//_______________________________________________________
void AliTRDmakePIDThresholds(TString filename){
if(gSystem->Load("libANALYSIS.so")<0) return;
if(gSystem->Load("libTRDqaRec.so")<0) return;
const TString histnames[4] = {"fHistThreshLQ",
"fHistThreshNN",
"fHistPionEffLQ",
"fHistPionEffNN"};
const TString histtitles[4] = {"PID Thresholds for the 2D Likelihood Method",
"PID Thresholds for the Neural Network Method",
"Pion Efficiency for the 2D Likelihood Method",
"Pion Efficiency for the Neural Network Method"};
const Int_t pos[4] = {3 + AliTRDpidChecker::kLQ,
3 + AliTRDpidChecker::kNN,
AliTRDpidChecker::kLQ,
AliTRDpidChecker::kNN};
AliTRDpidChecker pidchecker;
pidchecker.SetDebugLevel(2);
pidchecker.Load(filename.Data());
pidchecker.PostProcess();
TObjArray *fGraph = pidchecker.GetGraphs();
// Save the thresholds
TObjArray *histos = new TObjArray;
TH1F *histo_thresh = 0x0;
for(Int_t ihist = 0; ihist < 4; ihist++){
g = (TGraphErrors*)fGraph->At(pos[ihist]);
histo_thresh = CreateHistogram(histnames[ihist], histtitles[ihist]);
CovertHisto(g, histo_thresh);
histos->AddAt(histo_thresh, ihist);
}
AliCDBMetaData *metaData= new AliCDBMetaData();
metaData->SetObjectClassName("TObjArray");
metaData->SetResponsible("Alexander Wilk");
metaData->SetBeamPeriod(1);
metaData->SetAliRootVersion("05-21-01"); //root version
metaData->SetComment("TRD PID thresholds based on 90\% electron efficiency");
AliCDBId id("TRD/Calib/PIDThresholds", 0, AliCDBRunRange::Infinity());
AliCDBManager *man = AliCDBManager::Instance();
AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB");
if (!gStorLoc) {
return;
}
gStorLoc->Put(histos, id, metaData);
return;
}
//_______________________________________________________
TH1F *CreateHistogram(TString &histname, TString &histtitle){
const Float_t fTrackMomentum[AliTRDCalPID::kNMom + 1] = { 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 11.0};
return new TH1F(histname.Data(), histtitle.Data(), AliTRDCalPID::kNMom, fTrackMomentum);
}
//_______________________________________________________
void CovertHisto(TGraphErrors *g, TH1F *h){
Double_t x, y, dy;
for(Int_t ibin = 1; ibin <= h->GetNbinsX(); ibin++){
g->GetPoint(ibin - 1, x, y);
dy = g->GetErrorY(ibin -1);
h->SetBinContent(ibin, y);
h->SetBinError(ibin, dy);
}
}
AliTRDmakePIDThresholds.C:1 AliTRDmakePIDThresholds.C:2 AliTRDmakePIDThresholds.C:3 AliTRDmakePIDThresholds.C:4 AliTRDmakePIDThresholds.C:5 AliTRDmakePIDThresholds.C:6 AliTRDmakePIDThresholds.C:7 AliTRDmakePIDThresholds.C:8 AliTRDmakePIDThresholds.C:9 AliTRDmakePIDThresholds.C:10 AliTRDmakePIDThresholds.C:11 AliTRDmakePIDThresholds.C:12 AliTRDmakePIDThresholds.C:13 AliTRDmakePIDThresholds.C:14 AliTRDmakePIDThresholds.C:15 AliTRDmakePIDThresholds.C:16 AliTRDmakePIDThresholds.C:17 AliTRDmakePIDThresholds.C:18 AliTRDmakePIDThresholds.C:19 AliTRDmakePIDThresholds.C:20 AliTRDmakePIDThresholds.C:21 AliTRDmakePIDThresholds.C:22 AliTRDmakePIDThresholds.C:23 AliTRDmakePIDThresholds.C:24 AliTRDmakePIDThresholds.C:25 AliTRDmakePIDThresholds.C:26 AliTRDmakePIDThresholds.C:27 AliTRDmakePIDThresholds.C:28 AliTRDmakePIDThresholds.C:29 AliTRDmakePIDThresholds.C:30 AliTRDmakePIDThresholds.C:31 AliTRDmakePIDThresholds.C:32 AliTRDmakePIDThresholds.C:33 AliTRDmakePIDThresholds.C:34 AliTRDmakePIDThresholds.C:35 AliTRDmakePIDThresholds.C:36 AliTRDmakePIDThresholds.C:37 AliTRDmakePIDThresholds.C:38 AliTRDmakePIDThresholds.C:39 AliTRDmakePIDThresholds.C:40 AliTRDmakePIDThresholds.C:41 AliTRDmakePIDThresholds.C:42 AliTRDmakePIDThresholds.C:43 AliTRDmakePIDThresholds.C:44 AliTRDmakePIDThresholds.C:45 AliTRDmakePIDThresholds.C:46 AliTRDmakePIDThresholds.C:47 AliTRDmakePIDThresholds.C:48 AliTRDmakePIDThresholds.C:49 AliTRDmakePIDThresholds.C:50 AliTRDmakePIDThresholds.C:51 AliTRDmakePIDThresholds.C:52 AliTRDmakePIDThresholds.C:53 AliTRDmakePIDThresholds.C:54 AliTRDmakePIDThresholds.C:55 AliTRDmakePIDThresholds.C:56 AliTRDmakePIDThresholds.C:57 AliTRDmakePIDThresholds.C:58 AliTRDmakePIDThresholds.C:59 AliTRDmakePIDThresholds.C:60 AliTRDmakePIDThresholds.C:61 AliTRDmakePIDThresholds.C:62 AliTRDmakePIDThresholds.C:63 AliTRDmakePIDThresholds.C:64 AliTRDmakePIDThresholds.C:65 AliTRDmakePIDThresholds.C:66 AliTRDmakePIDThresholds.C:67 AliTRDmakePIDThresholds.C:68 AliTRDmakePIDThresholds.C:69 AliTRDmakePIDThresholds.C:70