]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/PHOSTasks/PHOS_Correlation/AliPHOSCorrelations.h
logic update and bug fix
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_Correlation / AliPHOSCorrelations.h
index 77ff5e9dd4c6db9164fd452b406e3e21f599df6a..02c99b7c9f065e3d3062268abc4827f45212617c 100644 (file)
@@ -4,10 +4,10 @@
 /* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice     */
 
-// Analysis task for identified PHOS cluster from pi0 and take korrelation betwen hadron-pi0 angel's.
-/// Authors:   Daniil Ponomarenko (Daniil.Ponomarenko@cern.ch)
-//                    Dmitry Blau
-// 07-Feb-2014
+// Analysis task for identified PHOS cluster from pi0 and extracting pi0-hadron correlation.
+// Authors:    Daniil Ponomarenko <Daniil.Ponomarenko@cern.ch>
+//             Dmitry Blau <Dmitry.Blau@cern.ch>
+// 09-Jul-2014
 
 class TClonesArray;
 class AliStack ;
@@ -24,6 +24,8 @@ class AliAODTrack ;
 class AliVCluster ;
 class AliAnalysisUtils;
 class AliEPFlattener;
+class AliAODInputHandler;
+class AliESDInputHandler;
 
 
 #include "TArrayD.h"
@@ -33,14 +35,14 @@ class AliPHOSCorrelations : public AliAnalysisTaskSE
 {
 public:
   enum Period { kUndefinedPeriod, kLHC10h, kLHC11h, kLHC13 };
-  enum EventSelection { kTotal, kInternalTriggerMaskSelection, kHasVertex, kHasAbsVertex, kHasCentrality,  kCentUnderUpperBinUpperEdge, kHasPHOSClusters, kHasTPCTracks, kTotalSelected };
+  enum EventSelection { kTotal, kEvent, kEventHandler, kTriggerMaskSelection, kHasVertex, kHasCentrality, kHasPHOSClusters, kHasTPCTracks, kPHOSEvent, kMBEvent, kTotalSelected, kHasAbsVertex };
   enum HibridCheckVeriable { kOnlyHibridTracks, kWithOutHibridTracks, kAllTracks };
   enum PID { kPidAll, kPidCPV, kPidDisp, kPidBoth};
-  enum TriggerSelection { kNoSelection, kCentralInclusive, kCentralExclusive, kSemiCentralInclusive, kSemiCentralExclusive, kMBInclusive, kMBExclusive };
 
 
 public:
   AliPHOSCorrelations();
+  AliPHOSCorrelations(const char *name);
   AliPHOSCorrelations(const char *name, Period period );
   virtual ~AliPHOSCorrelations();
 
@@ -49,8 +51,9 @@ public:
 //  virtual void   Terminate(Option_t *);
 
   void SetHibridGlobalCheking(Int_t hibridCheck = kAllTracks) {fCheckHibridGlobal = hibridCheck; }
+  void SetAnalysisAlgoritmForReal(TString algoritm = "ME") {algoritm.Contains("ME")?fUseMEAlgoritmForReal = true:fUseMEAlgoritmForReal = false;}
+  void SetAnalysisAlgoritmForMix(TString algoritm = "ME") {algoritm.Contains("ME")?fUseMEAlgoritmForMix = true:fUseMEAlgoritmForMix = false;}
   void SetCentralityBinning(const TArrayD& edges, const TArrayI& nMixed);
-  void SetInternalTriggerSelection(TriggerSelection selection) { fInternalTriggerSelection = selection; }
   void EnableTOFCut(Bool_t enable = kTRUE, Double_t TOFCut = 100.e-9){fTOFCutEnabled=enable; fTOFCut=TOFCut;}
   void SetMassWindow(Double_t massMean = 0.135, Double_t massSigma = 0.01) { fMassInvMean = massMean; fMassInvSigma = massSigma; }
   void SetSigmaWidth(Double_t sigmaWidth= 0) { fSigmaWidth = sigmaWidth; }
@@ -70,16 +73,15 @@ protected:
   AliPHOSCorrelations& operator=(const AliPHOSCorrelations&); // not implemented
   
   // Histograms and trees.
-    void SetHistPtNumTrigger(Int_t  ptMult, Double_t ptMin, Double_t ptMax);                      // Set massive of histograms (1-5).
-    void SetHistPtAssoc(Int_t  ptMult, Double_t ptMin, Double_t ptMax);                      // Set massive of histograms (1-5).
+    void SetHistPtNumTrigger(Int_t  ptMult, Double_t ptMin, Double_t ptMax);      // Set massive of histograms (1-5).
+    void SetHistPtAssoc(Int_t  ptMult, Double_t ptMin, Double_t ptMax);           // Set massive of histograms (1-5).
     void SetHistMass(Int_t  ptMult, Double_t ptMin, Double_t ptMax);              // Set other histograms.
     void SetHistEtaPhi();                       // Set hists, with track's and cluster's angle distributions.
-    void SetHistPHOSClusterMap();       // XZE distribution in PHOS.
-    void FillHistogram(const char * key,Double_t x) const ; //Fill 1D histogram witn name key
-    void FillHistogram(const char * key,Double_t x, Double_t y) const ; //Fill 2D histogram witn name key
-    void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ; //Fill 3D histogram witn name key
+    void SetHistPHOSClusterMap();               // XZE distribution in PHOS.
+    void FillHistogram(const char * key,Double_t x) const ;                                     //Fill 1D histogram witn name key
+    void FillHistogram(const char * key,Double_t x, Double_t y) const ;                         //Fill 2D histogram witn name key
+    void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z) const ;             //Fill 3D histogram witn name key
     void FillHistogram(const char * key,Double_t x, Double_t y, Double_t z, Double_t w) const ; //Fill 3D histogram witn name key
-    void FillTrackEtaPhi();                     // Distribution by track's angles.
 
     void SetESDTrackCuts(); // AliESDtrack cuts ( for esd data )
     
@@ -87,16 +89,14 @@ protected:
     Double_t MassMeanFunktion(Double_t &pt) const ;
     Double_t MassSigmaFunktion(Double_t &pt) const ;
 
-    Double_t GetAssocBin(Double_t pt) const ;
-
-    Double_t GetEfficiency(Double_t pt) const ;  // Return Pi0 efficiency for current pT.
+    Double_t GetAssocBin(Double_t pt) const ;   //Calculates bin of associated particle pt.
+    Double_t GetEfficiency(Double_t pt) const ; // Return Pi0 efficiency for current pT.
 
     Int_t GetModCase(Int_t &mod1, Int_t &mod2) const; // Produce part of module neme for pTetaPhi histogram in mixed events.
 
     Int_t ConvertToInternalRunNumber(Int_t run);
 
-    void TestTrigger();
-    Bool_t RejectTriggerMaskSelection(); 
+    Bool_t RejectTriggerMaskSelection();    // Select event trigger and reject.
 
     void    SetVertex();
     Bool_t RejectEventVertex();
@@ -104,37 +104,42 @@ protected:
     void  SetCentrality();   // Find centrality of event.
     Bool_t RejectEventCentrality(); 
     
-
     Int_t     GetCentralityBin(Float_t centralityV0M);
     UInt_t  GetNumberOfCentralityBins() { return fCentEdges.GetSize()-1; }
 
-    void EvalReactionPlane();                               // Find RP of event.
-    void EvalV0ReactionPlane();                           // Find RP of event.
-    Int_t GetRPBin(); // Return RP (rad).
+    void EvalReactionPlane();   // Find RP of event.
+    void EvalV0ReactionPlane(); // Find RP of event.
+    Int_t GetRPBin();           // Return RP (rad).
 
-    Double_t ApplyFlattening(Double_t phi, Double_t c) ;       //Apply centrality-dependent flattening.
-    Double_t ApplyFlatteningV0A(Double_t phi, Double_t c) ; //Apply centrality-dependent flattening.
-    Double_t ApplyFlatteningV0C(Double_t phi, Double_t c) ; //Apply centrality-dependent flattening.
+    Double_t ApplyFlattening(Double_t phi, Double_t c) ;    // Apply centrality-dependent flattening.
+    Double_t ApplyFlatteningV0A(Double_t phi, Double_t c) ; // Apply centrality-dependent flattening.
+    Double_t ApplyFlatteningV0C(Double_t phi, Double_t c) ; // Apply centrality-dependent flattening.
 
     void ZeroingVariables();
     
     virtual void SelectPhotonClusters();
     void SelectAccosiatedTracks();
 
-    void ConsiderPi0s();
-    void ConsiderPi0sME();
+     void FillTrackEtaPhi();        // Distribution by track's angles.
+
+    void SelectTriggerPi0ME();      //Select most energetic Pi0 in event.
+
+    void ConsiderPi0s();            // Consider all Pi0 with all tracks in same event.
+    void ConsiderTracksMix();       // Consider all Pi0 in this event with tracks from MIXing pull.
+
+    void ConsiderPi0sME();             // Consider the most energetic Pi0 in this event with all tracks of this event.
+    void ConsiderTracksMixME();        // Consider the most energetic Pi0 in this event with all tracks from MIXing pull.
+
     void ConsiderPi0sMix();           // MIX for catch Mass
-    void ConsiderTracksMix();       // MIX for catch Yeild
-    void ConsiderTracksMixME();
 
-    void TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCase);
-    Int_t CheckTriggerEta(Double_t eta);
+    void TestPi0ME(Int_t ipid, TLorentzVector p12, Int_t modCase);  // Compare Pi0 particles and save most energetic.
+    Int_t CheckTriggerEta(Double_t eta);                            // Return 1 if eta>=0, else 2.
     
     TList* GetCaloPhotonsPHOSList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin);
     TList* GetTracksTPCList(UInt_t vtxBin, UInt_t centBin, UInt_t rpBin);
 
-    void UpdatePhotonLists();
-    void UpdateTrackLists();
+    void UpdatePhotonLists();   // Fill photons in MIXing pull.
+    void UpdateTrackLists();    // Fill Tracks in MIXing pull.
 
     void SetGeometry();
 
@@ -148,45 +153,65 @@ protected:
   // Set / Get parametrs
     void SetManualV0EPCalc(Bool_t manCalc = true) {fManualV0EPCalc = manCalc;}
 
+    void SetMEExists(const Int_t pid) {fMEExists[pid] = true;}
+    Bool_t GetMEExists(const Int_t pid) const {return fMEExists[pid];}
+
+    void SetMEPhi(const Int_t pid, const Double_t phi) {fMEPhi[pid] = phi;}
+    Double_t GetMEPhi(const Int_t pid) const {return fMEPhi[pid];}
+
+    void SetMEEta(const Int_t pid, const Double_t eta) {fMEEta[pid] = eta;}
+    Double_t GetMEEta(const Int_t pid) const {return fMEEta[pid];}
+
+    void SetMEPt(const Int_t pid, const Double_t pT) {fMEPt[pid] = pT;}
+    Double_t GetMEPt(const Int_t pid) const {return fMEPt[pid];}
+
+    void SetMEModCase(const Int_t pid, const Int_t modcase) {fMEModCase[pid] = modcase;}
+    Int_t GetMEModCase(const Int_t pid) const {return fMEModCase[pid];}
+
+
     AliAnalysisUtils* GetAnalysisUtils();
  
 private:
   // Geometry
     AliPHOSGeometry* fPHOSGeo;
-  // Make output histograms / conteiners.
+  // Make output histograms/conteiners.
     TList * fOutputContainer;              //final histogram / tree container     
    
   // cluster cut variables:
-    Double_t fMinClusterEnergy;
-    Double_t fMinBCDistance;  //distance to nearest bad channel
-    Int_t    fMinNCells;
-    Double_t fMinM02;
-    Bool_t fTOFCutEnabled;
-    Double_t fTOFCut;
+    Double_t fMinClusterEnergy; // Min energy PHOS's cluster.
+    Double_t fMinBCDistance;    // Min distance to nearest bad channel
+    Int_t    fMinNCells;        // Min count of Cells in cluster.
+    Double_t fMinM02;           // Min size of M02 in claster.
+    Bool_t fTOFCutEnabled;      // Use time of flight or not?
+    Double_t fTOFCut;           // Max time of flight.
 
   // Binning, [vtx, centrality, reaction-plane]
     Int_t   fNVtxZBins;
     TArrayD fCentEdges;                 // Centrality Bin Lower edges.
     TArrayI fCentNMixed;                // Number of mixed events for each centrality bin.
-    UInt_t  fNEMRPBins;                  // Binning of Reaction plane.
+    UInt_t  fNEMRPBins;                 // Binning of Reaction plane.
     TArrayD fAssocBins;                 //  Assoc Pt Bin Lower edges.
 
   // Control variables
+    Bool_t fUseMEAlgoritmForReal;        // Use common or ME algoritm for analysis real events.
+    Bool_t fUseMEAlgoritmForMix;         // Use common or ME algoritm for analysis mixed events.
     Int_t fCheckHibridGlobal;      // For checking/dischecking/passingcheck: t->IsHybridGlobalConstrainedGlobal();
+
+  // Event selection
     Bool_t fPHOSEvent;              // PHOS event trigger.
+    Bool_t fMBEvent;                // MB event trigger.
 
   // Behavior / cuts
     Period fPeriod;
-    TriggerSelection fInternalTriggerSelection;
-    Float_t fMaxAbsVertexZ;       // in cm.
-    Bool_t fManualV0EPCalc;
+    Float_t fMaxAbsVertexZ;       // Maximum distence Z component of vertix in cm.
+    Bool_t fManualV0EPCalc;       //
 
     Double_t fCentCutoffDown;   // Ignore Centrality less %. (def = 0%)
     Double_t fCentCutoffUp;     // Ignore Centrality over %. (def = 90%)
 
-    Double_t fMassInvMean ;      //
-    Double_t fMassInvSigma ;      // 
-    Double_t fSigmaWidth;       // 0 = wide
+    Double_t fMassInvMean ;     // Mass Pi0.
+    Double_t fMassInvSigma ;    // Mass width Pi0.
+    Double_t fSigmaWidth;       // *N sigma. if 0 will use fMassInvMean+/-fMassInvSigma. Else will calculate using function.
 
   // Funktion of window mass parametrs: [mass, pt]
     Double_t fMassMeanP0;
@@ -197,20 +222,21 @@ private:
     AliVEvent* fEvent;          //! Current event
     AliESDEvent* fEventESD;     //! Current event, if ESD.
     AliAODEvent* fEventAOD;     //! Current event, if AOD.
+    AliInputEventHandler *fEventHandler; //! Event trigger bit.
     AliESDtrackCuts *fESDtrackCuts;     // Track cut
 
     Int_t fRunNumber;           //! run number
-    Int_t fInternalRunNumber ;  //!Current internal run number
+    Int_t fInternalRunNumber ;  //! Current internal run number
 
-    TProfile* fMultV0;                  // object containing VZERO calibration information
-    Float_t fV0Cpol,fV0Apol;            // loaded by OADB
+    TProfile* fMultV0;          // Object containing VZERO calibration information
+    Float_t fV0Cpol,fV0Apol;    // oaded by OADB
     Float_t fMeanQ[9][2][2];    // and recentering
     Float_t fWidthQ[9][2][2];   //       
-    TString fEPcalibFileName; 
+    TString fEPcalibFileName;   //
 
-    Double_t fVertex[3];          //!
-    TVector3 fVertexVector;       //!
-    Int_t fVtxBin;                //!
+    Double_t fVertex[3];          //! Event vertex.
+    TVector3 fVertexVector;       //! The same.
+    Int_t fVtxBin;                //! Vertex bin.
 
     TString fCentralityEstimator; //! Centrality estimator ("V0M", "ZNA")
     Float_t fCentrality ;         //! Centrality of the current event
@@ -220,9 +246,12 @@ private:
     Float_t fRP ;       //! Reaction plane calculated with full TPC
     Int_t fEMRPBin;     //! Event Mixing Reaction Plane Bin
 
-    Double_t fMEPhi[4], fMEEta[4], fMEPt[4];
-    Bool_t fMEExists[4];
-    Int_t fMEModCase[4];
+    // ME Pi0 selection veriables. 1...4 = all...both pid.
+    Bool_t fMEExists[4];    // Does trigger Pi0 exists?
+    Double_t fMEPhi[4];     // Phi ME pi0.
+    Double_t fMEEta[4];     // Eta ME Pi0.
+    Double_t fMEPt[4];      // pT ME Pi0.
+    Int_t fMEModCase[4];    // Pair of modules where photons are observed.
 
     TClonesArray * fCaloPhotonsPHOS ;      //! PHOS photons in current event
     TClonesArray * fTracksTPC ;            //! TPC Tracks in current event