]>
Commit | Line | Data |
---|---|---|
e69020a0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
b9d0a01d | 17 | |
e69020a0 | 18 | #include <TROOT.h> |
19 | #include <TFile.h> | |
20 | #include <TSeqCollection.h> | |
21 | #include <TString.h> | |
22 | #include <TClonesArray.h> | |
23 | ||
24 | #include "AliRun.h" | |
88cb7938 | 25 | #include "AliRunLoader.h" |
e69020a0 | 26 | |
27 | #include "AliITS.h" | |
28 | #include "AliITSDetType.h" | |
88cb7938 | 29 | #include "AliITSLoader.h" |
e69020a0 | 30 | #include "AliITSreconstruction.h" |
31 | #include "AliITSsegmentationSPD.h" | |
32 | #include "AliITSsegmentationSDD.h" | |
33 | #include "AliITSsegmentationSSD.h" | |
34 | #include "AliITSClusterFinderSPD.h" | |
35 | #include "AliITSClusterFinderSDD.h" | |
36 | #include "AliITSClusterFinderSSD.h" | |
37 | #include "AliITSresponseSDD.h" | |
38 | #include "AliITSgeom.h" | |
39 | ||
40 | ClassImp(AliITSreconstruction) | |
41 | ||
42 | //______________________________________________________________________ | |
88cb7938 | 43 | AliITSreconstruction::AliITSreconstruction(): |
44 | fInit(kFALSE), | |
45 | fEnt(0), | |
46 | fEnt0(0), | |
47 | fITS(0x0), | |
48 | fDfArp(kFALSE), | |
49 | fLoader(0x0), | |
50 | fRunLoader(0x0) | |
51 | { | |
e69020a0 | 52 | // Default constructor. |
53 | // Inputs: | |
54 | // none. | |
55 | // Outputs: | |
56 | // none. | |
57 | // Return: | |
58 | // A zero-ed constructed AliITSreconstruction class. | |
e69020a0 | 59 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
4d24e763 | 60 | } |
61 | //______________________________________________________________________ | |
4d24e763 | 62 | |
88cb7938 | 63 | AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl): |
64 | fInit(kFALSE), | |
65 | fEnt(0), | |
66 | fEnt0(0), | |
67 | fITS(0x0), | |
68 | fDfArp(kFALSE), | |
69 | fLoader(0x0), | |
70 | fRunLoader(rl) | |
71 | { | |
72 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
e69020a0 | 73 | } |
74 | //______________________________________________________________________ | |
88cb7938 | 75 | AliITSreconstruction::AliITSreconstruction(const char* filename): |
76 | fInit(kFALSE), | |
77 | fEnt(0), | |
78 | fEnt0(0), | |
79 | fITS(0x0), | |
80 | fDfArp(kFALSE), | |
81 | fLoader(0x0), | |
82 | fRunLoader(0x0) | |
83 | { | |
e69020a0 | 84 | // Standard constructor. |
85 | // Inputs: | |
86 | // const char* filename filename containing the digits to be | |
3e9ba728 | 87 | // reconstructed. If filename = 0 (nil) |
88 | // then no file is opened but a file is | |
89 | // assumed to already be opened. This | |
90 | // already opened file will be used. | |
e69020a0 | 91 | // Outputs: |
92 | // none. | |
93 | // Return: | |
94 | // A standardly constructed AliITSreconstruction class. | |
95 | ||
88cb7938 | 96 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
97 | ||
98 | fRunLoader = AliRunLoader::Open(filename); | |
99 | if (fRunLoader == 0x0) | |
100 | { | |
101 | Error("AliITSreconstruction","Can not load the session",filename); | |
102 | return; | |
103 | } | |
104 | fRunLoader->LoadgAlice(); | |
105 | gAlice = fRunLoader->GetAliRun(); | |
106 | ||
107 | if(!gAlice) { | |
108 | Error("AliITSreconstruction","gAlice not found on file. Aborting."); | |
109 | fInit = kFALSE; | |
110 | return; | |
111 | } // end if !gAlice | |
112 | ||
e69020a0 | 113 | } |
114 | //______________________________________________________________________ | |
115 | AliITSreconstruction::~AliITSreconstruction(){ | |
e69020a0 | 116 | // A destroyed AliITSreconstruction class. |
88cb7938 | 117 | delete fRunLoader; |
e69020a0 | 118 | fITS = 0; |
e69020a0 | 119 | } |
120 | //______________________________________________________________________ | |
121 | Bool_t AliITSreconstruction::Init(){ | |
122 | // Class Initilizer. | |
123 | // Inputs: | |
124 | // none. | |
125 | // Outputs: | |
126 | // none. | |
127 | // Return: | |
128 | // kTRUE if no errors initilizing this class occurse else kFALSE | |
88cb7938 | 129 | Info("Init",""); |
130 | if (fRunLoader == 0x0) | |
131 | { | |
132 | Error("Init","Run Loader is NULL"); | |
133 | return kFALSE; | |
134 | } | |
135 | fRunLoader->LoadgAlice(); | |
136 | fRunLoader->LoadHeader(); | |
137 | ||
138 | fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader"); | |
139 | if(!fLoader) { | |
140 | Error("Init","ITS loader not found"); | |
141 | fInit = kFALSE; | |
142 | } | |
143 | ||
144 | //Int_t retcode; | |
145 | fITS = (AliITS*) gAlice->GetDetector("ITS"); | |
e69020a0 | 146 | if(!fITS){ |
88cb7938 | 147 | cout << "ITS not found aborting. fITS=" << fITS << endl; |
148 | fInit = kFALSE; | |
149 | return fInit; | |
e69020a0 | 150 | } // end if !fITS |
151 | if(!(fITS->GetITSgeom())){ | |
88cb7938 | 152 | cout << "ITSgeom not found aborting."<< endl; |
153 | fInit = kFALSE; | |
154 | return fInit; | |
e69020a0 | 155 | } // end if !GetITSgeom() |
156 | // Now ready to init. | |
157 | ||
158 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
159 | fEnt0 = 0; | |
88cb7938 | 160 | |
161 | fEnt = gAlice->GetEventsPerRun(); | |
162 | ||
163 | fLoader->LoadDigits("read"); | |
164 | fLoader->LoadRecPoints("recreate"); | |
165 | fLoader->LoadRawClusters("recreate"); | |
166 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); | |
167 | fITS->MakeBranch("R"); | |
168 | fITS->MakeBranchC(); | |
169 | fITS->SetTreeAddress(); | |
e69020a0 | 170 | fInit = InitRec(); |
88cb7938 | 171 | |
172 | Info("Init"," Done\n\n\n"); | |
173 | ||
e69020a0 | 174 | return fInit; |
175 | } | |
176 | //______________________________________________________________________ | |
177 | Bool_t AliITSreconstruction::InitRec(){ | |
178 | // Sets up Reconstruction part of AliITSDetType.. | |
179 | // Inputs: | |
180 | // none. | |
181 | // Outputs: | |
182 | // none. | |
183 | // Return: | |
184 | // none. | |
185 | AliITSDetType *idt; | |
186 | ||
187 | // SPD | |
188 | if(fDet[kSPD]){ | |
88cb7938 | 189 | Info("InitRec","SPD"); |
190 | idt = fITS->DetType(kSPD); | |
191 | AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)idt->GetSegmentationModel(); | |
192 | TClonesArray *digSPD = fITS->DigitsAddress(kSPD); | |
193 | TClonesArray *recpSPD = fITS->ClustersAddress(kSPD); | |
194 | Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",idt,digSPD,recpSPD); | |
195 | AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD); | |
196 | fITS->SetReconstructionModel(kSPD,recSPD); | |
e69020a0 | 197 | } // end if fDet[kSPD]. |
198 | // SDD | |
199 | if(fDet[kSDD]){ | |
88cb7938 | 200 | Info("InitRec","SDD"); |
201 | idt = fITS->DetType(kSDD); | |
202 | AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*) | |
203 | idt->GetSegmentationModel(); | |
204 | AliITSresponseSDD *resSDD = (AliITSresponseSDD*) | |
205 | idt->GetResponseModel(); | |
206 | TClonesArray *digSDD = fITS->DigitsAddress(kSDD); | |
207 | TClonesArray *recpSDD = fITS->ClustersAddress(kSDD); | |
208 | AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD, | |
209 | resSDD, | |
210 | digSDD,recpSDD); | |
211 | fITS->SetReconstructionModel(kSDD,recSDD); | |
e69020a0 | 212 | } // end if fDet[kSDD] |
213 | // SSD | |
214 | if(fDet[kSSD]){ | |
88cb7938 | 215 | Info("InitRec","SSD"); |
216 | idt = fITS->DetType(kSSD); | |
217 | AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*) | |
218 | idt->GetSegmentationModel(); | |
219 | TClonesArray *digSSD = fITS->DigitsAddress(kSSD); | |
220 | AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD, | |
221 | digSSD); | |
222 | fITS->SetReconstructionModel(kSSD,recSSD); | |
e69020a0 | 223 | } // end if fDet[kSSD] |
88cb7938 | 224 | Info("InitRec"," Done\n"); |
e69020a0 | 225 | return kTRUE; |
226 | } | |
227 | //______________________________________________________________________ | |
228 | void AliITSreconstruction::Exec(const Option_t *opt){ | |
229 | // Main reconstruction function. | |
230 | // Inputs: | |
231 | // Option_t * opt list of subdetector to digitize. =0 all. | |
232 | // Outputs: | |
233 | // none. | |
234 | // Return: | |
235 | // none. | |
236 | Option_t *lopt; | |
88cb7938 | 237 | Int_t evnt; |
e69020a0 | 238 | |
239 | if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){ | |
88cb7938 | 240 | fDet[0] = fDet[1] = fDet[2] = kTRUE; |
241 | lopt = "All"; | |
e69020a0 | 242 | }else{ |
88cb7938 | 243 | fDet[0] = fDet[1] = fDet[2] = kFALSE; |
244 | if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE; | |
245 | if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE; | |
246 | if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE; | |
247 | if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All"; | |
248 | else lopt = opt; | |
e69020a0 | 249 | } // end if strstr(opt,...) |
250 | ||
251 | if(!fInit){ | |
88cb7938 | 252 | cout << "Initilization Failed, Can't run Exec." << endl; |
253 | return; | |
e69020a0 | 254 | } // end if !fInit |
88cb7938 | 255 | |
256 | for(evnt=0;evnt<fEnt;evnt++) | |
257 | { | |
258 | Info("Exec",""); | |
259 | Info("Exec","Processing Event %d",evnt); | |
260 | Info("Exec",""); | |
261 | ||
262 | fRunLoader->GetEvent(evnt); | |
263 | if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); | |
def15085 | 264 | fITS->MakeBranch("R"); |
88cb7938 | 265 | if (fLoader->TreeC() == 0x0) fITS->MakeTreeC(); |
266 | fITS->SetTreeAddress(); | |
def15085 | 267 | fITS->DigitsToRecPoints(evnt,0,lopt); |
e69020a0 | 268 | } // end for evnt |
f243fbe6 | 269 | } |
270 | //______________________________________________________________________ | |
271 | void AliITSreconstruction::SetOutputFile(TString filename){ | |
272 | // Set a file name for recpoints. Used only if this file is not the file | |
273 | // containing digits. This obj is deleted by AliRun. | |
ac74f489 | 274 | Error("SetOutputFile", |
275 | "Use AliLoader::SetRecPointsFileName(TString&)instead filename=%s", | |
276 | filename.Data()); | |
e69020a0 | 277 | } |