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, kGeoEtaPhiArea, kGeoRArea, kDeepMatching};
24 enum duplicateRecovery {kDoNothing, kTraceDuplicates, kRemoveDuplicates};
25 enum sourceBKG {kNoSourceBKG, kSourceRho, kSourceLocalRho};
26 enum targetBKG {kNoTargetBKG, kTargetRho, kTargetLocalRho};
27 // constructors, destructor
28 AliAnalysisTaskJetMatching();
29 AliAnalysisTaskJetMatching(const char *name);
30 virtual ~AliAnalysisTaskJetMatching();
31 // setting up the task and technical aspects
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 // printf("dEta %.2f \t dPhi %.2f \n", a->Eta()-b->Eta(), a->Phi()-b->Phi());
51 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; }
53 // setters - setup how to run
54 void SetDebugMode(Int_t d) {fDebug = d;}
55 void SetMatchingScheme(matchingSceme m) {fMatchingScheme = m;}
56 void SetDuplicateRecoveryScheme(duplicateRecovery d) {fDuplicateJetRecoveryMode = d;}
57 void SetSourceBKG(sourceBKG b) {fSourceBKG = b;}
58 void SetTargetBKG(targetBKG b) {fTargetBKG = b;}
59 void SetSourceJetsName(const char* n) {fSourceJetsName = n;}
60 void SetTargetJetsName(const char* n) {fTargetJetsName = n; }
61 void SetMatchedJetsName(const char* n) {fMatchedJetsName = n;}
62 void SetMatchEta(Float_t f) {fMatchEta = f;}
63 void SetMatchPhi(Float_t f) {fMatchPhi = f;}
64 void SetMatchR(Float_t f) {fMatchR = f;}
65 void SetMatchRelArea(Float_t f) {fMatchArea = f;}
66 void SetMaxRelEnergyDiff(Float_t f) {fMaxRelEnergyDiff = f;}
67 void SetMaxAbsEnergyDiff(Float_t f) {fMaxAbsEnergyDiff = f;}
69 void DoGeometricMatchingEtaPhi(Bool_t pairCuts = kFALSE);
70 void DoGeometricMatchingR(Bool_t pairCuts = kFALSE);
71 void DoDeepMatching();
72 void DuplicateJetRecovery();
73 void PostMatchedJets();
75 void FillAnalysisSummaryHistogram() const;
76 void FillMatchedJetHistograms() const;
77 // setters - analysis details
78 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
79 if(!track) return kFALSE;
80 return (track->Pt() < fTrackPtCut || track->Eta() < fTrackMinEta || track->Eta() > fTrackMaxEta || track->Phi() < fTrackMinPhi || track->Phi() > fTrackMaxPhi) ? kFALSE : kTRUE; }
81 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet) const {
82 return (jet) ? kTRUE : kFALSE; }
83 /* inline */ Bool_t PassesCuts(AliEmcalJet* a, AliEmcalJet* b) const {
84 if (fMatchArea > 0) { return (TMath::Abs(a->Area()/b->Area()) < fMatchArea) ? kTRUE : kFALSE; }
85 if (fMaxRelEnergyDiff > 0) { return (TMath::Abs(a->E()/b->E()) > fMaxRelEnergyDiff) ? kTRUE : kFALSE; }
86 if (fMaxAbsEnergyDiff > 0) { return (TMath::Abs(a->E()-b->E()) > fMaxAbsEnergyDiff) ? kTRUE : kFALSE; }
88 /* inline */ void ClearMatchedJetsCache() {
89 for (Int_t i(0); i < fNoMatchedJets; i++) {
90 fMatchedJetContainer[i][0] = 0x0; fMatchedJetContainer[i][1] = 0x0; }
93 void PrintInfo() const;
94 virtual void Terminate(Option_t* option);
97 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
98 TClonesArray* fSourceJets; //! array with source jets
99 TString fSourceJetsName; // name of array with source jets
100 TClonesArray* fTargetJets; //! array with target jets
101 TString fTargetJetsName; // name of array with target jets
102 TClonesArray* fMatchedJets; //! final list of matched jets which is added to event
103 TString fMatchedJetsName; // name of list of matched jets
104 Bool_t fUseScaledRho; // use scaled rho
105 matchingSceme fMatchingScheme; // select your favorite matching algorithm
106 duplicateRecovery fDuplicateJetRecoveryMode; // what to do with duplicate matches
107 sourceBKG fSourceBKG; // subtracted background of source jets
108 targetBKG fTargetBKG; // subtracted background of target jets
109 // additional jet cuts (most are inherited)
110 Float_t fLocalJetMinEta; // local eta cut for jets
111 Float_t fLocalJetMaxEta; // local eta cut for jets
112 Float_t fLocalJetMinPhi; // local phi cut for jets
113 Float_t fLocalJetMaxPhi; // local phi cut for jets
114 // transient object pointers
115 TList* fOutputList; //! output list
116 TH1F* fHistUnsortedCorrelation; //! dphi correlation of unsorted jets
117 TH1F* fHistMatchedCorrelation; //! dphi correlation of matched jets
118 TH1F* fHistSourceJetPt; //! pt of source jets
119 TH1F* fHistTargetJetPt; //! pt of target jets
120 TH1F* fHistMatchedJetPt; //! pt of matched jets
121 TH1F* fHistNoConstSourceJet; //! number of constituents of source jet
122 TH1F* fHistNoConstTargetJet; //! number of constituents of target jet
123 TH1F* fHistNoConstMatchJet; //! number of constituents of matched jets
124 TH1F* fHistAnalysisSummary; //! flags
125 TProfile* fProfQAMatched; //! QA spreads of matched jets
126 TProfile* fProfQA; //! QA spreads of source and target jets
127 Int_t fNoMatchedJets; //! number of matched jets
128 AliEmcalJet* fMatchedJetContainer[100][2]; //! pointers to matched jets
129 // geometric matching parameters
130 Float_t fMatchEta; // max eta distance between centers of matched jets
131 Float_t fMatchPhi; // max phi distance between centers of matched jets
132 Float_t fMatchR; // max distance between matched jets
133 Float_t fMatchArea; // max relative area mismatch between matched jets
134 Float_t fMaxRelEnergyDiff; // max relative energy difference between matched jets
135 Float_t fMaxAbsEnergyDiff; // max absolute energy difference between matched jets
137 AliAnalysisTaskJetMatching(const AliAnalysisTaskJetMatching&); // not implemented
138 AliAnalysisTaskJetMatching& operator=(const AliAnalysisTaskJetMatching&); // not implemented
140 ClassDef(AliAnalysisTaskJetMatching, 1);