]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALDigitizer.cxx
Fixed error with trigger name at method SetInput
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALDigitizer.cxx
index a7de7e673b87db30bcc9d9d479b7ac594892dbee..767fdd5cad360a0f59578f3303cbf1fda2dd696f 100644 (file)
@@ -144,7 +144,7 @@ AliEMCALDigitizer::AliEMCALDigitizer(TString alirunFileName, TString eventFolder
     fFirstEvent(0),
     fLastEvent(0),
     fControlHists(0),
-    fHists(0)
+    fHists(0),fCalibData(0x0)
 {
   // ctor
   InitParameters() ; 
@@ -205,7 +205,7 @@ AliEMCALDigitizer::AliEMCALDigitizer(AliRunDigitizer * rd)
     fFirstEvent(0),
     fLastEvent(0),
     fControlHists(0),
-    fHists(0)
+    fHists(0),fCalibData(0x0)
 {
   // ctor Init() is called by RunDigitizer
   fManager = rd ; 
@@ -241,7 +241,6 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   // after that adds contributions from SDigits. This design 
   // helps to avoid scanning over the list of digits to add 
   // contribution of any new SDigit.
-  static int isTrd1Geom = -1; // -1 - mean undefined 
   static int nEMC=0; //max number of digits possible
 
   AliRunLoader *rl = AliRunLoader::GetRunLoader();
@@ -255,7 +254,7 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   rl->GetEvent(readEvent);
 
   TClonesArray * digits = emcalLoader->Digits() ; 
-  digits->Delete() ;  
+  digits->Delete() ;  //JLK why is this created then deleted?
 
   // Load Geometry
   AliEMCALGeometry *geom = 0;
@@ -266,16 +265,9 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   else 
     AliFatal("Could not get AliRun from runLoader");
 
-  if(isTrd1Geom < 0) { 
-    AliDebug(1, Form(" get Geometry %s : %s ", geom->GetName(),geom->GetTitle()));
-    TString ng(geom->GetName());
-    isTrd1Geom = 0;
-    if(ng.Contains("SHISH") &&  ng.Contains("TRD1")) isTrd1Geom = 1;
-
-    if(isTrd1Geom == 0) nEMC = geom->GetNPhi()*geom->GetNZ();
-    else                nEMC = geom->GetNCells();
-    AliDebug(1,Form("nEMC %i (number cells in EMCAL) | %s | isTrd1Geom %i\n", nEMC, geom->GetName(), isTrd1Geom));
-  }
+  nEMC = geom->GetNCells();
+  AliDebug(1,Form("nEMC %i (number cells in EMCAL) | %s \n", nEMC, geom->GetName()));
+  
   Int_t absID ;
 
   digits->Expand(nEMC) ;
@@ -332,7 +324,7 @@ void AliEMCALDigitizer::Digitize(Int_t event)
   AliEMCALDigit * digit ;
   AliEMCALDigit * curSDigit ;
 
-  TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
+  //  TClonesArray * ticks = new TClonesArray("AliEMCALTick",1000) ;
 
   //Put Noise contribution
   for(absID = 0; absID < nEMC; absID++){ // Nov 30, 2006 by PAI; was from 1 to nEMC
@@ -344,14 +336,22 @@ void AliEMCALDigitizer::Digitize(Int_t event)
     
     if(absID==nextSig){
       //Add SDigits from all inputs    
-      ticks->Clear() ;
-      Int_t contrib = 0 ;
-      Float_t a = digit->GetAmp() ;
-      Float_t b = TMath::Abs( a /fTimeSignalLength) ;
+      //      ticks->Clear() ;
+      //Int_t contrib = 0 ;
+
+      //Follow PHOS and comment out this timing model til a better one
+      //can be developed - JLK 28-Apr-2008
+
+      //Float_t a = digit->GetAmp() ;
+      //Float_t b = TMath::Abs( a /fTimeSignalLength) ;
       //Mark the beginning of the signal
-      new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);  
+      //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime(),0, b);  
       //Mark the end of the signal     
-      new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+      //new((*ticks)[contrib++]) AliEMCALTick(digit->GetTime()+fTimeSignalLength, -a, -b);
+
+      // Calculate time as time of the largest digit
+      Float_t time = digit->GetTime() ;
+      Float_t eTime= digit->GetAmp() ;
       
       // loop over input
       for(i = 0; i< fInput ; i++){  //loop over (possible) merge sources
@@ -368,11 +368,16 @@ void AliEMCALDigitizer::Digitize(Int_t event)
          else
            primaryoffset = i ;
          curSDigit->ShiftPrimary(primaryoffset) ;
-         
-         a = curSDigit->GetAmp() ;
-         b = a /fTimeSignalLength ;
-         new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);  
-         new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); 
+
+         //Remove old timing model - JLK 28-April-2008
+         //a = curSDigit->GetAmp() ;
+         //b = a /fTimeSignalLength ;
+         //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime(),0, b);  
+         //new((*ticks)[contrib++]) AliEMCALTick(curSDigit->GetTime()+fTimeSignalLength, -a, -b); 
+         if(curSDigit->GetAmp()>eTime) {
+           eTime = curSDigit->GetAmp();
+           time = curSDigit->GetTime();
+         }
 
          *digit = *digit + *curSDigit ;  //add energies
 
@@ -388,7 +393,8 @@ void AliEMCALDigitizer::Digitize(Int_t event)
       amp *= static_cast<Float_t>(gRandom->Poisson(fMeanPhotonElectron)) / static_cast<Float_t>(fMeanPhotonElectron) ;
   
       //calculate and set time
-      Float_t time = FrontEdgeTime(ticks) ;
+      //New timing model needed - JLK 28-April-2008
+      //Float_t time = FrontEdgeTime(ticks) ;
       digit->SetTime(time) ;
 
       //Find next signal module
@@ -409,8 +415,8 @@ void AliEMCALDigitizer::Digitize(Int_t event)
                     absID, amp, nextSig));
   } // for(absID = 1; absID <= nEMC; absID++)
   
-  ticks->Delete() ;
-  delete ticks ;
+  //ticks->Delete() ;
+  //delete ticks ;
 
   delete sdigArray ; //We should not delete its contents
 
@@ -617,9 +623,10 @@ void AliEMCALDigitizer::InitParameters()
 { 
   // Parameter initialization for digitizer
   // Tune parameters - 24-nov-04; Apr 29, 2007
+  // New parameters JLK 14-Apr-2008
 
-  fMeanPhotonElectron = 3300;  // electrons per GeV 
-  fPinNoise           = 0.010; // pin noise in GEV from analysis test beam data 
+  fMeanPhotonElectron = 4400;  // electrons per GeV 
+  fPinNoise           = 0.037; // pin noise in GEV from analysis test beam data 
   if (fPinNoise == 0. ) 
     Warning("InitParameters", "No noise added\n") ; 
   fDigitThreshold     = fPinNoise * 3; // 3 * sigma
@@ -691,6 +698,7 @@ void AliEMCALDigitizer::MixWith(TString alirunFileName, TString eventFolderName)
     fInput++ ;
 }  
 
+//__________________________________________________________________
 void AliEMCALDigitizer::Print1(Option_t * option)
 { // 19-nov-04 - just for convinience
   Print(); 
@@ -837,12 +845,14 @@ void AliEMCALDigitizer::WriteDigits()
 
 }
 
+//__________________________________________________________________
 void AliEMCALDigitizer::Browse(TBrowser* b)
 {
   if(fHists) b->Add(fHists);
   TTask::Browse(b);
 }
 
+//__________________________________________________________________
 TList *AliEMCALDigitizer::BookControlHists(int var)
 { 
   // 22-nov-04
@@ -866,6 +876,7 @@ TList *AliEMCALDigitizer::BookControlHists(int var)
   return fHists;
 }
 
+//__________________________________________________________________
 void AliEMCALDigitizer::SaveHists(const char* name, Bool_t kSingleKey, const char* opt)
 {
   AliEMCALHistoUtilities::SaveListOfHists(fHists, name, kSingleKey, opt);