]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add possibility to set bad map channel from file, add example file with map of bad...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Dec 2009 13:51:49 +0000 (13:51 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Dec 2009 13:51:49 +0000 (13:51 +0000)
EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C
EMCAL/macros/PedestalDB/map.txt [new file with mode: 0644]

index b9821072be120419199e76f9a217707f5e7a5dd4..d74e05d0b2886002ae6fb47d735af4303bd37dbc 100644 (file)
@@ -41,6 +41,8 @@ void AliEMCALPedestalCDB()
                                        "Set randomly 20% of the channels dead");
   menu->AddButton("Create Random Status Map, 30% dead","SetTowerStatusMap(30)",
                                        "Set randomly 30% of the channels dead");
+  menu->AddButton("Set Map from txt file","SetTowerStatusMap(\"map.txt\")",
+                 "Read bad channels from txt file and set them in root file");
   menu->AddButton("Read Tower Status Map","GetTowerStatusMap()",
                  "Read initial equal calibration coefficients");
   menu->Show();
@@ -65,7 +67,7 @@ void SetTowerStatusMap(Int_t percent=0)
   Int_t firstRun   =  0; 
   Int_t lastRun    =  999999999;
   Int_t beamPeriod =  1;
-  char* objFormat = Form("%d percent decalibrated channels", percent);
+  char* objFormat = Form("%d percent of bad channels", percent);
   
   AliCaloCalibPedestal *caloped=new AliCaloCalibPedestal(AliCaloCalibPedestal::kEmCal);
   TObjArray map = caloped->GetDeadMap();
@@ -111,6 +113,66 @@ void SetTowerStatusMap(Int_t percent=0)
 
 }
 
+//____________________________________________
+
+
+
+
+//------------------------------------------------------------------------
+void SetTowerStatusMap(char * file = "map.txt")
+{
+  // Get the list of dead/hot channels from file and set them in OCDB
+  
+  TString sDBFolder ="local://PedestalsDB";
+  Int_t firstRun   =  0; 
+  Int_t lastRun    =  999999999;
+  Int_t beamPeriod =  1;
+  char* objFormat = Form("bad channels extracted from file %s", file);
+  
+  AliCaloCalibPedestal *caloped=new AliCaloCalibPedestal(AliCaloCalibPedestal::kEmCal);
+  TObjArray map = caloped->GetDeadMap();
+  printf("MAP entries %d\n",map.GetEntries());
+  
+  
+  // Read parameter file line-by-line  
+  ifstream f;
+  f.open(file);
+  
+  Int_t iSM=-1, icol=-1, irow=-1, istatus=-1, ndead=0 ;
+  TString string;
+  if (f.good()) {
+    while(string.ReadLine(f, kFALSE) && !f.eof()) {
+      
+      sscanf(string.Data(), "%d %d %d %d",&iSM,&icol,&irow,&istatus);
+      cout<<"SM= "<<iSM<<", col= "<<icol<<", row= "<<irow<<", status="<<istatus<<endl;
+      if(iSM==-1) continue;
+      ((TH2D*)map[iSM])->SetBinContent(icol, irow, istatus); 
+      ndead++;
+    }
+  }
+  caloped->SetDeadTowerCount(ndead-2);
+  printf("--- dead %d\n",ndead-2);
+  
+  printf("--- total dead %d\n",caloped->GetDeadTowerCount());
+  
+  caloped->SetDeadMap(map);
+  
+  //Store map into database
+  
+  AliCDBMetaData md;
+  md.SetComment(objFormat);
+  md.SetBeamPeriod(beamPeriod);
+  md.SetResponsible("Gustavo Conesa");
+  
+  AliCDBId id("EMCAL/Calib/Pedestals",firstRun,lastRun); // create in EMCAL/Calib/Pedestal sDBFolder 
+  
+  AliCDBManager* man = AliCDBManager::Instance();  
+  AliCDBStorage* loc = man->GetStorage(sDBFolder.Data());
+    loc->Put(caloped, id, &md);
+    
+}
+
+  
 //------------------------------------------------------------------------
 void GetTowerStatusMap()
 {
@@ -134,18 +196,20 @@ void GetTowerStatusMap()
          Int_t ndead = 0;
          printf(" >>> SM %d <<< Entries %d, NbinsX %d, NbinsY %d\n",iSM,((TH2D*)map[iSM])->GetEntries(),((TH2D*)map[iSM])->GetNbinsX(),((TH2D*)map[iSM])->GetNbinsY());
          for(Int_t i = 0; i < ((TH2D*)map[iSM])->GetNbinsX() ; i++){
-                 for(Int_t j = 0; j < ((TH2D*)map[iSM])->GetNbinsY() ; j++){
-                               //printf("Bin (%d-%d) Content: %d \n",i,j,((TH2D*)map[iSM])->GetBinContent(i, j));      
-                         
-                               if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kDead)
-                                       ndead++;
-                 }     
+           for(Int_t j = 0; j < ((TH2D*)map[iSM])->GetNbinsY() ; j++){
+             if(((TH2D*)map[iSM])->GetBinContent(i, j)!=AliCaloCalibPedestal::kAlive)
+               printf("Bin (%d-%d) Content: %d \n",i,j,((TH2D*)map[iSM])->GetBinContent(i, j));        
+             
+             if(((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kDead ||
+                ((TH2D*)map[iSM])->GetBinContent(i, j)==AliCaloCalibPedestal::kHot)
+               ndead++;
+           }   
          }
          printf("--- dead %d\n",ndead);  
          cMap->cd(iSM);
          (TH2D*)map[iSM])->Draw("lego2");
-  }
+}
+
+printf("Total DEAD %d\n", caloped->GetDeadTowerCount());
 
-       printf("Total DEAD %d\n", caloped->GetDeadTowerCount());
-       
 }
diff --git a/EMCAL/macros/PedestalDB/map.txt b/EMCAL/macros/PedestalDB/map.txt
new file mode 100644 (file)
index 0000000..073703b
--- /dev/null
@@ -0,0 +1,85 @@
+Mod - Col - Row - Dead/hot
+
+0 2 3 2
+0 13 5 2
+0 14 3 2
+0 20 18 2
+0 23 10 2
+1 4 13 2
+1 39 19 2
+1 40 1 2
+1 40 2 2
+1 40 3 2
+1 40 5 2
+1 40 6 2
+1 41 0 2
+1 41 1 2
+1 41 2 2
+1 41 3 2
+1 41 4 2
+1 41 6 2
+1 41 13 2
+1 45 21 2
+2 0 16 2
+2 4 16 2
+2 5 9 2
+2 18 16 2
+2 18 17 2
+2 18 20 2
+2 18 21 2
+2 19 16 2
+2 19 18 2
+2 19 19 2
+2 19 20 2
+2 19 21 2
+2 20 19 2
+2 32 20 2
+2 42 21 2
+2 46 17 2
+3 15 2 2
+3 22 7 2
+3 27 21 2
+3 28 1 2
+
+0 3 13 1
+0 31 0 1
+0 38 2 1
+1 0 11 1
+1 4 7 1
+1 5 20 1
+1 9 16 1
+1 9 20 1
+1 14 15 1
+1 15 7 1
+1 23 16 1
+1 24 22 1
+1 30 2 1
+1 36 15 1
+1 37 5 1
+1 44 23 1
+1 45 5 1
+1 47 18 1
+2 33 22 1
+3 4 21 1
+3 9 2 1
+3 15 23 1
+3 29 18 1
+3 34 13 1
+
+
+0 2 4 1
+0 2 5 1
+0 2 6 1
+0 2 7 1
+0 3 4 1
+0 3 5 1
+0 3 6 1
+0 3 7 1
+0 26 12 1
+0 26 13 1
+0 26 14 1
+0 26 15 1
+0 27 12 1
+0 27 13 1
+0 27 14 1
+0 27 15 1