]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSModuleDaSSD.cxx
added extraction of V0s origin
[u/mrichter/AliRoot.git] / ITS / AliITSModuleDaSSD.cxx
index 380cf8448be9ada0aaae6722e18a1315cdb66963..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) {
@@ -408,14 +392,14 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber)
   Int_t i;
   if (!fStrips) return kFALSE;
   for (i = 0; i < fNumberOfStrips; i++) {
-    if (fStrips[i])  
+    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;
       }
-    else 
+    }
+    else { 
       if (!(fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber))) {
         for (Int_t j = 0; j < i; j++) delete fStrips[j];
         delete [] fStrips;
@@ -424,14 +408,8 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber)
         AliError(Form("AliITSModuleDaSSD: Error allocating memory for strip %i of module %i!", (Int_t)fModuleId, i));
         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;
 }
@@ -460,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)
@@ -484,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 
@@ -494,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;
-}