-// $Id$
//
// Emcal jet class.
//
#include "AliEmcalJet.h"
+#include "AliLog.h"
+#include "Riostream.h"
+
ClassImp(AliEmcalJet)
//__________________________________________________________________________________________________
fAreaPhi(0),
fAreaEmc(-1),
fAxisInEmcal(0),
+ fFlavourTagging(0),
fMaxCPt(0),
fMaxNPt(0),
fMCPt(0),
fTrackIDs(),
fMatched(2),
fMatchingType(0),
+ fTaggedJet(0x0),
+ fTagStatus(-1),
fPtSub(0),
- fPtVectSub(0)
+ fPtVectSub(0),
+ fTriggers(0),
+ fJetShapeMassFirstDer(0),
+ fJetShapeMassSecondDer(0),
+ fJetShapeMassFirstSub(0),
+ fJetShapeMassSecondSub(0),
+ fLabel(-1)
{
// Constructor.
fAreaPhi(0),
fAreaEmc(-1),
fAxisInEmcal(0),
+ fFlavourTagging(0),
fMaxCPt(0),
fMaxNPt(0),
fMCPt(0),
fTrackIDs(),
fMatched(2),
fMatchingType(0),
+ fTaggedJet(0x0),
+ fTagStatus(-1),
fPtSub(0),
- fPtVectSub(0)
+ fPtVectSub(0),
+ fTriggers(0),
+ fJetShapeMassFirstDer(0),
+ fJetShapeMassSecondDer(0),
+ fJetShapeMassFirstSub(0),
+ fJetShapeMassSecondSub(0),
+ fLabel(-1)
{
// Constructor.
fAreaPhi(0),
fAreaEmc(-1),
fAxisInEmcal(0),
+ fFlavourTagging(0),
fMaxCPt(0),
fMaxNPt(0),
fMCPt(0),
fTrackIDs(),
fMatched(2),
fMatchingType(0),
+ fTaggedJet(0x0),
+ fTagStatus(-1),
fPtSub(0),
- fPtVectSub(0)
+ fPtVectSub(0),
+ fTriggers(0),
+ fJetShapeMassFirstDer(0),
+ fJetShapeMassSecondDer(0),
+ fJetShapeMassFirstSub(0),
+ fJetShapeMassSecondSub(0),
+ fLabel(-1)
{
// Constructor.
fAreaPhi(jet.fAreaPhi),
fAreaEmc(jet.fAreaEmc),
fAxisInEmcal(jet.fAxisInEmcal),
+ fFlavourTagging(jet.fFlavourTagging),
fMaxCPt(jet.fMaxCPt),
fMaxNPt(jet.fMaxNPt),
fMCPt(jet.fMCPt),
fTrackIDs(jet.fTrackIDs),
fMatched(jet.fMatched),
fMatchingType(jet.fMatchingType),
+ fTaggedJet(jet.fTaggedJet),
+ fTagStatus(jet.fTagStatus),
fPtSub(jet.fPtSub),
- fPtVectSub(jet.fPtVectSub)
+ fPtVectSub(jet.fPtVectSub),
+ fTriggers(jet.fTriggers),
+ fJetShapeMassFirstDer(jet.fJetShapeMassFirstDer),
+ fJetShapeMassSecondDer(jet.fJetShapeMassSecondDer),
+ fJetShapeMassFirstSub(jet.fJetShapeMassFirstSub),
+ fJetShapeMassSecondSub(jet.fJetShapeMassSecondSub),
+ fLabel(jet.fLabel)
{
// Copy constructor.
fAreaPhi = jet.fAreaPhi;
fAreaEmc = jet.fAreaEmc;
fAxisInEmcal = jet.fAxisInEmcal;
+ fFlavourTagging = jet.fFlavourTagging;
fMaxCPt = jet.fMaxCPt;
fMaxNPt = jet.fMaxNPt;
fMCPt = jet.fMCPt;
fClosestJetsDist[0] = jet.fClosestJetsDist[0];
fClosestJetsDist[1] = jet.fClosestJetsDist[1];
fMatched = jet.fMatched;
+ fTaggedJet = jet.fTaggedJet;
+ fTagStatus = jet.fTagStatus;
fPtSub = jet.fPtSub;
fPtVectSub = jet.fPtVectSub;
+ fTriggers = jet.fTriggers;
+ fJetShapeMassFirstDer = jet.fJetShapeMassFirstDer;
+ fJetShapeMassSecondDer = jet.fJetShapeMassSecondDer;
+ fJetShapeMassFirstSub = jet.fJetShapeMassFirstSub;
+ fJetShapeMassSecondSub = jet.fJetShapeMassSecondSub;
+ fLabel = jet.fLabel;
}
return *this;
}
+//_________________________________________________________________________________________________
Int_t AliEmcalJet::Compare(const TObject* obj) const
{
//Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
{
// Print jet information.
- printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
+ Printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f", fPt, fEta, fPhi, fArea, fNEF);
}
//__________________________________________________________________________________________________
std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize());
}
+//__________________________________________________________________________________________________
+Double_t AliEmcalJet::DeltaR (const AliVParticle* part) const
+{ // Helper function to calculate the distance between two jets or a jet and a particle
+ Double_t dPhi = this->Phi() - part->Phi();
+ Double_t dEta = this->Eta() - part->Eta();
+ dPhi = TVector2::Phi_mpi_pi ( dPhi );
+
+ return TMath::Sqrt ( dPhi * dPhi + dEta * dEta );
+}
+
+
+//__________________________________________________________________________________________________
+std::vector<int> AliEmcalJet::SortConstituentsPt( TClonesArray *tracks ) const
+{ //___________________________________________
+ // Sorting by p_T (decreasing) jet constituents
+ //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ typedef std::pair<Double_t, Int_t> ptidx_pair;
+
+ // Create vector for Pt sorting
+ std::vector<ptidx_pair> pair_list ;
+
+ for ( Int_t i_entry = 0; i_entry < GetNumberOfTracks(); i_entry++ )
+ {
+ AliVParticle *track = TrackAt(i_entry, tracks);
+ if (!track)
+ {
+ AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)", i_entry, tracks->GetName(), TrackAt(i_entry), tracks->GetEntriesFast()));
+ continue;
+ }
+
+ pair_list.push_back( std::make_pair ( track->Pt(), i_entry ) );
+ }
+
+ std::stable_sort( pair_list.begin() , pair_list.end() , sort_descend() );
+
+ // return an vector of indexes of constituents (sorted descending by pt)
+ std::vector <int> index_sorted_list;
+
+ for ( std::vector< std::pair<Double_t,Int_t> >::iterator it = pair_list.begin(); it != pair_list.end(); ++it)
+ { index_sorted_list.push_back( (*it).second ); } // populating the return object with indexes of sorted tracks
+
+ return index_sorted_list;
+}
+
//__________________________________________________________________________________________________
AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const
{
AliVParticle* maxTrack = 0;
for (Int_t i = 0; i < GetNumberOfTracks(); i++) {
AliVParticle *track = TrackAt(i, tracks);
+ if (!track) {
+ AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)",
+ i,tracks->GetName(),TrackAt(i),tracks->GetEntriesFast()));
+ continue;
+ }
if (!maxTrack || track->Pt() > maxTrack->Pt())
maxTrack = track;
}
AliVCluster* maxCluster = 0;
for (Int_t i = 0; i < GetNumberOfClusters(); i++) {
AliVCluster *cluster = ClusterAt(i, clusters);
+ if (!cluster) {
+ AliError(Form("Unable to find jet cluster %d in collection %s (pos in collection %d, max %d)",
+ i,clusters->GetName(),ClusterAt(i),clusters->GetEntriesFast()));
+ continue;
+ }
if (!maxCluster || cluster->E() > maxCluster->E())
maxCluster = cluster;
}
return maxCluster;
}
+
+//__________________________________________________________________________________________________
+void AliEmcalJet::ResetMatching()
+{
+ fClosestJets[0] = 0;
+ fClosestJets[1] = 0;
+ fClosestJetsDist[0] = 999;
+ fClosestJetsDist[1] = 999;
+ fMatched = 2;
+}