]>
Commit | Line | Data |
---|---|---|
1 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
2 | ||
3 | #include <Riostream.h> | |
4 | #include<TClassTable.h> | |
5 | #include <TError.h> | |
6 | #include <TInterpreter.h> | |
7 | #include <TStopwatch.h> | |
8 | #include <TString.h> | |
9 | #include "AliRun.h" | |
10 | #include "AliRunLoader.h" | |
11 | #include "AliITS.h" | |
12 | #include "AliITSInitGeometry.h" | |
13 | #include "AliITSgeom.h" | |
14 | #include "AliITSLoader.h" | |
15 | #include "AliITSsimulationFastPoints.h" | |
16 | #include "AliGeomManager.h" | |
17 | #endif | |
18 | ||
19 | /* | |
20 | $Id$ | |
21 | */ | |
22 | ||
23 | ||
24 | void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", Int_t nsignal=25, Int_t size=-1) | |
25 | { | |
26 | ///////////////////////////////////////////////////////////////////////// | |
27 | // | |
28 | // This macro creates fast recpoints | |
29 | // | |
30 | ///////////////////////////////////////////////////////////////////////// | |
31 | ||
32 | ||
33 | // Dynamically link some shared libs | |
34 | ||
35 | if (gClassTable->GetID("AliRun") < 0) { | |
36 | gInterpreter->ExecuteMacro("loadlibs.C"); | |
37 | } | |
38 | else { | |
39 | if(gAlice){ | |
40 | delete AliRunLoader::Instance(); | |
41 | delete gAlice; | |
42 | gAlice=0; | |
43 | } | |
44 | } | |
45 | ||
46 | ||
47 | // Get geometry | |
48 | AliGeomManager::LoadGeometry("geometry.root"); | |
49 | ||
50 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
51 | AliRunLoader* rl = AliRunLoader::Open(inFile.Data()); | |
52 | if (rl == 0x0) | |
53 | { | |
54 | Error("AliITSHits2FastRecPoints.C","Can not open session RL=NULL"); | |
55 | return; | |
56 | } | |
57 | ||
58 | Int_t retval = rl->LoadgAlice(); | |
59 | if (retval) | |
60 | { | |
61 | Error("AliITSHits2FastRecPoints.C","LoadgAlice returned error"); | |
62 | delete rl; | |
63 | return; | |
64 | } | |
65 | gAlice=rl->GetAliRun(); | |
66 | rl->LoadHeader(); | |
67 | retval = rl->LoadKinematics(); | |
68 | if (retval) | |
69 | { | |
70 | Error("AliITSHits2FastRecPoints.C","LoadKinematics returned error"); | |
71 | delete rl; | |
72 | return; | |
73 | } | |
74 | ||
75 | AliITSInitGeometry initgeom; | |
76 | AliITSgeom *geom = initgeom.CreateAliITSgeom(); | |
77 | printf("Geometry name: %s \n",(initgeom.GetGeometryName()).Data()); | |
78 | ||
79 | AliITSLoader* gime = (AliITSLoader*)rl->GetLoader("ITSLoader"); | |
80 | if (gime == 0x0) | |
81 | { | |
82 | ::Error("AliITSHits2FastRecPoints.C","can not get ITS loader"); | |
83 | delete rl; | |
84 | return; | |
85 | } | |
86 | gime->SetITSgeom(geom); | |
87 | retval = gime->LoadHits("read"); | |
88 | if (retval) | |
89 | { | |
90 | ::Error("AliITSHits2FastRecPoints.C","LoadHits returned error"); | |
91 | delete rl; | |
92 | return; | |
93 | } | |
94 | gime->SetRecPointsFileName("ITS.FastRecPoints.root"); | |
95 | retval = gime->LoadRecPoints("update"); | |
96 | if (retval) | |
97 | { | |
98 | ::Error("AliITSHits2FastRecPoints.C","LoadRecPoints returned error"); | |
99 | delete rl; | |
100 | return; | |
101 | } | |
102 | ||
103 | ||
104 | ||
105 | ||
106 | AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); | |
107 | if (!ITS) return; | |
108 | ||
109 | // Set the simulation model | |
110 | ||
111 | ||
112 | ||
113 | // | |
114 | // Event Loop | |
115 | // | |
116 | ||
117 | TStopwatch timer; | |
118 | ||
119 | cout << "Creating fast reconstructed points from hits for the ITS..." << endl; | |
120 | AliITSDetTypeSim* dettyp = new AliITSDetTypeSim(); | |
121 | dettyp->SetLoader(gime); | |
122 | dettyp->SetITSgeom(geom); | |
123 | ITS->SetDetTypeSim(dettyp); | |
124 | for (Int_t i=0;i<3;i++) { | |
125 | ITS->SetSimulationModel(i,new AliITSsimulationFastPoints()); | |
126 | } | |
127 | ||
128 | ||
129 | for (int ev=evNumber1; ev<= evNumber2; ev++) { | |
130 | cout << "...working on event "<< ev << " ..." << endl; | |
131 | Int_t nparticles = gAlice->GetEvent(ev); | |
132 | cout << "event " <<ev<<endl; | |
133 | cout << "nparticles " <<nparticles<<endl; | |
134 | rl->GetEvent(ev); | |
135 | //if(gime->TreeR() == 0x0) gime->MakeTree("R"); | |
136 | ||
137 | if (ev < evNumber1) continue; | |
138 | if (nparticles <= 0) return; | |
139 | ||
140 | Int_t bgr_ev=Int_t(ev/nsignal); | |
141 | timer.Start(); | |
142 | ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," "); | |
143 | timer.Stop(); timer.Print(); | |
144 | } // event loop | |
145 | ||
146 | delete rl; | |
147 | } | |
148 |