]>
Commit | Line | Data |
---|---|---|
990119d6 | 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 | ||
16 | /* $Id$ */ | |
17 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
3663622c | 21 | * Revision 1.91 2006/04/29 20:25:30 hristov |
22 | * Decalibration is implemented (Yu.Kharlov) | |
23 | * | |
877695e7 | 24 | * Revision 1.90 2006/04/22 10:30:17 hristov |
25 | * Add fEnergy to AliPHOSDigit and operate with EMC amplitude in energy units (Yu.Kharlov) | |
26 | * | |
27a73a5d | 27 | * Revision 1.89 2006/04/11 15:22:59 hristov |
28 | * run number in query set to -1: forces AliCDBManager to use its run number (A.Colla) | |
29 | * | |
28871337 | 30 | * Revision 1.88 2006/03/13 14:05:43 kharlov |
31 | * Calibration objects for EMC and CPV | |
32 | * | |
fc6706cb | 33 | * Revision 1.87 2005/08/24 15:33:49 kharlov |
34 | * Calibration data for raw digits | |
35 | * | |
a8ec0771 | 36 | * Revision 1.86 2005/07/12 20:07:35 hristov |
37 | * Changes needed to run simulation and reconstrruction in the same AliRoot session | |
38 | * | |
7c193632 | 39 | * Revision 1.85 2005/05/28 14:19:04 schutz |
40 | * Compilation warnings fixed by T.P. | |
41 | * | |
702ab87e | 42 | */ |
88cb7938 | 43 | |
990119d6 | 44 | //_________________________________________________________________________ |
990119d6 | 45 | //*-- Author : Dmitri Peressounko (SUBATECH & Kurchatov Institute) |
46 | ////////////////////////////////////////////////////////////////////////////// | |
a4e98857 | 47 | // This TTask performs digitization of Summable digits (in the PHOS case it is just |
48 | // the sum of contributions from all primary particles into a given cell). | |
990119d6 | 49 | // In addition it performs mixing of summable digits from different events. |
7b7c1533 | 50 | // The name of the TTask is also the title of the branch that will contain |
51 | // the created SDigits | |
52 | // The title of the TTAsk is the name of the file that contains the hits from | |
53 | // which the SDigits are created | |
bca3b32a | 54 | // |
55 | // For each event two branches are created in TreeD: | |
56 | // "PHOS" - list of digits | |
57 | // "AliPHOSDigitizer" - AliPHOSDigitizer with all parameters used in digitization | |
58 | // | |
a4e98857 | 59 | // Note, that one can set a title for new digits branch, and repeat digitization with |
bca3b32a | 60 | // another set of parameters. |
61 | // | |
a4e98857 | 62 | // Use case: |
990119d6 | 63 | // root[0] AliPHOSDigitizer * d = new AliPHOSDigitizer() ; |
64 | // root[1] d->ExecuteTask() | |
65 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
66 | // //Digitizes SDigitis in all events found in file galice.root | |
bca3b32a | 67 | // |
8cb3533f | 68 | // root[2] AliPHOSDigitizer * d1 = new AliPHOSDigitizer("galice1.root") ; |
69 | // // Will read sdigits from galice1.root | |
70 | // root[3] d1->MixWith("galice2.root") | |
990119d6 | 71 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated |
a4e98857 | 72 | // // Reads another set of sdigits from galice2.root |
8cb3533f | 73 | // root[3] d1->MixWith("galice3.root") |
a4e98857 | 74 | // // Reads another set of sdigits from galice3.root |
8cb3533f | 75 | // root[4] d->ExecuteTask("deb timing") |
76 | // // Reads SDigits from files galice1.root, galice2.root .... | |
77 | // // mixes them and stores produced Digits in file galice1.root | |
78 | // // deb - prints number of produced digits | |
79 | // // deb all - prints list of produced digits | |
80 | // // timing - prints time used for digitization | |
990119d6 | 81 | // |
990119d6 | 82 | |
83 | // --- ROOT system --- | |
990119d6 | 84 | #include "TTree.h" |
85 | #include "TSystem.h" | |
8cb3533f | 86 | #include "TBenchmark.h" |
e957fea8 | 87 | #include "TRandom.h" |
ba54256b | 88 | |
990119d6 | 89 | // --- Standard library --- |
90 | ||
91 | // --- AliRoot header files --- | |
351dd634 | 92 | #include "AliLog.h" |
3f81a70b | 93 | #include "AliRunDigitizer.h" |
990119d6 | 94 | #include "AliPHOSDigit.h" |
7b7c1533 | 95 | #include "AliPHOSGetter.h" |
990119d6 | 96 | #include "AliPHOSDigitizer.h" |
97 | #include "AliPHOSSDigitizer.h" | |
8cb3533f | 98 | #include "AliPHOSGeometry.h" |
7437a0f7 | 99 | #include "AliPHOSTick.h" |
990119d6 | 100 | |
101 | ClassImp(AliPHOSDigitizer) | |
102 | ||
103 | ||
104 | //____________________________________________________________________________ | |
3663622c | 105 | AliPHOSDigitizer::AliPHOSDigitizer() : |
106 | AliDigitizer("",""), | |
107 | fDefaultInit(kTRUE), | |
108 | fDigitsInRun(0), | |
109 | fInit(kFALSE), | |
110 | fInput(0), | |
111 | fInputFileNames(0x0), | |
112 | fEventNames(0x0), | |
113 | fEmcCrystals(0), | |
114 | fPinNoise(0.f), | |
115 | fEMCDigitThreshold(0.f), | |
116 | fCPVNoise(0.f), | |
117 | fCPVDigitThreshold(0.f), | |
118 | fTimeResolution(0.f), | |
119 | fTimeThreshold(0.f), | |
120 | fTimeSignalLength(0.f), | |
121 | fADCchanelEmc(0.f), | |
122 | fADCpedestalEmc(0.f), | |
123 | fNADCemc(0), | |
124 | fADCchanelCpv(0.f), | |
125 | fADCpedestalCpv(0.f), | |
126 | fNADCcpv(0), | |
127 | fEventFolderName(""), | |
128 | fFirstEvent(0), | |
129 | fLastEvent(0) | |
990119d6 | 130 | { |
131 | // ctor | |
8d0f3f77 | 132 | InitParameters() ; |
fbf811ec | 133 | fManager = 0 ; // We work in the standalong mode |
88cb7938 | 134 | } |
3f81a70b | 135 | |
136 | //____________________________________________________________________________ | |
e191bb57 | 137 | AliPHOSDigitizer::AliPHOSDigitizer(TString alirunFileName, |
138 | TString eventFolderName): | |
3663622c | 139 | AliDigitizer("PHOS"+AliConfig::Instance()->GetDigitizerTaskName(), alirunFileName), |
140 | fDefaultInit(kFALSE), | |
141 | fDigitsInRun(0), | |
142 | fInit(kFALSE), | |
143 | fInput(0), | |
144 | fInputFileNames(0x0), | |
145 | fEventNames(0x0), | |
146 | fEmcCrystals(0), | |
147 | fPinNoise(0.f), | |
148 | fEMCDigitThreshold(0.f), | |
149 | fCPVNoise(0.f), | |
150 | fCPVDigitThreshold(0.f), | |
151 | fTimeResolution(0.f), | |
152 | fTimeThreshold(0.f), | |
153 | fTimeSignalLength(0.f), | |
154 | fADCchanelEmc(0.f), | |
155 | fADCpedestalEmc(0.f), | |
156 | fNADCemc(0), | |
157 | fADCchanelCpv(0.f), | |
158 | fADCpedestalCpv(0.f), | |
159 | fNADCcpv(0), | |
160 | fEventFolderName(eventFolderName), | |
161 | fFirstEvent(0), | |
162 | fLastEvent(0) | |
3f81a70b | 163 | { |
164 | // ctor | |
8d0f3f77 | 165 | InitParameters() ; |
3f81a70b | 166 | Init() ; |
92f521a9 | 167 | fDefaultInit = kFALSE ; |
88cb7938 | 168 | fManager = 0 ; // We work in the standalong mode |
169 | } | |
170 | ||
171 | //____________________________________________________________________________ | |
3663622c | 172 | AliPHOSDigitizer::AliPHOSDigitizer(const AliPHOSDigitizer & d) : |
173 | AliDigitizer(d), | |
174 | fDefaultInit(d.fDefaultInit), | |
175 | fDigitsInRun(d.fDigitsInRun), | |
176 | fInit(d.fInit), | |
177 | fInput(d.fInput), | |
178 | fInputFileNames(0x0),//? | |
179 | fEventNames(0x0),//? | |
180 | fEmcCrystals(d.fEmcCrystals), | |
181 | fPinNoise(d.fPinNoise), | |
182 | fEMCDigitThreshold(d.fEMCDigitThreshold), | |
183 | fCPVNoise(d.fCPVNoise), | |
184 | fCPVDigitThreshold(d.fCPVDigitThreshold), | |
185 | fTimeResolution(d.fTimeResolution), | |
186 | fTimeThreshold(d.fTimeThreshold), | |
187 | fTimeSignalLength(d.fTimeSignalLength), | |
188 | fADCchanelEmc(d.fADCchanelEmc), | |
189 | fADCpedestalEmc(d.fADCpedestalEmc), | |
190 | fNADCemc(d.fNADCemc), | |
191 | fADCchanelCpv(d.fADCchanelCpv), | |
192 | fADCpedestalCpv(d.fADCpedestalCpv), | |
193 | fNADCcpv(d.fNADCcpv), | |
194 | fEventFolderName(d.fEventFolderName), | |
195 | fFirstEvent(d.fFirstEvent), | |
196 | fLastEvent(d.fLastEvent) | |
88cb7938 | 197 | { |
198 | // copyy ctor | |
88cb7938 | 199 | SetName(d.GetName()) ; |
200 | SetTitle(d.GetTitle()) ; | |
990119d6 | 201 | } |
202 | ||
990119d6 | 203 | //____________________________________________________________________________ |
3663622c | 204 | AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * rd) : |
205 | AliDigitizer(rd,"PHOS"+AliConfig::Instance()->GetDigitizerTaskName()), | |
206 | fDefaultInit(kFALSE), | |
207 | fDigitsInRun(0), | |
208 | fInit(kFALSE), | |
209 | fInput(0), | |
210 | fInputFileNames(0x0), | |
211 | fEventNames(0x0), | |
212 | fEmcCrystals(0), | |
213 | fPinNoise(0.f), | |
214 | fEMCDigitThreshold(0.f), | |
215 | fCPVNoise(0.f), | |
216 | fCPVDigitThreshold(0.f), | |
217 | fTimeResolution(0.f), | |
218 | fTimeThreshold(0.f), | |
219 | fTimeSignalLength(0.f), | |
220 | fADCchanelEmc(0.f), | |
221 | fADCpedestalEmc(0.f), | |
222 | fNADCemc(0), | |
223 | fADCchanelCpv(0.f), | |
224 | fADCpedestalCpv(0.f), | |
225 | fNADCcpv(0), | |
226 | fEventFolderName(fManager->GetInputFolderName(0)), | |
227 | fFirstEvent(0), | |
228 | fLastEvent(0) | |
990119d6 | 229 | { |
45fa49ca | 230 | // ctor Init() is called by RunDigitizer |
88cb7938 | 231 | fManager = rd ; |
88cb7938 | 232 | SetTitle(dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetFileName(0)); |
b22e4735 | 233 | InitParameters() ; |
fbf811ec | 234 | fDefaultInit = kFALSE ; |
990119d6 | 235 | } |
236 | ||
237 | //____________________________________________________________________________ | |
238 | AliPHOSDigitizer::~AliPHOSDigitizer() | |
239 | { | |
7c193632 | 240 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; |
241 | ||
242 | // Clean Digitizer from the white board | |
243 | gime->PhosLoader()->CleanDigitizer() ; | |
990119d6 | 244 | // dtor |
88cb7938 | 245 | delete [] fInputFileNames ; |
246 | delete [] fEventNames ; | |
247 | ||
990119d6 | 248 | } |
249 | ||
250 | //____________________________________________________________________________ | |
fc7e2f43 | 251 | void AliPHOSDigitizer::Digitize(Int_t event) |
a4e98857 | 252 | { |
253 | ||
254 | // Makes the digitization of the collected summable digits. | |
255 | // It first creates the array of all PHOS modules | |
dc986a1d | 256 | // filled with noise (different for EMC, and CPV) and |
a4e98857 | 257 | // then adds contributions from SDigits. |
258 | // This design avoids scanning over the list of digits to add | |
259 | // contribution to new SDigits only. | |
990119d6 | 260 | |
f98c06a1 | 261 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; |
45fa49ca | 262 | Int_t ReadEvent = event ; |
263 | if (fManager) | |
264 | ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(0))->GetCurrentEventNumber() ; | |
351dd634 | 265 | AliInfo(Form("Adding event %d from input stream 0 %s %s", |
266 | ReadEvent, GetTitle(), fEventFolderName.Data())) ; | |
45fa49ca | 267 | gime->Event(ReadEvent, "S") ; |
88cb7938 | 268 | TClonesArray * digits = gime->Digits() ; |
7b7c1533 | 269 | digits->Clear() ; |
990119d6 | 270 | |
7b7c1533 | 271 | const AliPHOSGeometry *geom = gime->PHOSGeometry() ; |
990119d6 | 272 | //Making digits with noise, first EMC |
273 | Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ(); | |
274 | ||
275 | Int_t nCPV ; | |
990119d6 | 276 | Int_t absID ; |
990119d6 | 277 | |
88cb7938 | 278 | nCPV = nEMC + geom->GetNumberOfCPVPadsZ() * geom->GetNumberOfCPVPadsPhi() * geom->GetNModules() ; |
279 | ||
9688c1dd | 280 | digits->Expand(nCPV) ; |
8cb3533f | 281 | |
88cb7938 | 282 | // get first the sdigitizer from the tasks list |
283 | if ( !gime->SDigitizer() ) | |
284 | gime->LoadSDigitizer(); | |
285 | AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(); | |
286 | ||
287 | if ( !sDigitizer ) | |
351dd634 | 288 | AliFatal(Form("SDigitizer with name %s %s not found", |
289 | GetTitle(), fEventFolderName.Data() )) ; | |
88cb7938 | 290 | |
291 | //take all the inputs to add together and load the SDigits | |
292 | TObjArray * sdigArray = new TObjArray(fInput) ; | |
293 | sdigArray->AddAt(gime->SDigits(), 0) ; | |
294 | Int_t i ; | |
295 | for(i = 1 ; i < fInput ; i++){ | |
296 | TString tempo(fEventNames[i]) ; | |
297 | tempo += i ; | |
45fa49ca | 298 | AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ; |
299 | if (fManager) | |
300 | ReadEvent = dynamic_cast<AliStream*>(fManager->GetInputStream(i))->GetCurrentEventNumber() ; | |
351dd634 | 301 | AliInfo(Form("Adding event %d from input stream %d %s %s", |
302 | ReadEvent, i, fInputFileNames[i].Data(), tempo.Data())) ; | |
45fa49ca | 303 | gime->Event(ReadEvent,"S"); |
88cb7938 | 304 | sdigArray->AddAt(gime->SDigits(), i) ; |
38bb0fd5 | 305 | } |
9688c1dd | 306 | |
27a73a5d | 307 | //Find the first crystal with signal |
9688c1dd | 308 | Int_t nextSig = 200000 ; |
88cb7938 | 309 | TClonesArray * sdigits ; |
310 | for(i = 0 ; i < fInput ; i++){ | |
311 | sdigits = dynamic_cast<TClonesArray *>(sdigArray->At(i)) ; | |
a6eedfad | 312 | if ( !sdigits->GetEntriesFast() ) |
7a9d98f9 | 313 | continue ; |
88cb7938 | 314 | Int_t curNext = dynamic_cast<AliPHOSDigit *>(sdigits->At(0))->GetId() ; |
315 | if(curNext < nextSig) | |
316 | nextSig = curNext ; | |
9688c1dd | 317 | } |
88cb7938 | 318 | |
319 | TArrayI index(fInput) ; | |
9688c1dd | 320 | index.Reset() ; //Set all indexes to zero |
88cb7938 | 321 | |
9688c1dd | 322 | AliPHOSDigit * digit ; |
323 | AliPHOSDigit * curSDigit ; | |
88cb7938 | 324 | |
7437a0f7 | 325 | TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ; |
88cb7938 | 326 | |
9688c1dd | 327 | //Put Noise contribution |
88cb7938 | 328 | for(absID = 1 ; absID <= nEMC ; absID++){ |
9688c1dd | 329 | Float_t noise = gRandom->Gaus(0., fPinNoise) ; |
27a73a5d | 330 | // YVK: do not digitize amplitudes for EMC |
331 | // new((*digits)[absID-1]) AliPHOSDigit( -1, absID, sDigitizer->Digitize(noise), TimeOfNoise() ) ; | |
332 | new((*digits)[absID-1]) AliPHOSDigit( -1, absID, noise, TimeOfNoise() ) ; | |
9688c1dd | 333 | //look if we have to add signal? |
88cb7938 | 334 | digit = dynamic_cast<AliPHOSDigit *>(digits->At(absID-1)) ; |
335 | ||
9688c1dd | 336 | if(absID==nextSig){ |
337 | //Add SDigits from all inputs | |
7437a0f7 | 338 | ticks->Clear() ; |
9688c1dd | 339 | Int_t contrib = 0 ; |
27a73a5d | 340 | Float_t a = digit->GetEnergy() ; |
88cb7938 | 341 | Float_t b = TMath::Abs( a / fTimeSignalLength) ; |
342 | //Mark the beginning of the signal | |
7437a0f7 | 343 | new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b); |
27a73a5d | 344 | //Mark the end of the signal |
7437a0f7 | 345 | new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b); |
88cb7938 | 346 | |
9688c1dd | 347 | //loop over inputs |
88cb7938 | 348 | for(i = 0 ; i < fInput ; i++){ |
349 | if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] ) | |
350 | curSDigit = dynamic_cast<AliPHOSDigit*>(dynamic_cast<TClonesArray *>(sdigArray->At(i))->At(index[i])) ; | |
5c9dfca0 | 351 | else |
352 | curSDigit = 0 ; | |
9688c1dd | 353 | //May be several digits will contribute from the same input |
354 | while(curSDigit && curSDigit->GetId() == absID){ | |
355 | //Shift primary to separate primaries belonging different inputs | |
356 | Int_t primaryoffset ; | |
9891b76e | 357 | if(fManager) |
358 | primaryoffset = fManager->GetMask(i) ; | |
9688c1dd | 359 | else |
21c293b7 | 360 | primaryoffset = 10000000*i ; |
361 | curSDigit->ShiftPrimary(primaryoffset) ; | |
7437a0f7 | 362 | |
27a73a5d | 363 | a = curSDigit->GetEnergy() ; |
7437a0f7 | 364 | b = a /fTimeSignalLength ; |
365 | new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b); | |
366 | new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); | |
88cb7938 | 367 | |
3663622c | 368 | *digit += *curSDigit ; //add energies |
27a73a5d | 369 | |
9688c1dd | 370 | index[i]++ ; |
88cb7938 | 371 | if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] ) |
372 | curSDigit = dynamic_cast<AliPHOSDigit*>(dynamic_cast<TClonesArray *>(sdigArray->At(i))->At(index[i])) ; | |
5c9dfca0 | 373 | else |
374 | curSDigit = 0 ; | |
9688c1dd | 375 | } |
376 | } | |
88cb7938 | 377 | |
9688c1dd | 378 | //calculate and set time |
7437a0f7 | 379 | Float_t time = FrontEdgeTime(ticks) ; |
9688c1dd | 380 | digit->SetTime(time) ; |
88cb7938 | 381 | |
9688c1dd | 382 | //Find next signal module |
7437a0f7 | 383 | nextSig = 200000 ; |
88cb7938 | 384 | for(i = 0 ; i < fInput ; i++){ |
385 | sdigits = dynamic_cast<TClonesArray *>(sdigArray->At(i)) ; | |
5c9dfca0 | 386 | Int_t curNext = nextSig ; |
387 | if(sdigits->GetEntriesFast() > index[i] ){ | |
88cb7938 | 388 | curNext = dynamic_cast<AliPHOSDigit *>(sdigits->At(index[i]))->GetId() ; |
5c9dfca0 | 389 | } |
9688c1dd | 390 | if(curNext < nextSig) nextSig = curNext ; |
7b7c1533 | 391 | } |
392 | } | |
990119d6 | 393 | } |
3f81a70b | 394 | |
7437a0f7 | 395 | ticks->Delete() ; |
396 | delete ticks ; | |
88cb7938 | 397 | |
9688c1dd | 398 | //Now CPV digits (different noise and no timing) |
399 | for(absID = nEMC+1; absID <= nCPV; absID++){ | |
400 | Float_t noise = gRandom->Gaus(0., fCPVNoise) ; | |
401 | new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ; | |
402 | //look if we have to add signal? | |
403 | if(absID==nextSig){ | |
88cb7938 | 404 | digit = dynamic_cast<AliPHOSDigit *>(digits->At(absID-1)) ; |
9688c1dd | 405 | //Add SDigits from all inputs |
88cb7938 | 406 | for(i = 0 ; i < fInput ; i++){ |
407 | if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] ) | |
408 | curSDigit = dynamic_cast<AliPHOSDigit*>( dynamic_cast<TClonesArray *>(sdigArray->At(i))->At(index[i])) ; | |
5c9dfca0 | 409 | else |
410 | curSDigit = 0 ; | |
a6eedfad | 411 | |
9688c1dd | 412 | //May be several digits will contribute from the same input |
413 | while(curSDigit && curSDigit->GetId() == absID){ | |
414 | //Shift primary to separate primaries belonging different inputs | |
415 | Int_t primaryoffset ; | |
9891b76e | 416 | if(fManager) |
417 | primaryoffset = fManager->GetMask(i) ; | |
9688c1dd | 418 | else |
419 | primaryoffset = 10000000*i ; | |
420 | curSDigit->ShiftPrimary(primaryoffset) ; | |
421 | ||
422 | //add energies | |
3663622c | 423 | *digit += *curSDigit ; |
9688c1dd | 424 | index[i]++ ; |
88cb7938 | 425 | if( dynamic_cast<TClonesArray *>(sdigArray->At(i))->GetEntriesFast() > index[i] ) |
426 | curSDigit = dynamic_cast<AliPHOSDigit*>( dynamic_cast<TClonesArray *>(sdigArray->At(i))->At(index[i]) ) ; | |
5c9dfca0 | 427 | else |
428 | curSDigit = 0 ; | |
9688c1dd | 429 | } |
430 | } | |
a6eedfad | 431 | |
9688c1dd | 432 | //Find next signal module |
a6eedfad | 433 | nextSig = 200000 ; |
88cb7938 | 434 | for(i = 0 ; i < fInput ; i++){ |
435 | sdigits = dynamic_cast<TClonesArray *>(sdigArray->At(i)) ; | |
5c9dfca0 | 436 | Int_t curNext = nextSig ; |
437 | if(sdigits->GetEntriesFast() > index[i] ) | |
88cb7938 | 438 | curNext = dynamic_cast<AliPHOSDigit *>( sdigits->At(index[i]) )->GetId() ; |
9688c1dd | 439 | if(curNext < nextSig) nextSig = curNext ; |
440 | } | |
441 | ||
442 | } | |
443 | } | |
88cb7938 | 444 | |
445 | delete sdigArray ; //We should not delete its contents | |
9688c1dd | 446 | |
990119d6 | 447 | //remove digits below thresholds |
88cb7938 | 448 | for(i = 0 ; i < nEMC ; i++){ |
548f0134 | 449 | digit = dynamic_cast<AliPHOSDigit*>( digits->At(i) ) ; |
877695e7 | 450 | DecalibrateEMC(digit); |
27a73a5d | 451 | if(digit->GetEnergy() < fEMCDigitThreshold) |
a6eedfad | 452 | digits->RemoveAt(i) ; |
aaf8a71c | 453 | else |
454 | digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ; | |
455 | } | |
456 | ||
a6eedfad | 457 | |
458 | for(i = nEMC; i < nCPV ; i++) | |
27a73a5d | 459 | // if( sDigitizer->Calibrate( dynamic_cast<AliPHOSDigit*>(digits->At(i))->GetAmp() ) < fCPVDigitThreshold ) |
460 | if( dynamic_cast<AliPHOSDigit*>(digits->At(i))->GetEnergy() < fCPVDigitThreshold ) | |
a6eedfad | 461 | digits->RemoveAt(i) ; |
9688c1dd | 462 | |
7b7c1533 | 463 | digits->Compress() ; |
990119d6 | 464 | |
7b7c1533 | 465 | Int_t ndigits = digits->GetEntriesFast() ; |
7b7c1533 | 466 | digits->Expand(ndigits) ; |
990119d6 | 467 | |
3758d9fc | 468 | //Set indexes in list of digits and make true digitization of the energy |
990119d6 | 469 | for (i = 0 ; i < ndigits ; i++) { |
548f0134 | 470 | digit = dynamic_cast<AliPHOSDigit*>( digits->At(i) ) ; |
990119d6 | 471 | digit->SetIndexInList(i) ; |
27a73a5d | 472 | if(digit->GetId() > fEmcCrystals){ //digitize CPV only |
877695e7 | 473 | digit->SetAmp(DigitizeCPV(digit->GetEnergy(),digit->GetId()) ) ; |
27a73a5d | 474 | } |
990119d6 | 475 | } |
7b7c1533 | 476 | } |
548f0134 | 477 | |
3758d9fc | 478 | //____________________________________________________________________________ |
877695e7 | 479 | void AliPHOSDigitizer::DecalibrateEMC(AliPHOSDigit *digit) |
3758d9fc | 480 | { |
877695e7 | 481 | // Decalibrate EMC digit, i.e. change its energy by a factor read from CDB |
482 | ||
483 | AliPHOSGetter* gime = AliPHOSGetter::Instance(); | |
484 | ||
485 | if(!gime->CalibData()) { | |
486 | AliPHOSCalibData* cdb = new AliPHOSCalibData(-1); | |
487 | gime->SetCalibData(cdb); | |
488 | } | |
489 | ||
490 | //Determine rel.position of the cell absolute ID | |
491 | Int_t relId[4]; | |
492 | gime->PHOSGeometry()->AbsToRelNumbering(digit->GetId(),relId); | |
493 | Int_t module=relId[0]; | |
494 | Int_t row =relId[2]; | |
495 | Int_t column=relId[3]; | |
496 | Float_t decalibration = gime->CalibData()->GetADCchannelEmc(module,column,row); | |
497 | Float_t energy = digit->GetEnergy() * decalibration; | |
498 | digit->SetEnergy(energy); | |
499 | } | |
500 | //____________________________________________________________________________ | |
501 | Int_t AliPHOSDigitizer::DigitizeCPV(Float_t charge, Int_t absId) | |
502 | { | |
503 | // Returns digitized value of the CPV charge in a pad absId | |
0bc3b8ed | 504 | |
a8ec0771 | 505 | AliPHOSGetter* gime = AliPHOSGetter::Instance(); |
506 | ||
fc6706cb | 507 | if(!gime->CalibData()) { |
28871337 | 508 | AliPHOSCalibData* cdb = new AliPHOSCalibData(-1); // use AliCDBManager's run number |
fc6706cb | 509 | gime->SetCalibData(cdb); |
510 | } | |
511 | ||
a8ec0771 | 512 | //Determine rel.position of the cell absId |
513 | Int_t relId[4]; | |
514 | gime->PHOSGeometry()->AbsToRelNumbering(absId,relId); | |
515 | Int_t module=relId[0]; | |
27a73a5d | 516 | Int_t row =relId[2]; |
a8ec0771 | 517 | Int_t column=relId[3]; |
518 | ||
877695e7 | 519 | Int_t channel = 0; |
a8ec0771 | 520 | |
877695e7 | 521 | if(absId > fEmcCrystals){ //digitize CPV only |
a8ec0771 | 522 | |
523 | //reading calibration data for cell absId. | |
524 | //If no calibration DB found, accept default values. | |
525 | ||
fc6706cb | 526 | if(gime->CalibData()) { |
27a73a5d | 527 | fADCpedestalCpv = gime->CalibData()->GetADCpedestalCpv(module,column,row); |
877695e7 | 528 | fADCchanelCpv = gime->CalibData()->GetADCchannelCpv( module,column,row); |
fc6706cb | 529 | } |
530 | ||
877695e7 | 531 | channel = (Int_t) TMath::Ceil((charge - fADCpedestalCpv)/fADCchanelCpv) ; |
532 | if(channel > fNADCcpv ) channel = fNADCcpv ; | |
3758d9fc | 533 | } |
877695e7 | 534 | return channel ; |
3758d9fc | 535 | } |
548f0134 | 536 | |
7b7c1533 | 537 | //____________________________________________________________________________ |
538 | void AliPHOSDigitizer::Exec(Option_t *option) | |
539 | { | |
212d1c0f | 540 | // Steering method to process digitization for events |
541 | // in the range from fFirstEvent to fLastEvent. | |
542 | // This range is optionally set by SetEventRange(). | |
45fa49ca | 543 | // if fLastEvent=-1, then process events until the end. |
544 | // by default fLastEvent = fFirstEvent (process only one event) | |
88cb7938 | 545 | |
546 | if (!fInit) { // to prevent overwrite existing file | |
351dd634 | 547 | AliError(Form("Give a version name different from %s", |
548 | fEventFolderName.Data() )) ; | |
88cb7938 | 549 | return ; |
550 | } | |
990119d6 | 551 | |
7b7c1533 | 552 | if (strstr(option,"print")) { |
88cb7938 | 553 | Print(); |
7b7c1533 | 554 | return ; |
8cb3533f | 555 | } |
990119d6 | 556 | |
7b7c1533 | 557 | if(strstr(option,"tim")) |
558 | gBenchmark->Start("PHOSDigitizer"); | |
3f81a70b | 559 | |
fb43ada4 | 560 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; |
88cb7938 | 561 | |
5b4d2c50 | 562 | // Post Digitizer to the white board |
563 | gime->PostDigitizer(this) ; | |
564 | ||
212d1c0f | 565 | if (fLastEvent == -1) |
566 | fLastEvent = gime->MaxEvent() - 1 ; | |
396a348e | 567 | else if (fManager) |
568 | fLastEvent = fFirstEvent ; | |
45fa49ca | 569 | |
212d1c0f | 570 | Int_t nEvents = fLastEvent - fFirstEvent + 1; |
571 | ||
7b7c1533 | 572 | Int_t ievent ; |
88cb7938 | 573 | |
212d1c0f | 574 | for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) { |
88cb7938 | 575 | |
576 | gime->Event(ievent,"S") ; | |
b22e4735 | 577 | |
7b7c1533 | 578 | Digitize(ievent) ; //Add prepared SDigits to digits and add the noise |
88cb7938 | 579 | |
90cceaf6 | 580 | WriteDigits() ; |
88cb7938 | 581 | |
01a599c9 | 582 | if(strstr(option,"deb")) |
583 | PrintDigits(option); | |
94de8339 | 584 | |
585 | //increment the total number of Digits per run | |
586 | fDigitsInRun += gime->Digits()->GetEntriesFast() ; | |
88cb7938 | 587 | } |
588 | ||
5b4d2c50 | 589 | gime->PhosLoader()->CleanDigitizer(); |
590 | ||
8cb3533f | 591 | if(strstr(option,"tim")){ |
592 | gBenchmark->Stop("PHOSDigitizer"); | |
21cd0c07 | 593 | TString message ; |
594 | message = " took %f seconds for Digitizing %f seconds per event\n" ; | |
351dd634 | 595 | AliInfo(Form( message.Data(), |
21cd0c07 | 596 | gBenchmark->GetCpuTime("PHOSDigitizer"), |
351dd634 | 597 | gBenchmark->GetCpuTime("PHOSDigitizer")/nEvents )); |
21cd0c07 | 598 | } |
990119d6 | 599 | } |
600 | ||
9688c1dd | 601 | //____________________________________________________________________________ |
0bc3b8ed | 602 | Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks) const |
603 | { | |
604 | // Returns the shortest time among all time ticks | |
605 | ||
7437a0f7 | 606 | ticks->Sort() ; //Sort in accordance with times of ticks |
607 | TIter it(ticks) ; | |
608 | AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ; | |
609 | Float_t time = ctick->CrossingTime(fTimeThreshold) ; | |
610 | ||
611 | AliPHOSTick * t ; | |
612 | while((t=(AliPHOSTick*) it.Next())){ | |
613 | if(t->GetTime() < time) //This tick starts before crossing | |
614 | *ctick+=*t ; | |
615 | else | |
616 | return time ; | |
617 | ||
618 | time = ctick->CrossingTime(fTimeThreshold) ; | |
9688c1dd | 619 | } |
620 | return time ; | |
9688c1dd | 621 | } |
8d0f3f77 | 622 | |
7b7c1533 | 623 | //____________________________________________________________________________ |
3f81a70b | 624 | Bool_t AliPHOSDigitizer::Init() |
8d0f3f77 | 625 | { |
fbf811ec | 626 | // Makes all memory allocations |
88cb7938 | 627 | fInit = kTRUE ; |
628 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; | |
8d0f3f77 | 629 | if ( gime == 0 ) { |
351dd634 | 630 | AliFatal(Form("Could not obtain the Getter object for file %s and event %s !", |
631 | GetTitle(), fEventFolderName.Data())); | |
8d0f3f77 | 632 | return kFALSE; |
633 | } | |
634 | ||
635 | const AliPHOSGeometry * geom = gime->PHOSGeometry() ; | |
b22e4735 | 636 | |
88cb7938 | 637 | fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ; |
8d0f3f77 | 638 | |
88cb7938 | 639 | TString opt("Digits") ; |
640 | if(gime->VersionExists(opt) ) { | |
351dd634 | 641 | AliError(Form("Give a version name different from %s", |
642 | fEventFolderName.Data() )) ; | |
88cb7938 | 643 | fInit = kFALSE ; |
644 | } | |
645 | ||
45fa49ca | 646 | fFirstEvent = 0 ; |
647 | fLastEvent = fFirstEvent ; | |
88cb7938 | 648 | if (fManager) |
649 | fInput = fManager->GetNinputs() ; | |
650 | else | |
651 | fInput = 1 ; | |
652 | ||
653 | fInputFileNames = new TString[fInput] ; | |
654 | fEventNames = new TString[fInput] ; | |
655 | fInputFileNames[0] = GetTitle() ; | |
656 | fEventNames[0] = fEventFolderName.Data() ; | |
657 | Int_t index ; | |
658 | for (index = 1 ; index < fInput ; index++) { | |
659 | fInputFileNames[index] = dynamic_cast<AliStream*>(fManager->GetInputStream(index))->GetFileName(0); | |
660 | TString tempo = fManager->GetInputFolderName(index) ; | |
45fa49ca | 661 | fEventNames[index] = tempo.Remove(tempo.Length()-1) ; // strip of the stream number added by fManager |
8d0f3f77 | 662 | } |
88cb7938 | 663 | |
664 | //to prevent cleaning of this object while GetEvent is called | |
665 | gime->PhosLoader()->GetDigitsDataLoader()->GetBaseTaskLoader()->SetDoNotReload(kTRUE); | |
666 | ||
667 | return fInit ; | |
8d0f3f77 | 668 | } |
669 | ||
670 | //____________________________________________________________________________ | |
671 | void AliPHOSDigitizer::InitParameters() | |
a4e98857 | 672 | { |
45fa49ca | 673 | // Set initial parameters Digitizer |
0bc3b8ed | 674 | |
27a73a5d | 675 | fPinNoise = 0.004 ; // [GeV] |
676 | fEMCDigitThreshold = 0.012 ; // [GeV] | |
677 | fCPVNoise = 0.01; // [aux units] | |
678 | fCPVDigitThreshold = 0.09 ; // [aux units] | |
679 | fTimeResolution = 0.5e-9 ; // [sec] | |
680 | fTimeSignalLength = 1.0e-9 ; // [sec] | |
3758d9fc | 681 | fDigitsInRun = 0 ; |
877695e7 | 682 | fADCchanelEmc = 1.0; // Coefficient between real and measured energies in EMC |
683 | fADCpedestalEmc = 0. ; // | |
3758d9fc | 684 | fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC |
685 | ||
686 | fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais' | |
687 | fADCpedestalCpv = 0.012 ; // | |
688 | fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC | |
689 | ||
27a73a5d | 690 | // fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude |
691 | fTimeThreshold = 0.001 ; // [GeV] | |
212d1c0f | 692 | SetEventRange(0,-1) ; |
8cb3533f | 693 | |
990119d6 | 694 | } |
7b7c1533 | 695 | |
990119d6 | 696 | //__________________________________________________________________ |
fc7e2f43 | 697 | void AliPHOSDigitizer::MixWith(TString alirunFileName, TString eventFolderName) |
a4e98857 | 698 | { |
ba54256b | 699 | // Allows to produce digits by superimposing background and signal event. |
bca3b32a | 700 | // It is assumed, that headers file with SIGNAL events is opened in |
a4e98857 | 701 | // the constructor. |
702 | // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed | |
703 | // Thus we avoid writing (changing) huge and expensive | |
bca3b32a | 704 | // backgound files: all output will be writen into SIGNAL, i.e. |
705 | // opened in constructor file. | |
706 | // | |
a4e98857 | 707 | // One can open as many files to mix with as one needs. |
7b7c1533 | 708 | // However only Sdigits with the same name (i.e. constructed with the same SDigitizer) |
709 | // can be mixed. | |
bca3b32a | 710 | |
88cb7938 | 711 | if( strcmp(fEventFolderName, "") == 0 ) |
8cb3533f | 712 | Init() ; |
713 | ||
9891b76e | 714 | if(fManager){ |
88cb7938 | 715 | Warning("MixWith", "Cannot use this method with AliRunDigitizer\n" ) ; |
3f81a70b | 716 | return ; |
717 | } | |
88cb7938 | 718 | // looking for file which contains AliRun |
719 | if (gSystem->AccessPathName(alirunFileName)) {// file does not exist | |
351dd634 | 720 | AliError(Form("File %s does not exist!", alirunFileName.Data())) ; |
88cb7938 | 721 | return ; |
990119d6 | 722 | } |
88cb7938 | 723 | // looking for the file which contains SDigits |
724 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; | |
725 | TString fileName( gime->GetSDigitsFileName() ) ; | |
e191bb57 | 726 | if ( eventFolderName != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name |
88cb7938 | 727 | fileName = fileName.ReplaceAll(".root", "") + "_" + eventFolderName + ".root" ; |
728 | if ( (gSystem->AccessPathName(fileName)) ) { | |
351dd634 | 729 | AliError(Form("The file %s does not exist!", fileName.Data())) ; |
88cb7938 | 730 | return ; |
7b7c1533 | 731 | } |
88cb7938 | 732 | // need to increase the arrays |
733 | TString tempo = fInputFileNames[fInput-1] ; | |
734 | delete [] fInputFileNames ; | |
735 | fInputFileNames = new TString[fInput+1] ; | |
736 | fInputFileNames[fInput-1] = tempo ; | |
737 | ||
738 | tempo = fEventNames[fInput-1] ; | |
739 | delete [] fEventNames ; | |
740 | fEventNames = new TString[fInput+1] ; | |
741 | fEventNames[fInput-1] = tempo ; | |
742 | ||
743 | fInputFileNames[fInput] = alirunFileName ; | |
744 | fEventNames[fInput] = eventFolderName ; | |
745 | fInput++ ; | |
990119d6 | 746 | } |
7b7c1533 | 747 | |
990119d6 | 748 | //__________________________________________________________________ |
702ab87e | 749 | void AliPHOSDigitizer::Print(const Option_t *)const |
21cd0c07 | 750 | { |
dd5c4038 | 751 | // Print Digitizer's parameters |
351dd634 | 752 | AliInfo(Form("\n------------------- %s -------------", GetName() )) ; |
88cb7938 | 753 | if( strcmp(fEventFolderName.Data(), "") != 0 ){ |
754 | printf(" Writing Digits to branch with title %s\n", fEventFolderName.Data()) ; | |
755 | ||
756 | Int_t nStreams ; | |
757 | if (fManager) | |
758 | nStreams = GetNInputStreams() ; | |
759 | else | |
760 | nStreams = fInput ; | |
761 | ||
762 | Int_t index = 0 ; | |
763 | for (index = 0 ; index < nStreams ; index++) { | |
764 | TString tempo(fEventNames[index]) ; | |
765 | tempo += index ; | |
766 | AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[index], tempo) ; | |
767 | TString fileName( gime->GetSDigitsFileName() ) ; | |
e191bb57 | 768 | if ( fEventNames[index] != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name |
88cb7938 | 769 | fileName = fileName.ReplaceAll(".root", "") + "_" + fEventNames[index] + ".root" ; |
770 | printf ("Adding SDigits from %s %s\n", fInputFileNames[index].Data(), fileName.Data()) ; | |
771 | } | |
772 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; | |
773 | printf("\nWriting digits to %s", gime->GetDigitsFileName().Data()) ; | |
774 | ||
775 | printf("\nWith following parameters:\n") ; | |
27a73a5d | 776 | printf(" Electronics noise in EMC (fPinNoise) = %f GeV\n", fPinNoise ) ; |
777 | printf(" Threshold in EMC (fEMCDigitThreshold) = %f GeV\n", fEMCDigitThreshold ) ; | |
778 | printf(" Noise in CPV (fCPVNoise) = %f aux units\n", fCPVNoise ) ; | |
779 | printf(" Threshold in CPV (fCPVDigitThreshold) = %f aux units\n",fCPVDigitThreshold ) ; | |
88cb7938 | 780 | printf(" ---------------------------------------------------\n") ; |
990119d6 | 781 | } |
8cb3533f | 782 | else |
351dd634 | 783 | AliInfo(Form("AliPHOSDigitizer not initialized" )) ; |
8cb3533f | 784 | |
785 | } | |
88cb7938 | 786 | |
8cb3533f | 787 | //__________________________________________________________________ |
21cd0c07 | 788 | void AliPHOSDigitizer::PrintDigits(Option_t * option) |
789 | { | |
3bf72d32 | 790 | // Print a table of digits |
21cd0c07 | 791 | |
88cb7938 | 792 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; |
3bf72d32 | 793 | TClonesArray * digits = gime->Digits() ; |
794 | ||
351dd634 | 795 | AliInfo(Form("%d", digits->GetEntriesFast())) ; |
88cb7938 | 796 | printf("\nevent %d", gAlice->GetEvNumber()) ; |
797 | printf("\n Number of entries in Digits list %d", digits->GetEntriesFast() ) ; | |
798 | ||
11f9c5ff | 799 | |
3bf72d32 | 800 | if(strstr(option,"all")||strstr(option,"EMC")){ |
8cb3533f | 801 | //loop over digits |
802 | AliPHOSDigit * digit; | |
88cb7938 | 803 | printf("\nEMC digits (with primaries):\n") ; |
804 | printf("\n Id Amplitude Time Index Nprim: Primaries list \n") ; | |
9688c1dd | 805 | Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ; |
8cb3533f | 806 | Int_t index ; |
a6eedfad | 807 | for (index = 0 ; (index < digits->GetEntriesFast()) && |
88cb7938 | 808 | (dynamic_cast<AliPHOSDigit *>(digits->At(index))->GetId() <= maxEmc) ; index++) { |
7b7c1533 | 809 | digit = (AliPHOSDigit * ) digits->At(index) ; |
21cd0c07 | 810 | if(digit->GetNprimary() == 0) |
811 | continue; | |
27a73a5d | 812 | // printf("%6d %8d %6.5e %4d %2d :", |
813 | // digit->GetId(), digit->GetAmp(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ; // YVK | |
814 | printf("%6d %.4f %6.5e %4d %2d :", | |
815 | digit->GetId(), digit->GetEnergy(), digit->GetTime(), digit->GetIndexInList(), digit->GetNprimary()) ; | |
8cb3533f | 816 | Int_t iprimary; |
21cd0c07 | 817 | for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) { |
88cb7938 | 818 | printf("%d ",digit->GetPrimary(iprimary+1) ) ; |
21cd0c07 | 819 | } |
81d5f731 | 820 | printf("\n") ; |
21cd0c07 | 821 | } |
9688c1dd | 822 | } |
3bf72d32 | 823 | |
9688c1dd | 824 | if(strstr(option,"all")||strstr(option,"CPV")){ |
8cb3533f | 825 | |
9688c1dd | 826 | //loop over CPV digits |
827 | AliPHOSDigit * digit; | |
88cb7938 | 828 | printf("\nCPV digits (with primaries):\n") ; |
829 | printf("\n Id Amplitude Time Index Nprim: Primaries list \n") ; | |
9688c1dd | 830 | Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ; |
831 | Int_t index ; | |
a6eedfad | 832 | for (index = 0 ; index < digits->GetEntriesFast(); index++) { |
9688c1dd | 833 | digit = (AliPHOSDigit * ) digits->At(index) ; |
834 | if(digit->GetId() > maxEmc){ | |
81d5f731 | 835 | printf("%6d %8d %4d %2d :", |
11f9c5ff | 836 | digit->GetId(), digit->GetAmp(), digit->GetIndexInList(), digit->GetNprimary()) ; |
9688c1dd | 837 | Int_t iprimary; |
21cd0c07 | 838 | for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++) { |
88cb7938 | 839 | printf("%d ",digit->GetPrimary(iprimary+1) ) ; |
21cd0c07 | 840 | } |
81d5f731 | 841 | printf("\n") ; |
21cd0c07 | 842 | } |
9688c1dd | 843 | } |
8cb3533f | 844 | } |
88cb7938 | 845 | |
8cb3533f | 846 | } |
7b7c1533 | 847 | |
9688c1dd | 848 | //__________________________________________________________________ |
0bc3b8ed | 849 | Float_t AliPHOSDigitizer::TimeOfNoise(void) const |
9688c1dd | 850 | { // Calculates the time signal generated by noise |
26a2ef9d | 851 | //PH Info("TimeOfNoise", "Change me") ; |
04f0bda3 | 852 | return gRandom->Rndm() * 1.28E-5; |
8cb3533f | 853 | } |
7b7c1533 | 854 | |
88cb7938 | 855 | //__________________________________________________________________ |
856 | void AliPHOSDigitizer::Unload() | |
857 | { | |
858 | ||
859 | Int_t i ; | |
860 | for(i = 1 ; i < fInput ; i++){ | |
861 | TString tempo(fEventNames[i]) ; | |
862 | tempo += i ; | |
863 | AliPHOSGetter * gime = AliPHOSGetter::Instance(fInputFileNames[i], tempo) ; | |
864 | gime->PhosLoader()->UnloadSDigits() ; | |
865 | } | |
866 | ||
867 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle(), fEventFolderName) ; | |
868 | gime->PhosLoader()->UnloadDigits() ; | |
869 | } | |
870 | ||
7b7c1533 | 871 | //____________________________________________________________________________ |
90cceaf6 | 872 | void AliPHOSDigitizer::WriteDigits() |
7b7c1533 | 873 | { |
874 | ||
875 | // Makes TreeD in the output file. | |
876 | // Check if branch already exists: | |
877 | // if yes, exit without writing: ROOT TTree does not support overwriting/updating of | |
878 | // already existing branches. | |
879 | // else creates branch with Digits, named "PHOS", title "...", | |
880 | // and branch "AliPHOSDigitizer", with the same title to keep all the parameters | |
881 | // and names of files, from which digits are made. | |
882 | ||
f98c06a1 | 883 | AliPHOSGetter * gime = AliPHOSGetter::Instance(GetTitle()) ; |
88cb7938 | 884 | const TClonesArray * digits = gime->Digits() ; |
885 | TTree * treeD = gime->TreeD(); | |
886 | ||
7b7c1533 | 887 | // -- create Digits branch |
888 | Int_t bufferSize = 32000 ; | |
2524c56f | 889 | TBranch * digitsBranch = treeD->Branch("PHOS","TClonesArray",&digits,bufferSize); |
88cb7938 | 890 | digitsBranch->SetTitle(fEventFolderName); |
891 | digitsBranch->Fill() ; | |
fbf811ec | 892 | |
88cb7938 | 893 | gime->WriteDigits("OVERWRITE"); |
894 | gime->WriteDigitizer("OVERWRITE"); | |
895 | ||
896 | Unload() ; | |
b3690abb | 897 | |
7b7c1533 | 898 | } |