]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix coverity
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 May 2012 06:58:07 +0000 (06:58 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 May 2012 06:58:07 +0000 (06:58 +0000)
update make trend graphs

PWGPP/TRD/AliTRDcheckPID.cxx
PWGPP/TRD/info/AliTRDtrendValue.cxx
PWGPP/TRD/macros/makeTrending.C
PWGPP/TRD/macros/makeTrendingDB.C

index 764121451ff2d1f91b8bc01efcc3bf4008bd06d8..59b99798baaacdb8812e67e9810a6d91b4a8ec19 100644 (file)
@@ -1170,7 +1170,7 @@ Bool_t AliTRDcheckPID::GetRefFigure(Int_t ifig)
         h->SetMaximum(20.);
         h->GetXaxis()->SetRangeUser(0., 35.);
         kFIRST = kFALSE;
-      } else h = (TH1F*)h1->DrawClone("samec");
+      } else /*h = (TH1F*)*/h1->DrawClone("samec");
 
 //      legNClus->AddEntry(h, Form("%s", AliTRDCalPID::GetPartName(is)), "l");
     }
index cc6e873da8ab090351a37ae787f9be8b35756b95..c825dfef37dfe28cc02eaa15f57e60da1d373bd0 100644 (file)
@@ -120,7 +120,7 @@ const char* AliTRDtrendValue::GetResponsible() const
 const char* AliTRDtrendValue::GetNotifiable(Int_t in) const
 {
 // Get noticible person "in" with name and mail
-  if(in<0||in>kNnotifiable) return NULL;
+  if(in<0||in>=kNnotifiable) return NULL;
   if(!fNotifiable[in]) return NULL;
   return Form("%s <%s>", fNotifiable[in]->GetName(), fNotifiable[in]->GetTitle());
 }
index 5046ab9f4bd5e383ca4c5507d1b6b538d406d8e4..bb885b49d70c88427553ffbf46cdb9d0300f2518 100644 (file)
@@ -1,4 +1,4 @@
-void makeTrending(const Char_t *fl)
+void makeTrending(const Char_t *fl, const Char_t *db = "$ALICE_ROOT/PWGPP/TRD/data/TRD.Trend.root")
 {
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libANALYSISalice.so");
@@ -8,8 +8,8 @@ void makeTrending(const Char_t *fl)
   gSystem->Load("libPWGmuon.so");
 
   AliTRDtrendingManager *tm = AliTRDtrendingManager::Instance();
-  tm->Load();
+  tm->Load(db);
   tm->MakeTrends(fl);
-  return /*task*/;
+  return;
 }
 
index 41a0cb5d1a819a7463cd82ea75555c04f0041a6f..985be4a48b0075b3301cf0d62d8e271a60689e38 100644 (file)
@@ -102,19 +102,32 @@ void makeTrendingDB(const Char_t *fl)
     notifiable+=notMail[inot];
     if(inot<4) notifiable+=",";
   }
+  TF1 f("f", "gaus", -100, 100);
   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]);
-    TH1 *h = (TH1*)gROOT->FindObject("htemp");
-    h->Fit("gaus", "WQ");
-    c->Modified(); c->Update(); c->SaveAs(Form("%s.gif", tvn[it][0]));
+    tDB->Draw(tvn[it][0], "", "goff");
+    Double_t *v = tDB->GetV1(), xmin(100.), xmax(-100);
+    for(Int_t ir=0; ir<ntr; ir++){
+      if(v[ir]<-100) continue;
+      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(h->Integral() < 1) continue;
+    f.SetParameter(0, h->Integral());
+    f.SetParameter(1, h->GetMean());
+    f.SetParameter(2, h->GetRMS());
+    h->Fit(&f, "WQ");
+    c->Modified(); c->Update(); c->SaveAs(Form("Fit_%s.gif", tvn[it][0]));
 
     // write trending value to manager
-    TF1 *f = h->GetFunction("gaus");
-    printf("%s %f[%f] %f[%f]\n", tvn[it][0], h->GetMean(), f->GetParameter(1), h->GetRMS(), f->GetParameter(2));
-    tm->AddValue(tvn[it][0], h->GetMean()/*f->GetParameter(1)*/, h->GetRMS()/*f->GetParameter(2)*/,
+    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;
   }
   tm->Terminate();