86 |
calling {\bf Setup} at the beginning of the analysis, {\bf OnGood} and {\bf |
calling {\bf Setup} at the beginning of the analysis, {\bf OnGood} and {\bf |
87 |
OnBad} for every event (depending on the selection result), and {\bf Finalize} |
OnBad} for every event (depending on the selection result), and {\bf Finalize} |
88 |
at the end of the analysis. In all other aspects, it behaves exactly as {\bf |
at the end of the analysis. In all other aspects, it behaves exactly as {\bf |
89 |
PamCutCollection}.\\ |
PamCutCollection}. The handling of the actions depend on their position with |
90 |
|
respect to cuts. In the main analysis code, cuts can be added to the |
91 |
|
collection; then, an action or more can be added. This sequence of cuts and the |
92 |
|
actions added after the cuts will be called a bunch. The last bunch may have no |
93 |
|
actions at its end. |
94 |
|
\begin{verbatim} |
95 |
|
. |
96 |
|
. |
97 |
|
. |
98 |
|
Cut1 cut1(``cut1''); |
99 |
|
Cut2 cut2(``cut2''); |
100 |
|
Action1 action1(``action1''); |
101 |
|
|
102 |
|
Cut1 cut3(``cut3''); |
103 |
|
Cut2 cut4(``cut4''); |
104 |
|
Cut1 cut5(``cut5''); |
105 |
|
Cut2 cut6(``cut6''); |
106 |
|
Action1 action2(``action2''); |
107 |
|
Action1 action3(``action3''); |
108 |
|
. |
109 |
|
. |
110 |
|
. |
111 |
|
\end{verbatim} |
112 |
|
In the example above, {\bf cut1}, {\bf cut2} and {\bf action1} are the first |
113 |
|
bunch, {\bf cut3}, {\bf cut4}, {\bf cut5}, {\bf cut6}, {\bf action2} and {\bf |
114 |
|
action3} are the second bunch and so on. If all the cuts in the bunch are |
115 |
|
successful, the {\bf SmartCollection} will call {\bf OnGood} for every action |
116 |
|
in that bunch, and then the analysis will go on with the next bunch for the same |
117 |
|
event. If a certain cut in a bunch fails, then {\bf OnBad} is called for the |
118 |
|
actions of the bunch, but successive bunches are ignored; the current event is |
119 |
|
discarded and the focus switches on the next one (the {\bf |
120 |
|
SmartBlindCollection} behaves a little different; see the Doxygen |
121 |
|
documentation for more details.) |
122 |
|
\\ |
123 |
Loosely speaking, after defining an action one simply has to instantiate it, |
Loosely speaking, after defining an action one simply has to instantiate it, |
124 |
add it to a {\bf SmartCollection} and launch the analysis (fire and |
add it to a {\bf SmartCollection} and launch the analysis. |
|
forget\ldots). |
|
125 |
|
|
126 |
\section{The software organization} |
\section{The software organization} |
127 |
The software is organized in a tree of directories. The idea is that each node |
The software is organized in a tree of directories. The idea is that each node |
534 |
implementations of actions if you need some example to setup your build. |
implementations of actions if you need some example to setup your build. |
535 |
|
|
536 |
\section{How to build and use the library} |
\section{How to build and use the library} |
537 |
|
\subsection{Standard Pamela environment} |
538 |
If the makefiles are correctly set up, the only remaining thing is to type |
If the makefiles are correctly set up, the only remaining thing is to type |
539 |
\verb1make all1. Remember to set the PAMELA environment with the set\_pam\_env |
\verb1make all1. Remember to set the PAMELA environment with the set\_pam\_env |
540 |
script BEFORE invoking \verb1make1. This will generate a {\it libPamCut.so} file |
script BEFORE invoking \verb1make1. This will generate a {\it libPamCut.so} file |
541 |
which will contain all the cuts. To clean the project and build from scratch |
which will contain all the cuts. To clean the project and build from scratch |
542 |
type \verb1make clean all1. To use the library in an analysis code the |
type \verb1make clean all1. The software can then be installed in the usual |
543 |
|
Pamela environment calling \verb1make install1: this will place all the |
544 |
|
headers in the folder \verb1$PAM_INC/PamCut1 and the {\it libPamCut.so} file in |
545 |
|
\verb1$PAM_LIB1. To eliminate the installed files call \verb1make distclean1; |
546 |
|
note that this will NOT do the work of \verb1make clean1, eg., clean the |
547 |
|
project, but simply remove the files copied in the Pamela directories. Remember |
548 |
|
to type \verb1make install1 each time you modify and recompile the software, to |
549 |
|
upgrade the installed version to the new one. |
550 |
|
|
551 |
|
To use the library in an analysis code the |
552 |
environment header must be included in the code: |
environment header must be included in the code: |
553 |
\verb1#include "<root PamCutdirectory>/PamCutEnv.h"1. With this, all the |
\verb1#include "<root PamCutdirectory>/PamCutEnv.h"1. With this, all the |
554 |
classes and common definitions will be accessible. A typical usage of {\bf |
classes and common definitions will be accessible. A typical usage of {\bf |
555 |
PamCut} inside the analysis code would look like: |
PamCut} inside the analysis code would look like: |
556 |
|
|
557 |
\begin{verbatim} |
\begin{verbatim} |
558 |
|
|
559 |
|
#include <PamCut/PamCutEnv.h> |
560 |
|
|
561 |
|
int main(){ |
562 |
|
. |
563 |
|
. |
564 |
|
. |
565 |
|
|
566 |
PamCutCollection collection; |
PamCutCollection collection; |
567 |
|
|
568 |
DummyCut1 dummy1; |
DummyCut1 dummy1; |
572 |
|
|
573 |
collection.Process(event, 0, event->GetEntries()-1); |
collection.Process(event, 0, event->GetEntries()-1); |
574 |
|
|
575 |
|
. |
576 |
|
. |
577 |
|
. |
578 |
|
} |
579 |
|
|
580 |
\end{verbatim} |
\end{verbatim} |
581 |
|
|
582 |
In the simple example above a \verb1DummyCut11 and a \verb1DummyCut21 object |
In the simple example above a \verb1DummyCut11 and a \verb1DummyCut21 object |
583 |
(which requires some sort of parameter) are instantiated. They are added to |
(which requires some sort of parameter) are instantiated. They are added to |
584 |
\verb1collection1 which takes care of applying them to all the events. |
\verb1collection1 which takes care of applying them to all the events. |
585 |
|
|
586 |
When the analysis code is compiled the linker must be aware that it |
\subsection{Custom environment} |
587 |
needs a library called {\it libPamCut.so} and where to find it. In the {\it |
If you don't have access to the Pamela software directories (eg., you don't |
588 |
makefile} which builds the analysis program the following option must be added |
have write permission on them) you cannot install the software; but you can |
589 |
to the linker invocation: |
still use PamCut directly from the source folder. |
590 |
|
|
591 |
|
First of all, you have to tell the compiler where to find the {\bf PamCut}'s |
592 |
|
headers. They are in the main {\bf PamCut} directory, so you may add this |
593 |
|
option: |
594 |
\newline |
\newline |
595 |
\verb1-L<root PamCut directory> -lPamCut1. |
\verb1 -I<directory>1 |
596 |
|
\newline |
597 |
One could also wish to move {\it libPamCut.so} to another directory: this path |
to the compiler invocation in the {\it makefile} of your main analysis program. |
598 |
must then replace what is indicated as \verb1<root PamCut directory>1 above. |
This tells the compiler to search for headers in the folder specified after |
599 |
|
\verb1-I1. So, if {\it <directory>} is the folder which contains the {\bf |
600 |
|
PamCut}'s main folder, you don't have to change anything in your main analysis |
601 |
|
file (with respect to what described in the previous subsection), since: |
602 |
|
\newline |
603 |
|
\verb1 #include <PamCut/PamCutEnv.h>1 |
604 |
|
\newline |
605 |
|
includes the file {\it PamCutEnv.h} which is in the folder {\it PamCut} in the |
606 |
|
standard inclusion directories, one of which is the one specified with the |
607 |
|
\verb1-I1 compiler directive. Obviously, one can play with directories, having |
608 |
|
care to indicate the right paths to the compiler |
609 |
|
|
610 |
Finally, when the analysis code is compiled and linked against libPamCut.so, to |
The following option must be added to the linker invocation: |
611 |
|
\newline |
612 |
|
\verb1 -L<root PamCut directory> -lPamCut1. |
613 |
|
\newline |
614 |
|
to tell the linker where the dynamic library is. |
615 |
|
|
616 |
|
Then, when the analysis code is compiled and linked against libPamCut.so, to |
617 |
launch it it's necessary to tell the environment where the library is, so that |
launch it it's necessary to tell the environment where the library is, so that |
618 |
the program can dynamically access it at runtime. This information is encoded |
the program can dynamically access it at runtime. This information is encoded |
619 |
in the environment variable LD\_LIBRARY\_PATH, which contains the paths of the |
in the environment variable LD\_LIBRARY\_PATH, which contains the paths of the |