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