X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PWGPP%2FCalibMacros%2FCPass0%2FmakeOCDB.C;h=ac62db2f4be8d8a6b2689a8d388759f6b8ff709e;hb=bfa6f86241863205e6e3e8697578cd4eae05322e;hp=a41fdd65305a41202c58127bd72b44fe450d0346;hpb=f5d76b5917bacfd744ce75eab6af1d36c25c5ecb;p=u%2Fmrichter%2FAliRoot.git diff --git a/PWGPP/CalibMacros/CPass0/makeOCDB.C b/PWGPP/CalibMacros/CPass0/makeOCDB.C index a41fdd65305..ac62db2f4be 100644 --- a/PWGPP/CalibMacros/CPass0/makeOCDB.C +++ b/PWGPP/CalibMacros/CPass0/makeOCDB.C @@ -12,12 +12,12 @@ void printCalibStat(Int_t run, const char * fname, TTreeSRedirector * pcstream); - -void makeOCDB(Int_t runNumber, TString ocdbStorage="", TString defaultOCDBstorage="raw://") +void makeOCDB(Int_t runNumber, TString targetOCDBstorage="", TString sourceOCDBstorage="raw://") { // - // extract TPC OCDB entries + // extract OCDB entries for detectors participating in the calibration for the current run // + gROOT->Macro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/LoadLibraries.C"); gROOT->LoadMacro("$ALICE_ROOT/PWGPP/CalibMacros/CPass0/ConfigCalibTrain.C"); @@ -26,73 +26,84 @@ void makeOCDB(Int_t runNumber, TString ocdbStorage="", TString defaultOCDBstora // config GRP printf("runNumber from runCalibTrain = %d\n",runNumber); - ConfigCalibTrain(runNumber, defaultOCDBstorage.Data()); - // - // + ConfigCalibTrain(runNumber, sourceOCDBstorage.Data()); + // check the presence of the detectors AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); - AliGRPObject* grpData = dynamic_cast(entry->GetObject()); + AliGRPObject* grpData = dynamic_cast(entry->GetObject()); if (!grpData) {printf("Failed to get GRP data for run",runNumber); return;} - Int_t activeDetectors = grpData->GetDetectorMask(); + Int_t activeDetectors = grpData->GetDetectorMask(); TString detStr = AliDAQ::ListOfTriggeredDetectors(activeDetectors); printf("Detectors in the data:\n%s\n",detStr.Data()); - printf("Monalisa: Detectors in the data:\t%s\n",detStr.Data()); - // Steering Tasks - set output storage // DefaultStorage set already before - in ConfigCalibTrain.C -//ocdbStorage+="?se=ALICE::CERN::SE"; - AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data()); + // Setting the mirror SEs for the default storage + TString mirrorsStr("ALICE::CERN::OCDB,ALICE::FZK::SE,ALICE::LLNL::SE"); + AliCDBManager::Instance()->SetMirrorSEs(mirrorsStr.Data()); + printf("List of mirror SEs set to: \"%s\"\n",mirrorsStr.Data()); + + // activate target OCDB storage + AliCDBStorage* targetStorage = 0x0; + if (targetOCDBstorage.Length()==0) { + targetOCDBstorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; + targetStorage = AliCDBManager::Instance()->GetStorage(targetOCDBstorage.Data()); + } + else if (targetOCDBstorage.CompareTo("same",TString::kIgnoreCase) == 0 ){ + targetStorage = AliCDBManager::Instance()->GetDefaultStorage(); + } + else { + targetStorage = AliCDBManager::Instance()->GetStorage(targetOCDBstorage.Data()); + } + printf("** targetOCDBstorage: \"%s\"\n",targetOCDBstorage.Data()); + + // specific storage for TPC/Calib/Correction entry if (gSystem->AccessPathName("TPC", kFileExists)==0) { AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Correction","local://"); } - // set OCDB storage - if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB"; // TPC part - TFile fcalib("CalibObjects.root"); AliTPCPreprocessorOffline *procesTPC = 0; - if (detStr.Contains("TPC")){ - //if (0){ - procesTPC = new AliTPCPreprocessorOffline; + if (detStr.Contains("TPC")){ + Printf("\n******* Calibrating TPC *******"); + procesTPC = new AliTPCPreprocessorOffline; // switch on parameter validation - procesTPC->SetTimeGainRange(0.5,3.0); + procesTPC->SetTimeGainRange(0.5,5.0); + procesTPC->SetMaxVDriftCorr(0.2); + //procesTPC->SetMinTracksVdrift(100000); procesTPC->SwitchOnValidation(); - + // Make timegain calibration - //proces.CalibTimeGain("CalibObjects.root", runNumber,AliCDBRunRange::Infinity(),ocdbStorage); - procesTPC->CalibTimeGain("CalibObjects.root", runNumber,runNumber,ocdbStorage); + //proces.CalibTimeGain("CalibObjects.root", runNumber,AliCDBRunRange::Infinity(),targetOCDBstorage); + procesTPC->CalibTimeGain("CalibObjects.root", runNumber,runNumber,targetStorage); // Make vdrift calibration - //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),ocdbStorage); - procesTPC->CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,ocdbStorage); + //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),targetOCDBstorage); + procesTPC->CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,targetStorage); } - // + // TOF part - // AliTOFAnalysisTaskCalibPass0 *procesTOF=0; - if ( detStr.Contains("TOF")){ + if (detStr.Contains("TOF") && detStr.Contains("TPC")){ procesTOF = new AliTOFAnalysisTaskCalibPass0; - Printf("Calibrating TOF"); - procesTOF->ProcessOutput("CalibObjects.root", ocdbStorage); + Printf("\n******* Calibrating TOF *******"); + procesTOF->ProcessOutput("CalibObjects.root", targetStorage); } - // - // + // T0 part AliT0PreprocessorOffline *procesT0= 0; - if ( detStr.Contains("T0")) { + if (detStr.Contains("T0")) { + Printf("\n******* Calibrating T0 *******"); // Make calibration of channels offset - // procesT0.setDArun(179000); - procesT0= new AliT0PreprocessorOffline; - procesT0->Process("CalibObjects.root",runNumber, runNumber, ocdbStorage); + procesT0 = new AliT0PreprocessorOffline; + procesT0->Process("CalibObjects.root",runNumber, runNumber, targetStorage); } - // + //TRD part - // AliTRDPreprocessorOffline *procesTRD = 0; - if ( detStr.Contains("TRD")){ - //if (0){ + if (detStr.Contains("TRD") && detStr.Contains("TPC")){ + Printf("\n******* Calibrating TRD *******"); procesTRD = new AliTRDPreprocessorOffline; procesTRD->SetLinearFitForVdrift(kTRUE); procesTRD->SetMinStatsVdriftT0PH(600*10); @@ -111,14 +122,15 @@ void makeOCDB(Int_t runNumber, TString ocdbStorage="", TString defaultOCDBstora printf("version and subversion vdrift %d and %d\n",versionVdriftUsed,subversionVdriftUsed); printf("version and subversion gain %d and %d\n",versionGainUsed,subversionGainUsed); printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed); - procesTRD->Process("CalibObjects.root",runNumber,runNumber,ocdbStorage); + procesTRD->Process("CalibObjects.root",runNumber,runNumber,targetStorage); } //Mean Vertex AliMeanVertexPreprocessorOffline * procesMeanVtx=0; - if ( detStr.Contains("ITSSPD")) { - procesMeanVtx = new AliMeanVertexPreprocessorOffline; - procesMeanVtx->ProcessOutput("CalibObjects.root", ocdbStorage, runNumber); + if (detStr.Contains("ITSSPD")) { + Printf("\n******* Calibrating MeanVertex *******"); + procesMeanVtx = new AliMeanVertexPreprocessorOffline; + procesMeanVtx->ProcessOutput("CalibObjects.root", targetStorage, runNumber); } // @@ -127,14 +139,16 @@ void makeOCDB(Int_t runNumber, TString ocdbStorage="", TString defaultOCDBstora Int_t trdStatus = (procesTRD) ? procesTRD->GetStatus():0; Int_t tofStatus = (procesTOF) ? procesTOF->GetStatus():0; Int_t t0Status = (procesT0) ? procesT0->GetStatus():0; - Int_t tpcStatus = (procesTPC) ? ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE):0; + Int_t tpcStatus = (procesTPC) ? procesTPC->GetStatus():0; + Int_t meanVtxStatus = (procesMeanVtx) ? procesMeanVtx->GetStatus():0; // - printf("\n\n\n\n"); - printf("CPass0 calibration status\n"); + printf("\n"); + printf("******* CPass0 calibration status *******\n"); printf("TRD calibration status=%d\n",trdStatus); printf("TOF calibration status=%d\n",tofStatus); printf("TPC calibration status=%d\n",tpcStatus); printf("T0 calibration status=%d\n",t0Status); + printf("MeanVertex calibration status=%d\n",meanVtxStatus); // TTreeSRedirector *pcstream = new TTreeSRedirector("cpassStat.root","recreate"); printCalibStat(runNumber, "CalibObjects.root",pcstream); @@ -143,12 +157,10 @@ void makeOCDB(Int_t runNumber, TString ocdbStorage="", TString defaultOCDBstora } - - - - +// function to print statistics used to calibrate the various detectors void printCalibStat(Int_t run, const char * fname, TTreeSRedirector * pcstream){ + // // Dump the statistical information about all histograms in the calibration files // into the statistical tree, print on the screen (log files) as well @@ -164,10 +176,11 @@ void printCalibStat(Int_t run, const char * fname, TTreeSRedirector * pcstream) // - First version implemented by MI // // + TFile *fin = TFile::Open(fname); if (!fin) return; const Double_t kMaxHis=10000; - // + TList * keyList = fin->GetListOfKeys(); Int_t nkeys=keyList->GetEntries(); Double_t *hisEntries = new Double_t[kMaxHis]; @@ -178,142 +191,152 @@ void printCalibStat(Int_t run, const char * fname, TTreeSRedirector * pcstream) Int_t counter=0; if (pcstream) (*pcstream)<<"calibStatAll"<<"run="<Get(keyList->At(ikey)->GetName()); - if (!object) continue; - if (object->InheritsFrom("TCollection")==0) continue; - TSeqCollection *collection = (TSeqCollection*)object; - Int_t nentries= collection->GetEntries(); - for (Int_t ihis=0; ihisAt(ihis); - if (!ohis) continue; - if (ohis->InheritsFrom("TH1")==0) continue; - TH1* phis = (TH1*)ohis; - hisEntries[counter]=phis->GetEntries(); - Int_t idim=1; - if (ohis->InheritsFrom("TH2")) idim=2; - if (ohis->InheritsFrom("TH3")) idim=3; - hisMean[counter]=phis->GetMean(idim); - hisMeanError[counter]=phis->GetMeanError(idim); - hisRMS[counter]=phis->GetRMS(idim); - hisMaxBin[counter]=phis->GetBinCenter(phis->GetMaximumBin()); - if (pcstream) (*pcstream)<<"calibStatAll"<< - Form("%s_%sEntries=",keyList->At(ikey)->GetName(), phis->GetName())<At(ikey)->GetName(), phis->GetName(), hisEntries[counter],idim); - counter++; - } - delete object; - } - } - // + for (Int_t ikey=0; ikeyGet(keyList->At(ikey)->GetName()); + if (!object) continue; + if (object->InheritsFrom("TCollection")==0) continue; + TSeqCollection *collection = (TSeqCollection*)object; + Int_t nentries= collection->GetEntries(); + for (Int_t ihis=0; ihisAt(ihis); + if (!ohis) continue; + if (ohis->InheritsFrom("TH1")==0) continue; + TH1* phis = (TH1*)ohis; + hisEntries[counter]=phis->GetEntries(); + Int_t idim=1; + if (ohis->InheritsFrom("TH2")) idim=2; + if (ohis->InheritsFrom("TH3")) idim=3; + hisMean[counter]=phis->GetMean(idim); + hisMeanError[counter]=phis->GetMeanError(idim); + hisRMS[counter]=phis->GetRMS(idim); + hisMaxBin[counter]=phis->GetBinCenter(phis->GetMaximumBin()); + if (pcstream) (*pcstream)<<"calibStatAll"<< + Form("%s_%sEntries=",keyList->At(ikey)->GetName(), phis->GetName())<At(ikey)->GetName(), phis->GetName(), hisEntries[counter],idim); + counter++; + } + delete object; + } + // - // Expert dump example (MI first itteration): + // Expert dump example (MI first iteration): // // 0.) TOF dump // + Int_t tofEvents=0; Int_t tofTracks=0; TList * TOFCalib = (TList*)fin->Get("TOFHistos"); - {if (TOFCalib) { - TH1 *histoEvents = (TH1*) TOFCalib->FindObject("hHistoVertexTimestamp"); - TH1 *histoTracks = (TH1*)TOFCalib->FindObject("hHistoDeltatTimestamp"); - if (histoEvents && histoTracks){ - tofEvents= histoEvents->GetEntries(); - tofTracks= histoTracks->GetEntries(); - } - delete TOFCalib; - }} - printf("Monalisa TOFevents\t%f\n",tofEvents); + if (TOFCalib) { + TH1 *histoEvents = (TH1*)TOFCalib->FindObject("hHistoVertexTimestamp"); + TH1 *histoTracks = (TH1*)TOFCalib->FindObject("hHistoDeltatTimestamp"); + if (histoEvents && histoTracks){ + tofEvents = TMath::Nint(histoEvents->GetEntries()); + tofTracks = TMath::Nint(histoTracks->GetEntries()); + } + delete TOFCalib; + } + printf("Monalisa TOFevents\t%d\n",tofEvents); if (pcstream) (*pcstream)<<"calibStatAll"<<"TOFevents="<FindObject("calibTime"); - if (calibTime){ - tpcEvents = calibTime->GetTPCVertexHisto(0)->GetEntries(); - tpcTracks = calibTime->GetResHistoTPCITS(0)->GetEntries(); - } - }} - printf("Monalisa TPCevents\t%f\n",tpcEvents); + TObject* obj = dynamic_cast(fin->Get("TPCCalib")); + TObjArray* array = dynamic_cast(obj); + TDirectory* dir = dynamic_cast(obj); + AliTPCcalibTime * calibTime = NULL; + if (dir) { + calibTime = dynamic_cast(dir->Get("calibTime")); + } + else if (array){ + calibTime = (AliTPCcalibTime *)array->FindObject("calibTime"); + } + if (calibTime) { + tpcEvents = TMath::Nint(calibTime->GetTPCVertexHisto(0)->GetEntries()); + tpcTracks = TMath::Nint(calibTime->GetResHistoTPCITS(0)->GetEntries()); + } + printf("Monalisa TPCevents\t%d\n",tpcEvents); if (pcstream) (*pcstream)<<"calibStatAll"<<"TPCevents="<FindObject("NEventsInput_AliTRDCalibTask"); - TH1 *histoTracks = (TH1*)TRDCalib->FindObject("AbsoluteGain_AliTRDCalibTask"); - if (histoEvents && histoTracks){ - trdEvents= histoEvents->GetEntries(); - trdTracks= histoTracks->GetEntries(); - } - delete TRDCalib; - }} - printf("Monalisa TRDevents\t%f\n",trdEvents); + if (TRDCalib) { + TH1 *histoEvents = (TH1*)TRDCalib->FindObject("NEventsInput_AliTRDCalibTask"); + TH1 *histoTracks = (TH1*)TRDCalib->FindObject("AbsoluteGain_AliTRDCalibTask"); + if (histoEvents && histoTracks){ + trdEvents= TMath::Nint(histoEvents->GetEntries()); + trdTracks= TMath::Nint(histoTracks->GetEntries()); + } + delete TRDCalib; + } + printf("Monalisa TRDevents\t%d\n",trdEvents); if (pcstream) (*pcstream)<<"calibStatAll"<<"TRDevents="<FindObject("fTzeroORAplusORC"); - if (histoEvents && histoTracks){ - T0Events= histoEvents->GetEntries(); - } - delete T0Calib; - }} - printf("Monalisa T0events\t%f\n",T0Events); + if (T0Calib) { + TH1 *histoEvents = (TH1*) T0Calib->FindObject("fTzeroORAplusORC"); + if (histoEvents){ + T0Events= TMath::Nint(histoEvents->GetEntries()); + } + delete T0Calib; + } + printf("Monalisa T0events\t%d\n",T0Events); if (pcstream) (*pcstream)<<"calibStatAll"<<"T0events="<Get("MeanVertex"); - {if (MeanVertexCalib) { - TH1 *histoEvents = (TH1*) MeanVertexCalib->FindObject("hSPDVertexX"); - if (histoEvents && histoTracks){ - MeanVertexEvents= histoEvents->GetEntries(); - } - delete MeanVertexCalib; - }} - printf("Monalisa MeanVertexevents\t%f\n",MeanVertexEvents); - if (pcstream) (*pcstream)<<"calibStatAll"<<"MeanVertexevents="<Get("MeanVertex"); + if (meanVertexCalib) { + TH1 *histoEvents = (TH1*) meanVertexCalib->FindObject("hTRKVertexX"); + if (histoEvents){ + meanVertexEvents = TMath::Nint(histoEvents->GetEntries()); + } + delete meanVertexCalib; + } + printf("Monalisa MeanVertexevents\t%d\n",meanVertexEvents); + if (pcstream) (*pcstream)<<"calibStatAll"<<"MeanVertexevents="<Get("clistSDDCalib"); - {if (SDDCalib) { - TH1 *histoEvents = (TH1*) SDDCalib->FindObject("hNEvents"); - if (histoEvents ){ - sddEvents= histoEvents->GetBinContent(4); - sddTracks= histoEvents->GetBinContent(5); - } - delete SDDCalib; - }} - printf("Monalisa SDDevents\t%f\n",sddEvents); + if (SDDCalib) { + TH1 *histoEvents = (TH1*) SDDCalib->FindObject("hNEvents"); + if (histoEvents ){ + sddEvents = TMath::Nint(histoEvents->GetBinContent(4)); + sddTracks = TMath::Nint(histoEvents->GetBinContent(5)); + } + delete SDDCalib; + } + printf("Monalisa SDDevents\t%d\n",sddEvents); if (pcstream) (*pcstream)<<"calibStatAll"<<"SDDevents="<