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 "TGeometry.h"
65 #include "TBenchmark.h"
67 // --- Standard library ---
70 // --- AliRoot header files ---
73 #include "AliHeader.h"
74 #include "AliRunDigitizer.h"
75 #include "AliPHOSDigit.h"
77 #include "AliPHOSGetter.h"
78 #include "AliPHOSDigitizer.h"
79 #include "AliPHOSSDigitizer.h"
80 #include "AliPHOSGeometry.h"
81 #include "AliPHOSTick.h"
83 ClassImp(AliPHOSDigitizer)
86 //____________________________________________________________________________
87 AliPHOSDigitizer::AliPHOSDigitizer()
94 //____________________________________________________________________________
95 AliPHOSDigitizer::AliPHOSDigitizer(const char *headerFile,const char * name)
98 SetTitle(headerFile) ;
100 fManager = 0 ; // We work in the standalong mode
107 //____________________________________________________________________________
108 AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard):AliDigitizer(ard)
111 SetTitle("aliroot") ;
117 //____________________________________________________________________________
118 AliPHOSDigitizer::~AliPHOSDigitizer()
123 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
125 // remove the task from the folder list
126 gime->RemoveTask("S",GetName()) ;
127 gime->RemoveTask("D",GetName()) ;
129 // remove the Digits from the folder list
130 gime->RemoveObjects("D", GetName()) ;
132 // remove the SDigits from the folder list
133 gime->RemoveSDigits() ;
141 //____________________________________________________________________________
142 void AliPHOSDigitizer::Digitize(const Int_t event)
145 // Makes the digitization of the collected summable digits.
146 // It first creates the array of all PHOS modules
147 // filled with noise (different for EMC, CPV and PPSD) and
148 // then adds contributions from SDigits.
149 // This design avoids scanning over the list of digits to add
150 // contribution to new SDigits only.
152 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
153 TClonesArray * digits = gime->Digits(GetName()) ;
157 const AliPHOSGeometry *geom = gime->PHOSGeometry() ;
158 //Making digits with noise, first EMC
159 Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
163 TString name = geom->GetName() ;
165 nCPV = nEMC + geom->GetNumberOfCPVPadsZ()*geom->GetNumberOfCPVPadsPhi()*
166 geom->GetNModules() ;
168 digits->Expand(nCPV) ;
170 // get first the sdigitizer from the tasks list (must have same name as the digitizer)
171 const AliPHOSSDigitizer * sDigitizer = new AliPHOSSDigitizer() ; //gime->SDigitizer(GetName());
173 cerr << "ERROR: AliPHOSDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
177 // loop through the sdigits posted to the White Board and add them to the noise
178 TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ;
179 TIter next(folderslist) ;
180 TFolder * folder = 0 ;
181 TClonesArray * sdigits = 0 ;
183 TObjArray * sdigArray = new TObjArray(2) ;
184 while ( (folder = (TFolder*)next()) ) {
185 if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
186 TString fileName(folder->GetName()) ;
187 fileName.ReplaceAll("_","/") ;
188 cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
189 << GetName() << " from " << fileName << endl ;
190 sdigArray->AddAt(sdigits, input) ;
195 //Find the first crystall with signal
196 Int_t nextSig = 200000 ;
198 for(i=0; i<input; i++){
199 sdigits = (TClonesArray *)sdigArray->At(i) ;
200 if ( !sdigits->GetEntriesFast() )
202 Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ;
203 if(curNext < nextSig)
207 TArrayI index(input) ;
208 index.Reset() ; //Set all indexes to zero
210 AliPHOSDigit * digit ;
211 AliPHOSDigit * curSDigit ;
213 TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ;
215 //Put Noise contribution
216 for(absID = 1; absID <= nEMC; absID++){
217 Float_t noise = gRandom->Gaus(0., fPinNoise) ;
218 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
219 //look if we have to add signal?
220 digit = (AliPHOSDigit *) digits->At(absID-1) ;
223 //Add SDigits from all inputs
226 Float_t a = digit->GetAmp() ;
227 Float_t b = TMath::Abs( a /fTimeSignalLength) ;
228 //Mark the beginnign of the signal
229 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
230 //Mark the end of the ignal
231 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
234 for(i=0; i<input; i++){
235 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
236 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
239 //May be several digits will contribute from the same input
240 while(curSDigit && curSDigit->GetId() == absID){
241 //Shift primary to separate primaries belonging different inputs
242 Int_t primaryoffset ;
244 primaryoffset = fManager->GetMask(i) ;
246 primaryoffset = 10000000*i ;
247 curSDigit->ShiftPrimary(primaryoffset) ;
249 a = curSDigit->GetAmp() ;
250 b = a /fTimeSignalLength ;
251 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
252 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
254 *digit = *digit + *curSDigit ; //add energies
257 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
258 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
264 //calculate and set time
265 Float_t time = FrontEdgeTime(ticks) ;
266 digit->SetTime(time) ;
268 //Find next signal module
270 for(i=0; i<input; i++){
271 sdigits = ((TClonesArray *)sdigArray->At(i)) ;
272 Int_t curNext = nextSig ;
273 if(sdigits->GetEntriesFast() > index[i] ){
274 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
277 if(curNext < nextSig) nextSig = curNext ;
286 //Now CPV digits (different noise and no timing)
287 for(absID = nEMC+1; absID <= nCPV; absID++){
288 Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
289 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
290 //look if we have to add signal?
292 digit = (AliPHOSDigit *) digits->At(absID-1) ;
293 //Add SDigits from all inputs
294 for(i=0; i<input; i++){
295 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
296 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
300 //May be several digits will contribute from the same input
301 while(curSDigit && curSDigit->GetId() == absID){
302 //Shift primary to separate primaries belonging different inputs
303 Int_t primaryoffset ;
305 primaryoffset = fManager->GetMask(i) ;
307 primaryoffset = 10000000*i ;
308 curSDigit->ShiftPrimary(primaryoffset) ;
311 *digit = *digit + *curSDigit ;
313 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
314 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
320 //Find next signal module
322 for(i=0; i<input; i++){
323 sdigits = (TClonesArray *)sdigArray->At(i) ;
324 Int_t curNext = nextSig ;
325 if(sdigits->GetEntriesFast() > index[i] )
326 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
327 if(curNext < nextSig) nextSig = curNext ;
332 delete sdigArray ; //We should not delete its contents
336 //remove digits below thresholds
337 for(i = 0; i < nEMC ; i++){
338 digit = (AliPHOSDigit*) digits->At(i) ;
339 if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold)
340 digits->RemoveAt(i) ;
342 digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
346 for(i = nEMC; i < nCPV ; i++)
347 if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(i))->GetAmp()) < fCPVDigitThreshold)
348 digits->RemoveAt(i) ;
352 Int_t ndigits = digits->GetEntriesFast() ;
353 digits->Expand(ndigits) ;
355 //Set indexes in list of digits and make true digitization of the energy
356 for (i = 0 ; i < ndigits ; i++) {
357 AliPHOSDigit * digit = (AliPHOSDigit *) digits->At(i) ;
358 digit->SetIndexInList(i) ;
359 Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ;
360 digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ;
364 //____________________________________________________________________________
365 Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId)
368 if(absId <= fEmcCrystals){ //digitize as EMC
369 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalEmc)/fADCchanelEmc) ;
370 if(chanel > fNADCemc ) chanel = fNADCemc ;
372 else{ //Digitize as CPV
373 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalCpv)/fADCchanelCpv) ;
374 if(chanel > fNADCcpv ) chanel = fNADCcpv ;
378 //____________________________________________________________________________
379 void AliPHOSDigitizer::Exec(Option_t *option)
383 if(strcmp(GetName(), "") == 0 )
385 if (strstr(option,"print")) {
390 if(strstr(option,"tim"))
391 gBenchmark->Start("PHOSDigitizer");
393 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
400 treeD = fManager->GetTreeD() ;
401 nevents = 1 ; // Will process only one event
404 gAlice->GetEvent(0) ;
405 nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
406 treeD=gAlice->TreeD() ;
410 //Check, if this branch already exits
412 TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
414 TBranch * branch = 0 ;
415 Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
417 while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
418 if ( (strcmp(branch->GetName(), "PHOS")==0) &&
419 (strcmp(branch->GetTitle(), GetName())==0) )
422 else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) &&
423 (strcmp(branch->GetTitle(), GetName())==0) )
424 digitizerfound = kTRUE ;
428 cerr << "WARNING: AliPHOSDigitizer -> Digits branch with name " << GetName()
429 << " already exits" << endl ;
432 if ( digitizerfound ) {
433 cerr << "WARNING: AliPHOSDigitizer -> Digitizer branch with name " << GetName()
434 << " already exits" << endl ;
441 for(ievent = 0; ievent < nevents; ievent++){
446 for(input = 0 ; input < fManager->GetNinputs(); input ++){
447 TTree * treeS = fManager->GetInputTreeS(input) ;
449 cerr << "AliPHOSDigitizer::Exec -> No Input " << endl ;
452 gime->ReadTreeS(treeS,input) ;
457 gime->Event(ievent,"S") ;
459 Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
461 WriteDigits(ievent) ;
463 if(strstr(option,"deb"))
466 //increment the total number of Digits per run
467 fDigitsInRun += gime->Digits()->GetEntriesFast() ;
470 if(strstr(option,"tim")){
471 gBenchmark->Stop("PHOSDigitizer");
472 cout << "AliPHOSDigitizer:" << endl ;
473 cout << " took " << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds for Digitizing "
474 << gBenchmark->GetCpuTime("PHOSDigitizer")/nevents << " seconds per event " << endl ;
480 //____________________________________________________________________________
481 Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks)
483 ticks->Sort() ; //Sort in accordance with times of ticks
485 AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ;
486 Float_t time = ctick->CrossingTime(fTimeThreshold) ;
489 while((t=(AliPHOSTick*) it.Next())){
490 if(t->GetTime() < time) //This tick starts before crossing
495 time = ctick->CrossingTime(fTimeThreshold) ;
500 //____________________________________________________________________________
501 Bool_t AliPHOSDigitizer::Init()
504 AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
506 cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
510 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
512 fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
514 // Post Digits to the white board
515 gime->PostDigits(GetName() ) ;
517 // Post Digitizer to the white board
518 gime->PostDigitizer(this) ;
520 //Mark that we will use current header file
522 gime->PostSDigits(GetName(),GetTitle()) ;
523 gime->PostSDigitizer(GetName(),GetTitle()) ;
528 //____________________________________________________________________________
529 void AliPHOSDigitizer::InitParameters()
532 fEMCDigitThreshold = 0.012 ;
534 fCPVDigitThreshold = 0.09 ;
535 fTimeResolution = 0.5e-9 ;
536 fTimeSignalLength = 1.0e-9 ;
538 fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
539 fADCpedestalEmc = 0.005 ; //
540 fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
542 fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
543 fADCpedestalCpv = 0.012 ; //
544 fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
546 fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
550 //__________________________________________________________________
551 void AliPHOSDigitizer::MixWith(const char* headerFile)
553 // Allows to produce digits by superimposing background and signal event.
554 // It is assumed, that headers file with SIGNAL events is opened in
556 // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
557 // Thus we avoid writing (changing) huge and expensive
558 // backgound files: all output will be writen into SIGNAL, i.e.
559 // opened in constructor file.
561 // One can open as many files to mix with as one needs.
562 // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
565 if( strcmp(GetName(), "") == 0 )
569 cout << "Can not use this method under AliRunDigitizer " << endl ;
573 // check if the specified SDigits do not already exist on the White Board:
574 // //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname
576 TString path = "Folders/RunMC/Event/Data/PHOS/SDigits" ;
580 if ( gROOT->FindObjectAny(path.Data()) ) {
581 cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
585 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
586 gime->PostSDigits(GetName(),headerFile) ;
588 // check if the requested file is already open or exist and if SDigits Branch exist
589 TFile * file = (TFile*)gROOT->FindObject(headerFile);
591 file = new TFile(headerFile, "READ") ;
593 cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
600 //__________________________________________________________________
601 void AliPHOSDigitizer::SetSplitFile(const TString splitFileName)
603 // Diverts the Digits in a file separate from the hits file
605 // I guess it is not going to work if we do merging
607 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
611 TDirectory * cwd = gDirectory ;
612 if ( !(gAlice->GetTreeDFileName() == splitFileName) ) {
613 if (gAlice->GetTreeDFile() )
614 gAlice->GetTreeDFile()->Close() ;
617 fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data());
619 gAlice->Write(0, TObject::kOverwrite);
621 TTree *treeE = gAlice->TreeE();
623 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> No TreeE found "<<endl;
628 AliHeader *header = new AliHeader();
629 treeE->SetBranchAddress("Header", &header);
630 treeE->SetBranchStatus("*",1);
631 TTree *treeENew = treeE->CloneTree();
632 treeENew->Write(0, TObject::kOverwrite);
635 TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
637 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
640 AliceGeom->Write(0, TObject::kOverwrite);
642 gAlice->MakeTree("D",fSplitFile);
644 cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
647 //__________________________________________________________________
648 void AliPHOSDigitizer::Print(Option_t* option)const {
649 // Print Digitizer's parameters
650 if( strcmp(GetName(), "") != 0 ){
652 cout << "------------------- "<< GetName() << " -------------" << endl ;
653 cout << "Digitizing sDigits from file(s): " <<endl ;
655 TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("Folders/RunMC/Event/Data/PHOS/SDigits"))->GetListOfFolders() ;
656 TIter next(folderslist) ;
657 TFolder * folder = 0 ;
659 while ( (folder = (TFolder*)next()) ) {
660 if ( folder->FindObject(GetName()) )
661 cout << "Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
664 cout << "Writing digits to " << GetTitle() << endl ;
667 cout << "With following parameters: " << endl ;
668 cout << " Electronics noise in EMC (fPinNoise) = " << fPinNoise << endl ;
669 cout << " Threshold in EMC (fEMCDigitThreshold) = " << fEMCDigitThreshold << endl ; ;
670 cout << " Noise in CPV (fCPVNoise) = " << fCPVNoise << endl ;
671 cout << " Threshold in CPV (fCPVDigitThreshold) = " << fCPVDigitThreshold << endl ;
672 cout << "---------------------------------------------------" << endl ;
675 cout << "AliPHOSDigitizer not initialized " << endl ;
679 //__________________________________________________________________
680 void AliPHOSDigitizer::PrintDigits(Option_t * option){
681 // Print a table of digits
683 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
684 TClonesArray * digits = gime->Digits() ;
686 cout << "AliPHOSDigitiser: event " << gAlice->GetEvNumber() << endl ;
687 cout << " Number of entries in Digits list " << digits->GetEntriesFast() << endl ;
689 if(strstr(option,"all")||strstr(option,"EMC")){
692 AliPHOSDigit * digit;
693 cout << "EMC digits (with primaries): " << endl ;
694 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
695 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
697 for (index = 0 ; (index < digits->GetEntriesFast()) &&
698 (((AliPHOSDigit * ) digits->At(index))->GetId() <= maxEmc) ; index++) {
699 digit = (AliPHOSDigit * ) digits->At(index) ;
700 if(digit->GetNprimary() == 0) continue;
701 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
702 << setw(6) << digit->GetIndexInList() << " "
703 << setw(5) << digit->GetNprimary() <<" ";
706 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
707 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
713 if(strstr(option,"all")||strstr(option,"CPV")){
715 //loop over CPV digits
716 AliPHOSDigit * digit;
717 cout << "CPV digits: " << endl ;
718 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
719 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
721 for (index = 0 ; index < digits->GetEntriesFast(); index++) {
722 digit = (AliPHOSDigit * ) digits->At(index) ;
723 if(digit->GetId() > maxEmc){
724 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
725 << setw(6) << digit->GetIndexInList() << " "
726 << setw(5) << digit->GetNprimary() <<" ";
729 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
730 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
738 //__________________________________________________________________
739 void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
741 // we set title (comment) of the SDigits branch in the first! header file
742 if( strcmp(GetName(), "") == 0 )
745 AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
748 //__________________________________________________________________
749 Float_t AliPHOSDigitizer::TimeOfNoise(void)
750 { // Calculates the time signal generated by noise
751 //to be rewritten, now returns just big number
755 //____________________________________________________________________________
756 void AliPHOSDigitizer::Reset()
758 // sets current event number to the first simulated event
760 if( strcmp(GetName(), "") == 0 )
764 // for(inputs = 0; inputs < fNinputs ;inputs++)
765 // fIevent->AddAt(-1, inputs ) ;
769 //____________________________________________________________________________
770 void AliPHOSDigitizer::WriteDigits(Int_t event)
773 // Makes TreeD in the output file.
774 // Check if branch already exists:
775 // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
776 // already existing branches.
777 // else creates branch with Digits, named "PHOS", title "...",
778 // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
779 // and names of files, from which digits are made.
781 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
782 const TClonesArray * digits = gime->Digits(GetName()) ;
787 treeD = fManager->GetTreeD() ;
789 if (!gAlice->TreeD() )
790 gAlice->MakeTree("D", fSplitFile);
791 treeD = gAlice->TreeD();
795 // -- create Digits branch
796 Int_t bufferSize = 32000 ;
797 TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
798 digitsBranch->SetTitle(GetName());
800 // -- Create Digitizer branch
801 Int_t splitlevel = 0 ;
802 AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
803 TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
804 digitizerBranch->SetTitle(GetName());
806 digitsBranch->Fill() ;
807 digitizerBranch->Fill() ;