AliPhysics  9b6b435 (9b6b435)
AliAnalysisTaskEmcalJetCDF.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKEMCALJETCDF_H
2 #define ALIANALYSISTASKEMCALJETCDF_H
3 
9 /* Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
10  * See cxx source for full Copyright notice */
11 
12 #include <TChain.h>
13 #include <TH1D.h>
14 #include <TH2D.h>
15 #include <TArrayD.h>
16 #include <TVector2.h>
18 #include <THistManager.h>
19 
26 public:
27 
29  AliAnalysisTaskEmcalJetCDF ( const char *name );
31 
33  void Terminate ( Option_t *option );
34 
36 
37 protected:
38  void ExecOnce();
39  Bool_t Run() ;
40 
44 
48  TObject* GetHistogram ( const char* histName );
49 
50 private:
51  AliAnalysisTaskEmcalJetCDF ( const AliAnalysisTaskEmcalJetCDF& ); // not implemented
53 
55  ClassDef ( AliAnalysisTaskEmcalJetCDF, 8 );
57 
58 };
59 
62  typedef std::pair<Double_t, Int_t> ptidx_pair;
63 
65  struct sort_descend
66  {
67  bool operator () ( const ptidx_pair &p1, const ptidx_pair &p2 ) { return p1.first > p2.first ; }
68  };
69 
73  inline Double_t Mag2 (const AliVParticle& trk)
74  { return trk.Px()*trk.Px() + trk.Py()*trk.Py() + trk.Pz()*trk.Pz(); }
75 
79  inline Double_t Mag(const AliVParticle& trk) { return TMath::Sqrt(Mag2(trk)); }
80 
85  inline Double_t Dot (const AliVParticle& trk1, const AliVParticle& trk2 )
86  { return trk1.Px()*trk2.Px() + trk1.Py()*trk2.Py() + trk1.Pz()*trk2.Pz(); }
87 
92  inline Double_t Perp2( const AliVParticle& trk1, const AliVParticle& trk2) {
93  Double_t mag1 = Mag2(trk1);
94  Double_t mag2 = Mag2(trk2);
95  Double_t dotp = Dot(trk1,trk2);
96  if (mag2 > 0.0) { mag1 -= dotp*dotp/mag2; }
97  if (mag1 <= 0) { mag1 = 0; }
98  return mag1;
99  }
100 
105  inline Double_t Perp (const AliVParticle& trk1, const AliVParticle& trk2 ) { return TMath::Sqrt(Perp2(trk1,trk2)); }
106 
110  std::vector<Int_t> SortTracksPt ( AliVEvent* event );
111 
115  std::vector<Int_t> SortTracksPt ( AliParticleContainer* track_container );
116 
121  inline Double_t Z_ptot ( const AliEmcalJet* jet, const AliVParticle* trk ) // Get Z of constituent trk ; p total
122  {
123  if (trk->P() < 1e-6) return 0.;
124  return (trk != 0) ? trk->P()/ jet->P() : 0.;
125  }
126 
131  inline Double_t Z_pt ( const AliEmcalJet* jet, const AliVParticle* trk ) // Get Z of constituent trk ; pt
132  {
133  if (trk->P() < 1e-6) return 0.;
134  return (trk != 0) ? trk->Pt() / jet->Pt() : 0.;
135  }
136 
139  inline Double_t Xi ( Double_t z ) { return TMath::Log ( 1/z ); } // Get Xi of value z
140 
145  inline Double_t DeltaR ( const AliVParticle* part1, const AliVParticle* part2 )
146  {
147  Double_t dPhi = part1->Phi() - part2->Phi();
148  Double_t dEta = part1->Eta() - part2->Eta();
149  dPhi = TVector2::Phi_mpi_pi ( dPhi );
150  return TMath::Sqrt ( dPhi * dPhi + dEta * dEta );
151  }
152 
157  inline Int_t IdxInArray ( Int_t index, TArrayI &array )
158  {
159  for ( Int_t i = 0; i < array.GetSize(); i++ ) { if ( index == array[i] ) { return i; } }
160  return -1;
161  }
162 
170  const char* ntracks = "usedefault",
171  const char* nclusters = "usedefault",
172  const char* ncells = "usedefault",
173  const char* tag = "CDF"
174  );
175 
186  void jetContSetParams (
187  AliJetContainer* jetCont,
188  Float_t jetptmin = 1.,
189  Float_t jetptmax = 500.,
190  Float_t jetareacutperc = 0.,
191  Int_t leadhadtype = 2,
192  Int_t nLeadJets = 1,
193  Float_t mintrackpt = 0.15,
194  Float_t maxtrackpt = 1000.
195  );
196 
197 
210 TChain* CreateChain ( const char* filelist = "filelist.txt",
211  const char* cTreeNameArg = "auto",
212  const char* friends = "",
213  UInt_t iNumFiles = -1,
214  UInt_t iStartWithFile = 1
215  );
216 
217 
218 } // end of NS_AliAnalysisTaskEmcalJetCDF
219 
220 #endif // end of #ifndef ALIANALYSISTASKEMCALJETCDF_H
221 
222 // kate: indent-mode none; indent-width 2; replace-tabs on;
THistManager fHistManager
Histogram manager.
std::pair< Double_t, Int_t > ptidx_pair
(pt,index) pair
double Double_t
Definition: External.C:58
void jetContSetParams(AliJetContainer *jetCont, Float_t jetptmin=1., Float_t jetptmax=500., Float_t jetareacutperc=0., Int_t leadhadtype=2, Int_t nLeadJets=1, Float_t mintrackpt=0.15, Float_t maxtrackpt=1000.)
Container for particles within the EMCAL framework.
Double_t Dot(const AliVParticle &trk1, const AliVParticle &trk2)
std::vector< Int_t > SortTracksPt(AliParticleContainer *track_container)
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
TObject * GetHistogram(const char *histName)
Double_t Z_pt(const AliEmcalJet *jet, const AliVParticle *trk)
AliAnalysisTaskEmcalJetCDF * AddTaskEmcalJetCDF(const char *ntracks="usedefault", const char *nclusters="usedefault", const char *ncells="usedefault", const char *tag="CDF")
Double_t Mag(const AliVParticle &trk)
Double_t Perp(const AliVParticle &trk1, const AliVParticle &trk2)
Double_t Pt() const
Definition: AliEmcalJet.h:109
virtual ~AliAnalysisTaskEmcalJetCDF()
Destructor.
Double_t P() const
Definition: AliEmcalJet.h:110
Double_t DeltaR(const AliVParticle *part1, const AliVParticle *part2)
Int_t IdxInArray(Int_t index, TArrayI &array)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Container class for histograms.
Definition: THistManager.h:99
functional for sorting pair by first element - descending
Double_t Perp2(const AliVParticle &trk1, const AliVParticle &trk2)
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
AliAnalysisTaskEmcalJetCDF & operator=(const AliAnalysisTaskEmcalJetCDF &)
TChain * CreateChain(const char *filelist="filelist.txt", const char *cTreeNameArg="auto", const char *friends="", UInt_t iNumFiles=-1, UInt_t iStartWithFile=1)
Double_t Z_ptot(const AliEmcalJet *jet, const AliVParticle *trk)
Container for jet within the EMCAL jet framework.
Analysis of jet shapes and FF of all jets and leading jets.
Double_t Mag2(const AliVParticle &trk)