// Macro to print the values stored in the OCDB with AliEMCALCalibData
-// These parameters are used during simulation and reconstruction
+// either local file or alien file
// Author: Gustavo Conesa (LPSC-IN2P3)
-void PrintEMCALCalibData(char * file = "$ALICE_ROOT/OCDB/EMCAL/Calib/Data/Run0_999999999_v0_s0.root"){
+void PrintEMCALCalibData(TString file =
+ /*"alien:///alice/data/2014/OCDB/EMCAL/Calib/Data/Run0_999999999_v1_s0.root"*/
+ "$ALICE_ROOT/OCDB/EMCAL/Calib/Data/Run0_999999999_v0_s0.root"){
-
- TFile * f = new TFile(file,"READ");
+ if(file.Contains("alien:///"))
+ TGrid::Connect("alien://");
+
+ TFile * f = TFile::Open(file,"READ");
AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
AliEMCALCalibData * cparam = cdb->GetObject();
-
-
- cout<<"============== "<<cparam->GetName()<<" ==============="<<endl;
-
- cparam->Print("gain");
+
+ //cparam->Print("gain");
//cparam->Print("ped");
+ cparam->Print("all");
+
}
--- /dev/null
+// Set OCDB parameters from existing versions
+
+// Author : Gustavo Conesa Balbastre (LPSC-CNRS)
+
+void SetOCDBFromRun1(Int_t year = 2010, Bool_t printAll = kFALSE)
+{
+
+ gSystem->Load("libOADB");
+ TGrid::Connect("alien://");
+
+ Int_t run = 182325; //2012
+ if(year == 2010) run = 134908;
+ if(year == 2011) run = 159582;
+
+ AliCDBManager* man = AliCDBManager::Instance();
+ man->SetDefaultStorage("raw://");
+ man->SetRun(run);
+ AliCDBStorage *storage = man->GetDefaultStorage();
+
+ // Instantiate EMCAL geometry for the first time
+
+ if (year == 2010) geom = AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEARV1"); // 2010
+ else geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1"); // 2011-2012-2013
+// else geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM"); // Run2
+
+ const Int_t nSM = geom->GetNumberOfSuperModules();
+
+ // Get the final OCDB object
+
+ AliEMCALCalibData* cparam = (AliEMCALCalibData*) (storage->Get("EMCAL/Calib/Data", run)->GetObject());
+
+ // Access OCDB file with the first version of the calibration
+ TString first = "Run177115_999999999_v2_s0.root";
+ if(year==2010) first = "Run113461_999999999_v3_s0.root";
+ if(year==2011) first = "Run144484_999999999_v3_s0.root";
+
+ TFile * f = TFile::Open(Form("alien:///alice/data/%d/OCDB/EMCAL/Calib/Data/%s",year,first.Data()),"READ");
+ AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
+ AliEMCALCalibData* cparam1 = (AliEMCALCalibData*) cdb->GetObject();
+
+
+ //New OCDB container
+ AliEMCALCalibData *cparamnew=new AliEMCALCalibData("EMCAL");
+
+ // Do the comparison
+ Float_t param = -1;
+ Float_t param1 = -1;
+ Int_t iCol = -1, iRow = -1, iSM =-1, iMod = -1,iIphi =-1,iIeta = -1;
+ for(Int_t i=0;i < nSM*24*48; i++)
+ {
+ //printf("AbsID %d\n",i);
+ geom->GetCellIndex(i,iSM,iMod,iIphi,iIeta);
+ geom->GetCellPhiEtaIndexInSModule(iSM,iMod, iIphi, iIeta,iRow,iCol);
+
+ Float_t param = -1;
+ if( cparam ) param = cparam ->GetADCchannel(iSM,iCol,iRow);
+
+ Float_t param1 = -1;
+ if( cparam1 ) param1 = cparam1->GetADCchannel(iSM,iCol,iRow);
+
+ if (printAll)
+ printf("ID %d, col %d, row %d, sm %d final %1.4f, first %1.4f\n",
+ i,iCol,iRow,iSM,param, param1);
+ cparamnew->SetADCchannel (iSM,iCol,iRow,param );
+ cparamnew->SetADCchannelOnline(iSM,iCol,iRow,param1);
+ }
+
+ //Create OCDB File
+ AliCDBMetaData md;
+ md.SetComment("Calibration after calibration with pi0, store also first online calibration");
+ md.SetBeamPeriod(0);
+ md.SetResponsible("Gustavo Conesa");
+ md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
+
+ // Careful, select here the first run where this calibration is valid
+ Int_t firstRun = 172439; // 2012-13
+ if(year == 2010) firstRun = 113461;
+ if(year == 2011) firstRun = 144484;
+
+ AliCDBId id("EMCAL/Calib/Data",firstRun,AliCDBRunRange::Infinity()); // create in EMCAL/Calib/Data DBFolder
+
+ AliCDBManager* man = AliCDBManager::Instance();
+ AliCDBStorage* loc = man->GetStorage(Form("local://%d",year));
+ loc->Put(cparamnew, id, &md);
+}
+
+
-// Example to check the contents of a bad channels OCDB file locally
+// Example to check the contents of a bad channels OCDB file
+// either local file or alien file
// Author: Gustavo Conesa Balbastre (LPSC-Grenoble)
-void PrintBadChannels(char * file = "$ALICE_ROOT/OCDB/EMCAL/Calib/Pedestals/Run0_999999999_v0_s0.root")
+void PrintBadChannels(TString file =
+ "$ALICE_ROOT/OCDB/EMCAL/Calib/Pedestals/Run0_999999999_v0_s0.root"
+ "alien:///alice/data/2014/OCDB/EMCAL/Calib/Pedestals/Run0_999999999_v1_s0.root"
+ )
{
// Read status map
- TFile * f = new TFile(file,"READ");
+
+ if(file.Contains("alien:///"))
+ TGrid::Connect("alien://");
+
+ TFile * f = TFile::Open(file,"READ");
AliCDBEntry * cdb = (AliCDBEntry*) f->Get("AliCDBEntry");
AliCaloCalibPedestal * caloped = (AliCaloCalibPedestal *) cdb->GetObject();
TObjArray map = caloped->GetDeadMap();
-
- printf("MAP entries %d\n",map.GetEntries());
-
+ Int_t nHisto = map.GetEntries();
AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM");
+ printf ("N SM %d, array size %d\n",geom->GetNumberOfSuperModules(),nHisto);
+
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 ++)
- {
+ {
+ if(iSM >=nHisto || !(TH2D*)map[iSM]))
+ {
+ printf("No entry for SM %d, skip it!\n",iSM);
+ continue;
+ }
+
+ printf(">>> SM %d <<< Entries %d \n",iSM,((TH2D*)map[iSM])->GetEntries());
+
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++)