We describe HowTo produce Digi.root and Recon.root files with Nevents number of events from ldf output files obtained with the on-line LATTE. The LatIntegration package of the EngineeringModel v3r0407p1 is used.
Always source cmt/setup.csh (or setup.sh) otherwise the shared-libraries are not loaded!

LDF files

The ldf files can be downloaded from our web server. Some of them (actually, the most interesting ones) are copied also into pcglast28 in a directory structure of the type /data28/glast/data/TowerX/3MMNNNNNN. This disk can be mounted via NFS from every pcglast computer via mount pcglast28:/data28 <mountpoint> (as root).

Digi files

To convert Nevents from a LDF file to Digi.root file, we first create a file ldf2digiNNN.txt (NNN = run number) in the LatIntegration/src directory. This file includes src/ldf2digi.txt. As an example the following file src/ldf2digi306000384.txt is created for run 306000384 and 500k events:
#include "$LATINTEGRATIONROOT/src/ldf2digi.txt"
EventSelector.StorageType = "EBFFILE";
EventSelector.InputList = { "/data28/glast/data/TowerA/306000384/041205012844.ldf" };
digiRootWriterAlg.digiRootFile = "306000384_041205012844_digi500k.root";
ApplicationMgr.EvtMax  = 500000;
ApplicationMgr.EvtMax set the number of events to be converted. A minimum of 500k events is necessary for the 2D hitmap to check the strips integrity, while 100k events (2h CPU on pcglast28) are sufficient for alignment and efficiency studies.

Then, to get the digi issue the command:
rh9-gcc32opt\LatIntegration src\ldf2digiNNN.txt

Recon files

To get Recon.root files, again, we use LatIntegration. We read input data from the digi.root file. The requested number of events in the recon.root file must be less or equal to the number of events in the digi file. As for digi, an individual file readigi_runreconNNN.txt (NNN = run number) is created in the LatIntegration/src directory which includes readigi_runrecon.txt:

#include "readigi_runrecon.txt"
digiRootReaderAlg.digiRootFile   = "306000384_041205012844_digi500k.root";
reconRootWriterAlg.reconRootFile = "306000384_041205012844_recon100k.root"; 
ApplicationMgr.EvtMax  = 100000;

Again issue the command:
rh9-gcc32opt\LatIntegration src\readigi_runreconNNN.txt

Since readigi_runrecon.txt, quickly accumulates a lot of memory (because of memory leaks in OnboardFilter, which actually doesn't filter anything) this OnboardFilter stuff can be commented. A readigi_runrecon.txt commented by M.Kuss can be downloaded from here. The difference with the $LATINTEGRATION/src/readigi_runrecon.txt (for curious only) is:

< //    "FilterAlg",
>     "FilterAlg",
< //    "EventIntegrityAlg",
< //    "EbfWriter",
< //    "OnboardFilter"
<     };
>     "EventIntegrityAlg",
>     "EbfWriter",
>     "OnboardFilter"};
< GlastDetSvc.xmlfile = "$(XMLGEODBSROOT)/xml/PisaTowerNoCal/1TowerSegVols.xml";
< //GlastDetSvc.xmlfile = "$(XMLGEODBSROOT)/xml/flight/flightSegVols.xml";
> GlastDetSvc.xmlfile    = "$(XMLGEODBSROOT)/xml/latAssembly/2TowerSegVols.xml";
< //OnboardFilter.mask=0; // all bits off by default: no rejection
> OnboardFilter.mask=0; // all bits off by default: no rejection

The files of the geometry description can be found in this tar file.
cd $(XMLGEODBSROOT)/xml and untar the contents. It should be the same as the standard 1TowerSegVols.xml, but it doesn't contain the calorimeter.

The tree

For alignment and efficiency studies both digi and recon data are necessary, but analyzing 100k events using the digi and recon files and RootTreeAnalysis is too slow. For this reason, we have decided to read the interesting quantities of the digi and recon file and merge them in a new tree.
In the RootAnalysis package of EngineeringModel v3r0407p1 we use the command:
../rh9_gcc32opt/runTreeMaker.exe digifile reconfile "" treefile numberofevents.
It merges the digi and recon file ("" is for a MonteCarlo file, eventually) and writes out the tree into a treefile. If numberofevents is not specified, all events are taken.
When reconstruction is not necessary, p.e. in the case of strip functionality studies where a 2D hitmap plot is sufficient, the tree is built up by using the digi file only:
../rh9_gcc32opt/runTreeMaker.exe digifile "" "" treefile numberofevents.