expand trending functionality by generic PutTrendValue/GetTrendValue
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jun 2012 11:36:01 +0000 (11:36 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jun 2012 11:36:01 +0000 (11:36 +0000)
expand trending manager functionality

PWGPP/TRD/AliTRDefficiency.cxx
PWGPP/TRD/AliTRDefficiency.h
PWGPP/TRD/AliTRDrecoTask.cxx
PWGPP/TRD/AliTRDrecoTask.h
PWGPP/TRD/AliTRDresolution.cxx
PWGPP/TRD/info/AliTRDtrendingManager.cxx
PWGPP/TRD/info/AliTRDtrendingManager.h
PWGPP/TRD/macros/makeTrending.C
PWGPP/TRD/macros/makeTrendingDB.C

index b05a746..b9199e9 100644 (file)
@@ -25,6 +25,7 @@
 ////////////////////////////////////////////////////////////////////////////
 
 #include <TROOT.h>
+#include <TFile.h>
 #include <TStyle.h>
 #include <TClonesArray.h>
 #include <TObjArray.h>
@@ -126,7 +127,7 @@ TH1* AliTRDefficiency::PlotBasicEff(const AliTRDtrackV1 *track)
   }
   if(track) fkTrack = track;
 
-  Double_t val[11]; memset(val, 0, 11*sizeof(Double_t));
+  Double_t val[7]; memset(val, 0, 7*sizeof(Double_t));
   ULong_t status(fkESD->GetStatus());
   val[0] =((status&AliESDtrack::kTRDin)?1:0) +
           ((status&AliESDtrack::kTRDStop)?1:0) +
@@ -140,10 +141,10 @@ TH1* AliTRDefficiency::PlotBasicEff(const AliTRDtrackV1 *track)
     else if(fkMC->GetLabel() == -fkMC->GetTRDlabel()) val[4] = 1.;
     else val[4] = -1.;
   }
-  if(fkTrack){ // read track status in debug mode with friends
-    //val[4] = fkTrack->GetStatusTRD(-1);
-    for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++) val[5+ily]=fkTrack->GetStatusTRD(ily);
-  }
+  val[6] = 0;//fkTrack->GetNumberOfTracklets();
+  // down scale PID resolution
+  Int_t spc(fSpecies); if(spc==3) spc=2; if(spc==-3) spc=-2;
+  val[7] = spc;
   H->Fill(val);
   return NULL;
 }
@@ -445,13 +446,13 @@ TObjArray* AliTRDefficiency::Histos()
   //++++++++++++++++++++++
   // cluster to detector
   if(!(H = (THnSparseI*)gROOT->FindObject("hEFF"))){
-    const Int_t mdim(11);
+    const Int_t mdim(7);
     Int_t npt=DebugLevel()>=1?20:3;
     Int_t nlabel(1);
-    const Char_t *eTitle[mdim] = {"label", "#phi [rad]", "eta", "p_{t} [bin]", "label", "status[0]", "status[1]", "status[2]", "status[3]", "status[4]", "status[5]"};
-    const Int_t eNbins[mdim]   = {5, 180, 50, npt, nlabel, 5, 5, 5, 5, 5, 5};
-    const Double_t eMin[mdim]  = {-0.5, -TMath::Pi(), -1., -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5},
-                   eMax[mdim]  = {4.5, TMath::Pi(), 1., npt-.5, nlabel-0.5, 5.5, 5.5, 5.5, 5.5, 5.5, 5.5};
+    const Char_t *eTitle[mdim] = {"label", "#phi [rad]", "eta", "p_{t} [bin]", "MClabel", "n_trklt", "chg*spec*rc"};
+    const Int_t eNbins[mdim]   = {   5,         180,       50,         npt,      nlabel, AliTRDgeometry::kNlayer-2, 5};
+    const Double_t eMin[mdim]  = { -0.5,    -TMath::Pi(),  -1.,       -0.5,       -0.5,        0.5,               -2.5},
+                   eMax[mdim]  = {  4.5,     TMath::Pi(),   1.,       npt-.5,  nlabel-0.5,     4.5,                2.5};
     st = "basic efficiency;";
     // define minimum info to be saved in non debug mode
     Int_t ndim=DebugLevel()>=1?mdim:(HasMCdata()?5:4);
@@ -521,14 +522,40 @@ Bool_t AliTRDefficiency::MakeProjectionBasicEff()
   }
   AliInfo(Form("Build %3d 3D projections.", ih));
 
+  AliTRDrecoProjection *pr0(NULL), *pr1(NULL);
   Int_t istatus, ilab(0), coord[11]; memset(coord, 0, sizeof(Int_t) * 11); Double_t v = 0.;
   for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
     v = H->GetBinContent(ib, coord); if(v<1.) continue;
     istatus = coord[0]-1;
     if(al) ilab = coord[4];
     Int_t isel = ilab*5+istatus;
+    if(isel>=ih){
+      AliError(Form("Wrong selection %d [%3d]", isel, ih));
+      return kFALSE;
+    }
+    if(!(pr0=(AliTRDrecoProjection*)php.At(isel))) {
+      AliError(Form("Missing projection %d", isel));
+      return kFALSE;
+    }
+    if(strcmp(pr0->H()->GetName(), Form("HEff%d%d", ilab, istatus))!=0){
+      AliError(Form("Projection mismatch :: request[HEff%d%d] found[%s]", ilab, istatus, pr0->H()->GetName()));
+      return kFALSE;
+    }
     for(Int_t jh(0); jh<1/*np[isel]*/; jh++) ((AliTRDrecoProjection*)php.At(isel+jh))->Increment(coord, v);
   }
+  if(HasDump3D()){
+    TDirectory *cwd = gDirectory;
+    TFile::Open(Form("EffDump_%s.root", H->GetName()), "RECREATE");
+    for(Int_t ip(0); ip<php.GetEntriesFast(); ip++){
+      if(!(pr0 = (AliTRDrecoProjection*)php.At(ip))) continue;
+      if(!pr0->H()) continue;
+      TH3 *h3=(TH3*)pr0->H()->Clone();
+      h3->Write();
+    }
+    gFile->Close();
+    cwd->cd();
+  }
+
   TH2 *h2(NULL);  Int_t jh(0);
   for(; ih--; ){
     if(!hp[ih].H()) continue;
@@ -536,7 +563,6 @@ Bool_t AliTRDefficiency::MakeProjectionBasicEff()
     if((h2 = (TH2*)gDirectory->Get(Form("%sEn", hp[ih].H()->GetName())))) fProj->AddAt(h2, jh++);
   }
 
-  AliTRDrecoProjection *pr0(NULL), *pr1(NULL);
   AliTRDrecoProjection prLab;  TH2 *hLab[3] = {0}; TH1 *hpLab[3] = {0};
   for(ilab=0; ilab<nlab; ilab++){
     if(!(pr0 = (AliTRDrecoProjection*)php.FindObject(Form("HEff%d%d", ilab, 3)))) continue;
@@ -575,36 +601,48 @@ Bool_t AliTRDefficiency::MakeProjectionBasicEff()
   }
   // Tracked tracks
   if((pr0 = (AliTRDrecoProjection*)php.FindObject(Form("HEff%d%d", 0, 2)))) {
-    pr0->H()->SetNameTitle("H2EffT", "Efficiency :: Tracked Tracks");
+    pr0->H()->SetNameTitle("HEffT", "Efficiency :: Tracked Tracks");
     pr0->Projection2D(1, 10, -1, kFALSE);
     hEff[1] = (TH2*)gDirectory->Get(Form("%sEn", pr0->H()->GetName()));
+    // remove fakes
+    for(Int_t ix(1); ix<=hEff[1]->GetNbinsX(); ix++){
+      for(Int_t iy(1); iy<=hEff[1]->GetNbinsY(); iy++){
+        if(hEff[1]->GetBinContent(ix, iy)<5) hEff[1]->SetBinContent(ix, iy, 0.);
+    }}
     hpEff[1]= pr0->H()->Project3D("z");
   }
   // Propagated tracks
   if((pr0 = (AliTRDrecoProjection*)php.FindObject(Form("HEff%d%d", 0, 3)))) {
-    pr0->H()->SetNameTitle("HEffPrp", "Efficiency :: Propagated Tracks");
+    pr0->H()->SetNameTitle("HEffP", "Efficiency :: Propagated Tracks");
     pr0->Projection2D(1, 10, -1, kFALSE);
     hEff[2] = (TH2*)gDirectory->Get(Form("%sEn", pr0->H()->GetName()));
+    // remove fakes
+    for(Int_t ix(1); ix<=hEff[2]->GetNbinsX(); ix++){
+      for(Int_t iy(1); iy<=hEff[2]->GetNbinsY(); iy++){
+        if(hEff[2]->GetBinContent(ix, iy)<5) hEff[2]->SetBinContent(ix, iy, 0.);
+    }}
     hpEff[2]= pr0->H()->Project3D("z");
   }
   if(hEff[0]){
     if(hEff[1]){
-      hEff[1]->Divide(hEff[0]);
-      fProj->AddAt(hEff[1], jh++);
+      TH2 *hEff1 = (TH2*)hEff[1]->Clone(Form("%sN", hEff[1]->GetName()));
+      hEff1->Divide(hEff[0]);
+      fProj->AddAt(hEff1, jh++);
     }
     if(hEff[2]){
-      TH2 *hEff1 = (TH2*)hEff[2]->Clone("H2EffPEn");
+      TH2 *hEff1 = (TH2*)hEff[2]->Clone(Form("%sN", hEff[2]->GetName()));
       hEff1->Divide(hEff[0]);
       fProj->AddAt(hEff1, jh++);
     }
   }
   if(hpEff[0]){
     if(hpEff[1]){
-      hpEff[1]->Divide(hpEff[0]);
-      fProj->AddAt(hpEff[1], jh++);
+      TH1 *hpEff1 = (TH1*)hpEff[1]->Clone(Form("%sN", hpEff[1]->GetName()));
+      hpEff1->Divide(hpEff[0]);
+      fProj->AddAt(hpEff1, jh++);
     }
     if(hEff[2]){
-      TH1 *hpEff1 = (TH1*)hpEff[2]->Clone("H2EffP_z");
+      TH1 *hpEff1 = (TH1*)hpEff[2]->Clone(Form("%sN", hpEff[2]->GetName()));
       hpEff1->Divide(hpEff[0]);
       fProj->AddAt(hpEff1, jh++);
     }
@@ -613,15 +651,22 @@ Bool_t AliTRDefficiency::MakeProjectionBasicEff()
   if(hEff[2]){
     for(ilab=0; ilab<nlab; ilab++){
       if(!hLab[ilab]) continue;
-      hLab[ilab]->Divide(hEff[2]);
-      fProj->AddAt(hLab[ilab], jh++);
+      // remove fakes
+      TH2 *hEff1 = (TH2*)hLab[ilab]->Clone(Form("%sN", hLab[ilab]->GetName()));
+      for(Int_t ix(1); ix<=hLab[ilab]->GetNbinsX(); ix++){
+        for(Int_t iy(1); iy<=hLab[ilab]->GetNbinsY(); iy++){
+          if(hLab[ilab]->GetBinContent(ix, iy)<5) hEff1->SetBinContent(ix, iy, 0.);
+      }}
+      hEff1->Divide(hEff[2]);
+      fProj->AddAt(hEff1, jh++);
     }
   }
   if(hpEff[2]){
     for(ilab=0; ilab<nlab; ilab++){
       if(!hpLab[ilab]) continue;
-      hpLab[ilab]->Divide(hpEff[2]);
-      fProj->AddAt(hpLab[ilab], jh++);
+      TH1 *hpEff1 = (TH1*)hpLab[ilab]->Clone(Form("%sN", hpLab[ilab]->GetName()));
+      hpEff1->Divide(hpEff[2]);
+      fProj->AddAt(hpEff1, jh++);
     }
   }
   AliInfo(Form("Done %3d 2D projections.", jh));
@@ -663,8 +708,8 @@ void AliTRDefficiency::MakeSummary()
   cOut = new TCanvas(Form("%s_Eff", GetName()), "TRD Efficiency", 1536, 1536); cOut->Divide(2,2,1.e-5,1.e-5);
   // tracking eff :: eta-phi dependence
   for(Int_t it(0); it<2; it++){
-    if(!(h2 = (TH2*)fProj->FindObject(Form("H2Eff%cEn", cid[it])))) {
-      AliError(Form("Missing \"H2Eff%c\".", cid[it]));
+    if(!(h2 = (TH2*)fProj->FindObject(Form("HEff%cEnN", cid[it])))) {
+      AliError(Form("Missing \"HEff%cEnN\".", cid[it]));
       continue;
     }
     h2->SetContour(10); h2->Scale(1.e2); SetRangeZ(h2, 80, 100, 5);
@@ -681,12 +726,12 @@ void AliTRDefficiency::MakeSummary()
   h2->Draw("colz"); MakeDetectorPlot();
   // tracking eff :: pt dependence
   TH1 *h[2] = {0};
-  if(!(h[0] = (TH1*)fProj->FindObject("H2EffP_z"))){
-    AliError("Missing \"H2EffP_z\".");
+  if(!(h[0] = (TH1*)fProj->FindObject("HEffP_zN"))){
+    AliError("Missing \"HEffP_zN\".");
     return;
   }
-  if(!(h[1] = (TH1*)fProj->FindObject("H2EffT_z"))){
-    AliError("Missing \"H2EffT_z\".");
+  if(!(h[1] = (TH1*)fProj->FindObject("HEffT_zN"))){
+    AliError("Missing \"HEffT_zN\".");
     return;
   }
   TH1 *h1[3] = {0};
@@ -696,6 +741,8 @@ void AliTRDefficiency::MakeSummary()
     h1[il]->SetFillColor(color[il]);
     h1[il]->SetFillStyle(il==2?3002:1001);
     h1[il]->SetLineColor(color[il]);
+    h1[il]->SetMarkerStyle(4);
+    h1[il]->SetMarkerColor(color[il]);
     h1[il]->SetLineWidth(1);
   }
   for(Int_t ip(0);ip<=(nbins+1);ip++){
@@ -709,28 +756,29 @@ void AliTRDefficiency::MakeSummary()
   leg->SetBorderSize(0); leg->SetFillColor(kWhite); leg->SetFillStyle(1001);
   for(Int_t ic(0); ic<3;ic++){ hs->Add(h1[ic]);leg->AddEntry(h1[ic], labEff[ic], "f");}
   p=cOut->cd(4); p->SetLeftMargin(0.08266129); p->SetRightMargin(0.0141129);p->SetTopMargin(0.006355932);p->SetLogx();
-  hs->Draw(); leg->Draw();
+  hs->Draw(); //hs->Draw("same nostack,e1p");
+  leg->Draw();
   hs->GetXaxis()->SetRangeUser(0.6,10.);
   hs->GetXaxis()->SetMoreLogLabels();
   hs->GetXaxis()->SetTitleOffset(1.2);
   hs->GetYaxis()->SetNdivisions(513);
-  hs->SetMinimum(80.);
+  hs->SetMinimum(75.);
   hs->GetYaxis()->CenterTitle();
   cOut->SaveAs(Form("%s.gif", cOut->GetName()));
 
   cOut = new TCanvas(Form("%s_MC", GetName()), "TRD Label", 1536, 1536); cOut->Divide(2,2,1.e-5,1.e-5);
   for(Int_t ipad(0); ipad<3; ipad++){
     p=cOut->cd(ipad+1);p->SetRightMargin(0.1572581);p->SetTopMargin(0.08262712);
-    if(!(h2 = (TH2*)fProj->FindObject(Form("HEffLb%dEn", ipad)))) continue;
+    if(!(h2 = (TH2*)fProj->FindObject(Form("HEffLb%dEnN", ipad)))) continue;
     h2->SetContour(10);
-    h2->Scale(1.e2); SetRangeZ(h2, ipad==1?80:0., ipad==1?100.:10., ipad==1?30:0.01);
+    h2->Scale(1.e2); SetRangeZ(h2, ipad==1?50:0., ipad==1?90.:50., ipad==1?0.01:0.01);
     h2->GetZaxis()->SetTitle("Efficiency [%]"); h2->GetZaxis()->CenterTitle();
     h2->Draw("colz");
     MakeDetectorPlot();
   }
   color[0] = kRed; color[1] = kGreen; color[2] = kBlue;
   for(Int_t il=0;il<3;il++){
-    if(!(h[il] = (TH1D*)fProj->FindObject(Form("HEffLb%d_z", il)))) continue;
+    if(!(h[il] = (TH1D*)fProj->FindObject(Form("HEffLb%d_zN", il)))) continue;
     h1[il]=new TH1F(Form("h1Lab%d", il), "", nbins+2, ptBins);
     for(Int_t ip(0);ip<=(nbins+1);ip++) h1[il]->SetBinContent(ip+1, 1.e2*h[il]->GetBinContent(ip));
     h1[il]->SetFillColor(color[il]);
@@ -746,13 +794,13 @@ void AliTRDefficiency::MakeSummary()
   hs->Add(h1[2]);leg->AddEntry(h1[2], labMC[2], "f"); // accept
   hs->Add(h1[0]);leg->AddEntry(h1[0], labMC[0], "f"); // bad
   p=cOut->cd(4); p->SetLeftMargin(0.08266129); p->SetRightMargin(0.0141129);p->SetTopMargin(0.006355932); p->SetLogx();
-  hs->Draw(); leg->Draw();
+  hs->Draw(/*"nostack,e1p"*/); leg->Draw();
   cOut->Modified();cOut->Update();
   hs->GetXaxis()->SetRangeUser(0.6,10.);
   hs->GetXaxis()->SetMoreLogLabels();
   hs->GetXaxis()->SetTitleOffset(1.2);
   hs->GetYaxis()->SetNdivisions(513);
-  hs->SetMinimum(80.);
+  hs->SetMinimum(50.);
   hs->GetYaxis()->CenterTitle();
   cOut->SaveAs(Form("%s.gif", cOut->GetName()));
 }
index 10f9c49..538954e 100644 (file)
@@ -23,6 +23,9 @@ class TTreeSRedirector;
 class AliTRDefficiency : public AliTRDrecoTask
 {
 public:
+  enum ETRDefficiencySteer {
+     kDump    = BIT(18) // dump 3D projections
+  };
   AliTRDefficiency();
   AliTRDefficiency(char* name);
   virtual       ~AliTRDefficiency();
@@ -36,8 +39,10 @@ public:
   void          MakeSummary();
   Bool_t        PostProcess();
   TObjArray*    Results() const {return fProj;}
+  void          SetDump3D(const Bool_t dump=kTRUE)    { SetBit(kDump, dump);}
 protected:
   Bool_t        MakeProjectionBasicEff();
+  Bool_t        HasDump3D() const                     { return TestBit(kDump);}
 
 private:
   AliTRDefficiency(const AliTRDefficiency&);
index 1c8708d..a7be908 100644 (file)
@@ -650,6 +650,44 @@ void AliTRDrecoTask::AliTRDrecoProjection::Increment(Int_t bin[], Double_t v)
 }\r
 \r
 //________________________________________________________\r
+Double_t AliTRDrecoTask::AliTRDrecoProjection::GetTrendValue(const Int_t mid, Double_t *m, Double_t *s) const\r
+{\r
+//   Return result of fitting the main distribution (represented on the z axis) with the function selected\r
+// "mid". Optionally return the Mean and RMS of the distribution pointing to "m" and "s"\r
+\r
+  if(!fH){\r
+    AliDebug(1, Form("Missing 3D in %s", GetName()));\r
+    return -999.;\r
+  }\r
+  TH1 *h1s(NULL);\r
+  if(!(h1s = (TH2D*)fH->Project3D("z"))){\r
+    AliDebug(1, Form("Failed Project3D(\"z\") in %s", GetName()));\r
+    return -999.;\r
+  }\r
+  Int_t ne((Int_t)h1s->Integral());\r
+  if(ne<100){\r
+    AliDebug(1, Form("Statistics too low[%2d] in %s", ne, GetName()));\r
+    return -999.;\r
+  }\r
+  TAxis *az(h1s->GetXaxis());\r
+  Float_t vm(h1s->GetMean()), v(vm), ve(h1s->GetRMS());\r
+  if(mid==1){\r
+    TF1 fg("fg", "gaus", az->GetXmin(), az->GetXmax());\r
+    fg.SetParameter(0, Float_t(ne)); fg.SetParameter(1, vm); fg.SetParameter(2, ve);\r
+    h1s->Fit(&fg, "WQ0");\r
+    v = fg.GetParameter(1);\r
+  } else if (mid==2) {\r
+    TF1 fl("fl", "landau", az->GetXmin(), az->GetXmax());\r
+    fl.SetParameter(0, Float_t(ne)); fl.SetParameter(1, vm); fl.SetParameter(2, ve);\r
+    h1s->Fit(&fl, "WQ0");\r
+    v = fl.GetMaximumX();\r
+  }\r
+  if(m) *m = vm;\r
+  if(s) *s = ve;\r
+  return v;\r
+}\r
+\r
+//________________________________________________________\r
 TH2* AliTRDrecoTask::AliTRDrecoProjection::Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid, Bool_t del)\r
 {\r
 // build the 2D projection and adjust binning\r
index 8928111..1737da5 100644 (file)
@@ -50,12 +50,13 @@ public:
     virtual ~AliTRDrecoProjection();\r
     AliTRDrecoProjection& operator+=(const AliTRDrecoProjection& other);\r
     AliTRDrecoProjection& operator=(const AliTRDrecoProjection& other);\r
-    void  Build(const Char_t *n, const Char_t *t, Int_t ix, Int_t iy, Int_t iz, TAxis *aa[]);\r
-    void  Increment(Int_t bin[], Double_t v);\r
-    TH3*  H() const { return fH;}\r
-    TH2*  Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid=0, Bool_t del=kTRUE);\r
-    void  SetRebinStrategy(Int_t n, Int_t rebx[], Int_t reby[]);\r
-    void  SetShowRange(Float_t zm, Float_t zM, Float_t em=0., Float_t eM=0.) {fRange[0] = zm; fRange[1] = zM; fRange[2] = em; fRange[3] = eM;}\r
+    void      Build(const Char_t *n, const Char_t *t, Int_t ix, Int_t iy, Int_t iz, TAxis *aa[]);\r
+    Double_t  GetTrendValue(const Int_t mid=0, Double_t *m=NULL, Double_t *s=NULL) const;\r
+    TH3*      H() const { return fH;}\r
+    void      Increment(Int_t bin[], Double_t v);\r
+    TH2*      Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid=0, Bool_t del=kTRUE);\r
+    void      SetRebinStrategy(Int_t n, Int_t rebx[], Int_t reby[]);\r
+    void      SetShowRange(Float_t zm, Float_t zM, Float_t em=0., Float_t eM=0.) {fRange[0] = zm; fRange[1] = zM; fRange[2] = em; fRange[3] = eM;}\r
   private:\r
     AliTRDrecoProjection(const AliTRDrecoProjection&);\r
   protected:\r
index 7a55ff4..1bce3a6 100644 (file)
@@ -1170,10 +1170,8 @@ void AliTRDresolution::MakeSummary()
             continue;
           }
           nplot++;
-          if(vTrkInOpt[iview]==0){
-            h2->Draw("colz");
-            PutTrendValue(vTrkInName[iview][iplot], GetMeanStat(h2, -10., ">"));
-          } else DrawSigma(h2, ttt[iplot], min[iplot], max[iplot]);
+          if(vTrkInOpt[iview]==0) h2->Draw("colz");
+          else DrawSigma(h2, ttt[iplot], min[iplot], max[iplot]);
           MakeDetectorPlot(0);
         }
         if(nplot==6) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
@@ -1224,7 +1222,6 @@ void AliTRDresolution::MakeSummary()
             }
             nplot++;
             h2->Draw("colz");
-            PutTrendValue(Form("TrkIn%s%s%d", chQ[iq], chName[ich], ispec), GetMeanStat(h2, -10., ">"));
             MakeDetectorPlot(0);
           }
         }
@@ -2186,6 +2183,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
   }
   // build combined performance plots
   // combine up the tree of projections
+  Double_t m(0.), s(0.), trend(0.);
   AliTRDrecoProjection xlow[2], specY[kNcharge*kNspc], specPh[kNcharge*kNspc], specQ[kNcharge*kNspc];
   for(Int_t ich(0); ich<kNcharge; ich++){
     // PID dependency - summation over pt
@@ -2213,12 +2211,15 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
         specPh[idx].H()->SetNameTitle(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[ich], isp),
                               Form("TrackIn[%s%c]:: #Delta#phi", spcName[isp], chSgn[ich]));
         specPh[idx].SetShowRange(-1.5, 1.5);
+        PutTrendValue(Form("TrkInPh%c%c%d", chName[ich], ptName[0], isp), specPh[idx].GetTrendValue(1));
         for(Int_t ipt(1); ipt<nPt; ipt++){
           if(!(pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+          PutTrendValue(Form("TrkInPh%c%c%d", chName[ich], ptName[ipt], isp), pr1->GetTrendValue(1));
           specPh[idx]+=(*pr1);
         }
         php.AddLast(&specPh[idx]);
         if((h2 = specPh[idx].Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+        PutTrendValue(Form("TrkInPh%c%d", chName[ich], isp), specPh[idx].GetTrendValue(1));
         if(ich && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specPh[idx];
       }
       /*!dQdl*/
@@ -2229,8 +2230,16 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
                               Form("TrackIn[%s%c]:: dQdl", spcName[isp], chSgn[ich]));
         specQ[idx].SetShowRange(-2.2, -1.75);
         specQ[idx].H()->GetZaxis()->SetTitle("dQdl [a.u.]");
+        if((trend = specQ[idx].GetTrendValue(2, &m))>-100.){
+          PutTrendValue(Form("TrkInQ%c%c%d", chName[ich], ptName[0], isp), trend);
+          PutTrendValue(Form("TrkInQS%c%c%d", chName[ich], ptName[0], isp), m);
+        }
         for(Int_t ipt(1); ipt<nPt; ipt++){
           if(!(pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInQ%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+          if((trend=pr1->GetTrendValue(2, &m))>-100.){
+            PutTrendValue(Form("TrkInQ%c%c%d", chName[ich], ptName[ipt], isp), trend);
+            PutTrendValue(Form("TrkInQS%c%c%d", chName[ich], ptName[ipt], isp), m);
+          }
           specQ[idx]+=(*pr1);
         }
         php.AddLast(&specQ[idx]);
@@ -2238,6 +2247,10 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
         specQ[idx].H()->SetName(Form("H%sTrkInQS%c%d", mc?"MC":"", chName[ich], isp));
         specQ[idx].SetShowRange(-1.85, -1.4);
         if((h2 = specQ[idx].Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+        if((trend=specQ[idx].GetTrendValue(2, &m))>-100.){
+          PutTrendValue(Form("TrkInQ%c%d", chName[ich], isp), trend);
+          PutTrendValue(Form("TrkInQS%c%d", chName[ich], isp), m);
+        }
         if(ich && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specQ[idx];
       }
     } // end PID loop for pt integration
@@ -2254,6 +2267,10 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
                                   Form("TrackIn[%c]:: #Deltay{%s}", chSgn[ich], ptCut[ipt]));
         pr0->SetShowRange(-0.3, 0.3);
         if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+        if((trend=pr0->GetTrendValue(1,&m,&s))>-100.){
+          PutTrendValue(Form("TrkInY%c%c", chName[ich], ptName[ipt]), trend);
+          PutTrendValue(Form("TrkInYS%c%c", chName[ich], ptName[ipt]), s);
+        }
         if(ipt && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))) (*pr1)+=(*pr0);
       }
       /*!dphi*/
@@ -2265,6 +2282,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
         pr0->H()->SetNameTitle(Form("H%sTrkInPh%c%c", mc?"MC":"", chName[ich], ptName[ipt]),
                                   Form("TrackIn[%c]:: #Delta#phi{%s}", chSgn[ich], ptCut[ipt]));
         if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+        PutTrendValue(Form("TrkInPh%c%c", chName[ich], ptName[ipt]), pr0->GetTrendValue(1));
         if(ipt && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))) (*pr1)+=(*pr0);
       }
       /*!dx*/
@@ -2276,6 +2294,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
         pr0->H()->SetNameTitle(Form("H%sTrkInX%c%c", mc?"MC":"", chName[ich], ptName[ipt]),
                                   Form("TrackIn[%c]:: #Deltax{%s}", chSgn[ich], ptCut[ipt]));
         if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+        PutTrendValue(Form("TrkInX%c%c", chName[ich], ptName[ipt]), pr0->GetTrendValue(1));
         if(!ipt){
           xlow[ich] = (*pr0);
           xlow[ich].SetNameTitle(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[0], 5),
@@ -2293,6 +2312,10 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
       pr0->SetShowRange(-0.3, 0.3);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 1, kFALSE))) arr->AddAt(h2, jh++);
       if((h2 = (TH2*)gDirectory->Get(Form("%sEn", pr0->H()->GetName())))) arr->AddAt(h2, jh++);
+      if((trend=pr0->GetTrendValue(1, &m, &s))>-100.){
+        PutTrendValue(Form("TrkInY%c", chName[ich]), trend);
+        PutTrendValue(Form("TrkInYS%c", chName[ich]), s);
+      }
       if(ich && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
     }
     /*!dy high pt*/
@@ -2310,6 +2333,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
                             Form("TrackIn[%c]:: #Delta#phi", chSgn[ich]));
       pr0->SetShowRange(-1., 1.);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+      PutTrendValue(Form("TrkInPh%c", chName[ich]), pr0->GetTrendValue(1));
       if(ich==1 && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
     }
     /*!dx*/
@@ -2317,6 +2341,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
       pr0->H()->SetNameTitle(Form("H%sTrkInX%c", mc?"MC":"", chName[ich]),
                             Form("TrackIn[%c]:: #Deltax", chSgn[ich]));
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+      PutTrendValue(Form("TrkInX%c", chName[ich]), pr0->GetTrendValue(1));
       if(ich==1 && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
     }
     /*!dx low pt*/
@@ -2342,6 +2367,7 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
       pr0->H()->SetNameTitle(Form("H%sTrkInPh%d", mc?"MC":"", isp), Form("TrackIn[%s] :: #Delta#phi", spcName[isp]));
       pr0->SetShowRange(-1., 1.);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+      PutTrendValue(Form("TrkInPh%d", isp), pr0->GetTrendValue(1));
     }
     /*!dQdl*/
     if((pr0 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[0], isp)))){
@@ -2351,6 +2377,10 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
       pr0->H()->SetName(Form("H%sTrkInQS%d", mc?"MC":"", isp));
       pr0->SetShowRange(-1.85, -1.4);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+      if((trend=pr0->GetTrendValue(2, &m))>-100.){
+        PutTrendValue(Form("TrkInQ%d", isp), trend);
+        PutTrendValue(Form("TrkInQS%d", isp), m);
+      }
     }
   } // end PID processing
 
index e7b05c4..b15c5b4 100644 (file)
@@ -186,7 +186,7 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
         AliWarning(Form("Missing %09d.%s", rno, TV->GetName()));
         continue;
       }
-      (*tv)/=(*TV);
+      if(IsRelativeMeanSigma()) (*tv)/=(*TV);
       if(!g[it]){
         g[it] = new TGraph();
         g[it]->SetNameTitle(TV->GetName(), TV->GetTitle());
@@ -200,17 +200,26 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
   // Draw
   TH1 *hT = new TH1F("hT", ";#bf{RUN};", nr, -0.5, nr-0.5);
   TAxis *ax = hT->GetXaxis(); ax->SetTitleOffset(2.6);ax->CenterTitle(); ax->SetBit(TAxis::kLabelsVert);
-  TAxis *ay = hT->GetYaxis(); ay->SetTitleOffset(0.4);ay->CenterTitle(); ay->SetAxisColor(kRed); ay->SetRangeUser(-5, 5);
+  TAxis *ay = hT->GetYaxis(); ay->SetTitleOffset(IsRelativeMeanSigma()?0.4:0.75);ay->CenterTitle(); ay->SetAxisColor(kRed); ay->SetDecimals();
   for(Int_t ir(0); ir<nr; ir++) ax->SetBinLabel(ir+1, Form("%09d", run[ir]));
 
   TCanvas *c = new TCanvas("c", "TRD Trend", 1, 1, 1200, 500);
-  c->SetLeftMargin(0.03666361);
+  c->SetLeftMargin(IsRelativeMeanSigma()?0.03666361:0.05685619);
   c->SetRightMargin(0.005499542);
   c->SetTopMargin(0.02542373);
   c->SetBottomMargin(0.1758475);
   for(Int_t it(0); it<ntv; it++){
+    if(!g[it]) continue;
     c->Clear();
-    ay->SetTitle(Form("#bf{%s [#sigmau]}", g[it]->GetTitle())); hT->Draw("p");
+    if(IsRelativeMeanSigma()){
+      ay->SetRangeUser(-5, 5);
+      ay->SetTitle(Form("#bf{%s [#sigmau]}", g[it]->GetTitle()));
+    } else {
+      if(!(TV = (AliTRDtrendValue*)fEntries->At(it))) continue;
+      ay->SetRangeUser(TV->GetVal()-3*TV->GetErr(), TV->GetVal()+3*TV->GetErr());
+      ay->SetTitle(Form("#bf{%s}", g[it]->GetTitle()));
+    }
+    hT->Draw("p");
     g[it]->Draw("p");
     c->Modified(); c->Update(); c->SaveAs(Form("Trend_%s.gif", g[it]->GetName()));
     delete g[it];
index 15cb246..ce1c1d5 100644 (file)
@@ -24,6 +24,9 @@ class TObjArray;
 class AliTRDtrendingManager : public TObject
 {
 public:
+  enum AliTRDtrendingManagerSteer{
+    kRelative    = BIT(14) // trending plots normalized to mean/sigma
+  };
   virtual ~AliTRDtrendingManager();
   void              AddValue(const Char_t *name
                             ,Double_t mean,Double_t sigm=1
@@ -34,6 +37,7 @@ public:
                             );
   AliTRDtrendValue* GetValue(const Char_t *name);
   static AliTRDtrendingManager*        Instance();
+  Bool_t            IsRelativeMeanSigma() const     { return TestBit(kRelative);}
   void              Load(const char *fn = "$ALICE_ROOT/PWGPP/TRD/data/TRD.Trend.root");
   Bool_t            MakeTrends(const char *fileList);
   Bool_t            ModifyValue(const Char_t *name
@@ -45,6 +49,7 @@ public:
                             );
   void              Print(Option_t *o="") const;
 //  void              ResetRunRange(Int_t runStart, Int_t runStop) {fRunRange[0]=runStart; fRunRange[1]=runStop;}
+  void              SetRelativeMeanSigma(Bool_t set=kTRUE) { SetBit(kRelative, set);}
   void              Terminate();
 
 protected:
index bb885b4..2952bbd 100644 (file)
@@ -1,4 +1,4 @@
-void makeTrending(const Char_t *fl, const Char_t *db = "$ALICE_ROOT/PWGPP/TRD/data/TRD.Trend.root")
+void makeTrending(const Char_t *fl, const Char_t *db = "$ALICE_ROOT/PWGPP/TRD/data/TRD.Trend.root", Bool_t relative=kFALSE)
 {
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libANALYSISalice.so");
@@ -9,6 +9,7 @@ void makeTrending(const Char_t *fl, const Char_t *db = "$ALICE_ROOT/PWGPP/TRD/da
 
   AliTRDtrendingManager *tm = AliTRDtrendingManager::Instance();
   tm->Load(db);
+  tm->SetRelativeMeanSigma(relative);
   tm->MakeTrends(fl);
   return;
 }
index 985be4a..884c89e 100644 (file)
@@ -1,3 +1,16 @@
+#if ! defined (__CINT__) || defined (__MAKECINT__)
+#include "TSystem.h"
+#include "TROOT.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TH1.h"
+#include "TF1.h"
+#include "TCanvas.h"
+#include "TError.h"
+#include "PWGPP/TRD/info/AliTRDtrendingManager.h"
+
+#endif
+
 void makeTrendingDB(const Char_t *fl)
 {
 // Make trending of variable list "tl" from trending file list "fl"
@@ -10,7 +23,7 @@ void makeTrendingDB(const Char_t *fl)
   gSystem->Load("libPWGPP.so");
   gSystem->Load("libPWGmuon.so");
 
-  const Int_t nt(45);
+  const Int_t nt(167);
   const Char_t *tvn[nt][2] = {
     {"TRDcheckDET_NTracksEvent", "<N_{track}/Event>"},
     {"TRDcheckDET_NTracksEventRMS", "RMS(N_{track}/Event)"},
@@ -27,37 +40,159 @@ void makeTrendingDB(const Char_t *fl)
     {"TRDcheckDET_PHslope", "Slope(<PH>)"},
     {"TRDcheckDET_PHamplificationPeak", "Peak(<PH>)"},
 //=======================================================
-    {"TRDresolution_TrkInY", "#Deltay (TrkIn)"},
-    {"TRDresolution_TrkInYn", "#Deltay^{-} (TrkIn)"},
-    {"TRDresolution_TrkInYp", "#Deltay^{+} (TrkIn)"},
-    {"TRDresolution_TrkInRCZ", "#Deltaz (TrkIn)"},
-    {"TRDresolution_TrkInPhn", "#Delta#phi^{-} (TrkIn)"},
-    {"TRDresolution_TrkInPhp", "#Delta#phi^{+} (TrkIn)"},
-    {"TRDresolution_TrkInQp0", "MPV(dQdl^{e+}) (TrkIn)"},
-    {"TRDresolution_TrkInQp1", "MPV(dQdl^{#mu+}) (TrkIn)"},
-    {"TRDresolution_TrkInQp2", "MPV(dQdl^{#pi+}) (TrkIn)"},
-    {"TRDresolution_TrkInQp3", "MPV(dQdl^{K+}) (TrkIn)"},
-    {"TRDresolution_TrkInQp4", "MPV(dQdl^{p+}) (TrkIn)"},
-    {"TRDresolution_TrkInQn0", "MPV(dQdl^{e-}) (TrkIn)"},
-    {"TRDresolution_TrkInQn1", "MPV(dQdl^{#mu-}) (TrkIn)"},
-    {"TRDresolution_TrkInQn2", "MPV(dQdl^{#pi-}) (TrkIn)"},
-    {"TRDresolution_TrkInQn3", "MPV(dQdl^{K-}) (TrkIn)"},
-    {"TRDresolution_TrkInQn4", "MPV(dQdl^{p-}) (TrkIn)"},
-    {"TRDresolution_TrkInQ0", "MPV(dQdl^{e}) (TrkIn)"},
-    {"TRDresolution_TrkInQ1", "MPV(dQdl^{#mu}) (TrkIn)"},
-    {"TRDresolution_TrkInQ2", "MPV(dQdl^{#pi}) (TrkIn)"},
-    {"TRDresolution_TrkInQ3", "MPV(dQdl^{K}) (TrkIn)"},
-    {"TRDresolution_TrkInQ4", "MPV(dQdl^{p}) (TrkIn)"},
-    {"TRDresolution_TrkInQSp0", "<dQdl^{e+}> (TrkIn)"},
-    {"TRDresolution_TrkInQSp1", "<dQdl^{#mu+}> (TrkIn)"},
-    {"TRDresolution_TrkInQSp2", "<dQdl^{pi+}> (TrkIn)"},
-    {"TRDresolution_TrkInQSp3", "<dQdl^{K+}> (TrkIn)"},
-    {"TRDresolution_TrkInQSp4", "<dQdl^{p+}> (TrkIn)"},
-    {"TRDresolution_TrkInQSn0", "<dQdl^{e-}> (TrkIn)"},
-    {"TRDresolution_TrkInQSn1", "<dQdl^{#mu-}> (TrkIn)"},
-    {"TRDresolution_TrkInQSn2", "<dQdl^{#pi-}> (TrkIn)"},
-    {"TRDresolution_TrkInQSn3", "<dQdl^{K-}> (TrkIn)"},
-    {"TRDresolution_TrkInQSn4", "<dQdl^{p-}> (TrkIn)"}
+    {"TRDresolution_TrkInPhnL0", "TrkIn :: <#Delta#phi>^{e-}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhnl0", "TrkIn :: <#Delta#phi>^{e-}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhni0", "TrkIn :: <#Delta#phi>^{e-}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhnh0", "TrkIn :: <#Delta#phi>^{e-}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhnH0", "TrkIn :: <#Delta#phi>^{e-}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhn0", "TrkIn :: <#Delta#phi>^{e-} [deg]"},
+    {"TRDresolution_TrkInQnL0", "TrkIn :: MPV(dQdl)^{e-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQnl0", "TrkIn :: MPV(dQdl)^{e-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQni0", "TrkIn :: MPV(dQdl)^{e-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQnh0", "TrkIn :: MPV(dQdl)^{e-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQnH0", "TrkIn :: MPV(dQdl)^{e-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQn0", "TrkIn :: MPV(dQdl)^{e-} [a.u.]"},
+    {"TRDresolution_TrkInQSnL0", "TrkIn :: <dQdl>^{e-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnl0", "TrkIn :: <dQdl>^{e-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSni0", "TrkIn :: <dQdl>^{e-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnh0", "TrkIn :: <dQdl>^{e-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSnH0", "TrkIn :: <dQdl>^{e-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSn0", "TrkIn :: <dQdl>^{e-} [a.u.]"},
+    {"TRDresolution_TrkInPhnL1", "TrkIn :: <#Delta#phi>^{#mu#pi-}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhnl1", "TrkIn :: <#Delta#phi>^{#mu#pi-}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhni1", "TrkIn :: <#Delta#phi>^{#mu#pi-}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhnh1", "TrkIn :: <#Delta#phi>^{#mu#pi-}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhnH1", "TrkIn :: <#Delta#phi>^{#mu#pi-}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhn1", "TrkIn :: <#Delta#phi>^{#mu#pi-} [deg]"},
+    {"TRDresolution_TrkInQnL1", "TrkIn :: MPV(dQdl)^{#mu#pi-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQnl1", "TrkIn :: MPV(dQdl)^{#mu#pi-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQni1", "TrkIn :: MPV(dQdl)^{#mu#pi-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQnh1", "TrkIn :: MPV(dQdl)^{#mu#pi-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQnH1", "TrkIn :: MPV(dQdl)^{#mu#pi-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQn1", "TrkIn :: MPV(dQdl)^{#mu#pi-} [a.u.]"},
+    {"TRDresolution_TrkInQSnL1", "TrkIn :: <dQdl>^{#mu#pi-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnl1", "TrkIn :: <dQdl>^{#mu#pi-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSni1", "TrkIn :: <dQdl>^{#mu#pi-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnh1", "TrkIn :: <dQdl>^{#mu#pi-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSnH1", "TrkIn :: <dQdl>^{#mu#pi-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSn1", "TrkIn :: <dQdl>^{#mu#pi-} [a.u.]"},
+    {"TRDresolution_TrkInPhnL2", "TrkIn :: <#Delta#phi>^{Kp-}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhnl2", "TrkIn :: <#Delta#phi>^{Kp-}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhni2", "TrkIn :: <#Delta#phi>^{Kp-}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhnh2", "TrkIn :: <#Delta#phi>^{Kp-}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhnH2", "TrkIn :: <#Delta#phi>^{Kp-}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhn2", "TrkIn :: <#Delta#phi>^{Kp-} [deg]"},
+    {"TRDresolution_TrkInQnL2", "TrkIn :: MPV(dQdl)^{Kp-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQnl2", "TrkIn :: MPV(dQdl)^{Kp-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQni2", "TrkIn :: MPV(dQdl)^{Kp-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQnh2", "TrkIn :: MPV(dQdl)^{Kp-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQnH2", "TrkIn :: MPV(dQdl)^{Kp-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQn2", "TrkIn :: MPV(dQdl)^{Kp-} [a.u.]"},
+    {"TRDresolution_TrkInQSnL2", "TrkIn :: <dQdl>^{Kp-}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnl2", "TrkIn :: <dQdl>^{Kp-}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSni2", "TrkIn :: <dQdl>^{Kp-}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSnh2", "TrkIn :: <dQdl>^{Kp-}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSnH2", "TrkIn :: <dQdl>^{Kp-}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSn2", "TrkIn :: <dQdl>^{Kp-} [a.u.]"},
+    {"TRDresolution_TrkInYnL", "TrkIn :: <#Deltay>^{-}(p_{t}[GeV/c]<0.5) [cm]"},
+    {"TRDresolution_TrkInYSnL", "TrkIn :: RMS(#Deltay)^{-}(p_{t}[GeV/c]<0.5) [cm]"},
+    {"TRDresolution_TrkInPhnL", "TrkIn :: <#Delta#phi>^{-}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInYnl", "TrkIn :: <#Deltay>^{-}(0.5<=p_{t}[GeV/c]<0.8) [cm]"},
+    {"TRDresolution_TrkInYSnl", "TrkIn :: RMS(#Deltay)^{-}(0.5<=p_{t}[GeV/c]<0.8) [cm]"},
+    {"TRDresolution_TrkInPhnl", "TrkIn :: <#Delta#phi>^{-}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInYni", "TrkIn :: <#Deltay>^{-}(0.8<=p_{t}[GeV/c]<1.5) [cm]"},
+    {"TRDresolution_TrkInYSni", "TrkIn :: RMS(#Deltay)^{-}(0.8<=p_{t}[GeV/c]<1.5) [cm]"},
+    {"TRDresolution_TrkInPhni", "TrkIn :: <#Delta#phi>^{-}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInYnh", "TrkIn :: <#Deltay>^{-}(1.5<=p_{t}[GeV/c]<5.0) [cm]"},
+    {"TRDresolution_TrkInYSnh", "TrkIn :: RMS(#Deltay)^{-}(1.5<=p_{t}[GeV/c]<5.0) [cm]"},
+    {"TRDresolution_TrkInPhnh", "TrkIn :: <#Delta#phi>^{-}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInYnH", "TrkIn :: <#Deltay>^{-}(5.0<=p_{t}[GeV/c]) [cm]"},
+    {"TRDresolution_TrkInYSnH", "TrkIn :: RMS(#Deltay)^{-}(5.0<=p_{t}[GeV/c]) [cm]"},
+    {"TRDresolution_TrkInPhnH", "TrkIn :: <#Delta#phi>^{-}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInYn", "TrkIn :: <#Deltay>^{-} [cm]"},
+    {"TRDresolution_TrkInYSn", "TrkIn :: RMS(#Deltay)^{-} [cm]"},
+    {"TRDresolution_TrkInPhn", "TrkIn :: <#Delta#phi>^{-} [deg]"},
+    {"TRDresolution_TrkInPhpL0", "TrkIn :: <#Delta#phi>^{e+}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhpl0", "TrkIn :: <#Delta#phi>^{e+}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhpi0", "TrkIn :: <#Delta#phi>^{e+}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhph0", "TrkIn :: <#Delta#phi>^{e+}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhpH0", "TrkIn :: <#Delta#phi>^{e+}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhp0", "TrkIn :: <#Delta#phi>^{e+} [deg]"},
+    {"TRDresolution_TrkInQpL0", "TrkIn :: MPV(dQdl)^{e+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQpl0", "TrkIn :: MPV(dQdl)^{e+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQpi0", "TrkIn :: MPV(dQdl)^{e+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQph0", "TrkIn :: MPV(dQdl)^{e+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQpH0", "TrkIn :: MPV(dQdl)^{e+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQp0", "TrkIn :: MPV(dQdl)^{e+} [a.u.]"},
+    {"TRDresolution_TrkInQSpL0", "TrkIn :: <dQdl>^{e+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSpl0", "TrkIn :: <dQdl>^{e+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSpi0", "TrkIn :: <dQdl>^{e+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSph0", "TrkIn :: <dQdl>^{e+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSpH0", "TrkIn :: <dQdl>^{e+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSp0", "TrkIn :: <dQdl>^{e+} [a.u.]"},
+    {"TRDresolution_TrkInPhpL1", "TrkIn :: <#Delta#phi>^{#mu#pi+}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhpl1", "TrkIn :: <#Delta#phi>^{#mu#pi+}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhpi1", "TrkIn :: <#Delta#phi>^{#mu#pi+}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhph1", "TrkIn :: <#Delta#phi>^{#mu#pi+}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhpH1", "TrkIn :: <#Delta#phi>^{#mu#pi+}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhp1", "TrkIn :: <#Delta#phi>^{#mu#pi+} [deg]"},
+    {"TRDresolution_TrkInQpL1", "TrkIn :: MPV(dQdl)^{#mu#pi+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQpl1", "TrkIn :: MPV(dQdl)^{#mu#pi+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQpi1", "TrkIn :: MPV(dQdl)^{#mu#pi+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQph1", "TrkIn :: MPV(dQdl)^{#mu#pi+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQpH1", "TrkIn :: MPV(dQdl)^{#mu#pi+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQp1", "TrkIn :: MPV(dQdl)^{#mu#pi+} [a.u.]"},
+    {"TRDresolution_TrkInQSpL1", "TrkIn :: <dQdl>^{#mu#pi+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSpl1", "TrkIn :: <dQdl>^{#mu#pi+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSpi1", "TrkIn :: <dQdl>^{#mu#pi+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSph1", "TrkIn :: <dQdl>^{#mu#pi+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSpH1", "TrkIn :: <dQdl>^{#mu#pi+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSp1", "TrkIn :: <dQdl>^{#mu#pi+} [a.u.]"},
+    {"TRDresolution_TrkInPhpL2", "TrkIn :: <#Delta#phi>^{Kp+}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInPhpl2", "TrkIn :: <#Delta#phi>^{Kp+}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInPhpi2", "TrkIn :: <#Delta#phi>^{Kp+}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInPhph2", "TrkIn :: <#Delta#phi>^{Kp+}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInPhpH2", "TrkIn :: <#Delta#phi>^{Kp+}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInPhp2", "TrkIn :: <#Delta#phi>^{Kp+} [deg]"},
+    {"TRDresolution_TrkInQpL2", "TrkIn :: MPV(dQdl)^{Kp+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQpl2", "TrkIn :: MPV(dQdl)^{Kp+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQpi2", "TrkIn :: MPV(dQdl)^{Kp+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQph2", "TrkIn :: MPV(dQdl)^{Kp+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQpH2", "TrkIn :: MPV(dQdl)^{Kp+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQp2", "TrkIn :: MPV(dQdl)^{Kp+} [a.u.]"},
+    {"TRDresolution_TrkInQSpL2", "TrkIn :: <dQdl>^{Kp+}(p_{t}[GeV/c]<0.5) [a.u.]"},
+    {"TRDresolution_TrkInQSpl2", "TrkIn :: <dQdl>^{Kp+}(0.5<=p_{t}[GeV/c]<0.8) [a.u.]"},
+    {"TRDresolution_TrkInQSpi2", "TrkIn :: <dQdl>^{Kp+}(0.8<=p_{t}[GeV/c]<1.5) [a.u.]"},
+    {"TRDresolution_TrkInQSph2", "TrkIn :: <dQdl>^{Kp+}(1.5<=p_{t}[GeV/c]<5.0) [a.u.]"},
+    {"TRDresolution_TrkInQSpH2", "TrkIn :: <dQdl>^{Kp+}(5.0<=p_{t}[GeV/c]) [a.u.]"},
+    {"TRDresolution_TrkInQSp2", "TrkIn :: <dQdl>^{Kp+} [a.u.]"},
+    {"TRDresolution_TrkInYpL", "TrkIn :: <#Deltay>^{+}(p_{t}[GeV/c]<0.5) [cm]"},
+    {"TRDresolution_TrkInYSpL", "TrkIn :: RMS(#Deltay)^{+}(p_{t}[GeV/c]<0.5) [cm]"},
+    {"TRDresolution_TrkInPhpL", "TrkIn :: <#Delta#phi>^{+}(p_{t}[GeV/c]<0.5) [deg]"},
+    {"TRDresolution_TrkInYpl", "TrkIn :: <#Deltay>^{+}(0.5<=p_{t}[GeV/c]<0.8) [cm]"},
+    {"TRDresolution_TrkInYSpl", "TrkIn :: RMS(#Deltay)^{+}(0.5<=p_{t}[GeV/c]<0.8) [cm]"},
+    {"TRDresolution_TrkInPhpl", "TrkIn :: <#Delta#phi>^{+}(0.5<=p_{t}[GeV/c]<0.8) [deg]"},
+    {"TRDresolution_TrkInYpi", "TrkIn :: <#Deltay>^{+}(0.8<=p_{t}[GeV/c]<1.5) [cm]"},
+    {"TRDresolution_TrkInYSpi", "TrkIn :: RMS(#Deltay)^{+}(0.8<=p_{t}[GeV/c]<1.5) [cm]"},
+    {"TRDresolution_TrkInPhpi", "TrkIn :: <#Delta#phi>^{+}(0.8<=p_{t}[GeV/c]<1.5) [deg]"},
+    {"TRDresolution_TrkInYph", "TrkIn :: <#Deltay>^{+}(1.5<=p_{t}[GeV/c]<5.0) [cm]"},
+    {"TRDresolution_TrkInYSph", "TrkIn :: RMS(#Deltay)^{+}(1.5<=p_{t}[GeV/c]<5.0) [cm]"},
+    {"TRDresolution_TrkInPhph", "TrkIn :: <#Delta#phi>^{+}(1.5<=p_{t}[GeV/c]<5.0) [deg]"},
+    {"TRDresolution_TrkInYpH", "TrkIn :: <#Deltay>^{+}(5.0<=p_{t}[GeV/c]) [cm]"},
+    {"TRDresolution_TrkInYSpH", "TrkIn :: RMS(#Deltay)^{+}(5.0<=p_{t}[GeV/c]) [cm]"},
+    {"TRDresolution_TrkInPhpH", "TrkIn :: <#Delta#phi>^{+}(5.0<=p_{t}[GeV/c]) [deg]"},
+    {"TRDresolution_TrkInYp", "TrkIn :: <#Deltay>^{+} [cm]"},
+    {"TRDresolution_TrkInYSp", "TrkIn :: RMS(#Deltay)^{+} [cm]"},
+    {"TRDresolution_TrkInPhp", "TrkIn :: <#Delta#phi>^{+} [deg]"},
+    {"TRDresolution_TrkInPh0", "TrkIn :: <#Delta#phi>^{e} [deg]"},
+    {"TRDresolution_TrkInQ0", "TrkIn :: MPV(dQdl)^{e} [a.u.]"},
+    {"TRDresolution_TrkInQS0", "TrkIn :: <dQdl>^{e} [a.u.]"},
+    {"TRDresolution_TrkInPh1", "TrkIn :: <#Delta#phi>^{#mu#pi} [deg]"},
+    {"TRDresolution_TrkInQ1", "TrkIn :: MPV(dQdl)^{#mu#pi} [a.u.]"},
+    {"TRDresolution_TrkInQS1", "TrkIn :: <dQdl>^{#mu#pi} [a.u.]"},
+    {"TRDresolution_TrkInPh2", "TrkIn :: <#Delta#phi>^{Kp} [deg]"},
+    {"TRDresolution_TrkInQ2", "TrkIn :: MPV(dQdl)^{Kp} [a.u.]"},
+    {"TRDresolution_TrkInQS2", "TrkIn :: <dQdl>^{Kp} [a.u.]"}
   };
   const char *resName[] = {"Markus Fasel", "Alexandru Bercuci"},
              *resMail[] = {"M.Fasel@gsi.de", "A.Bercuci@gsi.de"};
@@ -78,7 +213,11 @@ void makeTrendingDB(const Char_t *fl)
     for(Int_t it(0); it<nt; it++){
       val[it] = -999;
       if(!(tv = (AliTRDtrendValue*)gFile->Get(tvn[it][0]))) {
-        Warning("makeTrendingDB()", "Missing %s", tvn[it][0]);
+        Warning("makeTrendingDB()", "Missing %s from %s", tvn[it][0], sfp.Data());
+        continue;
+      }
+      if((strstr(tvn[it][0], "QS") || strstr(tvn[it][0], "YS")) &&tv->GetVal() < 1.e-5){
+        Info("makeTrendingDB()", "Found bad value for %s[%f] in %s", tvn[it][0], tv->GetVal(), sfp.Data());
         continue;
       }
       val[it] = tv->GetVal();
@@ -102,20 +241,27 @@ void makeTrendingDB(const Char_t *fl)
     notifiable+=notMail[inot];
     if(inot<4) notifiable+=",";
   }
-  TF1 f("f", "gaus", -100, 100);
+  TF1 f("f", "gaus", -100, 100); TH1 *h(NULL);
   AliTRDtrendingManager *tm = AliTRDtrendingManager::Instance();
   TCanvas *c = new TCanvas("c", "Trend Distrib.", 10, 10, 500, 500);
   Int_t ntr=tDB->GetEntries();
   for(Int_t it(0); it<nt; it++){
     tDB->Draw(tvn[it][0], "", "goff");
     Double_t *v = tDB->GetV1(), xmin(100.), xmax(-100);
+    Int_t ntr0(0);
     for(Int_t ir=0; ir<ntr; ir++){
       if(v[ir]<-100) continue;
+      ntr0++;
       if(v[ir]<xmin) xmin = v[ir];
       if(v[ir]>xmax) xmax = v[ir];
     }
-    TH1 *h = new TH1F("h", Form(";%s;entries", tvn[it][0]), 10, 0.5*(3*xmin-xmax), 0.5*(3*xmax - xmin));
-    tDB->Draw(Form("%s>>h", tvn[it][0]), Form("%s>-100", tvn[it][0]));
+    if(ntr0<10){
+      Warning("makeTrendingDB", "Couldn't create entry %s. Too few values %d", tvn[it][0], ntr0);
+      continue;
+    }
+    if((h =(TH1F*)gROOT->FindObject("hp"))){delete h; h = NULL;}
+    h = new TH1F("hp", Form(";%s;entries", tvn[it][0]), 10, 0.5*(3*xmin-xmax), 0.5*(3*xmax - xmin));
+    tDB->Draw(Form("%s>>hp", tvn[it][0]), Form("%s>-100", tvn[it][0]));
     if(h->Integral() < 1) continue;
     f.SetParameter(0, h->Integral());
     f.SetParameter(1, h->GetMean());
@@ -125,9 +271,17 @@ void makeTrendingDB(const Char_t *fl)
 
     // write trending value to manager
     Info("makeTrendingDB", "%s [%f - %f] %f[%f]", tvn[it][0], xmin, xmax, f.GetParameter(1), f.GetParameter(2));
-    tm->AddValue(tvn[it][0], f.GetParameter(1), f.GetParameter(2),
-      tvn[it][1], res[it>13], notifiable);
-    delete h;
+    Double_t m(0.), s(0.);
+    if(strstr(tvn[it][0], "TrkInY")) {
+      m=0.; s=0.1;
+    } else if(strstr(tvn[it][0], "TrkInPh")) {
+      m=0.; s=0.35;
+    } else if(strstr(tvn[it][0], "TrkInQ") || strstr(tvn[it][0], "TrkInQS")) {
+      m=-2.; s=0.2;
+    } else {
+      m=f.GetParameter(1); s=f.GetParameter(2);
+    }
+    tm->AddValue(tvn[it][0], m, s, tvn[it][1], res[it>13], notifiable);
   }
   tm->Terminate();