]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add new mergeable classes for chamber status and trigger statistics
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Aug 2012 10:41:22 +0000 (10:41 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Aug 2012 10:41:22 +0000 (10:41 +0000)
add trigger selection option for TRDrecoTask
fix memory leaks due to wrong usage of TString::Tokenize
update style/functionality for trending
clean unused code

22 files changed:
PWGPP/PWGPPLinkDef.h
PWGPP/TRD/AliTRDcheckESD.cxx
PWGPP/TRD/AliTRDinfoGen.cxx
PWGPP/TRD/AliTRDpwgppHelper.cxx
PWGPP/TRD/AliTRDrecoTask.cxx
PWGPP/TRD/AliTRDrecoTask.h
PWGPP/TRD/AliTRDresolution.cxx
PWGPP/TRD/AliTRDresolution.h
PWGPP/TRD/info/AliTRDchmbInfo.cxx [new file with mode: 0644]
PWGPP/TRD/info/AliTRDchmbInfo.h [new file with mode: 0644]
PWGPP/TRD/info/AliTRDeventCuts.cxx
PWGPP/TRD/info/AliTRDeventInfo.cxx
PWGPP/TRD/info/AliTRDeventInfo.h
PWGPP/TRD/info/AliTRDtrendValue.cxx
PWGPP/TRD/info/AliTRDtrendingManager.cxx
PWGPP/TRD/info/AliTRDtrendingManager.h
PWGPP/TRD/info/AliTRDtriggerInfo.cxx [new file with mode: 0644]
PWGPP/TRD/info/AliTRDtriggerInfo.h [new file with mode: 0644]
PWGPP/TRD/macros/AddTRDresolution.C
PWGPP/TRD/macros/makeResults.C
PWGPP/TRD/macros/makeTrending.C
PWGPP/TRD/macros/makeTrendingDB.C

index 4eec38f677f44ddaa5b68b6f1f506f22671dc8ad..a574d4b622a336d7329817865ab0455bbd3d861c 100644 (file)
@@ -86,6 +86,8 @@
 #pragma link C++ class  AliTRDtrendValue+;
 #pragma link C++ class  AliTRDtrendingManager+;
 #pragma link C++ class  AliTRDclusterInfo+;
+#pragma link C++ class  AliTRDtriggerInfo+;
+#pragma link C++ class  AliTRDchmbInfo+;
 #pragma link C++ class  AliTRDv0Info+;
 #pragma link C++ class  AliTRDtrackInfo+;
 #pragma link C++ class  AliTRDtrackInfo::AliESDinfo+;
index 582ed5800fdc1e97f8b3f9a2e2920bf76e1d1d5b..b9a6ec4e7daffeaf5c520de5caa412511715b398 100644 (file)
@@ -783,7 +783,7 @@ void AliTRDcheckESD::UserExec(Option_t *){
   }  // end loop over tracks\r
   \r
   \r
-  \r
+  triggers->Delete(); delete triggers;\r
   delete [] valuesMatchingPhiEtaCF;\r
   delete [] valuesMatchingPtCF;\r
   delete [] valuesBCCF;\r
@@ -1281,6 +1281,8 @@ void AliTRDcheckESD::InitializeCFContainers() {
         // Assign an index into the trigger histogram and the CF container for this trigger\r
         GetTriggerIndex(arr2->At(jt)->GetName(), kTRUE);\r
       }\r
+      arr2->Delete(); delete arr2;\r
+      arr->Delete(); delete arr;\r
     }\r
   }\r
   // Add background triggers from PhysicsSelection\r
@@ -1295,6 +1297,8 @@ void AliTRDcheckESD::InitializeCFContainers() {
         // Assign an index into the trigger histogram and the CF container for this trigger\r
         GetTriggerIndex(arr2->At(jt)->GetName(), kTRUE);\r
       }\r
+      arr2->Delete(); delete arr2;\r
+      arr->Delete(); delete arr;\r
     }\r
   }\r
   if(!fNAssignedTriggers) {GetTriggerIndex("All triggers", kTRUE);}\r
@@ -1304,6 +1308,7 @@ void AliTRDcheckESD::InitializeCFContainers() {
   for(Int_t it=0; it<arr->GetEntries(); ++it) {\r
     GetTriggerIndex(arr->At(it)->GetName(), kTRUE);\r
   }\r
+  arr->Delete(); delete arr;\r
 }\r
 \r
 \r
@@ -1459,9 +1464,10 @@ AliCFContainer* AliTRDcheckESD::CreateCFContainer(const Char_t* name, const Char
        nVars++;\r
       }\r
       else {\r
-       TObjArray* arr = fExpertCFVarBins[ivar].Tokenize(";");\r
-       nBins[nVars] = arr->GetEntries()-1;\r
-       if(nBins[nVars]>0) nVars++;\r
+        TObjArray* arr = fExpertCFVarBins[ivar].Tokenize(";");\r
+        nBins[nVars] = arr->GetEntries()-1;\r
+        if(nBins[nVars]>0) nVars++;\r
+        arr->Delete(); delete arr;\r
       }\r
     }\r
     if(nVars<1) return 0x0;\r
@@ -1471,18 +1477,19 @@ AliCFContainer* AliTRDcheckESD::CreateCFContainer(const Char_t* name, const Char
     Int_t iUsedVar = 0;\r
     for(Int_t ivar=0; ivar<kNTrdCfVariables; ++ivar) {\r
       if(!fExpertCFVarsEnabled[ivar]) continue;\r
-      if(fExpertCFVarBins[ivar][0]=='\0')\r
-       cf->SetBinLimits(iUsedVar, fExpertCFVarRanges[ivar][0], fExpertCFVarRanges[ivar][1]);\r
-      else {\r
-       TObjArray* arr = fExpertCFVarBins[ivar].Tokenize(";");\r
-       if(arr->GetEntries()-1>0) {\r
-         Double_t* binLims = new Double_t[arr->GetEntries()];\r
-         for(Int_t ib=0;ib<arr->GetEntries();++ib) {\r
-           TString binStr = arr->At(ib)->GetName();\r
-           binLims[ib] = binStr.Atof();\r
-         }\r
-         cf->SetBinLimits(iUsedVar++, binLims);\r
-       }\r
+      if(fExpertCFVarBins[ivar][0]=='\0'){\r
+        cf->SetBinLimits(iUsedVar, fExpertCFVarRanges[ivar][0], fExpertCFVarRanges[ivar][1]);\r
+      } else {\r
+        TObjArray* arr = fExpertCFVarBins[ivar].Tokenize(";");\r
+        if(arr->GetEntries()-1>0) {\r
+          Double_t* binLims = new Double_t[arr->GetEntries()];\r
+          for(Int_t ib=0;ib<arr->GetEntries();++ib) {\r
+            TString binStr = arr->At(ib)->GetName();\r
+            binLims[ib] = binStr.Atof();\r
+          }\r
+          cf->SetBinLimits(iUsedVar++, binLims);\r
+        }\r
+        arr->Delete(); delete arr;\r
       }\r
       cf->SetVarTitle(iUsedVar, varNames[ivar]);\r
     }\r
index fe0e7cb7e0112904e07ac653d57fbe3fcef47d70..930d8e43e2ee386b9cfa7a7c413e5afc27438e79 100644 (file)
@@ -94,6 +94,8 @@
 #include "info/AliTRDtrackInfo.h"\r
 #include "info/AliTRDeventInfo.h"\r
 #include "info/AliTRDv0Info.h"\r
+#include "info/AliTRDchmbInfo.h"\r
+#include "info/AliTRDtriggerInfo.h"\r
 #include "info/AliTRDeventCuts.h"\r
 \r
 ClassImp(AliTRDinfoGen)\r
@@ -268,10 +270,9 @@ void AliTRDinfoGen::UserCreateOutputObjects()
   fContainer->AddAt(h, kEvType);\r
   TH2I* h2=new TH2I("hBCtrack", "Track Statistics;Fill Bunch;TOF BC;Entries", 3500, -0.5, 3499.5, 31, -10.5, 20.5);\r
   fContainer->AddAt(h2, kBC);\r
-  h=new TH1I("hTriggers", "Triggers statistics;;Entries", 21, -0.5, 20.5);\r
-  fContainer->AddAt(h, kTrigger);\r
+  fContainer->AddAt(new AliTRDtriggerInfo(), kTrigger);\r
   TObjArray *chmb = new TObjArray(AliTRDgeometry::kNdet);\r
-  chmb->SetName("Chambers"); chmb->SetOwner();\r
+  chmb->SetName("Chambers Status"); chmb->SetOwner(kTRUE);\r
   fContainer->AddAt(chmb, kChmb);\r
 \r
   PostData(AliTRDpwgppHelper::kTracksBarrel, fTracksBarrel);\r
@@ -363,7 +364,8 @@ void AliTRDinfoGen::UserExec(Option_t *){
     // load misalignment\r
     fgGeo = new AliTRDgeometry;\r
     fgGeo->CreateClusterMatrixArray();\r
-    //MakeChambers();\r
+    MakeChambers();\r
+    printf("After MakeChambers()\n");\r
     // load reco param list from OCDB\r
     AliInfo("Initializing TRD reco params ...");\r
     fgReconstructor = new AliTRDReconstructor();\r
@@ -406,20 +408,11 @@ void AliTRDinfoGen::UserExec(Option_t *){
   fMCev = MCEvent();\r
   \r
   // trigger monitor\r
-  h = (TH1I*)fContainer->At(kTrigger);\r
-  TAxis *ax(h->GetXaxis());\r
+  AliTRDtriggerInfo *ti = (AliTRDtriggerInfo*)fContainer->At(kTrigger);\r
   TObjArray *evTriggers = fESDev->GetFiredTriggerClasses().Tokenize(" ");\r
-  for(Int_t iet(evTriggers->GetEntriesFast()); iet--;){\r
-    Int_t ix(1);\r
-    for(; ix<=ax->GetNbins(); ix++){\r
-      if(!Int_t(h->GetBinContent(ix))){\r
-        ax->SetBinLabel(ix, (*evTriggers)[iet]->GetName());\r
-        break;\r
-      }\r
-      if(strcmp((*evTriggers)[iet]->GetName(), ax->GetBinLabel(ix))==0) break;\r
-    }\r
-    h->AddBinContent(ix);\r
-  }\r
+  //printf("Ev[%03d] Triggers[%s]\n", fESDev->GetEventNumberInFile(), fESDev->GetFiredTriggerClasses().Data());\r
+  for(Int_t iet(evTriggers->GetEntriesFast()); iet--;) ti->Add((*evTriggers)[iet]->GetName());\r
+  evTriggers->Delete(); delete evTriggers;\r
 \r
   // event selection based on vertex cuts and trigger\r
   if(UseLocalEvSelection() && !fEventCut->IsSelected(fESDev, IsCollision())){\r
@@ -855,9 +848,9 @@ void AliTRDinfoGen::MakeChambers()
     AliError("No access to calibration data");\r
     return;\r
   }\r
-\r
-  Double_t alpha(0.), cs(-2.), sn(0.);\r
-  TVectorF pos(5*AliTRDgeometry::kNdet);\r
+  TObjArray *chmb = (TObjArray*)fContainer->At(kChmb);\r
+  Int_t stat(0);\r
+  Double_t alpha(0.), cs(-2.), sn(0.), pos[4];\r
   for(Int_t isec(0); isec<AliTRDgeometry::kNsector; isec++){\r
     alpha = (0.5+isec)*AliTRDgeometry::GetAlpha();\r
     cs    = TMath::Cos(alpha);\r
@@ -866,7 +859,6 @@ void AliTRDinfoGen::MakeChambers()
     for(Int_t istk(0); istk<AliTRDgeometry::kNstack; istk++){\r
       for(Int_t ilyr(0); ilyr<AliTRDgeometry::kNlayer; ilyr++){\r
         Int_t idet(AliTRDgeometry::GetDetector(ilyr, istk, isec));\r
-        Int_t jdet = 5*idet;\r
         TGeoHMatrix *matrix(fgGeo->GetClusterMatrix(idet));\r
         if(!matrix){\r
           AliDebug(2, Form("Missing matrix for %03d [%02d_%d_%d]", idet, isec, istk, ilyr));\r
@@ -877,26 +869,26 @@ void AliTRDinfoGen::MakeChambers()
         Double_t zm(0.5 * (pp->GetRow0() + pp->GetRowEnd())),\r
                  loc0[] = {AliTRDgeometry::AnodePos(), pp->GetCol0(), zm-pp->GetRow0()},\r
                  loc1[] = {AliTRDgeometry::AnodePos(), pp->GetColEnd(), zm-pp->GetRowEnd()},\r
-                 glb[3];\r
+                 glb[3] = {1,1,1};\r
         matrix->LocalToMaster(loc0, glb);\r
         Float_t phi = TMath::ATan2(glb[0]*sn + glb[1]*cs, glb[0]*cs - glb[1]*sn),\r
                 tgl = glb[2]/glb[0]/TMath::Sqrt(1.+glb[1]*glb[1]/glb[0]/glb[0]),\r
                 eta = -TMath::Log(TMath::Tan(0.5 *  (0.5*TMath::Pi() - TMath::ATan(tgl))));\r
-        pos[jdet+0] = eta; pos[jdet+1] = phi;\r
+        pos[0] = eta; pos[1] = phi;\r
         matrix->LocalToMaster(loc1, glb);\r
         phi = TMath::ATan2(glb[0]*sn + glb[1]*cs, glb[0]*cs - glb[1]*sn);\r
         tgl = glb[2]/glb[0]/TMath::Sqrt(1.+glb[1]*glb[1]/glb[0]/glb[0]);\r
         eta = -TMath::Log(TMath::Tan(0.5 *  (0.5*TMath::Pi() - TMath::ATan(tgl))));\r
-        pos[jdet+2] = eta; pos[jdet+3] = phi;\r
-        pos[jdet+4] = 0.;\r
+        pos[2] = eta; pos[3] = phi;\r
+        stat = 0;\r
         if(calib->IsChamberGood(idet)){\r
-          if(calib->IsHalfChamberNoData(idet, 0)) pos[jdet+4] += 2.;\r
-          if(calib->IsHalfChamberNoData(idet, 1)) pos[jdet+4] += 3.;\r
-        } else pos[jdet+4] = 1.;\r
+          if(calib->IsHalfChamberNoData(idet, 0)) stat += 2;\r
+          if(calib->IsHalfChamberNoData(idet, 1)) stat += 3;\r
+        } else stat = 1;\r
+        chmb->Add(new AliTRDchmbInfo(idet, stat, pos));\r
       }\r
     }\r
   }\r
-  fContainer->AddAt(new TVectorF(pos), kChmb);\r
 }\r
 \r
 //____________________________________________________________________\r
@@ -909,18 +901,18 @@ void AliTRDinfoGen::MakeSummary()
   }\r
   TH1 *h1(NULL); TVirtualPad *p(NULL); TCanvas *cOut(NULL);\r
 \r
-  const Int_t nx(2048), ny(750);\r
-  cOut = new TCanvas(GetName(), "Run Statistics", nx, ny);\r
-  cOut->Divide(3,1, 1.e-5, 1.e-5);\r
+  const Int_t nx(1024), ny(1024);\r
+  cOut = new TCanvas("infoGenSummary", "Run Statistics", nx, ny);\r
+  cOut->Divide(2,2, 1.e-5, 1.e-5);\r
   //=========\r
   p=cOut->cd(1);p->SetRightMargin(0.025);p->SetTopMargin(0.01);p->SetLogy();\r
   h1 = (TH1*)fContainer->At(kStatTrk);\r
-  h1->SetBarOffset(0.06); h1->SetBarWidth(0.88); h1->SetFillColor(3);\r
+  h1->SetBarOffset(0.06); h1->SetBarWidth(0.88); h1->SetFillColor(kGreen); h1->SetFillStyle(3001);\r
   h1->Draw("bar1");\r
   //=========\r
   p=cOut->cd(2);p->SetRightMargin(0.025);p->SetTopMargin(0.01);p->SetLogy();\r
   h1 = (TH1*)fContainer->At(kEvType);\r
-  h1->SetBarOffset(0.04); h1->SetBarWidth(0.92);h1->SetFillColor(6);\r
+  h1->SetBarOffset(0.04); h1->SetBarWidth(0.92);h1->SetFillColor(kGreen); h1->SetFillStyle(3001);\r
   h1->Draw("bar1");\r
   //=========\r
   p=cOut->cd(3);p->SetRightMargin(0.025);p->SetTopMargin(0.01);p->SetLogz();\r
@@ -938,7 +930,7 @@ void AliTRDinfoGen::MakeSummary()
                      n, -0.5, n-0.5, ay->GetNbins(), ay->GetXmin(), ay->GetXmax());\r
   hs->SetLineColor(kBlack);hs->SetLineWidth(1);\r
   hs->SetMarkerColor(kRed);\r
-  TAxis *ax(hs->GetXaxis());\r
+  TAxis *ax(hs->GetXaxis()); ax->CenterTitle(); ax->SetTitleOffset(1.4);\r
   for(Int_t ib(0); ib<n; ib++){\r
     ax->SetBinLabel(ib+1, Form("%d", bins[ib]));\r
     for(Int_t iy(1); iy<=ay->GetNbins(); iy++){\r
@@ -946,6 +938,19 @@ void AliTRDinfoGen::MakeSummary()
     }\r
   }\r
   hs->Draw("textbox");\r
+\r
+  //=========\r
+  p=cOut->cd(4); p->SetRightMargin(0.0215);p->SetLeftMargin(0.414);//p->SetLogz();\r
+  TObject *o = fContainer->At(kTrigger);\r
+  if(o){\r
+    if(!strcmp("TH1I", o->IsA()->GetName())){\r
+      h1 = dynamic_cast<TH1I*>(o);\r
+      h1->GetXaxis()->SetTitleOffset(6.5); h1->GetXaxis()->CenterTitle();\r
+      h1->SetFillStyle(3001);h1->SetFillColor(kGreen);\r
+      h1->SetBarWidth(0.8);h1->SetBarOffset(0.1);\r
+      ((TH1I*)o)->Draw("hbar2");\r
+    } else ((AliTRDtriggerInfo*)o)->Draw();\r
+  }\r
   cOut->SaveAs(Form("%s.gif", cOut->GetName()));\r
 }\r
 \r
@@ -987,11 +992,13 @@ void AliTRDinfoGen::Terminate(Option_t* /*option*/)
   AliInfo("");\r
   if(!(fContainer = dynamic_cast<TObjArray *>(GetOutputData(AliTRDpwgppHelper::kMonitor)))) return;\r
   AliInfo(Form("fContainer(%p)", (void*)fContainer));\r
+\r
+  AliTRDtriggerInfo* ti(NULL);\r
   if(UseLocalEvSelection()){\r
-    TH1 *h1 = (TH1*)fContainer->At(kTrigger); TAxis *ax(h1->GetXaxis());\r
-    AliInfo(Form("h1(%p)", (void*)h1));\r
-    for(Int_t ix(1); ix<=ax->GetNbins(); ix++){\r
-      if(fEventCut->CheckTrigger(ax->GetBinLabel(ix))) ax->SetBinLabel(ix, Form("#color[2]{%s}", ax->GetBinLabel(ix)));\r
+    if(!(ti = (AliTRDtriggerInfo*)fContainer->At(kTrigger))) return;\r
+    for(Int_t ix(0); ix<ti->GetNTriggers(); ix++){\r
+      if(fEventCut->CheckTrigger(ti->GetTrigger(ix))) ti->SetSelectTrigger(ix);\r
+      //ax->SetBinLabel(ix, Form("#color[2]{%s}", ax->GetBinLabel(ix)));\r
     }\r
   }\r
 }\r
index 1dafd7367d7b07859b6025e895c81fcd3c752e06..9463850d6688349ec50accfcc029da68abf6d4a0 100644 (file)
@@ -110,6 +110,8 @@ Int_t AliTRDpwgppHelper::ParseOptions(const Char_t *trd)
       if(!foundOpt) Warning("AliTRDpwgppHelper::ParseOptions()", "TRD task %s not implemented (yet).", s.Data());
     }
   }
+  tasksArray->Delete(); delete tasksArray;
+
   // extra rules for calibration tasks
 //  if(TESTBIT(fSteerTask, kCheckTRK)) SETBIT(fSteerTask, kResolution);
   if(TESTBIT(fSteerTask, kCalibration)) SETBIT(fSteerTask, kCheckDET);
index ee461d815f3e1ceb9f369d43f0663a9ce6ce7035..65b4b498525c6071200a226a072f1ce0a44916dd 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliAnalysisManager.h"\r
 #include "AliExternalTrackParam.h"\r
 \r
+#include "info/AliTRDchmbInfo.h"\r
 #include "info/AliTRDeventInfo.h"\r
 #include "info/AliTRDtrendingManager.h"\r
 #include "AliTRDrecoTask.h"\r
@@ -62,9 +63,11 @@ AliTRDrecoTask::AliTRDrecoTask()
   ,fkMC(NULL)\r
   ,fkESD(NULL)\r
   ,fSpecies(-6)\r
+  ,fTriggerSlot(-1)\r
   ,fPt(-1.)\r
   ,fPhi(0.)\r
   ,fEta(0.)\r
+  ,fTriggerList(NULL)\r
   ,fPlotFuncList(NULL)\r
   ,fDetFuncList(NULL)\r
   ,fRunTerminate(kFALSE)\r
@@ -88,9 +91,11 @@ AliTRDrecoTask::AliTRDrecoTask(const char *name, const char *title)
   ,fkMC(NULL)\r
   ,fkESD(NULL)\r
   ,fSpecies(-6)\r
+  ,fTriggerSlot(-1)\r
   ,fPt(-1.)\r
   ,fPhi(0.)\r
   ,fEta(0.)\r
+  ,fTriggerList(NULL)\r
   ,fPlotFuncList(NULL)\r
   ,fDetFuncList(NULL)\r
   ,fRunTerminate(kFALSE)\r
@@ -134,6 +139,7 @@ AliTRDrecoTask::~AliTRDrecoTask()
     fDets = NULL;\r
   }\r
   if(fDetsV) delete fDetsV; fDetsV=NULL;\r
+  if(fTriggerList){fTriggerList->Delete(); delete fTriggerList;}\r
 \r
   if(fContainer && !(AliAnalysisManager::GetAnalysisManager() && AliAnalysisManager::GetAnalysisManager()->IsProofMode())){\r
     if(fContainer->IsOwner()) fContainer->Delete();\r
@@ -185,6 +191,18 @@ void AliTRDrecoTask::UserExec(Option_t *)
 \r
   fTracks   = dynamic_cast<TObjArray *>(GetInputData(1));\r
   fEvent    = dynamic_cast<AliTRDeventInfo *>(GetInputData(2));\r
+  fTriggerSlot=0;\r
+  if(fTriggerList){\r
+    for(Int_t itrig(0); itrig<fTriggerList->GetEntries(); itrig++){\r
+      if(!fEvent->GetFiredTriggerClasses().Contains(((TObjString*)(*fTriggerList)[itrig])->GetName())) continue;\r
+      //printf("\"%s\" selected\n", ((TObjString*)(*fTriggerList)[itrig])->GetName());\r
+      SETBIT(fTriggerSlot,itrig);\r
+    }\r
+    if(!fTriggerSlot){\r
+      AliDebug(2, Form("Triggers[%s] not used for %s", fEvent->GetFiredTriggerClasses().Data(),  GetName()));\r
+      return;\r
+    }\r
+  }\r
   fClusters = dynamic_cast<TObjArray*>(GetInputData(3));\r
 \r
   if(!fPlotFuncList){\r
@@ -317,14 +335,15 @@ Bool_t AliTRDrecoTask::LoadDetectorMap(const Char_t *file, const Char_t *dir)
     AliWarning("Missing TRDinfoGen container.");\r
     return kFALSE;\r
   }\r
-  TObjArray *dets = (TObjArray*)info->FindObject("Chambers");\r
+  TObjArray *dets = (TObjArray*)info->FindObject("Chambers Status");\r
   if(!dets){\r
-    TVector *vdets = (TVector*)info->At(4);\r
-    if(!vdets){\r
-      AliWarning("Missing detector map from TRDinfoGen results.");\r
-      return kFALSE;\r
-    } else fDetsV = (TVector*)vdets->Clone();\r
-  } else fDets = (TObjArray*)dets->Clone("Chambers");\r
+    if(strcmp("TObjArray", info->At(4)->IsA()->GetName())) AliError("Looking for old style chamber status map. Failed.");\r
+    else {\r
+      AliWarning("Looking for old style chamber status map.");\r
+      TObjArray *vdets = (TObjArray*)info->At(4);\r
+      fDetsV = (TObjArray*)vdets->Clone();\r
+    }\r
+  } else fDets = (TObjArray*)dets->Clone();\r
   gFile->Close();\r
   return kTRUE;\r
 }\r
@@ -369,91 +388,74 @@ void AliTRDrecoTask::MakeDetectorPlot(Int_t ly, const Option_t *opt)
 // based on info collected by AliTRDinfoGen\r
 \r
   if(!fDets){\r
-    AliWarning("OLD Detector map and status not available. Try NEW");\r
-    MakeDetectorPlotNEW(ly, opt);\r
+    AliWarning("NEW Detector map and status not available. Try OLD");\r
+    MakeDetectorPlotOLD(ly, opt);\r
     return;\r
   }\r
-  Float_t xmin(0.), xmax(0.);\r
-  TBox *gdet = new TBox();\r
-  gdet->SetLineColor(kBlack);gdet->SetFillColor(kBlack);\r
-  Int_t style[] = {0, 3003};\r
-  for(Int_t idet(0); idet<540; idet++){\r
-    if(idet%6 != ly) continue;\r
-    TVectorF *det((TVectorF*)fDets->At(idet));\r
-    if(!det) continue;\r
-    Int_t iopt = Int_t((*det)[4]);\r
-    if(strcmp(opt, "eta")==0){\r
-      xmin=(*det)[0]; xmax=(*det)[2];\r
-    } else if(strcmp(opt, "pad")==0){\r
-      Int_t stk(AliTRDgeometry::GetStack(idet));\r
-      xmin=-0.6+16*(4-stk)-(stk<2?4:0); xmax=xmin+(stk==2?12:16)-0.2;\r
-    } else continue;\r
-    AliDebug(2, Form("det[%03d] 0[%+4.1f(%+4.1f) %+4.1f] 1[%+4.1f(%+4.1f) %+4.1f] opt[%d]", idet, xmin, (*det)[0], (*det)[1], xmax, (*det)[2], (*det)[3], iopt));\r
-    if(iopt==1){\r
-      gdet->SetFillStyle(style[1]);gdet->SetFillColor(kBlack);\r
-      gdet->DrawBox(xmin, (*det)[1], xmax, (*det)[3]);\r
-    } else {\r
-      gdet->SetFillStyle(style[0]);\r
-      gdet->DrawBox(xmin, (*det)[1], xmax, (*det)[3]);\r
-      if(iopt==2){\r
-        gdet->SetFillStyle(style[1]);gdet->SetFillColor(kGreen);\r
-        gdet->DrawBox(xmin, (*det)[1], xmax, 0.5*((*det)[3]+(*det)[1]));\r
-      } else if(iopt==3){\r
-        gdet->SetFillStyle(style[1]);gdet->SetFillColor(kRed);\r
-        gdet->DrawBox(xmin, 0.5*((*det)[3]+(*det)[1]), xmax, (*det)[3]);\r
-      } else if(iopt!=0) AliError(Form("Wrong chmb. status[%d] for det[%03d]", iopt, idet));\r
-    }\r
+  AliTRDchmbInfo *ci(NULL);\r
+  for(Int_t idet(0); idet<fDets->GetEntriesFast(); idet++){\r
+    if(!(ci = (AliTRDchmbInfo*)fDets->At(idet))) continue;\r
+    if(AliTRDgeometry::GetLayer(ci->GetDetector()) != ly) continue;\r
+    ci->Draw(opt);\r
   }\r
+  \r
   Float_t dsm = TMath::TwoPi()/AliTRDgeometry::kNsector;\r
-  xmin=0.;\r
-  if(strcmp(opt, "pad")==0) xmin=38.;\r
-  TLatex *sm = new TLatex(); sm->SetTextAlign(22);sm->SetTextColor(0); sm->SetTextFont(32);sm->SetTextSize(0.03);\r
-  for(Int_t is(0); is<AliTRDgeometry::kNsector; is++) sm->DrawLatex(xmin, -TMath::Pi()+(is+0.5)*dsm, Form("%02d", is>=9?(is-9):(is+9)));\r
+  Float_t xmed=0.;\r
+  if(strcmp(opt, "pad")==0) xmed=38.;\r
+  TLatex *sm = new TLatex(); sm->SetTextAlign(22);sm->SetTextColor(kBlack); sm->SetTextFont(32);sm->SetTextSize(0.03);\r
+  for(Int_t is(0); is<AliTRDgeometry::kNsector; is++) sm->DrawLatex(xmed, -TMath::Pi()+(is+0.5)*dsm, Form("%02d", is>=9?(is-9):(is+9)));\r
 }\r
 \r
 //_______________________________________________________\r
-void AliTRDrecoTask::MakeDetectorPlotNEW(Int_t ly, const Option_t *opt)\r
+void AliTRDrecoTask::MakeDetectorPlotOLD(Int_t ly, const Option_t *opt)\r
 {\r
 // Draw chamber boundaries in eta/phi plots with misalignments\r
-// based on info collected by AliTRDinfoGen NEW data storage\r
+// based on info collected by AliTRDinfoGen OLD data storage\r
 \r
   if(!fDetsV){\r
-    AliWarning("NEW Detector map and status not available.");\r
+    AliError("OLD Detector map and status not available.");\r
+    return;\r
+  }\r
+  if(!fDetsV->GetEntries()){\r
+    AliError("OLD Detector map and status not filled.");\r
     return;\r
   }\r
+\r
   Float_t xmin(0.), xmax(0.);\r
   TBox *gdet = new TBox();\r
   gdet->SetLineColor(kBlack);gdet->SetFillColor(kBlack);\r
   Int_t style[] = {0, 3003};\r
-  for(Int_t idet(0), jdet(0); idet<AliTRDgeometry::kNdet; idet++, jdet+=5){\r
+  for(Int_t idet(0); idet<540; idet++){\r
     if(idet%6 != ly) continue;\r
-    Int_t iopt = Int_t((*fDetsV)[jdet+4]);\r
+    TVectorF *det((TVectorF*)fDetsV->At(idet));\r
+    if(!det) continue;\r
+    Int_t iopt = Int_t((*det)[4]);\r
     if(strcmp(opt, "eta")==0){\r
-      xmin=(*fDetsV)[jdet+0]; xmax=(*fDetsV)[jdet+2];\r
+      xmin=(*det)[0]; xmax=(*det)[2];\r
     } else if(strcmp(opt, "pad")==0){\r
       Int_t stk(AliTRDgeometry::GetStack(idet));\r
       xmin=-0.6+16*(4-stk)-(stk<2?4:0); xmax=xmin+(stk==2?12:16)-0.2;\r
     } else continue;\r
-    AliDebug(2, Form("det[%03d] 0[%+4.1f(%+4.1f) %+4.1f] 1[%+4.1f(%+4.1f) %+4.1f] opt[%d]", idet, xmin, (*fDetsV)[jdet+0], (*fDetsV)[jdet+1], xmax, (*fDetsV)[jdet+2], (*fDetsV)[jdet+3], iopt));\r
+    AliDebug(2, Form("det[%03d] 0[%+4.1f(%+4.1f) %+4.1f] 1[%+4.1f(%+4.1f) %+4.1f] opt[%d]", idet, xmin, (*det)[0], (*det)[1], xmax, (*det)[2], (*det)[3], iopt));\r
     if(iopt==1){\r
       gdet->SetFillStyle(style[1]);gdet->SetFillColor(kBlack);\r
-      gdet->DrawBox(xmin, (*fDetsV)[jdet+1], xmax, (*fDetsV)[jdet+3]);\r
+      gdet->DrawBox(xmin, (*det)[1], xmax, (*det)[3]);\r
     } else {\r
       gdet->SetFillStyle(style[0]);\r
-      gdet->DrawBox(xmin, (*fDetsV)[jdet+1], xmax, (*fDetsV)[jdet+3]);\r
+      gdet->DrawBox(xmin, (*det)[1], xmax, (*det)[3]);\r
       if(iopt==2){\r
         gdet->SetFillStyle(style[1]);gdet->SetFillColor(kGreen);\r
-        gdet->DrawBox(xmin, (*fDetsV)[jdet+1], xmax, 0.5*((*fDetsV)[jdet+3]+(*fDetsV)[jdet+1]));\r
+        gdet->DrawBox(xmin, (*det)[1], xmax, 0.5*((*det)[3]+(*det)[1]));\r
       } else if(iopt==3){\r
         gdet->SetFillStyle(style[1]);gdet->SetFillColor(kRed);\r
-        gdet->DrawBox(xmin, 0.5*((*fDetsV)[jdet+3]+(*fDetsV)[jdet+1]), xmax, (*fDetsV)[jdet+3]);\r
+        gdet->DrawBox(xmin, 0.5*((*det)[3]+(*det)[1]), xmax, (*det)[3]);\r
       } else if(iopt!=0) AliError(Form("Wrong chmb. status[%d] for det[%03d]", iopt, idet));\r
     }\r
   }\r
   Float_t dsm = TMath::TwoPi()/AliTRDgeometry::kNsector;\r
   xmin=0.;\r
   if(strcmp(opt, "pad")==0) xmin=38.;\r
-  TLatex *sm = new TLatex(); sm->SetTextAlign(22);sm->SetTextColor(0); sm->SetTextFont(32);sm->SetTextSize(0.03);\r
+  TLatex *sm = new TLatex(); sm->SetTextAlign(22);sm->SetTextColor(kBlack); sm->SetTextFont(32);sm->SetTextSize(0.03);\r
   for(Int_t is(0); is<AliTRDgeometry::kNsector; is++) sm->DrawLatex(xmin, -TMath::Pi()+(is+0.5)*dsm, Form("%02d", is>=9?(is-9):(is+9)));\r
 }\r
 \r
@@ -730,6 +732,7 @@ TH2* AliTRDrecoTask::AliTRDrecoProjection::Projection2D(const Int_t nstat, const
   h2 = new TH2F(Form("%s_2D", fH->GetName()),\r
             Form("%s;%s;%s;%s(%s) %s", fH->GetTitle(), ax->GetTitle(), ay->GetTitle(), title[mid], nt>0?(*tokenTitle)[0]->GetName():"", nt>1?(*tokenTitle)[1]->GetName():""),\r
             nx, ax->GetXmin(), ax->GetXmax(), ny, ay->GetXmin(), ay->GetXmax());\r
+  tokenTitle->Delete(); delete tokenTitle;\r
   h2->SetContour(ncol);\r
   h2->GetZaxis()->CenterTitle();\r
   h2->GetZaxis()->SetTitleOffset(1.4);\r
@@ -789,5 +792,17 @@ void AliTRDrecoTask::AliTRDrecoProjection::SetRebinStrategy(Int_t n, Int_t rebx[
   fRebinY = new Int_t[n]; memcpy(fRebinY, reby, n*sizeof(Int_t));\r
 }\r
 \r
+//________________________________________________________\r
+void AliTRDrecoTask::SetTriggerList(const Char_t *tl)\r
+{\r
+// Store list of triggers to be monitored\r
+  TString stl(tl);\r
+  if(fTriggerList){ fTriggerList->Delete(); delete fTriggerList;}\r
+  TObjArray *atl = stl.Tokenize(" ");\r
+  fTriggerList = (TObjArray*)atl->Clone("");\r
+  atl->Delete(); delete atl;\r
+  AliInfo("Running only for triggers::");\r
+  fTriggerList->Print();\r
+}\r
 \r
 \r
index 1737da5cc61e7b03d3fff5ccf04a5a2fd91385ab..93ee68432d4d6939b274c5667d7aec2a0841fea5 100644 (file)
@@ -30,9 +30,7 @@ class TList;
 class TObjArray;\r
 class TTreeSRedirector;\r
 class AliTRDtrackV1;\r
-template <typename Value> class TVectorT;\r
-typedef class TVectorT<Float_t> TVector;\r
-class AliTRDrecoTask : public AliAnalysisTaskSE \r
+class AliTRDrecoTask : public AliAnalysisTaskSE\r
 {\r
 friend class AliEveTRDTrackList;\r
 public:\r
@@ -88,7 +86,7 @@ public:
   virtual Bool_t GetRefFigure(Int_t ifig);\r
   virtual void   MakeSummary();\r
   void           MakeDetectorPlot(Int_t ly=0, const Option_t *opt="eta");\r
-  void           MakeDetectorPlotNEW(Int_t ly=0, const Option_t *opt="eta");\r
+  void           MakeDetectorPlotOLD(Int_t ly=0, const Option_t *opt="eta");\r
   Bool_t         IsHeavyIon() const      { return TestBit(kHeavyIon);};\r
   Bool_t         IsPP() const            { return !TestBit(kHeavyIon);};\r
   Bool_t         HasFriends() const      { return TestBit(kFriends);};\r
@@ -109,6 +107,7 @@ public:
   static Float_t SetNormZ(TH2 *h2, Int_t bxmin=1, Int_t bxmax=-1, Int_t bymin=1, Int_t bymax=-1, Float_t thr=0.);\r
   static void    SetRangeZ(TH2 *h2, Float_t m, Float_t M, Float_t thr=0.);\r
   void SetRunTerminate(Bool_t runTerminate = kTRUE) { fRunTerminate = runTerminate; }\r
+  void           SetTriggerList(const Char_t *tl);\r
   virtual void   Terminate(Option_t *);\r
 \r
 protected:\r
@@ -119,7 +118,7 @@ protected:
   Char_t                fNameId[10];       // unique identifier of task particularity\r
   UChar_t               fNRefFigures;      // no of reference figures reported by task\r
   TObjArray             *fDets;            //! OLD container to store detector position and status support should be discontinued \r
-  TVector               *fDetsV;           //! NEW container to store detector position and status\r
+  TObjArray             *fDetsV;           //! NEW container to store detector position and status\r
   TObjArray             *fContainer;       //! container to store results\r
   AliTRDeventInfo       *fEvent;           //! Event Info\r
   TObjArray             *fTracks;          //! Array of tracks\r
@@ -129,9 +128,11 @@ protected:
   const AliTRDtrackInfo::AliMCinfo  *fkMC; //! MC info\r
   const AliTRDtrackInfo::AliESDinfo *fkESD;//! ESD info\r
   Char_t                 fSpecies;         //! species index +1 with charge sign\r
+  Char_t                 fTriggerSlot;     //! selected triggers map (if requested)\r
   Float_t                fPt;              //! p_t of the track being analyzed\r
   Float_t                fPhi;             //! phi of the track being analyzed\r
   Float_t                fEta;             //! eta of the track being analyzed\r
+  TObjArray             *fTriggerList;     //! optional trigger list to be monitored\r
 \r
 private:\r
   AliTRDrecoTask(const AliTRDrecoTask&);\r
index e3f1127beea4c27723e0f7fc6efab88afcf4cf1e..1eca596b387998949f60fb7ac65ea30e81e3424d 100644 (file)
@@ -155,9 +155,7 @@ Float_t AliTRDresolution::fgPtBin[25];
 AliTRDresolution::AliTRDresolution()
   :AliTRDrecoTask()
   ,fSteer(0)
-  ,fIdxFrame(0)
   ,fPtThreshold(.3)
-  ,fDyRange(0.75)
   ,fBCbinTOF(0)
   ,fBCbinFill(0)
   ,fBsign(kFALSE)
@@ -178,9 +176,7 @@ AliTRDresolution::AliTRDresolution()
 AliTRDresolution::AliTRDresolution(char* name, Bool_t xchange)
   :AliTRDrecoTask(name, "TRD spatial and momentum resolution")
   ,fSteer(0)
-  ,fIdxFrame(0)
   ,fPtThreshold(.3)
-  ,fDyRange(0.75)
   ,fBCbinTOF(0)
   ,fBCbinFill(0)
   ,fBsign(kFALSE)
@@ -579,69 +575,7 @@ TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
 //
 // Additionally the momentum resolution/pulls are calculated for usage in the
 // PID calculation.
-  //printf("AliTRDresolution::PlotTrackIn() :: track[%p]\n", (void*)track);
-  const Int_t np(27);
-  Float_t vp[np] = {
-    0.3375, 0.3625, 0.3875, 0.4125, 0.4375, 0.4625, 0.4875, 0.5125, 0.5375, 0.5625, 0.5875, 0.6125, 0.6375, 0.6625, 0.6875, 0.7125, 0.7375, 0.7625, 0.7875, 0.8125, 0.8375, 0.8625, 0.8875, 0.9125, 0.9375, 0.9625, 0.9875};
-  Float_t vpar[np][7] = {
-    {1620.77, 1637.76, 1033.49,  219.90,  300.00, 11234.87, 1113.33},
-    {1761.62, 1772.56, 1002.12,  219.44,  300.00, 9247.25, 1180.65},
-    {1759.54, 1805.76, 1011.67,  226.35,   54.74, 7739.81, 1120.52},
-    {1785.01, 1847.86,  993.53,  225.54,   48.02, 6575.87, 1001.27},
-    {1816.10, 1893.11,  993.37,  219.72,   70.20, 5860.19,  924.65},
-    {1745.73, 1769.14,  984.64,  217.80,   99.74, 4987.99,  729.97},
-    {1630.73, 1739.22,  987.80,  210.79,  140.88, 4404.52,  661.83},
-    {1532.09, 1637.25,  969.80,  208.23,  183.06, 4023.80,  593.95},
-    {1406.39, 1457.61,  973.71,  214.04,  221.52, 3684.11,  568.14},
-    {1319.60, 1363.47,  973.81,  214.03,  213.82, 3358.99,  602.18},
-    {1204.52, 1286.62,  975.00,  213.85,  249.08, 3086.86,  451.61},
-    {1108.89, 1172.44,  969.34,  209.29,  234.00, 2857.36,  512.79},
-    {1080.99, 1119.23,  956.90,  199.72,  232.16, 2662.46,  511.70},
-    { 932.87, 1022.37,  996.10,  211.59,  191.86, 2495.88,  472.64},
-    { 870.37,  927.52,  979.59,  211.22,  185.93, 2352.64,  471.50},
-    { 813.63,  862.36,  976.39,  208.70,  170.30, 2228.81,  543.72},
-    { 719.08,  764.51,  979.11,  216.24,  159.93, 2121.21,  483.85},
-    { 686.97,  746.95,  981.91,  208.64,  172.86, 2027.26,  428.23},
-    { 657.16,  660.34,  979.22,  220.23,  146.15, 1874.18,  418.02},
-    { 586.85,  617.01,  994.70,  225.71,  151.23, 1816.44,  317.01},
-    { 590.84,  553.40,  973.50,  208.46,  153.81, 1608.13,  407.54},
-    { 548.43,  501.37,  979.41,  209.70,  130.38, 1551.19,  422.07},
-    { 500.07,  476.37,  969.69,  209.10,  159.85, 1500.49,  321.93},
-    { 484.45,  476.31,  990.48,  204.98,  117.53, 1608.40,  304.42},
-    { 448.54,  447.14,  981.36,  205.21,  128.96, 1513.62,  244.57},
-    { 412.45,  398.59,  999.26,  201.71,  164.19, 1441.81,  196.49},
-    { 385.75,  390.55,  983.29,  214.26,  117.22, 1360.23,  174.48}
-  };
-  Float_t vqq[np][2] = {
-    {10.1500, 0.0050},
-    {37.4500, 0.0050},
-    {39.8500, 0.0050},
-    {37.1500, 0.0050},
-    {39.5500, 0.0050},
-    {38.9500, 0.0050},
-    {37.1500, 0.0050},
-    {32.6500, 0.0250},
-    {22.1500, 0.0250},
-    {10.1500, 0.0750},
-    {15.5500, 0.0650},
-    {10.1500, 0.1150},
-    {11.0500, 0.1750},
-    {10.1500, 0.1050},
-    {10.1500, 0.1150},
-    {10.1500, 0.1750},
-    {10.7500, 0.1950},
-    {11.0500, 0.2050},
-    {11.3500, 0.1950},
-    {12.8500, 0.1950},
-    {10.1500, 0.2650},
-    {10.1500, 0.2950},
-    {10.1500, 0.3050},
-    {10.1500, 0.2350},
-    {11.6500, 0.2750},
-    {10.7500, 0.2750},
-    {10.1500, 0.2450}
-  };
-
   if(track) fkTrack = track;
   if(!fkTrack){
     AliDebug(4, "No Track defined.");
@@ -690,59 +624,10 @@ TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
   // down scale PID resolution
   Int_t spc(fSpecies); if(spc==3) spc=2; if(spc==-3) spc=-2; if(spc>3) spc=3; if(spc<-3) spc=-3;
 
-  //identify high dEdx component
-  Int_t xid(0);
-  if(!fTracklet->IsRowCross()){
-    TF1 fl1("fl1", "landau", 5.5e2, 6.5e3);
-    TF1 fl2("fl2", "landau", 5.5e2, 6.5e3);
-    TF1 fg("fg", "gausn", -100, 100);
-    fg.SetParameter(0, 1.);
-    fg.SetParameter(1, -20.88);
-    fg.SetParameter(2,  14.47);
-    Double_t  ang(TMath::DegToRad()*50.), cs[2] = {TMath::Cos(ang), TMath::Sin(ang)};
-    Float_t p(fTracklet->GetMomentum()),
-            dqdl(fTracklet->GetdQdl());
-    if(p>vp[0] && p<vp[np-1]){
-      Int_t jp(0); while(jp<np && p>vp[jp]) jp++;
-      Int_t imin=TMath::Max(0, jp-1), imax=TMath::Min(jp, np-1);
-      //if(spc==2) printf("p[%6.4f] [%6.4f %6.4f]\n", p, vp[imin], vp[imax]);
-      for(Int_t ip(0); ip<3; ip++){
-        fl1.SetParameter(ip, 0.5*(vpar[imin][ip+1] + vpar[imax][ip+1]));
-        fl2.SetParameter(ip, 0.5*(vpar[imin][ip+4] + vpar[imax][ip+4]));
-      }
-      Float_t q0=fl1.Eval(dqdl), q1=fl2.Eval(dqdl);
-      q1/=(q0+q1); q1*=1.e2;
-
-      // calculate shape
-      AliTRDcluster *c(NULL);
-      Int_t ntb=0, q[26];Float_t qm(0.), qs(0.);
-      for(Int_t itb(0); itb<26/*AliTRDseedV1::kNtb*/; itb++){
-        q[itb]=0;
-        if(!(c=fTracklet->GetClusters(itb))) continue;
-        //Int_t col(c->GetPadCol());
-        Short_t *sig = c->GetSignals();
-        for(Int_t ipad(0); ipad<7; ipad++){
-          if(sig[ipad]<0) continue; // avoid signals below baseline
-          q[itb]+=sig[ipad];
-        }
-        if(!q[itb]) continue;
-        qm+=q[itb]; ntb++;
-      }
-      if(ntb) qm/=ntb;
-      for(Int_t itb(0); itb<26/*AliTRDseedV1::kNtb*/; itb++) qs += (q[itb]-qm)*(q[itb]-qm);
-      if(ntb) qs/=ntb;
-      if(qs>0.) qs=TMath::Sqrt(qs);
-      Float_t qsm = cs[0]*qm-cs[1]*qs;
-      Float_t q2 = 1.e2*fg.Eval(qsm);
-      if(q1>0.5*(vqq[imin][0]+vqq[imax][0])&&q2<=0.5*(vqq[imin][1]+vqq[imax][1])) xid = 1;
-    }
-  }
-
   if(DebugLevel()>=3){
     Float_t tpc(fkESD->GetTPCdedx());
     Float_t tof(fkESD->GetTOFbeta());
     (*DebugStream()) << "trackIn"
-      <<"xid="        << xid
       <<"spc="        << spc
       <<"tpc="        << tpc
       <<"tof="        << tof
@@ -766,7 +651,7 @@ TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
   Double_t dphi = TMath::ATan(phit) - TMath::ASin(parR[2]);
 
   Double_t val[kNdim+2];
-  val[kBC]          = xid;//bc==0?0:(bc<0?-1.:1.);
+  val[kBC]          = fTriggerSlot;//bc==0?0:(bc<0?-1.:1.);
   Double_t alpha = (0.5+AliTRDgeometry::GetSector(fTracklet->GetDetector()))*AliTRDgeometry::GetAlpha(),
            cs    = TMath::Cos(alpha),
            sn    = TMath::Sin(alpha);
@@ -1317,7 +1202,9 @@ void AliTRDresolution::MakeSummary()
           h2->SetContour(9);
           h2->GetZaxis()->SetRangeUser(zmin[ispec], zmax[ispec]);
           h2->GetZaxis()->SetTitle("Rel. Abundancy [%]");h2->GetZaxis()->CenterTitle();
-          TString tit(h2->GetTitle()); h2->SetTitle(Form("%s :: Relative Abundancy", ((*(tit.Tokenize("::")))[0])->GetName()));
+          TString tit(h2->GetTitle()); TObjArray *atit = tit.Tokenize("::");
+          h2->SetTitle(Form("%s :: Relative Abundancy", ((*atit)[0])->GetName()));
+          atit->Delete(); delete atit;
           h2->Draw("colz");
           MakeDetectorPlot(0);
         }
@@ -2319,7 +2206,6 @@ Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
         }
         php.AddLast(&specY[idx]);
         if((h2 = specY[idx].Projection2D(kNstat, kNcontours, 1, kFALSE))) arr->AddAt(h2, jh++);
-        if((h2 = (TH2*)gDirectory->Get(Form("%sEn", specY[idx].H()->GetName())))) arr->AddAt(h2, jh++);
         if(ich && (pr1 = (AliTRDrecoProjection*)php.FindObject(Form("H%sTrkInY%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specY[idx];
       }
       /*!dphi*/
@@ -2831,159 +2717,6 @@ void AliTRDresolution::AdjustF1(TH1 *h, TF1 *f)
   f->SetParameter(5, 2.e-1);
 }
 
-//________________________________________________________
-TObjArray* AliTRDresolution::BuildMonitorContainerCluster(const char* name, Bool_t expand, Float_t range)
-{
-// Build performance histograms for AliTRDcluster.vs TRD track or MC
-//  - y reziduals/pulls
-
-  TObjArray *arr = new TObjArray(2);
-  arr->SetName(name); arr->SetOwner();
-  TH1 *h(NULL); char hname[100], htitle[300];
-
-  // tracklet resolution/pull in y direction
-  snprintf(hname, 100, "%s_%s_Y", GetNameId(), name);
-  snprintf(htitle, 300, "Y res for \"%s\" @ %s;tg(#phi);#Delta y [cm];%s", GetNameId(), name, "Detector");
-  Float_t rr = range<0.?fDyRange:range;
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    Int_t nybins=50;
-    if(expand) nybins*=2;
-    h = new TH3S(hname, htitle,
-                 48, -.48, .48,            // phi
-                 60, -rr, rr,              // dy
-                 nybins, -0.5, nybins-0.5);// segment
-  } else h->Reset();
-  arr->AddAt(h, 0);
-  snprintf(hname, 100, "%s_%s_YZpull", GetNameId(), name);
-  snprintf(htitle, 300, "YZ pull for \"%s\" @ %s;%s;#Delta y  / #sigma_{y};#Delta z  / #sigma_{z}", GetNameId(), name, "Detector");
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle, 540, -0.5, 540-0.5, 100, -4.5, 4.5, 100, -4.5, 4.5);
-  } else h->Reset();
-  arr->AddAt(h, 1);
-
-  return arr;
-}
-
-//________________________________________________________
-TObjArray* AliTRDresolution::BuildMonitorContainerTracklet(const char* name, Bool_t expand)
-{
-// Build performance histograms for AliExternalTrackParam.vs TRD tracklet
-//  - y reziduals/pulls
-//  - z reziduals/pulls
-//  - phi reziduals
-  TObjArray *arr = BuildMonitorContainerCluster(name, expand, 0.05);
-  arr->Expand(5);
-  TH1 *h(NULL); char hname[100], htitle[300];
-
-  // tracklet resolution/pull in z direction
-  snprintf(hname, 100, "%s_%s_Z", GetNameId(), name);
-  snprintf(htitle, 300, "Z res for \"%s\" @ %s;tg(#theta);#Delta z [cm]", GetNameId(), name);
-  if(!(h = (TH2S*)gROOT->FindObject(hname))){
-    h = new TH2S(hname, htitle, 50, -1., 1., 100, -.05, .05);
-  } else h->Reset();
-  arr->AddAt(h, 2);
-  snprintf(hname, 100, "%s_%s_Zpull", GetNameId(), name);
-  snprintf(htitle, 300, "Z pull for \"%s\" @ %s;tg(#theta);#Delta z  / #sigma_{z};row cross", GetNameId(), name);
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle, 50, -1., 1., 100, -5.5, 5.5, 2, -0.5, 1.5);
-    h->GetZaxis()->SetBinLabel(1, "no RC");
-    h->GetZaxis()->SetBinLabel(2, "RC");
-  } else h->Reset();
-  arr->AddAt(h, 3);
-
-  // tracklet to track phi resolution
-  snprintf(hname, 100, "%s_%s_PHI", GetNameId(), name);
-  snprintf(htitle, 300, "#Phi res for \"%s\" @ %s;tg(#phi);#Delta #phi [rad];%s", GetNameId(), name, "Detector");
-  Int_t nsgms=540;
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle, 48, -.48, .48, 100, -.5, .5, nsgms, -0.5, nsgms-0.5);
-  } else h->Reset();
-  arr->AddAt(h, 4);
-
-  return arr;
-}
-
-//________________________________________________________
-TObjArray* AliTRDresolution::BuildMonitorContainerTrack(const char* name)
-{
-// Build performance histograms for AliExternalTrackParam.vs MC
-//  - y resolution/pulls
-//  - z resolution/pulls
-//  - phi resolution, snp pulls
-//  - theta resolution, tgl pulls
-//  - pt resolution, 1/pt pulls, p resolution
-
-  TObjArray *arr = BuildMonitorContainerTracklet(name);
-  arr->Expand(11);
-  TH1 *h(NULL); char hname[100], htitle[300];
-  //TAxis *ax(NULL);
-
-  // snp pulls
-  snprintf(hname, 100, "%s_%s_SNPpull", GetNameId(), name);
-  snprintf(htitle, 300, "SNP pull for \"%s\" @ %s;tg(#phi);#Delta snp  / #sigma_{snp};entries", GetNameId(), name);
-  if(!(h = (TH2I*)gROOT->FindObject(hname))){
-    h = new TH2I(hname, htitle, 60, -.3, .3, 100, -4.5, 4.5);
-  } else h->Reset();
-  arr->AddAt(h, 5);
-
-  // theta resolution
-  snprintf(hname, 100, "%s_%s_THT", GetNameId(), name);
-  snprintf(htitle, 300, "#Theta res for \"%s\" @ %s;tg(#theta);#Delta #theta [rad];entries", GetNameId(), name);
-  if(!(h = (TH2I*)gROOT->FindObject(hname))){
-    h = new TH2I(hname, htitle, 100, -1., 1., 100, -5e-3, 5e-3);
-  } else h->Reset();
-  arr->AddAt(h, 6);
-  // tgl pulls
-  snprintf(hname, 100, "%s_%s_TGLpull", GetNameId(), name);
-  snprintf(htitle, 300, "TGL pull for \"%s\" @ %s;tg(#theta);#Delta tgl  / #sigma_{tgl};entries", GetNameId(), name);
-  if(!(h = (TH2I*)gROOT->FindObject(hname))){
-    h = new TH2I(hname, htitle, 100, -1., 1., 100, -4.5, 4.5);
-  } else h->Reset();
-  arr->AddAt(h, 7);
-
-  const Int_t kNdpt(150);
-  const Int_t nNspc = 2*kNspc+1;
-  Float_t lPt=0.1, lDPt=-.1, lSpc=-5.5;
-  Float_t binsPt[kNpt+1], binsSpc[nNspc+1], binsDPt[kNdpt+1];
-  for(Int_t i=0;i<kNpt+1; i++,lPt=TMath::Exp(i*.15)-1.) binsPt[i]=lPt;
-  for(Int_t i=0; i<nNspc+1; i++,lSpc+=1.) binsSpc[i]=lSpc;
-  for(Int_t i=0; i<kNdpt+1; i++,lDPt+=2.e-3) binsDPt[i]=lDPt;
-
-  // Pt resolution
-  snprintf(hname, 100, "%s_%s_Pt", GetNameId(), name);
-  snprintf(htitle, 300, "#splitline{P_{t} res for}{\"%s\" @ %s};p_{t} [GeV/c];#Delta p_{t}/p_{t}^{MC};SPECIES", GetNameId(), name);
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle,
-                 kNpt, binsPt, kNdpt, binsDPt, nNspc, binsSpc);
-    //ax = h->GetZaxis();
-    //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
-  } else h->Reset();
-  arr->AddAt(h, 8);
-  // 1/Pt pulls
-  snprintf(hname, 100, "%s_%s_1Pt", GetNameId(), name);
-  snprintf(htitle, 300, "#splitline{1/P_{t} pull for}{\"%s\" @ %s};1/p_{t}^{MC} [c/GeV];#Delta(1/p_{t})/#sigma(1/p_{t});SPECIES", GetNameId(), name);
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle,
-                 kNpt, 0., 2., 100, -4., 4., kNspc, -5.5, kNspc-.5);
-    //ax = h->GetZaxis();
-    //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
-  } else h->Reset();
-  arr->AddAt(h, 9);
-  // P resolution
-  snprintf(hname, 100, "%s_%s_P", GetNameId(), name);
-  snprintf(htitle, 300, "P res for \"%s\" @ %s;p [GeV/c];#Delta p/p^{MC};SPECIES", GetNameId(), name);
-  if(!(h = (TH3S*)gROOT->FindObject(hname))){
-    h = new TH3S(hname, htitle,
-                 kNpt, binsPt, kNdpt, binsDPt, nNspc, binsSpc);
-    //ax = h->GetZaxis();
-    //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
-  } else h->Reset();
-  arr->AddAt(h, 10);
-
-  return arr;
-}
-
-
 //________________________________________________________
 TObjArray* AliTRDresolution::Histos()
 {
@@ -3069,6 +2802,11 @@ TObjArray* AliTRDresolution::Histos()
     Int_t trinNbins[mdim];   memcpy(trinNbins, fgkNbins, kNdim*sizeof(Int_t));
     Double_t trinMin[mdim];  memcpy(trinMin, fgkMin, kNdim*sizeof(Double_t));
     Double_t trinMax[mdim];  memcpy(trinMax, fgkMax, kNdim*sizeof(Double_t));
+    if(fTriggerList){
+      trinTitle[kBC]=StrDup("trigger"); 
+      trinNbins[kBC] = TMath::Power(2.,fTriggerList->GetEntriesFast())-1;
+      trinMin[kBC] = 0.5; trinMax[kBC] = trinNbins[kBC]+.5;
+    }
     trinNbins[kSpeciesChgRC] = Int_t(kNcharge)*(kNspc-1)+1; trinMin[kSpeciesChgRC] = -kNspc+0.5; trinMax[kSpeciesChgRC] = kNspc-0.5;
     if(DebugLevel()>=1){trinNbins[kPt]=24; trinMax[kPt] = 23.5;}
     trinTitle[kNdim]=StrDup("bin_p"); trinNbins[kNdim] = (DebugLevel()>=1?24:kNpt); trinMin[kNdim] = -0.5; trinMax[kNdim] = trinNbins[kNdim]-.5;
index 45524c9a6cd23514041ff7583937517267cf3457..f5bee03ab5a2b4a7a71aaf39bc59bc70479aefb5 100644 (file)
@@ -103,7 +103,6 @@ public:
   void            UserCreateOutputObjects();
 //  Float_t GetCorrectionX(Int_t det, Int_t tb) const {return fXcorr[det][tb];}
   static void     GetRangeZ(TH2 *h2, Float_t &m, Float_t &M);
-  Float_t         GetDyRange() const {return fDyRange;}
   Float_t         GetPtThreshold() const {return fPtThreshold;}
   static Int_t    GetPtBin(Float_t pt);
   Bool_t          GetRefFigure(Int_t ifig);
@@ -134,9 +133,8 @@ public:
   TH1*            PlotMC(const AliTRDtrackV1 *t=NULL);
 
   static Bool_t   Process(TH2* const /*h2*/, TGraphErrors **/*g*/, Int_t stat=100){ return Bool_t(stat);}
-  void            SetDyRange(Float_t dy) {fDyRange = dy;}
   void            SetPtThreshold(Float_t pt)            { fPtThreshold = pt;}
-  void            SetBCselectTOF(Int_t b=0)             { fBCbinTOF = b==0?2:(b<0?1:3);}
+  void            SetBCselectTOF(Int_t b=0)             { fBCbinTOF = b;}
   void            SetBCselectFill(Int_t b=0)            { fBCbinFill = b<0||b>3499?1:b+1;}
   void            SetBsign(Int_t b=0)                   { fBsign = Bool_t(b);}
   void            SetProcesses(Bool_t det, Bool_t cl, Bool_t trklt, Bool_t trkin);
@@ -151,9 +149,6 @@ public:
   static Bool_t   UseTrack(const Int_t np, const AliTrackPoint *points, Float_t params[10]);
 
   void        AdjustF1(TH1 *h, TF1 *f);
-  TObjArray*  BuildMonitorContainerCluster(const char* name, Bool_t expand=kFALSE, Float_t range=-1.);
-  TObjArray*  BuildMonitorContainerTracklet(const char* name, Bool_t expand=kFALSE);
-  TObjArray*  BuildMonitorContainerTrack(const char* name);
   void        DrawSigma(TH2 *h2, const Char_t *t, Float_t m=0., Float_t M=-1., Float_t scale=1);
   void        GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM);
   void        GetRange(TH2 *h2, Char_t mod, Float_t *range);
@@ -172,9 +167,7 @@ protected:
   UShort_t              fSteer;           // bit map to steer internal behaviour of class
                                           // MakeProjection [kTrackIn kTracklet kCluster kDetector]
                                           // Dump3D [4+kTrackIn 4+kTracklet 4+kCluster 4+kDetector]
-  UShort_t              fIdxFrame;        // frame counter (internal)
   Float_t               fPtThreshold;     // pt threshold for some performance plots
-  Float_t               fDyRange;         // min/max dy
   Int_t                 fBCbinTOF;        // set/select by TOF BC index
   Int_t                 fBCbinFill;       // set/select by Bunch Fill index
   Bool_t                fBsign;           // sign of magnetic field (kFALSE[-] kTRUE[+])
@@ -191,6 +184,6 @@ protected:
   TObjArray            *fCl;              //! cluster2track calib
   TObjArray            *fMCcl;            //! cluster2mc calib
   
-  ClassDef(AliTRDresolution, 10) // TRD tracking resolution task
+  ClassDef(AliTRDresolution, 11) // TRD tracking resolution task
 };
 #endif
diff --git a/PWGPP/TRD/info/AliTRDchmbInfo.cxx b/PWGPP/TRD/info/AliTRDchmbInfo.cxx
new file mode 100644 (file)
index 0000000..cd7d215
--- /dev/null
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Chamber Info Incapsulation                                             //
+//                                                                        //
+//  Authors:                                                              //
+//    Alexandru Bercuci <A.Bercuci@gsi.de>                                //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+
+
+#include "TBox.h"
+
+#include "AliLog.h"
+#include "AliTRDchmbInfo.h"
+#include "AliTRDgeometry.h"
+
+ClassImp(AliTRDchmbInfo)
+//____________________________________________
+AliTRDchmbInfo::AliTRDchmbInfo()
+  :TNamed()
+  ,fDet(-1)
+  ,fStatus(0)
+  ,fBox(NULL)
+{
+//  Constructor. Reset all fields.
+  memset(fPosition, 0, 4*sizeof(Double_t));
+}
+
+
+//____________________________________________
+AliTRDchmbInfo::AliTRDchmbInfo(Int_t det, Int_t stat, Double_t p[4])
+  :TNamed(Form("D%03d", det), "")
+  ,fDet(det)
+  ,fStatus(stat)
+  ,fBox(NULL)
+{
+//  Constructor. Set position fields.
+  SetPosition(p);
+}
+
+//____________________________________________
+AliTRDchmbInfo::~AliTRDchmbInfo()
+{
+//  Destructor. 
+  if(fBox) delete fBox;
+}
+
+//____________________________________________
+void AliTRDchmbInfo::Print(Option_t */*o*/) const
+{
+//   Dump formated chamber info
+
+  printf("  DET[%03d] Status[%d]\n", fDet, fStatus);
+  printf("  eta[%f %f] phi[%f %f]\n", fPosition[0], fPosition[2], fPosition[1], fPosition[3]);
+}
+
+//____________________________________________
+void AliTRDchmbInfo::SetDetector(Int_t det)
+{
+// register detector no.
+  fDet = det;
+  SetName(Form("D%03d", det));
+}
+
+//____________________________________________
+void AliTRDchmbInfo::Draw(Option_t *opt)
+{
+// set style parameters according to chamber status
+
+  Int_t style[] = {0, 3003, 3008};
+  if(!fBox) fBox = new TBox();
+  fBox->SetLineColor(kBlack);fBox->SetFillColor(kWhite);fBox->SetFillStyle(style[0]);
+
+  Float_t xmin(0.), xmax(0.);
+  if(strcmp(opt, "eta")==0){
+    xmin=fPosition[0]; xmax=fPosition[2];
+  } else if(strcmp(opt, "pad")==0){
+    Int_t stk(AliTRDgeometry::GetStack(fDet));
+    xmin=-0.6+16*(4-stk)-(stk<2?4:0); xmax=xmin+(stk==2?12:16)-0.2;
+  } else {
+    AliWarning(Form("Unknow option \"%s\"", opt));
+    return;
+  }
+
+  AliDebug(2, Form("D[%03d] 0[%+4.1f(%+4.1f) %+4.1f] 1[%+4.1f(%+4.1f) %+4.1f] opt[%d]", fDet, xmin, fPosition[0], fPosition[1], xmax, fPosition[2], fPosition[3], fStatus));
+  fBox->SetX1(xmin); fBox->SetX2(xmax); fBox->SetY1(fPosition[1]); fBox->SetY2(fPosition[3]);
+  if(fStatus==1){
+    fBox->SetFillStyle(style[1]);fBox->SetFillColor(kBlack);
+  } else {
+    if(fStatus==2){
+      TBox *b = fBox->DrawBox(xmin, fPosition[1], xmax, 0.5*(fPosition[3]+fPosition[1]));
+      b->SetFillStyle(style[2]);b->SetFillColor(kGreen);
+    } else if(fStatus==3){
+      TBox *b = fBox->DrawBox(xmin, 0.5*(fPosition[3]+fPosition[1]), xmax, fPosition[3]);
+      b->SetFillStyle(style[2]);b->SetFillColor(kRed);
+    } else if(fStatus!=0){
+      AliError(Form("Wrong chmb. status[%d] for det[%03d]", fStatus, fDet));
+      return;
+    }
+  }
+  fBox->Draw();
+}
diff --git a/PWGPP/TRD/info/AliTRDchmbInfo.h b/PWGPP/TRD/info/AliTRDchmbInfo.h
new file mode 100644 (file)
index 0000000..5782bfd
--- /dev/null
@@ -0,0 +1,50 @@
+#ifndef ALITRDCHMBINFO_H
+#define ALITRDCHMBINFO_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Chamber Info Incapsulation                                            //
+//                                                                        //
+//  Authors:                                                              //
+//    Alexandru Bercuci <A.Bercuci@gsi.de>                                //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TNamed
+#include "TNamed.h"
+#endif
+
+class TBox;
+class TCollection;
+class AliTRDchmbInfo : public TNamed
+{
+public:  
+  AliTRDchmbInfo();
+  AliTRDchmbInfo(Int_t det, Int_t stat, Double_t p[4]);
+  virtual ~AliTRDchmbInfo();
+
+  void        Draw(Option_t* option = "eta");
+  Short_t     GetDetector() const          { return fDet;}
+  const Double_t*   GetPosition() const    { return &fPosition[0];}
+  Char_t      GetStatus() const            { return fStatus;}
+  Long64_t    Merge(TCollection* /*list*/) { return 0;}
+  void        Print(Option_t *o="") const;  // *MENU*
+  void        SetDetector(Int_t det);
+  void        SetPosition(Double_t p[4])   { memcpy(fPosition, p, 4*sizeof(Double_t));}
+  void        SetStatus(Int_t stat)        { fStatus = stat;}
+
+private:
+  AliTRDchmbInfo(const AliTRDchmbInfo &ref);
+  const AliTRDchmbInfo& operator=(const AliTRDchmbInfo &ref);
+
+  Short_t     fDet;           // chamber no.
+  Char_t      fStatus;        // status of chamber
+  Double_t    fPosition[4];   // eta-phi position
+  TBox        *fBox;          //! graph representation of chmb info
+  ClassDef(AliTRDchmbInfo, 1) // TRD chamber position/status representation
+};
+
+#endif
+
index a5e9b637b4c9252031c83c0c9be1cc08874a4310..8cf64df01812899de4b2af08204763e73c2b4042 100644 (file)
@@ -114,7 +114,7 @@ Bool_t AliTRDeventCuts::IsSelected(AliESDEvent *ev, Bool_t col)
     TObjString *trg(NULL);
     while((trg = dynamic_cast<TObjString *>(trgIter->Next())))
       passTrigger = passTrigger || CheckTrigger(trg->String().Data());
-    delete triggers; delete trgIter;
+    triggers->Delete(); delete triggers; delete trgIter;
     select = select && passTrigger;
   }
   if(!select){
index 2eb2db4dffaa3a2bf3702fbb951fe1fe99c65a26..dd387b770bd66893bf3521d1c20b3b9954b694bc 100644 (file)
@@ -140,6 +140,13 @@ Int_t  AliTRDeventInfo::GetCentralityBin(Float_t cenPer)
   return -1;
 }
 
+//____________________________________________________________________
+TString  AliTRDeventInfo::GetFiredTriggerClasses()
+{
+// copy of similar function from AliESDEvent
+  return (fRun&&fHeader)?fRun->GetFiredTriggerClasses(fHeader->GetTriggerMask()):"";
+}
+
 //____________________________________________________________________
 Int_t  AliTRDeventInfo::GetMultiplicityBin(Int_t n)
 {
index a2d8ec744e8623bf1d0d9819d1db4f83935e0b81..ba03e66f16a0cd846471554618943328a3ffba75 100644 (file)
@@ -13,6 +13,7 @@
 ////////////////////////////////////////////////////////////////////////////
 
 #include <TObject.h>
+#include <TString.h>
 
 class AliESDHeader;
 class AliESDRun;
@@ -34,6 +35,7 @@ public:
   AliESDRun*    GetRunInfo() const                     { return fRun; }
   Int_t         GetCentrality() const                  { return fCentrality; }
   static Int_t  GetCentralityBin(Float_t cenPer);
+  TString       GetFiredTriggerClasses();
   Int_t         GetMultiplicity() const                { return fMult; }
   static Int_t  GetMultiplicityBin(Int_t n);
   UShort_t      GetBunchFill() const;
index 2ba66b74209d9c40010a1bd9e3ecf0bd4d1cfe18..bb9de57e18d16549cef3805ae8c8f64d275ae8e3 100644 (file)
@@ -42,6 +42,7 @@ AliTRDtrendValue::AliTRDtrendValue(const Char_t *n, const Char_t *t)
   if(names->GetEntriesFast()!=2){
     AliError(Form("Wrong trend value name format. Trend value name should be of the form \"trendClass_trendValue\" with only one \"_\" character."));
   } else SetName(n);
+  names->Delete(); delete names;
 
   //memset(fAlarmMessage, 0, kNlevels*sizeof(Char_t*));
   memset(fNotifiable, 0, kNnotifiable*sizeof(TNamed*));
@@ -86,28 +87,31 @@ const char* AliTRDtrendValue::GetAlarmMessage(Int_t ns) const
 //____________________________________________
 const char* AliTRDtrendValue::GetClassName() const
 {
-// Check task to which value belong
+// Check task to which value belong. Return value on heap !
   TString s(TNamed::GetName());
   TObjArray *names(s.Tokenize("_"));
   if(names->GetEntriesFast()!=2){
     AliError(Form("Wrong trend value name format."));
     return NULL;
   }
-
-  return ((TObjString*)names->At(0))->String().Data();
+  char *cn=StrDup(((TObjString*)(*names)[0])->GetName());
+  names->Delete(); delete names;
+  return cn;
 }
 
 //____________________________________________
 const char* AliTRDtrendValue::GetValueName() const
 {
-// value name
+// Value name.  Return value on heap !
   TString s(TNamed::GetName());
   TObjArray *names(s.Tokenize("_"));
   if(names->GetEntriesFast()!=2){
     AliError(Form("Wrong trend value name format."));
     return NULL;
   }
-  return ((TObjString*)names->At(1))->String().Data();
+  char *vn=StrDup(((TObjString*)(*names)[1])->GetName());
+  names->Delete(); delete names;
+  return vn;
 }
 
 //____________________________________________
index f442e6ad9c79630acee62e2985e41425d0b04a62..fad032d53d1c4fe855441a67e4cb95b46876d32c 100644 (file)
@@ -14,6 +14,7 @@
 #include "TH1F.h"
 #include "TAxis.h"
 #include "TGraph.h"
+#include "TLine.h"
 #include "TCanvas.h"
 #include "TString.h"
 
@@ -121,6 +122,7 @@ void AliTRDtrendingManager::AddValue(
       } else {
         fValue->SetResponsible(((TObjString*)r->At(0))->String().Data(), ((TObjString*)r->At(1))->String().Data());
       }
+      r->Delete(); delete r;
     }
     if(notifiables){
       TString s(notifiables);
@@ -133,7 +135,9 @@ void AliTRDtrendingManager::AddValue(
         } else {
           fValue->SetNotifiable(((TObjString*)r->At(0))->String().Data(), ((TObjString*)r->At(1))->String().Data());
         }
+        r->Delete(); delete r;
       }
+      n->Delete(); delete n;
     }
   }
 
@@ -153,21 +157,23 @@ AliTRDtrendValue* AliTRDtrendingManager::GetValue(const Char_t *name)
 }
 
 //____________________________________________
-Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
+TH1* AliTRDtrendingManager::MakeTrends(const char *fileList, TObjArray *dump)
 {
 // Make trends with reference to DB for all trend files in "fileList".
 // The DB should be loaded
   if(!fEntries){
     AliWarning("Trending map undefined");
-    return kFALSE;
+    return NULL;
   }
   Int_t ntv(fEntries->GetEntries());
 
   FILE *fp(NULL);
   if(!(fp= fopen(fileList, "rt"))){
     AliWarning(Form("Can not open file list \"%s\"", fileList));
-    return kFALSE;
+    return NULL;
   }
+  Int_t *na = new Int_t[ntv]; memset(na, 0, ntv*sizeof(Int_t));
+  Float_t *la = new Float_t[ntv]; memset(la, 0, ntv*sizeof(Float_t));
   Float_t *lm = new Float_t[ntv]; for(Int_t im(0); im<ntv; im++) lm[im] = 1.e5;
   Float_t *lM = new Float_t[ntv]; for(Int_t im(0); im<ntv; im++) lM[im] = -1.e5;
   TGraph **g = new TGraph*[ntv]; memset(g, 0, ntv*sizeof(TGraph*));
@@ -178,8 +184,9 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
     TObjArray *afp=sfp.Tokenize("/");
     Int_t idx = afp->GetEntries()-2;
     Int_t rno = ((TObjString*)(*afp)[idx])->GetString().Atoi();
-
+    afp->Delete(); delete afp;
     if(!TFile::Open(sfp.Data())) continue;
+
     run[nr] = rno;
     for(Int_t it(0); it<ntv; it++){
       if(!(TV = (AliTRDtrendValue*)fEntries->At(it))) continue;
@@ -187,17 +194,22 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
         AliWarning(Form("Missing %09d.%s", rno, TV->GetName()));
         continue;
       }
-      if(IsRelativeMeanSigma()) (*tv)/=(*TV);
+      if(tv->GetVal()<-998. ||
+         (strstr(TV->GetName(), "TRDcheckDET")&&TMath::Abs(tv->GetVal())<1.e-5)) continue;
+      if(IsRelativeMeanSigma()){
+        (*tv)/=(*TV);
+        la[it]+=tv->GetVal(); na[it]++;
+      } else {
+        if(tv->GetVal()<lm[it]) lm[it]=tv->GetVal();
+        if(tv->GetVal()>lM[it])lM[it]=tv->GetVal();
+      }
       if(!g[it]){
         g[it] = new TGraph();
         g[it]->SetNameTitle(TV->GetName(), TV->GetTitle());
-        g[it]->SetMarkerStyle(4);g[it]->SetMarkerSize(0.8);
+        g[it]->SetMarkerStyle(4);g[it]->SetMarkerSize(1.2);
+        g[it]->SetLineStyle(2);g[it]->SetLineWidth(1);
       }
       g[it]->SetPoint(g[it]->GetN(), nr, tv->GetVal());
-      if(!IsRelativeMeanSigma() && tv->GetVal()>-999.){
-        if(tv->GetVal()<lm[it]) lm[it]=tv->GetVal();
-        if(tv->GetVal()>lM[it]) lM[it]=tv->GetVal();
-      }
     }
     nr++;
   }
@@ -208,7 +220,8 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
   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);
+  TLine *line(NULL);
+  TCanvas *c = new TCanvas("c", "TRD Trend", 1, 1, 2400, 1000);
   c->SetLeftMargin(IsRelativeMeanSigma()?0.03666361:0.05685619);
   c->SetRightMargin(0.005499542);
   c->SetTopMargin(0.02542373);
@@ -219,19 +232,26 @@ Bool_t AliTRDtrendingManager::MakeTrends(const char *fileList)
     if(IsRelativeMeanSigma()){
       ay->SetRangeUser(-5, 5);
       ay->SetTitle(Form("#bf{%s [#sigmau]}", g[it]->GetTitle()));
+      line = new TLine(-0.5, na[it]?(la[it]/na[it]):0., nr-0.5, na[it]?(la[it]/na[it]):0.);
+      line->SetLineColor(kBlue);
     } else {
       ay->SetRangeUser(lm[it]-0.1*(lM[it]-lm[it]), lM[it]+0.1*(lM[it]-lm[it]));
       ay->SetTitle(Form("#bf{%s}", g[it]->GetTitle()));
     }
     hT->Draw("p");
-    g[it]->Draw("p");
+    g[it]->Draw("pl");
+    if(line) line->Draw();
     c->Modified(); c->Update(); c->SaveAs(Form("Trend_%s.gif", g[it]->GetName()));
-    delete g[it];
+    if(dump) dump->Add(g[it]);
+    else delete g[it];
+    if(line) delete line;
   }
   delete [] g;
   delete [] lm;
   delete [] lM;
-  return kTRUE;
+  delete [] la;
+  delete [] na;
+  return hT;
 }
 
 //____________________________________________
@@ -274,6 +294,7 @@ Bool_t AliTRDtrendingManager::ModifyValue(
     } else { 
       fValue->SetResponsible(((TObjString*)r->At(0))->String().Data(), ((TObjString*)r->At(1))->String().Data());
     }
+    r->Delete(); delete r;
   }
   if(notifiables){
     s=notifiables;
@@ -286,7 +307,9 @@ Bool_t AliTRDtrendingManager::ModifyValue(
       } else { 
         fValue->SetNotifiable(((TObjString*)r->At(0))->String().Data(), ((TObjString*)r->At(1))->String().Data());
       }
+      r->Delete(); delete r;
     }
+    n->Delete(); delete n;
   }
   return kTRUE;
 }
index ce1c1d5a178376edaff664dba59aae7711759fe7..8fb732ddabb426fc2e7175194d0acde8d1b1719e 100644 (file)
@@ -20,6 +20,7 @@
 #include "AliTRDtrendValue.h"
 #endif
 
+class TH1;
 class TObjArray;
 class AliTRDtrendingManager : public TObject
 {
@@ -39,7 +40,7 @@ public:
   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);
+  TH1*              MakeTrends(const char *fileList, TObjArray *dump=NULL);
   Bool_t            ModifyValue(const Char_t *name
                             ,const Char_t *title
                             ,Double_t mean,Double_t sigm
diff --git a/PWGPP/TRD/info/AliTRDtriggerInfo.cxx b/PWGPP/TRD/info/AliTRDtriggerInfo.cxx
new file mode 100644 (file)
index 0000000..77dd213
--- /dev/null
@@ -0,0 +1,157 @@
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Mergable Trigger List                                                 //
+//                                                                        //
+//  Authors:                                                              //
+//    Alexandru Bercuci <A.Bercuci@gsi.de>                                //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+
+
+#include "TObjArray.h"
+#include "TObjString.h"
+#include "TH1.h"
+
+#include "AliLog.h"
+
+#include "AliTRDtriggerInfo.h"
+
+ClassImp(AliTRDtriggerInfo)
+//____________________________________________
+AliTRDtriggerInfo::AliTRDtriggerInfo()
+  :TObject()
+  ,fTriggerList(NULL)
+  ,fHisto(NULL)
+{
+//  Constructor. Reset all fields.
+  memset(fTriggerSel, 0, kTriggerListSize *sizeof(Bool_t));
+  memset(fTriggerStat, 0, kTriggerListSize *sizeof(Int_t));
+}
+
+//____________________________________________
+AliTRDtriggerInfo::~AliTRDtriggerInfo()
+{
+//  Destructor. 
+  if(fHisto) delete fHisto;
+  if(fTriggerList){ fTriggerList->Delete(); delete fTriggerList;}
+}
+
+//____________________________________________
+Int_t AliTRDtriggerInfo::Add(const Char_t *trigger, Int_t nstat, Bool_t select)
+{
+// Add trigger named "trigger" to the list. If trigger is not on the list it is add.
+// The statistics of this trigger is set to "nstat" [default=1]
+// On return the position incremented
+
+  Int_t itrig(-1), nt(0);
+  if((nt=GetNTriggers()) && (itrig = GetTrigger(trigger))>=0){
+    fTriggerSel[itrig]  = select;
+    fTriggerStat[itrig]+= nstat;
+  } else {
+    if(!nt) fTriggerList = new TObjArray;
+    fTriggerList->AddAt(new TObjString(trigger), nt);
+    fTriggerStat[nt] = nstat;
+    fTriggerSel[nt]  = select;
+    nt++;
+  }
+  return nt;
+}
+
+//____________________________________________
+void AliTRDtriggerInfo::Draw(Option_t *opt)
+{
+// Draw trigger statistics. Via parameter "opt" one can select a sublist of trigger names
+
+  Int_t nt(0);
+  if(!(nt = GetNTriggers())) return;
+  if(fHisto && fHisto->GetNbinsX() != nt){ delete fHisto; fHisto=NULL;}
+//
+  if(!fHisto) fHisto = new TH1I("hTriggerStat", "Trigger Statistics;TRIGGER;Freq. [%]", nt, 0.5, nt+0.5);
+  TAxis *ax(fHisto->GetXaxis());  fHisto->Reset();
+  ax->SetTitleOffset(6.5); ax->CenterTitle();
+  fHisto->SetFillStyle(3001);fHisto->SetFillColor(kGreen);
+  fHisto->SetBarWidth(0.8);fHisto->SetBarOffset(0.1);
+//
+  Int_t ibin(0);
+  if(strcmp(opt, "")!=0){
+    TString sopt(opt);
+    TObjArray *optTriggers = sopt.Tokenize(" ");
+    for(Int_t iopt(0); iopt<optTriggers->GetEntries(); iopt++){
+      const Char_t *trigger = ((TObjString*)(*optTriggers)[iopt])->GetName();
+      Int_t itrig(-1);
+      if((itrig = GetTrigger(trigger))<0) continue;
+      ibin++;
+      ax->SetBinLabel(ibin, trigger);
+      fHisto->SetBinContent(ibin, fTriggerStat[itrig]);
+    }
+    optTriggers->Delete(); delete optTriggers;
+  } else {
+    for(Int_t jtrig(nt); jtrig--;){
+      ibin++;
+      ax->SetBinLabel(ibin, ((TObjString*)(*fTriggerList)[jtrig])->GetName());
+      fHisto->SetBinContent(ibin, fTriggerStat[jtrig]);
+    }
+  }
+  ax->SetRange(1, ibin);
+  fHisto->Scale(1.e2/fHisto->Integral());
+  fHisto->Draw("hbar2");
+
+  return;
+}
+
+//____________________________________________
+Int_t AliTRDtriggerInfo::GetNTriggers() const
+{
+// Return no of trigger classes
+  return fTriggerList?fTriggerList->GetEntries():0;
+}
+
+//____________________________________________
+const char* AliTRDtriggerInfo::GetTrigger(Int_t it) const
+{
+// Return trigger by index. 0 in case it is not found
+  if(it<0||it>=GetNTriggers()) return 0;
+  return ((TObjString*)(*fTriggerList)[it])->GetName();
+}
+
+//____________________________________________
+Int_t AliTRDtriggerInfo::GetTrigger(const char *trigger) const
+{
+// Return trigger index by name. -1 in case trigger not registred
+
+  for(Int_t jtrig(GetNTriggers()); jtrig--;){
+    if(((TObjString*)(*fTriggerList)[jtrig])->String().CompareTo(trigger)==0) return jtrig;
+  }
+  return -1;
+}
+
+//____________________________________________
+Long64_t AliTRDtriggerInfo::Merge(TCollection* list)
+{
+// Merge list of trigger statistics. Add new triggers if neccessary
+
+  Int_t imerge(1);
+  AliTRDtriggerInfo *o(NULL);
+  TIterator *it(list->MakeIterator());
+  while((o  = (AliTRDtriggerInfo*)it->Next())){
+    for(Int_t jtrig(o->GetNTriggers()); jtrig--;) Add(((TObjString*)(*o->fTriggerList)[jtrig])->GetName(), o->fTriggerStat[jtrig], o->fTriggerSel[jtrig]);
+    imerge++;
+  }
+  return imerge;
+}
+  
+//____________________________________________
+void AliTRDtriggerInfo::Print(Option_t *opt) const
+{
+// Print trigger statistics. If opt="a" detailed trigger/statistics is also provided
+
+  Int_t nt(GetNTriggers());
+  Int_t stat(0); for(Int_t jtrig(0); jtrig<nt; jtrig++) stat+=fTriggerStat[jtrig];
+  printf("TriggerClasses[%3d] Stat[%5d]\n", nt, stat);
+  if(!nt || strcmp(opt,"a")!=0) return;
+
+  for(Int_t jtrig(0); jtrig<nt; jtrig++) printf("  %3d \"%s\" [%5d]\n", jtrig, ((TObjString*)(*fTriggerList)[jtrig])->GetName(), fTriggerStat[jtrig]);
+}
+
+
diff --git a/PWGPP/TRD/info/AliTRDtriggerInfo.h b/PWGPP/TRD/info/AliTRDtriggerInfo.h
new file mode 100644 (file)
index 0000000..cb509a2
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALITRDTRIGGERINFO_H
+#define ALITRDTRIGGERINFO_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Chamber Info Incapsulation                                            //
+//                                                                        //
+//  Authors:                                                              //
+//    Alexandru Bercuci <A.Bercuci@gsi.de>                                //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef ROOT_TObject
+#include "TObject.h"
+#endif
+#define kTriggerListSize 1000
+
+class TH1;
+class TCollection;
+class TObjArray;
+class AliTRDtriggerInfo : public TObject
+{
+public:
+  AliTRDtriggerInfo();
+  virtual ~AliTRDtriggerInfo();
+
+  Int_t       Add(const Char_t *trigger, Int_t nstat=1, Bool_t select=kFALSE);
+  void        Draw(Option_t* option = "");  // *MENU*
+  Int_t       GetNTriggers() const;
+  const char* GetTrigger(Int_t it) const;
+  Int_t       GetTrigger(const char *trigger) const;
+
+  Bool_t      IsSelected(Int_t it) const            { return it>=0&&it<GetNTriggers()?fTriggerSel[it]:kFALSE;}
+  Bool_t      IsSelected(const char* trigger) const { Int_t idx(GetTrigger(trigger)); return IsSelected(idx);}
+
+  Long64_t    Merge(TCollection* list);
+  void        Print(Option_t *o="") const;  // *MENU*
+  void        SetSelectTrigger(Int_t it, Bool_t sel=kTRUE) { if(it>=0&&it<GetNTriggers()) fTriggerSel[it]=sel;}
+private:
+  AliTRDtriggerInfo(const AliTRDtriggerInfo &ref);
+  const AliTRDtriggerInfo& operator=(const AliTRDtriggerInfo &ref);
+
+  Bool_t      fTriggerSel[kTriggerListSize];  // trigger selection corresponding to fTriggerList
+  Int_t       fTriggerStat[kTriggerListSize]; // trigger statistics corresponding to fTriggerList
+  TObjArray  *fTriggerList;                   // list of trigger names
+  TH1        *fHisto;                         //! graphic representation of trigger statistics
+
+  ClassDef(AliTRDtriggerInfo, 1)              // trigger statistics
+};
+
+#endif
+
index 5bc98757075d89ecb75d4deff58db5c8c13b56ab..586712b3918db40a85eb1c0c1702d36c1e24e2cf 100644 (file)
@@ -26,6 +26,7 @@ void AddTRDresolution(AliAnalysisManager *mgr, Int_t map, AliAnalysisDataContain
     res->SetPostProcess(kFALSE);
     //res->SetDebugLevel(3);
     res->SetPtThreshold(0.2);
+    //res->SetTriggerList("CINT7WUHJT-S-NOPF-CENT CINT7WUHSE-S-NOPF-CENT CINT7WUHQU-S-NOPF-CENT CEMC7WU-S-NOPF-ALL");
     res->SetNameId(suffix[itq]);
     mgr->ConnectInput(res, 0, mgr->GetCommonInputContainer()); // connect main (ESD) container 
     mgr->ConnectInput(res, 1, ci[itq]);                        // conect track info container
index 186db2e9c2cf0811392a17998510feb14137865f..293c99c20a6fec1b47b37d7e514dcd3c6cb84920 100644 (file)
@@ -225,14 +225,14 @@ void processGEN(TNamed *otask, const Char_t *filename)
     delete info;
     return;
   }
-  if(summary) Info("processGEN", "MakeSummary() not implemented yet");//info->MakeSummary();
-  else{
-    for(Int_t ipic(0); ipic<info->GetNRefFigures(); ipic++){
-      c->Clear();
-      if(!info->GetRefFigure(ipic)) continue;
-      c->SaveAs(Form("%s_Fig%02d.gif", info->GetName(), ipic));
-    }
-  }
+  info->MakeSummary();
+//   else{
+//     for(Int_t ipic(0); ipic<info->GetNRefFigures(); ipic++){
+//       c->Clear();
+//       if(!info->GetRefFigure(ipic)) continue;
+//       c->SaveAs(Form("%s_Fig%02d.gif", info->GetName(), ipic));
+//     }
+//   }
 
   delete info;
 }
index 44cb284fd4b81f0f1ecb86a808621cacbd3fe8ea..83b6ca6944fc61437f722610a377bb3e41f98a87 100644 (file)
@@ -10,7 +10,14 @@ void makeTrending(const Char_t *fl, Bool_t relative=kFALSE, const Char_t *db = "
   AliTRDtrendingManager *tm = AliTRDtrendingManager::Instance();
   tm->Load(db);
   tm->SetRelativeMeanSigma(relative);
-  tm->MakeTrends(fl);
+
+  TH1 *h1(NULL); TObjArray *trend = new TObjArray(100);
+  h1 = tm->MakeTrends(fl, trend);
+
+  TFile *fOut = TFile::Open("Trend_TRDgraph.root", "RECREATE");
+  h1->SetDirectory(fOut); h1->Write();
+  trend->Write();
+  fOut->Close();
   return;
 }
 
index ef4b97082ed421b2e6317d6f3051b1f0a67f7e0f..caf0dd8bf408d1da2991dca12e5425bda0922d6b 100644 (file)
@@ -260,7 +260,7 @@ void makeTrendingDB(const Char_t *fl)
       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));
+    h = new TH1F("hp", Form(";%s;entries", tvn[it][0]), 25, 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());
@@ -281,7 +281,7 @@ void makeTrendingDB(const Char_t *fl)
 /*    } 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);
+      m=f.GetParameter(1); s=h->GetRMS()/*f.GetParameter(2)*/;
 //    }
     tm->AddValue(tvn[it][0], m, s, tvn[it][1], res[it>13], notifiable);
   }