/// /// Update OADB Container for EMCal energy recalibration factors /// from external file. /// /// \param fileNameOADB: OADB file name and path /// \param fileNameRecalibFactors: name and path of input file with new factors /// void UpdateEMCAL_OADB_Recalib ( const char *fileNameOADB="EMCALRecalib_input4test.root", const char *fileNameRecalibFactors="/cebaf/cebaf/EMCAL/calibPi0_run2/createOCDB_4_with2015data_Nov2016finalCalib/multiplyPi0CalibrationFactors_TextToHisto_Final.root" ) { gSystem->Load("libOADB"); AliOADBContainer *con = new AliOADBContainer(""); con->InitFromFile(fileNameOADB, "AliEMCALRecalib"); //Updating the original OADB file, output will be written into BetaRecalib.root // **** Loading the root files with Recalibration Factors: TFile* fRecalibFactors=new TFile(fileNameRecalibFactors); TObjArray *arrayRecalibFactors = new TObjArray(kNbSMtot); arrayRecalibFactors->SetName("Recalib"); char name[30]; // Filling The objects above with the EMCALRecalFactors_SM Histos: for (Int_t iSM=0;iSM<kNbSMtot;iSM++){ cout<<"SM "<< iSM<<endl; sprintf(name,"EMCALRecalFactors_SM%d",iSM); cout<<"Recalib : "<<name<<endl; arrayRecalibFactors->Add(fRecalibFactors->Get(name)); } //iSM //******************************************************************** // Setting Periods //**** Adding pass object to period Object ****/ //When updating object that has already been created. For instance, adding pass2,3 etc. //Just get the object and add new array. Append of runnumber is already done in this case. /*TObjArray *array13b = (TObjArray*)con->GetObject(195345,"LHC13b"); TObjArray *array13c = (TObjArray*)con->GetObject(195529,"LHC13c"); TObjArray *array13d = (TObjArray*)con->GetObject(195681,"LHC13d"); TObjArray *array13e = (TObjArray*)con->GetObject(195935,"LHC13e"); TObjArray *array13f = (TObjArray*)con->GetObject(196433,"LHC13f"); TObjArray *array13b_pass3 = new TObjArray(kNbSMtot); array13b_pass3->SetName("pass3"); array13b_pass3->Add(*&arrayRecalibFactors); TObjArray *array13c_pass2 = new TObjArray(kNbSMtot); array13c_pass2->SetName("pass2"); array13c_pass2->Add(*&arrayRecalibFactors); TObjArray *array13d_pass2 = new TObjArray(kNbSMtot); array13d_pass2->SetName("pass2"); array13d_pass2->Add(*&arrayRecalibFactors); TObjArray *array13e_pass2 = new TObjArray(kNbSMtot); array13e_pass2->SetName("pass2"); array13e_pass2->Add(*&arrayRecalibFactors); TObjArray *array13f_pass2 = new TObjArray(kNbSMtot); array13f_pass2->SetName("pass2"); array13f_pass2->Add(*&arrayRecalibFactors); array13b->Add(*&array13b_pass3); array13c->Add(*&array13c_pass2); array13d->Add(*&array13d_pass2); array13e->Add(*&array13e_pass2); array13f->Add(*&array13f_pass2);*/ TObjArray *array15_pass1 = new TObjArray(kNbSMtot); TObjArray *array15_pass2 = new TObjArray(kNbSMtot); TObjArray *array15_pass3 = new TObjArray(kNbSMtot); array15_pass1->SetName("pass1"); array15_pass2->SetName("pass2"); array15_pass3->SetName("pass3"); array15_pass1->Add(*&arrayRecalibFactors); array15_pass2->Add(*&arrayRecalibFactors); array15_pass3->Add(*&arrayRecalibFactors); con->WriteToFile("BetaRecalib.root"); //test(195935); // If someone wants to test container }
void FillVZEROEPOADBFull(const char* filename = "AOD083.txt", Bool_t mbOnly = kFALSE) { gSystem->Load("libCore"); gSystem->Load("libTree"); gSystem->Load("libGeom"); gSystem->Load("libVMC"); gSystem->Load("libPhysics"); gSystem->Load("libMinuit"); gSystem->Load("libSTEERBase"); gSystem->Load("libESD"); gSystem->Load("libAOD"); gSystem->Load("libANALYSIS"); gSystem->Load("libANALYSISalice"); gSystem->Load("libOADB"); AliOADBContainer * oadbCont = new AliOADBContainer("vzeroEP"); { TList *defaultList = new TList; defaultList->SetName("Default"); TProfile *profHisto = NULL; TFile fInputDefault("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000170162.root"); TList *inputList = (TList*)fInputDefault.Get("coutput"); for(Int_t i = 0; i < 11; ++i) { profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i)); profHisto->SetDirectory(0); defaultList->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i)); profHisto->SetDirectory(0); defaultList->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i)); profHisto->SetDirectory(0); defaultList->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i)); profHisto->SetDirectory(0); defaultList->Add(profHisto); } fInputDefault.Close(); oadbCont->AddDefaultObject(defaultList); printf("Run 170162 filled\n"); } { TList *list1 = new TList; TProfile *profHisto = NULL; TFile fInput1("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000169683.root"); TList *inputList = (TList*)fInput1.Get("coutput"); for(Int_t i = 0; i < 11; ++i) { profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i)); profHisto->SetDirectory(0); list1->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i)); profHisto->SetDirectory(0); list1->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i)); profHisto->SetDirectory(0); list1->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i)); profHisto->SetDirectory(0); list1->Add(profHisto); } oadbCont->AppendObject(list1, 169683, 169683); printf("Run 169683 filled\n"); } // loop of over all other runs Int_t runList[500]; ifstream *fruns = new ifstream (filename); if (!*fruns) return; TString strLine; Int_t count = 0; while (strLine.ReadLine(*fruns)) { runList[count++] = strLine.Atoi(); } delete fruns; for(Int_t irun = 0; irun < count; ++irun) { TList *list2 = new TList; TProfile *profHisto = NULL; TFile fInput2(Form("csemi/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun])); TList *inputList = (TList*)fInput2.Get("coutput"); TFile fInput3(Form("cpbi2/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun])); TList *inputListBis = (TList*)fInput3.Get("coutput"); for(Int_t i = 0; i < 11; ++i) { profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i)); profHisto->SetDirectory(0); Int_t ibin = profHisto->FindBin(62.5); profHisto->SetBinContent(ibin,0); profHisto->SetBinError(ibin,0); profHisto->SetBinEntries(ibin,0); if (mbOnly) { profHisto = (TProfile*)inputListBis->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i)); profHisto->SetDirectory(0); } else profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2_%d",i))); list2->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i)); profHisto->SetDirectory(0); profHisto->SetBinContent(ibin,0); profHisto->SetBinError(ibin,0); profHisto->SetBinEntries(ibin,0); if (mbOnly) { profHisto = (TProfile*)inputListBis->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i)); profHisto->SetDirectory(0); } else profHisto->Add((TProfile*)inputListBis->FindObject(Form("fY2_%d",i))); list2->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i)); profHisto->SetDirectory(0); profHisto->SetBinContent(ibin,0); profHisto->SetBinError(ibin,0); profHisto->SetBinEntries(ibin,0); if (mbOnly) { profHisto = (TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i)); profHisto->SetDirectory(0); } else profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i))); list2->Add(profHisto); profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i)); profHisto->SetDirectory(0); profHisto->SetBinContent(ibin,0); profHisto->SetBinError(ibin,0); profHisto->SetBinEntries(ibin,0); if (mbOnly) { profHisto = (TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i)); profHisto->SetDirectory(0); } else profHisto->Add((TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i))); list2->Add(profHisto); } oadbCont->AppendObject(list2, runList[irun], runList[irun]); printf("Run %d filled\n",runList[irun]); } TString oadbFileName = Form("%s/COMMON/EVENTPLANE/data/vzero.root", AliAnalysisManager::GetOADBPath()); oadbCont->WriteToFile(oadbFileName.Data()); }