The ECAL reconstruction package for the ONLINE environment


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.

How to use the ONLINE care package

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:

  1. Start with initialising the reconstruction code with a call to the ecalinit function done once at the beginning of the data processing :
  2.   /* C style function prototype */
      int ecalinit(int argc, char * argv[]);
      // 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.

  3. The ecal event reconstruction can be obtained by a call to the ecalevnt function inside the event loop:
  4.   /* C style function prototype */
      int ecalevnt(EVENT_HDR *event, int length);
      // 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.


  5. Although not strictly necessary now, it is wise for future compatibility reasons to add a call to the ecalstop function at the end of the processing:
  /* C style function prototype */
  int ecalstop();

  // 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++.

Compiling the user code

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.

Linking the user code

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/$(BINTYPE)/lib -ldbcs -ldb

-L/afs/$(BINTYPE)/lib ....

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:




depending on your shell.


Command line arguments understood by ecalinit

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



Callable C functions


       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 */