select on trigger class if wanted
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jul 2012 19:55:05 +0000 (19:55 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jul 2012 19:55:05 +0000 (19:55 +0000)
PWGGA/EMCALTasks/AliAnalysisTaskEmcal.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEmcal.h

index 9c3002f..345be19 100644 (file)
@@ -41,6 +41,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal() :
   fMinVz(-999),
   fMaxVz(-999),
   fOffTrigger(AliVEvent::kAny),
+  fTrigClass(),
   fNbins(500),
   fMinBinPt(0),
   fMaxBinPt(250),
@@ -55,6 +56,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal() :
   fEPV0(-1.0),
   fEPV0A(-1.0),
   fEPV0C(-1.0),
+  fNVertCont(0),
   fBeamType(kNA),
   fOutput(0)
 {
@@ -78,6 +80,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal(const char *name, Bool_t histo) :
   fMinVz(-999),
   fMaxVz(-999),
   fOffTrigger(AliVEvent::kAny),
+  fTrigClass(),
   fNbins(500),
   fMinBinPt(0),
   fMaxBinPt(250),
@@ -92,6 +95,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal(const char *name, Bool_t histo) :
   fEPV0(-1.0),
   fEPV0A(-1.0),
   fEPV0C(-1.0),
+  fNVertCont(0),
   fBeamType(kNA),
   fOutput(0)
 {
@@ -292,7 +296,38 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
         res = aev->GetHeader()->GetOfflineTrigger();
       }
     }
-    if (res & fOffTrigger == 0)
+    if ((res & fOffTrigger) == 0)
+      return kFALSE;
+  }
+
+  if (!fTrigClass.IsNull()) {
+    TString fired;
+    const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
+    if (eev) {
+      fired = eev->GetFiredTriggerClasses();
+    } else {
+      const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
+      if (aev) {
+        fired = aev->GetFiredTriggerClasses();
+      }
+    }
+    if (!fired.Contains("-B-"))
+      return kFALSE;
+    TObjArray *arr = fTrigClass.Tokenize("|");
+    if (!arr)
+      return kFALSE;
+    Bool_t match = 0;
+    for (Int_t i=0;i<arr->GetEntriesFast();++i) {
+      TObject *obj = arr->At(i);
+      if (!obj)
+        continue;
+      if (fired.Contains(obj->GetName())) {
+        match = 1;
+        break;
+      }
+    }
+    delete arr;
+    if (!match)
       return kFALSE;
   }
 
@@ -304,6 +339,8 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
   }
 
   if ((fMinVz != -999) && (fMaxVz != -999)) {
+    if (fNVertCont == 0 )
+      return kFALSE;
     Double_t vz = fVertex[2];
     if (vz<fMinVz)
       return kFALSE;
@@ -352,7 +389,13 @@ Bool_t AliAnalysisTaskEmcal::RetrieveEventObjects()
   fVertex[0] = 0;
   fVertex[1] = 0;
   fVertex[2] = 0;
-  InputEvent()->GetPrimaryVertex()->GetXYZ(fVertex);
+  fNVertCont = 0;
+
+  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
+  if (vert) {
+    vert->GetXYZ(fVertex);
+    fNVertCont = vert->GetNContributors();
+  }
 
   fBeamType = GetBeamType();
 
index 37ecec8..9327e84 100644 (file)
@@ -36,17 +36,18 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
 
   void                        UserExec(Option_t *option);
 
-  void                        SetAnaType(EmcalAnaType type)                         { fAnaType        = type        ; }
+  void                        SetAnaType(EmcalAnaType type)                         { fAnaType        = type;         }
   void                        SetCentRange(Double_t min, Double_t max)              { fMinCent = min; fMaxCent = max; }
-  void                        SetClusName(const char *n)                            { fCaloName       = n           ; }
-  void                        SetClusPtCut(Double_t cut)                            { fClusPtCut      = cut         ; }
+  void                        SetClusName(const char *n)                            { fCaloName       = n;            }
+  void                        SetClusPtCut(Double_t cut)                            { fClusPtCut      = cut;          }
   void                        SetClusTimeCut(Double_t min, Double_t max)            { fClusTimeCutLow = min; fClusTimeCutUp = max;      }
   void                        SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max; }
-  void                        SetOffTrigger(UInt_t t)                               { fOffTrigger    = t;            }
+  void                        SetOffTrigger(UInt_t t)                               { fOffTrigger    = t;                               }
   void                        SetPtCut(Double_t cut)                                { SetClusPtCut(cut); SetTrackPtCut(cut);            }
-  void                        SetTrackPtCut(Double_t cut)                           { fTrackPtCut     = cut        ; }
-  void                        SetTracksName(const char *n)                          { fTracksName     = n          ; }
-  void                        SetVzRange(Double_t min, Double_t max)                { fMinVz = min; fMaxVz   = max;  }
+  void                        SetTrackPtCut(Double_t cut)                           { fTrackPtCut     = cut;          }
+  void                        SetTracksName(const char *n)                          { fTracksName     = n;            }
+  void                        SetTrigClass(const char *n)                           { fTrigClass = n;                 } 
+  void                        SetVzRange(Double_t min, Double_t max)                { fMinVz = min; fMaxVz   = max;   }
 
  protected:
   Bool_t                      AcceptCluster(AliVCluster        *clus,  Bool_t acceptMC = kFALSE) const;
@@ -71,6 +72,7 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   Double_t                    fMinVz;                      // min vertex for event selection
   Double_t                    fMaxVz;                      // max vertex for event selection
   UInt_t                      fOffTrigger;                 // offline trigger for event selection
+  TString                     fTrigClass;                  // trigger class name for event selection
   Int_t                       fNbins;                      // no. of pt bins
   Double_t                    fMinBinPt;                   // min pt in histograms
   Double_t                    fMaxBinPt;                   // max pt in histograms
@@ -86,6 +88,7 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   Double_t                    fEPV0A;                      //!event plane V0A
   Double_t                    fEPV0C;                      //!event plane V0C
   Double_t                    fVertex[3];                  //!event vertex
+  Int_t                       fNVertCont;                  //!event vertex number of contributors
   BeamType                    fBeamType;                   //!event beam type
   TList                      *fOutput;                     //!output list
 
@@ -93,6 +96,6 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&);            // not implemented
   AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
 
-  ClassDef(AliAnalysisTaskEmcal, 4) // EMCAL base analysis task
+  ClassDef(AliAnalysisTaskEmcal, 5) // EMCAL base analysis task
 };
 #endif