o add option to switch off pid caching in AddTask
authorwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Sep 2012 20:44:59 +0000 (20:44 +0000)
committerwiechula <wiechula@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 18 Sep 2012 20:44:59 +0000 (20:44 +0000)
o add option to set a user defined TPC Response file in AddTask

ANALYSIS/AliAnalysisTaskPIDResponse.cxx
ANALYSIS/AliAnalysisTaskPIDResponse.h
ANALYSIS/macros/AddTaskPIDResponse.C

index f0a2f08..0fc20fb 100644 (file)
@@ -37,6 +37,7 @@ AliAnalysisTaskSE(),
 fIsMC(kFALSE),
 fCachePID(kTRUE),
 fOADBPath(),
+fSpecialDetResponse(),
 fPIDResponse(0x0),
 fRun(0),
 fOldRun(0),
@@ -55,6 +56,7 @@ AliAnalysisTaskSE(name),
 fIsMC(kFALSE),
 fCachePID(kTRUE),
 fOADBPath(),
+fSpecialDetResponse(),
 fPIDResponse(0x0),
 fRun(0),
 fOldRun(0),
@@ -96,9 +98,22 @@ void AliAnalysisTaskPIDResponse::UserCreateOutputObjects()
   if (!fPIDResponse) AliFatal("PIDResponse object was not created");
 
   fPIDResponse->SetOADBPath(AliAnalysisManager::GetOADBPath());
+  fPIDResponse->SetCachePID(fCachePID);
   if (!fOADBPath.IsNull()) fPIDResponse->SetOADBPath(fOADBPath.Data());
 
   if(fIsTunedOnData) fPIDResponse->SetTunedOnData(kTRUE,fRecoPassTuned);
+
+  if (!fSpecialDetResponse.IsNull()){
+    TObjArray *arr=fSpecialDetResponse.Tokenize("; ");
+    for (Int_t i=0; i<arr->GetEntriesFast();++i){
+      TString resp(arr->At(i)->GetName());
+      if (resp.BeginsWith("TPC:")){
+        resp.ReplaceAll("TPC:","");
+        fPIDResponse->SetCustomTPCpidResponse(resp.Data());
+        AliInfo(Form("Setting custom TPC response file: '%s'",resp.Data()));
+      }
+    }
+  }
 }
 
 //______________________________________________________________________________
index 71cdd66..c3b2461 100644 (file)
@@ -44,10 +44,13 @@ public:
   const char* GetOADBPath() const { return fOADBPath.Data(); }
   void SetTuneOnData(Bool_t flag,Int_t recopass){fIsTunedOnData=flag;fRecoPassTuned=recopass;};
 
+  void SetSpecialDetectorResponse(const char* det) { fSpecialDetResponse=det; }
+
 private:
   Bool_t fIsMC;                        // If we run on MC data
   Bool_t fCachePID;                    // Cache PID values in transient object
   TString fOADBPath;                   // OADB path to use
+  TString fSpecialDetResponse;         // Special detector response files for debugging
   
   AliPIDResponse *fPIDResponse;        //! PID response Handler
   Int_t   fRun;                        //! current run number
index 2144412..e54dea7 100644 (file)
@@ -1,4 +1,6 @@
-AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,Bool_t tuneOnData=kFALSE,Int_t recoPass=2)
+AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,
+                                    Bool_t tuneOnData=kFALSE, Int_t recoPass=2,
+                                    Bool_t cachePID=kTRUE, TString detResponse="")
 {
 // Macro to connect a centrality selection task to an existing analysis manager.
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -41,6 +43,8 @@ AliAnalysisTask *AddTaskPIDResponse(Bool_t isMC=kFALSE, Bool_t autoMCesd=kTRUE,B
 //   pidTask->SelectCollisionCandidates(AliVEvent::kMB);
   pidTask->SetIsMC(isMC);
   if(isMC&&tuneOnData) pidTask->SetTuneOnData(kTRUE,recoPass);
+  pidTask->SetCachePID(cachePID);
+  pidTask->SetSpecialDetectorResponse(detResponse);
   mgr->AddTask(pidTask);
   
 //   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("PIDResponseQA",