1 void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
3 //////////////////////////////////////
5 // ROOT macro for ALICE Dimuon Arm: //
8 //////////////////////////////////////
10 // Adds the tree TD for digits (charges deposited on pads)
11 // to the ROOT file "galice.root"
12 // containing the signal hit coordinates from simulation (tree TH).
13 // Eventually (argument "ibg"), background hits are also taken into account,
14 // from the ROOT file "bg.root".
17 // evNumber1 = first event number to digitize in file "galice.root"
18 // evNumber2 = last event number to digitize in file "galice.root"
19 // ibg = 0 if no background hits to be taken into account;
20 // = 1 if background hits to be taken into account
22 // bgr : used only if "ibg" = 1
23 // = number of events in the background file "bg.root";
24 // the signal events are divided into "bgr" successive parts,
25 // all events of each part are associated
26 // with the same background event,
27 // starting with event number 0,
28 // incrementing it by 1 for the next part.
29 // Strictly speaking, "bgr" can be smaller than
30 // the number of events in the background file,
31 // in which case one will only use
32 // the first "bgr" events of the background file.
33 // But it SHOULD NOT BE LARGER THAN
34 // THE NUMBER OF EVENTS IN THE BACKGROUND FILE.
37 // "galice.root" for signal
38 // "bg.root" for background (used only if "ibg" = 1)
43 //__________________________________________________________________________
45 // Dynamically link some shared libs
47 if (gClassTable->GetID("AliRun") < 0) {
48 gROOT->LoadMacro("loadlibs.C");
52 // Connect the Root Galice file containing Geometry, Kine and Hits
54 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
55 if (file) file->Close();
56 file = new TFile("galice.root","UPDATE");
58 // Get AliRun object from file or create it if not on file
61 gAlice = (AliRun*)file->Get("gAlice");
62 if (gAlice) cout<<"AliRun object found on file"<<endl;
63 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
66 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
69 AliMUONMerger* merger = new AliMUONMerger();
73 merger->SetBackgroundFileName("bg.root");
76 pMUON->SetMerger(merger);
82 for (int nev=evNumber1; nev<= evNumber2; nev++) {
83 Int_t nparticles = gAlice->GetEvent(nev);
84 cout << "nev " << nev <<endl;
85 cout << "nparticles " << nparticles <<endl;
86 if (nev < evNumber1) continue;
87 if (nparticles <= 0) return;
88 Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
91 merger->SetBackgroundEventNumber(nbgr_ev);
94 gAlice->SDigits2Digits("MUON");
96 // Tree writing was moved to AliMUON::SDigits2Digits();