Calibration object updated
[u/mrichter/AliRoot.git] / ZDC / ZDCD2R2f.C
CommitLineData
20100b10 1// ------------------------------------------------------------
2// Macro for ZDC reconstruction
3// ------------------------------------------------------------
4void ZDCD2R2f(Int_t totnev=1, const char *filedig="ZDCdigits.root",
5 const char *filerec="ZDCreco.root")
6{
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 }
15
16 // Connect the Root Galice file containing Geometry, Kine, Hits and Digits
17 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
18 if (!file) {
19 printf("\n Creating galice.root \n");
20 file = new TFile("galice.root");
21 } else {
22 printf("\n galice.root found in file list");
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");
32 }
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
58}
59
60
61
62
63
64