3 void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=9, Int_t ibg=1, Int_t bgr=10)
5 //////////////////////////////////////
7 // ROOT macro for ALICE Dimuon Arm: //
10 //////////////////////////////////////
12 // Adds the tree TD for digits (charges deposited on pads)
13 // to the ROOT file "galice.root"
14 // containing the signal hit coordinates from simulation (tree TH).
15 // Eventually (argument "ibg"), background hits are also taken into account,
16 // from the ROOT file "galice_bgr.root".
19 // evNumber1 = first event number to digitize in file "galice.root"
20 // evNumber2 = last event number to digitize in file "galice.root"
21 // ibg = 0 if no background hits to be taken into account;
22 // = 1 if background hits to be taken into account
23 // in file "galice_bgr.root"
24 // bgr : used only if "ibg" = 1
25 // = number of events in the background file "galice_bgr.root";
26 // the signal events are divided into "bgr" successive parts,
27 // all events of each part are associated
28 // with the same background event,
29 // starting with event number 0,
30 // incrementing it by 1 for the next part.
31 // Strictly speaking, "bgr" can be smaller than
32 // the number of events in the background file,
33 // in which case one will only use
34 // the first "bgr" events of the background file.
35 // But it SHOULD NOT BE LARGER THAN
36 // THE NUMBER OF EVENTS IN THE BACKGROUND FILE.
39 // "galice.root" for signal
40 // "galice_bgr.root" for background (used only if "ibg" = 1)
45 //__________________________________________________________________________
47 // Dynamically link some shared libs
49 if (gClassTable->GetID("AliRun") < 0) {
50 gROOT->LoadMacro("loadlibs.C");
54 // Connect the Root Galice file containing Geometry, Kine and Hits
56 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
57 if (file) file->Close();
58 file = new TFile("galice.root","UPDATE");
60 // Get AliRun object from file or create it if not on file
63 gAlice = (AliRun*)file->Get("gAlice");
64 if (gAlice) printf("AliRun object found on file\n");
65 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
67 printf ("I'm after gAlice \n");
69 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON");
76 for (int nev=evNumber1; nev<= evNumber2; nev++) {
77 Int_t nparticles = gAlice->GetEvent(nev);
78 cout << "nev " <<nev<<endl;
79 cout << "nparticles " <<nparticles<<endl;
80 if (nparticles <= 0) return;
82 nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
85 printf("nbgr_ev %d\n",nbgr_ev);
86 if (MUON) MUON->Digitise(nev,nbgr_ev,"Add"," ","galice_bgr.root");
88 if (MUON) MUON->Digitise(nev,nbgr_ev,"rien"," ","galice_bgr.root");