]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/CaloCalib/AliAnalysisTaskEMCALPi0PbPb.h
Get trigger primitive information and do trigger cluster matching
[u/mrichter/AliRoot.git] / PWG4 / CaloCalib / AliAnalysisTaskEMCALPi0PbPb.h
index b92d20f51e37354b6002b103c33646b6062da5f9..35225ea76f1da8cb00b10ff985c2741f57c74e30 100644 (file)
@@ -5,17 +5,25 @@
 
 class TAxis;
 class TClonesArray;
-class TH1F;
-class TH2F;
+class TH1;
+class TH2;
 class TNtuple;
 class TObjArray;
 class AliAODCaloCells;
 class AliAODCaloCluster;
 class AliAODEvent;
+class AliAODTrack;
+class AliAODVertex;
 class AliEMCALGeoUtils;
+class AliEMCALRecoUtils;
 class AliESDCaloCells;
 class AliESDCaloCluster;
 class AliESDEvent;
+class AliESDTrack;
+class AliESDVertex;
+class AliESDtrackCuts;
+class AliStaHeader;
+class AliStaVertex;
 
 #include "AliAnalysisTaskSE.h"
 
@@ -28,29 +36,48 @@ class AliAnalysisTaskEMCALPi0PbPb : public AliAnalysisTaskSE {
   void         UserExec(Option_t *option);
   void         Terminate(Option_t *);
 
-  void         SetAsymMax(Double_t asymMax)                   { fAsymMax = asymMax;         }
-  void         SetCentrality(const char *name)                { fCentVar = name;            }
+  void         SetAsymMax(Double_t asymMax)                   { fAsymMax       = asymMax;   }
+  void         SetCentrality(const char *n)                   { fCentVar       = n;         }
   void         SetCentralityRange(Double_t from, Double_t to) { fCentFrom=from; fCentTo=to; }
-  void         SetClusName(const char *name)                  { fClusName = name;           }
+  void         SetClusName(const char *n)                     { fClusName      = n;         }
   void         SetDoAfterburner(Bool_t b)                     { fDoAfterburner = b;         }
-  void         SetFillNtuple(Bool_t b)                        { fDoNtuple = b;              }
-  void         SetGeoName(const char *n)                      { fGeoName = n;               }
-  void         SetMinClusEnergy(Double_t e)                   { fMinE = e;                  }
-  void         SetMinEcc(Double_t ecc)                        { fMinEcc = ecc;              }
-  void         SetMinErat(Double_t erat)                      { fMinErat = erat;            }
-  void         SetNminCells(Int_t n)                          { fNminCells = n;             }
-  void         SetUseQualFlag(Bool_t b)                       { fUseQualFlag = b;           }
+  void         SetDoTrackMatWithGeom(Bool_t b)                { fDoTrMatGeom   = b;         }
+  void         SetFillNtuple(Bool_t b)                        { fDoNtuple      = b;         }
+  void         SetGeoName(const char *n)                      { fGeoName       = n;         }
+  void         SetIsoDist(Double_t d)                         { fIsoDist       = d;         }
+  void         SetMarkCells(const char *n)                    { fMarkCells     = n;         }
+  void         SetMinClusEnergy(Double_t e)                   { fMinE          = e;         }
+  void         SetMinEcc(Double_t ecc)                        { fMinEcc        = ecc;       }
+  void         SetMinErat(Double_t erat)                      { fMinErat       = erat;      }
+  void         SetMinNClustersPerTrack(Double_t m)            { fMinNClusPerTr = m;         }
+  void         SetNminCells(Int_t n)                          { fNminCells     = n;         }
+  void         SetPrimTrackCuts(AliESDtrackCuts *c)           { fPrimTrCuts    = c;         }
+  void         SetTrClassNames(const char *n)                 { fTrClassNames  = n;         }
+  void         SetTrackCuts(AliESDtrackCuts *c)               { fTrCuts        = c;         }
+  void         SetTrainMode(Bool_t b)                         { fTrainMode     = b;         }
+  void         SetUseQualFlag(Bool_t b)                       { fUseQualFlag   = b;         }
   void         SetVertexRange(Double_t z1, Double_t z2)       { fVtxZMin=z1; fVtxZMax=z2;   }
 
  protected:
+  void         CalcCaloTriggers();
+  virtual void CalcClusterProps();
+  virtual void CalcPrimTracks();
+  virtual void CalcTracks();
   virtual void ClusterAfterburner();
   virtual void FillCellHists();
   virtual void FillClusHists();
-  virtual void FillPionHists();
+  virtual void FillNtuple();
   virtual void FillOtherHists();
-  Double_t     GetMaxCellEnergy(AliVCluster *c);
-  Int_t        GetNCells(AliVCluster *c, Double_t emin=0.);
-  void         GetSigma(AliVCluster *c, Double_t &sigmaMax, Double_t &sigmaMin);
+  virtual void FillPionHists();
+  void         FillVertex(AliStaVertex *v, const AliESDVertex *esdv);
+  void         FillVertex(AliStaVertex *v, const AliAODVertex *aodv);
+  Double_t     GetCellIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2)                  const;
+  Double_t     GetMaxCellEnergy(AliVCluster *c) const { Short_t id=-1; return GetMaxCellEnergy(c,id); }
+  Double_t     GetMaxCellEnergy(AliVCluster *c, Short_t &id)                                        const;
+  Int_t        GetNCells(AliVCluster *c, Double_t emin=0.)                                          const;
+  void         GetSigma(AliVCluster *c, Double_t &sigmaMax, Double_t &sigmaMin)                     const;
+  Double_t     GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius=0.2, Double_t pt=0.) const;
+  Double_t     GetTrigEnergy(AliVCluster *c)                                                        const;
 
     // input members
   TString                fCentVar;                // variable for centrality determination
@@ -64,14 +91,27 @@ class AliAnalysisTaskEMCALPi0PbPb : public AliAnalysisTaskSE {
   Bool_t                 fDoAfterburner;          // if true run after burner
   Double_t               fAsymMax;                // maximum energy asymmetry (def=1)
   Int_t                  fNminCells;              // minimum number of cells attached to cluster (def=1)
-  Double_t               fMinE;                   // minimum cluster energy (def=0.1)
+  Double_t               fMinE;                   // minimum cluster energy (def=0.1 GeV/c)
   Double_t               fMinErat;                // minimum emax/ec ratio (def=0)
   Double_t               fMinEcc;                 // minimum eccentricity (def=0)
   TString                fGeoName;                // geometry name (def = EMCAL_FIRSTYEARV1)
+  Double_t               fMinNClusPerTr;          // minimum number of cluster per track (def=50)
+  Double_t               fIsoDist;                // isolation distance (def=0.2)
+  TString                fTrClassNames;           // trigger class names
+  AliESDtrackCuts       *fTrCuts;                 // track cuts
+  AliESDtrackCuts       *fPrimTrCuts;             // track cuts
+  Bool_t                 fDoTrMatGeom;            // track matching including geometry
+  Bool_t                 fTrainMode;              // train mode with minimal number of resources
+  TString                fMarkCells;              // list of mark cells to monitor
+  Int_t                  fMinL0Time;              // minimum accepted time for trigger
+  Int_t                  fMaxL0Time;              // maximum accepted time for trigger
     // derived members (ie with ! after //)
+  Bool_t                 fIsGeoMatsSet;           //!indicate that geo matrices are set 
   ULong64_t              fNEvs;                   //!accepted events 
   AliEMCALGeoUtils      *fGeom;                   //!geometry utils
+  AliEMCALRecoUtils     *fReco;                   //!geometry utils
   TList                 *fOutput;                 //!container of output histograms
+  TObjArray             *fTrClassNamesArr;        //!array of trig class names  
   AliESDEvent           *fEsdEv;                  //!pointer to input esd event
   AliAODEvent           *fAodEv;                  //!pointer to input aod event
   TObjArray             *fRecPoints;              //!pointer to rec points (AliAnalysisTaskEMCALClusterizeFast)
@@ -80,39 +120,174 @@ class AliAnalysisTaskEMCALPi0PbPb : public AliAnalysisTaskSE {
   TObjArray             *fAodClusters;            //!pointer to aod clusters
   AliAODCaloCells       *fAodCells;               //!pointer to aod cells
   TAxis                 *fPtRanges;               //!pointer to pt ranges
-  TNtuple               *fNtuple;                 //!pointer to ntuple
+  TObjArray             *fSelTracks;              //!pointer to selected tracks
+  TObjArray             *fSelPrimTracks;          //!pointer to selected primary tracks
+  Int_t                  fNAmpInTrigger;          //!number of cells to keep trigger statistic
+  Float_t               *fAmpInTrigger;           //!amplitude for calo cells which are part of trigger
+    // ntuple
+  TTree                 *fNtuple;                 //!pointer to ntuple
+  AliStaHeader          *fHeader;                 //!pointer to header
+  AliStaVertex          *fPrimVert;               //!pointer to primary vertex
+  AliStaVertex          *fSpdVert;                //!pointer to SPD vertex
+  AliStaVertex          *fTpcVert;                //!pointer to TPC vertex
+  TClonesArray          *fClusters;               //!pointer to clusters
+  TClonesArray          *fTriggers;               //!pointer to triggers
     // histograms
-  TH1F                  *fHCuts;                  //!histo for cuts
-  TH1F                  *fHVertexZ;               //!histo for vtxz
-  TH1F                  *fHVertexZ2;              //!histo for vtxz after vtx cuts
-  TH1F                  *fHCent;                  //!histo for cent
-  TH1F                  *fHCentQual;              //!histo for cent after quality flag cut
+  TH1                   *fHCuts;                  //!histo for cuts
+  TH1                   *fHVertexZ;               //!histo for vtxz
+  TH1                   *fHVertexZ2;              //!histo for vtxz after vtx cuts
+  TH1                   *fHCent;                  //!histo for cent
+  TH1                   *fHCentQual;              //!histo for cent after quality flag cut
+  TH1                   *fHTclsBeforeCuts;        //!histo for trigger classes before cuts
+  TH1                   *fHTclsAfterCuts;         //!histo for trigger classes after cuts
+
     // histograms for cells
-  TH2F                 **fHColuRow;               //!histo for cell column and row
-  TH2F                 **fHColuRowE;              //!histo for cell column and row weight energy
-  TH1F                 **fHCellMult;              //!histo for cell multiplicity in module
-  TH1F                  *fHCellE;                 //!histo for cell energy
-  TH1F                  *fHCellH;                 //!histo for highest cell energy
-  TH1F                  *fHCellM;                 //!histo for mean cell energy (normalized to hit cells)
-  TH1F                  *fHCellM2;                //!histo for mean cell energy (normalized to all cells)
+  TH2                  **fHColuRow;               //!histo for cell column and row
+  TH2                  **fHColuRowE;              //!histo for cell column and row weight energy
+  TH1                  **fHCellMult;              //!histo for cell multiplicity in module
+  TH1                   *fHCellE;                 //!histo for cell energy
+  TH1                   *fHCellH;                 //!histo for highest cell energy
+  TH1                   *fHCellM;                 //!histo for mean cell energy (normalized to hit cells)
+  TH1                   *fHCellM2;                //!histo for mean cell energy (normalized to all cells)
+  TH1                  **fHCellFreqNoCut;         //!histo for cell frequency without cut
+  TH1                  **fHCellFreqCut100M;       //!histo for cell frequency with cut 100MeV
+  TH1                  **fHCellFreqCut300M;       //!histo for cell frequency with cut 300MeV
+  TH1                  **fHCellFreqE;             //!histo for cell frequency weighted with energy
+  TH1                  **fHCellCheckE;            //!histo for cell E distribution for given channels
     // histograms for clusters
-  TH1F                  *fHClustEccentricity;     //!histo for cluster eccentricity
-  TH2F                  *fHClustEtaPhi;           //!histo for cluster eta vs. phi
-  TH2F                  *fHClustEnergyPt;         //!histo for cluster energy vs. pT
-  TH2F                  *fHClustEnergySigma;      //!histo for cluster energy vs. variance over long axis 
-  TH2F                  *fHClustSigmaSigma;       //!histo for sigma vs. lambda_0 comparison
-  TH2F                  *fHClustNCellEnergyRatio; //!histo for cluster n tow vs. energy ratio
+  TH1                   *fHClustEccentricity;     //!histo for cluster eccentricity
+  TH2                   *fHClustEtaPhi;           //!histo for cluster eta vs. phi
+  TH2                   *fHClustEnergyPt;         //!histo for cluster energy vs. pT
+  TH2                   *fHClustEnergySigma;      //!histo for cluster energy vs. variance over long axis 
+  TH2                   *fHClustSigmaSigma;       //!histo for sigma vs. lambda_0 comparison
+  TH2                   *fHClustNCellEnergyRatio; //!histo for cluster n tow vs. energy ratio
+    // histograms for track matching
+  TH1                   *fHMatchDr;               //!histo for dR track cluster matching
+  TH1                   *fHMatchDz;               //!histo for dZ track cluster matching
+  TH1                   *fHMatchEp;               //!histo for E/p track cluster matching
     // histograms for pion candidates
-  TH2F                  *fHPionEtaPhi;            //!histo for pion eta vs. phi
-  TH2F                  *fHPionMggPt;             //!histo for pion mass vs. pT
-  TH2F                  *fHPionMggAsym;           //!histo for pion mass vs. asym
-  TH2F                  *fHPionMggDgg;            //!histo for pion mass vs. opening angle
-  TH1F                  *fHPionInvMasses[21];     //!histos for invariant mass plots 
+  TH2                   *fHPionEtaPhi;            //!histo for pion eta vs. phi
+  TH2                   *fHPionMggPt;             //!histo for pion mass vs. pT
+  TH2                   *fHPionMggAsym;           //!histo for pion mass vs. asym
+  TH2                   *fHPionMggDgg;            //!histo for pion mass vs. opening angle
+  TH1                   *fHPionInvMasses[21];     //!histos for invariant mass plots 
 
  private:
   AliAnalysisTaskEMCALPi0PbPb(const AliAnalysisTaskEMCALPi0PbPb&);            // not implemented
   AliAnalysisTaskEMCALPi0PbPb &operator=(const AliAnalysisTaskEMCALPi0PbPb&); // not implemented
 
-  ClassDef(AliAnalysisTaskEMCALPi0PbPb, 2); // Analysis task for neutral pions in Pb+Pb
+  ClassDef(AliAnalysisTaskEMCALPi0PbPb, 7) // Analysis task for neutral pions in Pb+Pb
+};
+#endif
+
+#ifndef AliStaObjs_h
+#define AliStaObjs_h
+class AliStaHeader
+{
+ public:
+  AliStaHeader() : fRun(0), fOrbit(0), fPeriod(0), fBx(0), fL0(0), fL1(0), fL2(0),
+                   fTrClassMask(0), fTrCluster(0), fOffTriggers(0), fFiredTriggers(),
+                   fTcls(0), fV0Cent(0), fCl1Cent(0), fTrCent(0), fCqual(-1),
+                   fPsi(0), fPsiRes(0) {;}
+  virtual ~AliStaHeader() {;}
+
+ public:
+  Int_t         fRun;            //         run number
+  UInt_t        fOrbit;          //         orbit number
+  UInt_t        fPeriod;         //         period number
+  UShort_t      fBx;             //         bunch crossing id
+  UInt_t        fL0;             //         l0 trigger bits
+  UInt_t        fL1;             //         l1 trigger bits
+  UShort_t      fL2;             //         l2 trigger bits
+  ULong64_t     fTrClassMask;    //         trigger class mask
+  UChar_t       fTrCluster;      //         trigger cluster mask
+  UInt_t        fOffTriggers;    //         fired offline triggers for this event
+  TString       fFiredTriggers;  //         string with fired triggers
+  UInt_t        fTcls;           //         custom trigger definition
+  Double32_t    fV0Cent;         //[0,0,16] v0 cent
+  Double32_t    fCl1Cent;        //[0,0,16] cl1 cent
+  Double32_t    fTrCent;         //[0,0,16] tr cent
+  Int_t         fCqual;          //         centrality quality
+  Double32_t    fPsi;            //[0,0,16] event-plane angle
+  Double32_t    fPsiRes;         //[0,0,16] event-plane ange resolution
+
+  ClassDef(AliStaHeader,2) // Header class
+};
+
+class AliStaVertex
+{
+ public:
+  AliStaVertex(Double_t x=0, Double_t y=0, Double_t z=0) : fVx(x), fVy(y), fVz(z), fVc(-1), fDisp(0), fZres(0),
+                                                           fChi2(0), fSt(0), fIs3D(0), fIsZ(0) {;}
+  virtual ~AliStaVertex() {;}
+
+ public:
+  Double_t      fVx;          //[0,0,16] vertex x
+  Double_t      fVy;          //[0,0,16] vertex y
+  Double_t      fVz;          //[0,0,16] vertex z
+  Double_t      fVc;          //[0,0,16] number of contributors to vertex
+  Double_t      fDisp;        //[0,0,16] dispersion
+  Double_t      fZres;        //[0,0,16] z-resolution
+  Double_t      fChi2;        //[0,0,16] chi2 of fit
+  Bool_t        fSt;          //         status bit
+  Bool_t        fIs3D;        //         is vertex from 3D
+  Bool_t        fIsZ;         //         is vertex from Z only
+
+  ClassDef(AliStaVertex,1) // Vertex class
+};
+
+class AliStaCluster : public TObject
+{
+ public:
+  AliStaCluster() : TObject(), fE(0), fR(0), fEta(0), fPhi(0), fN(0), fN1(0), fN3(0), fIdMax(0), fEmax(0),  
+                    fDbc(-1), fDisp(-1), fM20(0), fM02(0), fEcc(0), fSig(0), fTrackM(0), fTrDz(0), fTrDr(-1), 
+                    fTrEp(0), fTrIso(0), fTrIso1(0), fTrIso2(0), fCeIso(0), fCeCore(0), fTrigM(0), fTrigE(-1), fTrigMaskE(-1) {;}
+
+ public:
+  Double32_t    fE;                //[0,0,16] energy
+  Double32_t    fR;                //[0,0,16] radius
+  Double32_t    fEta;              //[0,0,16] eta
+  Double32_t    fPhi;              //[0,0,16] phi
+  UChar_t       fN;                //         number of cells
+  UChar_t       fN1;               //         number of cells > 100 MeV
+  UChar_t       fN3;               //         number of cells > 300 MeV
+  UShort_t      fIdMax;            //         id maximum cell
+  Double32_t    fEmax;             //[0,0,16] energy of maximum cell
+  Double32_t    fDbc;              //[0,0,16] distance to nearest bad channel
+  Double32_t    fDisp;             //[0,0,16] cluster dispersion, for shape analysis
+  Double32_t    fM20;              //[0,0,16] 2-nd moment along the main eigen axis
+  Double32_t    fM02;              //[0,0,16] 2-nd moment along the second eigen axis
+  Double32_t    fEcc;              //[0,0,16] eccentricity
+  Double32_t    fSig;              //[0,0,16] sigma
+  Bool_t        fTrackM;           //         if true then track values are set
+  Double32_t    fTrDz;             //[0,0,16] dZ to nearest track
+  Double32_t    fTrDr;             //[0,0,16] dR to nearest track (in x,y)
+  Double32_t    fTrEp;             //[0,0,16] E/P to nearest track 
+  Double32_t    fTrIso;            //[0,0,16] track isolation
+  Double32_t    fTrIso1;           //[0,0,16] track isolation (pt>1GeV/c)
+  Double32_t    fTrIso2;           //[0,0,16] track isolation (pt>2GeV/c)
+  Double32_t    fCeIso;            //[0,0,16] cell isolation
+  Double32_t    fCeCore;           //[0,0,16] cell content in R=0.025
+  Bool_t        fTrigM;            //         if true then trigger values are set
+  Double32_t    fTrigE;            //[0,0,16] trigger tower energy
+  Double32_t    fTrigMaskE;        //[0,0,16] masked trigger tower energy
+
+  ClassDef(AliStaCluster,3) // Cluster class
+};
+
+class AliStaTrigger : public TObject
+{
+ public:
+  AliStaTrigger() : TObject(), fE(0), fEta(0), fPhi(0), fAmp(0), fMinTime(0), fMaxTime(0) {}
+
+ public:
+  Double32_t    fE;                //[0,0,16] energy
+  Double32_t    fEta;              //[0,0,16] eta
+  Double32_t    fPhi;              //[0,0,16] phi
+  Double32_t    fAmp;              //[0,0,16] amplitude
+  Short_t       fMinTime;           //        minimum L0 "time"
+  Short_t       fMaxTime;           //        maximum L0 "time"
+
+  ClassDef(AliStaTrigger,1) // Trigger class
 };
 #endif