set reco param on an event by event basis
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDinfoGen.cxx
index 3e9128bc09993b5ffdd54a0472cd8a54c54b6033..3eb74420c58c527c5cb31c502eb144a329e04a83 100644 (file)
@@ -123,6 +123,7 @@ AliTRDinfoGen::AliTRDinfoGen()
   ,fTracksKink(NULL)\r
   ,fV0List(NULL)\r
   ,fContainer(NULL)\r
+  ,fRecos(NULL)\r
   ,fDebugStream(NULL)\r
 {\r
   //\r
@@ -149,6 +150,7 @@ AliTRDinfoGen::AliTRDinfoGen(char* name)
   ,fTracksKink(NULL)\r
   ,fV0List(NULL)\r
   ,fContainer(NULL)\r
+  ,fRecos(NULL)\r
   ,fDebugStream(NULL)\r
 {\r
   //\r
@@ -229,7 +231,7 @@ void AliTRDinfoGen::UserCreateOutputObjects()
   fV0List = new TObjArray(10); fV0List->SetOwner(kTRUE);\r
 \r
   // define general monitor\r
-  fContainer = new TObjArray(1); fContainer->SetOwner(kTRUE);\r
+  fContainer = new TObjArray(2); fContainer->SetOwner(kTRUE);\r
   TH1 *h=new TH1I("hStat", "Run statistics;Observable;Entries", Int_t(kNObjects), -0.5, Float_t(kNObjects)-0.5);\r
   TAxis *ax(h->GetXaxis());\r
   ax->SetBinLabel(Int_t(kTracksESD) + 1, "ESD");\r
@@ -247,6 +249,13 @@ void AliTRDinfoGen::UserCreateOutputObjects()
   ax->SetBinLabel(Int_t(kBarrelFriend) + 1, "BFriend");\r
   ax->SetBinLabel(Int_t(kSAFriend) + 1, "SFriend");\r
   fContainer->AddAt(h, 0);\r
+  h=new TH1I("hEv", "Run statistics;Event Class;Entries", 4, -0.5, 3.5);\r
+  ax = h->GetXaxis();\r
+  ax->SetBinLabel(1, "Low");\r
+  ax->SetBinLabel(2, "High");\r
+  ax->SetBinLabel(3, "Cosmic");\r
+  ax->SetBinLabel(4, "Calib");\r
+  fContainer->AddAt(h, 1);\r
   PostData(AliTRDpwg1Helper::kMonitor, fContainer);\r
 }\r
 \r
@@ -322,33 +331,40 @@ void AliTRDinfoGen::UserExec(Option_t *){
     AliTRDtrackerV1::SetNTimeBins(AliTRDcalibDB::Instance()->GetNumberOfTimeBinsDCS());\r
     AliInfo(Form("OCDB :  Loc[%s] Run[%d] TB[%d]", fOCDB.Data(), ocdb->GetRun(), AliTRDtrackerV1::GetNTimeBins()));\r
 \r
-    // set reco param valid for this run/event\r
+    // load reco param list from OCDB\r
     AliInfo(Form("Initializing TRD reco params for EventSpecie[%d]...",\r
       fESDev->GetEventSpecie()));\r
     fgReconstructor = new AliTRDReconstructor();\r
     if(!(obj = ocdb->Get(AliCDBPath("TRD", "Calib", "RecoParam")))){\r
       AliError("RECO PARAM failed initialization.");\r
-      fgReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());\r
     } else {\r
       obj->PrintMetaData();\r
-      TObjArray *recos((TObjArray*)obj->GetObject());\r
-      for(Int_t ireco(0); ireco<recos->GetEntriesFast(); ireco++){\r
-        AliTRDrecoParam *reco((AliTRDrecoParam*)recos->At(ireco));\r
-        Int_t es(reco->GetEventSpecie());\r
-        if(!(es&fESDev->GetEventSpecie())) continue;\r
-        fgReconstructor->SetRecoParam(reco);\r
-        TString s;\r
-        if(es&AliRecoParam::kLowMult) s="LowMult";\r
-        else if(es&AliRecoParam::kHighMult) s="HighMult";\r
-        else if(es&AliRecoParam::kCosmic) s="Cosmic";\r
-        else if(es&AliRecoParam::kCalib) s="Calib";\r
-        else s="Unknown";\r
-        AliInfo(Form("Using reco params for %s", s.Data()));\r
-        break;\r
-      }\r
+      fRecos = (TObjArray*)obj->GetObject();\r
     }\r
     SetInitOCDB();\r
   }\r
+  // set reco param valid for this event\r
+  TH1 *h = (TH1I*)fContainer->At(1);\r
+  if(!fRecos){\r
+    fgReconstructor->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());\r
+    h->Fill(0);\r
+  } else {\r
+    for(Int_t ireco(0); ireco<fRecos->GetEntriesFast(); ireco++){\r
+      AliTRDrecoParam *reco((AliTRDrecoParam*)fRecos->At(ireco));\r
+      Int_t es(reco->GetEventSpecie());\r
+      if(!(es&fESDev->GetEventSpecie())) continue;\r
+      fgReconstructor->SetRecoParam(reco);\r
+      if(AliLog::GetDebugLevel("PWG1/TRD", "AliTRDinfoGen")>1) reco->Dump();\r
+      TString s;\r
+      if(es&AliRecoParam::kLowMult){ s="LowMult"; h->Fill(0);}\r
+      else if(es&AliRecoParam::kHighMult){ s="HighMult"; h->Fill(1);}\r
+      else if(es&AliRecoParam::kCosmic){ s="Cosmic"; h->Fill(2);}\r
+      else if(es&AliRecoParam::kCalib){ s="Calib"; h->Fill(3);}\r
+      else s="Unknown";\r
+      AliDebug(2, Form("Using reco param \"%s\" for event %d.", s.Data(), fESDev->GetEventNumberInFile()));\r
+      break;\r
+    }\r
+  }\r
 \r
   // link MC if available\r
   fMCev = MCEvent();\r
@@ -708,7 +724,7 @@ void AliTRDinfoGen::UserExec(Option_t *){
     ,nKink, nKinkMC, fTracksKink->GetEntries()\r
   ));\r
   // save track statistics\r
-  TH1 *h((TH1S*)fContainer->At(0));\r
+  h = (TH1I*)fContainer->At(0);\r
   h->Fill(Float_t(kTracksESD), nTracksESD);\r
   h->Fill(Float_t(kTracksMC), nTracksMC);\r
   h->Fill(Float_t(kV0), fV0List->GetEntries());\r