1 #ifndef ALIANALYSISTASKJETSHAPE_h
2 #define ALIANALYSISTASKJETSHAPE_h
4 #include "AliAnalysisTaskSE.h"
6 //#include "AliTriggerAnalysis.h"
7 //#include "THnSparse.h"
11 #include "TClonesArray.h"
17 class AliAODExtension;
31 class AliAnalysisTaskJetShape : public AliAnalysisTaskSE {
36 class AliAnalysisTaskJetShapeTool :public TObject {
38 AliAnalysisTaskJetShapeTool();
39 //AnalJetSubStrTool(TList *list, TVector3 v);
40 AliAnalysisTaskJetShapeTool(TClonesArray *list);
41 ~AliAnalysisTaskJetShapeTool();
44 void SetVecJ(TVector3 v);
45 void SetPtMinTr(Double_t a, Double_t b) {fPtMinTr[0] = a; fPtMinTr[1] = b;}
47 void SetNEntries(Int_t n) {fEntries = n;}
49 TArrayI GetListJ(Int_t b, Int_t i) {return fListJ[b][i];}
50 TArrayI GetListB1(Int_t b, Int_t i) {return fListB1[b][i];}
51 TArrayI GetListB2(Int_t b, Int_t i) {return fListB2[b][i];}
53 Int_t GetSizeJ(Int_t b, Int_t i) {return fListJc[b][i];}
54 Int_t GetSizeB1(Int_t b, Int_t i) {return fListB1c[b][i];}
55 Int_t GetSizeB2(Int_t b, Int_t i) {return fListB2c[b][i];}
57 TVector3 *GetJ(Int_t b,Int_t i, Int_t p)
58 { return (TVector3*)GetAt(fListJ[b][i].At(p)); }
59 TVector3 *GetB1(Int_t b,Int_t i, Int_t p)
60 { return (TVector3*)GetAt(fListB1[b][i].At(p)); }
61 TVector3 *GetB2(Int_t b,Int_t i, Int_t p)
62 { return (TVector3*)GetAt(fListB2[b][i].At(p)); }
64 TVector3 GetVecJ() {return fvecJ;}
65 TVector3 GetVecB1() {return fvecB1;}
66 TVector3 GetVecB2() {return fvecB2;}
68 Double_t GetR(Int_t b) {return fR[b];}
70 TVector3 *GetAt(Int_t i)
72 if(i<0 || i>= fEntries) printf(" TVector3 *GetAt(Int_t i) for i= %d\n",i);
73 return (TVector3*) fList->At(i);
76 Double_t GetLocPhi(TVector3 v, Int_t i)
78 TVector3 p(*GetAt(i));
79 // GetLocalMom(v, &vtmp);
80 // return CalcdPhi0To2pi(vtmp.Phi());
82 Double_t phi = TMath::ATan2(p.Eta() - v.Eta(), CalcdPhi(p.Phi(), v.Phi()) );
84 return CalcdPhi0To2pi(phi);
88 Double_t GetLocPhiJ(Int_t b, Int_t i, Int_t index)
90 TVector3 v1(*GetAt(fListJ[b][i].At(index)));
91 Double_t phi = TMath::ATan2(v1.Eta() - fvecJ.Eta(), CalcdPhi(v1.Phi(), fvecJ.Phi()) );
92 return CalcdPhi0To2pi(phi);
96 Double_t GetLocPhiB1(Int_t b, Int_t i, Int_t index)
98 TVector3 v0(*GetAt(fListB1[b][i].At(index)));
99 Double_t cV = (fvecB1(0)*fvecJ(0) + fvecB1(1)*fvecJ(1))/fvecJ.Perp2();
100 Double_t sV = (fvecB1(1)*fvecJ(0) - fvecB1(0)*fvecJ(1))/fvecJ.Perp2();
101 TVector3 v1(v0(0)*cV+v0(1)*sV, v0(1)*cV-v0(0)*sV, v0(2));
102 // GetLocalMom(fvecJ, &v1);
103 // return CalcdPhi0To2pi(v1.Phi());
105 Double_t phi = TMath::ATan2(v1.Eta() - fvecJ.Eta(), CalcdPhi(v1.Phi(), fvecJ.Phi()) );
106 return CalcdPhi0To2pi(phi);
109 Double_t GetLocPhiB2(Int_t b, Int_t i, Int_t index)
111 TVector3 v0(*GetAt(fListB2[b][i].At(index)));
112 Double_t cV = (fvecB2(0)*fvecJ(0) + fvecB2(1)*fvecJ(1))/fvecJ.Perp2();
113 Double_t sV = (fvecB2(1)*fvecJ(0) - fvecB2(0)*fvecJ(1))/fvecJ.Perp2();
114 TVector3 v1(v0(0)*cV+v0(1)*sV, v0(1)*cV-v0(0)*sV, v0(2));
115 // GetLocalMom(fvecJ, &v1);
116 // return CalcdPhi0To2pi(v1.Phi());
117 Double_t phi = TMath::ATan2(v1.Eta() - fvecJ.Eta(), CalcdPhi(v1.Phi(), fvecJ.Phi()) );
118 return CalcdPhi0To2pi(phi);
124 // { new(fList[fList.GetEntriesFast()]) TVector3(v);}
125 { new((*fList)[fEntries]) TVector3(v); fEntries++;}
127 void AddToJ(Int_t b, Int_t i, Int_t index) {
128 fListJ[b][i].AddAt(index, fListJc[b][i]);
132 void AddToB1(Int_t b, Int_t i, Int_t index) {
133 fListB1[b][i].AddAt(index, fListB1c[b][i]);
137 void AddToB2(Int_t b, Int_t i, Int_t index) {
138 fListB2[b][i].AddAt(index, fListB2c[b][i]);
145 TVector3 GetPRecJ(Int_t b, Int_t i) {return fPRecJ[b][i];}
146 TVector3 GetPRecInRJ() {return fPRecInRJ;}//
150 // Bool_t FindCorrelationAxesAnd(TArrayI list, TVector3 vec, Double_t &Phi, Int_t scenario=0);
151 Bool_t FindCorrelationAxes(TArrayI list, TVector3 vec, Double_t &Phi, Int_t scenario=3);
152 Bool_t FindCorrelationAxesCorr(TArrayI list, TVector3 vec, Double_t &Phi, Int_t scenario, Double_t R);
154 // virtual void Print(Option_t* /*option = ""*/) const;
156 void PRINT(TArrayI a, Int_t n, const char *txt="") const;
160 static Double_t CalcdPhi0To2pi(Double_t phi1, Double_t phi2=0.)
162 Double_t dphi = CalcdPhi(phi1, phi2);
163 while(dphi<0) dphi+=TMath::TwoPi();
164 while(dphi>TMath::TwoPi()) dphi-=TMath::TwoPi();
168 static Double_t CalcdPhi(Double_t phi1, Double_t phi2);
170 static Double_t CalcdPhiSigned(Double_t phi1, Double_t phi2)
173 Double_t dphi = CalcdPhi(phi1, phi2);
174 if(dphi < TMath::Pi()) return dphi;
175 else return (dphi- TMath::Pi());
190 static const Int_t fgkbinR= 3; // n bins
191 Double_t fR[fgkbinR];
192 TArrayI fListJ[fgkbinR][2]; //
193 TArrayI fListB1[fgkbinR][2];//
194 TArrayI fListB2[fgkbinR][2];//
196 Int_t fListJc[fgkbinR][2]; //
197 Int_t fListB1c[fgkbinR][2];//
198 Int_t fListB2c[fgkbinR][2];//
200 TVector3 fPRecJ[fgkbinR][2];//
201 TVector3 fPRecInRJ;//
203 Double_t fPtMinTr[2];
206 TClonesArray *fList; //!
210 Double_t CalcR(TVector3 v1, TVector3 v2);
211 void GetLocalMom(TVector3 vecJ, TVector3 *q);
214 AliAnalysisTaskJetShapeTool(const AliAnalysisTaskJetShapeTool&); // not implemented
215 AliAnalysisTaskJetShapeTool& operator=(const AliAnalysisTaskJetShapeTool&); // not implemented
217 ClassDef(AliAnalysisTaskJetShapeTool, 1) // tbd
224 class AliAnalysisTaskJetShapeHM :public TObject {
227 AliAnalysisTaskJetShapeHM(TString comment = "", Bool_t kMC = kFALSE);
228 ~AliAnalysisTaskJetShapeHM();
231 void SetPtJetBins(Int_t Nbin=-1, Double_t *array = 0);
232 void SetRBins( Int_t Nbin = 8, Double_t Rmax = 0.4) {fPsiVsRNbin = Nbin; fRmax = Rmax;}
233 void SetPhiNbins(Int_t Nbin = 1024) {fPsiVsPhiNbin = Nbin;}
234 void SetFilterMask(UInt_t i = 0){fFilterMask = i;}
235 void SetEtaTrackMax(Double_t e =0.9) {fEtaTrackMax = e;}
236 void SetPtTrackRange(Double_t min = 1., Double_t max = 100.) {fPtTrackMin = min; fPtTrackMax = max;}
237 void SetPtJetRange(Double_t min = 1., Double_t max = 200. ) {fPtJmin =min; fPtJmax = max; }
239 void MCprod(Bool_t kMCprod=kTRUE) {fkMCprod=kMCprod; }
242 Double_t GetPtJ() {return fPtJ;}
244 Bool_t AddEvent(AliAODEvent* aodE, AliAODJet *jet, Double_t DeltaPtJ=0.);
245 void AddToList(TList *list);
255 TH2F *fhPtJvsPtCorr;//!
257 TH2F *fhPsiVsRPtJ;//!
258 TH2F *fhPhiEtaTrack;//!
260 TH3F *fhPsiVsR_MCtr; //!
261 TH2F *fhPsiVsRPtJ_MCtr; //!
262 TH2F *fhJetTrPtVsPartPt;//!
265 TH1F *fhTMA_JAA[3];//!
266 TH1F *fhTMA_JAp[3];//!
267 TH1F *fhTMA_B1AA[3];//!
268 TH1F *fhTMA_B1Ap[3];//!
269 TH1F *fhTMA_B2AA[3];//!
270 TH1F *fhTMA_B2Ap[3];//!
272 TH2F *fhPtresVsPt[3][2] ;//!
273 TH2F *fhPhiresVsPhi[3][2];//!
274 TH2F *fhEtaresVsEta[3][2];//!
275 TH2F *fhRresVsPt[3][2];//!
276 TH2F *fhDCAxy[3][2]; //!
277 TH2F *fhDCAz[3][2]; //!
278 TH3F *fhTrackPtEtaPhi[3][2];//!
287 Double_t fEtaTrackMax;
288 Double_t fPtTrackMin;
289 Double_t fPtTrackMax;
297 Double_t CalcR(TVector3 v1, TVector3 v2);
298 Double_t CalcdPhi(Double_t phi1, Double_t phi2);
300 TH1F* Hist1D(const char* name, Int_t nBins, Double_t xMin, Double_t xMax, const char* xLabel = "", Int_t color=1, const char* yLabel="");
301 TH1F* Hist1D(const char* name, Int_t nBins, Double_t *xArray, const char* xLabel = "", Int_t color=1, const char* yLabel="");
302 TH2F *Hist2D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, const char* xLabel = NULL, const char* yLabel = NULL, Int_t color=1);
303 TH2F *Hist2D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t *yArray, const char* xLabel = NULL, const char* yLabel = NULL, Int_t color=1, const char* zLabel = NULL);
304 TH2F *Hist2D(const char* name, Int_t nBinsx, Double_t *yArrax, Int_t nBinsy, Double_t yMin, Double_t yMax, const char* xLabel = NULL, const char* yLabel = NULL, Int_t color=1, const char* zLabel = NULL);
305 TH3F *Hist3D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, Int_t nBinsz, Double_t zMin, Double_t zMax, const char* xLabel = NULL, const char* yLabel = NULL, const char* zLabel = NULL, Int_t color=1);
306 TH3F *Hist3D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, Int_t nBinsz, Double_t *z, const char* xLabel = NULL, const char* yLabel = NULL, const char* zLabel = NULL, Int_t color=1);
309 AliAnalysisTaskJetShapeHM(const AliAnalysisTaskJetShapeHM&); // not implemented
310 AliAnalysisTaskJetShapeHM& operator=(const AliAnalysisTaskJetShapeHM&); // not implemented
313 ClassDef(AliAnalysisTaskJetShapeHM,1) // tbd
319 AliAnalysisTaskJetShape(const char *name = "");
320 ~AliAnalysisTaskJetShape();
322 virtual void SetIsMC(Bool_t ismc=kTRUE) {fkMC=ismc;}
323 virtual void SetCMSE(Double_t s = 7000.) {fCMSE=s;}
326 virtual void SetNonStdFile(TString c){fNonStdFile = c;}
327 virtual void SetBranchNames(const TString &branch1, const TString &branch2);
328 virtual void SetBackgroundBranch(TString &branch1, TString &branch2) { fBackgroundBranch[0] = branch1; fBackgroundBranch[1] = branch2;};
330 virtual void SetFilterMask(UInt_t i){fFilterMask = i;}
331 virtual void SetOfflineTrgMask(AliVEvent::EOfflineTriggerTypes mask) { fOfflineTrgMask = mask; }
332 virtual void SetCentMin(Float_t cent) { fCentMin = cent; }
333 virtual void SetCentMax(Float_t cent) { fCentMax = cent; }
334 virtual void SetEvtClassMin(Int_t evtClass) { fEvtClassMin = evtClass; }
335 virtual void SetEvtClassMax(Int_t evtClass) { fEvtClassMax = evtClass; }
336 virtual void SetJetPtCorrMin(Float_t ptJ=20, Float_t ptB=20) { fPtJcorrMin = ptJ; fPtJBcorrMin = ptB;}
338 virtual void SetPbPb(Bool_t a = kTRUE) {fkIsPbPb = a;}
340 virtual void SetVtxZRange(Double_t zmin=-10., Double_t zmax=10.) {fVtxZMin = zmin; fVtxZMax = zmax;}
341 virtual void SetVixMinContrib(Int_t n=1) { fVtxMinContrib = n; }
343 // virtual void SetAngStructCloseTracks(Int_t yesno){fAngStructCloseTracks=yesno;}
346 // virtual void ConnectInputData(Option_t *);
347 virtual void UserCreateOutputObjects();
348 virtual void UserExec(Option_t *option);
349 virtual void Terminate(Option_t *);
355 // TTree *fOutputTree; //!Output tree
357 TList *fOutputList; // Output list
358 AliESDEvent *fESD; // ESD object
359 AliAODEvent *fAODIn; // AOD event
360 AliAODEvent *fAODOut; // AOD event
361 AliAODExtension *fAODExtension; //! where we take the jets from can be input or output AOD
364 // AliTriggerAnalysis * fTriggerAnalysis; // trigger analysis object, to get the offline triggers
368 Double_t fCMSE; //cms energy
369 UInt_t fRunNb; //run number
370 Bool_t fkIsPhysSel; //tbd
371 TString fNonStdFile; // delta AOD file
372 UInt_t fFilterMask; // filter bit for slecected tracks
373 AliVEvent::EOfflineTriggerTypes fOfflineTrgMask; // mask of offline triggers to accept
374 Float_t fCentMin; // lower bound on centrality
375 Float_t fCentMax; // upper bound on centrality
376 Int_t fEvtClassMin; // lower bound on event class
377 Int_t fEvtClassMax; // upper bound on event class
378 Double_t fPtJcorrMin ;
379 Double_t fPtJBcorrMin;
382 Int_t fVtxMinContrib;
388 TString fBackgroundBranch[2]; //tbd
389 TString fJetBranchName[2]; // name of jet branches to compare
392 static const Int_t fgkbinNCent=7; // tbd
393 Double_t fgkbinCent[fgkbinNCent+1] ;// {0, 5, 10, 20, 40, 60, 80, 100};
398 // TClonesArray farray;
399 AliAnalysisTaskJetShapeHM *fanalJetSubStrHM;//!
400 AliAnalysisTaskJetShapeHM *fanalJetSubStrMCHM;//!
402 TH2F *fhPtresVsPt[3] ;//!
403 TH2F *fhPhiresVsPhi[3];//!
404 TH2F *fhEtaresVsEta[3];//!
405 TH2F *fhDCAxy[3]; //!
407 TH3F *fhTrackPtEtaPhi[3];//!
409 Bool_t IsGoodEvent();
412 Double_t CalcdPhi(Double_t phi1, Double_t phi2);
413 Double_t CalcdPhi0To2pi(Double_t phi1, Double_t phi2);
415 TH1F *Hist1D(const char* name, Int_t nBins , Double_t xMin, Double_t xMax, const char* xLabel = NULL, Int_t color=1);
416 TH2F *Hist2D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, const char* xLabel = NULL, const char* yLabel = NULL, Int_t color=1);
417 TH3F *Hist3D(const char* name, Int_t nBinsx, Double_t xMin, Double_t xMax, Int_t nBinsy, Double_t yMin, Double_t yMax, Int_t nBinsz, Double_t zMin, Double_t zMax, const char* xLabel = NULL, const char* yLabel = NULL, const char* zLabel = NULL, Int_t color=1);
420 // AliAnalysisTaskJetShape(const AnalysisJetMain&); // not implemented
421 // AliAnalysisTaskJetShape& operator=(const AnalysisJetMain&); // not implemented
425 AliAnalysisTaskJetShape(const AliAnalysisTaskJetShape&); // not implemented
426 AliAnalysisTaskJetShape& operator=(const AliAnalysisTaskJetShape&); // not implemented
429 ClassDef(AliAnalysisTaskJetShape, 1)