ROOT logo
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: Yvonne Pachmayer <pachmay@physi.uni-heidelberg.de>             *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  *
**************************************************************************/
//
// The task:
// stores TRD PID quantities in a Tree
//
//  Author:
//  Yvonne Pachmayer <pachmay@physi.uni-heidelberg.de>
//

#ifndef ALITRDPIDTREE_H
#define ALITRDPIDTREE_H
#include "AliAnalysisTaskSE.h"
#include "AliStack.h"

class TTreeStream;
class AliInputEventHandler;
class TArrayF;
template <class X>
class THnSparseT;
typedef class THnSparseT<TArrayF> THnSparseF;
class TFile;
class AliESDEvent;
class AliMCEvent;
class AliESDtrackCuts;
class AliPIDResponse;
class AliESD;
class AliESDtrack;
class AliAnalysisTask;
class AliESDInputHandler;
class AliESDv0KineCuts;
class AliAnalysisManager;
class AliCentrality;
class AliTRDgeometry;
class TTree;
class TSystem;
class TStyle;
class TROOT;
class Riostream;
class TChain;
class TH2;
class TF1;
class TH1;
class TObjArray;


class AliTRDPIDTree : public AliAnalysisTaskSE {

    public:
  typedef enum{
      kpp = 0,
      kpPb = 1,
      kPbPb = 2
    } ECollisionSystem_t;

  AliTRDPIDTree(const char *name = "trd_pid_tree");
  virtual ~AliTRDPIDTree();
  virtual void   UserCreateOutputObjects();
  virtual void   UserExec(Option_t *);
  virtual void   Process(AliESDEvent *const esdEvent=0, AliMCEvent *const mcEvent=0);
  virtual void   Terminate(const Option_t*);
  Int_t          CompareFloat(Float_t f1=1, Float_t f2=0) const;
  Int_t          GetV0tag(Int_t trackIndex) const;
  Int_t          *fV0tags;  //! Pointer to array with tags for identified particles from V0 decays

  Bool_t Ispp() const { return fCollisionSystem.TestBitNumber(kpp); }
  Bool_t IspPb() const { return fCollisionSystem.TestBitNumber(kpPb); }
  Bool_t IsPbPb() const { return fCollisionSystem.TestBitNumber(kPbPb); }

  void SetCollisionSystem(ECollisionSystem_t system){
      fCollisionSystem.Clear();
      fCollisionSystem.SetBitNumber(system, kTRUE);
  }
  void SetppAnalysis(){
      fCollisionSystem.SetBitNumber(kpPb, kFALSE);
      fCollisionSystem.SetBitNumber(kPbPb, kFALSE);
      fCollisionSystem.SetBitNumber(kpp, kTRUE);
  }
  void SetpPbAnalysis() {
      fCollisionSystem.SetBitNumber(kpp, kFALSE);
      fCollisionSystem.SetBitNumber(kPbPb, kFALSE);
      fCollisionSystem.SetBitNumber(kpPb, kTRUE);
  }
  void SetPbPbAnalysis() {
      fCollisionSystem.SetBitNumber(kpp, kFALSE);
      fCollisionSystem.SetBitNumber(kpPb, kFALSE);
      fCollisionSystem.SetBitNumber(kPbPb, kTRUE);
  };

  protected:
  static Double_t fgMinLayer;  //! Cut variable for min number of layers
  AliESDv0KineCuts *fV0cuts;           //! ESD V0 cuts
  TObjArray *fV0electrons;             //! array with pointer to identified particles from V0 decays (electrons)
  TObjArray *fV0pions;                 //! array with pointer to identified particles from V0 decays (pions)
  TObjArray *fV0protons;               //! array with pointer to identified particles from V0 decays (ptotons)

  void FillTree(AliESDtrack *track, Int_t pdg, Int_t runnumber, Int_t centralityvalue);
  void SetupV0qa();
  void FillV0PIDlist();
  void ClearV0PIDlist();
  Double_t GetPhi(AliESDtrack *const fTrack,Int_t iPl, Double_t& ar);
  Bool_t PassTrackCuts(AliESDtrack *fESDTrack=0);
  Bool_t HasMissingLayer(const AliVTrack *fESDTrack=0);
  Int_t  GetNTrackletsPID(const AliVTrack *fESDTrack=0) const;

  private:
  //
  //
  AliESDEvent *fESDEvent;              //! ESD object
  AliMCEvent  *fMCEvent;               //! MC object
  AliStack    *fMCStack;               //! MC stack
  TTree *fTreeTRDPID;                  //! Tree with V0
  AliPIDResponse *fPIDResponse;        //! PID handling
  TObjArray *fOutputContainer;         //! output data container
  AliESDtrackCuts *fESDtrackCuts;      //! basic cut variables for all non-V0 tracks
  AliESDtrackCuts *fESDtrackCutsV0;    //! basic cut variables for all V0 tracks
  //
  TList                 *fListQATRD;   //! List with QATRD histograms
  TList                 *fListQATRDV0; //! List with V0 kine cuts QATRD histograms

  Int_t fNumTagsStored;                //! Number of entries of fV0tags

  TBits fCollisionSystem;              //! Collision System;

  Float_t fpdg;                        //! particle type (pdg value)
  Int_t frun;                          //! run number
  
  // TTree stuff for PID References
  Int_t frunnumber;                  //! Tree: Run number
  Double_t fcentrality;              //! Tree: Centrality
  Int_t fTRDNtracklets;              //! Tree: number of tracklets for layers with dE/dx>0
  Double_t fTRDslices[48];           //! Tree: dEdx slices (8 per layer)
  Double_t fTRDMomentum[6];          //! Tree: local track momentum at anode wire
  Int_t fTRDNcls;                    //! Tree: number of clusters
  Int_t fTRDntracklets;              //! Tree: number of tracking tracklets
  Int_t fTRDntrackletsPID;           //! Tree: number of pid tracklets
  Double_t fTRDphi[6];               //! Tree: local track inclination phi (from track extrapol)
  Double_t fTRDY[6];                 //! Tree: local track y-position (from track extrapol)
  Double_t fTRDtheta;                //! Tree: theta track
  Double_t fTRDsignal;               //! Tree: Truncated mean
  Int_t fTRDnclsdEdx;                //! Tree: number of clusters dedx
  Int_t fTRDnch;                     //! Tree: number of chambers dedx
  Float_t fNSigmaTPC[3];             //! Tree: TPC nsigma ele, pion, proton
  Float_t fNSigmaTOF[3];             //! Tree: TOF nsigma ele, pion, proton
  Int_t fPDG;                        //! Tree: PDG value from V0 identification
  Int_t fPDGTRUE;                    //! Tree: true PDG value (only available in MC)
  Float_t fDCA[2];                   //! Tree: DCA
  Float_t fChi2;                     //! Tree: Chi at TRD
  Double_t fsigmaTRD[5];             //! Tree: truncated mean sigma
  Double_t fdeltaTRD[5];             //! Tree: truncated delta
  Double_t fratioTRD[5];             //! Tree: truncated ratio

  // Histograms
  TH1F *fhtrackCuts;                 //! Track and Event Cuts - QA
  TH2F *fhArmenteros;                 //! 2D V0 QA Hist

  AliTRDPIDTree(const AliTRDPIDTree&); // not implemented
  AliTRDPIDTree& operator=(const AliTRDPIDTree&); // not implemented
  
  ClassDef(AliTRDPIDTree, 1);
};
#endif
 AliTRDPIDTree.h:1
 AliTRDPIDTree.h:2
 AliTRDPIDTree.h:3
 AliTRDPIDTree.h:4
 AliTRDPIDTree.h:5
 AliTRDPIDTree.h:6
 AliTRDPIDTree.h:7
 AliTRDPIDTree.h:8
 AliTRDPIDTree.h:9
 AliTRDPIDTree.h:10
 AliTRDPIDTree.h:11
 AliTRDPIDTree.h:12
 AliTRDPIDTree.h:13
 AliTRDPIDTree.h:14
 AliTRDPIDTree.h:15
 AliTRDPIDTree.h:16
 AliTRDPIDTree.h:17
 AliTRDPIDTree.h:18
 AliTRDPIDTree.h:19
 AliTRDPIDTree.h:20
 AliTRDPIDTree.h:21
 AliTRDPIDTree.h:22
 AliTRDPIDTree.h:23
 AliTRDPIDTree.h:24
 AliTRDPIDTree.h:25
 AliTRDPIDTree.h:26
 AliTRDPIDTree.h:27
 AliTRDPIDTree.h:28
 AliTRDPIDTree.h:29
 AliTRDPIDTree.h:30
 AliTRDPIDTree.h:31
 AliTRDPIDTree.h:32
 AliTRDPIDTree.h:33
 AliTRDPIDTree.h:34
 AliTRDPIDTree.h:35
 AliTRDPIDTree.h:36
 AliTRDPIDTree.h:37
 AliTRDPIDTree.h:38
 AliTRDPIDTree.h:39
 AliTRDPIDTree.h:40
 AliTRDPIDTree.h:41
 AliTRDPIDTree.h:42
 AliTRDPIDTree.h:43
 AliTRDPIDTree.h:44
 AliTRDPIDTree.h:45
 AliTRDPIDTree.h:46
 AliTRDPIDTree.h:47
 AliTRDPIDTree.h:48
 AliTRDPIDTree.h:49
 AliTRDPIDTree.h:50
 AliTRDPIDTree.h:51
 AliTRDPIDTree.h:52
 AliTRDPIDTree.h:53
 AliTRDPIDTree.h:54
 AliTRDPIDTree.h:55
 AliTRDPIDTree.h:56
 AliTRDPIDTree.h:57
 AliTRDPIDTree.h:58
 AliTRDPIDTree.h:59
 AliTRDPIDTree.h:60
 AliTRDPIDTree.h:61
 AliTRDPIDTree.h:62
 AliTRDPIDTree.h:63
 AliTRDPIDTree.h:64
 AliTRDPIDTree.h:65
 AliTRDPIDTree.h:66
 AliTRDPIDTree.h:67
 AliTRDPIDTree.h:68
 AliTRDPIDTree.h:69
 AliTRDPIDTree.h:70
 AliTRDPIDTree.h:71
 AliTRDPIDTree.h:72
 AliTRDPIDTree.h:73
 AliTRDPIDTree.h:74
 AliTRDPIDTree.h:75
 AliTRDPIDTree.h:76
 AliTRDPIDTree.h:77
 AliTRDPIDTree.h:78
 AliTRDPIDTree.h:79
 AliTRDPIDTree.h:80
 AliTRDPIDTree.h:81
 AliTRDPIDTree.h:82
 AliTRDPIDTree.h:83
 AliTRDPIDTree.h:84
 AliTRDPIDTree.h:85
 AliTRDPIDTree.h:86
 AliTRDPIDTree.h:87
 AliTRDPIDTree.h:88
 AliTRDPIDTree.h:89
 AliTRDPIDTree.h:90
 AliTRDPIDTree.h:91
 AliTRDPIDTree.h:92
 AliTRDPIDTree.h:93
 AliTRDPIDTree.h:94
 AliTRDPIDTree.h:95
 AliTRDPIDTree.h:96
 AliTRDPIDTree.h:97
 AliTRDPIDTree.h:98
 AliTRDPIDTree.h:99
 AliTRDPIDTree.h:100
 AliTRDPIDTree.h:101
 AliTRDPIDTree.h:102
 AliTRDPIDTree.h:103
 AliTRDPIDTree.h:104
 AliTRDPIDTree.h:105
 AliTRDPIDTree.h:106
 AliTRDPIDTree.h:107
 AliTRDPIDTree.h:108
 AliTRDPIDTree.h:109
 AliTRDPIDTree.h:110
 AliTRDPIDTree.h:111
 AliTRDPIDTree.h:112
 AliTRDPIDTree.h:113
 AliTRDPIDTree.h:114
 AliTRDPIDTree.h:115
 AliTRDPIDTree.h:116
 AliTRDPIDTree.h:117
 AliTRDPIDTree.h:118
 AliTRDPIDTree.h:119
 AliTRDPIDTree.h:120
 AliTRDPIDTree.h:121
 AliTRDPIDTree.h:122
 AliTRDPIDTree.h:123
 AliTRDPIDTree.h:124
 AliTRDPIDTree.h:125
 AliTRDPIDTree.h:126
 AliTRDPIDTree.h:127
 AliTRDPIDTree.h:128
 AliTRDPIDTree.h:129
 AliTRDPIDTree.h:130
 AliTRDPIDTree.h:131
 AliTRDPIDTree.h:132
 AliTRDPIDTree.h:133
 AliTRDPIDTree.h:134
 AliTRDPIDTree.h:135
 AliTRDPIDTree.h:136
 AliTRDPIDTree.h:137
 AliTRDPIDTree.h:138
 AliTRDPIDTree.h:139
 AliTRDPIDTree.h:140
 AliTRDPIDTree.h:141
 AliTRDPIDTree.h:142
 AliTRDPIDTree.h:143
 AliTRDPIDTree.h:144
 AliTRDPIDTree.h:145
 AliTRDPIDTree.h:146
 AliTRDPIDTree.h:147
 AliTRDPIDTree.h:148
 AliTRDPIDTree.h:149
 AliTRDPIDTree.h:150
 AliTRDPIDTree.h:151
 AliTRDPIDTree.h:152
 AliTRDPIDTree.h:153
 AliTRDPIDTree.h:154
 AliTRDPIDTree.h:155
 AliTRDPIDTree.h:156
 AliTRDPIDTree.h:157
 AliTRDPIDTree.h:158
 AliTRDPIDTree.h:159
 AliTRDPIDTree.h:160
 AliTRDPIDTree.h:161
 AliTRDPIDTree.h:162
 AliTRDPIDTree.h:163
 AliTRDPIDTree.h:164
 AliTRDPIDTree.h:165
 AliTRDPIDTree.h:166
 AliTRDPIDTree.h:167
 AliTRDPIDTree.h:168
 AliTRDPIDTree.h:169
 AliTRDPIDTree.h:170
 AliTRDPIDTree.h:171
 AliTRDPIDTree.h:172
 AliTRDPIDTree.h:173
 AliTRDPIDTree.h:174