Correct initialization of the EM length (A.Gheata)
[u/mrichter/AliRoot.git] / ZDC / ZDCDigits2Reco.C
CommitLineData
a6643142 1// ------------------------------------------------------------
2// Macro for ZDC reconstruction
3// ------------------------------------------------------------
4void ZDCDigits2Reco(Int_t totnev=1, const char *filedig="ZDCdigits.root",
5 const char *filerec="ZDCreco.root")
a9902af0 6{
a6643142 7 delete gAlice;
8 gAlice=0;
9
10 // Dynamically link some shared libs
11 if (gClassTable->GetID("AliRun") < 0) {
12 gROOT->LoadMacro("loadlibs.C");
13 loadlibs();
14 }
a9902af0 15
a6643142 16 // Connect the Root Galice file containing Geometry, Kine, Hits and Digits
17 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
18 if (!file) {
a9902af0 19 printf("\n Creating galice.root \n");
a6643142 20 file = new TFile("galice.root");
21 } else {
a9902af0 22 printf("\n galice.root found in file list");
a6643142 23 }
24
25 // Get AliRun object from file or create it if not on file
26 if (!gAlice) {
27 gAlice = (AliRun*)file->Get("gAlice");
28 if (gAlice) printf("AliRun object found on file\n");
29 if (!gAlice) {
30 printf("\n create new gAlice object");
31 gAlice = new AliRun("gAlice","Alice test program");
a9902af0 32 }
a6643142 33 }
34 gAlice->SetTreeDFileName(filedig);
35 // File where SDigits and Digits Tree are written
36 TFile *file2 = gAlice->InitTreeFile("R",filerec);
37
38 AliZDC *ZDC = (AliZDC*) gAlice->GetModule("ZDC");
39 merger = new AliZDCMerger();
40 merger->SetMode(1);
41 merger->SetBackgroundFileName("galice.root");
42 ZDC->SetMerger(merger);
43 printf("\n AliZDCMerger set \n");
44
45 //
46 // Loop over events
47 //
48 for(Int_t iev=0; iev<totnev; iev++) {
49 gAlice->GetEvent(iev);
50 merger->SetBackgroundEventNum(iev);
51 printf(" iev = %d -> Background Event Num setted\n",iev);
52 gAlice->MakeTree("R",file2);
53 printf(" TreeR made\n");
54 ZDC->MakeBranch("R");
55 printf(" ZDC branch in TreeR made\n");
56 ZDC->Digits2Reco();
57 } // event loop
a9902af0 58}
a6643142 59
60
61
62
63
64