]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new macro to generate OCDB entries for PIDThresholds (Markus)
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Dec 2008 08:33:27 +0000 (08:33 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Dec 2008 08:33:27 +0000 (08:33 +0000)
TRD/Cal/AliTRDmakePIDThresholds.C [new file with mode: 0644]
TRD/qaRec/AliTRDpidChecker.h

diff --git a/TRD/Cal/AliTRDmakePIDThresholds.C b/TRD/Cal/AliTRDmakePIDThresholds.C
new file mode 100644 (file)
index 0000000..5b1137d
--- /dev/null
@@ -0,0 +1,69 @@
+//_______________________________________________________
+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");
+  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);
+  }
+}
+
index e26bcd6f67dd677294a57dc0efeb5b5f9a1bb705..9ed0881becf0debf9875e65b473115b848a79e76 100644 (file)
@@ -53,7 +53,7 @@ public:
   TH1 *PlotMom(const AliTRDtrackV1 *track = 0x0);
   TH1 *PlotMomBin(const AliTRDtrackV1 *track = 0x0);
 
-
+  TObjArray *GetGraphs() { return fGraph; };
   virtual TObjArray *Histos();
 
 private: