]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
example macro to check contents of a OCDB bad channel file localy
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 May 2012 08:50:37 +0000 (08:50 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 May 2012 08:50:37 +0000 (08:50 +0000)
EMCAL/macros/PedestalDB/PrintBadChannels.C [new file with mode: 0644]

diff --git a/EMCAL/macros/PedestalDB/PrintBadChannels.C b/EMCAL/macros/PedestalDB/PrintBadChannels.C
new file mode 100644 (file)
index 0000000..e281f4c
--- /dev/null
@@ -0,0 +1,63 @@
+// Example to check the contents of a bad channels OCDB file locally
+// Author: Gustavo Conesa Balbastre (LPSC-Grenoble)
+
+void PrintBadChannels(char * file = "$ALICE_ROOT/OCDB/EMCAL/Calib/Pedestals/Run0_999999999_v0_s0.root") 
+{
+  // Read status map
+  TFile * f = new TFile(file,"READ");
+  
+  AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
+  
+  AliCaloCalibPedestal * caloped = (AliCaloCalibPedestal *) cdb->GetObject();
+  
+  TObjArray map = caloped->GetDeadMap();
+  
+  printf("MAP entries %d\n",map.GetEntries());
+  
+  AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
+  
+  Int_t nbadTotal  = 0;
+  Int_t nhotTotal  = 0;
+  Int_t nwarmTotal = 0;
+  Int_t ndeadTotal = 0;
+  
+  for(Int_t iSM = 0; iSM < geom->GetNumberOfSuperModules(); iSM ++)
+  { 
+    Int_t nbad  = 0;
+    Int_t nhot  = 0;
+    Int_t nwarm = 0;
+    Int_t ndead = 0;
+    
+    printf(">>> SM %d <<< Entries %d \n",iSM,((TH2D*)map[iSM])->GetEntries());
+    
+    for(Int_t i = 0; i < ((TH2D*)map[iSM])->GetNbinsX() ; i++)
+    {
+      for(Int_t j = 0; j < ((TH2D*)map[iSM])->GetNbinsY() ; j++)
+      {
+        if(((TH2D*)map[iSM])->GetBinContent(i, j)!=AliCaloCalibPedestal::kAlive)
+        {
+          Int_t id = geom->GetAbsCellIdFromCellIndexes(iSM,j,i);
+          printf("\t Bin (%d-%d) Id %d Content: %d \n",i,j,id,((TH2D*)map[iSM])->GetBinContent(i, j));
+          nbad++;
+        }      
+        
+        if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kDead   ) ndead++;
+        if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kHot    ) nhot ++;
+        if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kWarning) nwarm++;
+      }        
+    }
+    
+    printf("Summary : --- dead %d --- hot %d --- warm %d --- bad %d\n",ndead,nhot,nwarm,nbad);  
+    
+    nbadTotal  += nbad  ;
+    nhotTotal  += nhot  ;
+    ndeadTotal += ndead ;
+    nwarmTotal += nwarm ;
+  }
+  
+  
+  printf("All SM summary : --- dead %d --- hot %d --- warm %d --- bad %d\n",ndeadTotal,nhotTotal,nwarmTotal,nbadTotal);  
+  
+  printf("Total BAD %d\n", caloped->GetDeadTowerCount());
+  
+}