1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 //*-- Author : Dmitri Peressounko (SUBATECH & Kurchatov Institute)
20 //////////////////////////////////////////////////////////////////////////////
21 // This TTask performs digitization of Summable digits (in the PHOS case it is just
22 // the sum of contributions from all primary particles into a given cell).
23 // In addition it performs mixing of summable digits from different events.
24 // The name of the TTask is also the title of the branch that will contain
25 // the created SDigits
26 // The title of the TTAsk is the name of the file that contains the hits from
27 // which the SDigits are created
29 // For each event two branches are created in TreeD:
30 // "PHOS" - list of digits
31 // "AliPHOSDigitizer" - AliPHOSDigitizer with all parameters used in digitization
33 // Note, that one can set a title for new digits branch, and repeat digitization with
34 // another set of parameters.
37 // root[0] AliPHOSDigitizer * d = new AliPHOSDigitizer() ;
38 // root[1] d->ExecuteTask()
39 // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
40 // //Digitizes SDigitis in all events found in file galice.root
42 // root[2] AliPHOSDigitizer * d1 = new AliPHOSDigitizer("galice1.root") ;
43 // // Will read sdigits from galice1.root
44 // root[3] d1->MixWith("galice2.root")
45 // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated
46 // // Reads another set of sdigits from galice2.root
47 // root[3] d1->MixWith("galice3.root")
48 // // Reads another set of sdigits from galice3.root
49 // root[4] d->ExecuteTask("deb timing")
50 // // Reads SDigits from files galice1.root, galice2.root ....
51 // // mixes them and stores produced Digits in file galice1.root
52 // // deb - prints number of produced digits
53 // // deb all - prints list of produced digits
54 // // timing - prints time used for digitization
57 // --- ROOT system ---
63 #include "TObjString.h"
64 #include "TBenchmark.h"
66 // --- Standard library ---
69 // --- AliRoot header files ---
72 #include "AliRunDigitizer.h"
73 #include "AliPHOSDigit.h"
75 #include "AliPHOSGetter.h"
76 #include "AliPHOSDigitizer.h"
77 #include "AliPHOSSDigitizer.h"
78 #include "AliPHOSGeometry.h"
79 #include "AliPHOSTick.h"
81 ClassImp(AliPHOSDigitizer)
84 //____________________________________________________________________________
85 AliPHOSDigitizer::AliPHOSDigitizer()
90 fEMCDigitThreshold = 0.01 ;
92 fCPVDigitThreshold = 0.09 ;
93 fTimeResolution = 0.5e-9 ;
94 fTimeSignalLength = 1.0e-9 ;
96 fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
97 fADCpedestalEmc = 0.005 ; //
98 fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
100 fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
101 fADCpedestalCpv = 0.012 ; //
102 fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
104 fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
105 fARD = 0 ; // We work in the standalong mode
108 //____________________________________________________________________________
109 AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name)
113 SetTitle(headerFile) ;
114 fARD = 0 ; // We work in the standalong mode
119 //____________________________________________________________________________
120 AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard)
125 SetTitle("aliroot") ;
130 //____________________________________________________________________________
131 AliPHOSDigitizer::~AliPHOSDigitizer()
138 //____________________________________________________________________________
139 void AliPHOSDigitizer::Digitize(const Int_t event)
142 // Makes the digitization of the collected summable digits.
143 // It first creates the array of all PHOS modules
144 // filled with noise (different for EMC, CPV and PPSD) and
145 // then adds contributions from SDigits.
146 // This design avoids scanning over the list of digits to add
147 // contribution to new SDigits only.
149 if( strcmp(GetName(), "") == 0 )
152 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
153 TClonesArray * digits = gime->Digits(GetName()) ;
154 AliPHOSSDigitizer * sdiz = gime->SDigitizer(GetName()) ;
158 const AliPHOSGeometry *geom = gime->PHOSGeometry() ;
160 //Making digits with noise, first EMC
161 Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
165 TString name = geom->GetName() ;
167 nCPV = nEMC + geom->GetNumberOfCPVPadsZ()*geom->GetNumberOfCPVPadsPhi()*
168 geom->GetNModules() ;
170 digits->Expand(nCPV) ;
173 // sdigitize random gaussian noise and add it to all cells (EMCA+CPV+PPSD)
174 // get first the sdigitizer from the tasks list (must have same name as the digitizer)
175 const AliPHOSSDigitizer * sDigitizer = gime->SDigitizer(GetName());
177 cerr << "ERROR: AliPHOSDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
181 // loop through the sdigits posted to the White Board and add them to the noise
182 TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ;
183 TIter next(folderslist) ;
184 TFolder * folder = 0 ;
185 TClonesArray * sdigits = 0 ;
187 TObjArray * sdigArray = new TObjArray(2) ;
188 while ( (folder = (TFolder*)next()) )
189 if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
190 cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
191 << GetName() << " from " << folder->GetName() << endl ;
192 sdigArray->AddAt(sdigits, input) ;
196 //Find the first crystall with signal
197 Int_t nextSig = 200000 ;
199 for(i=0; i<input; i++){
200 sdigits = (TClonesArray *)sdigArray->At(i) ;
201 if ( !sdigits->GetEntriesFast() )
203 Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ;
204 if(curNext < nextSig)
208 TArrayI index(input) ;
209 index.Reset() ; //Set all indexes to zero
211 AliPHOSDigit * digit ;
212 AliPHOSDigit * curSDigit ;
214 TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ;
216 //Put Noise contribution
217 for(absID = 1; absID <= nEMC; absID++){
218 Float_t noise = gRandom->Gaus(0., fPinNoise) ;
219 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
220 //look if we have to add signal?
222 //Add SDigits from all inputs
223 digit = (AliPHOSDigit *) digits->At(absID-1) ;
227 Float_t a = digit->GetAmp() ;
228 Float_t b = TMath::Abs( a /fTimeSignalLength) ;
229 //Mark the beginnign of the signal
230 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
231 //Mark the end of the ignal
232 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
235 for(i=0; i<input; i++){
236 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
237 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
240 //May be several digits will contribute from the same input
241 while(curSDigit && curSDigit->GetId() == absID){
242 //Shift primary to separate primaries belonging different inputs
243 Int_t primaryoffset ;
245 primaryoffset = fARD->GetMask(i) ;
247 primaryoffset = 10000000*i ;
248 curSDigit->ShiftPrimary(primaryoffset) ;
250 a = curSDigit->GetAmp() ;
251 b = a /fTimeSignalLength ;
252 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
253 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
255 *digit = *digit + *curSDigit ; //add energies
258 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
259 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
265 //calculate and set time
266 Float_t time = FrontEdgeTime(ticks) ;
267 digit->SetTime(time) ;
269 //Find next signal module
271 for(i=0; i<input; i++){
272 sdigits = ((TClonesArray *)sdigArray->At(i)) ;
273 Int_t curNext = nextSig ;
274 if(sdigits->GetEntriesFast() > index[i] ){
275 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
278 if(curNext < nextSig) nextSig = curNext ;
287 //Now CPV digits (different noise and no timing)
288 for(absID = nEMC+1; absID <= nCPV; absID++){
289 Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
290 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
291 //look if we have to add signal?
293 digit = (AliPHOSDigit *) digits->At(absID-1) ;
294 //Add SDigits from all inputs
295 for(i=0; i<input; i++){
296 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
297 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
301 //May be several digits will contribute from the same input
302 while(curSDigit && curSDigit->GetId() == absID){
303 //Shift primary to separate primaries belonging different inputs
304 Int_t primaryoffset ;
306 primaryoffset = fARD->GetMask(i) ;
308 primaryoffset = 10000000*i ;
309 curSDigit->ShiftPrimary(primaryoffset) ;
312 *digit = *digit + *curSDigit ;
314 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
315 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
321 //Find next signal module
323 for(i=0; i<input; i++){
324 sdigits = (TClonesArray *)sdigArray->At(i) ;
325 Int_t curNext = nextSig ;
326 if(sdigits->GetEntriesFast() > index[i] )
327 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
328 if(curNext < nextSig) nextSig = curNext ;
333 delete sdigArray ; //We should not delete its contents
337 //remove digits below thresholds
338 for(i = 0; i < nEMC ; i++){
339 digit = (AliPHOSDigit*) digits->At(i) ;
340 if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold)
341 digits->RemoveAt(i) ;
343 digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
347 for(i = nEMC; i < nCPV ; i++)
348 if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(i))->GetAmp()) < fCPVDigitThreshold)
349 digits->RemoveAt(i) ;
353 Int_t ndigits = digits->GetEntriesFast() ;
354 digits->Expand(ndigits) ;
356 //Set indexes in list of digits and make true digitization of the energy
357 for (i = 0 ; i < ndigits ; i++) {
358 AliPHOSDigit * digit = (AliPHOSDigit *) digits->At(i) ;
359 digit->SetIndexInList(i) ;
360 Float_t energy = sdiz->Calibrate(digit->GetAmp()) ;
361 digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ;
365 //____________________________________________________________________________
366 Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId)
369 if(absId <= fEmcCrystals){ //digitize as EMC
370 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalEmc)/fADCchanelEmc) ;
371 if(chanel > fNADCemc ) chanel = fNADCemc ;
373 else{ //Digitize as CPV
374 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalCpv)/fADCchanelCpv) ;
375 if(chanel > fNADCcpv ) chanel = fNADCcpv ;
379 //____________________________________________________________________________
380 void AliPHOSDigitizer::Exec(Option_t *option)
384 if( strcmp(GetName(), "") == 0 )
387 if (strstr(option,"print")) {
392 if(strstr(option,"tim"))
393 gBenchmark->Start("PHOSDigitizer");
395 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
402 treeD = fARD->GetTreeD() ;
403 nevents = 1 ; // Will process only one event
406 gAlice->GetEvent(0) ;
407 nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
408 treeD=gAlice->TreeD() ;
411 cerr << " AliPHOSDigitizer :: Can not find TreeD " << endl ;
415 //Check, if this branch already exits
416 TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
418 TBranch * branch = 0 ;
419 Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
421 while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
422 if ( (strcmp(branch->GetName(), "PHOS")==0) &&
423 (strcmp(branch->GetTitle(), GetName())==0) )
426 else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) &&
427 (strcmp(branch->GetTitle(), GetName())==0) )
428 digitizerfound = kTRUE ;
432 cerr << "WARNING: AliPHOSDigitizer -> Digits branch with name " << GetName()
433 << " already exits" << endl ;
436 if ( digitizerfound ) {
437 cerr << "WARNING: AliPHOSDigitizer -> Digitizer branch with name " << GetName()
438 << " already exits" << endl ;
444 for(ievent = 0; ievent < nevents; ievent++){
448 for(input = 0 ; input < fARD->GetNinputs(); input ++){
449 TTree * treeS = fARD->GetInputTreeS(input) ;
451 cerr << "AliPHOSDigitizer -> No Input " << endl ;
454 gime->ReadTreeS(treeS,input) ;
458 gime->Event(ievent,"S") ;
460 Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
462 WriteDigits(ievent) ;
464 if(strstr(option,"deb"))
467 //increment the total number of Digits per run
468 fDigitsInRun += gime->Digits()->GetEntriesFast() ;
471 if(strstr(option,"tim")){
472 gBenchmark->Stop("PHOSDigitizer");
473 cout << "AliPHOSDigitizer:" << endl ;
474 cout << " took " << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds for Digitizing "
475 << gBenchmark->GetCpuTime("PHOSDigitizer")/nevents << " seconds per event " << endl ;
481 //____________________________________________________________________________
482 Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks)
484 ticks->Sort() ; //Sort in accordance with times of ticks
486 AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ;
487 Float_t time = ctick->CrossingTime(fTimeThreshold) ;
490 while((t=(AliPHOSTick*) it.Next())){
491 if(t->GetTime() < time) //This tick starts before crossing
496 time = ctick->CrossingTime(fTimeThreshold) ;
500 //____________________________________________________________________________
501 Bool_t AliPHOSDigitizer::Init()
504 fEMCDigitThreshold = 0.01 ;
506 fCPVDigitThreshold = 0.09 ;
507 fTimeResolution = 0.5e-9 ;
508 fTimeSignalLength = 1.0e-9 ;
510 fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
511 fADCpedestalEmc = 0.005 ; //
512 fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
514 fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
515 fADCpedestalCpv = 0.012 ; //
516 fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
518 fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
520 // Makes all memory allocations
521 // Adds Digitizer task to the folder of PHOS tasks
523 //============================================================= YS
524 // The initialisation is now done by AliPHOSGetter
526 if( strcmp(GetTitle(), "") == 0 )
527 SetTitle("galice.root") ;
529 // the SDigits name is stored by AliPHOSGetter as the name of the TClones Array
530 // //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/branchname and has branchTitle as title.
532 AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
534 cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
538 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
539 fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
541 // create a folder on the white board //YSAlice/WhiteBoard/Digits/PHOS/headerFile/digitsTitle
542 gime->PostDigits(GetName() ) ;
544 //add Task to //YSAlice/tasks/Digitizer/PHOS
545 gime->PostDigitizer(this) ;
547 //Mark that we will use current header file
549 gime->PostSDigits(GetName(),GetTitle()) ;
550 gime->PostSDigitizer(GetName(),GetTitle()) ;
555 //__________________________________________________________________
556 void AliPHOSDigitizer::MixWith(const char* headerFile)
558 // Allows to produce digits by superimposing background and signal event.
559 // It is assumed, that headers file with SIGNAL events is opened in
561 // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
562 // Thus we avoid writing (changing) huge and expensive
563 // backgound files: all output will be writen into SIGNAL, i.e.
564 // opened in constructor file.
566 // One can open as many files to mix with as one needs.
567 // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
570 if( strcmp(GetName(), "") == 0 )
574 cout << "Can not use this method under AliRunDigitizer " << endl ;
578 // check if the specified SDigits do not already exist on the White Board:
579 // //YSAlice/WhiteBoard/SDigits/PHOS/headerFile/sDigitsTitle
581 TString path = "YSAlice/WhiteBoard/SDigits/PHOS/" ;
585 if ( gROOT->FindObjectAny(path.Data()) ) {
586 cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
590 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
591 gime->PostSDigits(GetName(),headerFile) ;
593 // check if the requested file is already open or exist and if SDigits Branch exist
594 TFile * file = (TFile*)gROOT->FindObject(headerFile);
596 file = new TFile(headerFile, "READ") ;
598 cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
605 //__________________________________________________________________
606 void AliPHOSDigitizer::Print(Option_t* option)const {
607 // Print Digitizer's parameters
608 if( strcmp(GetName(), "") != 0 ){
610 cout << "------------------- "<< GetName() << " -------------" << endl ;
611 cout << "Digitizing sDigits from file(s): " <<endl ;
613 TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/SDigits/PHOS"))->GetListOfFolders() ;
614 TIter next(folderslist) ;
615 TFolder * folder = 0 ;
617 while ( (folder = (TFolder*)next()) ) {
618 if ( folder->FindObject(GetName()) )
619 cout << "Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
622 cout << "Writing digits to " << GetTitle() << endl ;
625 cout << "With following parameters: " << endl ;
626 cout << " Electronics noise in EMC (fPinNoise) = " << fPinNoise << endl ;
627 cout << " Threshold in EMC (fEMCDigitThreshold) = " << fEMCDigitThreshold << endl ; ;
628 cout << " Noise in CPV (fCPVNoise) = " << fCPVNoise << endl ;
629 cout << " Threshold in CPV (fCPVDigitThreshold) = " << fCPVDigitThreshold << endl ;
630 cout << "---------------------------------------------------" << endl ;
633 cout << "AliPHOSDigitizer not initialized " << endl ;
637 //__________________________________________________________________
638 void AliPHOSDigitizer::PrintDigits(Option_t * option){
639 // Print a table of digits
641 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
642 TClonesArray * digits = gime->Digits() ;
644 cout << "AliPHOSDigitiser: event " << gAlice->GetEvNumber() << endl ;
645 cout << " Number of entries in Digits list " << digits->GetEntriesFast() << endl ;
647 if(strstr(option,"all")||strstr(option,"EMC")){
650 AliPHOSDigit * digit;
651 cout << "EMC digits (with primaries): " << endl ;
652 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
653 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
655 for (index = 0 ; (index < digits->GetEntriesFast()) &&
656 (((AliPHOSDigit * ) digits->At(index))->GetId() <= maxEmc) ; index++) {
657 digit = (AliPHOSDigit * ) digits->At(index) ;
658 if(digit->GetNprimary() == 0) continue;
659 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
660 << setw(6) << digit->GetIndexInList() << " "
661 << setw(5) << digit->GetNprimary() <<" ";
664 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
665 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
671 if(strstr(option,"all")||strstr(option,"CPV")){
673 //loop over CPV digits
674 AliPHOSDigit * digit;
675 cout << "CPV digits: " << endl ;
676 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
677 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
679 for (index = 0 ; index < digits->GetEntriesFast(); index++) {
680 digit = (AliPHOSDigit * ) digits->At(index) ;
681 if(digit->GetId() > maxEmc){
682 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
683 << setw(6) << digit->GetIndexInList() << " "
684 << setw(5) << digit->GetNprimary() <<" ";
687 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
688 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
696 //__________________________________________________________________
697 void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
699 // we set title (comment) of the SDigits branch in the first! header file
700 if( strcmp(GetName(), "") == 0 )
703 AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
706 //__________________________________________________________________
707 Float_t AliPHOSDigitizer::TimeOfNoise(void)
708 { // Calculates the time signal generated by noise
709 //to be rewritten, now returns just big number
713 //____________________________________________________________________________
714 void AliPHOSDigitizer::Reset()
716 // sets current event number to the first simulated event
718 if( strcmp(GetName(), "") == 0 )
722 // for(inputs = 0; inputs < fNinputs ;inputs++)
723 // fIevent->AddAt(-1, inputs ) ;
727 //____________________________________________________________________________
728 void AliPHOSDigitizer::WriteDigits(Int_t event)
731 // Makes TreeD in the output file.
732 // Check if branch already exists:
733 // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
734 // already existing branches.
735 // else creates branch with Digits, named "PHOS", title "...",
736 // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
737 // and names of files, from which digits are made.
739 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
740 TClonesArray * digits = gime->Digits(GetName()) ;
745 treeD = fARD->GetTreeD() ;
747 treeD = gAlice->TreeD();
749 // create new branches
750 // -- generate file name if necessary
752 if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
753 file = new char[strlen(gAlice->GetBaseFile())+20] ;
754 sprintf(file,"%s/PHOS.Digits.root",gAlice->GetBaseFile()) ;
757 TDirectory *cwd = gDirectory;
758 // -- create Digits branch
759 Int_t bufferSize = 32000 ;
760 TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
761 digitsBranch->SetTitle(GetName());
763 digitsBranch->SetFile(file);
764 TIter next( digitsBranch->GetListOfBranches());
766 while ((sbr=(TBranch*)next())) {
772 // -- Create Digitizer branch
773 Int_t splitlevel = 0 ;
774 AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
775 TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
776 digitizerBranch->SetTitle(GetName());
778 digitizerBranch->SetFile(file);
779 TIter next( digitizerBranch->GetListOfBranches());
781 while ((sbr=(TBranch*)next())) {
787 digitsBranch->Fill() ;
788 digitizerBranch->Fill() ;
790 treeD->Write(0,kOverwrite) ;