]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ */ |
2ab0c725 | 17 | |
4c039060 | 18 | |
fe4da5cc | 19 | /////////////////////////////////////////////////////////////////////////////// |
58005f18 | 20 | // |
21 | // An overview of the basic philosophy of the ITS code development | |
22 | // and analysis is show in the figure below. | |
fe4da5cc | 23 | //Begin_Html |
24 | /* | |
a92b2b7d | 25 | <img src="picts/ITS/ITS_Analysis_schema.gif"> |
fe4da5cc | 26 | </pre> |
27 | <br clear=left> | |
28 | <font size=+2 color=red> | |
58005f18 | 29 | <p>Roberto Barbera is in charge of the ITS Offline code (1999). |
fe4da5cc | 30 | <a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>. |
31 | </font> | |
32 | <pre> | |
33 | */ | |
34 | //End_Html | |
58005f18 | 35 | // |
36 | // AliITS. Inner Traking System base class. | |
37 | // This class contains the base procedures for the Inner Tracking System | |
38 | // | |
39 | //Begin_Html | |
40 | /* | |
a92b2b7d | 41 | <img src="picts/ITS/AliITS_Class_Diagram.gif"> |
58005f18 | 42 | </pre> |
43 | <br clear=left> | |
44 | <font size=+2 color=red> | |
45 | <p>This show the class diagram of the different elements that are part of | |
46 | the AliITS class. | |
47 | </font> | |
48 | <pre> | |
49 | */ | |
50 | //End_Html | |
51 | // | |
52 | // Version: 0 | |
53 | // Written by Rene Brun, Federico Carminati, and Roberto Barbera | |
54 | // | |
55 | // Version: 1 | |
56 | // Modified and documented by Bjorn S. Nilsen | |
57 | // July 11 1999 | |
58 | // | |
3bd79107 | 59 | // Version: 2 |
60 | // Modified and documented by A. Bologna | |
61 | // October 18 1999 | |
62 | // | |
58005f18 | 63 | // AliITS is the general base class for the ITS. Also see AliDetector for |
64 | // futher information. | |
65 | // | |
fe4da5cc | 66 | /////////////////////////////////////////////////////////////////////////////// |
88cb7938 | 67 | |
4ae5bbc4 | 68 | #include <Riostream.h> |
143d1056 | 69 | #include <stdlib.h> |
88cb7938 | 70 | |
9c74c52b | 71 | #include <TBranch.h> |
caf37aec | 72 | #include <TClonesArray.h> |
9c74c52b | 73 | #include <TFile.h> |
88cb7938 | 74 | #include <TMath.h> |
75 | #include <TObjectTable.h> | |
76 | #include <TROOT.h> | |
77 | #include <TRandom.h> | |
d5da1ecf | 78 | #include <TString.h> |
88cb7938 | 79 | #include <TTree.h> |
80 | #include <TVector.h> | |
81 | #include <TVirtualMC.h> | |
3bd79107 | 82 | |
88cb7938 | 83 | #include "AliConfig.h" |
828e06c7 | 84 | #include "AliHeader.h" |
3bd79107 | 85 | #include "AliITS.h" |
88cb7938 | 86 | #include "AliITSClusterFinderSDD.h" |
87 | #include "AliITSClusterFinderSPD.h" | |
88 | #include "AliITSClusterFinderSSD.h" | |
e8189707 | 89 | #include "AliITSDetType.h" |
88cb7938 | 90 | #include "AliITSLoader.h" |
41b19549 | 91 | #include "AliITSRawClusterSPD.h" |
92 | #include "AliITSRawClusterSDD.h" | |
93 | #include "AliITSRawClusterSSD.h" | |
88cb7938 | 94 | #include "AliITSRecPoint.h" |
e869281d | 95 | #include "AliITSdigitSPD.h" |
96 | #include "AliITSdigitSDD.h" | |
97 | #include "AliITSdigitSSD.h" | |
88cb7938 | 98 | #include "AliITSgeom.h" |
99 | #include "AliITShit.h" | |
100 | #include "AliITSmodule.h" | |
101 | #include "AliITSpList.h" | |
3bd79107 | 102 | #include "AliITSresponseSDD.h" |
88cb7938 | 103 | #include "AliITSresponseSPD.h" |
3bd79107 | 104 | #include "AliITSresponseSSD.h" |
828e06c7 | 105 | #include "AliITSsegmentationSDD.h" |
88cb7938 | 106 | #include "AliITSsegmentationSPD.h" |
828e06c7 | 107 | #include "AliITSsegmentationSSD.h" |
828e06c7 | 108 | #include "AliITSsimulationSDD.h" |
88cb7938 | 109 | #include "AliITSsimulationSPD.h" |
828e06c7 | 110 | #include "AliITSsimulationSSD.h" |
5d12ce38 | 111 | #include "AliMC.h" |
85a5290f | 112 | #include "AliITSDigitizer.h" |
596a855f | 113 | #include "AliITSclustererV2.h" |
114 | #include "AliITStrackerV2.h" | |
2257f27e | 115 | #include "AliITStrackerSA.h" |
596a855f | 116 | #include "AliITSpidESD.h" |
117 | #include "AliV0vertexer.h" | |
2257f27e | 118 | #include "AliITSVertexerPPZ.h" |
119 | #include "AliITSVertexerFast.h" | |
120 | #include "AliITSVertexerZ.h" | |
121 | #include "AliITSVertexerIons.h" | |
596a855f | 122 | #include "AliCascadeVertexer.h" |
123 | #include "AliESD.h" | |
8f726cb3 | 124 | #include "AliRun.h" |
828e06c7 | 125 | |
3bd79107 | 126 | ClassImp(AliITS) |
3bd79107 | 127 | |
2aea926d | 128 | //______________________________________________________________________ |
129 | AliITS::AliITS() : AliDetector() { | |
4a5bebc2 | 130 | // Default initializer for ITS |
2aea926d | 131 | // The default constructor of the AliITS class. In addition to |
132 | // creating the AliITS class it zeros the variables fIshunt (a member | |
133 | // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers | |
134 | // fITSpoints, fIdSens, and fIdName. The AliDetector default constructor | |
135 | // is also called. | |
4a5bebc2 | 136 | // Inputs: |
137 | // none. | |
138 | // Outputs: | |
139 | // none. | |
140 | // Return: | |
141 | // Blank ITS class. | |
3bd79107 | 142 | |
2aea926d | 143 | fIshunt = 0; // not zeroed in AliDetector. |
3bd79107 | 144 | |
2aea926d | 145 | // AliITS variables. |
146 | fEuclidOut = 0; | |
147 | fITSgeom = 0; | |
148 | fITSmodules = 0; | |
aa044888 | 149 | fOpt = "All"; |
150 | // SetDetectors(); // default to fOpt="All". This variable not written out. | |
cb26748d | 151 | |
2aea926d | 152 | fIdN = 0; |
153 | fIdName = 0; | |
154 | fIdSens = 0; | |
3bd79107 | 155 | |
2aea926d | 156 | fNDetTypes = kNTYPES; |
157 | fDetTypes = 0; | |
3bd79107 | 158 | |
2aea926d | 159 | fSDigits = 0; |
160 | fNSDigits = 0; | |
58005f18 | 161 | |
2aea926d | 162 | fNdtype = 0; |
163 | fDtype = 0; | |
3bd79107 | 164 | |
2aea926d | 165 | fCtype = 0; |
166 | fNctype = 0; | |
58005f18 | 167 | |
2aea926d | 168 | fRecPoints = 0; |
169 | fNRecPoints = 0; | |
58005f18 | 170 | |
2aea926d | 171 | SetMarkerColor(kRed); |
2257f27e | 172 | SelectVertexer(" "); |
fe4da5cc | 173 | } |
2aea926d | 174 | //______________________________________________________________________ |
175 | AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ | |
4a5bebc2 | 176 | // The standard Constructor for the ITS class. In addition to |
177 | // creating the AliITS class, it allocates memory for the TClonesArrays | |
178 | // fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype | |
179 | // (clusters). It also zeros the variables | |
2aea926d | 180 | // fIshunt (a member of AliDetector class), fEuclidOut, and fIdN, and zeros |
181 | // the pointers fIdSens and fIdName. To help in displaying hits via the | |
182 | // ROOT macro display.C AliITS also sets the marker color to red. The | |
183 | // variables passes with this constructor, const char *name and *title, | |
184 | // are used by the constructor of AliDetector class. See AliDetector | |
185 | // class for a description of these parameters and its constructor | |
186 | // functions. | |
4a5bebc2 | 187 | // Inputs: |
188 | // const char *name Detector name. Should always be "ITS" | |
189 | // const char *title Detector title. | |
190 | // Outputs: | |
191 | // none. | |
192 | // Return: | |
193 | // An ITS class. | |
2aea926d | 194 | |
195 | fIshunt = 0; // not zeroed in AliDetector | |
196 | fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector | |
0e73d04c | 197 | if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector. |
2aea926d | 198 | |
199 | fEuclidOut = 0; | |
200 | fITSgeom = 0; | |
201 | fITSmodules = 0; | |
cd77595e | 202 | SetDetectors(); // default to fOpt="All". This variable not written out. |
2aea926d | 203 | |
204 | fIdN = 0; | |
205 | fIdName = 0; | |
206 | fIdSens = 0; | |
207 | ||
208 | fNDetTypes = kNTYPES; | |
209 | fDetTypes = new TObjArray(fNDetTypes); | |
210 | ||
2aea926d | 211 | fSDigits = new TClonesArray("AliITSpListItem",1000); |
212 | fNSDigits = 0; | |
213 | ||
214 | fNdtype = new Int_t[fNDetTypes]; | |
215 | fDtype = new TObjArray(fNDetTypes); | |
216 | ||
217 | fCtype = new TObjArray(fNDetTypes); | |
218 | fNctype = new Int_t[fNDetTypes]; | |
2aea926d | 219 | |
220 | fRecPoints = new TClonesArray("AliITSRecPoint",1000); | |
221 | fNRecPoints = 0; | |
3bd79107 | 222 | |
2aea926d | 223 | Int_t i; |
224 | for(i=0;i<fNDetTypes;i++) { | |
88cb7938 | 225 | fDetTypes->AddAt(new AliITSDetType(),i); |
226 | fNdtype[i] = 0; | |
227 | fNctype[i] = 0; | |
2aea926d | 228 | } // end for i |
fe4da5cc | 229 | |
2aea926d | 230 | SetMarkerColor(kRed); |
2257f27e | 231 | SelectVertexer(" "); |
3bd79107 | 232 | } |
2aea926d | 233 | //______________________________________________________________________ |
58005f18 | 234 | AliITS::~AliITS(){ |
4a5bebc2 | 235 | // Default destructor for ITS. |
2aea926d | 236 | // The default destructor of the AliITS class. In addition to deleting |
237 | // the AliITS class it deletes the memory pointed to by the fHits, fDigits, | |
4a5bebc2 | 238 | // fSDigits, fCtype, fITSmodules, fITSgeom, fRecPoints, fIdSens, fIdName, |
239 | // fITSpoints, fDetType and it's contents. | |
240 | // Inputs: | |
241 | // none. | |
242 | // Outputs: | |
243 | // none. | |
244 | // Return: | |
245 | // none. | |
2aea926d | 246 | |
88cb7938 | 247 | if (fHits) { |
248 | fHits->Delete(); | |
249 | delete fHits; | |
250 | fHits=0; | |
251 | } | |
252 | if (fSDigits) { | |
253 | fSDigits->Delete(); | |
254 | delete fSDigits; | |
255 | fSDigits=0; | |
256 | } | |
257 | if (fDigits) { | |
258 | fDigits->Delete(); | |
259 | delete fDigits; | |
260 | fDigits=0; | |
261 | } | |
262 | if (fRecPoints) { | |
263 | fRecPoints->Delete(); | |
264 | delete fRecPoints; | |
265 | fRecPoints=0; | |
266 | } | |
267 | delete[] fIdName; // Array of TStrings | |
268 | delete[] fIdSens; | |
269 | if(fITSmodules) { | |
270 | this->ClearModules(); | |
271 | delete fITSmodules; | |
279a35d7 | 272 | fITSmodules = 0; |
88cb7938 | 273 | }// end if fITSmodules!=0 |
274 | ||
275 | if(fDtype) { | |
276 | fDtype->Delete(); | |
277 | delete fDtype; | |
278 | } // end if fDtype | |
279 | delete [] fNdtype; | |
280 | if (fCtype) { | |
281 | fCtype->Delete(); | |
282 | delete fCtype; | |
283 | fCtype = 0; | |
284 | } // end if fCtype | |
285 | delete [] fNctype; | |
286 | ||
287 | if (fDetTypes) { | |
288 | fDetTypes->Delete(); | |
289 | delete fDetTypes; | |
290 | fDetTypes = 0; | |
291 | } // end if fDetTypes | |
292 | ||
293 | ||
294 | if (fITSgeom) delete fITSgeom; | |
3bd79107 | 295 | } |
2aea926d | 296 | //______________________________________________________________________ |
ac74f489 | 297 | AliITS::AliITS(const AliITS &source) : AliDetector(source){ |
4a5bebc2 | 298 | // Copy constructor. This is a function which is not allowed to be |
299 | // done to the ITS. It exits with an error. | |
300 | // Inputs: | |
301 | // AliITS &source An AliITS class. | |
302 | // Outputs: | |
303 | // none. | |
304 | // Return: | |
305 | // none. | |
3bd79107 | 306 | |
2aea926d | 307 | if(this==&source) return; |
4a5bebc2 | 308 | Error("Copy constructor", |
88cb7938 | 309 | "You are not allowed to make a copy of the AliITS"); |
2aea926d | 310 | exit(1); |
3bd79107 | 311 | } |
2aea926d | 312 | //______________________________________________________________________ |
313 | AliITS& AliITS::operator=(AliITS &source){ | |
4a5bebc2 | 314 | // Assignment operator. This is a function which is not allowed to be |
315 | // done to the ITS. It exits with an error. | |
316 | // Inputs: | |
317 | // AliITS &source An AliITS class. | |
318 | // Outputs: | |
319 | // none. | |
320 | // Return: | |
321 | // none. | |
3bd79107 | 322 | |
2aea926d | 323 | if(this==&source) return *this; |
4a5bebc2 | 324 | Error("operator=","You are not allowed to make a copy of the AliITS"); |
2aea926d | 325 | exit(1); |
326 | return *this; //fake return | |
3bd79107 | 327 | } |
2aea926d | 328 | //______________________________________________________________________ |
93f82b23 | 329 | Int_t AliITS::DistancetoPrimitive(Int_t,Int_t) const{ |
2aea926d | 330 | // Distance from mouse to ITS on the screen. Dummy routine |
331 | // A dummy routine used by the ROOT macro display.C to allow for the | |
332 | // use of the mouse (pointing device) in the macro. In general this should | |
333 | // never be called. If it is it returns the number 9999 for any value of | |
334 | // x and y. | |
4a5bebc2 | 335 | // Inputs: |
336 | // Int_t Dummy screen coordinate. | |
337 | // Int_t Dummy screen coordinate. | |
338 | // Outputs: | |
339 | // none. | |
340 | // Return: | |
341 | // Int_t Dummy = 9999 distance to ITS. | |
3bd79107 | 342 | |
2aea926d | 343 | return 9999; |
3bd79107 | 344 | } |
2aea926d | 345 | //______________________________________________________________________ |
346 | void AliITS::Init(){ | |
4a5bebc2 | 347 | // Initializer ITS after it has been built |
2aea926d | 348 | // This routine initializes the AliITS class. It is intended to be |
349 | // called from the Init function in AliITSv?. Besides displaying a banner | |
350 | // indicating that it has been called it initializes the array fIdSens | |
351 | // and sets the default segmentation, response, digit and raw cluster | |
352 | // classes therefore it should be called after a call to CreateGeometry. | |
4a5bebc2 | 353 | // Inputs: |
354 | // none. | |
355 | // Outputs: | |
356 | // none. | |
357 | // Return: | |
358 | // none. | |
3bd79107 | 359 | Int_t i; |
3bd79107 | 360 | |
2aea926d | 361 | SetDefaults(); |
362 | // Array of TStrings | |
0e73d04c | 363 | if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]); |
3bd79107 | 364 | } |
2aea926d | 365 | //______________________________________________________________________ |
366 | void AliITS::SetDefaults(){ | |
4a5bebc2 | 367 | // sets the default segmentation, response, digit and raw cluster classes. |
368 | // Inputs: | |
369 | // none. | |
370 | // Outputs: | |
371 | // none. | |
372 | // Return: | |
373 | // none. | |
2aea926d | 374 | |
375 | if(fDebug) printf("%s: SetDefaults\n",ClassName()); | |
376 | ||
377 | AliITSDetType *iDetType; | |
378 | ||
379 | //SPD | |
380 | iDetType=DetType(0); | |
381 | if (!iDetType->GetSegmentationModel()) { | |
88cb7938 | 382 | AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom); |
383 | SetSegmentationModel(0,seg0); | |
2aea926d | 384 | } // end if |
385 | if (!iDetType->GetResponseModel()) { | |
88cb7938 | 386 | SetResponseModel(0,new AliITSresponseSPD()); |
2aea926d | 387 | } // end if |
388 | // set digit and raw cluster classes to be used | |
389 | ||
390 | const char *kData0=(iDetType->GetResponseModel())->DataType(); | |
391 | if (strstr(kData0,"real")) { | |
88cb7938 | 392 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSPD"); |
2aea926d | 393 | } else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD"); |
394 | ||
395 | // SDD | |
396 | iDetType=DetType(1); | |
397 | if (!iDetType->GetResponseModel()) { | |
88cb7938 | 398 | SetResponseModel(1,new AliITSresponseSDD("simulated")); |
2aea926d | 399 | } // end if |
400 | AliITSresponse *resp1=iDetType->GetResponseModel(); | |
401 | if (!iDetType->GetSegmentationModel()) { | |
88cb7938 | 402 | AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1); |
403 | SetSegmentationModel(1,seg1); | |
2aea926d | 404 | } // end if |
405 | const char *kData1=(iDetType->GetResponseModel())->DataType(); | |
406 | const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption(); | |
4a5bebc2 | 407 | if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D")) || strstr(kData1,"real") ){ |
88cb7938 | 408 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD"); |
2aea926d | 409 | } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD"); |
410 | ||
411 | // SSD | |
412 | iDetType=DetType(2); | |
413 | if (!iDetType->GetSegmentationModel()) { | |
88cb7938 | 414 | AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom); |
415 | SetSegmentationModel(2,seg2); | |
2aea926d | 416 | } // end if |
417 | if (!iDetType->GetResponseModel()) { | |
88cb7938 | 418 | SetResponseModel(2,new AliITSresponseSSD("simulated")); |
2aea926d | 419 | } // end if |
420 | const char *kData2=(iDetType->GetResponseModel())->DataType(); | |
421 | if (strstr(kData2,"real")) { | |
88cb7938 | 422 | iDetType->ClassNames("AliITSdigit","AliITSRawClusterSSD"); |
2aea926d | 423 | } else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD"); |
424 | ||
425 | if (kNTYPES>3) { | |
88cb7938 | 426 | Warning("SetDefaults", |
427 | "Only the three basic detector types are initialized!"); | |
2aea926d | 428 | } // end if |
3bd79107 | 429 | } |
2aea926d | 430 | //______________________________________________________________________ |
431 | void AliITS::SetDefaultSimulation(){ | |
4a5bebc2 | 432 | // sets the default simulation. |
433 | // Inputs: | |
434 | // none. | |
435 | // Outputs: | |
436 | // none. | |
437 | // Return: | |
438 | // none. | |
2aea926d | 439 | |
440 | AliITSDetType *iDetType; | |
54b8cf3b | 441 | AliITSsimulation *sim; |
2aea926d | 442 | iDetType=DetType(0); |
54b8cf3b | 443 | sim = iDetType->GetSimulationModel(); |
444 | if (!sim) { | |
88cb7938 | 445 | AliITSsegmentation *seg0= |
446 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
447 | AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel(); | |
448 | AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); | |
449 | SetSimulationModel(0,sim0); | |
54b8cf3b | 450 | }else{ // simulation exists, make sure it is set up properly. |
88cb7938 | 451 | ((AliITSsimulationSPD*)sim)->Init( |
452 | (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(), | |
453 | (AliITSresponseSPD*) iDetType->GetResponseModel()); | |
454 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
455 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
456 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
457 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
2aea926d | 458 | } // end if |
459 | iDetType=DetType(1); | |
54b8cf3b | 460 | sim = iDetType->GetSimulationModel(); |
461 | if (!sim) { | |
88cb7938 | 462 | AliITSsegmentation *seg1= |
463 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
464 | AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); | |
465 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
466 | SetSimulationModel(1,sim1); | |
54b8cf3b | 467 | }else{ // simulation exists, make sure it is set up properly. |
88cb7938 | 468 | ((AliITSsimulationSDD*)sim)->Init( |
469 | (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(), | |
470 | (AliITSresponseSDD*) iDetType->GetResponseModel()); | |
471 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
472 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
473 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
474 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
2aea926d | 475 | } //end if |
476 | iDetType=DetType(2); | |
54b8cf3b | 477 | sim = iDetType->GetSimulationModel(); |
478 | if (!sim) { | |
88cb7938 | 479 | AliITSsegmentation *seg2= |
480 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
481 | AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel(); | |
482 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
483 | SetSimulationModel(2,sim2); | |
54b8cf3b | 484 | }else{ // simulation exists, make sure it is set up properly. |
88cb7938 | 485 | ((AliITSsimulationSSD*)sim)->Init( |
486 | (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(), | |
487 | (AliITSresponseSSD*) iDetType->GetResponseModel()); | |
488 | // if(sim->GetResponseModel()==0) sim->SetResponseModel( | |
489 | // (AliITSresponse*)iDetType->GetResponseModel()); | |
490 | // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel( | |
491 | // (AliITSsegmentation*)iDetType->GetSegmentationModel()); | |
2aea926d | 492 | } // end if |
3bd79107 | 493 | } |
2aea926d | 494 | //______________________________________________________________________ |
495 | void AliITS::SetDefaultClusterFinders(){ | |
4a5bebc2 | 496 | // Sets the default cluster finders. Used in finding RecPoints. |
497 | // Inputs: | |
498 | // none. | |
499 | // Outputs: | |
500 | // none. | |
501 | // Return: | |
502 | // none. | |
2aea926d | 503 | |
504 | MakeTreeC(); | |
505 | AliITSDetType *iDetType; | |
506 | ||
507 | // SPD | |
508 | iDetType=DetType(0); | |
509 | if (!iDetType->GetReconstructionModel()) { | |
88cb7938 | 510 | AliITSsegmentation *seg0 = |
511 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
512 | TClonesArray *dig0=DigitsAddress(0); | |
513 | TClonesArray *recp0=ClustersAddress(0); | |
514 | AliITSClusterFinderSPD *rec0 = new AliITSClusterFinderSPD(seg0,dig0, | |
515 | recp0); | |
516 | SetReconstructionModel(0,rec0); | |
2aea926d | 517 | } // end if |
518 | ||
519 | // SDD | |
520 | iDetType=DetType(1); | |
521 | if (!iDetType->GetReconstructionModel()) { | |
88cb7938 | 522 | AliITSsegmentation *seg1 = |
523 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
524 | AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel(); | |
525 | TClonesArray *dig1=DigitsAddress(1); | |
526 | TClonesArray *recp1=ClustersAddress(1); | |
527 | AliITSClusterFinderSDD *rec1 = | |
528 | new AliITSClusterFinderSDD(seg1,res1,dig1,recp1); | |
2aea926d | 529 | SetReconstructionModel(1,rec1); |
530 | } // end if | |
531 | ||
532 | // SSD | |
533 | iDetType=DetType(2); | |
534 | if (!iDetType->GetReconstructionModel()) { | |
88cb7938 | 535 | AliITSsegmentation *seg2= |
536 | (AliITSsegmentation*)iDetType->GetSegmentationModel(); | |
537 | TClonesArray *dig2=DigitsAddress(2); | |
538 | AliITSClusterFinderSSD *rec2= new AliITSClusterFinderSSD(seg2,dig2); | |
539 | SetReconstructionModel(2,rec2); | |
2aea926d | 540 | } // end if |
3bd79107 | 541 | } |
2aea926d | 542 | //______________________________________________________________________ |
88cb7938 | 543 | void AliITS::MakeBranch(Option_t* option){ |
2aea926d | 544 | // Creates Tree branches for the ITS. |
4a5bebc2 | 545 | // Inputs: |
546 | // Option_t *option String of Tree types S,D, and/or R. | |
547 | // const char *file String of the file name where these branches | |
548 | // are to be stored. If blank then these branches | |
549 | // are written to the same tree as the Hits were | |
550 | // read from. | |
551 | // Outputs: | |
552 | // none. | |
553 | // Return: | |
554 | // none. | |
88cb7938 | 555 | Bool_t cH = (strstr(option,"H")!=0); |
ff0e455e | 556 | Bool_t cS = (strstr(option,"S")!=0); |
557 | Bool_t cD = (strstr(option,"D")!=0); | |
558 | Bool_t cR = (strstr(option,"R")!=0); | |
559 | Bool_t cRF = (strstr(option,"RF")!=0); | |
88cb7938 | 560 | |
ff0e455e | 561 | if(cRF)cR = kFALSE; |
88cb7938 | 562 | if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); |
563 | ||
564 | AliDetector::MakeBranch(option); | |
2aea926d | 565 | |
88cb7938 | 566 | if(cS) MakeBranchS(0); |
567 | if(cD) MakeBranchD(0); | |
568 | if(cR) MakeBranchR(0); | |
569 | if(cRF) MakeBranchRF(0); | |
fe4da5cc | 570 | } |
2aea926d | 571 | //______________________________________________________________________ |
572 | void AliITS::SetTreeAddress(){ | |
573 | // Set branch address for the Trees. | |
4a5bebc2 | 574 | // Inputs: |
575 | // none. | |
576 | // Outputs: | |
577 | // none. | |
578 | // Return: | |
579 | // none. | |
88cb7938 | 580 | TTree *treeS = fLoader->TreeS(); |
581 | TTree *treeD = fLoader->TreeD(); | |
582 | TTree *treeR = fLoader->TreeR(); | |
583 | if (fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); | |
584 | ||
2aea926d | 585 | AliDetector::SetTreeAddress(); |
586 | ||
587 | SetTreeAddressS(treeS); | |
588 | SetTreeAddressD(treeD); | |
589 | SetTreeAddressR(treeR); | |
fe4da5cc | 590 | } |
2aea926d | 591 | //______________________________________________________________________ |
592 | AliITSDetType* AliITS::DetType(Int_t id){ | |
4a5bebc2 | 593 | // Return pointer to id detector type. |
594 | // Inputs: | |
595 | // Int_t id detector id number. | |
596 | // Outputs: | |
597 | // none. | |
598 | // Return: | |
599 | // returned, a pointer to a AliITSDetType. | |
fe4da5cc | 600 | |
2aea926d | 601 | return ((AliITSDetType*) fDetTypes->At(id)); |
3bd79107 | 602 | } |
2aea926d | 603 | //______________________________________________________________________ |
604 | void AliITS::SetResponseModel(Int_t id, AliITSresponse *response){ | |
4a5bebc2 | 605 | // Set the response model for the id detector type. |
606 | // Inputs: | |
607 | // Int_t id detector id number. | |
608 | // AliITSresponse* a pointer containing an instance of AliITSresponse | |
609 | // to be stored/owned b y AliITSDetType. | |
610 | // Outputs: | |
611 | // none. | |
612 | // Return: | |
613 | // none. | |
e8189707 | 614 | |
2aea926d | 615 | ((AliITSDetType*) fDetTypes->At(id))->ResponseModel(response); |
e8189707 | 616 | } |
2aea926d | 617 | //______________________________________________________________________ |
618 | void AliITS::SetSegmentationModel(Int_t id, AliITSsegmentation *seg){ | |
4a5bebc2 | 619 | // Set the segmentation model for the id detector type. |
620 | // Inputs: | |
621 | // Int_t id detector id number. | |
622 | // AliITSsegmentation* a pointer containing an instance of | |
623 | // AliITSsegmentation to be stored/owned b y | |
624 | // AliITSDetType. | |
625 | // Outputs: | |
626 | // none. | |
627 | // Return: | |
628 | // none. | |
e8189707 | 629 | |
2aea926d | 630 | ((AliITSDetType*) fDetTypes->At(id))->SegmentationModel(seg); |
e8189707 | 631 | } |
2aea926d | 632 | //______________________________________________________________________ |
633 | void AliITS::SetSimulationModel(Int_t id, AliITSsimulation *sim){ | |
4a5bebc2 | 634 | // Set the simulation model for the id detector type. |
635 | // Inputs: | |
636 | // Int_t id detector id number. | |
637 | // AliITSresponse* a pointer containing an instance of AliITSresponse | |
638 | // to be stored/owned b y AliITSDetType. | |
639 | // Outputs: | |
640 | // none. | |
641 | // Return: | |
642 | // none. | |
3bd79107 | 643 | |
2aea926d | 644 | ((AliITSDetType*) fDetTypes->At(id))->SimulationModel(sim); |
3bd79107 | 645 | |
646 | } | |
2aea926d | 647 | //______________________________________________________________________ |
648 | void AliITS::SetReconstructionModel(Int_t id, AliITSClusterFinder *reconst){ | |
4a5bebc2 | 649 | // Set the cluster finder model for the id detector type. |
650 | // Inputs: | |
651 | // Int_t id detector id number. | |
652 | // AliITSClusterFinder* a pointer containing an instance of | |
653 | // AliITSClusterFinder to be stored/owned b y | |
654 | // AliITSDetType. | |
655 | // Outputs: | |
656 | // none. | |
657 | // Return: | |
658 | // none. | |
3bd79107 | 659 | |
2aea926d | 660 | ((AliITSDetType*) fDetTypes->At(id))->ReconstructionModel(reconst); |
3bd79107 | 661 | } |
2aea926d | 662 | //______________________________________________________________________ |
663 | void AliITS::SetClasses(Int_t id, const char *digit, const char *cluster){ | |
4a5bebc2 | 664 | // Set the digit and cluster classes name to be used for the id detector |
665 | // type. | |
666 | // Inputs: | |
667 | // Int_t id detector id number. | |
668 | // const char *digit Digit class name for detector id. | |
669 | // const char *cluster Cluster class name for detector id. | |
670 | // Outputs: | |
671 | // none. | |
672 | // Return: | |
673 | // none. | |
3bd79107 | 674 | |
2aea926d | 675 | ((AliITSDetType*) fDetTypes->At(id))->ClassNames(digit,cluster); |
3bd79107 | 676 | } |
2aea926d | 677 | //______________________________________________________________________ |
678 | void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ | |
679 | // Add an ITS hit | |
680 | // The function to add information to the AliITShit class. See the | |
681 | // AliITShit class for a full description. This function allocates the | |
682 | // necessary new space for the hit information and passes the variable | |
683 | // track, and the pointers *vol and *hits to the AliITShit constructor | |
684 | // function. | |
4a5bebc2 | 685 | // Inputs: |
686 | // Int_t track Track number which produced this hit. | |
687 | // Int_t *vol Array of Integer Hit information. See AliITShit.h | |
688 | // Float_t *hits Array of Floating Hit information. see AliITShit.h | |
689 | // Outputs: | |
690 | // none. | |
691 | // Return: | |
692 | // none. | |
2aea926d | 693 | |
694 | TClonesArray &lhits = *fHits; | |
695 | new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); | |
3bd79107 | 696 | } |
2aea926d | 697 | //______________________________________________________________________ |
3bd79107 | 698 | void AliITS::InitModules(Int_t size,Int_t &nmodules){ |
4a5bebc2 | 699 | // Initialize the modules array. |
700 | // Inputs: | |
701 | // Int_t size Size of array of the number of modules to be | |
702 | // created. If size <=0 then the number of modules | |
703 | // is gotten from AliITSgeom class kept in fITSgeom. | |
704 | // Outputs: | |
705 | // Int_t &nmodules The number of modules existing. | |
706 | // Return: | |
707 | // none. | |
3bd79107 | 708 | |
2aea926d | 709 | if(fITSmodules){ |
88cb7938 | 710 | fITSmodules->Delete(); |
711 | delete fITSmodules; | |
2aea926d | 712 | } // end fir fITSmoudles |
e8189707 | 713 | |
3bd79107 | 714 | Int_t nl,indexMAX,index; |
3bd79107 | 715 | |
716 | if(size<=0){ // default to using data stored in AliITSgeom | |
88cb7938 | 717 | if(fITSgeom==0) { |
718 | Error("InitModules","fITSgeom not defined"); | |
719 | return; | |
720 | } // end if fITSgeom==0 | |
721 | nl = fITSgeom->GetNlayers(); | |
722 | indexMAX = fITSgeom->GetModuleIndex(nl,fITSgeom->GetNladders(nl), | |
723 | fITSgeom->GetNdetectors(nl))+1; | |
724 | nmodules = indexMAX; | |
725 | fITSmodules = new TObjArray(indexMAX); | |
726 | for(index=0;index<indexMAX;index++){ | |
727 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
728 | } // end for index | |
3bd79107 | 729 | }else{ |
88cb7938 | 730 | fITSmodules = new TObjArray(size); |
731 | for(index=0;index<size;index++) { | |
732 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
733 | } // end for index | |
9c74c52b | 734 | |
3bd79107 | 735 | nmodules = size; |
736 | } // end i size<=0 | |
737 | } | |
2aea926d | 738 | //______________________________________________________________________ |
739 | void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, | |
8e8eae84 | 740 | Option_t *option, const char *filename){ |
2aea926d | 741 | // fill the modules with the sorted by module hits; add hits from |
4a5bebc2 | 742 | // background if option=Add. |
743 | // Inputs: | |
744 | // Int_t evnt Event to be processed. | |
745 | // Int_t bgrev Background Hit tree number. | |
746 | // Int_t nmodules Not used. | |
747 | // Option_t *option String indicating if merging hits or not. To | |
748 | // merge hits set equal to "Add". Otherwise no | |
749 | // background hits are considered. | |
750 | // Test_t *filename File name containing the background hits.. | |
751 | // Outputs: | |
752 | // none. | |
753 | // Return: | |
754 | // none. | |
3bd79107 | 755 | static TTree *trH1; //Tree with background hits |
3bd79107 | 756 | static Bool_t first=kTRUE; |
757 | static TFile *file; | |
5cf7bbad | 758 | const char *addBgr = strstr(option,"Add"); |
3bd79107 | 759 | |
ac74f489 | 760 | evnt = nmodules; // Dummy use of variables to remove warnings |
e8189707 | 761 | if (addBgr ) { |
88cb7938 | 762 | if(first) { |
763 | file=new TFile(filename); | |
764 | } // end if first | |
765 | first=kFALSE; | |
766 | file->cd(); | |
767 | file->ls(); | |
768 | // Get Hits Tree header from file | |
769 | if(trH1) delete trH1; | |
770 | trH1=0; | |
771 | ||
772 | char treeName[20]; | |
773 | sprintf(treeName,"TreeH%d",bgrev); | |
774 | trH1 = (TTree*)gDirectory->Get(treeName); | |
775 | if (!trH1) { | |
776 | Error("FillModules","cannot find Hits Tree for event:%d",bgrev); | |
777 | } // end if !trH1 | |
778 | // Set branch addresses | |
2aea926d | 779 | } // end if addBgr |
3bd79107 | 780 | |
88cb7938 | 781 | FillModules(fLoader->TreeH(),0); // fill from this file's tree. |
3bd79107 | 782 | |
e8189707 | 783 | if (addBgr ) { |
88cb7938 | 784 | FillModules(trH1,10000000); // Default mask 10M. |
785 | TTree *fAli=fLoader->GetRunLoader()->TreeK(); | |
786 | TFile *fileAli=0; | |
787 | if (fAli) fileAli =fAli->GetCurrentFile(); | |
788 | fileAli->cd(); | |
3bd79107 | 789 | } // end if add |
3bd79107 | 790 | } |
2aea926d | 791 | //______________________________________________________________________ |
b4012daf | 792 | void AliITS::FillModules(TTree *treeH, Int_t mask) { |
793 | // fill the modules with the sorted by module hits; | |
794 | // can be called many times to do a merging | |
795 | // Inputs: | |
796 | // TTree *treeH The tree containing the hits to be copied into | |
797 | // the modules. | |
798 | // Int_t mask The track number mask to indecate which file | |
799 | // this hits came from. | |
800 | // Outputs: | |
801 | // none. | |
802 | // Return: | |
803 | // none. | |
804 | ||
88cb7938 | 805 | if (treeH == 0x0) |
806 | { | |
807 | Error("FillModules","Tree is NULL"); | |
808 | } | |
b4012daf | 809 | Int_t lay,lad,det,index; |
810 | AliITShit *itsHit=0; | |
811 | AliITSmodule *mod=0; | |
812 | char branchname[20]; | |
813 | sprintf(branchname,"%s",GetName()); | |
814 | TBranch *branch = treeH->GetBranch(branchname); | |
815 | if (!branch) { | |
88cb7938 | 816 | Error("FillModules","%s branch in TreeH not found",branchname); |
817 | return; | |
b4012daf | 818 | } // end if !branch |
819 | branch->SetAddress(&fHits); | |
820 | Int_t nTracks =(Int_t) treeH->GetEntries(); | |
821 | Int_t iPrimTrack,h; | |
822 | for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){ | |
88cb7938 | 823 | ResetHits(); |
824 | Int_t nBytes = treeH->GetEvent(iPrimTrack); | |
825 | if (nBytes <= 0) continue; | |
826 | Int_t nHits = fHits->GetEntriesFast(); | |
827 | for(h=0; h<nHits; h++){ | |
828 | itsHit = (AliITShit *)fHits->UncheckedAt(h); | |
829 | itsHit->GetDetectorID(lay,lad,det); | |
830 | if (fITSgeom) { | |
831 | index = fITSgeom->GetModuleIndex(lay,lad,det); | |
832 | } else { | |
833 | index=det-1; // This should not be used. | |
834 | } // end if [You must have fITSgeom for this to work!] | |
835 | mod = GetModule(index); | |
836 | itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask. | |
837 | mod->AddHit(itsHit,iPrimTrack,h); | |
838 | } // end loop over hits | |
b4012daf | 839 | } // end loop over tracks |
840 | } | |
841 | //______________________________________________________________________ | |
2aea926d | 842 | void AliITS::ClearModules(){ |
4a5bebc2 | 843 | // Clear the modules TObjArray. |
844 | // Inputs: | |
845 | // none. | |
846 | // Outputs: | |
847 | // none. | |
3bd79107 | 848 | |
2aea926d | 849 | if(fITSmodules) fITSmodules->Delete(); |
850 | } | |
851 | //______________________________________________________________________ | |
4a5bebc2 | 852 | void AliITS::MakeBranchS(const char *fl){ |
853 | // Creates Tree Branch for the ITS summable digits. | |
854 | // Inputs: | |
855 | // cont char *fl File name where SDigits branch is to be written | |
856 | // to. If blank it write the SDigits to the same | |
857 | // file in which the Hits were found. | |
858 | // Outputs: | |
859 | // none. | |
860 | // Return: | |
861 | // none. | |
2aea926d | 862 | Int_t buffersize = 4000; |
863 | char branchname[30]; | |
2ab0c725 | 864 | |
2aea926d | 865 | // only one branch for SDigits. |
866 | sprintf(branchname,"%s",GetName()); | |
88cb7938 | 867 | |
868 | ||
7941072e | 869 | if(fLoader->TreeS()){ |
88cb7938 | 870 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); |
871 | MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl); | |
2aea926d | 872 | } // end if |
873 | } | |
874 | //______________________________________________________________________ | |
875 | void AliITS::SetTreeAddressS(TTree *treeS){ | |
876 | // Set branch address for the ITS summable digits Trees. | |
4a5bebc2 | 877 | // Inputs: |
878 | // TTree *treeS Tree containing the SDigits. | |
879 | // Outputs: | |
880 | // none. | |
881 | // Return: | |
882 | // none. | |
2aea926d | 883 | char branchname[30]; |
828e06c7 | 884 | |
2aea926d | 885 | if(!treeS) return; |
88cb7938 | 886 | if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000); |
2aea926d | 887 | TBranch *branch; |
888 | sprintf(branchname,"%s",GetName()); | |
889 | branch = treeS->GetBranch(branchname); | |
890 | if (branch) branch->SetAddress(&fSDigits); | |
891 | } | |
892 | //______________________________________________________________________ | |
9ad8b5dd | 893 | void AliITS::MakeBranchInTreeD(TTree *treeD,const char *file){ |
2aea926d | 894 | // Creates Tree branches for the ITS. |
4a5bebc2 | 895 | // Inputs: |
e0fc0305 | 896 | // TTree *treeD Pointer to the Digits Tree. |
4a5bebc2 | 897 | // cont char *file File name where Digits branch is to be written |
898 | // to. If blank it write the SDigits to the same | |
899 | // file in which the Hits were found. | |
900 | // Outputs: | |
901 | // none. | |
902 | // Return: | |
903 | // none. | |
2aea926d | 904 | Int_t buffersize = 4000; |
905 | char branchname[30]; | |
2ab0c725 | 906 | |
2aea926d | 907 | sprintf(branchname,"%s",GetName()); |
908 | // one branch for digits per type of detector | |
909 | const char *det[3] = {"SPD","SDD","SSD"}; | |
910 | char digclass[40]; | |
911 | char clclass[40]; | |
912 | Int_t i; | |
913 | for (i=0; i<kNTYPES ;i++) { | |
88cb7938 | 914 | DetType(i)->GetClassNames(digclass,clclass); |
915 | // digits | |
916 | if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); | |
917 | if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); | |
918 | else ResetDigits(i); | |
2aea926d | 919 | } // end for i |
920 | for (i=0; i<kNTYPES ;i++) { | |
88cb7938 | 921 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); |
922 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
923 | if (fDtype && treeD) { | |
924 | MakeBranchInTree(treeD, branchname, &((*fDtype)[i]),buffersize,file); | |
925 | } // end if | |
2aea926d | 926 | } // end for i |
2ab0c725 | 927 | } |
2aea926d | 928 | //______________________________________________________________________ |
929 | void AliITS::SetTreeAddressD(TTree *treeD){ | |
930 | // Set branch address for the Trees. | |
4a5bebc2 | 931 | // Inputs: |
932 | // TTree *treeD Tree containing the Digits. | |
933 | // Outputs: | |
934 | // none. | |
935 | // Return: | |
936 | // none. | |
2aea926d | 937 | char branchname[30]; |
938 | const char *det[3] = {"SPD","SDD","SSD"}; | |
939 | TBranch *branch; | |
940 | char digclass[40]; | |
941 | char clclass[40]; | |
942 | Int_t i; | |
2ab0c725 | 943 | |
2aea926d | 944 | if(!treeD) return; |
945 | for (i=0; i<kNTYPES; i++) { | |
88cb7938 | 946 | DetType(i)->GetClassNames(digclass,clclass); |
947 | // digits | |
948 | if (fDtype == 0x0) fDtype = new TObjArray(fNDetTypes); | |
949 | if(!(fDtype->At(i))) fDtype->AddAt(new TClonesArray(digclass,1000),i); | |
950 | else ResetDigits(i); | |
951 | if (kNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
952 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
953 | if (fDtype) { | |
954 | branch = treeD->GetBranch(branchname); | |
955 | if (branch) branch->SetAddress(&((*fDtype)[i])); | |
956 | } // end if fDtype | |
2aea926d | 957 | } // end for i |
958 | } | |
959 | //______________________________________________________________________ | |
960 | void AliITS::Hits2SDigits(){ | |
961 | // Standard Hits to summable Digits function. | |
4a5bebc2 | 962 | // Inputs: |
963 | // none. | |
964 | // Outputs: | |
965 | // none. | |
2aea926d | 966 | |
e0fc0305 | 967 | // return; // Using Hits in place of the larger sDigits. |
85a5290f | 968 | fLoader->LoadHits("read"); |
969 | fLoader->LoadSDigits("recreate"); | |
88cb7938 | 970 | AliRunLoader* rl = fLoader->GetRunLoader(); |
85a5290f | 971 | |
972 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { | |
2aea926d | 973 | // Do the Hits to Digits operation. Use Standard input values. |
974 | // Event number from file, no background hit merging , use size from | |
975 | // AliITSgeom class, option="All", input from this file only. | |
85a5290f | 976 | rl->GetEvent(iEvent); |
977 | if (!fLoader->TreeS()) fLoader->MakeTree("S"); | |
978 | MakeBranch("S"); | |
979 | SetTreeAddress(); | |
980 | HitsToSDigits(iEvent,0,-1," ",fOpt," "); | |
981 | } | |
88cb7938 | 982 | |
85a5290f | 983 | fLoader->UnloadHits(); |
984 | fLoader->UnloadSDigits(); | |
2aea926d | 985 | } |
986 | //______________________________________________________________________ | |
987 | void AliITS::Hits2PreDigits(){ | |
988 | // Standard Hits to summable Digits function. | |
4a5bebc2 | 989 | // Inputs: |
990 | // none. | |
991 | // Outputs: | |
992 | // none. | |
2aea926d | 993 | |
88cb7938 | 994 | AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file. |
2aea926d | 995 | // Do the Hits to Digits operation. Use Standard input values. |
996 | // Event number from file, no background hit merging , use size from | |
997 | // AliITSgeom class, option="All", input from this file only. | |
7d8046e8 | 998 | HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," "); |
2aea926d | 999 | } |
1000 | //______________________________________________________________________ | |
c92eb8ad | 1001 | AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const |
85a5290f | 1002 | { |
1003 | return new AliITSDigitizer(manager); | |
1004 | } | |
1005 | //______________________________________________________________________ | |
e0fc0305 | 1006 | void AliITS::SDigitsToDigits(Option_t *opt){ |
2aea926d | 1007 | // Standard Summable digits to Digits function. |
4a5bebc2 | 1008 | // Inputs: |
1009 | // none. | |
1010 | // Outputs: | |
1011 | // none. | |
e0fc0305 | 1012 | char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
1013 | ||
1014 | if(!GetITSgeom()) return; // need transformations to do digitization. | |
1015 | AliITSgeom *geom = GetITSgeom(); | |
1016 | ||
1017 | const char *all = strstr(opt,"All"); | |
1018 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
88cb7938 | 1019 | strstr(opt,"SSD")}; |
e0fc0305 | 1020 | if( !det[0] && !det[1] && !det[2] ) all = "All"; |
1021 | else all = 0; | |
1022 | static Bool_t setDef=kTRUE; | |
1023 | if (setDef) SetDefaultSimulation(); | |
1024 | setDef=kFALSE; | |
1025 | ||
1026 | AliITSsimulation *sim = 0; | |
1027 | AliITSDetType *iDetType = 0; | |
88cb7938 | 1028 | TTree *trees = fLoader->TreeS(); |
e0fc0305 | 1029 | if( !(trees && this->GetSDigits()) ){ |
88cb7938 | 1030 | Error("SDigits2Digits","Error: No trees or SDigits. Returning."); |
1031 | return; | |
e0fc0305 | 1032 | } // end if |
1033 | sprintf( name, "%s", this->GetName() ); | |
1034 | TBranch *brchSDigits = trees->GetBranch( name ); | |
1035 | ||
1036 | Int_t id,module; | |
1037 | for(module=0;module<geom->GetIndexMax();module++){ | |
88cb7938 | 1038 | id = geom->GetModuleType(module); |
e0fc0305 | 1039 | if (!all && !det[id]) continue; |
88cb7938 | 1040 | iDetType = DetType(id); |
1041 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1042 | if (!sim) { | |
1043 | Error("SDigit2Digits", | |
1044 | "The simulation class was not instanciated!"); | |
1045 | exit(1); | |
1046 | } // end if !sim | |
1047 | sim->InitSimulationModule(module,gAlice->GetEvNumber()); | |
e0fc0305 | 1048 | // |
88cb7938 | 1049 | // add summable digits to module |
1050 | this->GetSDigits()->Clear(); | |
1051 | brchSDigits->GetEvent(module); | |
1052 | sim->AddSDigitsToModule(GetSDigits(),0); | |
e0fc0305 | 1053 | // |
1054 | // Digitise current module sum(SDigits)->Digits | |
1055 | sim->FinishSDigitiseModule(); | |
3bd79107 | 1056 | |
e0fc0305 | 1057 | // fills all branches - wasted disk space |
88cb7938 | 1058 | fLoader->TreeD()->Fill(); |
e0fc0305 | 1059 | this->ResetDigits(); |
1060 | } // end for module | |
1061 | ||
88cb7938 | 1062 | fLoader->TreeD()->GetEntries(); |
ed9afcd2 | 1063 | |
88cb7938 | 1064 | fLoader->TreeD()->AutoSave(); |
e0fc0305 | 1065 | // reset tree |
88cb7938 | 1066 | fLoader->TreeD()->Reset(); |
e0fc0305 | 1067 | |
2aea926d | 1068 | } |
1069 | //______________________________________________________________________ | |
1070 | void AliITS::Hits2Digits(){ | |
1071 | // Standard Hits to Digits function. | |
4a5bebc2 | 1072 | // Inputs: |
1073 | // none. | |
1074 | // Outputs: | |
1075 | // none. | |
2aea926d | 1076 | |
85a5290f | 1077 | fLoader->LoadHits("read"); |
1078 | fLoader->LoadDigits("recreate"); | |
1079 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
1080 | ||
1081 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { | |
2aea926d | 1082 | // Do the Hits to Digits operation. Use Standard input values. |
1083 | // Event number from file, no background hit merging , use size from | |
1084 | // AliITSgeom class, option="All", input from this file only. | |
85a5290f | 1085 | rl->GetEvent(iEvent); |
1086 | if (!fLoader->TreeD()) fLoader->MakeTree("D"); | |
1087 | MakeBranch("D"); | |
1088 | SetTreeAddress(); | |
1089 | HitsToDigits(iEvent,0,-1," ",fOpt," "); | |
1090 | } | |
1091 | ||
1092 | fLoader->UnloadHits(); | |
1093 | fLoader->UnloadDigits(); | |
2aea926d | 1094 | } |
1095 | //______________________________________________________________________ | |
1096 | void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
8e8eae84 | 1097 | Option_t *option, Option_t *opt, const char *filename){ |
3bd79107 | 1098 | // keep galice.root for signal and name differently the file for |
1099 | // background when add! otherwise the track info for signal will be lost ! | |
2aea926d | 1100 | // the condition below will disappear when the geom class will be |
4a5bebc2 | 1101 | // initialized for all versions - for the moment it is only for v5 ! |
1102 | // 7 is the SDD beam test version. Dummy routine. Hits are ITS's Summable | |
1103 | // Digits. | |
1104 | // Inputs: | |
1105 | // Int_t evnt Event to be processed. | |
1106 | // Int_t bgrev Background Hit tree number. | |
1107 | // Int_t nmodules Not used. | |
1108 | // Option_t *option String indicating if merging hits or not. To | |
1109 | // merge hits set equal to "Add". Otherwise no | |
1110 | // background hits are considered. | |
1111 | // Test_t *filename File name containing the background hits.. | |
1112 | // Outputs: | |
1113 | // none. | |
1114 | // Return: | |
1115 | // none. | |
e0fc0305 | 1116 | // return; // using Hits instead of the larger sdigits. |
1117 | ||
1118 | HitsToPreDigits(evNumber,bgrev,size,option,opt,filename); | |
2aea926d | 1119 | } |
1120 | //______________________________________________________________________ | |
1121 | void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
8e8eae84 | 1122 | Option_t *option, Option_t *opt, const char *filename){ |
4a5bebc2 | 1123 | // Keep galice.root for signal and name differently the file for |
2aea926d | 1124 | // background when add! otherwise the track info for signal will be lost ! |
1125 | // the condition below will disappear when the geom class will be | |
4a5bebc2 | 1126 | // initialized for all versions - for the moment it is only for v5 ! |
1127 | // 7 is the SDD beam test version. | |
1128 | // Inputs: | |
1129 | // Int_t evnt Event to be processed. | |
1130 | // Int_t bgrev Background Hit tree number. | |
1131 | // Int_t nmodules Not used. | |
1132 | // Option_t *option String indicating if merging hits or not. To | |
1133 | // merge hits set equal to "Add". Otherwise no | |
1134 | // background hits are considered. | |
1135 | // Test_t *filename File name containing the background hits.. | |
1136 | // Outputs: | |
1137 | // none. | |
1138 | // Return: | |
1139 | // none. | |
2aea926d | 1140 | |
1141 | if(!GetITSgeom()) return; // need transformations to do digitization. | |
1142 | AliITSgeom *geom = GetITSgeom(); | |
1143 | ||
1144 | const char *all = strstr(opt,"All"); | |
1145 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
88cb7938 | 1146 | strstr(opt,"SSD")}; |
2aea926d | 1147 | static Bool_t setDef=kTRUE; |
1148 | if (setDef) SetDefaultSimulation(); | |
1149 | setDef=kFALSE; | |
1150 | ||
1151 | Int_t nmodules; | |
1152 | InitModules(size,nmodules); | |
1153 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
1154 | ||
1155 | AliITSsimulation *sim = 0; | |
1156 | AliITSDetType *iDetType = 0; | |
1157 | AliITSmodule *mod = 0; | |
1158 | Int_t id,module; | |
1159 | for(module=0;module<geom->GetIndexMax();module++){ | |
88cb7938 | 1160 | id = geom->GetModuleType(module); |
2aea926d | 1161 | if (!all && !det[id]) continue; |
88cb7938 | 1162 | iDetType = DetType(id); |
1163 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1164 | if (!sim) { | |
1165 | Error("HitsToSDigits", | |
1166 | "The simulation class was not instanciated!"); | |
1167 | exit(1); | |
1168 | } // end if !sim | |
1169 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1170 | sim->SDigitiseModule(mod,module,evNumber); | |
1171 | // fills all branches - wasted disk space | |
1172 | fLoader->TreeS()->Fill(); | |
1173 | ResetSDigits(); | |
2aea926d | 1174 | } // end for module |
1175 | ||
1176 | ClearModules(); | |
1177 | ||
88cb7938 | 1178 | fLoader->TreeS()->GetEntries(); |
1179 | fLoader->TreeS()->AutoSave(); | |
1180 | fLoader->WriteSDigits("OVERWRITE"); | |
2aea926d | 1181 | // reset tree |
88cb7938 | 1182 | fLoader->TreeS()->Reset(); |
2aea926d | 1183 | } |
1184 | //______________________________________________________________________ | |
1185 | void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, | |
8e8eae84 | 1186 | Option_t *option, Option_t *opt, const char *filename){ |
4a5bebc2 | 1187 | // Keep galice.root for signal and name differently the file for |
2aea926d | 1188 | // background when add! otherwise the track info for signal will be lost ! |
1189 | // the condition below will disappear when the geom class will be | |
4a5bebc2 | 1190 | // initialized for all versions - for the moment it is only for v5 ! |
1191 | // 7 is the SDD beam test version. | |
1192 | // Inputs: | |
1193 | // Int_t evnt Event to be processed. | |
1194 | // Int_t bgrev Background Hit tree number. | |
1195 | // Int_t nmodules Not used. | |
1196 | // Option_t *option String indicating if merging hits or not. To | |
1197 | // merge hits set equal to "Add". Otherwise no | |
1198 | // background hits are considered. | |
1199 | // Test_t *filename File name containing the background hits.. | |
1200 | // Outputs: | |
1201 | // none. | |
1202 | // Return: | |
1203 | // none. | |
1204 | ||
2aea926d | 1205 | if(!GetITSgeom()) return; // need transformations to do digitization. |
1206 | AliITSgeom *geom = GetITSgeom(); | |
1207 | ||
1208 | const char *all = strstr(opt,"All"); | |
1209 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
88cb7938 | 1210 | strstr(opt,"SSD")}; |
2aea926d | 1211 | static Bool_t setDef=kTRUE; |
1212 | if (setDef) SetDefaultSimulation(); | |
1213 | setDef=kFALSE; | |
1214 | ||
1215 | Int_t nmodules; | |
1216 | InitModules(size,nmodules); | |
1217 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
1218 | ||
1219 | AliITSsimulation *sim = 0; | |
1220 | AliITSDetType *iDetType = 0; | |
1221 | AliITSmodule *mod = 0; | |
1222 | Int_t id,module; | |
1223 | for(module=0;module<geom->GetIndexMax();module++){ | |
88cb7938 | 1224 | id = geom->GetModuleType(module); |
2aea926d | 1225 | if (!all && !det[id]) continue; |
88cb7938 | 1226 | iDetType = DetType(id); |
1227 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1228 | if (!sim) { | |
1229 | Error("HitsToDigits", | |
1230 | "The simulation class was not instanciated!"); | |
1231 | exit(1); | |
1232 | } // end if !sim | |
1233 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1234 | sim->DigitiseModule(mod,module,evNumber); | |
1235 | // fills all branches - wasted disk space | |
1236 | fLoader->TreeD()->Fill(); | |
1237 | ResetDigits(); | |
2aea926d | 1238 | } // end for module |
4a5bebc2 | 1239 | |
2aea926d | 1240 | ClearModules(); |
3bd79107 | 1241 | |
88cb7938 | 1242 | fLoader->TreeD()->GetEntries(); |
1243 | fLoader->TreeD()->AutoSave(); | |
2aea926d | 1244 | // reset tree |
88cb7938 | 1245 | fLoader->TreeD()->Reset(); |
2aea926d | 1246 | } |
1247 | //______________________________________________________________________ | |
1248 | void AliITS::ResetSDigits(){ | |
4a5bebc2 | 1249 | // Reset the Summable Digits array. |
1250 | // Inputs: | |
1251 | // none. | |
1252 | // Outputs: | |
1253 | // none. | |
3bd79107 | 1254 | |
2aea926d | 1255 | if (fSDigits) fSDigits->Clear(); |
1256 | fNSDigits = 0; | |
3bd79107 | 1257 | } |
2aea926d | 1258 | //______________________________________________________________________ |
1259 | void AliITS::ResetDigits(){ | |
4a5bebc2 | 1260 | // Reset number of digits and the digits array for the ITS detector. |
1261 | // Inputs: | |
1262 | // none. | |
1263 | // Outputs: | |
1264 | // none. | |
3bd79107 | 1265 | |
2aea926d | 1266 | if (!fDtype) return; |
3bd79107 | 1267 | |
2aea926d | 1268 | Int_t i; |
1269 | for (i=0;i<kNTYPES;i++ ) { | |
88cb7938 | 1270 | if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear(); |
1271 | if (fNdtype) fNdtype[i]=0; | |
2aea926d | 1272 | } // end for i |
1273 | } | |
1274 | //______________________________________________________________________ | |
1275 | void AliITS::ResetDigits(Int_t i){ | |
4a5bebc2 | 1276 | // Reset number of digits and the digits array for this branch. |
1277 | // Inputs: | |
1278 | // none. | |
1279 | // Outputs: | |
1280 | // none. | |
828e06c7 | 1281 | |
2aea926d | 1282 | if (fDtype->At(i)) ((TClonesArray*)fDtype->At(i))->Clear(); |
1283 | if (fNdtype) fNdtype[i]=0; | |
1284 | } | |
1285 | //______________________________________________________________________ | |
1286 | void AliITS::AddSumDigit(AliITSpListItem &sdig){ | |
4a5bebc2 | 1287 | // Adds the a module full of summable digits to the summable digits tree. |
1288 | // Inputs: | |
1289 | // AliITSpListItem &sdig SDigit to be added to SDigits tree. | |
1290 | // Outputs: | |
1291 | // none. | |
1292 | // Return: | |
1293 | // none. | |
828e06c7 | 1294 | |
2aea926d | 1295 | TClonesArray &lsdig = *fSDigits; |
1296 | new(lsdig[fNSDigits++]) AliITSpListItem(sdig); | |
828e06c7 | 1297 | } |
2aea926d | 1298 | //______________________________________________________________________ |
1299 | void AliITS::AddRealDigit(Int_t id, Int_t *digits){ | |
4a5bebc2 | 1300 | // Add a real digit - as coming from data. |
1301 | // Inputs: | |
1302 | // Int_t id Detector type number. | |
1303 | // Int_t *digits Integer array containing the digits info. See | |
1304 | // AliITSdigit.h | |
1305 | // Outputs: | |
1306 | // none. | |
1307 | // Return: | |
1308 | // none. | |
9c74c52b | 1309 | |
2aea926d | 1310 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); |
1311 | new(ldigits[fNdtype[id]++]) AliITSdigit(digits); | |
1312 | } | |
1313 | //______________________________________________________________________ | |
1314 | void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){ | |
4a5bebc2 | 1315 | // Add a simulated digit. |
1316 | // Inputs: | |
1317 | // Int_t id Detector type number. | |
1318 | // AliITSdigit *d Digit to be added to the Digits Tree. See | |
1319 | // AliITSdigit.h | |
1320 | // Outputs: | |
1321 | // none. | |
1322 | // Return: | |
1323 | // none. | |
2aea926d | 1324 | |
1325 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); | |
1326 | ||
1327 | switch(id){ | |
1328 | case 0: | |
88cb7938 | 1329 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(*((AliITSdigitSPD*)d)); |
1330 | break; | |
2aea926d | 1331 | case 1: |
88cb7938 | 1332 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(*((AliITSdigitSDD*)d)); |
1333 | break; | |
2aea926d | 1334 | case 2: |
88cb7938 | 1335 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(*((AliITSdigitSSD*)d)); |
1336 | break; | |
2aea926d | 1337 | } // end switch id |
1338 | } | |
1339 | //______________________________________________________________________ | |
1340 | void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks, | |
88cb7938 | 1341 | Int_t *hits,Float_t *charges){ |
7f1a504b | 1342 | // Add a simulated digit to the list. |
1343 | // Inputs: | |
1344 | // Int_t id Detector type number. | |
1345 | // Float_t phys Physics indicator. See AliITSdigits.h | |
1346 | // Int_t *digits Integer array containing the digits info. See | |
1347 | // AliITSdigit.h | |
1348 | // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()] | |
1349 | // containing the track numbers that contributed to | |
1350 | // this digit. | |
1351 | // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()] | |
1352 | // containing the hit numbers, from AliITSmodule, that | |
1353 | // contributed to this digit. | |
1354 | // Float_t *charge Floating point array of the signals contributed | |
1355 | // to this digit by each track. | |
1356 | // Outputs: | |
1357 | // none. | |
1358 | // Return: | |
1359 | // none. | |
2aea926d | 1360 | |
7f1a504b | 1361 | TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id)); |
1362 | AliITSresponseSDD *resp = 0; | |
1363 | switch(id){ | |
1364 | case 0: | |
1365 | new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits); | |
1366 | break; | |
1367 | case 1: | |
1368 | resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel(); | |
1369 | new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks, | |
1370 | hits,charges,resp); | |
1371 | break; | |
1372 | case 2: | |
1373 | new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits); | |
1374 | break; | |
1375 | } // end switch id | |
2aea926d | 1376 | } |
1377 | //______________________________________________________________________ | |
1378 | void AliITS::MakeTreeC(Option_t *option){ | |
88cb7938 | 1379 | // Create a separate tree to store the clusters. |
1380 | // Inputs: | |
1381 | // Option_t *option string which must contain "C" otherwise | |
1382 | // no Cluster Tree is created. | |
1383 | // Outputs: | |
1384 | // none. | |
1385 | // Return: | |
1386 | // none. | |
1387 | ||
1388 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; | |
1389 | ||
1390 | if (pITSLoader == 0x0) { | |
ac74f489 | 1391 | Error("MakeTreeC","fLoader == 0x0 option=%s",option); |
88cb7938 | 1392 | return; |
1393 | } | |
1394 | if (pITSLoader->TreeC() == 0x0) pITSLoader->MakeTree("C"); | |
1395 | MakeBranchC(); | |
1396 | } | |
828e06c7 | 1397 | |
88cb7938 | 1398 | void AliITS::MakeBranchC() |
1399 | { | |
1400 | //Makes barnches in treeC | |
1401 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; | |
1402 | if (pITSLoader == 0x0) | |
1403 | { | |
1404 | Error("MakeTreeC","fLoader == 0x0"); | |
1405 | return; | |
1406 | } | |
93f82b23 | 1407 | TTree * lTC = pITSLoader->TreeC(); |
1408 | if (lTC == 0x0) | |
88cb7938 | 1409 | { |
1410 | Error("MakeTreeC","Can not get TreeC from Loader"); | |
1411 | return; | |
1412 | } | |
1413 | ||
1414 | Int_t buffersize = 4000; | |
1415 | char branchname[30]; | |
1416 | const char *det[3] = {"SPD","SDD","SSD"}; | |
1417 | char digclass[40]; | |
1418 | char clclass[40]; | |
caf37aec | 1419 | |
2aea926d | 1420 | // one branch for Clusters per type of detector |
88cb7938 | 1421 | Int_t i; |
1422 | for (i=0; i<kNTYPES ;i++) | |
1423 | { | |
2aea926d | 1424 | AliITSDetType *iDetType=DetType(i); |
1425 | iDetType->GetClassNames(digclass,clclass); | |
88cb7938 | 1426 | // clusters |
1427 | if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); | |
1428 | if(!ClustersAddress(i)) | |
1429 | { | |
def15085 | 1430 | fCtype->AddAt(new TClonesArray(clclass,1000),i); |
88cb7938 | 1431 | } |
2aea926d | 1432 | if (kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); |
88cb7938 | 1433 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); |
93f82b23 | 1434 | if (fCtype && lTC) |
88cb7938 | 1435 | { |
93f82b23 | 1436 | if (lTC->GetBranch(branchname)) |
88cb7938 | 1437 | { |
1438 | Warning("MakeBranchC","Branch %s alread exists in TreeC",branchname); | |
1439 | } | |
1440 | else | |
1441 | { | |
1442 | Info("MakeBranchC","Creating branch %s in TreeC",branchname); | |
93f82b23 | 1443 | lTC->Branch(branchname,&((*fCtype)[i]), buffersize); |
88cb7938 | 1444 | } |
93f82b23 | 1445 | } // end if fCtype && lTC |
88cb7938 | 1446 | } // end for i |
2aea926d | 1447 | } |
88cb7938 | 1448 | |
2aea926d | 1449 | //______________________________________________________________________ |
1450 | void AliITS::GetTreeC(Int_t event){ | |
88cb7938 | 1451 | // Get the clusters tree for this event and set the branch address. |
1452 | // Inputs: | |
1453 | // Int_t event Event number for the cluster tree. | |
1454 | // Outputs: | |
1455 | // none. | |
1456 | // Return: | |
1457 | // none. | |
1458 | char branchname[30]; | |
1459 | const char *det[3] = {"SPD","SDD","SSD"}; | |
9c74c52b | 1460 | |
88cb7938 | 1461 | AliITSLoader *pITSLoader = (AliITSLoader*)fLoader; |
93f82b23 | 1462 | TTree * lTC = pITSLoader->TreeC(); |
3bd79107 | 1463 | |
88cb7938 | 1464 | ResetClusters(); |
93f82b23 | 1465 | if (lTC) { |
88cb7938 | 1466 | pITSLoader->CleanRawClusters(); |
1467 | } // end if TreeC() | |
2aea926d | 1468 | |
88cb7938 | 1469 | |
1470 | TBranch *branch; | |
1471 | ||
93f82b23 | 1472 | if (lTC) { |
88cb7938 | 1473 | Int_t i; |
1474 | char digclass[40]; | |
1475 | char clclass[40]; | |
1476 | for (i=0; i<kNTYPES; i++) { | |
1477 | AliITSDetType *iDetType=DetType(i); | |
1478 | iDetType->GetClassNames(digclass,clclass); | |
1479 | // clusters | |
1480 | if (fCtype == 0x0) fCtype = new TObjArray(fNDetTypes); | |
1481 | if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(clclass,1000),i); | |
1482 | if(kNTYPES==3) sprintf(branchname,"%sClusters%s",GetName(),det[i]); | |
1483 | else sprintf(branchname,"%sClusters%d",GetName(),i+1); | |
1484 | if (fCtype) { | |
93f82b23 | 1485 | branch = lTC->GetBranch(branchname); |
88cb7938 | 1486 | if (branch) branch->SetAddress(&((*fCtype)[i])); |
1487 | } // end if fCtype | |
1488 | } // end for i | |
1489 | } else { | |
1490 | Error("GetTreeC","cannot find Clusters Tree for event:%d",event); | |
93f82b23 | 1491 | } // end if lTC |
2aea926d | 1492 | } |
1493 | //______________________________________________________________________ | |
1494 | void AliITS::AddCluster(Int_t id, AliITSRawCluster *c){ | |
4a5bebc2 | 1495 | // Add a cluster to the list. |
1496 | // Inputs: | |
1497 | // Int_t id Detector type number. | |
1498 | // AliITSRawCluster *c Cluster class to be added to the tree of | |
1499 | // clusters. | |
1500 | // Outputs: | |
1501 | // none. | |
1502 | // Return: | |
1503 | // none. | |
2aea926d | 1504 | |
1505 | TClonesArray &lc = *((TClonesArray*)fCtype->At(id)); | |
1506 | ||
1507 | switch(id){ | |
1508 | case 0: | |
88cb7938 | 1509 | new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c)); |
1510 | break; | |
2aea926d | 1511 | case 1: |
88cb7938 | 1512 | new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c)); |
1513 | break; | |
2aea926d | 1514 | case 2: |
88cb7938 | 1515 | new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c)); |
1516 | break; | |
2aea926d | 1517 | } // end switch id |
1518 | } | |
1519 | //______________________________________________________________________ | |
1520 | void AliITS::ResetClusters(){ | |
4a5bebc2 | 1521 | // Reset number of clusters and the clusters array for ITS. |
1522 | // Inputs: | |
1523 | // none. | |
1524 | // Outputs: | |
1525 | // none. | |
2aea926d | 1526 | |
1527 | Int_t i; | |
4a5bebc2 | 1528 | for (i=0;i<kNTYPES;i++ ) ResetClusters(i); |
2aea926d | 1529 | } |
1530 | //______________________________________________________________________ | |
1531 | void AliITS::ResetClusters(Int_t i){ | |
4a5bebc2 | 1532 | // Reset number of clusters and the clusters array for this branch. |
1533 | // Inputs: | |
1534 | // Int_t i Detector type number. | |
1535 | // Outputs: | |
1536 | // none. | |
1537 | // Return: | |
1538 | // none. | |
3bd79107 | 1539 | |
2aea926d | 1540 | if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear(); |
1541 | if (fNctype) fNctype[i]=0; | |
1542 | } | |
1543 | //______________________________________________________________________ | |
ff0e455e | 1544 | void AliITS::MakeBranchR(const char *file, Option_t *opt){ |
2aea926d | 1545 | // Creates Tree branches for the ITS Reconstructed points. |
4a5bebc2 | 1546 | // Inputs: |
1547 | // cont char *file File name where RecPoints branch is to be written | |
1548 | // to. If blank it write the SDigits to the same | |
1549 | // file in which the Hits were found. | |
1550 | // Outputs: | |
1551 | // none. | |
1552 | // Return: | |
1553 | // none. | |
1554 | Int_t buffsz = 4000; | |
2aea926d | 1555 | char branchname[30]; |
3bd79107 | 1556 | |
2aea926d | 1557 | // only one branch for rec points for all detector types |
ff0e455e | 1558 | Bool_t oFast= (strstr(opt,"Fast")!=0); |
1559 | if(oFast){ | |
1560 | sprintf(branchname,"%sRecPointsF",GetName()); | |
1561 | } else { | |
1562 | sprintf(branchname,"%sRecPoints",GetName()); | |
1563 | } | |
88cb7938 | 1564 | |
1565 | ||
8a92b3ef | 1566 | if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); |
1567 | if (fLoader->TreeR()) { | |
88cb7938 | 1568 | if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); |
1569 | MakeBranchInTree(fLoader->TreeR(),branchname,&fRecPoints,buffsz,file); | |
2aea926d | 1570 | } // end if |
1571 | } | |
1572 | //______________________________________________________________________ | |
1573 | void AliITS::SetTreeAddressR(TTree *treeR){ | |
1574 | // Set branch address for the Reconstructed points Trees. | |
4a5bebc2 | 1575 | // Inputs: |
1576 | // TTree *treeR Tree containing the RecPoints. | |
1577 | // Outputs: | |
1578 | // none. | |
1579 | // Return: | |
1580 | // none. | |
2aea926d | 1581 | char branchname[30]; |
3bd79107 | 1582 | |
2aea926d | 1583 | if(!treeR) return; |
88cb7938 | 1584 | if (fRecPoints == 0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000); |
2aea926d | 1585 | TBranch *branch; |
2aea926d | 1586 | sprintf(branchname,"%sRecPoints",GetName()); |
1587 | branch = treeR->GetBranch(branchname); | |
ff0e455e | 1588 | if (branch) { |
1589 | branch->SetAddress(&fRecPoints); | |
1590 | } | |
1591 | else { | |
1592 | sprintf(branchname,"%sRecPointsF",GetName()); | |
1593 | branch = treeR->GetBranch(branchname); | |
1594 | if (branch) { | |
1595 | branch->SetAddress(&fRecPoints); | |
1596 | } | |
1597 | } | |
2aea926d | 1598 | } |
1599 | //______________________________________________________________________ | |
1600 | void AliITS::AddRecPoint(const AliITSRecPoint &r){ | |
1601 | // Add a reconstructed space point to the list | |
4a5bebc2 | 1602 | // Inputs: |
1603 | // const AliITSRecPoint &r RecPoint class to be added to the tree | |
1604 | // of reconstructed points TreeR. | |
1605 | // Outputs: | |
1606 | // none. | |
1607 | // Return: | |
1608 | // none. | |
3bd79107 | 1609 | |
2aea926d | 1610 | TClonesArray &lrecp = *fRecPoints; |
1611 | new(lrecp[fNRecPoints++]) AliITSRecPoint(r); | |
3bd79107 | 1612 | } |
2aea926d | 1613 | //______________________________________________________________________ |
e8189707 | 1614 | void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, |
8e8eae84 | 1615 | Option_t *opt0,Option_t *opt1, const char *flnm){ |
3bd79107 | 1616 | // keep galice.root for signal and name differently the file for |
1617 | // background when add! otherwise the track info for signal will be lost ! | |
2aea926d | 1618 | // the condition below will disappear when the geom class will be |
4a5bebc2 | 1619 | // initialized for all versions - for the moment it is only for v5 ! |
1620 | // Inputs: | |
1621 | // Int_t evnt Event to be processed. | |
1622 | // Int_t bgrev Background Hit tree number. | |
1623 | // Int_t size Size used by InitModules. See InitModules. | |
1624 | // Option_t *opt0 Option passed to FillModules. See FillModules. | |
1625 | // Option_t *opt1 String indicating if merging hits or not. To | |
1626 | // merge hits set equal to "Add". Otherwise no | |
1627 | // background hits are considered. | |
1628 | // Test_t *flnm File name containing the background hits.. | |
1629 | // Outputs: | |
1630 | // none. | |
1631 | // Return: | |
1632 | // none. | |
1633 | ||
2aea926d | 1634 | if(!GetITSgeom()) return; |
8a92b3ef | 1635 | AliITSLoader *pITSloader = (AliITSLoader*)fLoader; |
2aea926d | 1636 | AliITSgeom *geom = GetITSgeom(); |
1637 | ||
1638 | const char *all = strstr(opt1,"All"); | |
1639 | const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"), | |
88cb7938 | 1640 | strstr(opt1,"SSD")}; |
2aea926d | 1641 | Int_t nmodules; |
1642 | InitModules(size,nmodules); | |
1643 | FillModules(evNumber,bgrev,nmodules,opt0,flnm); | |
1644 | ||
1645 | AliITSsimulation *sim = 0; | |
1646 | AliITSDetType *iDetType = 0; | |
1647 | AliITSmodule *mod = 0; | |
1648 | Int_t id,module; | |
e3b819ce | 1649 | |
1650 | //m.b. : this change is nothing but a nice way to make sure | |
1651 | //the CPU goes up ! | |
88cb7938 | 1652 | |
1653 | cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl; | |
1654 | ||
1655 | for(module=0;module<geom->GetIndexMax();module++) | |
1656 | { | |
1657 | id = geom->GetModuleType(module); | |
2aea926d | 1658 | if (!all && !det[id]) continue; |
88cb7938 | 1659 | iDetType = DetType(id); |
1660 | sim = (AliITSsimulation*)iDetType->GetSimulationModel(); | |
1661 | if (!sim) | |
1662 | { | |
1663 | Error("HitsToFastPoints","The simulation class was not instanciated!"); | |
1664 | exit(1); | |
1665 | } // end if !sim | |
1666 | mod = (AliITSmodule *)fITSmodules->At(module); | |
1667 | sim->CreateFastRecPoints(mod,module,gRandom); | |
1668 | cout<<module<<"\r";fflush(0); | |
8a92b3ef | 1669 | //gAlice->TreeR()->Fill(); |
93f82b23 | 1670 | TTree *lTR = pITSloader->TreeR(); |
1671 | TBranch *br=lTR->GetBranch("ITSRecPointsF"); | |
88cb7938 | 1672 | br->Fill(); |
1673 | ResetRecPoints(); | |
2aea926d | 1674 | } // end for module |
4a5bebc2 | 1675 | |
2aea926d | 1676 | ClearModules(); |
88cb7938 | 1677 | |
1678 | fLoader->WriteRecPoints("OVERWRITE"); | |
2aea926d | 1679 | } |
1680 | //______________________________________________________________________ | |
1681 | void AliITS::Digits2Reco(){ | |
4a5bebc2 | 1682 | // Find clusters and reconstruct space points. |
1683 | // Inputs: | |
1684 | // none. | |
1685 | // Outputs: | |
1686 | // none. | |
2aea926d | 1687 | |
88cb7938 | 1688 | AliHeader *header=fLoader->GetRunLoader()->GetHeader(); |
2aea926d | 1689 | // to Digits to RecPoints for event in file, all digits in file, and |
1690 | // all ITS detectors. | |
7d8046e8 | 1691 | DigitsToRecPoints(header->GetEvent(),0,fOpt); |
2aea926d | 1692 | } |
1693 | //______________________________________________________________________ | |
1694 | void AliITS::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt){ | |
88cb7938 | 1695 | // cluster finding and reconstruction of space points |
1696 | // the condition below will disappear when the geom class will be | |
1697 | // initialized for all versions - for the moment it is only for v5 ! | |
1698 | // 7 is the SDD beam test version | |
1699 | // Inputs: | |
1700 | // Int_t evNumber Event number to be processed. | |
1701 | // Int_t lastentry Offset for module when not all of the modules | |
1702 | // are processed. | |
1703 | // Option_t *opt String indicating which ITS sub-detectors should | |
1704 | // be processed. If ="All" then all of the ITS | |
1705 | // sub detectors are processed. | |
1706 | // Outputs: | |
1707 | // none. | |
1708 | // Return: | |
1709 | // none. | |
1710 | ||
1711 | if(!GetITSgeom()) return; | |
1712 | AliITSgeom *geom = GetITSgeom(); | |
2aea926d | 1713 | |
88cb7938 | 1714 | const char *all = strstr(opt,"All"); |
1715 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
1716 | strstr(opt,"SSD")}; | |
1717 | static Bool_t setRec=kTRUE; | |
1718 | if (setRec) SetDefaultClusterFinders(); | |
1719 | setRec=kFALSE; | |
1720 | ||
1721 | AliITSLoader *pITSloader = (AliITSLoader*)fLoader; | |
1722 | TTree *treeC=pITSloader->TreeC(); | |
1723 | AliITSClusterFinder *rec = 0; | |
1724 | AliITSDetType *iDetType = 0; | |
1725 | Int_t id,module,first=0; | |
1726 | for(module=0;module<geom->GetIndexMax();module++){ | |
ac74f489 | 1727 | id = geom->GetModuleType(module); |
1728 | if (!all && !det[id]) continue; | |
1729 | if(det[id]) first = geom->GetStartDet(id); | |
1730 | iDetType = DetType(id); | |
1731 | rec = (AliITSClusterFinder*)iDetType->GetReconstructionModel(); | |
1732 | TClonesArray *itsDigits = this->DigitsAddress(id); | |
1733 | if (!rec) { | |
1734 | Error("DigitsToRecPoints", | |
1735 | "The reconstruction class was not instanciated! event=%d", | |
1736 | evNumber); | |
1737 | exit(1); | |
1738 | } // end if !rec | |
1739 | this->ResetDigits(); | |
93f82b23 | 1740 | TTree *lTD = pITSloader->TreeD(); |
ac74f489 | 1741 | if (all) { |
93f82b23 | 1742 | lTD->GetEvent(lastentry+module); |
ac74f489 | 1743 | }else { |
93f82b23 | 1744 | lTD->GetEvent(lastentry+(module-first)); |
ac74f489 | 1745 | } |
1746 | Int_t ndigits = itsDigits->GetEntriesFast(); | |
1747 | if (ndigits) rec->FindRawClusters(module); | |
1748 | pITSloader->TreeR()->Fill(); | |
1749 | ResetRecPoints(); | |
1750 | treeC->Fill(); | |
1751 | ResetClusters(); | |
88cb7938 | 1752 | } // end for module |
828e06c7 | 1753 | |
2aea926d | 1754 | |
88cb7938 | 1755 | pITSloader->WriteRecPoints("OVERWRITE"); |
1756 | pITSloader->WriteRawClusters("OVERWRITE"); | |
fe4da5cc | 1757 | } |
2aea926d | 1758 | //______________________________________________________________________ |
1759 | void AliITS::ResetRecPoints(){ | |
4a5bebc2 | 1760 | // Reset number of rec points and the rec points array. |
1761 | // Inputs: | |
1762 | // none. | |
1763 | // Outputs: | |
1764 | // none. | |
63147407 | 1765 | |
2aea926d | 1766 | if (fRecPoints) fRecPoints->Clear(); |
1767 | fNRecPoints = 0; | |
1768 | } | |
88cb7938 | 1769 | //______________________________________________________________________ |
1770 | AliLoader* AliITS::MakeLoader(const char* topfoldername) | |
1771 | { | |
1772 | //builds ITSgetter (AliLoader type) | |
1773 | //if detector wants to use castomized getter, it must overload this method | |
1774 | ||
f2a509af | 1775 | Info("MakeLoader","Creating AliITSLoader. Top folder is %s.",topfoldername); |
88cb7938 | 1776 | fLoader = new AliITSLoader(GetName(),topfoldername); |
1777 | return fLoader; | |
88cb7938 | 1778 | } |
1779 | ||
1780 | ||
596a855f | 1781 | //_____________________________________________________________________________ |
1782 | void AliITS::Reconstruct() const | |
1783 | { | |
1784 | // reconstruct clusters | |
1785 | ||
1786 | AliLoader* loader = GetLoader(); | |
1787 | loader->LoadRecPoints("recreate"); | |
1788 | loader->LoadDigits("read"); | |
1789 | ||
1790 | AliITSclustererV2 clusterer(GetITSgeom()); | |
1791 | AliRunLoader* runLoader = loader->GetRunLoader(); | |
1792 | Int_t nEvents = runLoader->GetNumberOfEvents(); | |
1793 | ||
1794 | for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { | |
1795 | runLoader->GetEvent(iEvent); | |
1796 | ||
1797 | TTree* treeClusters = loader->TreeR(); | |
1798 | if (!treeClusters) { | |
1799 | loader->MakeTree("R"); | |
1800 | treeClusters = loader->TreeR(); | |
1801 | } | |
1802 | TTree* treeDigits = loader->TreeD(); | |
1803 | if (!treeDigits) { | |
1804 | Error("Reconstruct", "Can't get digits tree !"); | |
1805 | return; | |
1806 | } | |
1807 | ||
1808 | clusterer.Digits2Clusters(treeDigits, treeClusters); | |
1809 | ||
1810 | loader->WriteRecPoints("OVERWRITE"); | |
1811 | } | |
1812 | ||
1813 | loader->UnloadRecPoints(); | |
1814 | loader->UnloadDigits(); | |
1815 | } | |
1816 | ||
1817 | //_____________________________________________________________________________ | |
1818 | AliTracker* AliITS::CreateTracker() const | |
1819 | { | |
1820 | // create an ITS tracker | |
1821 | ||
2257f27e | 1822 | return new AliITStrackerSA(GetITSgeom()); |
1823 | } | |
1824 | //_____________________________________________________________________________ | |
1825 | AliVertexer* AliITS::CreateVertexer() const | |
1826 | { | |
1827 | // create a ITS vertexer | |
1828 | ||
1829 | if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){ | |
1830 | Info("CreateVertexer","a AliITSVertexerIons object has been selected\n"); | |
1831 | return new AliITSVertexerIons("null"); | |
1832 | } | |
1833 | if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.Contains("SMEAR")){ | |
1834 | Double_t smear[3]={0.005,0.005,0.01}; | |
1835 | Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); | |
1836 | return new AliITSVertexerFast(smear); | |
1837 | } | |
1838 | if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){ | |
1839 | Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n"); | |
1840 | return new AliITSVertexerPPZ("null"); | |
1841 | } | |
1842 | // by default an AliITSVertexerZ object is instatiated | |
1843 | Info("CreateVertexer","a AliITSVertexerZ object has been selected\n"); | |
1844 | return new AliITSVertexerZ("null"); | |
596a855f | 1845 | } |
1846 | ||
1847 | //_____________________________________________________________________________ | |
1848 | void AliITS::FillESD(AliESD* esd) const | |
1849 | { | |
1850 | // make PID, find V0s and cascades | |
1851 | ||
1852 | Double_t parITS[] = {34., 0.15, 10.}; | |
1853 | AliITSpidESD itsPID(parITS); | |
1854 | itsPID.MakePID(esd); | |
1855 | ||
1856 | // V0 finding | |
1857 | Double_t cuts[]={33, // max. allowed chi2 | |
1858 | 0.16,// min. allowed negative daughter's impact parameter | |
1859 | 0.05,// min. allowed positive daughter's impact parameter | |
1860 | 0.080,// max. allowed DCA between the daughter tracks | |
1861 | 0.998,// max. allowed cosine of V0's pointing angle | |
1862 | 0.9, // min. radius of the fiducial volume | |
1863 | 2.9 // max. radius of the fiducial volume | |
1864 | }; | |
1865 | AliV0vertexer vtxer(cuts); | |
1866 | Double_t vtx[3], cvtx[6]; | |
2257f27e | 1867 | esd->GetVertex()->GetXYZ(vtx); |
1868 | esd->GetVertex()->GetSigmaXYZ(cvtx); | |
596a855f | 1869 | vtxer.SetVertex(vtx); |
1870 | vtxer.Tracks2V0vertices(esd); | |
1871 | ||
1872 | // cascade finding | |
1873 | Double_t cts[]={33., // max. allowed chi2 | |
1874 | 0.05, // min. allowed V0 impact parameter | |
1875 | 0.008, // window around the Lambda mass | |
1876 | 0.035, // min. allowed bachelor's impact parameter | |
1877 | 0.10, // max. allowed DCA between a V0 and a track | |
1878 | 0.9985, //max. allowed cosine of the cascade pointing angle | |
1879 | 0.9, // min. radius of the fiducial volume | |
1880 | 2.9 // max. radius of the fiducial volume | |
1881 | }; | |
1882 | AliCascadeVertexer cvtxer=AliCascadeVertexer(cts); | |
1883 | cvtxer.V0sTracks2CascadeVertices(esd); | |
1884 | } | |
1885 |