]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALDigitizer.cxx
move remaining AliInfo to AliDebug
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALDigitizer.cxx
index 9fc6368d5cb29b7a5c8b27e7475b21ab82a23736..790f6e8a39c7e0f72010c6a0ce9881eab25245a0 100644 (file)
@@ -795,21 +795,27 @@ void AliEMCALDigitizer::Digitize(Option_t *option)
   AliRunLoader *rl = AliRunLoader::Instance();
   AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
   Int_t nEvents = 0;
-  if(!emcalLoader){
+  if(!emcalLoader)
+  {
     AliFatal("Did not get the  Loader");
   }
-  else{
-    
-    if (fLastEvent == -1)  {
+  else
+  {
+    if (fLastEvent == -1)
       fLastEvent = rl->GetNumberOfEvents() - 1 ;
-    }
-    else if (fDigInput) 
+    else if (fDigInput)
       fLastEvent = fFirstEvent ; // what is this ??
     
     nEvents = fLastEvent - fFirstEvent + 1;
     Int_t ievent  = -1;
 
     AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
+    if(!geom)
+    {
+      AliFatal("Geometry pointer null");
+      return; // fix for coverity
+    }
+    
     const Int_t nTRU = geom->GetNTotalTRU();
     TClonesArray* digitsTMP = new TClonesArray("AliEMCALDigit",    nTRU*96);
     TClonesArray* digitsTRG = new TClonesArray("AliEMCALRawDigit", nTRU*96);
@@ -892,6 +898,11 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
   if (!emcalLoader) AliFatal("Did not get the  Loader");
   
   const  AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
+  if(!geom)
+  {
+    AliFatal("Geometry pointer null");
+    return; // fix for coverity
+  }
   
   // build FOR from simulated digits
   // and xfer to the corresponding TRU input (mapping)
@@ -912,7 +923,7 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
     Int_t id = digit->GetId();
     
     Int_t trgid;
-    if (geom && geom->GetFastORIndexFromCellIndex(id , trgid))
+    if (geom->GetFastORIndexFromCellIndex(id , trgid))
     {
       AliDebug(1,Form("trigger digit id: %d from cell id: %d\n",trgid,id));
       
@@ -1245,7 +1256,8 @@ void AliEMCALDigitizer::WriteDigits()
 
 //__________________________________________________________________
 void AliEMCALDigitizer::WriteDigits(TClonesArray* digits, const char* branchName)
-{ // overloaded method
+{
+  // overloaded method
   AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(AliRunLoader::Instance()->GetDetectorLoader("EMCAL"));
   if(emcalLoader){
     
@@ -1276,59 +1288,43 @@ void AliEMCALDigitizer::WriteDigits(TClonesArray* digits, const char* branchName
 //__________________________________________________________________
 Bool_t AliEMCALDigitizer::IsDead(AliEMCALDigit *digit) 
 {
-  AliRunLoader *runLoader = AliRunLoader::Instance();
-  AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-  if (!emcalLoader) AliFatal("Did not get the  Loader");
-  
-  AliCaloCalibPedestal *caloPed = emcalLoader->PedestalData();
-  if (!caloPed) {
-    AliWarning("Could not access pedestal data! No dead channel removal applied");
-    return kFALSE;
-  }
-  
-       // Load Geometry
-  const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
-  if (!geom) AliFatal("Did not get geometry from EMCALLoader");
-  
+  // Check if cell is defined as dead, so that it is not included
+  // input is digit
   Int_t absId   = digit->GetId();
-  Int_t iSupMod = -1;
-  Int_t nModule = -1;
-  Int_t nIphi   = -1;
-  Int_t nIeta   = -1;
-  Int_t iphi    = -1;
-  Int_t ieta    = -1;
-       
-  Bool_t bCell = geom->GetCellIndex(absId, iSupMod, nModule, nIphi, nIeta) ;
-       
-  if (!bCell) Error("IsDead","Wrong cell id number : absId %i ", absId) ;
-  geom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
 
-  Int_t channelStatus = (Int_t)(caloPed->GetDeadMap(iSupMod))->GetBinContent(ieta,iphi);
-
-  if (channelStatus == AliCaloCalibPedestal::kDead) 
-    return kTRUE;
-  else
-    return kFALSE;
+  return IsDead(absId);
+  
 }
 
 
 //__________________________________________________________________
 Bool_t AliEMCALDigitizer::IsDead(Int_t absId)
 {
+  // Check if cell absID is defined as dead, so that it is not included
+
     AliRunLoader *runLoader = AliRunLoader::Instance();
     AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(runLoader->GetDetectorLoader("EMCAL"));
-    if (!emcalLoader) AliFatal("Did not get the  Loader");
-    
+    if (!emcalLoader)
+    {
+      AliFatal("Did not get the  Loader");
+      return kTRUE;
+    }
+  
     AliCaloCalibPedestal *caloPed = emcalLoader->PedestalData();
-    if (!caloPed) {
+    if (!caloPed)
+    {
         AliWarning("Could not access pedestal data! No dead channel removal applied");
         return kFALSE;
     }
     
        // Load Geometry
     const AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
-    if (!geom) AliFatal("Did not get geometry from EMCALLoader");
-    
+    if (!geom)
+    {
+      AliFatal("Did not get geometry from EMCALLoader");
+      return kTRUE; //coverity
+    }
+  
     Int_t iSupMod = -1;
     Int_t nModule = -1;
     Int_t nIphi   = -1;