Adding possibility to use PID, + routine updates
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Oct 2011 14:55:29 +0000 (14:55 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Oct 2011 14:55:29 +0000 (14:55 +0000)
PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx
PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx
PWG0/multPbPb/AliAnalysisTaskMultPbTracks.h
PWG0/multPbPb/correct.C
PWG0/multPbPb/run.C
PWG0/multPbPb/run.sh

index c226fb7..cf4b722 100644 (file)
@@ -62,7 +62,7 @@ Bool_t AliAnalysisMultPbCentralitySelector::IsCentralityBinSelected(AliESDEvent*
     //    cout << "ok" << endl;
 
   }
- else if(fIsMC || fUseMultRange) {
+ else if(fUseMultRange) {
     if(!trackCuts){
       AliFatal("Track cuts object is invalid");
     }
index 37627a2..5ac7364 100644 (file)
@@ -22,6 +22,7 @@
 #include <iostream>
 #include "AliAnalysisMultPbCentralitySelector.h"
 #include "AliTriggerAnalysis.h"
+#include "AliPIDResponse.h"
 
 using namespace std;
 
@@ -29,7 +30,7 @@ ClassImp(AliAnalysisTaskMultPbTracks)
 
 AliAnalysisTaskMultPbTracks::AliAnalysisTaskMultPbTracks()
 : AliAnalysisTaskSE("TaskMultPbTracks"),
-  fESD(0),fHistoManager(0),fCentrSelector(0),fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0), fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0)
+  fESD(0),fHistoManager(0),fCentrSelector(0),fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0), fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0),fPIDResponse(0)
 {
   // constructor
 
@@ -43,7 +44,7 @@ AliAnalysisTaskMultPbTracks::AliAnalysisTaskMultPbTracks()
 }
 AliAnalysisTaskMultPbTracks::AliAnalysisTaskMultPbTracks(const char * name)
   : AliAnalysisTaskSE(name),
-    fESD(0),fHistoManager(0),fCentrSelector(0),fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0),fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0)
+    fESD(0),fHistoManager(0),fCentrSelector(0),fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0),fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0),fPIDResponse(0)
 {
   //
   // Standard constructur which should be used
@@ -59,7 +60,7 @@ AliAnalysisTaskMultPbTracks::AliAnalysisTaskMultPbTracks(const char * name)
 }
 
 AliAnalysisTaskMultPbTracks::AliAnalysisTaskMultPbTracks(const AliAnalysisTaskMultPbTracks& obj) : 
-  AliAnalysisTaskSE(obj) ,fESD (0), fHistoManager(0), fCentrSelector(0), fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0),fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0)
+  AliAnalysisTaskSE(obj) ,fESD (0), fHistoManager(0), fCentrSelector(0), fTrackCuts(0),fTrackCutsNoDCA(0),fOfflineTrigger(0),fIsMC(0),fIsTPCOnly(0), fTriggerAnalysis(0),fPIDResponse(0)
 {
   //copy ctor
   fESD = obj.fESD ;
@@ -103,6 +104,12 @@ void AliAnalysisTaskMultPbTracks::UserCreateOutputObjects()
 
   fTriggerAnalysis = new AliTriggerAnalysis();
   fTriggerAnalysis->SetAnalyzeMC(fIsMC);
+
+  //The common PID object can then be retrieved from the input handler. This can naturally be done in the UserCreateOutputObjects:
+  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
+  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
+  fPIDResponse = inputHandler->GetPIDResponse();
+
 }
 
 
@@ -290,6 +297,20 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
     Bool_t accepted = fTrackCuts->AcceptTrack(esdTrack);
     Bool_t acceptedNoDCA = fTrackCutsNoDCA->AcceptTrack(esdTrack);
 
+    // accepted = accepted && ((fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kElectron) > 2) ||
+    //                             (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kPion    ) < 1) || 
+    //                             (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kProton  ) < 1) || 
+    //                             (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kKaon    ) < 1) 
+    //                             //                      (esdTrack->P() > 1.2)
+    //                             );//FIXME SKIP ELECTRONS below p = 1.2 gev, make configurable. Keep particles if they are in the crossing
+
+    // acceptedNoDCA = acceptedNoDCA && ((fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kElectron) > 2) ||
+    //                                       (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kPion    ) < 1) || 
+    //                                       (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kProton  ) < 1) || 
+    //                                       (fPIDResponse->NumberOfSigmasTPC(esdTrack,AliPID::kKaon    ) < 1) 
+    //                                       //                                      (esdTrack->P() > 1.2)
+    //                                       );//FIXME SKIP ELECTRONS below p = 1.2 gev, make configurable. Keep particles if they are in the crossing
+
     if(accepted) acceptedTracks++;
 
     // Compute weighted offset
@@ -351,7 +372,6 @@ void AliAnalysisTaskMultPbTracks::UserExec(Option_t *)
     // Get label and corresponding mcPart;
     if (fIsMC) {
       Int_t label = TMath::Abs(esdTrack->GetLabel()); // no fakes!!!
-      //Int_t label = esdTrack->GetLabel(); // 
       AliMCParticle *mcPart  = label < 0 ? 0 : (AliMCParticle*)fMCEvent->GetTrack(label);
       if (!mcPart)  {
        if(accepted)
index 762f150..6b95929 100644 (file)
@@ -19,7 +19,7 @@ class AliESDtrackCuts;
 class AliAnalysisMultPbCentralitySelector;
 class AliAnalysisMultPbTrackHistoManager;
 class AliTriggerAnalysis;
-
+class AliPIDResponse;
 
 class AliAnalysisTaskMultPbTracks : public AliAnalysisTaskSE {
 
@@ -61,6 +61,7 @@ private:
   Bool_t fIsMC; // true if processing montecarlo
   Bool_t fIsTPCOnly; // if you only want to use TPC tracks
   AliTriggerAnalysis * fTriggerAnalysis; // for offline triggers
+  AliPIDResponse *fPIDResponse;     //! PID response object
 
 
   AliAnalysisTaskMultPbTracks& operator=(const AliAnalysisTaskMultPbTracks& task);
index 4e1468f..8254abf 100644 (file)
@@ -294,8 +294,8 @@ void CheckSecondaries(Double_t &fracWeak, Double_t &fracMaterial) {
   // Set the components which are used in HistoSum, the static
   // function for GetFunctionHistoSum
   // Project onti DCA axis
-  //const Int_t ptBinsFit[] = {3,5,7,9,11,15,19,23,31,-1};
-  const Int_t ptBinsFit[] = {3,20,-1};
+  const Int_t ptBinsFit[] = {3,5,7,9,11,15,19,23,31,-1};
+  //const Int_t ptBinsFit[] = {3,20,-1};
   Int_t ibinPt = -1;
   while(ptBinsFit[(++ibinPt)+1]!=-1){
     c1->cd(ibinPt+1);
index 39d38d3..ab818c3 100644 (file)
@@ -57,10 +57,18 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
   gROOT->ProcessLine(".L $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
   physicsSelectionTask = AddTaskPhysicsSelection(isMC);
 
+  //PID
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+  AddTaskPIDResponse(isMC); 
+
+
   // Centrality
   AliCentralitySelectionTask *taskCentr = new AliCentralitySelectionTask("CentralitySelection");
   const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityBy1D.root";
   const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/test_AliCentralityByFunction.root";
+  if(isMC) taskCentr-> SetMCInput();
+  taskCentr->SetPass(2);
+
   // const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_LHC10g2a_100.root";
   // const char * file2 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityByFunction_LHC10g2a_100.root";
   // const char * file1 = "$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_137161_GLAU.root";
@@ -69,8 +77,8 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
   // taskCentr->SetPercentileFile (file1);
   // taskCentr->SetPercentileFile2(file2);
   //FIXME: include back centrality estimator
-  //  mgr->AddTask(taskCentr);
-  //  mgr->ConnectInput (taskCentr,0, mgr->GetCommonInputContainer());
+  mgr->AddTask(taskCentr);
+  mgr->ConnectInput (taskCentr,0, mgr->GetCommonInputContainer());
 
   // Create my own centrality selector
   AliAnalysisMultPbCentralitySelector * centrSelector = new AliAnalysisMultPbCentralitySelector();
@@ -214,10 +222,8 @@ void run(Char_t* data, Long64_t nev = -1, Long64_t offset = 0, Bool_t debug = kF
 
   if (doSave) MoveOutput(data, pathsuffix.Data());
 
-  // FIXME
-  TFile * f = new TFile("cuts.root", "recreate");
-  cuts->SaveHistograms();
-  f->Close();
+  
+
   
 }
 
@@ -288,39 +294,41 @@ void InitAndLoadLibs(Int_t runMode=kMyRunModeLocal, Int_t workers=0,Bool_t debug
     {
       cout << "Init in CAF mode" << endl;
     
-      //gEnv->SetValue("XSec.GSI.DelegProxy", "2");
+      gEnv->SetValue("XSec.GSI.DelegProxy", "2");
       TProof * p = TProof::Open("alice-caf.cern.ch", workers>0 ? Form("workers=%d",workers) : "1x");
       //      TProof * p = TProof::Open("skaf.saske.sk", workers>0 ? Form("workers=%d",workers) : "");    
       p->Exec("TObject *o = gEnv->GetTable()->FindObject(\"Proof.UseMergers\"); gEnv->GetTable()->Remove(o);", kTRUE);
 
-      // gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-17b-AN");
-      // gSystem->Load("libCore.so");  
-      // gSystem->Load("libTree.so");
-      // gSystem->Load("libGeom.so");
-      // gSystem->Load("libVMC.so");
-      // gSystem->Load("libPhysics.so");
-      // gSystem->Load("libSTEERBase");
-      // gSystem->Load("libESD");
-      // gSystem->Load("libAOD");
-      // gSystem->Load("libANALYSIS");
-      // gSystem->Load("libOADB");
-      // gSystem->Load("libANALYSISalice");   
+      TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-28-00f");
+      //      TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("5.28/00f");
+      gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-33-AN");
+      gSystem->Load("libCore.so");  
+      gSystem->Load("libTree.so");
+      gSystem->Load("libGeom.so");
+      gSystem->Load("libVMC.so");
+      gSystem->Load("libPhysics.so");
+      gSystem->Load("libSTEERBase");
+      gSystem->Load("libESD");
+      gSystem->Load("libAOD");
+      gSystem->Load("libANALYSIS");
+      gSystem->Load("libOADB");
+      gSystem->Load("libANALYSISalice");   
 
       // Enable the needed package
-      gProof->UploadPackage("$ALICE_ROOT/obj/STEERBase");
-      gProof->EnablePackage("$ALICE_ROOT/obj/STEERBase");
-      gProof->UploadPackage("$ALICE_ROOT/obj/ESD");
-      gProof->EnablePackage("$ALICE_ROOT/obj/ESD");
-      gProof->UploadPackage("$ALICE_ROOT/obj/AOD");
-      gProof->EnablePackage("$ALICE_ROOT/obj/AOD");
-      gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSIS");
-      gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSIS");
-      gProof->UploadPackage("$ALICE_ROOT/obj/OADB");
-      gProof->EnablePackage("$ALICE_ROOT/obj/OADB");
-      gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSISalice");
-      gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSISalice");
-      gProof->UploadPackage("$ALICE_ROOT/obj/PWG0base");
-      gProof->EnablePackage("$ALICE_ROOT/obj/PWG0base");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/STEERBase");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/STEERBase");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/ESD");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/ESD");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/AOD");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/AOD");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSIS");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSIS");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/OADB");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/OADB");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/ANALYSISalice");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/ANALYSISalice");
+      // gProof->UploadPackage("$ALICE_ROOT/obj/PWG0base");
+      // gProof->EnablePackage("$ALICE_ROOT/obj/PWG0base");
       gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPb"));
       gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG1/background"));
     }
index 5ed0014..a99096d 100755 (executable)
@@ -31,7 +31,8 @@ etaMax=0.5
 npart=381.188
 weakFactor=-1
 useSingleBin=kTRUE
-OUTPATH=output.BAK2010
+#OUTPATH=output.BAK2010
+OUTPATH=output
 
 give_help() {