added trigger decisions in spectrum task and Marta's high p_T task
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Dec 2009 13:24:40 +0000 (13:24 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Dec 2009 13:24:40 +0000 (13:24 +0000)
PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.cxx
PWG4/JetTasks/AliAnalysisTaskJetSpectrum2.h
PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
PWG4/JetTasks/AliPWG4HighPtQATPConly.h
PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
PWG4/JetTasks/AliPWG4HighPtSpectra.h

index ae98cd5..483d3eb 100644 (file)
@@ -70,6 +70,7 @@ AliAnalysisTaskJetSpectrum2::AliAnalysisTaskJetSpectrum2(): AliAnalysisTaskSE(),
   fBranchRec("jets"),
   fBranchGen(""),
   fUseAODInput(kFALSE),
+  fUseGlobalSelection(kFALSE),
   fUseExternalWeightOnly(kFALSE),
   fLimitGenJetEta(kFALSE),
   fFilterMask(0),
@@ -107,6 +108,7 @@ AliAnalysisTaskJetSpectrum2::AliAnalysisTaskJetSpectrum2(const char* name):
   fBranchRec("jets"),
   fBranchGen(""),
   fUseAODInput(kFALSE),
+  fUseGlobalSelection(kFALSE),
   fUseExternalWeightOnly(kFALSE),
   fLimitGenJetEta(kFALSE),
   fFilterMask(0),
@@ -296,6 +298,14 @@ void AliAnalysisTaskJetSpectrum2::Init()
 
 void AliAnalysisTaskJetSpectrum2::UserExec(Option_t */*option*/)
 {
+
+  if(! AliAnalysisHelperJetTasks::Selected()&&fUseGlobalSelection){
+    // no selection by the service task, we continue
+    if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__);
+    PostData(1, fHistList);
+    return;
+  }
+
   //
   // Execute analysis for current event
   //
index 73435ac..be5e77d 100644 (file)
@@ -42,7 +42,7 @@ class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
     virtual void Terminate(Option_t *option);
     virtual Bool_t Notify();
 
-
+    virtual void SetUseGlobalSelection(Bool_t b){fUseGlobalSelection = b;}
     virtual void SetExternalWeight(Float_t f){fExternalWeight = f;}
     virtual void SetUseExternalWeightOnly(Bool_t b){fUseExternalWeightOnly = b;}
     virtual void SetAODInput(Bool_t b){fUseAODInput = b;}
@@ -97,6 +97,7 @@ class AliAnalysisTaskJetSpectrum2 : public AliAnalysisTaskSE
     TString       fBranchGen;  // AOD brnach for genereated
 
     Bool_t        fUseAODInput;           // take jet from input AOD not from ouptu AOD
+    Bool_t        fUseGlobalSelection;    // Limit the eta of the generated jets
     Bool_t        fUseExternalWeightOnly; // use only external weight
     Bool_t        fLimitGenJetEta;        // Limit the eta of the generated jets
     UInt_t        fFilterMask;             // filter bit for slecected tracks
index e064e05..0eced3a 100644 (file)
 
 #include "AliPWG4HighPtQATPConly.h"
 
+#include "TVector3.h"
+#include <iostream>
 #include "TH1.h"
 #include "TH2.h"
 #include "TH3.h"
 #include "TList.h"
 #include "TChain.h"
 #include "TH3F.h"
+
 #include "AliAnalysisManager.h"
 #include "AliESDInputHandler.h"
 #include "AliESDtrack.h"
 #include "AliESDtrackCuts.h"
 #include "AliExternalTrackParam.h"
 #include "AliLog.h"
+#include "AliAnalysisHelperJetTasks.h"
 
 using namespace std; //required for resolving the 'cout' symbol
 
@@ -48,7 +52,9 @@ AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(): AliAnalysisTask("AliPWG4HighPt
   fESD(0), 
   fTrackCuts(0), 
   fTrackCutsITS(0),
-  fNEvent(0),
+  fTrigger(0),
+  fNEventAll(0),
+  fNEventSel(0),
   fPtAll(0),
   fPtSel(0),
   fPtAllminPtTPCvsPtAll(0),
@@ -85,7 +91,9 @@ AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(const char *name):
   fESD(0),
   fTrackCuts(),
   fTrackCutsITS(),
-  fNEvent(0),
+  fTrigger(0),
+  fNEventAll(0),
+  fNEventSel(0),
   fPtAll(0),
   fPtSel(0),
   fPtAllminPtTPCvsPtAll(0),
@@ -143,8 +151,9 @@ void AliPWG4HighPtQATPConly::ConnectInputData(Option_t *)
     
     if (!esdH) {
       AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); 
-    } else
+    } else {
       fESD = esdH->GetEvent();
+    }
   }
 }
 
@@ -170,10 +179,12 @@ void AliPWG4HighPtQATPConly::CreateOutputObjects() {
   Int_t fgkNPtBins=98;
   Float_t fgkPtMin=2.;
   Float_t fgkPtMax=100.;
-  Int_t fgkResPtBins=40;
+  Int_t fgkResPtBins=80;
 
-  fNEvent = new TH1F("fNEvent","NEvent",1,-0.5,0.5);
-  fHistList->Add(fNEvent);
+  fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
+  fHistList->Add(fNEventAll);
+  fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
+  fHistList->Add(fNEventSel);
   fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
   fHistList->Add(fPtAll);
   fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
@@ -305,33 +316,55 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
   // Called for each event
   AliDebug(2,Form(">> AliPWG4HighPtQATPConly::Exec \n"));  
 
+  // All events without selection
+  cout << "Fill fNEventAll" << endl;
+  fNEventAll->Fill(0.);
+
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
     return;
   }
 
-  const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+  //Trigger selection
+  AliAnalysisHelperJetTasks::Trigger trig;
+  trig = (const enum AliAnalysisHelperJetTasks::Trigger)fTrigger;
+  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
+    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
+  }else{
+    AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
+    return;
+  } 
 
+//  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
+  
+  const AliESDVertex *vtx = fESD->GetPrimaryVertexTracks();
   // Need vertex cut
   if (vtx->GetNContributors() < 2)
     return;
 
   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
-
-  // Need to keep track of evts without vertex
-  fNEvent->Fill(0.);
+  double primVtx[3];
+  vtx->GetXYZ(primVtx);
+  //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
+  if(primVtx[0]>1. || primVtx[1]>1. || primVtx[2]>10.) return;
 
   if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2) return;
   Int_t nTracks = fESD->GetNumberOfTracks();
-  AliDebug(2,Form("nTracks %d", nTracks));
+  AliDebug(2,Form("nTracks %d\n", nTracks));
+
+  if(!fTrackCuts) return;
+
+  // Selected events for analysis
+  fNEventSel->Fill(0.);
 
   for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
     
     AliESDtrack *track = fESD->GetTrack(iTrack);
     AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
-    AliESDtrack *trackTPConly = fTrackCuts->GetTPCOnlyTrack(fESD,iTrack); 
-    if(!track || !trackTPC || !trackTPConly) continue;
-
+    //    AliESDtrack *trackTPConly = fTrackCuts->GetTPCOnlyTrack(fESD,iTrack); 
+    if(!track) continue;
+    if(!trackTPC) continue;
+//     if(!trackTPConly) continue;
     Float_t pt = track->Pt();
     Float_t ptTPC = trackTPC->Pt();
     Float_t phi = track->Phi();
@@ -345,10 +378,11 @@ void AliPWG4HighPtQATPConly::Exec(Option_t *) {
       if (itsMap & (1 << i))
        nPointITS ++;
     }
+    double mom[3];
+    track->GetPxPyPz(mom);
     Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
     Float_t chi2C = track->GetConstrainedChi2();
-    // Float_t relUncertainty1Pt = TMath::Sqrt(extCov[14])*pt;
-    Float_t relUncertainty1Pt = TMath::Sqrt(track->GetSigma1Pt2())*pt;
+    Float_t relUncertainty1Pt = TMath::Sqrt(TMath::Abs(track->GetSigma1Pt2()))*pt;
 
     fPtAll->Fill(pt);
     fPtAllTPC->Fill(ptTPC);
index 0d441d6..f39a6ff 100644 (file)
@@ -28,6 +28,7 @@ class TH2F;
 class TH3F;
 class TList;
 class AliESDEvent;
+class AliVEvent;
 class AliESDtrackCuts;
 
 class AliPWG4HighPtQATPConly: public AliAnalysisTask {
@@ -44,6 +45,8 @@ class AliPWG4HighPtQATPConly: public AliAnalysisTask {
 
   void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
   void SetCutsITS(AliESDtrackCuts* trackCutsITS) {fTrackCutsITS = trackCutsITS;}
+  //Select the trigger
+  void SelectTrigger(Int_t trig) { fTrigger = trig; } 
 
  protected:
 
@@ -56,9 +59,10 @@ class AliPWG4HighPtQATPConly: public AliAnalysisTask {
   AliESDEvent *fESD;              //! ESD object
   AliESDtrackCuts *fTrackCuts;    // TrackCuts for global vs TPConly comparison
   AliESDtrackCuts *fTrackCutsITS; // TrackCuts including ITSrefit
-
+  Int_t fTrigger;                 //Trigger flag as defined in AliAnalysisHelperJetTasks.h 
   
-  TH1F *fNEvent;                                //! Event counter
+  TH1F *fNEventAll;                             //! Event counter
+  TH1F *fNEventSel;                             //! Event counter: Selected events for analysis
   TH1F *fPtAll;                                 //! Pt spectrum all charged particles
   TH1F *fPtSel;                                 //! Pt spectrum all selected charged particles by fTrackCuts
   TH2F *fPtAllminPtTPCvsPtAll;                  //! Momentum resolution (global vs TPConly)
@@ -91,7 +95,6 @@ class AliPWG4HighPtQATPConly: public AliAnalysisTask {
 
   TList *fHistListITS; //! List of Histograms
 
   ClassDef(AliPWG4HighPtQATPConly,1) 
   
 };
index dcb9b5d..9eb6105 100644 (file)
@@ -41,6 +41,7 @@
 #include "AliESDtrackCuts.h"
 #include "AliExternalTrackParam.h"
 #include "AliESDInputHandler.h"
+#include "AliAnalysisHelperJetTasks.h"
 
 using namespace std; //required for resolving the 'cout' symbol
 
@@ -52,8 +53,11 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpe
   fCFManager(0x0),
   fESD(0),
   fTrackCuts(0),
+  fTrigger(0),
   fHistList(0),
-  fHistEventsProcessed(0x0)
+  fNEventAll(0),
+  fNEventSel(0)
+  //  fHistEventsProcessed(0x0)
 {
   //
   //Default ctor
@@ -66,8 +70,11 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const Char_t* name) :
   fCFManager(0x0),
   fESD(0),
   fTrackCuts(),//new AliESDtrackCuts),
+  fTrigger(0),
   fHistList(0),
-  fHistEventsProcessed(0x0)
+  fNEventAll(0),
+  fNEventSel(0)
+  //  fHistEventsProcessed(0x0)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
@@ -90,7 +97,9 @@ AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra
     fReadAODData = c.fReadAODData ;
     fCFManager  = c.fCFManager;
     fHistList = c.fHistList;
-    fHistEventsProcessed = c.fHistEventsProcessed;
+    fNEventAll = c.fNEventAll;
+    fNEventSel = c.fNEventSel;
+    //    fHistEventsProcessed = c.fHistEventsProcessed;
   }
   return *this;
 }
@@ -102,8 +111,11 @@ AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
   fCFManager(c.fCFManager),
   fESD(c.fESD),
   fTrackCuts(c.fTrackCuts),
+  fTrigger(c.fTrigger),
   fHistList(c.fHistList),
-  fHistEventsProcessed(c.fHistEventsProcessed)
+  fNEventAll(c.fNEventAll),
+  fNEventSel(c.fNEventSel)
+  //  fHistEventsProcessed(c.fHistEventsProcessed)
 {
   //
   // Copy Constructor
@@ -117,7 +129,8 @@ AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
   //
   Info("~AliPWG4HighPtSpectra","Calling Destructor");
   if (fCFManager)           delete fCFManager ;
-  if (fHistEventsProcessed) delete fHistEventsProcessed ;
+  if (fNEventAll) delete fNEventAll ;
+  if (fNEventSel) delete fNEventSel ;
 }
 //________________________________________________________________________
 void AliPWG4HighPtSpectra::ConnectInputData(Option_t *) 
@@ -149,11 +162,25 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
   //
   AliDebug(2,Form(">> AliPWG4HighPtSpectra::Exec \n"));  
 
+  // All events without selection
+  fNEventAll->Fill(0.);
+
   if (!fESD) {
     AliDebug(2,Form("ERROR: fESD not available"));
     return;
   }
 
+  //Trigger selection
+  AliAnalysisHelperJetTasks::Trigger trig;
+  trig = (const enum AliAnalysisHelperJetTasks::Trigger)fTrigger;
+  if (AliAnalysisHelperJetTasks::IsTriggerFired(fESD,trig)){
+    AliDebug(2,Form(" Trigger Selection: event ACCEPTED ... "));
+  }else{
+    AliDebug(2,Form(" Trigger Selection: event REJECTED ... "));
+    return;
+  } 
+  //  if(!fESD->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL") || !fESD->IsTriggerClassFired("CSMBB-ABCE-NOPF-ALL")) return;
+
   // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
   // This handler can return the current MC event
   AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
@@ -174,25 +201,22 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
     AliDebug(2,Form("MC particles stack: %d", stack->GetNtrack()));
   }
   
-  if (!fESD) {
-    AliDebug(2,Form("ERROR: fESD not available"));
-    return;
-  }
-
   const AliESDVertex *vtx = fESD->GetPrimaryVertex();
-
   // Need vertex cut
   if (vtx->GetNContributors() < 2) return;
-  double pvtx[3];
-  vtx->GetXYZ(pvtx);
-  if(TMath::Abs(pvtx[2])>10.) return;
+  double primVtx[3];
+  vtx->GetXYZ(primVtx);
+  //  printf("primVtx: %g  %g  %g \n",primVtx[0],primVtx[1],primVtx[2]);
+  if(primVtx[0]>1. || primVtx[1]>1. || primVtx[2]>10.) return;
 
   AliDebug(2,Form("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors()));
-  // Need to keep track of evts without vertex
 
   Int_t nTracks = fESD->GetNumberOfTracks();
   AliDebug(2,Form("nTracks %d", nTracks));
 
+  // Selected events for analysis
+  fNEventSel->Fill(0.);
+
   Double_t containerInputRec[1] ;
   Double_t containerInputTPConly[1] ;
   Double_t containerInputMC[1] ;
@@ -249,7 +273,6 @@ void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
       }
   }
 
-   fHistEventsProcessed->Fill(0);
    PostData(0,fHistList);
    PostData(1,fCFManager->GetParticleContainer());
 
@@ -273,12 +296,13 @@ void AliPWG4HighPtSpectra::CreateOutputObjects() {
   //
   AliDebug(2,Form("CreateOutputObjects","CreateOutputObjects of task %s", GetName()));
 
-  //  OpenFile(0);
-  fHistList = new TList();
   //slot #1
-  //  OpenFile(0);
-  fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ;
-  fHistList->Add(fHistEventsProcessed);
+  OpenFile(0);
+  fHistList = new TList();
+  fNEventAll = new TH1F("fNEventAll","NEventAll",1,-0.5,0.5);
+  fHistList->Add(fNEventAll);
+  fNEventSel = new TH1F("fNEventSel","NEvent Selected for analysis",1,-0.5,0.5);
+  fHistList->Add(fNEventSel);
 
 }
 
index edef5f5..e966157 100644 (file)
@@ -24,6 +24,7 @@
 #include "AliCFManager.h"
 
 class TH1I;
+class TH1F;
 class TH1D;
 class TFile ;
 class AliCFManager;
@@ -31,7 +32,7 @@ class AliESDtrackCuts;
 class AliESDEvent;
 
 class AliPWG4HighPtSpectra : public AliAnalysisTask {
-  public:
+ public:
 
   enum {
     kStepReconstructed    = 0,
@@ -59,26 +60,31 @@ class AliPWG4HighPtSpectra : public AliAnalysisTask {
 
   //AliESDtrackCuts setters
   void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
+  //Select the trigger
+  void SelectTrigger(Int_t trig) { fTrigger = trig; } 
 
   // Data types
   Bool_t IsReadAODData()   const {return fReadAODData;}
-  void   SetReadAODData   (Bool_t flag=kTRUE) {fReadAODData=flag;}
-
+  void   SetReadAODData(Bool_t flag=kTRUE) {fReadAODData=flag;}
+  
  protected:
-  Bool_t          fReadAODData ;   // flag for AOD/ESD input files
-  const AliCFManager   *fCFManager    ;  // pointer to the CF manager
+  Bool_t              fReadAODData ;    // flag for AOD/ESD input files
+  const AliCFManager  *fCFManager    ;  // pointer to the CF manager
 
-  AliESDEvent *fESD;    //! ESD object
-  //AliESDtrackCuts options. Must be setted in AliCFPWG4Task.C. They correspond with different steps in container.
-  AliESDtrackCuts *fTrackCuts; // trackCuts applied
+  AliESDEvent *fESD;              //! ESD object
+  //AliESDtrackCuts options. Must be setted in AddTaskPWG4HighPtQAMC.C. They correspond with different steps in container.
+  AliESDtrackCuts *fTrackCuts;    // trackCuts applied
+  Int_t fTrigger;                 //Trigger flag as defined in AliAnalysisHelperJetTasks.h 
 
  private:
 
   // Histograms
   //Number of events
   TList *fHistList;            // List of output histograms
-  TH1I  *fHistEventsProcessed; // simple histo for monitoring the number of events processed
-  
+  //  TH1I  *fHistEventsProcessed; // simple histo for monitoring the number of events processed
+  TH1F *fNEventAll;            //! Event counter
+  TH1F *fNEventSel;            //! Event counter: Selected events for analysis
+
   ClassDef(AliPWG4HighPtSpectra,1);
 };