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