]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/macros/PedestalDB/PrintBadChannels.C
change order of bookkeeping events
[u/mrichter/AliRoot.git] / EMCAL / macros / PedestalDB / PrintBadChannels.C
1 // Example to check the contents of a bad channels OCDB file locally
2 // Author: Gustavo Conesa Balbastre (LPSC-Grenoble)
3
4 void PrintBadChannels(char * file = "$ALICE_ROOT/OCDB/EMCAL/Calib/Pedestals/Run0_999999999_v0_s0.root") 
5 {
6   // Read status map
7   TFile * f = new TFile(file,"READ");
8   
9   AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
10   
11   AliCaloCalibPedestal * caloped = (AliCaloCalibPedestal *) cdb->GetObject();
12   
13   TObjArray map = caloped->GetDeadMap();
14   
15   printf("MAP entries %d\n",map.GetEntries());
16   
17   AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM");
18   
19   Int_t nbadTotal  = 0;
20   Int_t nhotTotal  = 0;
21   Int_t nwarmTotal = 0;
22   Int_t ndeadTotal = 0;
23   
24   for(Int_t iSM = 0; iSM < geom->GetNumberOfSuperModules(); iSM ++)
25   { 
26     Int_t nbad  = 0;
27     Int_t nhot  = 0;
28     Int_t nwarm = 0;
29     Int_t ndead = 0;
30     
31     printf(">>> SM %d <<< Entries %d \n",iSM,((TH2D*)map[iSM])->GetEntries());
32     
33     for(Int_t i = 0; i < ((TH2D*)map[iSM])->GetNbinsX() ; i++)
34     {
35       for(Int_t j = 0; j < ((TH2D*)map[iSM])->GetNbinsY() ; j++)
36       {
37         if(((TH2D*)map[iSM])->GetBinContent(i, j)!=AliCaloCalibPedestal::kAlive)
38         {
39           Int_t id = geom->GetAbsCellIdFromCellIndexes(iSM,j,i);
40           printf("\t Bin (%d-%d) Id %d Content: %d \n",i,j,id,((TH2D*)map[iSM])->GetBinContent(i, j));
41           nbad++;
42         }       
43         
44         if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kDead   ) ndead++;
45         if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kHot    ) nhot ++;
46         if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kWarning) nwarm++;
47       } 
48     }
49     
50     printf("Summary : --- dead %d --- hot %d --- warm %d --- bad %d\n",ndead,nhot,nwarm,nbad);  
51     
52     nbadTotal  += nbad  ;
53     nhotTotal  += nhot  ;
54     ndeadTotal += ndead ;
55     nwarmTotal += nwarm ;
56   }
57   
58   
59   printf("All SM summary : --- dead %d --- hot %d --- warm %d --- bad %d\n",ndeadTotal,nhotTotal,nwarmTotal,nbadTotal);  
60   
61   printf("Total BAD %d\n", caloped->GetDeadTowerCount());
62   
63 }