]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONdigit.C
Comments put back
[u/mrichter/AliRoot.git] / MUON / MUONdigit.C
CommitLineData
2a10b148 1void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
fe4da5cc 2{
9898d2ee 3 //////////////////////////////////////
4 // //
5 // ROOT macro for ALICE Dimuon Arm: //
6 // Digitization //
7 // //
8 //////////////////////////////////////
9 //
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".
15 //
16 // Arguments:
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
21 // in file "bg.root"
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.
35 //
36 // Input file(s):
37 // "galice.root" for signal
38 // "bg.root" for background (used only if "ibg" = 1)
39 //
40 // Output file:
41 // "galice.root"
42 //
43 //__________________________________________________________________________
44
fe4da5cc 45// Dynamically link some shared libs
46
47 if (gClassTable->GetID("AliRun") < 0) {
a897a37a 48 gROOT->LoadMacro("loadlibs.C");
49 loadlibs();
fe4da5cc 50 }
51
52// Connect the Root Galice file containing Geometry, Kine and Hits
53
54 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
55 if (file) file->Close();
56 file = new TFile("galice.root","UPDATE");
fe4da5cc 57
58// Get AliRun object from file or create it if not on file
59
60 if (!gAlice) {
61 gAlice = (AliRun*)file->Get("gAlice");
a897a37a 62 if (gAlice) printf("AliRun object found on file\n");
fe4da5cc 63 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
64 }
66f93042 65 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON");
66 if (pMUON) {
67// creation
68 AliMUONMerger* merger = new AliMUONMerger();
69// configuration
2a10b148 70 if (ibg) {
71 merger->SetMode(ibg);
72 merger->SetBackgroundFileName("bg.root");
73 }
74 // pass
66f93042 75 pMUON->SetMerger(merger);
76 }
77// Action !
3f2e2671 78//
79// Loop over events
80//
81 for (int nev=evNumber1; nev<= evNumber2; nev++) {
82 Int_t nparticles = gAlice->GetEvent(nev);
83 cout << "nev " << nev <<endl;
84 cout << "nparticles " << nparticles <<endl;
85 if (nev < evNumber1) continue;
86 if (nparticles <= 0) return;
2a10b148 87 Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
88
89 if (ibg) {
90 merger->SetBackgroundEventNumber(nbgr_ev);
91 }
92
3f2e2671 93 gAlice->SDigits2Digits();
94
95 char hname[30];
96 sprintf(hname,"TreeD%d",nev);
97 gAlice->TreeD()->Write(hname);
98 // reset tree
99 gAlice->TreeD()->Reset();
100
101 } // event loop
a897a37a 102}
fe4da5cc 103
fe4da5cc 104
fe4da5cc 105
fe4da5cc 106
fe4da5cc 107
fe4da5cc 108
fe4da5cc 109
fe4da5cc 110
fe4da5cc 111
fe4da5cc 112
fe4da5cc 113
114
fe4da5cc 115
fe4da5cc 116