]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALSDigitizer.cxx
Use of (dummy) reconstructors for all detectors (T.Kuhr)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALSDigitizer.cxx
index 2eada3126188e26d3fe3d29fde15448058cf890f..56dd5118cd7fbec7c30c3c4eb34e2d1e25697681 100644 (file)
@@ -67,16 +67,18 @@ ClassImp(AliEMCALSDigitizer)
   AliEMCALSDigitizer::AliEMCALSDigitizer():TTask("","") 
 {
   // ctor
-  InitParameters() ; 
+  fFirstEvent = fLastEvent  = 0 ;  
   fDefaultInit = kTRUE ; 
 }
 
 //____________________________________________________________________________ 
-AliEMCALSDigitizer::AliEMCALSDigitizer(const char * alirunFileName, const char * eventFolderName):
-  TTask("EMCAL"+AliConfig::fgkSDigitizerTaskName, alirunFileName),
+AliEMCALSDigitizer::AliEMCALSDigitizer(const char * alirunFileName, 
+                                      const char * eventFolderName):
+  TTask("EMCAL"+AliConfig::Instance()->GetSDigitizerTaskName(), alirunFileName),
   fEventFolderName(eventFolderName)
 {
   // ctor
+  fFirstEvent = fLastEvent  = 0 ; // runs one event by defaut  
   Init();
   InitParameters() ; 
   fDefaultInit = kFALSE ; 
@@ -87,6 +89,8 @@ AliEMCALSDigitizer::AliEMCALSDigitizer(const char * alirunFileName, const char *
 AliEMCALSDigitizer::AliEMCALSDigitizer(const AliEMCALSDigitizer & sd) : TTask(sd) {
   //cpy ctor 
 
+  fFirstEvent    = sd.fFirstEvent ; 
+  fLastEvent     = sd.fLastEvent ;
   fA             = sd.fA ;
   fB             = sd.fB ;
   fECPrimThreshold  = sd.fECPrimThreshold ;
@@ -143,14 +147,13 @@ void AliEMCALSDigitizer::InitParameters()
   AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
   const AliEMCALGeometry * geom = gime->EMCALGeometry() ; 
   if (geom->GetSampling() == 0.) {
-    printf("InitParameters: Sampling factor not set !") ; 
-    abort() ;
+    Fatal("InitParameters", "Sampling factor not set !") ; 
   }
-  else
-    printf("InitParameters: Sampling factor set to %f\n", geom->GetSampling()) ; 
+//   else
+//     Info("InitParameters", "Sampling factor set to %f", geom->GetSampling()) ; 
   
   // this threshold corresponds approximately to 100 MeV
-  fECPrimThreshold     = 100E-3 / ( geom->GetSampling() * geom->GetNECLayers()) * geom->GetNECLayers() ;
+  fECPrimThreshold     = 100E-3;
 }
 
 //____________________________________________________________________________
@@ -165,7 +168,7 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
   if(strstr(option,"tim"))
     gBenchmark->Start("EMCALSDigitizer");
 
-  AliEMCALGetter * gime = AliEMCALGetter::Instance() ;
+  AliEMCALGetter * gime = AliEMCALGetter::Instance(GetTitle()) ;
  
   //switch off reloading of this task while getting event
   if (!fInit) { // to prevent overwrite existing file
@@ -173,11 +176,15 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
     return ;
     }
 
-  Int_t nevents = gime->MaxEvent() ; 
+  if (fLastEvent == -1) 
+    fLastEvent = gime->MaxEvent() - 1 ;
+  else 
+    fLastEvent = TMath::Min(fFirstEvent, gime->MaxEvent()); // only ine event at the time
+  Int_t nEvents   = fLastEvent - fFirstEvent + 1;
+
   Int_t ievent ;   
-  for(ievent = 0; ievent < nevents; ievent++){     
+  for (ievent = fFirstEvent; ievent <= fLastEvent; ievent++) {
     gime->Event(ievent,"H") ;  
-
     TTree * treeS = gime->TreeS(); 
     TClonesArray * hits = gime->Hits() ; 
     TClonesArray * sdigits = gime->SDigits() ;
@@ -276,7 +283,7 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
   if(strstr(option,"tim")){
     gBenchmark->Stop("EMCALSDigitizer"); 
     printf("Exec: took %f seconds for SDigitizing %f seconds per event", 
-        gBenchmark->GetCpuTime("EMCALSDigitizer"), gBenchmark->GetCpuTime("EMCALSDigitizer") ) ; 
+        gBenchmark->GetCpuTime("EMCALSDigitizer"), gBenchmark->GetCpuTime("EMCALSDigitizer")/nEvents ) ; 
   }
 }