]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskJetMatching.h
added pdet-ppart over ppart histogram for detector response
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskJetMatching.h
CommitLineData
f1354962 1#ifndef AliAnalysisTaskJetMatching_H
2#define AliAnalysisTaskJetMatching_H
3
9239b066 4#include <AliAnalysisTaskEmcalJet.h>
f1354962 5#include <AliEmcalJet.h>
6#include <AliVTrack.h>
7#include <TClonesArray.h>
8#include <TMath.h>
9#include <TRandom3.h>
10
11class TF1;
12class THF1;
13class THF2;
14class TProfile;
15class AliRhoParameter;
16class AliLocalRhoParameter;
17class TClonesArray;
18
9239b066 19class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJet
f1354962 20{
21 public:
22 // enumerators
285db795 23 enum matchingSceme {kGeoEtaPhi, kGeoR};
f1354962 24 enum sourceBKG {kNoSourceBKG, kSourceRho, kSourceLocalRho};
25 enum targetBKG {kNoTargetBKG, kTargetRho, kTargetLocalRho};
26 // constructors, destructor
27 AliAnalysisTaskJetMatching();
28 AliAnalysisTaskJetMatching(const char *name);
29 virtual ~AliAnalysisTaskJetMatching();
30 // setting up the task and technical aspects
31 void ExecOnce();
32 virtual void UserCreateOutputObjects();
33 TH1F* BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Bool_t append = kTRUE);
34 TH2F* BookTH2F(const char* name, const char* x, const char* y, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Bool_t append = kTRUE);
35 virtual Bool_t Run();
36 /* inline */ Double_t PhaseShift(Double_t x) const {
37 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
38 while (x<0.)x+=TMath::TwoPi();
39 return x; }
40 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
41 x = PhaseShift(x);
42 if(TMath::Nint(n)==2) while (x>TMath::Pi()) x-=TMath::Pi();
43 if(TMath::Nint(n)==3) {
44 if(x>2.*TMath::TwoPi()/n) x = TMath::TwoPi() - x;
45 if(x>TMath::TwoPi()/n) x = TMath::TwoPi()-(x+TMath::TwoPi()/n);
46 }
47 return x; }
48 /* inline */ Bool_t CompareTracks(AliVParticle* a, AliVParticle* b) const {
f1354962 49 return (TMath::AreEqualAbs(a->Pt(), b->Pt(), 1e-2) && TMath::AreEqualAbs(a->Eta(), b->Eta(), 1e-2) && TMath::AreEqualAbs(a->Phi(), b->Phi(), 1e-2)) ? kTRUE : kFALSE; }
f6d1b1a7 50 /* inline */ Double_t GetR(AliVParticle* a, AliVParticle* b) const {
51 if(!(a&&b)) return 999;
52 Double_t phiA(a->Phi()), phiB(b->Phi()), etaA(a->Eta()), etaB(b->Eta());
53 if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB + TMath::TwoPi())) phiA+=TMath::TwoPi();
54 if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB - TMath::TwoPi())) phiA-=TMath::TwoPi();
55 return TMath::Sqrt(TMath::Abs((etaA-etaB)*(etaA-etaB)+(phiA-phiB)*(phiA-phiB))); }
f1354962 56
57 // setters - setup how to run
58 void SetDebugMode(Int_t d) {fDebug = d;}
59 void SetMatchingScheme(matchingSceme m) {fMatchingScheme = m;}
f6d1b1a7 60 void SetMatchConstituents(Bool_t m) {fMatchConstituents = m;}
61 void SetMinFracRecoveredConstituents(Float_t f) {fMinFracRecoveredConstituents = f;}
285db795 62 void SetMinFracRecoveredConstituentPt(Float_t f) {fMinFracRecoveredConstituentPt = f;}
0aaf31ab 63 void SetUseEmcalBaseJetCuts(Bool_t b) {fUseEmcalBaseJetCuts = b;}
285db795 64 void SetGetBijection(Bool_t b) {fGetBijection = b;}
f1354962 65 void SetSourceBKG(sourceBKG b) {fSourceBKG = b;}
66 void SetTargetBKG(targetBKG b) {fTargetBKG = b;}
67 void SetSourceJetsName(const char* n) {fSourceJetsName = n;}
68 void SetTargetJetsName(const char* n) {fTargetJetsName = n; }
69 void SetMatchedJetsName(const char* n) {fMatchedJetsName = n;}
f6d1b1a7 70 void SetSourceLocalRhoName(const char* n) {fSourceRhoName = n;}
71 void SetTargetLocalRhoName(const char* n) {fTargetRhoName = n;}
72 void SetSourceRadius(Float_t r) {fSourceRadius = r;}
73 void SetTargetRadius(Float_t r) {fTargetRadius = r;}
f1354962 74 void SetMatchEta(Float_t f) {fMatchEta = f;}
75 void SetMatchPhi(Float_t f) {fMatchPhi = f;}
76 void SetMatchR(Float_t f) {fMatchR = f;}
c2460f8a 77 void SetDoDetectorResponse(Bool_t d) {fDoDetectorResponse = d;}
f1354962 78 // methods
285db795 79 void DoGeometricMatchingEtaPhi();
80 void DoGeometricMatchingR();
81 void DoConstituentMatching();
82 void GetBijection();
f1354962 83 void PostMatchedJets();
84 // fill histogrmas
85 void FillAnalysisSummaryHistogram() const;
c2460f8a 86 void FillMatchedJetHistograms();
f1354962 87 // setters - analysis details
88 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
e9c2d4f3 89 return (!track || TMath::Abs(track->Eta()) > 0.9 || track->Phi() < 0 || track->Phi() > TMath::TwoPi()) ? kFALSE : kTRUE; }
4f6d96b5 90 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet, Int_t c) { if(!fUseEmcalBaseJetCuts) return (jet) ? kTRUE : kFALSE;
91 else return AcceptJet(jet, c);}
f1354962 92 /* inline */ void ClearMatchedJetsCache() {
93 for (Int_t i(0); i < fNoMatchedJets; i++) {
94 fMatchedJetContainer[i][0] = 0x0; fMatchedJetContainer[i][1] = 0x0; }
95 fNoMatchedJets = 0;
96 }
97 void PrintInfo() const;
98 virtual void Terminate(Option_t* option);
99
100 private:
101 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
102 TClonesArray* fSourceJets; //! array with source jets
103 TString fSourceJetsName; // name of array with source jets
104 TClonesArray* fTargetJets; //! array with target jets
105 TString fTargetJetsName; // name of array with target jets
106 TClonesArray* fMatchedJets; //! final list of matched jets which is added to event
107 TString fMatchedJetsName; // name of list of matched jets
f6d1b1a7 108 AliLocalRhoParameter* fSourceRho; //! source rho
109 TString fSourceRhoName; // source rho name
110 AliLocalRhoParameter* fTargetRho; //! target rho
111 TString fTargetRhoName; // target rho name
f1354962 112 Bool_t fUseScaledRho; // use scaled rho
f6d1b1a7 113 Float_t fSourceRadius; // source radius
114 Float_t fTargetRadius; // target radius
f1354962 115 matchingSceme fMatchingScheme; // select your favorite matching algorithm
0aaf31ab 116 Bool_t fUseEmcalBaseJetCuts; // use the emcal jet base class for jet cuts
f1354962 117 sourceBKG fSourceBKG; // subtracted background of source jets
118 targetBKG fTargetBKG; // subtracted background of target jets
f1354962 119 // transient object pointers
120 TList* fOutputList; //! output list
121 TH1F* fHistUnsortedCorrelation; //! dphi correlation of unsorted jets
122 TH1F* fHistMatchedCorrelation; //! dphi correlation of matched jets
123 TH1F* fHistSourceJetPt; //! pt of source jets
2e3ee924 124 TH1F* fHistMatchedSourceJetPt;//! pt of matched source jets
f1354962 125 TH1F* fHistTargetJetPt; //! pt of target jets
126 TH1F* fHistMatchedJetPt; //! pt of matched jets
c2460f8a 127 TH2F* fHistSourceMatchedJetPt;//! pt or source vs matched jets
75eff6de 128 TH1F* fHistDetectorResponseProb; //! det prob
f1354962 129 TH1F* fHistNoConstSourceJet; //! number of constituents of source jet
130 TH1F* fHistNoConstTargetJet; //! number of constituents of target jet
131 TH1F* fHistNoConstMatchJet; //! number of constituents of matched jets
0aaf31ab 132 TProfile* fProfFracPtMatched; //! sum pt fraction for matched tracks / jet
133 TProfile* fProfFracPtJets; //! sum pt fraction for matched jets
134 TProfile* fProfFracNoMatched; //! no of constituents fraction found / jet
135 TProfile* fProfFracNoJets; //! no of consstituents fraction jet / jet
f1354962 136 TH1F* fHistAnalysisSummary; //! flags
137 TProfile* fProfQAMatched; //! QA spreads of matched jets
138 TProfile* fProfQA; //! QA spreads of source and target jets
139 Int_t fNoMatchedJets; //! number of matched jets
c2460f8a 140 AliEmcalJet* fMatchedJetContainer[200][2]; //! pointers to matched jets
f1354962 141 // geometric matching parameters
142 Float_t fMatchEta; // max eta distance between centers of matched jets
143 Float_t fMatchPhi; // max phi distance between centers of matched jets
144 Float_t fMatchR; // max distance between matched jets
c2460f8a 145 Bool_t fDoDetectorResponse; // get detector response matrix (not normalized)
f6d1b1a7 146 Bool_t fMatchConstituents; // match constituents
147 Float_t fMinFracRecoveredConstituents; // minimium fraction of constituents that needs to be found
285db795 148 Float_t fMinFracRecoveredConstituentPt; // minimium fraction of constituent pt that needs to be recovered
149 Bool_t fGetBijection; // get bijection of source and matched jets
f1354962 150
151 AliAnalysisTaskJetMatching(const AliAnalysisTaskJetMatching&); // not implemented
152 AliAnalysisTaskJetMatching& operator=(const AliAnalysisTaskJetMatching&); // not implemented
153
75eff6de 154 ClassDef(AliAnalysisTaskJetMatching, 5);
f1354962 155};
156
157#endif