]>
Commit | Line | Data |
---|---|---|
2a10b148 | 1 | void 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"); | |
f5a49e9b | 62 | if (gAlice) cout<<"AliRun object found on file"<<endl; |
fe4da5cc | 63 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); |
64 | } | |
f5a49e9b | 65 | |
66f93042 | 66 | AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); |
67 | if (pMUON) { | |
68 | // creation | |
69 | AliMUONMerger* merger = new AliMUONMerger(); | |
70 | // configuration | |
2a10b148 | 71 | if (ibg) { |
72 | merger->SetMode(ibg); | |
73 | merger->SetBackgroundFileName("bg.root"); | |
74 | } | |
75 | // pass | |
66f93042 | 76 | pMUON->SetMerger(merger); |
77 | } | |
78 | // Action ! | |
3f2e2671 | 79 | // |
80 | // Loop over events | |
81 | // | |
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; | |
2a10b148 | 88 | Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1)); |
89 | ||
90 | if (ibg) { | |
91 | merger->SetBackgroundEventNumber(nbgr_ev); | |
92 | } | |
93 | ||
f5a49e9b | 94 | gAlice->SDigits2Digits("MUON"); |
3f2e2671 | 95 | |
f5a49e9b | 96 | // Tree writing was moved to AliMUON::SDigits2Digits(); |
3f2e2671 | 97 | |
98 | } // event loop | |
a897a37a | 99 | } |
fe4da5cc | 100 | |
fe4da5cc | 101 | |
fe4da5cc | 102 | |
fe4da5cc | 103 | |
fe4da5cc | 104 | |
fe4da5cc | 105 | |
fe4da5cc | 106 | |
fe4da5cc | 107 | |
fe4da5cc | 108 | |
fe4da5cc | 109 | |
fe4da5cc | 110 | |
111 | ||
fe4da5cc | 112 | |
fe4da5cc | 113 |