1 #ifndef AliAnalysisTaskJetMatching_H
2 #define AliAnalysisTaskJetMatching_H
4 #include <AliAnalysisTaskEmcalJet.h>
5 #include <AliEmcalJet.h>
7 #include <TClonesArray.h>
15 class AliRhoParameter;
16 class AliLocalRhoParameter;
19 class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJet
23 enum matchingSceme {kGeoEtaPhi, kGeoR, kDiJet};
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
32 virtual Bool_t Notify();
33 virtual void UserCreateOutputObjects();
34 TH1F* BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Bool_t append = kTRUE);
35 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);
37 /* inline */ Double_t PhaseShift(Double_t x) const {
38 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
39 while (x<0.)x+=TMath::TwoPi();
41 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
43 if(TMath::Nint(n)==2) while (x>TMath::Pi()) x-=TMath::Pi();
44 if(TMath::Nint(n)==3) {
45 if(x>2.*TMath::TwoPi()/n) x = TMath::TwoPi() - x;
46 if(x>TMath::TwoPi()/n) x = TMath::TwoPi()-(x+TMath::TwoPi()/n);
49 /* inline */ Bool_t CompareTracks(AliVParticle* a, AliVParticle* b) const {
50 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; }
51 /* inline */ Double_t GetR(AliVParticle* a, AliVParticle* b) const {
52 if(!(a&&b)) return 999;
53 Double_t phiA(a->Phi()), phiB(b->Phi()), etaA(a->Eta()), etaB(b->Eta());
54 if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB + TMath::TwoPi())) phiA+=TMath::TwoPi();
55 if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB - TMath::TwoPi())) phiA-=TMath::TwoPi();
56 return TMath::Sqrt(TMath::Abs((etaA-etaB)*(etaA-etaB)+(phiA-phiB)*(phiA-phiB))); }
58 // setters - setup how to run
59 void SetDebugMode(Int_t d) {fDebug = d;}
60 void SetMatchingScheme(matchingSceme m) {fMatchingScheme = m;}
61 void SetMatchConstituents(Bool_t m) {fMatchConstituents = m;}
62 void SetMinFracRecoveredConstituents(Float_t f) {fMinFracRecoveredConstituents = f;}
63 void SetMinFracRecoveredConstituentPt(Float_t f) {fMinFracRecoveredConstituentPt = f;}
64 void SetUseEmcalBaseJetCuts(Bool_t b) {fUseEmcalBaseJetCuts = b;}
65 void SetGetBijection(Bool_t b) {fGetBijection = b;}
66 void SetSourceBKG(sourceBKG b) {fSourceBKG = b;}
67 void SetTargetBKG(targetBKG b) {fTargetBKG = b;}
68 void SetSourceJetsName(const char* n) {fSourceJetsName = n;}
69 void SetTargetJetsName(const char* n) {fTargetJetsName = n; }
70 void SetMatchedJetsName(const char* n) {fMatchedJetsName = n;}
71 void SetSourceLocalRhoName(const char* n) {fSourceRhoName = n;}
72 void SetTargetLocalRhoName(const char* n) {fTargetRhoName = n;}
73 void SetSourceRadius(Float_t r) {fSourceRadius = r;}
74 void SetTargetRadius(Float_t r) {fTargetRadius = r;}
75 void SetMatchEta(Float_t f) {fMatchEta = f;}
76 void SetMatchPhi(Float_t f) {fMatchPhi = f;}
77 void SetMatchR(Float_t f) {fMatchR = f;}
78 void SetDoDetectorResponse(Bool_t d) {fDoDetectorResponse = d;}
80 void DoGeometricMatchingEtaPhi();
81 void DoGeometricMatchingR();
82 void DoDiJetMatching();
83 void DoConstituentMatching();
85 void PostMatchedJets();
87 void FillAnalysisSummaryHistogram() const;
88 void FillMatchedJetHistograms();
89 // setters - analysis details
90 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
91 return (!track || TMath::Abs(track->Eta()) > 0.9 || track->Phi() < 0 || track->Phi() > TMath::TwoPi()) ? kFALSE : kTRUE; }
92 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet, Int_t c) { if(!fUseEmcalBaseJetCuts) return (jet) ? kTRUE : kFALSE;
93 else return AcceptJet(jet, c);}
94 /* inline */ void ClearMatchedJetsCache() {
95 for (Int_t i(0); i < fNoMatchedJets; i++) {
96 fMatchedJetContainer[i][0] = 0x0; fMatchedJetContainer[i][1] = 0x0; }
99 AliEmcalJet* GetLeadingJet(TClonesArray* source, Int_t &leadingJetIndex, Double_t etaMin = -.7, Double_t etaMax = .7);
100 AliEmcalJet* GetSubLeadingJet(TClonesArray* source, Int_t leadingJetIndex, Int_t &subLeadingJetIndex);
101 void PrintInfo() const;
102 virtual void Terminate(Option_t* option);
105 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
106 TClonesArray* fSourceJets; //! array with source jets
107 TString fSourceJetsName; // name of array with source jets
108 TClonesArray* fTargetJets; //! array with target jets
109 TString fTargetJetsName; // name of array with target jets
110 TClonesArray* fMatchedJets; //! final list of matched jets which is added to event
111 TString fMatchedJetsName; // name of list of matched jets
112 AliLocalRhoParameter* fSourceRho; //! source rho
113 TString fSourceRhoName; // source rho name
114 AliLocalRhoParameter* fTargetRho; //! target rho
115 TString fTargetRhoName; // target rho name
116 Bool_t fUseScaledRho; // use scaled rho
117 Float_t fSourceRadius; // source radius
118 Float_t fTargetRadius; // target radius
119 matchingSceme fMatchingScheme; // select your favorite matching algorithm
120 Bool_t fUseEmcalBaseJetCuts; // use the emcal jet base class for jet cuts
121 sourceBKG fSourceBKG; // subtracted background of source jets
122 targetBKG fTargetBKG; // subtracted background of target jets
123 // transient object pointers
124 TList* fOutputList; //! output list
125 TH1F* fHistUnsortedCorrelation; //! dphi correlation of unsorted jets
126 TH1F* fHistMatchedCorrelation; //! dphi correlation of matched jets
127 TH1F* fHistSourceJetPt; //! pt of source jets
128 TH1F* fHistMatchedSourceJetPt;//! pt of matched source jets
129 TH1F* fHistTargetJetPt; //! pt of target jets
130 TH1F* fHistMatchedJetPt; //! pt of matched jets
131 TH2F* fHistSourceMatchedJetPt;//! pt or source vs matched jets
132 TH2F* fHistDetectorResponseProb; //! det prob
133 TH1F* fHistNoConstSourceJet; //! number of constituents of source jet
134 TH1F* fHistNoConstTargetJet; //! number of constituents of target jet
135 TH1F* fHistNoConstMatchJet; //! number of constituents of matched jets
136 TProfile* fProfFracPtMatched; //! sum pt fraction for matched tracks / jet
137 TProfile* fProfFracPtJets; //! sum pt fraction for matched jets
138 TProfile* fProfFracNoMatched; //! no of constituents fraction found / jet
139 TProfile* fProfFracNoJets; //! no of consstituents fraction jet / jet
140 TH2F* fHistDiJet; //! matched dijet eta, phi
141 TH2F* fHistDiJetLeadingJet; //! leading jet (for dijet) eta, phi
142 TH1F* fHistDiJetDPhi; //! dijet dphi
143 TH1F* fHistDiJetDPt; //! dijet dpt
144 TH1F* fHistAnalysisSummary; //! flags
145 TProfile* fProfQAMatched; //! QA spreads of matched jets
146 TProfile* fProfQA; //! QA spreads of source and target jets
147 Int_t fNoMatchedJets; //! number of matched jets
148 AliEmcalJet* fMatchedJetContainer[200][2]; //! pointers to matched jets
149 // geometric matching parameters
150 Float_t fMatchEta; // max eta distance between centers of matched jets
151 Float_t fMatchPhi; // max phi distance between centers of matched jets
152 Float_t fMatchR; // max distance between matched jets
153 Bool_t fDoDetectorResponse; // get detector response matrix (not normalized)
154 Bool_t fMatchConstituents; // match constituents
155 Float_t fMinFracRecoveredConstituents; // minimium fraction of constituents that needs to be found
156 Float_t fMinFracRecoveredConstituentPt; // minimium fraction of constituent pt that needs to be recovered
157 Bool_t fGetBijection; // get bijection of source and matched jets
158 // pythia ntrials xsec bookkeeping
159 TH1F* fh1Trials; //! sum of trails (in Notify)
160 TH1F* fh1AvgTrials; //! average sum of trials (in Run)
161 TProfile* fh1Xsec; //! pythia cross section and trials
162 Float_t fAvgTrials; // average number of trails per event
164 AliAnalysisTaskJetMatching(const AliAnalysisTaskJetMatching&); // not implemented
165 AliAnalysisTaskJetMatching& operator=(const AliAnalysisTaskJetMatching&); // not implemented
167 ClassDef(AliAnalysisTaskJetMatching, 6);