+//____________________________________________________________________________
+Float_t AliEMCALDigitizer::FrontEdgeTime(TClonesArray * ticks)
+{ //
+ ticks->Sort() ; //Sort in accordance with times of ticks
+ TIter it(ticks) ;
+ AliEMCALTick * ctick = (AliEMCALTick *) it.Next() ;
+ Float_t time = ctick->CrossingTime(fTimeThreshold) ;
+
+ AliEMCALTick * t ;
+ while((t=(AliEMCALTick*) it.Next())){
+ if(t->GetTime() < time) //This tick starts before crossing
+ *ctick+=*t ;
+ else
+ return time ;
+
+ time = ctick->CrossingTime(fTimeThreshold) ;
+ }
+ return time ;
+}
+
+//____________________________________________________________________________
+Bool_t AliEMCALDigitizer::Init()
+{
+ // Makes all memory allocations
+
+ if( strcmp(GetTitle(), "") == 0 )
+ SetTitle("galice.root") ;
+
+ AliEMCALGetter * gime = AliEMCALGetter::GetInstance(GetTitle(), GetName(), fToSplit) ;
+ if ( gime == 0 ) {
+ cerr << "ERROR: AliEMCALDigitizer::Init -> Could not obtain the Getter object !" << endl ;
+ return kFALSE;
+ }
+
+ //const AliEMCALGeometry * geom = gime->EMCALGeometry() ;
+
+ //fEmcCrystals = geom->GetNModules() * geom->GetNCristalsInModule() ;
+
+ // Post Digits to the white board
+ gime->PostDigits(GetName() ) ;
+
+ // Post Digitizer to the white board
+ gime->PostDigitizer(this) ;
+
+ fSplitFile = 0 ;
+ if(fToSplit){
+ // construct the name of the file as /path/EMCAL.SDigits.root
+ //First - extract full path if necessary
+ TString digitsFileName(GetTitle()) ;
+ Ssiz_t islash = digitsFileName.Last('/') ;
+ if(islash<digitsFileName.Length())
+ digitsFileName.Remove(islash+1,digitsFileName.Length()) ;
+ else
+ digitsFileName="" ;
+ // Next - append the file name
+ digitsFileName+="EMCAL.Digits." ;
+ if((strcmp(GetName(),"Default")!=0)&&(strcmp(GetName(),"")!=0)){
+ digitsFileName+=GetName() ;
+ digitsFileName+="." ;
+ }
+ digitsFileName+="root" ;
+ // Finally - check if the file already opened or open the file
+ fSplitFile = static_cast<TFile*>(gROOT->GetFile(digitsFileName.Data()));
+ if(!fSplitFile)
+ fSplitFile = TFile::Open(digitsFileName.Data(),"update") ;
+ }
+
+ //Mark that we will use current header file
+ if(!fManager){
+ gime->PostSDigits(GetName(),GetTitle()) ;
+ gime->PostSDigitizer(GetName(),GetTitle()) ;
+ }
+ return kTRUE ;
+}
+
+//____________________________________________________________________________
+void AliEMCALDigitizer::InitParameters()
+{
+ fPinNoise = 0.00001 ;
+ fTowerDigitThreshold = 0.001 ;
+ fTimeResolution = 0.5e-9 ;
+ fTimeSignalLength = 1.0e-9 ;
+ fPreShowerDigitThreshold = fTowerDigitThreshold/25. ;
+ fADCchannelTower = 0.000220; // width of one ADC channel in GeV
+ fADCpedestalTower = 0.005 ; // GeV
+ fNADCTower = (Int_t) TMath::Power(2,16) ; // number of channels in Tower ADC