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)
99 SetTitle(headerFile) ;
100 fManager = 0 ; // We work in the standalong mode
107 //____________________________________________________________________________
108 AliPHOSDigitizer::AliPHOSDigitizer(AliRunDigitizer * ard):AliDigitizer(ard)
115 //____________________________________________________________________________
116 AliPHOSDigitizer::~AliPHOSDigitizer()
121 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
123 // remove the task from the folder list
124 gime->RemoveTask("S",GetName()) ;
125 gime->RemoveTask("D",GetName()) ;
127 // remove the Digits from the folder list
128 gime->RemoveObjects("D", GetName()) ;
130 // remove the SDigits from the folder list
131 gime->RemoveSDigits() ;
139 //____________________________________________________________________________
140 void AliPHOSDigitizer::Digitize(const Int_t event)
143 // Makes the digitization of the collected summable digits.
144 // It first creates the array of all PHOS modules
145 // filled with noise (different for EMC, CPV and PPSD) and
146 // then adds contributions from SDigits.
147 // This design avoids scanning over the list of digits to add
148 // contribution to new SDigits only.
150 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
151 TClonesArray * digits = gime->Digits(GetName()) ;
155 const AliPHOSGeometry *geom = gime->PHOSGeometry() ;
156 //Making digits with noise, first EMC
157 Int_t nEMC = geom->GetNModules()*geom->GetNPhi()*geom->GetNZ();
161 TString name = geom->GetName() ;
163 nCPV = nEMC + geom->GetNumberOfCPVPadsZ()*geom->GetNumberOfCPVPadsPhi()*
164 geom->GetNModules() ;
166 digits->Expand(nCPV) ;
168 // get first the sdigitizer from the tasks list (must have same name as the digitizer)
169 const AliPHOSSDigitizer * sDigitizer = new AliPHOSSDigitizer() ; //gime->SDigitizer(GetName());
171 cerr << "ERROR: AliPHOSDigitizer::Digitize -> SDigitizer with name " << GetName() << " not found " << endl ;
175 // loop through the sdigits posted to the White Board and add them to the noise
176 TCollection * folderslist = gime->SDigitsFolder()->GetListOfFolders() ;
177 TIter next(folderslist) ;
178 TFolder * folder = 0 ;
179 TClonesArray * sdigits = 0 ;
181 TObjArray * sdigArray = new TObjArray(2) ;
182 while ( (folder = (TFolder*)next()) )
183 if ( (sdigits = (TClonesArray*)folder->FindObject(GetName()) ) ) {
184 TString fileName(folder->GetName()) ;
185 fileName.ReplaceAll("_","/") ;
186 cout << "INFO: AliPHOSDigitizer::Digitize -> Adding SDigits "
187 << GetName() << " from " << fileName << endl ;
188 sdigArray->AddAt(sdigits, input) ;
192 //Find the first crystall with signal
193 Int_t nextSig = 200000 ;
195 for(i=0; i<input; i++){
196 sdigits = (TClonesArray *)sdigArray->At(i) ;
197 if ( !sdigits->GetEntriesFast() )
199 Int_t curNext = ((AliPHOSDigit *)sdigits->At(0))->GetId() ;
200 if(curNext < nextSig)
204 TArrayI index(input) ;
205 index.Reset() ; //Set all indexes to zero
207 AliPHOSDigit * digit ;
208 AliPHOSDigit * curSDigit ;
210 TClonesArray * ticks = new TClonesArray("AliPHOSTick",1000) ;
212 //Put Noise contribution
213 for(absID = 1; absID <= nEMC; absID++){
214 Float_t noise = gRandom->Gaus(0., fPinNoise) ;
215 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
216 //look if we have to add signal?
217 digit = (AliPHOSDigit *) digits->At(absID-1) ;
220 //Add SDigits from all inputs
223 Float_t a = digit->GetAmp() ;
224 Float_t b = TMath::Abs( a /fTimeSignalLength) ;
225 //Mark the beginnign of the signal
226 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime(),0, b);
227 //Mark the end of the ignal
228 new((*ticks)[contrib++]) AliPHOSTick(digit->GetTime()+fTimeSignalLength, -a, -b);
231 for(i=0; i<input; i++){
232 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
233 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
236 //May be several digits will contribute from the same input
237 while(curSDigit && curSDigit->GetId() == absID){
238 //Shift primary to separate primaries belonging different inputs
239 Int_t primaryoffset ;
241 primaryoffset = fManager->GetMask(i) ;
243 primaryoffset = 10000000*i ;
244 curSDigit->ShiftPrimary(primaryoffset) ;
246 a = curSDigit->GetAmp() ;
247 b = a /fTimeSignalLength ;
248 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime(),0, b);
249 new((*ticks)[contrib++]) AliPHOSTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b);
251 *digit = *digit + *curSDigit ; //add energies
254 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
255 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
261 //calculate and set time
262 Float_t time = FrontEdgeTime(ticks) ;
263 digit->SetTime(time) ;
265 //Find next signal module
267 for(i=0; i<input; i++){
268 sdigits = ((TClonesArray *)sdigArray->At(i)) ;
269 Int_t curNext = nextSig ;
270 if(sdigits->GetEntriesFast() > index[i] ){
271 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
274 if(curNext < nextSig) nextSig = curNext ;
283 //Now CPV digits (different noise and no timing)
284 for(absID = nEMC+1; absID <= nCPV; absID++){
285 Float_t noise = gRandom->Gaus(0., fCPVNoise) ;
286 new((*digits)[absID-1]) AliPHOSDigit( -1,absID,sDigitizer->Digitize(noise), TimeOfNoise() ) ;
287 //look if we have to add signal?
289 digit = (AliPHOSDigit *) digits->At(absID-1) ;
290 //Add SDigits from all inputs
291 for(i=0; i<input; i++){
292 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
293 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
297 //May be several digits will contribute from the same input
298 while(curSDigit && curSDigit->GetId() == absID){
299 //Shift primary to separate primaries belonging different inputs
300 Int_t primaryoffset ;
302 primaryoffset = fManager->GetMask(i) ;
304 primaryoffset = 10000000*i ;
305 curSDigit->ShiftPrimary(primaryoffset) ;
308 *digit = *digit + *curSDigit ;
310 if(((TClonesArray *)sdigArray->At(i))->GetEntriesFast() > index[i] )
311 curSDigit = (AliPHOSDigit*)((TClonesArray *)sdigArray->At(i))->At(index[i]) ;
317 //Find next signal module
319 for(i=0; i<input; i++){
320 sdigits = (TClonesArray *)sdigArray->At(i) ;
321 Int_t curNext = nextSig ;
322 if(sdigits->GetEntriesFast() > index[i] )
323 curNext = ((AliPHOSDigit *) sdigits->At(index[i]))->GetId() ;
324 if(curNext < nextSig) nextSig = curNext ;
329 delete sdigArray ; //We should not delete its contents
333 //remove digits below thresholds
334 for(i = 0; i < nEMC ; i++){
335 digit = (AliPHOSDigit*) digits->At(i) ;
336 if(sDigitizer->Calibrate( digit->GetAmp() ) < fEMCDigitThreshold)
337 digits->RemoveAt(i) ;
339 digit->SetTime(gRandom->Gaus(digit->GetTime(),fTimeResolution) ) ;
343 for(i = nEMC; i < nCPV ; i++)
344 if(sDigitizer->Calibrate(((AliPHOSDigit*)digits->At(i))->GetAmp()) < fCPVDigitThreshold)
345 digits->RemoveAt(i) ;
349 Int_t ndigits = digits->GetEntriesFast() ;
350 digits->Expand(ndigits) ;
352 //Set indexes in list of digits and make true digitization of the energy
353 for (i = 0 ; i < ndigits ; i++) {
354 AliPHOSDigit * digit = (AliPHOSDigit *) digits->At(i) ;
355 digit->SetIndexInList(i) ;
356 Float_t energy = sDigitizer->Calibrate(digit->GetAmp()) ;
357 digit->SetAmp(DigitizeEnergy(energy,digit->GetId()) ) ;
361 //____________________________________________________________________________
362 Int_t AliPHOSDigitizer::DigitizeEnergy(Float_t energy, Int_t absId)
365 if(absId <= fEmcCrystals){ //digitize as EMC
366 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalEmc)/fADCchanelEmc) ;
367 if(chanel > fNADCemc ) chanel = fNADCemc ;
369 else{ //Digitize as CPV
370 chanel = (Int_t) TMath::Ceil((energy - fADCpedestalCpv)/fADCchanelCpv) ;
371 if(chanel > fNADCcpv ) chanel = fNADCcpv ;
375 //____________________________________________________________________________
376 void AliPHOSDigitizer::Exec(Option_t *option)
380 if(strcmp(GetName(), "") == 0 )
382 if (strstr(option,"print")) {
387 if(strstr(option,"tim"))
388 gBenchmark->Start("PHOSDigitizer");
390 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
397 treeD = fManager->GetTreeD() ;
398 nevents = 1 ; // Will process only one event
401 gAlice->GetEvent(0) ;
402 nevents = (Int_t) gAlice->TreeE()->GetEntries() ;
403 treeD=gAlice->TreeD() ;
407 //Check, if this branch already exits
409 TObjArray * lob = (TObjArray*)treeD->GetListOfBranches() ;
411 TBranch * branch = 0 ;
412 Bool_t phosfound = kFALSE, digitizerfound = kFALSE ;
414 while ( (branch = (TBranch*)next()) && (!phosfound || !digitizerfound) ) {
415 if ( (strcmp(branch->GetName(), "PHOS")==0) &&
416 (strcmp(branch->GetTitle(), GetName())==0) )
419 else if ( (strcmp(branch->GetName(), "AliPHOSDigitizer")==0) &&
420 (strcmp(branch->GetTitle(), GetName())==0) )
421 digitizerfound = kTRUE ;
425 cerr << "WARNING: AliPHOSDigitizer -> Digits branch with name " << GetName()
426 << " already exits" << endl ;
429 if ( digitizerfound ) {
430 cerr << "WARNING: AliPHOSDigitizer -> Digitizer branch with name " << GetName()
431 << " already exits" << endl ;
438 for(ievent = 0; ievent < nevents; ievent++){
443 for(input = 0 ; input < fManager->GetNinputs(); input ++){
444 TTree * treeS = fManager->GetInputTreeS(input) ;
446 cerr << "AliPHOSDigitizer::Exec -> No Input " << endl ;
449 gime->ReadTreeS(treeS,input) ;
454 gime->Event(ievent,"S") ;
456 Digitize(ievent) ; //Add prepared SDigits to digits and add the noise
458 WriteDigits(ievent) ;
460 if(strstr(option,"deb"))
463 //increment the total number of Digits per run
464 fDigitsInRun += gime->Digits()->GetEntriesFast() ;
467 if(strstr(option,"tim")){
468 gBenchmark->Stop("PHOSDigitizer");
469 cout << "AliPHOSDigitizer:" << endl ;
470 cout << " took " << gBenchmark->GetCpuTime("PHOSDigitizer") << " seconds for Digitizing "
471 << gBenchmark->GetCpuTime("PHOSDigitizer")/nevents << " seconds per event " << endl ;
477 //____________________________________________________________________________
478 Float_t AliPHOSDigitizer::FrontEdgeTime(TClonesArray * ticks)
480 ticks->Sort() ; //Sort in accordance with times of ticks
482 AliPHOSTick * ctick = (AliPHOSTick *) it.Next() ;
483 Float_t time = ctick->CrossingTime(fTimeThreshold) ;
486 while((t=(AliPHOSTick*) it.Next())){
487 if(t->GetTime() < time) //This tick starts before crossing
492 time = ctick->CrossingTime(fTimeThreshold) ;
497 //____________________________________________________________________________
498 Bool_t AliPHOSDigitizer::Init()
501 AliPHOSGetter * gime = AliPHOSGetter::GetInstance(GetTitle(), GetName()) ;
503 cerr << "ERROR: AliPHOSDigitizer::Init -> Could not obtain the Getter object !" << endl ;
507 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
509 fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
511 // Post Digits to the white board
512 gime->PostDigits(GetName() ) ;
514 // Post Digitizer to the white board
515 gime->PostDigitizer(this) ;
517 //Mark that we will use current header file
519 gime->PostSDigits(GetName(),GetTitle()) ;
520 gime->PostSDigitizer(GetName(),GetTitle()) ;
525 //____________________________________________________________________________
526 void AliPHOSDigitizer::InitParameters()
529 fEMCDigitThreshold = 0.012 ;
531 fCPVDigitThreshold = 0.09 ;
532 fTimeResolution = 0.5e-9 ;
533 fTimeSignalLength = 1.0e-9 ;
535 fADCchanelEmc = 0.0015; // width of one ADC channel in GeV
536 fADCpedestalEmc = 0.005 ; //
537 fNADCemc = (Int_t) TMath::Power(2,16) ; // number of channels in EMC ADC
539 fADCchanelCpv = 0.0012 ; // width of one ADC channel in CPV 'popugais'
540 fADCpedestalCpv = 0.012 ; //
541 fNADCcpv = (Int_t) TMath::Power(2,12); // number of channels in CPV ADC
543 fTimeThreshold = 0.001*10000000 ; //Means 1 MeV in terms of SDigits amplitude
546 SetTitle("aliroot") ;
547 else if (strcmp(GetTitle(),"")==0)
548 SetTitle("galice.root") ;
550 if( strcmp(GetName(), "") == 0 )
554 //__________________________________________________________________
555 void AliPHOSDigitizer::MixWith(const char* headerFile)
557 // Allows to produce digits by superimposing background and signal event.
558 // It is assumed, that headers file with SIGNAL events is opened in
560 // Sets the BACKGROUND event, with which the SIGNAL event is to be mixed
561 // Thus we avoid writing (changing) huge and expensive
562 // backgound files: all output will be writen into SIGNAL, i.e.
563 // opened in constructor file.
565 // One can open as many files to mix with as one needs.
566 // However only Sdigits with the same name (i.e. constructed with the same SDigitizer)
569 if( strcmp(GetName(), "") == 0 )
573 cout << "Can not use this method under AliRunDigitizer " << endl ;
577 // check if the specified SDigits do not already exist on the White Board:
578 // //Folders/RunMC/Event/Data/PHOS/SDigits/headerFile/sdigitsname
580 TString path = "Folders/RunMC/Event/Data/PHOS/SDigits" ;
584 if ( gROOT->FindObjectAny(path.Data()) ) {
585 cerr << "WARNING: AliPHOSDigitizer::MixWith -> Entry already exists, do not add" << endl ;
589 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
590 gime->PostSDigits(GetName(),headerFile) ;
592 // check if the requested file is already open or exist and if SDigits Branch exist
593 TFile * file = (TFile*)gROOT->FindObject(headerFile);
595 file = new TFile(headerFile, "READ") ;
597 cerr << "ERROR: AliPHOSDigitizer::MixWith -> File " << headerFile << " does not exist!" << endl ;
604 //__________________________________________________________________
605 void AliPHOSDigitizer::SetSplitFile(const TString splitFileName)
607 // Diverts the Digits in a file separate from the hits file
609 // I guess it is not going to work if we do merging
611 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> Not yet available in case of merging activated " << endl ;
615 TDirectory * cwd = gDirectory ;
616 if ( !(gAlice->GetTreeDFileName() == splitFileName) ) {
617 if (gAlice->GetTreeDFile() )
618 gAlice->GetTreeDFile()->Close() ;
621 fSplitFile = gAlice->InitTreeFile("D",splitFileName.Data());
623 gAlice->Write(0, TObject::kOverwrite);
625 TTree *treeE = gAlice->TreeE();
627 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> No TreeE found "<<endl;
632 AliHeader *header = new AliHeader();
633 treeE->SetBranchAddress("Header", &header);
634 treeE->SetBranchStatus("*",1);
635 TTree *treeENew = treeE->CloneTree();
636 treeENew->Write(0, TObject::kOverwrite);
639 TGeometry *AliceGeom = static_cast<TGeometry*>(cwd->Get("AliceGeom"));
641 cerr << "ERROR: AliPHOSDigitizer::SetSplitFile -> AliceGeom was not found in the input file "<<endl;
644 AliceGeom->Write(0, TObject::kOverwrite);
646 gAlice->MakeTree("D",fSplitFile);
648 cout << "INFO: AliPHOSDigitizer::SetSPlitMode -> Digits will be stored in " << splitFileName.Data() << endl ;
651 //__________________________________________________________________
652 void AliPHOSDigitizer::Print(Option_t* option)const {
653 // Print Digitizer's parameters
654 if( strcmp(GetName(), "") != 0 ){
656 cout << "------------------- "<< GetName() << " -------------" << endl ;
657 cout << "Digitizing sDigits from file(s): " <<endl ;
659 TCollection * folderslist = ((TFolder*)gROOT->FindObjectAny("Folders/RunMC/Event/Data/PHOS/SDigits"))->GetListOfFolders() ;
660 TIter next(folderslist) ;
661 TFolder * folder = 0 ;
663 while ( (folder = (TFolder*)next()) ) {
664 if ( folder->FindObject(GetName()) )
665 cout << "Adding SDigits " << GetName() << " from " << folder->GetName() << endl ;
668 cout << "Writing digits to " << GetTitle() << endl ;
671 cout << "With following parameters: " << endl ;
672 cout << " Electronics noise in EMC (fPinNoise) = " << fPinNoise << endl ;
673 cout << " Threshold in EMC (fEMCDigitThreshold) = " << fEMCDigitThreshold << endl ; ;
674 cout << " Noise in CPV (fCPVNoise) = " << fCPVNoise << endl ;
675 cout << " Threshold in CPV (fCPVDigitThreshold) = " << fCPVDigitThreshold << endl ;
676 cout << "---------------------------------------------------" << endl ;
679 cout << "AliPHOSDigitizer not initialized " << endl ;
683 //__________________________________________________________________
684 void AliPHOSDigitizer::PrintDigits(Option_t * option){
685 // Print a table of digits
687 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
688 TClonesArray * digits = gime->Digits() ;
690 cout << "AliPHOSDigitiser: event " << gAlice->GetEvNumber() << endl ;
691 cout << " Number of entries in Digits list " << digits->GetEntriesFast() << endl ;
693 if(strstr(option,"all")||strstr(option,"EMC")){
696 AliPHOSDigit * digit;
697 cout << "EMC digits (with primaries): " << endl ;
698 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
699 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
701 for (index = 0 ; (index < digits->GetEntriesFast()) &&
702 (((AliPHOSDigit * ) digits->At(index))->GetId() <= maxEmc) ; index++) {
703 digit = (AliPHOSDigit * ) digits->At(index) ;
704 if(digit->GetNprimary() == 0) continue;
705 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
706 << setw(6) << digit->GetIndexInList() << " "
707 << setw(5) << digit->GetNprimary() <<" ";
710 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
711 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
717 if(strstr(option,"all")||strstr(option,"CPV")){
719 //loop over CPV digits
720 AliPHOSDigit * digit;
721 cout << "CPV digits: " << endl ;
722 cout << "Digit Id Amplitude Index Nprim Primaries list " << endl;
723 Int_t maxEmc = gime->PHOSGeometry()->GetNModules()*gime->PHOSGeometry()->GetNCristalsInModule() ;
725 for (index = 0 ; index < digits->GetEntriesFast(); index++) {
726 digit = (AliPHOSDigit * ) digits->At(index) ;
727 if(digit->GetId() > maxEmc){
728 cout << setw(6) << digit->GetId() << " " << setw(10) << digit->GetAmp() << " "
729 << setw(6) << digit->GetIndexInList() << " "
730 << setw(5) << digit->GetNprimary() <<" ";
733 for (iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
734 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
742 //__________________________________________________________________
743 void AliPHOSDigitizer::SetSDigitsBranch(const char* title)
745 // we set title (comment) of the SDigits branch in the first! header file
746 if( strcmp(GetName(), "") == 0 )
749 AliPHOSGetter::GetInstance()->SDigits()->SetName(title) ;
752 //__________________________________________________________________
753 Float_t AliPHOSDigitizer::TimeOfNoise(void)
754 { // Calculates the time signal generated by noise
755 //to be rewritten, now returns just big number
759 //____________________________________________________________________________
760 void AliPHOSDigitizer::Reset()
762 // sets current event number to the first simulated event
764 if( strcmp(GetName(), "") == 0 )
768 // for(inputs = 0; inputs < fNinputs ;inputs++)
769 // fIevent->AddAt(-1, inputs ) ;
773 //____________________________________________________________________________
774 void AliPHOSDigitizer::WriteDigits(Int_t event)
777 // Makes TreeD in the output file.
778 // Check if branch already exists:
779 // if yes, exit without writing: ROOT TTree does not support overwriting/updating of
780 // already existing branches.
781 // else creates branch with Digits, named "PHOS", title "...",
782 // and branch "AliPHOSDigitizer", with the same title to keep all the parameters
783 // and names of files, from which digits are made.
785 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
786 const TClonesArray * digits = gime->Digits(GetName()) ;
791 treeD = fManager->GetTreeD() ;
793 if (!gAlice->TreeD() )
794 gAlice->MakeTree("D", fSplitFile);
795 treeD = gAlice->TreeD();
799 // -- create Digits branch
800 Int_t bufferSize = 32000 ;
801 TBranch * digitsBranch = treeD->Branch("PHOS",&digits,bufferSize);
802 digitsBranch->SetTitle(GetName());
804 // -- Create Digitizer branch
805 Int_t splitlevel = 0 ;
806 AliPHOSDigitizer * d = gime->Digitizer(GetName()) ;
807 TBranch * digitizerBranch = treeD->Branch("AliPHOSDigitizer", "AliPHOSDigitizer", &d,bufferSize,splitlevel);
808 digitizerBranch->SetTitle(GetName());
810 digitsBranch->Fill() ;
811 digitizerBranch->Fill() ;