From 1769b3d15cd1af17d38823c3e0af92ef1eb75436 Mon Sep 17 00:00:00 2001 From: gconesab Date: Fri, 4 Dec 2009 13:51:49 +0000 Subject: [PATCH] Add possibility to set bad map channel from file, add example file with map of bad channels for first runs --- EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C | 84 +++++++++++++++--- EMCAL/macros/PedestalDB/map.txt | 85 +++++++++++++++++++ 2 files changed, 159 insertions(+), 10 deletions(-) create mode 100644 EMCAL/macros/PedestalDB/map.txt diff --git a/EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C b/EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C index b9821072be1..d74e05d0b28 100644 --- a/EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C +++ b/EMCAL/macros/PedestalDB/AliEMCALPedestalCDB.C @@ -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= "<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 index 00000000000..073703b2533 --- /dev/null +++ b/EMCAL/macros/PedestalDB/map.txt @@ -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 -- 2.43.0