The standard ECAL reconstruction has been developed in the ARTE framework. For some specific applications, such as SLT triggering on reconstructed clusters, online pi0 calibration, DB interface, data analysis outside the ARTE framework and more, the ECAL reconstruction has been extracted from the standard framework and the missing needed pieces have been re-implemented. Actually the core of the ARTE and ONLINE ECAL code is exactly the same and only few minor changes were needed for the different environments.
The main operation performed by this package is to cluster the information the hit cells of the calorimeter according to their measured energy and to classify afterwards the clusters of hit cells found. Therefore the main output of the reconstruction is a list of hit cells and a list of clusters.
In order to use the care package, you have to do these few operations on your code, on your Makefile (both compiling and linking steps) and your environment:
Let's start with the code:
/* C style function prototype */ int ecalinit(int argc, char * argv); or // C++ style extern "C" int ecalinit(int argc, const char * argv);
Input parameters are the same as the int main(int argc, char ** argv) function
Return value is a code equal to 0 for a successful initialisation.
During initialisation of the code the ECAL geometry files and the calibration DB is read in.
If you are using the dmon-user framework, the best place to put this call is in the int dmonuser_init(int argc, char **argv) function.
Here there is a list of command line arguments (or just arguments) that can be understood by ecalinit.
/* C style function prototype */ int ecalevnt(EVENT_HDR *event, int length); or // C++ style extern "C" int ecalevnt(EVENT_HDR *event, int length);
Input parameters are the event header pointer and the event length. Return value is a code equal to 0 for a successful reconstruction.
After this call the hit cell list and the cluster list are available for the user needs. (see here to know how to access internal data structures).
If you are using the dmon-user framework, the best place to put this call is in the int dmonuser_event(EVENT_HDR *event, int length) function whose passed parameters match exactly those needed by ecalevnt.
/* C style function prototype */ int ecalstop(); or // C++ style extern "C" int ecalstop();
There are no input parameters. Return value is a code equal to 0 for a successful reconstruction.
If you are using the dmon-user framework, the best place to put this call is in the int dmonuser_halt() function.
In order to link your code with the ECAL reconstruction, you have to link with g++ or with eg++.
If you are working in C, there are no particular things you have to do and the interactions between user code and the package are those permitted by the few interface routine provided.
If you are working in C++, since almost all the package has been written in that language, you gain in flexibility having more possibility to interact with the package but also you have to follow few conformance rules. If you need the include files they are in
At least those routines that directly call the CARE code must be compiled with the C++ options:
-DONLINE -fno-rtti -fno-exceptions
No ARTE includes are needed.
For linking please use eg++.
The CARE-ONLINE library is (platform independent address):
You have also to link the latest DATABASE and ONLINE libraries:
-L/afs/desy.de/group/hera-b/DATABASE/hblipcs3.0/$(BINTYPE)/lib -ldbcs -ldb
No ARTE libraries are needed.
For the execution some ASCII configuration files are needed. They are in
Be aware that they are not the same as the old ones! During execution these files are searched in a subdir named ECAL of the current directory. Therefore you have to create a directory "ECAL" (or a link "ECAL" to the mentioned place).
In order to select which ECAL calibration DB to use, a global environment variable (HBECALDB) can be set. If you just need the default, do nothing. You'll get the default DB which is now the rpm db /ECAL_CALIB. You can even set it directly, if you like it, as:
setenv HBECALDB /ECAL_CALIB
depending on your shell.
The initialisation routine ecalinit can receive few specifications on which particular calibration data to load. This can be done passing directly the command line arguments to the routine or providing the specification through an emulation of the command line arguments. All commands are optional.
The commands understood by the internal parser are:
-ECALmajor 10044 -ECALminor 1
-ECALDB:/ECAL_TEST -ECALmajor 9780
int ecalinit(int argc, char * argv); /* initialisation of ECAL code */ int ecalevnt(EVENT_HDR event, int length); /* ECAL event reconstruction */ int ecalstop(); /* end of ecal processing */
float* ecalenergies(); /* return the address of an (internal, readonly) array of 4 floats containing: respectively all ECAL energy, inner, middle and outer one */ float ecalenergy(); /* return the energy measured by the whole ECAL in GeV */ float ecalinner(); /* return the energy measured by the inner ECAL in GeV */ float ecalmiddle(); /* return the energy measured by the middle ECAL in GeV */ float ecalouter(); /* return the energy measured by the outer ECAL in GeV */
int ecalhits(HITC **hitcp); /* return the number of hitc found as well as the address of the first HITC entry Input: none Output: *hitcp : address of the first HITC entry (internal structures) return value:number of valid HITC entries Precondition: ecalevnt already executed for the current event */ int ecalclusters(RCCL **rcclp); /* return the number of clusters found as well as the address of the first RCCL entry Input: none Output: *rcclp : address of the first RCCL entry (internal structures) return value:number of valid RCCL entries Precondition: ecalevnt already executed for the current event */ int rccl2hitc(int rccl); /* return the first HITC entry of a given cluster Input: rccl : sequential number of cluster (from 0 to ecalclusters(rcclp)-1) Output: return value: index of the most important hit cell in a cluster (from 0 to ecalhits(hitcp) ) (-1 in case of failures). Precondition: ecalevnt already executed for the current event */
If you need cuts customisation, all the relevant cuts are defined during the initialisation in
The most important ones, you may want to change, are: