6 #include <TClonesArray.h>
10 #include <THnSparse.h>
13 #include <TLorentzVector.h>
19 #include <AliAnalysisDataSlot.h>
20 #include <AliAnalysisDataContainer.h>
22 #include "TMatrixDSym.h"
23 #include "TMatrixDSymEigen.h"
26 #include "AliVCluster.h"
27 #include "AliVTrack.h"
32 #include "AliMCEvent.h"
33 #include "AliGenPythiaEventHeader.h"
34 #include "AliAODMCHeader.h"
35 #include "AliMCEvent.h"
36 #include "AliAnalysisManager.h"
44 #include "AliAODEvent.h"
56 fMinFractionShared(0),
59 fJetSelection(kInclusive),
65 fangWindowRecoil(0.6),
72 fOneConstSelectOn(kFALSE),
86 fTreeObservableTagging(0)
89 for(Int_t i=0;i<14;i++){
91 SetMakeGeneralHistograms(kTRUE);
92 DefineOutput(1, TList::Class());
93 DefineOutput(2, TTree::Class());
100 fMinFractionShared(0),
101 fJetShapeType(
kData),
102 fJetShapeSub(kNoSub),
103 fJetSelection(kInclusive),
104 fPtThreshold(-9999.),
109 fangWindowRecoil(0.6),
113 fCentSelectOn(kTRUE),
116 fOneConstSelectOn(kFALSE),
130 fTreeObservableTagging(0)
134 for(Int_t i=0;i<14;i++){
138 DefineOutput(1, TList::Class());
139 DefineOutput(2, TTree::Class());
155 Bool_t oldStatus = TH1::AddDirectoryStatus();
156 TH1::AddDirectory(kFALSE);
161 fh2ResponseUW=
new TH2F(
"fh2ResponseUW",
"fh2ResponseUW", 100, 0, 200, 100, 0, 200);
163 fh2ResponseW=
new TH2F(
"fh2ResponseW",
"fh2ResponseW", 100, 0, 200, 100, 0, 200);
165 fPhiJetCorr6=
new TH2F(
"fPhiJetCorr6",
"fPhiJetCorr6", 50, 0, 2*TMath::Pi(), 50, 0, 2*TMath::Pi());
167 fEtaJetCorr6=
new TH2F(
"fEtaJetCorr6",
"fEtaJetCorr6", 50, -1.5, 1.5, 50, -1.5, 1.5);
170 fPhiJetCorr7=
new TH2F(
"fPhiJetCorr7",
"fPhiJetCorr7", 50, 0, 2*TMath::Pi(), 50, 0, 2*TMath::Pi());
172 fEtaJetCorr7=
new TH2F(
"fEtaJetCorr7",
"fEtaJetCorr7", 50, -1.5, 1.5, 50, -1.5, 1.5);
175 fPtJetCorr=
new TH2F(
"fPtJetCorr",
"fPtJetCorr", 100, 0, 200, 100, 0, 200);
177 fPtJet=
new TH1F(
"fPtJet",
"fPtJet", 100, 0, 200);
180 fhpTjetpT=
new TH2F(
"fhpTjetpT",
"fhpTjetpT", 200, 0, 200, 200, 0, 200);
182 fhPt=
new TH1F(
"fhPt",
"fhPt", 200, 0, 200);
184 fhPhi=
new TH1F(
"fhPhi",
"fhPhi", 100, -TMath::Pi(), TMath::Pi());
187 fNbOfConstvspT=
new TH2F(
"fNbOfConstvspT",
"fNbOfConstvspT", 100, 0, 100, 200, 0, 200);
191 for (Int_t i=0; i<
fOutput->GetEntries(); ++i) {
192 TH1 *h1 =
dynamic_cast<TH1*
>(
fOutput->At(i));
197 THnSparse *hn =
dynamic_cast<THnSparse*
>(
fOutput->At(i));
201 TH1::AddDirectory(oldStatus);
202 const Int_t
nVar = 14;
203 const char* nameoutput = GetOutputSlot(2)->GetContainer()->GetName();
208 TString *fShapesVarNames =
new TString [
nVar];
210 fShapesVarNames[0] =
"partonCode";
211 fShapesVarNames[1] =
"ptJet";
212 fShapesVarNames[2] =
"ptDJet";
213 fShapesVarNames[3] =
"mJet";
215 fShapesVarNames[4] =
"angularity";
216 fShapesVarNames[5] =
"circularity";
217 fShapesVarNames[6] =
"lesub";
220 fShapesVarNames[7] =
"ptJetMatch";
221 fShapesVarNames[8] =
"ptDJetMatch";
222 fShapesVarNames[9] =
"mJetMatch";
224 fShapesVarNames[10] =
"angularityMatch";
225 fShapesVarNames[11] =
"circularityMatch";
226 fShapesVarNames[12] =
"lesubMatch";
228 fShapesVarNames[13]=
"weightPythia";
230 for(Int_t ivar=0; ivar <
nVar; ivar++){
231 cout<<
"looping over variables"<<endl;
237 delete [] fShapesVarNames;
260 AliAODTrack *triggerHadron = 0x0;
267 if (triggerHadronLabel==-99999) {
273 TClonesArray *trackArrayAn = partContAn->GetArray();
274 triggerHadron =
static_cast<AliAODTrack*
>(trackArrayAn->At(triggerHadronLabel));
276 if (!triggerHadron) {
287 fhPt->Fill(triggerHadron->Pt());
292 jetCont->ResetCurrentID();
299 Int_t ifound=0, jfound=0;
300 Int_t ilab=-1, jlab=-1;
308 Float_t dphiRecoil = 0.;
330 for(Int_t i = 0; i<jetContUS->
GetNJets(); i++) {
331 jetUS = jetContUS->
GetJet(i);
334 if(ifound==1) ilab = i;
337 if(ilab==-1)
continue;
338 jetUS=jetContUS->
GetJet(ilab);
344 Printf(
"jet2 does not exist, returning");
352 Printf(
"jet3 does not exist, returning");
355 cout<<
"jet 3 exists"<<jet3->
Pt()<<endl;
379 for(Int_t i = 0; i<jetContUS->
GetNJets(); i++) {
380 jetUS = jetContUS->
GetJet(i);
383 if(ifound==1) ilab = i;
386 if(ilab==-1)
continue;
387 jetUS=jetContUS->
GetJet(ilab);
391 Printf(
"jet2 does not exist, returning");
395 for(Int_t j=0; j<jetContPart->
GetNJets(); j++) {
397 jet3 = jetContPart->
GetJet(j);
401 if(jfound==1) jlab = j;
404 if(jlab==-1)
continue;
405 jet3=jetContPart->
GetJet(jlab);
407 Printf(
"jet3 does not exist, returning");
413 Printf(
"jet3 does not exist, returning");
432 Float_t dRp1 = TMath::Sqrt(jp1 * jp1 + detap1 * detap1);
442 dRp1 = TMath::Sqrt(jp1 * jp1 + detap1 * detap1);
456 Double_t ptSubtracted = 0;
481 Float_t ptMatch=0., ptDMatch=0., massMatch=0., constMatch=0.,angulMatch=0.,circMatch=0., lesubMatch=0., sigma2Match=0.;
572 AliVParticle *vp1 = 0x0;
577 Printf(
"AliVParticle associated to constituent not found");
582 Double_t dr2 = (vp1->Eta()-jet->
Eta())*(vp1->Eta()-jet->
Eta()) + dphi*dphi;
583 Double_t dr = TMath::Sqrt(dr2);
584 num=num+vp1->Pt()*dr;
610 AliVParticle *vp1 = 0x0;
615 Printf(
"AliVParticle associated to constituent not found");
619 num=num+vp1->Pt()*vp1->Pt();
622 return TMath::Sqrt(num)/den;
632 return PTD(jet, jetContNb);
647 Double_t pxjet=jet->
Px();
648 Double_t pyjet=jet->
Py();
649 Double_t pzjet=jet->
Pz();
653 TVector3 ppJ1(pxjet, pyjet, pzjet);
654 TVector3 ppJ3(- pxjet* pzjet, - pyjet * pzjet, pxjet * pxjet + pyjet * pyjet);
656 TVector3 ppJ2(-pyjet, pxjet, 0);
658 AliVParticle *vp1 = 0x0;
663 Printf(
"AliVParticle associated to constituent not found");
667 TVector3 pp(vp1->Px(), vp1->Py(), vp1->Pz());
670 TVector3 pLong = pp.Dot(ppJ1) / ppJ1.Mag2() * ppJ1;
671 TVector3 pPerp = pp - pLong;
674 Float_t ppjX = pPerp.Dot(ppJ2);
675 Float_t ppjY = pPerp.Dot(ppJ3);
676 Float_t ppjT = TMath::Sqrt(ppjX * ppjX + ppjY * ppjY);
677 if(ppjT<=0)
return 0;
679 mxx += (ppjX * ppjX / ppjT);
680 myy += (ppjY * ppjY / ppjT);
681 mxy += (ppjX * ppjY / ppjT);
686 if(sump2==0)
return 0;
688 Double_t ele[4] = {mxx / sump2, mxy / sump2, mxy / sump2, myy / sump2};
689 TMatrixDSym m0(2,ele);
692 TMatrixDSymEigen m(m0);
694 TMatrixD evecm = m.GetEigenVectors();
695 eval = m.GetEigenValues();
699 if (eval[0] < eval[1]) jev = 1;
702 evec0 = TMatrixDColumn(evecm, jev);
703 Double_t compx=evec0[0];
704 Double_t compy=evec0[1];
705 TVector2 evec(compx, compy);
707 if(jev==1) circ=2*eval[0];
708 if(jev==0) circ=2*eval[1];
739 AliVParticle *vp1 = 0x0;
740 AliVParticle *vp2 = 0x0;
741 std::vector<int> ordindex;
746 if(ordindex.size()<2)
return -1;
750 Printf(
"AliVParticle associated to Leading constituent not found");
756 Printf(
"AliVParticle associated to Subleading constituent not found");
776 return LeSub(jet, jetContNb);
805 AliVParticle *vp1 = 0x0;
810 Printf(
"AliVParticle associated to constituent not found");
814 Double_t ppt=vp1->Pt();
817 Double_t deta = vp1->Eta()-jet->
Eta();
818 mxx += ppt*ppt*deta*deta;
819 myy += ppt*ppt*dphi*dphi;
820 mxy -= ppt*ppt*deta*TMath::Abs(dphi);
826 if(sump2==0)
return 0;
828 Double_t ele[4] = {mxx , mxy , mxy , myy };
829 TMatrixDSym m0(2,ele);
832 TMatrixDSymEigen m(m0);
834 TMatrixD evecm = m.GetEigenVectors();
835 eval = m.GetEigenValues();
839 if (eval[0] < eval[1]) jev = 1;
842 evec0 = TMatrixDColumn(evecm, jev);
843 Double_t compx=evec0[0];
844 Double_t compy=evec0[1];
845 TVector2 evec(compx, compy);
847 if(jev==1) sig=TMath::Sqrt(TMath::Abs(eval[0])/sump2);
848 if(jev==0) sig=TMath::Sqrt(TMath::Abs(eval[1])/sump2);
862 return Sigma2(jet, jetContNb);
870 TClonesArray *tracksArray = partCont->GetArray();
872 if(!partCont || !tracksArray)
return -99999;
873 AliAODTrack *track = 0x0;
877 TList *trackList =
new TList();
879 for (Int_t iTrigger=0; iTrigger<100; iTrigger++) triggers[iTrigger] = 0;
882 for(Int_t iTrack=0; iTrack <= tracksArray->GetEntriesFast(); iTrack++){
887 if (!emcPart)
continue;
888 if(TMath::Abs(emcPart->
Eta())>0.9)
continue;
889 if (emcPart->
Pt()<0.15)
continue;
891 if ((emcPart->
Pt() >= minpT) && (emcPart->
Pt()< maxpT)) {
892 trackList->Add(emcPart);
893 triggers[iTT] = iTrack;
898 track =
static_cast<AliAODTrack*
>(tracksArray->At(iTrack));
899 if (!track)
continue;
900 if(TMath::Abs(track->Eta())>0.9)
continue;
901 if (track->Pt()<0.15)
continue;
902 if (!(track->TestFilterBit(768)))
continue;
904 if ((track->Pt() >= minpT) && (track->Pt()< maxpT)) {
905 trackList->Add(track);
906 triggers[iTT] = iTrack;
913 if (iTT == 0)
return -99999;
914 Int_t nbRn = 0, index = 0 ;
915 TRandom3* random =
new TRandom3(0);
916 nbRn = random->Integer(iTT);
918 index = triggers[nbRn];
927 if (vphi < -1*TMath::Pi()) vphi += (2*TMath::Pi());
928 else if (vphi > TMath::Pi()) vphi -= (2*TMath::Pi());
929 if (mphi < -1*TMath::Pi()) mphi += (2*TMath::Pi());
930 else if (mphi > TMath::Pi()) mphi -= (2*TMath::Pi());
931 double dphi = mphi-vphi;
932 if (dphi < -1*TMath::Pi()) dphi += (2*TMath::Pi());
933 else if (dphi > TMath::Pi()) dphi -= (2*TMath::Pi());
Int_t SelectTrigger(Float_t minpT, Float_t maxpT)
JetShapeType fJetShapeType
Double_t GetFirstOrderSubtractedAngularity() const
Double_t GetSecondOrderSubtractedSigma2() const
Bool_t RetrieveEventObjects()
Float_t GetPartonEta6() const
AliEmcalJet * ClosestJet() const
virtual ~AliAnalysisTaskEmcalQGTagging()
AliJetContainer * GetJetContainer(Int_t i=0) const
Float_t GetPartonEta7() const
Double_t GetSecondOrderSubtractedConstituent() const
Float_t GetJetMass(AliEmcalJet *jet, Int_t jetContNb)
Float_t GetPythiaEventWeight() const
void UserCreateOutputObjects()
Float_t GetPartonPhi7() const
Double_t GetSecondOrderSubtractedpTD() const
Bool_t RetrieveEventObjects()
Double_t GetFirstOrderSubtractedLeSub() const
Float_t GetJetAngularity(AliEmcalJet *jet, Int_t jetContNb)
Int_t GetPartonFlag7() const
Container for particles within the EMCAL framework.
Float_t GetPartonPhi6() const
Double_t GetFirstOrderSubtractedpTD() const
UShort_t GetNumberOfTracks() const
TString kData
Declare data MC or deltaAOD.
Float_t fMinFractionShared
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Double_t GetSecondOrderSubtractedLeSub() const
Int_t GetPartonFlag6() const
AliParticleContainer * GetParticleContainer() const
Double_t GetFirstOrderSubtractedConstituent() const
Float_t GetJetCircularity(AliEmcalJet *jet, Int_t jetContNb)
Float_t PTD(AliEmcalJet *jet, Int_t jetContNb)
Double_t GetSecondOrderSubtractedAngularity() const
Float_t GetSigma2(AliEmcalJet *jet, Int_t jetContNb)
Double_t fCent
!event centrality
Double_t GetSecondOrderSubtracted() const
AliEmcalJet * GetNextAcceptJet()
Float_t Angularity(AliEmcalJet *jet, Int_t jetContNb)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Float_t LeSub(AliEmcalJet *jet, Int_t jetContNb)
AliAnalysisTaskEmcalQGTagging()
Double_t GetRhoVal(Int_t i=0) const
Double_t GetFirstOrderSubtractedCircularity() const
AliEmcalList * fOutput
!output list
JetSelectionType fJetSelection
Short_t TrackAt(Int_t idx) const
Float_t Sigma2(AliEmcalJet *jet, Int_t jetContNb)
Double_t RelativePhi(Double_t mphi, Double_t vphi)
void Terminate(Option_t *option)
Double_t GetSecondOrderSubtractedCircularity() const
Float_t GetJetNumberOfConstituents(AliEmcalJet *jet, Int_t jetContNb)
Store some informaion about a Pythia eventThis class is used to store some information about a Pythia...
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
const AliEmcalPythiaInfo * GetPythiaInfo() const
Float_t GetJetpTD(AliEmcalJet *jet, Int_t jetContNb)
ClassImp(AliAnalysisTaskEmcalQGTagging) AliAnalysisTaskEmcalQGTagging
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
Declaration of class AliEmcalPythiaInfo.
void UserCreateOutputObjects()
Double_t GetFirstOrderSubtractedSigma2() const
Float_t Circularity(AliEmcalJet *jet, Int_t jetContNb)
AliEmcalJetShapeProperties * GetShapeProperties() const
Float_t GetJetLeSub(AliEmcalJet *jet, Int_t jetContNb)
Float_t GetPartonPt7() const
Double_t GetFirstOrderSubtracted() const
Container for jet within the EMCAL jet framework.
std::vector< int > GetPtSortedTrackConstituentIndexes(TClonesArray *tracks) const
Float_t GetPartonPt6() const
AliEmcalJet * GetJet(Int_t i) const
TTree * fTreeObservableTagging