]>
Commit | Line | Data |
---|---|---|
ffa6d63b | 1 | /************************************************************************* |
61e0abb5 | 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 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // This is a TTask that makes SDigits out of Hits | |
20 | // A Summable Digits is the sum of all hits originating | |
ffa6d63b | 21 | // from one in one tower of the EMCAL |
61e0abb5 | 22 | // A threshold for assignment of the primary to SDigit is applied |
23 | // SDigits are written to TreeS, branch "EMCAL" | |
24 | // AliEMCALSDigitizer with all current parameters is written | |
25 | // to TreeS branch "AliEMCALSDigitizer". | |
26 | // Both branches have the same title. If necessary one can produce | |
27 | // another set of SDigits with different parameters. Two versions | |
28 | // can be distunguished using titles of the branches. | |
29 | // User case: | |
30 | // root [0] AliEMCALSDigitizer * s = new AliEMCALSDigitizer("galice.root") | |
31 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
32 | // root [1] s->ExecuteTask() | |
33 | // // Makes SDigitis for all events stored in galice.root | |
34 | // root [2] s->SetPedestalParameter(0.001) | |
35 | // // One can change parameters of digitization | |
36 | // root [3] s->SetSDigitsBranch("Redestal 0.001") | |
37 | // // and write them into the new branch | |
38 | // root [4] s->ExeciteTask("deb all tim") | |
39 | // // available parameters: | |
40 | // deb - print # of produced SDigitis | |
41 | // deb all - print # and list of produced SDigits | |
42 | // tim - print benchmarking information | |
43 | // | |
ffa6d63b | 44 | //*-- Author : Sahal Yacoob (LBL) |
45 | // based on : AliPHOSSDigitzer | |
61e0abb5 | 46 | ////////////////////////////////////////////////////////////////////////////// |
47 | ||
48 | ||
49 | // --- ROOT system --- | |
50 | #include "TFile.h" | |
51 | #include "TTask.h" | |
52 | #include "TTree.h" | |
53 | #include "TSystem.h" | |
54 | #include "TROOT.h" | |
55 | #include "TFolder.h" | |
106fc2fa | 56 | #include "TGeometry.h" |
61e0abb5 | 57 | #include "TBenchmark.h" |
58 | // --- Standard library --- | |
59 | #include <iomanip.h> | |
60 | ||
61 | // --- AliRoot header files --- | |
62 | #include "AliRun.h" | |
106fc2fa | 63 | #include "AliHeader.h" |
61e0abb5 | 64 | #include "AliEMCALDigit.h" |
65 | #include "AliEMCALHit.h" | |
66 | #include "AliEMCALSDigitizer.h" | |
67 | #include "AliEMCALGeometry.h" | |
68 | #include "AliEMCALv1.h" | |
814ad4bf | 69 | #include "AliEMCALGetter.h" |
61e0abb5 | 70 | |
71 | ClassImp(AliEMCALSDigitizer) | |
72 | ||
73 | ||
74 | //____________________________________________________________________________ | |
75 | AliEMCALSDigitizer::AliEMCALSDigitizer():TTask("AliEMCALSDigitizer","") | |
76 | { | |
77 | // ctor | |
839828a6 | 78 | InitParameters() ; |
61e0abb5 | 79 | } |
80 | ||
81 | //____________________________________________________________________________ | |
814ad4bf | 82 | AliEMCALSDigitizer::AliEMCALSDigitizer(const char* headerFile, const char *sDigitsTitle):TTask(sDigitsTitle, headerFile) |
61e0abb5 | 83 | { |
84 | // ctor | |
839828a6 | 85 | InitParameters() ; |
814ad4bf | 86 | Init(); |
61e0abb5 | 87 | } |
88 | ||
89 | //____________________________________________________________________________ | |
90 | AliEMCALSDigitizer::~AliEMCALSDigitizer() | |
91 | { | |
92 | // dtor | |
79bb1b62 | 93 | // gime=0 if Digitizer created by default ctor (to get just the parameters) |
94 | ||
303492aa | 95 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; |
79bb1b62 | 96 | |
839828a6 | 97 | if (gime) { |
98 | // remove the task from the folder list | |
99 | gime->RemoveTask("S",GetName()) ; | |
100 | ||
101 | TString name(GetName()) ; | |
102 | if (! name.IsNull() ) | |
103 | if (name.Index(":") > 0) | |
104 | name.Remove(name.Index(":")) ; | |
105 | ||
106 | // remove the Hits from the folder list | |
107 | gime->RemoveObjects("H",name) ; | |
108 | ||
109 | // remove the SDigits from the folder list | |
110 | gime->RemoveObjects("S", name) ; | |
111 | ||
112 | // Close the root file | |
113 | gime->CloseFile() ; | |
114 | ||
115 | } | |
116 | fSplitFile = 0 ; | |
61e0abb5 | 117 | } |
36657114 | 118 | |
61e0abb5 | 119 | //____________________________________________________________________________ |
120 | void AliEMCALSDigitizer::Init(){ | |
61e0abb5 | 121 | |
814ad4bf | 122 | // Initialization: open root-file, allocate arrays for hits and sdigits, |
36657114 | 123 | // attach task SDigitizer to the list of EMCAL tasks |
814ad4bf | 124 | // |
125 | // Initialization can not be done in the default constructor | |
126 | //============================================================= YS | |
127 | // The initialisation is now done by the getter | |
61e0abb5 | 128 | |
36657114 | 129 | if( strcmp(GetTitle(), "") == 0 ) |
814ad4bf | 130 | SetTitle("galice.root") ; |
36657114 | 131 | |
814ad4bf | 132 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), "update") ; |
133 | if ( gime == 0 ) { | |
134 | cerr << "ERROR: AliEMCALSDigitizer::Init -> Could not obtain the Getter object !" << endl ; | |
135 | return ; | |
136 | } | |
137 | ||
138 | gime->PostSDigits( GetName(), GetTitle() ) ; | |
61e0abb5 | 139 | |
814ad4bf | 140 | TString sdname(GetName() ); |
141 | sdname.Append(":") ; | |
142 | sdname.Append(GetTitle() ) ; | |
97f3344e | 143 | SetName(sdname.Data()) ; |
814ad4bf | 144 | gime->PostSDigitizer(this) ; |
145 | ||
814ad4bf | 146 | |
839828a6 | 147 | } |
148 | ||
149 | //____________________________________________________________________________ | |
150 | void AliEMCALSDigitizer::InitParameters(){ | |
151 | fA = 0; | |
152 | fB = 10000000.; | |
153 | fTowerPrimThreshold = 0.01 ; | |
154 | fPreShowerPrimThreshold = 0.0001 ; | |
155 | fNevents = 0 ; | |
156 | fPhotonElectronFactor = 5000. ; // photoelectrons per GeV | |
157 | fSplitFile = 0 ; | |
158 | ||
159 | } | |
160 | ||
61e0abb5 | 161 | //____________________________________________________________________________ |
162 | void AliEMCALSDigitizer::Exec(Option_t *option) { | |
61e0abb5 | 163 | |
814ad4bf | 164 | // Collects all hits in the same active volume into digit |
165 | ||
166 | if( strcmp(GetName(), "") == 0 ) | |
167 | Init() ; | |
61e0abb5 | 168 | |
814ad4bf | 169 | if (strstr(option, "print") ) { |
170 | Print("") ; | |
171 | return ; | |
172 | } | |
61e0abb5 | 173 | |
814ad4bf | 174 | if(strstr(option,"tim")) |
175 | gBenchmark->Start("EMCALSDigitizer"); | |
97f3344e | 176 | |
177 | ||
814ad4bf | 178 | //Check, if this branch already exits |
179 | gAlice->GetEvent(0) ; | |
97f3344e | 180 | |
181 | TString sdname(GetName()) ; | |
182 | sdname.Remove(sdname.Index(GetTitle())-1) ; | |
183 | ||
814ad4bf | 184 | if(gAlice->TreeS() ) { |
185 | TObjArray * lob = static_cast<TObjArray*>(gAlice->TreeS()->GetListOfBranches()) ; | |
186 | TIter next(lob) ; | |
187 | TBranch * branch = 0 ; | |
188 | Bool_t emcalfound = kFALSE, sdigitizerfound = kFALSE ; | |
61e0abb5 | 189 | |
97f3344e | 190 | while ( (branch = (static_cast<TBranch*>(next()))) && (!emcalfound || !sdigitizerfound) ) { |
36657114 | 191 | TString thisName( GetName() ) ; |
192 | TString branchName( branch->GetTitle() ) ; | |
193 | branchName.Append(":") ; | |
194 | if ( (strcmp(branch->GetName(), "EMCAL")==0) && thisName.BeginsWith(branchName) ) | |
814ad4bf | 195 | emcalfound = kTRUE ; |
196 | ||
36657114 | 197 | else if ( (strcmp(branch->GetName(), "AliEMCALSDigitizer")==0) && thisName.BeginsWith(branchName) ) |
814ad4bf | 198 | sdigitizerfound = kTRUE ; |
61e0abb5 | 199 | } |
200 | ||
814ad4bf | 201 | if ( emcalfound || sdigitizerfound ) { |
202 | cerr << "WARNING: AliEMCALSDigitizer::Exec -> SDigits and/or SDigitizer branch with name " << GetName() | |
203 | << " already exits" << endl ; | |
204 | return ; | |
205 | } | |
206 | } | |
97f3344e | 207 | |
814ad4bf | 208 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; |
814ad4bf | 209 | Int_t nevents = (Int_t) gAlice->TreeE()->GetEntries() ; |
210 | ||
211 | Int_t ievent ; | |
212 | for(ievent = 0; ievent < nevents; ievent++){ | |
213 | gime->Event(ievent,"H") ; | |
214 | const TClonesArray * fHits = gime->Hits() ; | |
215 | TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; | |
216 | sdigits->Clear(); | |
61e0abb5 | 217 | Int_t nSdigits = 0 ; |
814ad4bf | 218 | |
219 | //Collects all hits in the same active volume into digit | |
220 | ||
221 | ||
61e0abb5 | 222 | |
223 | ||
224 | //Now made SDigits from hits, for EMCAL it is the same, so just copy | |
814ad4bf | 225 | // Int_t itrack ; |
226 | // for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){ | |
227 | //gime->Track(itrack); | |
61e0abb5 | 228 | //=========== Get the EMCAL branch from Hits Tree for the Primary track itrack |
89e103bd | 229 | |
61e0abb5 | 230 | Int_t i; |
e1f60236 | 231 | for ( i = 0 ; i < fHits->GetEntries() ; i++ ) { // loop over all hits (hit = deposited energy/layer/entering particle) |
232 | AliEMCALHit * hit = dynamic_cast<AliEMCALHit*>(fHits->At(i)) ; | |
233 | AliEMCALDigit * curSDigit = 0 ; | |
234 | AliEMCALDigit * sdigit = 0 ; | |
ffa6d63b | 235 | Bool_t newsdigit = kTRUE; |
e1f60236 | 236 | |
89e103bd | 237 | |
238 | ||
e1f60236 | 239 | // Assign primary number only if deposited energy is significant |
240 | ||
89e103bd | 241 | if( (!hit->IsInPreShower() && hit->GetEnergy() > fTowerPrimThreshold) || |
242 | (hit->IsInPreShower() && hit->GetEnergy() > fPreShowerPrimThreshold)) { | |
243 | curSDigit = new AliEMCALDigit( hit->GetPrimary(), | |
e1f60236 | 244 | hit->GetIparent(),Layer2TowerID(hit->GetId(),hit->IsInPreShower()), |
89e103bd | 245 | Digitize(hit->GetEnergy()), |
814ad4bf | 246 | hit->GetTime()) ; |
89e103bd | 247 | } else { |
814ad4bf | 248 | curSDigit = new AliEMCALDigit( -1 , |
249 | -1 , | |
e1f60236 | 250 | Layer2TowerID(hit->GetId(),hit->IsInPreShower()), |
89e103bd | 251 | Digitize(hit->GetEnergy()), |
e1f60236 | 252 | hit->GetTime() ) ; |
89e103bd | 253 | } |
e1f60236 | 254 | Int_t check = 0 ; |
255 | for(check= 0; check < nSdigits ; check++) { | |
814ad4bf | 256 | sdigit = (AliEMCALDigit *)sdigits->At(check); |
e1f60236 | 257 | if( sdigit->GetId() == curSDigit->GetId()) { // Are we in the same tower or the same preshower ? |
258 | *sdigit = *sdigit + *curSDigit; | |
259 | ||
260 | newsdigit = kFALSE; | |
261 | } | |
814ad4bf | 262 | } |
e1f60236 | 263 | if (newsdigit) { |
264 | new((*sdigits)[nSdigits]) AliEMCALDigit(*curSDigit); | |
ffa6d63b | 265 | nSdigits++ ; |
e1f60236 | 266 | } |
267 | } // loop over all hits (hit = deposited energy/layer/entering particle) | |
814ad4bf | 268 | // } // loop over tracks |
e1f60236 | 269 | |
814ad4bf | 270 | sdigits->Sort() ; |
61e0abb5 | 271 | |
814ad4bf | 272 | nSdigits = sdigits->GetEntriesFast() ; |
106fc2fa | 273 | if (nSdigits > 0) { |
274 | sdigits->Expand(nSdigits) ; | |
275 | ||
276 | // Int_t i ; | |
277 | const AliEMCALGeometry * geom = gime->EMCALGeometry() ; | |
278 | ||
279 | Int_t lastPreShowerIndex = nSdigits - 1 ; | |
280 | if (!(dynamic_cast<AliEMCALDigit *>(sdigits->At(lastPreShowerIndex))->IsInPreShower())) | |
281 | lastPreShowerIndex = -2; | |
282 | Int_t firstPreShowerIndex = 100000 ; | |
283 | Int_t index ; | |
284 | AliEMCALDigit * sdigit = 0 ; | |
285 | for ( index = 0; index < nSdigits ; index++) { | |
286 | sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) ) ; | |
287 | if (sdigit->IsInPreShower() ){ | |
288 | firstPreShowerIndex = index ; | |
289 | break ; | |
290 | } | |
291 | } | |
292 | ||
293 | AliEMCALDigit * preshower ; | |
294 | AliEMCALDigit * tower ; | |
295 | Int_t lastIndex = lastPreShowerIndex +1 ; | |
296 | ||
297 | ||
298 | for (index = firstPreShowerIndex ; index <= lastPreShowerIndex; index++) { | |
299 | preshower = dynamic_cast<AliEMCALDigit *>(sdigits->At(index) ); | |
300 | Bool_t towerFound = kFALSE ; | |
301 | Int_t jndex ; | |
302 | for (jndex = 0; jndex < firstPreShowerIndex; jndex++) { | |
303 | tower = dynamic_cast<AliEMCALDigit *>(sdigits->At(jndex) ); | |
304 | if ( (preshower->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) == tower->GetId() ) { | |
305 | Float_t towerEnergy = static_cast<Float_t>(tower->GetAmp()) ; | |
306 | Float_t preshoEnergy = static_cast<Float_t>(preshower->GetAmp()) ; | |
307 | towerEnergy +=preshoEnergy ; | |
308 | *tower = *tower + *preshower ; // and add preshower multiplied by layer ratio to tower | |
309 | tower->SetAmp(static_cast<Int_t>(TMath::Ceil(towerEnergy))) ; | |
310 | towerFound = kTRUE ; | |
311 | } | |
312 | } | |
313 | if ( !towerFound ) { | |
314 | ||
315 | new((*sdigits)[lastIndex]) AliEMCALDigit(*preshower); | |
316 | AliEMCALDigit * temp = dynamic_cast<AliEMCALDigit *>(sdigits->At(lastIndex)) ; | |
317 | temp->SetId(temp->GetId() - (geom->GetNZ() * geom->GetNPhi()) ) ; | |
318 | lastIndex++ ; | |
319 | } | |
320 | } | |
321 | ||
322 | sdigits->Sort() ; | |
323 | Int_t NPrimarymax = -1 ; | |
324 | for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) { | |
325 | sdigit = dynamic_cast<AliEMCALDigit *>(sdigits->At(i)) ; | |
326 | sdigit->SetIndexInList(i) ; | |
327 | } | |
328 | ||
329 | for (i = 0 ; i < sdigits->GetEntriesFast() ; i++) { | |
330 | if (((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) > NPrimarymax) | |
331 | NPrimarymax = ((dynamic_cast<AliEMCALDigit *>(sdigits->At(i)))->GetNprimary()) ; | |
e1f60236 | 332 | } |
333 | } | |
106fc2fa | 334 | if(gAlice->TreeS() == 0) |
36657114 | 335 | gAlice->MakeTree("S",fSplitFile); |
336 | ||
814ad4bf | 337 | //First list of sdigits |
338 | Int_t bufferSize = 32000 ; | |
339 | TBranch * sdigitsBranch = gAlice->TreeS()->Branch("EMCAL",&sdigits,bufferSize); | |
340 | sdigitsBranch->SetTitle(sdname); | |
814ad4bf | 341 | |
814ad4bf | 342 | //second - SDigitizer |
343 | Int_t splitlevel = 0 ; | |
344 | AliEMCALSDigitizer * sd = this ; | |
345 | TBranch * sdigitizerBranch = gAlice->TreeS()->Branch("AliEMCALSDigitizer","AliEMCALSDigitizer", | |
346 | &sd,bufferSize,splitlevel); | |
347 | sdigitizerBranch->SetTitle(sdname); | |
814ad4bf | 348 | |
36657114 | 349 | sdigitsBranch->Fill() ; |
350 | sdigitizerBranch->Fill() ; | |
106fc2fa | 351 | gAlice->TreeS()->AutoSave() ; |
36657114 | 352 | |
814ad4bf | 353 | if(strstr(option,"deb")) |
354 | PrintSDigits(option) ; | |
355 | ||
61e0abb5 | 356 | } |
357 | ||
358 | if(strstr(option,"tim")){ | |
359 | gBenchmark->Stop("EMCALSDigitizer"); | |
360 | cout << "AliEMCALSDigitizer:" << endl ; | |
361 | cout << " took " << gBenchmark->GetCpuTime("EMCALSDigitizer") << " seconds for SDigitizing " | |
362 | << gBenchmark->GetCpuTime("EMCALSDigitizer")/fNevents << " seconds per event " << endl ; | |
363 | cout << endl ; | |
364 | } | |
365 | ||
366 | ||
367 | } | |
368 | //__________________________________________________________________ | |
369 | void AliEMCALSDigitizer::SetSDigitsBranch(const char * title ){ | |
814ad4bf | 370 | |
371 | // Setting title to branch SDigits | |
372 | ||
373 | TString stitle(title) ; | |
374 | ||
375 | // check if branch with title already exists | |
376 | TBranch * sdigitsBranch = | |
377 | static_cast<TBranch*>(gAlice->TreeS()->GetListOfBranches()->FindObject("EMCAL")) ; | |
378 | TBranch * sdigitizerBranch = | |
379 | static_cast<TBranch*>(gAlice->TreeS()->GetListOfBranches()->FindObject("AliEMCALSDigitizer")) ; | |
380 | const char * sdigitsTitle = sdigitsBranch ->GetTitle() ; | |
381 | const char * sdigitizerTitle = sdigitizerBranch ->GetTitle() ; | |
382 | if ( stitle.CompareTo(sdigitsTitle)==0 || stitle.CompareTo(sdigitizerTitle)==0 ){ | |
383 | cerr << "ERROR: AliEMCALSdigitizer::SetSDigitsBranch -> Cannot overwrite existing branch with title " << title << endl ; | |
384 | return ; | |
385 | } | |
386 | ||
387 | cout << "AliEMCALSdigitizer::SetSDigitsBranch -> Changing SDigits file from " << GetName() << " to " << title << endl ; | |
388 | ||
389 | SetName(title) ; | |
390 | ||
391 | // Post to the WhiteBoard | |
392 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; | |
393 | gime->PostSDigits( title, GetTitle()) ; | |
394 | ||
395 | ||
61e0abb5 | 396 | } |
106fc2fa | 397 | |
398 | //__________________________________________________________________ | |
36657114 | 399 | void AliEMCALSDigitizer::SetSplitFile(const TString splitFileName) |
106fc2fa | 400 | { |
401 | // Diverts the SDigits in a file separate from the hits file | |
402 | ||
403 | TDirectory * cwd = gDirectory ; | |
36657114 | 404 | |
405 | if ( !(gAlice->GetTreeSFileName() == splitFileName) ) { | |
406 | if (gAlice->GetTreeSFile() ) | |
407 | gAlice->GetTreeSFile()->Close() ; | |
408 | } | |
409 | ||
410 | fSplitFile = gAlice->InitTreeFile("S",splitFileName.Data()); | |
411 | fSplitFile->cd() ; | |
839828a6 | 412 | gAlice->Write(0, TObject::kOverwrite); |
413 | ||
106fc2fa | 414 | TTree *treeE = gAlice->TreeE(); |
415 | if (!treeE) { | |
36657114 | 416 | cerr << "ERROR: AliEMCALSDigitizer::SetSPlitFile -> No TreeE found "<<endl; |
417 | abort() ; | |
106fc2fa | 418 | } |
419 | ||
420 | // copy TreeE | |
839828a6 | 421 | |
422 | AliHeader *header = new AliHeader(); | |
423 | treeE->SetBranchAddress("Header", &header); | |
424 | treeE->SetBranchStatus("*",1); | |
425 | TTree *treeENew = treeE->CloneTree(); | |
426 | treeENew->Write(0, TObject::kOverwrite); | |
106fc2fa | 427 | |
428 | // copy AliceGeom | |
839828a6 | 429 | TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom")); |
430 | if (!AliceGeom) { | |
431 | cerr << "ERROR: AliEMCALSDigitizer::SetSPlitFile -> AliceGeom was not found in the input file "<<endl; | |
432 | abort() ; | |
106fc2fa | 433 | } |
839828a6 | 434 | AliceGeom->Write(0, TObject::kOverwrite) ; |
36657114 | 435 | |
436 | gAlice->MakeTree("S",fSplitFile); | |
106fc2fa | 437 | cwd->cd() ; |
36657114 | 438 | cout << "INFO: AliEMCALSDigitizer::SetSPlitFile -> SDigits will be stored in " << splitFileName.Data() << endl ; |
106fc2fa | 439 | } |
440 | ||
61e0abb5 | 441 | //__________________________________________________________________ |
442 | void AliEMCALSDigitizer::Print(Option_t* option)const{ | |
443 | cout << "------------------- "<< GetName() << " -------------" << endl ; | |
814ad4bf | 444 | cout << " Writing SDigitis to branch with title " << GetName() << endl ; |
89e103bd | 445 | cout << " with digitization parameters A = " << fA << endl ; |
446 | cout << " B = " << fB << endl ; | |
447 | cout << " Threshold for Primary assignment in Tower = " << fTowerPrimThreshold << endl ; | |
448 | cout << " Threshold for Primary assignment in PreShower = " << fPreShowerPrimThreshold << endl ; | |
61e0abb5 | 449 | cout << "---------------------------------------------------"<<endl ; |
450 | ||
451 | } | |
452 | //__________________________________________________________________ | |
453 | Bool_t AliEMCALSDigitizer::operator==( AliEMCALSDigitizer const &sd )const{ | |
89e103bd | 454 | if( (fA==sd.fA)&&(fB==sd.fB)&& |
455 | (fTowerPrimThreshold==sd.fTowerPrimThreshold) && | |
456 | (fPreShowerPrimThreshold==sd.fPreShowerPrimThreshold)) | |
61e0abb5 | 457 | return kTRUE ; |
458 | else | |
459 | return kFALSE ; | |
460 | } | |
461 | //__________________________________________________________________ | |
462 | void AliEMCALSDigitizer::PrintSDigits(Option_t * option){ | |
463 | //Prints list of digits produced at the current pass of AliEMCALDigitizer | |
464 | ||
814ad4bf | 465 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; |
466 | TString sdname(GetName()) ; | |
467 | sdname.Remove(sdname.Index(GetTitle())-1) ; | |
468 | const TClonesArray * sdigits = gime->SDigits(sdname.Data()) ; | |
61e0abb5 | 469 | |
814ad4bf | 470 | cout << "AliEMCALSDigitiser: event " << gAlice->GetEvNumber() << endl ; |
471 | cout << " Number of entries in SDigits list " << sdigits->GetEntriesFast() << endl ; | |
472 | cout << endl ; | |
473 | if(strstr(option,"all")||strstr(option,"EMC")){ | |
474 | ||
61e0abb5 | 475 | //loop over digits |
476 | AliEMCALDigit * digit; | |
e1f60236 | 477 | cout << "SDigit Id " << " Amplitude " << " Time " << " Index " << " Nprim " << " Primaries list " << endl; |
61e0abb5 | 478 | Int_t index ; |
814ad4bf | 479 | for (index = 0 ; index < sdigits->GetEntries() ; index++) { |
480 | digit = (AliEMCALDigit * ) sdigits->At(index) ; | |
481 | cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " " << digit->GetTime() | |
482 | << setw(6) << digit->GetIndexInList() << " " | |
483 | << setw(5) << digit->GetNprimary() <<" "; | |
61e0abb5 | 484 | |
485 | Int_t iprimary; | |
486 | for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) | |
814ad4bf | 487 | cout << " " << digit->GetPrimary(iprimary+1) << " "; |
61e0abb5 | 488 | cout << endl; |
489 | } | |
814ad4bf | 490 | cout <<endl; |
61e0abb5 | 491 | } |
492 | } | |
814ad4bf | 493 | //________________________________________________________________________ |
229f77c4 | 494 | Int_t AliEMCALSDigitizer::Layer2TowerID(Int_t ihit, Bool_t preshower){ |
495 | // Method to Transform from Hit Id to Digit Id | |
496 | // This function should be one to one | |
814ad4bf | 497 | AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ; |
498 | const AliEMCALGeometry * geom = gime->EMCALGeometry(); | |
f063936c | 499 | Int_t ieta = ((ihit-1)/geom->GetNPhi())%geom->GetNZ(); // eta Tower Index |
229f77c4 | 500 | Int_t iphi = (ihit-1)%(geom->GetNPhi())+1; //phi Tower Index |
501 | Int_t it = -10; | |
502 | Int_t ipre = 0; | |
814ad4bf | 503 | |
229f77c4 | 504 | if (preshower)ipre = 1; |
505 | if (iphi > 0 && ieta >= 0){ | |
506 | it = iphi+ieta*geom->GetNPhi() + ipre*geom->GetNPhi()*geom->GetNZ(); | |
507 | return it; | |
508 | }else{ | |
509 | cerr << " AliEMCALSDigitizer::Layer2TowerID() -- there is an error "<< endl << "Eta number = " | |
510 | << ieta << "Phi number = " << iphi << endl ; | |
511 | return it; | |
512 | } // end if iphi>0 && ieta>0 | |
814ad4bf | 513 | } |
229f77c4 | 514 | //_______________________________________________________________________________________ |
89e103bd | 515 | // void AliEMCALSDigitizer::TestTowerID(void) |
516 | // { | |
517 | // Int_t j; | |
229f77c4 | 518 | |
89e103bd | 519 | // Bool_t preshower = kFALSE; |
520 | // for (j = 0 ; j < 10 ; j++){ // loop over hit id | |
521 | // Int_t i; | |
522 | // for (i = 0 ; i <= 2 ; i++){ // loop over | |
523 | // Int_t k = i*96*144+j*144+1; | |
524 | // cout << " Hit Index = " << k << " " << j*10 << " TOWERID = " << Layer2TowerID(k, preshower) << endl ; | |
525 | // } | |
526 | // } | |
527 | // } |