]>
Commit | Line | Data |
---|---|---|
6b55c9cb | 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 | ||
88cb7938 | 24 | void AliITSHits2FastRecPoints (Int_t evNumber1=0,Int_t evNumber2=0, TString inFile = "galice.root", Int_t nsignal=25, Int_t size=-1) |
af8e1c2d | 25 | { |
cc2535cd | 26 | ///////////////////////////////////////////////////////////////////////// |
27 | // | |
6b55c9cb | 28 | // This macro creates fast recpoints |
cc2535cd | 29 | // |
30 | ///////////////////////////////////////////////////////////////////////// | |
31 | ||
88cb7938 | 32 | |
cc2535cd | 33 | // Dynamically link some shared libs |
34 | ||
35 | if (gClassTable->GetID("AliRun") < 0) { | |
6b55c9cb | 36 | gInterpreter->ExecuteMacro("loadlibs.C"); |
cc2535cd | 37 | } |
6b55c9cb | 38 | else { |
39 | if(gAlice){ | |
33c3c91a | 40 | delete AliRunLoader::Instance(); |
6b55c9cb | 41 | delete gAlice; |
42 | gAlice=0; | |
43 | } | |
44 | } | |
45 | ||
46 | ||
47 | // Get geometry | |
48 | AliGeomManager::LoadGeometry("geometry.root"); | |
cc2535cd | 49 | |
50 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
6b55c9cb | 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 | } | |
88cb7938 | 57 | |
6b55c9cb | 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()); | |
88cb7938 | 78 | |
6b55c9cb | 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 | } | |
88cb7938 | 102 | |
00a7cc50 | 103 | |
00a7cc50 | 104 | |
105 | ||
6b55c9cb | 106 | AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); |
107 | if (!ITS) return; | |
af8e1c2d | 108 | |
109 | // Set the simulation model | |
110 | ||
af8e1c2d | 111 | |
112 | ||
cc2535cd | 113 | // |
114 | // Event Loop | |
115 | // | |
116 | ||
cc2535cd | 117 | TStopwatch timer; |
118 | ||
119 | cout << "Creating fast reconstructed points from hits for the ITS..." << endl; | |
00a7cc50 | 120 | AliITSDetTypeSim* dettyp = new AliITSDetTypeSim(); |
00a7cc50 | 121 | dettyp->SetLoader(gime); |
f7f7391b | 122 | dettyp->SetITSgeom(geom); |
00a7cc50 | 123 | ITS->SetDetTypeSim(dettyp); |
124 | for (Int_t i=0;i<3;i++) { | |
125 | ITS->SetSimulationModel(i,new AliITSsimulationFastPoints()); | |
126 | } | |
cc2535cd | 127 | |
00a7cc50 | 128 | |
cc2535cd | 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; | |
88cb7938 | 134 | rl->GetEvent(ev); |
00a7cc50 | 135 | //if(gime->TreeR() == 0x0) gime->MakeTree("R"); |
136 | ||
6b55c9cb | 137 | if (ev < evNumber1) continue; |
cc2535cd | 138 | if (nparticles <= 0) return; |
139 | ||
140 | Int_t bgr_ev=Int_t(ev/nsignal); | |
cc2535cd | 141 | timer.Start(); |
142 | ITS->HitsToFastRecPoints(ev,bgr_ev,size," ","All"," "); | |
143 | timer.Stop(); timer.Print(); | |
144 | } // event loop | |
145 | ||
88cb7938 | 146 | delete rl; |
af8e1c2d | 147 | } |
148 |