]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONtracking.C
Transition to NewIO
[u/mrichter/AliRoot.git] / MUON / MUONtracking.C
CommitLineData
a9e2aefa 1void MUONtracking (Int_t evNumber1=0, Int_t evNumber2=99, Int_t idres=116, Int_t ireadgeant=1, Int_t ibgr=1, Int_t nev_bgd=10)
2{
3 //////////////////////////////////////
4 // //
5 // ROOT macro for ALICE Dimuon Arm: //
6 // Track reconstruction //
7 // //
8 //////////////////////////////////////
9 //
10 // Reconstructs tracks from events in the ROOT file "galice.root".
11 // Track reconstruction is performed (argument "ireadgeant")
12 // either directly from GEANT hits (tree TH),
13 // or from raw clusters (tree TR) constructed from digits (tree TD).
14 // Eventually (argument "ibgr"), background GEANT hits
15 // are also taken into account from the ROOT file "galice_bgr.root".
16 //
17 // Arguments:
18 // evNumber1 = first event number to act on in file "galice.root"
19 // evNumber2 = last event number to act on in file "galice.root"
20 // idres : used for statistics
21 // = 116 for Upsilon
22 // = 114 for J/Psi
23 // ireadgeant = 1 to reconstruct tracks directly from GEANT hits
24 // = 0 to reconstruct tracks from raw clusters
25 // ibg : used only if "ireadgeant" = 1
26 // = 0 if no background GEANT hits to be taken into account;
27 // = 1 if background GEANT hits
28 // to be taken into account in file "galice_bgr.root"
29 // used only if "ireadgeant" = 1
30 // nev_bgd : used only if "ireadgeant" = 1 and "ibg" = 1
31 // = number of events in the background file "galice_bgr.root";
32 // successive signal events are mixed
33 // with different background events in file "galice_bgr.root",
34 // starting from event number 0,
35 // incrementing it by 1 till event number ("nev_bgd" - 1),
36 // continuing with event number 0 and so on.
37 // Strictly speaking, "nev_bgd" can be smaller than
38 // the number of events in the background file,
39 // in which case one will only use
40 // the first "nev_bgd" events of the background file.
41 // But it SHOULD NOT BE LARGER THAN
42 // THE ACTUAL NUMBER OF EVENTS IN THE BACKGROUND FILE.
43 //
44 // Input file(s):
45 // "galice.root" for GEANT hits or raw clusters
46 // "galice_bgr.root" for background GEANT hits
47 // (used only if "ireadgeant" = 1 and "ibg" = 1)
48 //
49 // Output file:
50 // "reconst.root" for ROOT ntuples
51 //
52 //__________________________________________________________________________
53
54// Dynamically link some shared libs
55
56 if (gClassTable->GetID("AliRun") < 0) {
57 gROOT->LoadMacro("loadlibs.C");
58 loadlibs();
59 }
60// Connect the Root Galice file containing Geometry, Kine and Hits
61
62 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
63
64 if (!file) {
65 printf("\n Creating galice.root \n");
66 file = new TFile("galice.root");
67 } else { printf("\n galice.root found in file list");
68 }
69
70// Get AliRun object from file or create it if not on file
71 if (!gAlice) {
72 gAlice = (AliRun*)(file->Get("gAlice"));
73 if (gAlice) printf("AliRun object found on file\n");
74 if (!gAlice) {
75 printf("\n create new gAlice object");
76 gAlice = new AliRun("gAlice","Alice test program");
77 }
78 }
79
80// seff = efficiency per chamber (ireadgeant=1)
81 Double_t seff = 1;
82 // Double_t seff = 1.;
83// sb0 = magn. field in dipole, sbl3 = magn. field in L3
84// necessary for trackfinding only.
85 Double_t sb0 = 0.7;
86 Double_t sbl3 = 0.2;
87
88// ifit = 0 trackfinding only
89// ifit = 1 trackfinding + fit
90 Int_t ifit = 1;
91// idebug = 0,1,2 print level for reco_muon.F
92 Int_t idebug = 1;
93
94 AliMUON *MUON = (AliMUON*) gAlice->GetModule("MUON");
95 AliMUONTrackReconstructor *Reconstruction = new AliMUONTrackReconstructor();
96 Int_t nparticles = gAlice->GetEvent(evNumber1);
97 if (nparticles <= 0) return;
98
99 Reconstruction->Init(seff,sb0,sbl3);
100
101// Loop over events
102//
103 Int_t inev_bgd=0;
104
105 for (Int_t nev= evNumber1; nev<= evNumber2; nev++)
106 {
107 printf("nev=%d\n",nev);
108 if (nev != evNumber1) Int_t nparticles = gAlice->GetEvent(nev);
109 if (nev < evNumber1) continue;
110 if (nparticles <= 0) return;
111 Reconstruction->FinishEvent();
112 if (ireadgeant==1 && ibgr==1) {
113 if (inev_bgd==nev_bgd) inev_bgd=0;
114 Reconstruction->Reconst(ifit,idebug,inev_bgd,nev,idres,ireadgeant,"Add","galice_bgr.root");
115 Reconstruction->FinishEvent();
116 inev_bgd++;
117 }
118 else {
119 // printf("ireadgeant=%d\n",ireadgeant);
120 Reconstruction->Reconst(ifit,idebug,inev_bgd,nev,idres,ireadgeant,"rien1","rien2");
121 Reconstruction->FinishEvent();
122
123 }
124
125 } // event loop
126
127 Reconstruction->Close();
128}
129
130
131