]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskJetMatching.h
- Add THnSparse for correlation of different trigger bits - Change request in SelectC...
[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();
7ec64e26 32 virtual Bool_t Notify();
f1354962 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);
36 virtual Bool_t Run();
37 /* inline */ Double_t PhaseShift(Double_t x) const {
38 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
39 while (x<0.)x+=TMath::TwoPi();
40 return x; }
41 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
42 x = PhaseShift(x);
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);
47 }
48 return x; }
49 /* inline */ Bool_t CompareTracks(AliVParticle* a, AliVParticle* b) const {
f1354962 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; }
f6d1b1a7 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))); }
f1354962 57
58 // setters - setup how to run
59 void SetDebugMode(Int_t d) {fDebug = d;}
60 void SetMatchingScheme(matchingSceme m) {fMatchingScheme = m;}
f6d1b1a7 61 void SetMatchConstituents(Bool_t m) {fMatchConstituents = m;}
62 void SetMinFracRecoveredConstituents(Float_t f) {fMinFracRecoveredConstituents = f;}
285db795 63 void SetMinFracRecoveredConstituentPt(Float_t f) {fMinFracRecoveredConstituentPt = f;}
0aaf31ab 64 void SetUseEmcalBaseJetCuts(Bool_t b) {fUseEmcalBaseJetCuts = b;}
285db795 65 void SetGetBijection(Bool_t b) {fGetBijection = b;}
f1354962 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;}
f6d1b1a7 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;}
f1354962 75 void SetMatchEta(Float_t f) {fMatchEta = f;}
76 void SetMatchPhi(Float_t f) {fMatchPhi = f;}
77 void SetMatchR(Float_t f) {fMatchR = f;}
c2460f8a 78 void SetDoDetectorResponse(Bool_t d) {fDoDetectorResponse = d;}
f1354962 79 // methods
285db795 80 void DoGeometricMatchingEtaPhi();
81 void DoGeometricMatchingR();
82 void DoConstituentMatching();
83 void GetBijection();
f1354962 84 void PostMatchedJets();
85 // fill histogrmas
86 void FillAnalysisSummaryHistogram() const;
c2460f8a 87 void FillMatchedJetHistograms();
f1354962 88 // setters - analysis details
89 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
e9c2d4f3 90 return (!track || TMath::Abs(track->Eta()) > 0.9 || track->Phi() < 0 || track->Phi() > TMath::TwoPi()) ? kFALSE : kTRUE; }
4f6d96b5 91 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet, Int_t c) { if(!fUseEmcalBaseJetCuts) return (jet) ? kTRUE : kFALSE;
92 else return AcceptJet(jet, c);}
f1354962 93 /* inline */ void ClearMatchedJetsCache() {
94 for (Int_t i(0); i < fNoMatchedJets; i++) {
95 fMatchedJetContainer[i][0] = 0x0; fMatchedJetContainer[i][1] = 0x0; }
96 fNoMatchedJets = 0;
97 }
98 void PrintInfo() const;
99 virtual void Terminate(Option_t* option);
100
101 private:
102 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
103 TClonesArray* fSourceJets; //! array with source jets
104 TString fSourceJetsName; // name of array with source jets
105 TClonesArray* fTargetJets; //! array with target jets
106 TString fTargetJetsName; // name of array with target jets
107 TClonesArray* fMatchedJets; //! final list of matched jets which is added to event
108 TString fMatchedJetsName; // name of list of matched jets
f6d1b1a7 109 AliLocalRhoParameter* fSourceRho; //! source rho
110 TString fSourceRhoName; // source rho name
111 AliLocalRhoParameter* fTargetRho; //! target rho
112 TString fTargetRhoName; // target rho name
f1354962 113 Bool_t fUseScaledRho; // use scaled rho
f6d1b1a7 114 Float_t fSourceRadius; // source radius
115 Float_t fTargetRadius; // target radius
f1354962 116 matchingSceme fMatchingScheme; // select your favorite matching algorithm
0aaf31ab 117 Bool_t fUseEmcalBaseJetCuts; // use the emcal jet base class for jet cuts
f1354962 118 sourceBKG fSourceBKG; // subtracted background of source jets
119 targetBKG fTargetBKG; // subtracted background of target jets
f1354962 120 // transient object pointers
121 TList* fOutputList; //! output list
122 TH1F* fHistUnsortedCorrelation; //! dphi correlation of unsorted jets
123 TH1F* fHistMatchedCorrelation; //! dphi correlation of matched jets
124 TH1F* fHistSourceJetPt; //! pt of source jets
2e3ee924 125 TH1F* fHistMatchedSourceJetPt;//! pt of matched source jets
f1354962 126 TH1F* fHistTargetJetPt; //! pt of target jets
127 TH1F* fHistMatchedJetPt; //! pt of matched jets
c2460f8a 128 TH2F* fHistSourceMatchedJetPt;//! pt or source vs matched jets
7ec64e26 129 TH2F* fHistDetectorResponseProb; //! det prob
f1354962 130 TH1F* fHistNoConstSourceJet; //! number of constituents of source jet
131 TH1F* fHistNoConstTargetJet; //! number of constituents of target jet
132 TH1F* fHistNoConstMatchJet; //! number of constituents of matched jets
0aaf31ab 133 TProfile* fProfFracPtMatched; //! sum pt fraction for matched tracks / jet
134 TProfile* fProfFracPtJets; //! sum pt fraction for matched jets
135 TProfile* fProfFracNoMatched; //! no of constituents fraction found / jet
136 TProfile* fProfFracNoJets; //! no of consstituents fraction jet / jet
f1354962 137 TH1F* fHistAnalysisSummary; //! flags
138 TProfile* fProfQAMatched; //! QA spreads of matched jets
139 TProfile* fProfQA; //! QA spreads of source and target jets
140 Int_t fNoMatchedJets; //! number of matched jets
c2460f8a 141 AliEmcalJet* fMatchedJetContainer[200][2]; //! pointers to matched jets
f1354962 142 // geometric matching parameters
143 Float_t fMatchEta; // max eta distance between centers of matched jets
144 Float_t fMatchPhi; // max phi distance between centers of matched jets
145 Float_t fMatchR; // max distance between matched jets
c2460f8a 146 Bool_t fDoDetectorResponse; // get detector response matrix (not normalized)
f6d1b1a7 147 Bool_t fMatchConstituents; // match constituents
148 Float_t fMinFracRecoveredConstituents; // minimium fraction of constituents that needs to be found
285db795 149 Float_t fMinFracRecoveredConstituentPt; // minimium fraction of constituent pt that needs to be recovered
150 Bool_t fGetBijection; // get bijection of source and matched jets
7ec64e26 151 // pythia ntrials xsec bookkeeping
152 TH1F* fh1Trials; //! sum of trails (in Notify)
153 TH1F* fh1AvgTrials; //! average sum of trials (in Run)
154 TProfile* fh1Xsec; //! pythia cross section and trials
155 Float_t fAvgTrials; // average number of trails per event
f1354962 156
157 AliAnalysisTaskJetMatching(const AliAnalysisTaskJetMatching&); // not implemented
158 AliAnalysisTaskJetMatching& operator=(const AliAnalysisTaskJetMatching&); // not implemented
159
7ec64e26 160 ClassDef(AliAnalysisTaskJetMatching, 6);
f1354962 161};
162
163#endif