]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSModuleDaSSD.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / ITS / AliITSModuleDaSSD.cxx
index f2bcc9a3a27af2eda2a8623a5c15c1549a078213..2b3efb489bf77690d0e391d22d78ac4ee6ff10b9 100644 (file)
@@ -20,7 +20,7 @@
 /// This class provides storage container ITS SSD module callibration data
 /// used by DA. 
 /// 
-/// Date: 18/07/2008
+/// Date: 09/07/2009
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSNoiseSSD.h"
@@ -110,11 +110,6 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips) :
      fNumberOfStrips = 0;
      fStrips = NULL;
   }  
-  fCmFerom = new (nothrow) TArrayS [fgkChipsPerModule];
-  if (!fCmFerom) {
-     AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule));
-     fCmFerom = NULL;
-  }  
 }
 
 
@@ -149,17 +144,6 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips, const Long_t ev
      fNumberOfStrips = 0;
      fStrips = NULL;
   }  
-  fCmFerom = new (nothrow) TArrayS [fgkChipsPerModule];
-  if (fCmFerom) {
-    for (Int_t i = 0; i < fgkChipsPerModule; i++) {
-      fCmFerom[i].Set(eventsnumber);
-      fCmFerom[i].Reset(0);
-    }  
-  }
-  else {
-     AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule));
-     fCmFerom = NULL;
-  }  
 }
 
 
@@ -282,7 +266,7 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul
        fCm = NULL;
     }  
   }  
-  if (fCmFerom) delete [] fCmFerom;
+  if (fCmFerom) { delete [] fCmFerom; fCmFerom = NULL; }
   if (module.fCmFerom) {
     fCmFerom = new (nothrow) TArrayS [module.fNumberOfChips];
     if (fCmFerom) {
@@ -411,7 +395,7 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber)
     if (fStrips[i]) { 
       if (!fStrips[i]->SetEvenetsNumber(eventsnumber)) {
         for (Int_t j = 0; j < i; j++) fStrips[j]->DeleteSignal();
-        AliError(Form("AliITSModuleDaSSD: Error allocating memory for i% events for module %i, strip %i",eventsnumber, (Int_t)fModuleId, i));
+        AliError(Form("AliITSModuleDaSSD: Error allocating memory for %ld event for module %d, strip %d",eventsnumber, (Int_t)fModuleId, i));
         return kFALSE;
       }
     }
@@ -425,14 +409,7 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber)
         return kFALSE;
       }
     }
-  } 
-  if (fCmFerom) {
-    for (Int_t ie = 0; ie < fgkChipsPerModule; ie++) {
-      fCmFerom[ie].Set(eventsnumber);
-      fCmFerom[ie].Reset(0);
-    }  
   }
-  else  AliError("AliITSModuleDaSSD: No memory was allocated for fCmFerom!");
   fEventsNumber = eventsnumber;
   return kTRUE;
 }
@@ -461,6 +438,21 @@ Float_t  AliITSModuleDaSSD::GetCM(const Int_t chipn, const Long_t evn)   const
 }
 
 
+//______________________________________________________________________________
+Bool_t  AliITSModuleDaSSD::AllocateCMFeromArray(void)
+{
+// Allocates memory for the channels which contains CM calculated in Ferom
+ if (!fCmFerom) { 
+    fCmFerom = new (nothrow) TArrayS [fgkChipsPerModule];
+    if (!fCmFerom) {
+       AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule));
+       fCmFerom = NULL;
+       return kFALSE;
+    }
+  }
+  return kTRUE;
+}
+
 
 //______________________________________________________________________________
 Bool_t  AliITSModuleDaSSD::SetCMFeromEventsNumber(const Long_t eventsnumber)
@@ -485,6 +477,14 @@ Bool_t AliITSModuleDaSSD::SetCMFerom (const Short_t cm, const Int_t chipn, const
 }
 
 
+void  AliITSModuleDaSSD::SetCMFerom (Short_t* cm, const Int_t chipn)
+// Set value of FeromCM for a given chip
+{ 
+  if (!fCmFerom) 
+    if (!AllocateCMFeromArray()) return;
+  if (chipn < fgkChipsPerModule) fCmFerom[chipn].Set(fCmFerom[chipn].GetSize(), cm); 
+}
+
 
 //______________________________________________________________________________
 Short_t  AliITSModuleDaSSD::GetCMFerom(const Int_t chipn, const Long_t evn)   const 
@@ -495,21 +495,3 @@ Short_t  AliITSModuleDaSSD::GetCMFerom(const Int_t chipn, const Long_t evn)   co
   else return fCmFerom[chipn][evn];
 }
 
-
-
-UChar_t AliITSModuleDaSSD::CheckIfBad(const Int_t stripn) const
-{
-//Applies the bad channel creteria and set the appropriate flags for returned valie 
-  UInt_t          bcflags = 0;
-  const UInt_t    WOffsetMask = 0x000003FF;
-  if (!fStrips[stripn]) bcflags |= 3;
-  else {
-    if (fStrips[stripn]->GetNoiseCM() == AliITSChannelDaSSD::GetUndefinedValue()) bcflags |= 8;
-    if (fStrips[stripn]->GetNoiseCM() > 20) bcflags |= 8;
-    if (fStrips[stripn]->GetNoiseCM() < 1) bcflags |= 16;
-    if (fStrips[stripn]->GetPedestal() > ((WOffsetMask >> 1) - 1))  bcflags |= 4;
-    else if ((-(fStrips[stripn]->GetPedestal())) > (WOffsetMask >> 1))  bcflags |= 4;
-    if (bcflags) bcflags |= 3;
-  }
-  return bcflags;
-}