]>
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 | /////////////////////////////////////////////////////////////////////////////// |
04366a57 | 20 | // // |
21 | // An overview of the basic philosophy of the ITS code development // | |
22 | // and analysis is show in the figure below. // | |
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 | |
143d1056 | 68 | #include <stdlib.h> |
caf37aec | 69 | #include <TClonesArray.h> |
9c74c52b | 70 | #include <TFile.h> |
7d62fb64 | 71 | #include <TParticle.h> |
d5da1ecf | 72 | #include <TString.h> |
88cb7938 | 73 | #include <TTree.h> |
88cb7938 | 74 | #include <TVirtualMC.h> |
7d62fb64 | 75 | #include "AliDetector.h" |
3bd79107 | 76 | #include "AliITS.h" |
7d62fb64 | 77 | #include "AliITSDetTypeSim.h" |
f77f13c8 | 78 | #include "AliITSDDLRawData.h" |
88cb7938 | 79 | #include "AliITSLoader.h" |
88cb7938 | 80 | #include "AliITShit.h" |
81 | #include "AliITSmodule.h" | |
7d62fb64 | 82 | #include "AliITSpListItem.h" |
83 | #include "AliITSsimulation.h" | |
84 | #include "AliITSsimulationFastPoints.h" | |
5d12ce38 | 85 | #include "AliMC.h" |
7d62fb64 | 86 | #include "AliITSDigitizer.h" |
87 | #include "AliITSRecPoint.h" | |
f77f13c8 | 88 | #include "AliRun.h" |
7d62fb64 | 89 | #include "AliLog.h" |
ef7ff1f9 | 90 | #include "AliITSInitGeometry.h" |
828e06c7 | 91 | |
3bd79107 | 92 | ClassImp(AliITS) |
3bd79107 | 93 | |
2aea926d | 94 | //______________________________________________________________________ |
7d62fb64 | 95 | AliITS::AliITS() : AliDetector(){ |
96 | // Default initializer for ITS | |
97 | // The default constructor of the AliITS class. In addition to | |
98 | // creating the AliITS class it zeros the variables fIshunt (a member | |
99 | // of AliDetector class), fEuclidOut, and fIdN, and zeros the pointers | |
100 | // fIdSens, and fIdName. The AliDetector default constructor | |
101 | // is also called. | |
102 | ||
103 | fEuclidOut=0; | |
104 | fOpt="All"; | |
105 | fIdSens=0; | |
106 | fIdName=0; | |
107 | fDetTypeSim=0; | |
108 | fIshunt = 0; // not zeroed in AliDetector. | |
109 | fHits =0; | |
110 | fNhits=0; | |
111 | fITSmodules=0; | |
112 | ||
aa044888 | 113 | // SetDetectors(); // default to fOpt="All". This variable not written out. |
2aea926d | 114 | SetMarkerColor(kRed); |
fe4da5cc | 115 | } |
2aea926d | 116 | //______________________________________________________________________ |
7d62fb64 | 117 | AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ |
118 | // The standard Constructor for the ITS class. | |
119 | // It also zeros the variables | |
120 | // fIshunt (a member of AliDetector class), fEuclidOut, and zeros | |
121 | // the pointers fIdSens and fIdName. To help in displaying hits via the | |
122 | // ROOT macro display.C AliITS also sets the marker color to red. The | |
123 | // variables passes with this constructor, const char *name and *title, | |
124 | // are used by the constructor of AliDetector class. See AliDetector | |
125 | // class for a description of these parameters and its constructor | |
126 | // functions. | |
127 | ||
128 | fEuclidOut=0; | |
129 | fOpt="All"; | |
130 | fIdSens=0; | |
131 | fIdName=0; | |
132 | fDetTypeSim=0; | |
133 | fHits = new TClonesArray("AliITShit",1560); | |
134 | if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits); | |
135 | fNhits=0; | |
136 | fITSmodules = 0; | |
137 | ||
138 | fIshunt = 0; // not zeroed in AliDetector | |
139 | // Not done in AliDetector. | |
140 | ||
141 | fEuclidOut = 0; | |
142 | SetDetectors(); // default to fOpt="All". This variable not written out. | |
143 | ||
144 | fIdName = 0; | |
145 | fIdSens = 0; | |
146 | ||
147 | fDetTypeSim = new AliITSDetTypeSim(); | |
148 | ||
149 | SetMarkerColor(kRed); | |
023ae34b | 150 | if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName()); |
151 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); | |
fe4da5cc | 152 | |
3bd79107 | 153 | } |
2aea926d | 154 | //______________________________________________________________________ |
58005f18 | 155 | AliITS::~AliITS(){ |
4a5bebc2 | 156 | // Default destructor for ITS. |
2aea926d | 157 | // The default destructor of the AliITS class. In addition to deleting |
7d62fb64 | 158 | // the AliITS class it deletes the memory pointed to by |
159 | // fIdSens, fIdName, fDetTypeSim and it's contents. | |
4a5bebc2 | 160 | // Inputs: |
161 | // none. | |
162 | // Outputs: | |
163 | // none. | |
164 | // Return: | |
165 | // none. | |
023ae34b | 166 | |
88cb7938 | 167 | if (fHits) { |
168 | fHits->Delete(); | |
169 | delete fHits; | |
170 | fHits=0; | |
171 | } | |
88cb7938 | 172 | if(fITSmodules) { |
173 | this->ClearModules(); | |
174 | delete fITSmodules; | |
279a35d7 | 175 | fITSmodules = 0; |
88cb7938 | 176 | }// end if fITSmodules!=0 |
177 | ||
7d62fb64 | 178 | delete[] fIdName; // Array of TStrings |
179 | delete[] fIdSens; | |
180 | ||
181 | if (fDetTypeSim){ | |
182 | delete fDetTypeSim; | |
183 | fDetTypeSim = 0; | |
184 | } | |
3bd79107 | 185 | } |
2aea926d | 186 | //______________________________________________________________________ |
ac74f489 | 187 | AliITS::AliITS(const AliITS &source) : AliDetector(source){ |
4a5bebc2 | 188 | // Copy constructor. This is a function which is not allowed to be |
189 | // done to the ITS. It exits with an error. | |
190 | // Inputs: | |
191 | // AliITS &source An AliITS class. | |
192 | // Outputs: | |
193 | // none. | |
194 | // Return: | |
195 | // none. | |
3bd79107 | 196 | |
2aea926d | 197 | if(this==&source) return; |
4a5bebc2 | 198 | Error("Copy constructor", |
88cb7938 | 199 | "You are not allowed to make a copy of the AliITS"); |
2aea926d | 200 | exit(1); |
3bd79107 | 201 | } |
2aea926d | 202 | //______________________________________________________________________ |
7d62fb64 | 203 | AliITS& AliITS::operator=(const AliITS &source){ |
4a5bebc2 | 204 | // Assignment operator. This is a function which is not allowed to be |
205 | // done to the ITS. It exits with an error. | |
206 | // Inputs: | |
207 | // AliITS &source An AliITS class. | |
208 | // Outputs: | |
209 | // none. | |
210 | // Return: | |
211 | // none. | |
3bd79107 | 212 | |
2aea926d | 213 | if(this==&source) return *this; |
4a5bebc2 | 214 | Error("operator=","You are not allowed to make a copy of the AliITS"); |
2aea926d | 215 | exit(1); |
216 | return *this; //fake return | |
3bd79107 | 217 | } |
2aea926d | 218 | //______________________________________________________________________ |
aacedc3e | 219 | AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager)const{ |
220 | // Creates the AliITSDigitizer in a standard way for use via AliModule. | |
221 | // This function can not be included in the .h file because of problems | |
222 | // with the order of inclusion (recursive). | |
4a5bebc2 | 223 | // Inputs: |
aacedc3e | 224 | // AliRunDigitizer *manager The Manger class for Digitization |
225 | // Output: | |
226 | // none. | |
4a5bebc2 | 227 | // Return: |
aacedc3e | 228 | // A new AliITSRunDigitizer (cast as a AliDigitizer). |
3bd79107 | 229 | |
aacedc3e | 230 | return new AliITSDigitizer(manager); |
3bd79107 | 231 | } |
2aea926d | 232 | //______________________________________________________________________ |
233 | void AliITS::Init(){ | |
4a5bebc2 | 234 | // Initializer ITS after it has been built |
2aea926d | 235 | // This routine initializes the AliITS class. It is intended to be |
236 | // called from the Init function in AliITSv?. Besides displaying a banner | |
237 | // indicating that it has been called it initializes the array fIdSens | |
238 | // and sets the default segmentation, response, digit and raw cluster | |
239 | // classes therefore it should be called after a call to CreateGeometry. | |
4a5bebc2 | 240 | // Inputs: |
241 | // none. | |
242 | // Outputs: | |
243 | // none. | |
244 | // Return: | |
245 | // none. | |
3bd79107 | 246 | Int_t i; |
3bd79107 | 247 | |
2aea926d | 248 | SetDefaults(); |
249 | // Array of TStrings | |
0e73d04c | 250 | if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]); |
7d62fb64 | 251 | |
252 | WriteGeometry(); | |
253 | } | |
254 | ||
255 | //______________________________________________________________________ | |
256 | void AliITS::WriteGeometry(){ | |
257 | ||
023ae34b | 258 | //Writes ITS geometry on gAlice |
7d62fb64 | 259 | |
260 | if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName()); | |
261 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
262 | rl->CdGAFile(); | |
263 | AliITSgeom* geom = GetITSgeom(); | |
264 | geom->Write(); | |
265 | ||
3bd79107 | 266 | } |
7d62fb64 | 267 | |
2aea926d | 268 | //______________________________________________________________________ |
269 | void AliITS::SetDefaults(){ | |
4a5bebc2 | 270 | // sets the default segmentation, response, digit and raw cluster classes. |
271 | // Inputs: | |
272 | // none. | |
273 | // Outputs: | |
274 | // none. | |
275 | // Return: | |
276 | // none. | |
023ae34b | 277 | AliInfoClass("AliITS::Setting Defaults"); |
7d62fb64 | 278 | |
279 | if(!fDetTypeSim) { | |
280 | Error("SetDefaults()","fDetTypeSim is 0!"); | |
281 | return; | |
282 | } | |
283 | ||
284 | fDetTypeSim->SetDefaults(); | |
285 | ||
286 | ||
3bd79107 | 287 | } |
2aea926d | 288 | //______________________________________________________________________ |
289 | void AliITS::SetDefaultSimulation(){ | |
4a5bebc2 | 290 | // sets the default simulation. |
291 | // Inputs: | |
292 | // none. | |
293 | // Outputs: | |
294 | // none. | |
295 | // Return: | |
296 | // none. | |
7d62fb64 | 297 | if(!fDetTypeSim) { |
298 | Error("SetDefaultSimulation()","fDetTypeSim is 0!"); | |
299 | return; | |
300 | } | |
301 | ||
302 | fDetTypeSim->SetDefaultSimulation(); | |
04366a57 | 303 | |
04366a57 | 304 | } |
305 | ||
306 | ||
2aea926d | 307 | //______________________________________________________________________ |
88cb7938 | 308 | void AliITS::MakeBranch(Option_t* option){ |
2aea926d | 309 | // Creates Tree branches for the ITS. |
4a5bebc2 | 310 | // Inputs: |
311 | // Option_t *option String of Tree types S,D, and/or R. | |
312 | // const char *file String of the file name where these branches | |
313 | // are to be stored. If blank then these branches | |
314 | // are written to the same tree as the Hits were | |
315 | // read from. | |
316 | // Outputs: | |
317 | // none. | |
318 | // Return: | |
319 | // none. | |
7d62fb64 | 320 | if(!fDetTypeSim) { |
321 | Error("MakeBranch","fDetTypeSim is 0!"); | |
322 | return; | |
323 | } | |
04366a57 | 324 | |
7d62fb64 | 325 | Bool_t cH = (strstr(option,"H")!=0); |
326 | Bool_t cS = (strstr(option,"S")!=0); | |
327 | Bool_t cD = (strstr(option,"D")!=0); | |
328 | ||
329 | if(cH && (fHits == 0x0)) fHits = new TClonesArray("AliITShit", 1560); | |
330 | AliDetector::MakeBranch(option); | |
331 | ||
332 | if(cS) MakeBranchS(0); | |
333 | if(cD) MakeBranchD(0); | |
334 | ||
335 | ||
336 | } | |
337 | //___________________________________________________________________ | |
338 | void AliITS::MakeBranchS(const char* fl){ | |
339 | ||
340 | // Creates Tree Branch for the ITS summable digits. | |
341 | // Inputs: | |
342 | // cont char *fl File name where SDigits branch is to be written | |
343 | // to. If blank it write the SDigits to the same | |
344 | // file in which the Hits were found. | |
345 | ||
346 | ||
347 | if(!fDetTypeSim){ | |
348 | Error("MakeBranchS","fDetTypeSim is 0!"); | |
349 | } | |
350 | Int_t buffersize = 4000; | |
351 | char branchname[30]; | |
352 | ||
353 | // only one branch for SDigits. | |
354 | sprintf(branchname,"%s",GetName()); | |
355 | ||
356 | if(fLoader->TreeS()){ | |
357 | if(fDetTypeSim->GetSDigits()==0x0) fDetTypeSim->SetSDigits(new TClonesArray("AliITSpListItem",1000)); | |
358 | TClonesArray* sdig = (TClonesArray*)fDetTypeSim->GetSDigits(); | |
359 | MakeBranchInTree(fLoader->TreeS(),branchname,&sdig,buffersize,fl); | |
360 | } | |
361 | } | |
362 | //______________________________________________________________________ | |
363 | void AliITS::MakeBranchD(const char* file){ | |
364 | ||
365 | //Make branch for digits | |
366 | if(!fDetTypeSim) { | |
367 | Warning("MakeBranchD","fDetTypeSim is 0!"); | |
368 | return; | |
369 | } | |
023ae34b | 370 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 371 | MakeBranchInTreeD(fLoader->TreeD(),file); |
372 | } | |
373 | ||
374 | //___________________________________________________________________ | |
375 | void AliITS:: MakeBranchInTreeD(TTree* treeD, const char* file){ | |
376 | // Creates Tree branches for the ITS. | |
377 | ||
378 | if(!fDetTypeSim){ | |
379 | Error("MakeBranchS","fDetTypeSim is 0!"); | |
380 | } | |
023ae34b | 381 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 382 | |
383 | const Char_t *det[3] = {"SPD","SDD","SSD"}; | |
384 | Char_t* digclass; | |
385 | Int_t buffersize = 4000; | |
386 | Char_t branchname[30]; | |
387 | ||
388 | if(!fDetTypeSim->GetDigits()){ | |
389 | fDetTypeSim->SetDigits(new TObjArray(fgkNTYPES)); | |
390 | } | |
391 | for(Int_t i=0;i<fgkNTYPES;i++){ | |
392 | digclass = fDetTypeSim->GetDigitClassName(i); | |
393 | TString classn = digclass; | |
394 | if(!((fDetTypeSim->GetDigits())->At(i))){ | |
395 | (fDetTypeSim->GetDigits())->AddAt(new TClonesArray(classn.Data(),1000),i); | |
396 | } | |
397 | else ResetDigits(i); | |
398 | if(fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]); | |
399 | else sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
400 | TObjArray* dig = DigitsAddress(i); | |
401 | if(GetDigits() && treeD) AliDetector::MakeBranchInTree(treeD,branchname, &dig,buffersize,file); | |
402 | } | |
2aea926d | 403 | |
fe4da5cc | 404 | } |
2aea926d | 405 | //______________________________________________________________________ |
406 | void AliITS::SetTreeAddress(){ | |
407 | // Set branch address for the Trees. | |
4a5bebc2 | 408 | // Inputs: |
409 | // none. | |
410 | // Outputs: | |
411 | // none. | |
412 | // Return: | |
413 | // none. | |
023ae34b | 414 | |
7d62fb64 | 415 | if(!fDetTypeSim) { |
416 | Error("SetTreeAddress","fDetTypeSim is 0!"); | |
417 | return; | |
418 | } | |
419 | ||
023ae34b | 420 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 421 | |
422 | TTree *treeS = fLoader->TreeS(); | |
423 | TTree *treeD = fLoader->TreeD(); | |
424 | if (fLoader->TreeH() && (fHits == 0x0)) { | |
425 | fHits = new TClonesArray("AliITShit", 1560); | |
426 | } | |
427 | AliDetector::SetTreeAddress(); | |
428 | ||
429 | fDetTypeSim->SetTreeAddressS(treeS, (Char_t*)GetName()); | |
430 | fDetTypeSim->SetTreeAddressD(treeD, (Char_t*)GetName()); | |
fe4da5cc | 431 | } |
2aea926d | 432 | //______________________________________________________________________ |
2aea926d | 433 | void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ |
434 | // Add an ITS hit | |
435 | // The function to add information to the AliITShit class. See the | |
436 | // AliITShit class for a full description. This function allocates the | |
437 | // necessary new space for the hit information and passes the variable | |
438 | // track, and the pointers *vol and *hits to the AliITShit constructor | |
439 | // function. | |
4a5bebc2 | 440 | // Inputs: |
441 | // Int_t track Track number which produced this hit. | |
442 | // Int_t *vol Array of Integer Hit information. See AliITShit.h | |
443 | // Float_t *hits Array of Floating Hit information. see AliITShit.h | |
444 | // Outputs: | |
445 | // none. | |
446 | // Return: | |
447 | // none. | |
7d62fb64 | 448 | TClonesArray &lhits = *fHits; |
449 | new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); | |
3bd79107 | 450 | } |
9c74c52b | 451 | |
2aea926d | 452 | //______________________________________________________________________ |
453 | void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules, | |
8e8eae84 | 454 | Option_t *option, const char *filename){ |
7d62fb64 | 455 | // fill the modules with the sorted by module hits; add hits from |
456 | // background if option=Add. | |
457 | ||
458 | static TTree *trH1; //Tree with background hits | |
459 | static Bool_t first=kTRUE; | |
460 | static TFile *file; | |
461 | const char *addBgr = strstr(option,"Add"); | |
462 | ||
463 | evnt = nmodules; // Dummy use of variables to remove warnings | |
464 | if (addBgr ) { | |
465 | if(first) { | |
466 | file=new TFile(filename); | |
467 | } // end if first | |
468 | first=kFALSE; | |
469 | file->cd(); | |
470 | file->ls(); | |
471 | // Get Hits Tree header from file | |
472 | if(trH1) delete trH1; | |
473 | trH1=0; | |
474 | ||
475 | char treeName[20]; | |
476 | sprintf(treeName,"TreeH%d",bgrev); | |
477 | trH1 = (TTree*)gDirectory->Get(treeName); | |
478 | if (!trH1) { | |
479 | Error("FillModules","cannot find Hits Tree for event:%d",bgrev); | |
480 | } // end if !trH1 | |
481 | // Set branch addresses | |
482 | } // end if addBgr | |
483 | ||
484 | FillModules(fLoader->TreeH(),0); // fill from this file's tree. | |
3bd79107 | 485 | |
7d62fb64 | 486 | if (addBgr ) { |
487 | FillModules(trH1,10000000); // Default mask 10M. | |
488 | TTree *fAli=fLoader->GetRunLoader()->TreeK(); | |
489 | TFile *fileAli=0; | |
490 | if (fAli) fileAli =fAli->GetCurrentFile(); | |
491 | fileAli->cd(); | |
492 | } // end if add | |
493 | ||
494 | ||
3bd79107 | 495 | } |
7d62fb64 | 496 | |
497 | ||
2aea926d | 498 | //______________________________________________________________________ |
b4012daf | 499 | void AliITS::FillModules(TTree *treeH, Int_t mask) { |
500 | // fill the modules with the sorted by module hits; | |
501 | // can be called many times to do a merging | |
502 | // Inputs: | |
503 | // TTree *treeH The tree containing the hits to be copied into | |
504 | // the modules. | |
505 | // Int_t mask The track number mask to indecate which file | |
506 | // this hits came from. | |
507 | // Outputs: | |
508 | // none. | |
509 | // Return: | |
510 | // none. | |
511 | ||
88cb7938 | 512 | if (treeH == 0x0) |
513 | { | |
514 | Error("FillModules","Tree is NULL"); | |
515 | } | |
b4012daf | 516 | Int_t lay,lad,det,index; |
517 | AliITShit *itsHit=0; | |
518 | AliITSmodule *mod=0; | |
519 | char branchname[20]; | |
520 | sprintf(branchname,"%s",GetName()); | |
521 | TBranch *branch = treeH->GetBranch(branchname); | |
522 | if (!branch) { | |
88cb7938 | 523 | Error("FillModules","%s branch in TreeH not found",branchname); |
524 | return; | |
b4012daf | 525 | } // end if !branch |
526 | branch->SetAddress(&fHits); | |
527 | Int_t nTracks =(Int_t) treeH->GetEntries(); | |
528 | Int_t iPrimTrack,h; | |
529 | for(iPrimTrack=0; iPrimTrack<nTracks; iPrimTrack++){ | |
88cb7938 | 530 | ResetHits(); |
531 | Int_t nBytes = treeH->GetEvent(iPrimTrack); | |
532 | if (nBytes <= 0) continue; | |
533 | Int_t nHits = fHits->GetEntriesFast(); | |
534 | for(h=0; h<nHits; h++){ | |
535 | itsHit = (AliITShit *)fHits->UncheckedAt(h); | |
536 | itsHit->GetDetectorID(lay,lad,det); | |
7d62fb64 | 537 | if (GetITSgeom()) { |
538 | index = GetITSgeom()->GetModuleIndex(lay,lad,det); | |
88cb7938 | 539 | } else { |
540 | index=det-1; // This should not be used. | |
541 | } // end if [You must have fITSgeom for this to work!] | |
542 | mod = GetModule(index); | |
543 | itsHit->SetTrack(itsHit->GetTrack()+mask); // Set track mask. | |
544 | mod->AddHit(itsHit,iPrimTrack,h); | |
545 | } // end loop over hits | |
b4012daf | 546 | } // end loop over tracks |
547 | } | |
7d62fb64 | 548 | |
b4012daf | 549 | //______________________________________________________________________ |
7d62fb64 | 550 | void AliITS::InitModules(Int_t size,Int_t &nmodules){ |
551 | // Initialize the modules array. | |
4a5bebc2 | 552 | // Inputs: |
7d62fb64 | 553 | // Int_t size Size of array of the number of modules to be |
554 | // created. If size <=0 then the number of modules | |
555 | // is gotten from AliITSgeom class kept in fITSgeom. | |
4a5bebc2 | 556 | // Outputs: |
7d62fb64 | 557 | // Int_t &nmodules The number of modules existing. |
4a5bebc2 | 558 | // Return: |
559 | // none. | |
2ab0c725 | 560 | |
7d62fb64 | 561 | if(fITSmodules){ |
562 | fITSmodules->Delete(); | |
563 | delete fITSmodules; | |
564 | } // end fir fITSmoudles | |
88cb7938 | 565 | |
7d62fb64 | 566 | if(!fDetTypeSim) { |
567 | Error("InitModules","fDetTypeSim is null!"); | |
568 | return; | |
569 | } | |
828e06c7 | 570 | |
7d62fb64 | 571 | Int_t nl,indexMAX,index; |
572 | ||
573 | if(size<=0){ // default to using data stored in AliITSgeom | |
574 | if(fDetTypeSim->GetITSgeom()==0) { | |
575 | Error("InitModules","fITSgeom not defined"); | |
576 | return; | |
577 | } // end if fITSgeom==0 | |
578 | nl = fDetTypeSim->GetITSgeom()->GetNlayers(); | |
579 | indexMAX = fDetTypeSim->GetITSgeom()->GetIndexMax(); | |
580 | nmodules = indexMAX; | |
581 | fITSmodules = new TObjArray(indexMAX); | |
582 | for(index=0;index<indexMAX;index++){ | |
583 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
584 | } // end for index | |
585 | }else{ | |
586 | fITSmodules = new TObjArray(size); | |
587 | for(index=0;index<size;index++) { | |
588 | fITSmodules->AddAt( new AliITSmodule(index),index); | |
589 | } // end for index | |
590 | ||
591 | nmodules = size; | |
592 | } // end i size<=0 | |
2aea926d | 593 | } |
594 | //______________________________________________________________________ | |
595 | void AliITS::Hits2SDigits(){ | |
596 | // Standard Hits to summable Digits function. | |
4a5bebc2 | 597 | // Inputs: |
598 | // none. | |
599 | // Outputs: | |
600 | // none. | |
7d62fb64 | 601 | |
2aea926d | 602 | |
7d62fb64 | 603 | if(!fDetTypeSim) { |
604 | Error("Hits2SDigits","fDetTypeSim is null!"); | |
605 | return; | |
606 | ||
607 | } | |
608 | ||
609 | SetDefaults(); | |
610 | fLoader->LoadHits("read"); | |
611 | fLoader->LoadSDigits("recreate"); | |
612 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
023ae34b | 613 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 614 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { |
aacedc3e | 615 | // Do the Hits to Digits operation. Use Standard input values. |
616 | // Event number from file, no background hit merging , use size from | |
617 | // AliITSgeom class, option="All", input from this file only. | |
7d62fb64 | 618 | rl->GetEvent(iEvent); |
619 | if (!fLoader->TreeS()) fLoader->MakeTree("S"); | |
620 | MakeBranch("S"); | |
621 | SetTreeAddress(); | |
622 | HitsToPreDigits(iEvent,0,-1," ",fOpt," "); | |
623 | } // end for iEvent | |
e0fc0305 | 624 | |
7d62fb64 | 625 | fLoader->UnloadHits(); |
626 | fLoader->UnloadSDigits(); | |
627 | ||
2aea926d | 628 | } |
629 | //______________________________________________________________________ | |
630 | void AliITS::Hits2Digits(){ | |
2aea926d | 631 | |
7d62fb64 | 632 | //Conversion from hits to digits |
633 | if(!fDetTypeSim) { | |
634 | Error("Hits2SDigits","fDetTypeSim is 0!"); | |
635 | return; | |
636 | } | |
637 | ||
023ae34b | 638 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 639 | SetDefaults(); |
640 | ||
641 | fLoader->LoadHits("read"); | |
642 | fLoader->LoadDigits("recreate"); | |
643 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
644 | for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) { | |
645 | rl->GetEvent(iEvent); | |
646 | if (!fLoader->TreeD()) fLoader->MakeTree("D"); | |
647 | MakeBranch("D"); | |
648 | SetTreeAddress(); | |
649 | HitsToDigits(iEvent,0,-1," ",fOpt," "); | |
650 | } | |
651 | ||
652 | fLoader->UnloadHits(); | |
653 | fLoader->UnloadDigits(); | |
654 | ||
2aea926d | 655 | } |
7d62fb64 | 656 | |
2aea926d | 657 | //______________________________________________________________________ |
7d62fb64 | 658 | void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size, |
659 | Option_t *option,Option_t *opt, | |
660 | const char *filename){ | |
4a5bebc2 | 661 | // Keep galice.root for signal and name differently the file for |
2aea926d | 662 | // background when add! otherwise the track info for signal will be lost ! |
663 | // the condition below will disappear when the geom class will be | |
4a5bebc2 | 664 | // initialized for all versions - for the moment it is only for v5 ! |
665 | // 7 is the SDD beam test version. | |
666 | // Inputs: | |
667 | // Int_t evnt Event to be processed. | |
668 | // Int_t bgrev Background Hit tree number. | |
669 | // Int_t nmodules Not used. | |
670 | // Option_t *option String indicating if merging hits or not. To | |
671 | // merge hits set equal to "Add". Otherwise no | |
672 | // background hits are considered. | |
673 | // Test_t *filename File name containing the background hits.. | |
674 | // Outputs: | |
675 | // none. | |
676 | // Return: | |
677 | // none. | |
2aea926d | 678 | |
7d62fb64 | 679 | if(!fDetTypeSim) { |
680 | Error("HitsToDigits","fDetTypeSim is null!"); | |
681 | return; | |
682 | } | |
023ae34b | 683 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 684 | if(!GetITSgeom()) return; // need transformations to do digitization. |
685 | AliITSgeom *geom = GetITSgeom(); | |
686 | ||
687 | const char *all = strstr(opt,"All"); | |
688 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
689 | strstr(opt,"SSD")}; | |
690 | static Bool_t setDef=kTRUE; | |
691 | if (setDef) SetDefaultSimulation(); | |
692 | setDef=kFALSE; | |
693 | ||
694 | Int_t nmodules; | |
695 | InitModules(size,nmodules); | |
696 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
697 | ||
698 | AliITSsimulation *sim = 0; | |
699 | AliITSmodule *mod = 0; | |
700 | Int_t id; | |
701 | for(Int_t module=0;module<geom->GetIndexMax();module++){ | |
702 | id = geom->GetModuleType(module); | |
703 | if (!all && !det[id]) continue; | |
704 | sim = (AliITSsimulation*)fDetTypeSim->GetSimulationModel(id); | |
705 | if (!sim) { | |
706 | Error("HitsToDigits","The simulation class was not " | |
707 | "instanciated for module %d type %s!",module, | |
708 | geom->GetModuleTypeName(module)); | |
709 | exit(1); | |
710 | } // end if !sim | |
711 | mod = (AliITSmodule *)fITSmodules->At(module); | |
712 | sim->DigitiseModule(mod,module,evNumber); | |
713 | // fills all branches - wasted disk space | |
714 | fLoader->TreeD()->Fill(); | |
715 | ResetDigits(); | |
716 | } // end for module | |
717 | ||
718 | ClearModules(); | |
719 | ||
720 | fLoader->TreeD()->GetEntries(); | |
721 | fLoader->TreeD()->AutoSave(); | |
722 | // reset tree | |
723 | fLoader->TreeD()->Reset(); | |
2aea926d | 724 | } |
7d62fb64 | 725 | //_____________________________________________________________________ |
726 | void AliITS::Hits2PreDigits(){ | |
727 | // Turn hits into SDigits | |
728 | ||
729 | if(!fDetTypeSim) { | |
730 | Error("Hits2SDigits","fDetTypeSim is 0!"); | |
731 | return; | |
732 | } | |
733 | ||
023ae34b | 734 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 735 | SetDefaults(); |
736 | ||
737 | HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(), | |
738 | 0,-1," ",fOpt," "); | |
739 | } | |
740 | ||
2aea926d | 741 | //______________________________________________________________________ |
7d62fb64 | 742 | void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size, |
743 | Option_t *option,Option_t *opt, | |
744 | const char *filename){ | |
4a5bebc2 | 745 | // Keep galice.root for signal and name differently the file for |
2aea926d | 746 | // background when add! otherwise the track info for signal will be lost ! |
747 | // the condition below will disappear when the geom class will be | |
4a5bebc2 | 748 | // initialized for all versions - for the moment it is only for v5 ! |
749 | // 7 is the SDD beam test version. | |
750 | // Inputs: | |
751 | // Int_t evnt Event to be processed. | |
752 | // Int_t bgrev Background Hit tree number. | |
753 | // Int_t nmodules Not used. | |
754 | // Option_t *option String indicating if merging hits or not. To | |
755 | // merge hits set equal to "Add". Otherwise no | |
756 | // background hits are considered. | |
757 | // Test_t *filename File name containing the background hits.. | |
758 | // Outputs: | |
759 | // none. | |
760 | // Return: | |
761 | // none. | |
762 | ||
7d62fb64 | 763 | |
764 | if(!fDetTypeSim) { | |
765 | Error("HitsToPreDigits","fDetTypeSim is null!"); | |
766 | return; | |
767 | } | |
023ae34b | 768 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 769 | |
770 | if(!GetITSgeom()){ | |
771 | Error("HitsToPreDigits","fGeom is null!"); | |
772 | return; // need transformations to do digitization. | |
773 | } | |
774 | AliITSgeom *geom = GetITSgeom(); | |
775 | ||
776 | const char *all = strstr(opt,"All"); | |
777 | const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), | |
778 | strstr(opt,"SSD")}; | |
779 | static Bool_t setDef=kTRUE; | |
780 | if (setDef) SetDefaultSimulation(); | |
781 | setDef=kFALSE; | |
782 | ||
783 | Int_t nmodules; | |
784 | InitModules(size,nmodules); | |
785 | FillModules(evNumber,bgrev,nmodules,option,filename); | |
786 | ||
787 | ||
788 | AliITSsimulation *sim = 0; | |
789 | AliITSmodule *mod = 0; | |
790 | Int_t id,module; | |
791 | for(module=0;module<geom->GetIndexMax();module++){ | |
792 | id = geom->GetModuleType(module); | |
793 | if (!all && !det[id]) continue; | |
794 | sim = (AliITSsimulation*)GetSimulationModel(id); | |
795 | if (!sim) { | |
796 | Error("HitsToPreDigits","The simulation class was not " | |
797 | "instanciated for module %d type %s!",module, | |
798 | geom->GetModuleTypeName(module)); | |
799 | exit(1); | |
800 | } // end if !sim | |
801 | mod = (AliITSmodule *)fITSmodules->At(module); | |
802 | sim->SDigitiseModule(mod,module,evNumber); | |
803 | // fills all branches - wasted disk space | |
804 | fLoader->TreeS()->Fill(); | |
805 | fDetTypeSim->ResetSDigits(); | |
806 | } // end for module | |
04366a57 | 807 | |
7d62fb64 | 808 | ClearModules(); |
809 | ||
810 | ||
811 | fLoader->TreeS()->GetEntries(); | |
812 | fLoader->TreeS()->AutoSave(); | |
813 | fLoader->WriteSDigits("OVERWRITE"); | |
814 | // reset tree | |
815 | fLoader->TreeS()->Reset(); | |
2aea926d | 816 | } |
7d62fb64 | 817 | |
818 | //_____________________________________________________________________ | |
819 | void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, | |
820 | Option_t *opt0,Option_t *opt1, | |
821 | const char *flnm){ | |
822 | // keep galice.root for signal and name differently the file for | |
823 | // background when add! otherwise the track info for signal will be lost ! | |
824 | // the condition below will disappear when the geom class will be | |
825 | // initialized for all versions - for the moment it is only for v5 ! | |
826 | // Inputs: | |
827 | // Int_t evnt Event to be processed. | |
828 | // Int_t bgrev Background Hit tree number. | |
829 | // Int_t size Size used by InitModules. See InitModules. | |
830 | // Option_t *opt0 Option passed to FillModules. See FillModules. | |
831 | // Option_t *opt1 String indicating if merging hits or not. To | |
832 | // merge hits set equal to "Add". Otherwise no | |
833 | // background hits are considered. | |
834 | // Test_t *flnm File name containing the background hits.. | |
835 | // Outputs: | |
836 | // none. | |
837 | // Return: | |
838 | // none. | |
839 | ||
840 | ||
00a7cc50 | 841 | |
7d62fb64 | 842 | if(!GetITSgeom()){ |
843 | Error("HitsToPreDigits","fGeom is null!"); | |
844 | return; // need transformations to do digitization. | |
845 | } | |
846 | AliITSgeom *geom = GetITSgeom(); | |
847 | ||
848 | AliITSLoader *pITSloader = (AliITSLoader*)fLoader; | |
849 | ||
850 | const char *all = strstr(opt1,"All"); | |
851 | const char *det[3] ={strstr(opt1,"SPD"),strstr(opt1,"SDD"), | |
852 | strstr(opt1,"SSD")}; | |
853 | Int_t nmodules; | |
854 | InitModules(size,nmodules); | |
855 | FillModules(evNumber,bgrev,nmodules,opt0,flnm); | |
856 | ||
857 | AliITSsimulation *sim = 0; | |
858 | AliITSmodule *mod = 0; | |
859 | Int_t id,module; | |
860 | ||
861 | TTree *lTR = pITSloader->TreeR(); | |
00a7cc50 | 862 | if(!lTR) { |
863 | pITSloader->MakeTree("R"); | |
864 | lTR = pITSloader->TreeR(); | |
865 | } | |
866 | ||
7d62fb64 | 867 | TClonesArray* ptarray = new TClonesArray("AliITSRecPoint",1000); |
00a7cc50 | 868 | TBranch* branch = (TBranch*)lTR->Branch("ITSRecPointsF",&ptarray); |
869 | branch->SetAddress(&ptarray); | |
7d62fb64 | 870 | //m.b. : this change is nothing but a nice way to make sure |
023ae34b | 871 | //the CPU goes up ! |
7d62fb64 | 872 | for(module=0;module<geom->GetIndexMax();module++){ |
873 | id = geom->GetModuleType(module); | |
874 | if (!all && !det[id]) continue; | |
875 | sim = (AliITSsimulation*)GetSimulationModel(id); | |
876 | if (!sim) { | |
877 | Error("HitsToFastPoints","The simulation class was not " | |
878 | "instanciated for module %d type %x!",module, | |
879 | geom->GetModuleTypeName(module)); | |
880 | exit(1); | |
881 | } // end if !sim | |
882 | mod = (AliITSmodule *)fITSmodules->At(module); | |
883 | sim->CreateFastRecPoints(mod,module,gRandom,ptarray); | |
884 | lTR->Fill(); | |
885 | } // end for module | |
886 | ||
887 | ClearModules(); | |
888 | fLoader->WriteRecPoints("OVERWRITE"); | |
889 | delete ptarray; | |
890 | } | |
891 | //_____________________________________________________________________ | |
892 | Int_t AliITS::Hits2Clusters(TTree *hTree, TTree *cTree) { | |
893 | //------------------------------------------------------------ | |
894 | // This function creates ITS clusters | |
895 | //------------------------------------------------------------ | |
896 | if(!GetITSgeom()){ | |
897 | Error("HitsToPreDigits","fGeom is null!"); | |
898 | return 1; // need transformations to do digitization. | |
899 | } | |
900 | AliITSgeom *geom=GetITSgeom(); | |
901 | Int_t mmax=geom->GetIndexMax(); | |
902 | ||
903 | InitModules(-1,mmax); | |
904 | FillModules(hTree,0); | |
905 | ||
7d62fb64 | 906 | TClonesArray *points = new TClonesArray("AliITSRecPoint",1000); |
00a7cc50 | 907 | TBranch *branch=cTree->GetBranch("ITSRecPoints"); |
908 | if (!branch) cTree->Branch("ITSRecPoints",&points); | |
909 | else branch->SetAddress(&points); | |
7d62fb64 | 910 | |
911 | AliITSsimulationFastPoints sim; | |
912 | Int_t ncl=0; | |
913 | for (Int_t m=0; m<mmax; m++) { | |
914 | AliITSmodule *mod=GetModule(m); | |
915 | sim.CreateFastRecPoints(mod,m,gRandom,points); | |
00a7cc50 | 916 | ncl+=points->GetEntriesFast(); |
7d62fb64 | 917 | cTree->Fill(); |
7d62fb64 | 918 | points->Clear(); |
919 | } | |
920 | ||
921 | Info("Hits2Clusters","Number of found fast clusters : %d",ncl); | |
922 | ||
923 | //cTree->Write(); | |
924 | ||
7d62fb64 | 925 | delete points; |
926 | return 0; | |
927 | } | |
7d62fb64 | 928 | |
7d62fb64 | 929 | //_____________________________________________________________________ |
930 | void AliITS::CheckLabels(Int_t lab[3]) const { | |
931 | //------------------------------------------------------------ | |
932 | // Tries to find mother's labels | |
933 | //------------------------------------------------------------ | |
934 | ||
935 | if(lab[0]<0 && lab[1]<0 && lab[2]<0) return; // In case of no labels just exit | |
936 | ||
937 | Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); | |
938 | for (Int_t i=0;i<3;i++){ | |
939 | Int_t label = lab[i]; | |
940 | if (label>=0 && label<ntracks) { | |
941 | TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label); | |
942 | if (part->P() < 0.005) { | |
943 | Int_t m=part->GetFirstMother(); | |
944 | if (m<0) { | |
945 | continue; | |
946 | } | |
947 | if (part->GetStatusCode()>0) { | |
948 | continue; | |
949 | } | |
950 | lab[i]=m; | |
951 | } | |
952 | } | |
953 | } | |
954 | ||
955 | } | |
956 | ||
957 | //______________________________________________________________________ | |
958 | void AliITS::SDigitsToDigits(Option_t *opt){ | |
959 | // Standard Summable digits to Digits function. | |
960 | // Inputs: | |
961 | // none. | |
962 | // Outputs: | |
963 | // none. | |
964 | if(!fDetTypeSim) { | |
965 | Error("SDigitsToSDigits","fDetTypeSim is 0!"); | |
966 | return; | |
967 | } | |
968 | ||
023ae34b | 969 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 970 | SetDefaults(); |
971 | fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName()); | |
972 | ||
973 | } | |
974 | ||
2aea926d | 975 | //______________________________________________________________________ |
2aea926d | 976 | void AliITS::ResetDigits(){ |
4a5bebc2 | 977 | // Reset number of digits and the digits array for the ITS detector. |
978 | // Inputs: | |
979 | // none. | |
980 | // Outputs: | |
981 | // none. | |
7d62fb64 | 982 | if(!fDetTypeSim) { |
983 | Error("ResetDigits","fDetTypeSim is 0!"); | |
984 | return; | |
985 | } | |
986 | ||
987 | fDetTypeSim->ResetDigits(); | |
3bd79107 | 988 | |
989 | ||
2aea926d | 990 | } |
991 | //______________________________________________________________________ | |
7d62fb64 | 992 | void AliITS::ResetDigits(Int_t branch){ |
4a5bebc2 | 993 | // Reset number of digits and the digits array for this branch. |
994 | // Inputs: | |
995 | // none. | |
996 | // Outputs: | |
997 | // none. | |
828e06c7 | 998 | |
7d62fb64 | 999 | if(!fDetTypeSim) { |
1000 | Error("ResetDigits","fDetTypeSim is 0!"); | |
1001 | return; | |
1002 | } | |
1003 | ||
1004 | fDetTypeSim->ResetDigits(branch); | |
1005 | ||
2aea926d | 1006 | } |
1007 | //______________________________________________________________________ | |
1008 | void AliITS::AddSumDigit(AliITSpListItem &sdig){ | |
4a5bebc2 | 1009 | // Adds the a module full of summable digits to the summable digits tree. |
1010 | // Inputs: | |
1011 | // AliITSpListItem &sdig SDigit to be added to SDigits tree. | |
1012 | // Outputs: | |
1013 | // none. | |
1014 | // Return: | |
1015 | // none. | |
828e06c7 | 1016 | |
7d62fb64 | 1017 | if(!fDetTypeSim) { |
1018 | Error("AddSumDigit","fDetTypeSim is 0!"); | |
1019 | return; | |
1020 | } | |
1021 | fDetTypeSim->AddSumDigit(sdig); | |
1022 | ||
828e06c7 | 1023 | } |
2aea926d | 1024 | //______________________________________________________________________ |
7d62fb64 | 1025 | void AliITS::AddRealDigit(Int_t branch, Int_t *digits){ |
4a5bebc2 | 1026 | // Add a real digit - as coming from data. |
1027 | // Inputs: | |
1028 | // Int_t id Detector type number. | |
1029 | // Int_t *digits Integer array containing the digits info. See | |
1030 | // AliITSdigit.h | |
1031 | // Outputs: | |
1032 | // none. | |
1033 | // Return: | |
1034 | // none. | |
9c74c52b | 1035 | |
7d62fb64 | 1036 | if(!fDetTypeSim) { |
1037 | Error("AddRealDigit","fDetTypeSim is 0!"); | |
1038 | return; | |
1039 | } | |
1040 | fDetTypeSim->AddRealDigit(branch,digits); | |
1041 | ||
2aea926d | 1042 | } |
1043 | //______________________________________________________________________ | |
7d62fb64 | 1044 | void AliITS::AddSimDigit(Int_t branch, AliITSdigit *d){ |
4a5bebc2 | 1045 | // Add a simulated digit. |
1046 | // Inputs: | |
1047 | // Int_t id Detector type number. | |
1048 | // AliITSdigit *d Digit to be added to the Digits Tree. See | |
1049 | // AliITSdigit.h | |
1050 | // Outputs: | |
1051 | // none. | |
1052 | // Return: | |
1053 | // none. | |
2aea926d | 1054 | |
7d62fb64 | 1055 | if(!fDetTypeSim) { |
1056 | Error("AddSimDigit","fDetTypeSim is 0!"); | |
1057 | return; | |
1058 | } | |
1059 | fDetTypeSim->AddSimDigit(branch,d); | |
1060 | ||
2aea926d | 1061 | } |
1062 | //______________________________________________________________________ | |
7d62fb64 | 1063 | void AliITS::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits,Int_t *tracks, |
88cb7938 | 1064 | Int_t *hits,Float_t *charges){ |
7f1a504b | 1065 | // Add a simulated digit to the list. |
1066 | // Inputs: | |
1067 | // Int_t id Detector type number. | |
1068 | // Float_t phys Physics indicator. See AliITSdigits.h | |
1069 | // Int_t *digits Integer array containing the digits info. See | |
1070 | // AliITSdigit.h | |
1071 | // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()] | |
1072 | // containing the track numbers that contributed to | |
1073 | // this digit. | |
1074 | // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()] | |
1075 | // containing the hit numbers, from AliITSmodule, that | |
1076 | // contributed to this digit. | |
1077 | // Float_t *charge Floating point array of the signals contributed | |
1078 | // to this digit by each track. | |
1079 | // Outputs: | |
1080 | // none. | |
1081 | // Return: | |
1082 | // none. | |
2aea926d | 1083 | |
7d62fb64 | 1084 | if(!fDetTypeSim) { |
1085 | Error("AddSimDigit","fDetTypeSim is 0!"); | |
1086 | return; | |
1087 | } | |
1088 | fDetTypeSim->AddSimDigit(branch,phys,digits,tracks,hits,charges); | |
1089 | ||
2aea926d | 1090 | } |
0421c3d1 | 1091 | //______________________________________________________________________ |
aacedc3e | 1092 | void AliITS::Digits2Raw(){ |
1093 | // convert digits of the current event to raw data | |
0421c3d1 | 1094 | |
7d62fb64 | 1095 | if(!fDetTypeSim) { |
1096 | Error("Digits2Raw","fDetTypeSim is 0!"); | |
1097 | return; | |
1098 | } | |
023ae34b | 1099 | fDetTypeSim->SetLoader((AliITSLoader*)fLoader); |
7d62fb64 | 1100 | SetDefaults(); |
1101 | fDetTypeSim->GetLoader()->LoadDigits(); | |
1102 | TTree* digits = fDetTypeSim->GetLoader()->TreeD(); | |
0421c3d1 | 1103 | if (!digits) { |
aacedc3e | 1104 | Error("Digits2Raw", "no digits tree"); |
1105 | return; | |
0421c3d1 | 1106 | } |
7d62fb64 | 1107 | fDetTypeSim->SetTreeAddressD(digits,(Char_t*)GetName()); |
0421c3d1 | 1108 | |
1109 | AliITSDDLRawData rawWriter; | |
1110 | //Verbose level | |
1111 | // 0: Silent | |
1112 | // 1: cout messages | |
1113 | // 2: txt files with digits | |
1114 | //BE CAREFUL, verbose level 2 MUST be used only for debugging and | |
1115 | //it is highly suggested to use this mode only for debugging digits files | |
1116 | //reasonably small, because otherwise the size of the txt files can reach | |
1117 | //quickly several MB wasting time and disk space. | |
1118 | rawWriter.SetVerbose(0); | |
1119 | ||
1120 | //SILICON PIXEL DETECTOR | |
1121 | Info("Digits2Raw", "Formatting raw data for SPD"); | |
1122 | rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD")); | |
1123 | ||
1124 | //SILICON DRIFT DETECTOR | |
1125 | Info("Digits2Raw", "Formatting raw data for SDD"); | |
1126 | rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD")); | |
1127 | ||
1128 | //SILICON STRIP DETECTOR | |
1129 | Info("Digits2Raw", "Formatting raw data for SSD"); | |
1130 | rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD")); | |
1131 | ||
1132 | fLoader->UnloadDigits(); | |
2aea926d | 1133 | } |
2aea926d | 1134 | //______________________________________________________________________ |
aacedc3e | 1135 | AliLoader* AliITS::MakeLoader(const char* topfoldername){ |
1136 | //builds ITSgetter (AliLoader type) | |
1137 | //if detector wants to use castomized getter, it must overload this method | |
1138 | ||
1139 | Info("MakeLoader","Creating AliITSLoader. Top folder is %s.", | |
1140 | topfoldername); | |
1141 | fLoader = new AliITSLoader(GetName(),topfoldername); | |
1142 | return fLoader; | |
2aea926d | 1143 | } |
ef7ff1f9 | 1144 | |
1145 | //______________________________________________________________________ | |
1146 | void AliITS::UpdateInternalGeometry(){ | |
1147 | ||
1148 | Info("UpdateInternalGeometry", "Delete ITSgeom and create a new one reading TGeo"); | |
1149 | AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",2); | |
1150 | AliITSgeom* geom = initgeom->CreateAliITSgeom(); | |
1151 | SetITSgeom(geom); | |
1152 | ||
1153 | if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName()); | |
1154 | AliRunLoader* rl = fLoader->GetRunLoader(); | |
1155 | rl->CdGAFile(); | |
1156 | geom->Write(0,kOverwrite); | |
1157 | ||
1158 | } |