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