]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONdigit.C
Code from MUON-dev joined
[u/mrichter/AliRoot.git] / MUON / MUONdigit.C
CommitLineData
a897a37a 1#include "iostream.h"
2
a9e2aefa 3void MUONdigit (Int_t evNumber1=0, Int_t evNumber2=9, Int_t ibg=1, Int_t bgr=10)
fe4da5cc 4{
a9e2aefa 5 //////////////////////////////////////
6 // //
7 // ROOT macro for ALICE Dimuon Arm: //
8 // Digitization //
9 // //
10 //////////////////////////////////////
11 //
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".
17 //
18 // Arguments:
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.
37 //
38 // Input file(s):
39 // "galice.root" for signal
40 // "galice_bgr.root" for background (used only if "ibg" = 1)
41 //
42 // Output file:
43 // "galice.root"
44 //
45 //__________________________________________________________________________
fe4da5cc 46
47// Dynamically link some shared libs
48
49 if (gClassTable->GetID("AliRun") < 0) {
a897a37a 50 gROOT->LoadMacro("loadlibs.C");
51 loadlibs();
fe4da5cc 52 }
53
54// Connect the Root Galice file containing Geometry, Kine and Hits
55
56 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
57 if (file) file->Close();
58 file = new TFile("galice.root","UPDATE");
fe4da5cc 59
60// Get AliRun object from file or create it if not on file
61
62 if (!gAlice) {
63 gAlice = (AliRun*)file->Get("gAlice");
a897a37a 64 if (gAlice) printf("AliRun object found on file\n");
fe4da5cc 65 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
66 }
a897a37a 67 printf ("I'm after gAlice \n");
68
69 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON");
a9e2aefa 70
fe4da5cc 71//
a897a37a 72// Event Loop
fe4da5cc 73//
a9e2aefa 74 Int_t nbgr_ev = 0;
a897a37a 75
a9e2aefa 76 for (int nev=evNumber1; nev<= evNumber2; nev++) {
fe4da5cc 77 Int_t nparticles = gAlice->GetEvent(nev);
78 cout << "nev " <<nev<<endl;
a9e2aefa 79 cout << "nparticles " <<nparticles<<endl;
fe4da5cc 80 if (nparticles <= 0) return;
81
a9e2aefa 82 nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
83
84 if (ibg) {
85 printf("nbgr_ev %d\n",nbgr_ev);
86 if (MUON) MUON->Digitise(nev,nbgr_ev,"Add"," ","galice_bgr.root");
87 } else {
88 if (MUON) MUON->Digitise(nev,nbgr_ev,"rien"," ","galice_bgr.root");
89 }
90
a897a37a 91 } // event loop
92 file->Close();
93}
fe4da5cc 94
fe4da5cc 95
fe4da5cc 96
fe4da5cc 97
fe4da5cc 98
fe4da5cc 99
fe4da5cc 100
fe4da5cc 101
fe4da5cc 102
fe4da5cc 103
fe4da5cc 104
105
fe4da5cc 106
fe4da5cc 107