26#include "CLHEP/Units/SystemOfUnits.h"
27#include "CLHEP/Vector/LorentzVector.h"
28#include "GaudiKernel/MsgStream.h"
74 return fabs(p1-p2)< epsilon ;
82#define JET_CONSTRUCTOR_BASE m_constituentsN(0) \
83 , m_RoIword(0xFFFFFFFF) \
84 , m_jetId(Jet::s_defaultJetId) \
85 , m_collection(NULL) \
86 , m_jetAuthor(Jet::s_defaultJetAuthor) \
89 , m_constituentSigState(P4SignalState::UNKNOWN) \
90 , m_num_combinedLikelihood(0) \
119 const constituent_t* pConst,
121 : base_t(3, signalstate_t(1)),
140Jet::Jet(
const collection_t* pColl,index_t ind,
double wght)
141 : base_t(3, signalstate_t(1)),
143 this->
setup(hlv_t(0.,0.,0.,0.));
144 this->addConstituent(pColl,ind,wght);
155 : base_t(3, signalstate_t(1)),
157 this->
setup(hlv_t(pMom->
px(),pMom->
py(),pMom->
pz(),pMom->
e()));
167 : base_t(3, signalstate_t(1)),
169 this->
setup(hlv_t(rMom.
px(),rMom.
py(),rMom.
pz(),rMom.
e()));
178 : base_t(3, signalstate_t(1)),
192Jet::Jet(
double px,
double py,
double pz,
double e)
193 : base_t(3, signalstate_t(1)),
203 : base_t((
const base_t) *pJet) ,
212Jet::Jet(
const Jet* pJet,
bool copyStores,
bool copyConstituents)
213 : base_t( (
const base_t) *pJet),
229 CopyDataMembers cmd0, CopyDataMembers cmd1,
230 CopyDataMembers cmd2, CopyDataMembers cmd3)
231 : base_t( (
const base_t) *pJet ),
292 for ( ; firstConst != lastConst; ++firstConst )
295 if ( pJet->
getIndex(firstConst,theIndex) )
313 if ( oMap !=
nullptr ){
339 for (
size_t i = 0; i < old.size(); i++)
350 for (
size_t i = 0; i < old.size(); i++)
485 this->
updateKine(((pColl->operator[])(ind))->hlv(),wght);
508 for ( ; fC != lC ; ++fC )
521 return pJet->
size() > 0;
531 unsigned int aCtr = 0;
533 if ( this->
size() > 0 )
537 for ( ; fC != lC; ++fC )
579 Jet* newjet =
new Jet(
this,
true,
true);
592 if ( pJet->
size() != this->size() )
return false;
594 if( pJet->
size() == 0 ){
607 while ( isEqual && fC != lC )
612 while ( ( fK != lK ) && ((*fC) != (*fK) ||
625 std::ostringstream out;
626 out <<
jetAuthor() <<
": NConstituents: " <<
size() <<
"; Eta: " <<
eta() <<
"; Phi: " <<
phi() <<
"; Pt: " <<
pt();
631void diff(
const Jet& rJet1,
const Jet& rJet2, std::map<std::string,double> varDiff)
635 double ignoreWeight = 1.0e-06;
638 varDiff[
"NConstituents"] = rJet1.
size() - rJet2.
size();
641 if(fabs(rJet1.
e() - rJet2.
e()) > ignoreWeight)
642 varDiff[
"e"] = rJet1.
e() - rJet2.
e();
643 if(fabs(rJet1.
px() - rJet2.
px()) > ignoreWeight)
644 varDiff[
"px"] = rJet1.
px() - rJet2.
px();
645 if(fabs(rJet1.
py() - rJet2.
py()) > ignoreWeight)
646 varDiff[
"py"] = rJet1.
py() - rJet2.
py();
647 if(fabs(rJet1.
pz() - rJet2.
pz()) > ignoreWeight)
648 varDiff[
"pz"] = rJet1.
pz() - rJet2.
pz();
656 if ( pJet->
size() == 0 || this->size() == 0 )
return (
Jet*)
nullptr;
661 std::vector<const constituent_type*> constituents (this->
begin(),
668 Jet* newJet =
nullptr;
672 for ( ; fC != lC; ++fC )
675 if ( std::find (constituents.begin(), constituents.end(), c) !=
679 newJet =
new Jet(
this,
true,
false);
704 hlv_t fmom(0.,0.,0.,0.);
718 hlv_t fmom(0.,0.,0.,0.);
784 Jet*
jet =
new Jet(
this, copyStores,copyConstituents);
798 bool createIfMissing)
const
808 if (
map !=
nullptr )
819 std::vector<Jet::mkey_t> keys;
821 if ( pMap !=
nullptr )
825 for (
size_t i(0); i < n; ++i )
970 const std::string
base=
"LikeLihood_";
981 const std::string
base=
"LikeLihood_";
992 if ( this->
jetAuthor().
find(
"Atlfast") != std::string::npos) {
996 if (pos !=
nullptr) {
997 std::vector<double> prob = pos->tagLikelihood();
1000 double pu = prob[1];
1001 if (pb != 0 && pu != 0)
1010 if (Likelihood[0] > 0.9) w = 100;
1018 if( pos !=
nullptr ) {
1020 std::vector<double> prob = pos->tagLikelihood();
1022 double pb = prob[0];
1023 double pu = prob[1];
1024 if (pb > 0. && pu > 0.) {
1025 if(pb!=1.||pu!=1.e9) {
1034 if( pos !=
nullptr ) {
1036 std::vector<double> prob = pos->tagLikelihood();
1038 double pb = prob[0];
1039 double pu = prob[1];
1040 if (pb > 0. && pu > 0.)
1044 if (!found) w = -30.;
1053 if( pos !=
nullptr ) {
1054 std::vector<double> prob = pos->tagLikelihood();
1055 if(prob.size() == 1) {
1058 if(prob.size() > 1) {
1059 double pb = prob[0];
1060 double pu = prob[1];
1063 }
else if (pu<=0.) {
1099 size_t pos = full_auth.find_first_of(
'_');
1101 if( pos != std::string::npos)
1112 size_t found=full_auth.find_first_of(
'_');
1113 return found != std::string::npos ? full_auth.substr(0 , found) : std::move(full_auth);
1130 std::string full_tag =
""; full_tag+=
"_"; full_tag+=tag;
1131 return ( full_auth.find(full_tag) != std::string::npos );
1136 size_t p = full_auth.find_first_of(
'_');
1138 while(
p != std::string::npos){
1140 p = full_auth.find_first_of(
'_',
p+1);
1147 size_t p = full_auth.find_first_of(
'_');
1149 while(
p != std::string::npos){
1152 return full_auth.substr(
p+1,full_auth.find_first_of(
'_',
p+1)-
p-1);
1154 p = full_auth.find_first_of(
'_',
p+1);
1161 full_auth +=
"_"+tag;
1190 mapname +=
"MomentMap";
1206 double pz =
pt*std::sinh(
eta) ;
1219 return ( out <<
str() );
char data[hepevt_bytes_allocation_ATLAS]
bool jet_component_identity(double p1, double p2, double epsilon=0.1)
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
#define JET_CONSTRUCTOR_BASE
I4Momentum is an abstract base class providing 4-momentum behavior.
virtual CLHEP::HepLorentzVector hlv() const =0
CLHEP HepLorentzVector.
virtual double pz() const =0
z component of momentum
virtual double px() const =0
x component of momentum
virtual double e() const =0
energy
virtual double py() const =0
y component of momentum
ISignalState is an abstract base class providing support for various Signal States to be associated w...
virtual CLHEP::HepLorentzVector hlv(P4SignalState::State s) const =0
obtain the CLHEP HepLorentzVector
A safe iterator on jet constituents.
static JetConstituentIterator last(const Jet *jet)
get the end iterator
static JetConstituentIterator first(const Jet *jet)
get a default iterator
const Jet::constituent_t * get_real_constit()
access to the real constituent pointer
Theses classes implement a mapping between string and index used by jets.
const std::vector< key_t > & getKeys(const category_t &cat) const
static JetKeyDescriptorInstance * instance()
size_t getIndex(const category_t &cat, const key_t &key, bool createIfMissing=true)
const key_t & getKey(const category_t &cat, size_t index) const
virtual size_t numberOfMoments(size_t jetIndex) const
virtual void assignRecord(size_t jetIndex, record_t *rec) const
assign a given record to a given jet
virtual const record_t * getRecord(size_t jetIndex) const
get the full record for a given jet
virtual bool getMoment(size_t jetIndex, size_t keyIndex, float_t &moment) const
base_t::record_t record_t
const collection_t * getContainer(const constituent_t *pConst) const
Retrieve pointer to constituent object container.
std::vector< double > combinedLikelihood() const
(depreciated) Likelihood store access
bool removeConstituent(const constituent_t *pConst)
Remove a constituent.
bool isIdentical(const Jet &rJet) const
Test if Jet is identical to given Jet.
virtual void setE(double e)
Kinematics are now handled by the base class, except for the following.
size_t size() const
Size of constituent store.
signalstate_t constituentSignalState() const
Get the current Signal state of the jet constituents.
size_t id() const
Index category for jet shapes.
double getCScalePy() const
void setJetAuthorAndCalibTags(const std::string &author)
Set the full author-and-tag string.
const fastjet::PseudoJet * m_pseudoJet
Pointer to the fastjet object this jet is build from.
void removeInfo(const mkey_t &key)
(depreciated) Remove tag info object
const shape_map_t * getMomentMap(bool addIfMissing) const
void setJetAuthor(const std::string &author)
Set author of this Jet (only the author, tags unchanged)
virtual double pzi() const
virtual void setPx(double Px)
virtual double pyi() const
bool addJet(const Jet *pJet, double wght=1.0)
Add a jet.
bool checkKeyStore(const mcat_t &cat, const mkey_t &key, const STORE *store, size_t &aInd) const
Check key validity.
const std::vector< mkey_t > & getAssociationKeys() const
bool reweight(const constituent_t *pConst, double wght)
Change kinematic weight of constituent.
size_t m_jetId
the identifier of this jet within its collection.
CLHEP::HepLorentzVector hlv_t
virtual void setPz(double pz)
JetMoment::float_t shape_t
void insertElement(const collection_t *pColl, const constituent_t *pConst, double wght=1.0, size_t sizeHint=0)
insert element without checking
const taginfo_t * tagInfo(const mkey_t &key) const
Retrieve tag info object.
bool getIndex(const constituent_t *pConst, index_t &ind) const
Retrieve index of object in container.
bool finalScaleEqualsEMScale() const
True if JETFINAL state equals JETEMSCALE state within 0.1 MeV on each E,px,pypz components.
double getCScalePz() const
void setCalE(double e)
Sets calibrated .
double getWeight(const constituent_t *pConst) const
Retrieve kinematic weight of constituent.
std::string getMomentMapName() const
virtual void updateKine()
Resummation of kinematics from constituents.
void scale_momentum(double scale_factor)
scale the jet 4mom by scale_factor
static const double m_ignoreWeight
Maximum difference up to which weights are considered equal.
friend class JetTagInfoBase
const_iterator lastConstituent() const
(obsolere) end iterator for constituent store
bool checkKey(const mcat_t &cat, const mkey_t &key, size_t &aInd, bool createIfMissing) const
P4SignalState::State signalstate_t
virtual Jet * clone() const
clone method : do not clone stores and constituent
void addCalibTag(const std::string &tag)
set calib tag tag must be of the form "AAA"
std::vector< const assoc_t * > assostore_t
std::string getCalibTag(int i) const
retrieve calib tag number i (start at 1).
std::string jetAuthorAndCalibTags() const
Retrieve the full author-and-tag string of this Jet.
tagstore_t * m_tagInfoStore
Tag info store.
std::string jetAuthor() const
Author and calibration history are encoded in a simple way inside the jet object.
std::vector< const taginfo_t * > tagstore_t
void setCombinedLikelihood(const std::vector< double > &combinedLikelihood)
(depreciated) Likelihood store setter
double getCScalePx() const
Jet * getOverlap(const Jet &rJet, bool noKine=false) const
Retrieve constituent overlap between jets.
size_t m_jetAuthor
Jet author store.
bool addConstituent(const collection_t *pColl, const constituent_t *pConst, double wght=1.0)
Add a constituent with optional kinematic weight.
const JetCollection * parentCollection() const
a pointer to the collection this jet belongs to (can be NULL)
const OBJ * getObject(const mkey_t &key, const STORE *store, const mcat_t &cat) const
Get object from store with category and key.
static const size_t s_defaultJetId
friend class JetCollection
navigable_t::external_index_type index_type
Constituent index type (obsolete)
Jet * get_scaled_copy(double scale_factor) const
return a NEW copy of this jet with 4mom scaled
void setTagInfo(const mkey_t &key, const taginfo_t *pTagInfo, bool useLink=false)
Set tag info object.
Jet()
Default constructor.
virtual double pti() const
virtual ~Jet()
Destructor.
void setCalPy(double py)
Sets calibrated .
static const size_t s_defaultJetAuthor
const assoc_t * getAssociationBase(const mkey_t &key) const
const shape_map_t * getMomentMap() const
navigable_t::object_iter const_iterator
JetKeyDescriptor::key_t mkey_t
void setPtEtaPhiE(double a, double b, double c, double d)
assostore_t * m_assocStore
key descriptor for all jet stores
void setup(const hlv_t &v)
void setShape(const mkey_t &shapeName, shape_t shape, bool addIfMissing=true) const
Set shape variable.
virtual double pxi() const
const_iterator begin() const
Begin iterator for constituent store.
MsgStream & operator<<(MsgStream &out)
Output operator.
double getCScaleE() const
void copy_from_jet(const Jet *pjet, CopyDataMembers cdm0, CopyDataMembers cdm1=CopyNone, CopyDataMembers cdm2=CopyNone, CopyDataMembers cdm3=CopyNone)
virtual void setupKine(const hlv_t &v)
std::vector< mkey_t > getShapeKeys() const
Retrieve list of avalailable keys.
void setCalPz(double pz)
Sets calibrated .
double getFlavourTagWeight() const
get the final b-tag result from the default tagger
hlv_t constituent_sum4Mom() const
Sum of weighted constituent four-momentums.
INavigable4Momentum constituent_t
Constituent iterator type.
virtual double ei() const
INavigable4MomentumCollection collection_t
Navigable object type.
void setCScaleE(double e)
Sets uncalibrated .
void setCScalePy(double py)
Sets uncalibrated .
const_iterator end() const
End iterator for constituent store.
CopyDataMembers
@ brief fine control over what's copied in the various stores and constituents
bool cleanUp()
Remove all constituents with kinematic weight = 0.
void setRawPx(double px)
Sets uncalibrated .
void setCScalePx(double px)
Sets uncalibrated .
const_iterator firstConstituent() const
(obsolete) begin iterator for constituent store
void setRawE(double e)
Sets uncalibrated .
void setPtEtaPhiM(double a, double b, double c, double d)
JetAssociationBase assoc_t
void setRawPy(double py)
Sets uncalibrated .
INavigable4Momentum constituent_type
Navigable object type (obsolete)
void setCalPx(double px)
Sets calibrated .
ParticleSigStateImpl< Navigable< INavigable4MomentumCollection, double >, P4ImplPxPyPzE, ParticleEvent::Base > base_t
Internally used base type mixes particle/navigable/four-momentum interfaces with correct implementati...
void setPxPyPzE(double px, double py, double pz, double e)
compatibility with analysis EDM
numconstit_t m_constituentsN
std::string str()
Jet print-out function.
navigable_t::external_index_type index_t
bool hasCalibTag(const std::string &tag) const
test if jet has calib tag tag
void setCScalePz(double pz)
Sets uncalibrated .
int numCalibTag() const
number of calib tags for this jet
JetKeyDescriptorInstance * keyDesc() const
void setRawPz(double pz)
Sets uncalibrated .
const JetCollection * m_collection
Shape store link.
void putElement(const collection_t *pColl, const constituent_t *pConst, double wght=1.0, size_t sizeHint=0)
Add element with checking.
virtual void setPy(double py)
size_t m_num_combinedLikelihood
signalstate_t m_constituentSigState
Constituent Signal State.
void setConstituentSignalState(signalstate_t s)
Set the current Signal state of the jet constituents.
void setEEtaPhiM(double a, double b, double c, double d)
bool contains(const constituent_t *pConst) const
Check on containment.
shape_t getShape(const mkey_t &shapeName, bool addIfMissing=false) const
Retrieve shape variable.
static OrphanJetMomentMap instance
P4PtEtaPhiM is a class with 4-momentum behavior, for which Pt, Eta, Phi and M are data members.
virtual CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
virtual double eta() const
virtual bool setSignalState(state_t s)
virtual double phi() const
virtual double pz() const
z component of momentum
virtual double e() const
energy
virtual double py() const
y component of momentum
virtual CLHEP::HepLorentzVector hlv() const
CLHEP HepLorentzVector.
virtual double pt() const
const navigable_type & navigableBase() const
virtual void set4Mom(const I4Momentum &p4)
virtual double px() const
We re-define here extra class routines that will allow direct access to signal state kinematics witho...
bool setup(asg::AnaToolHandle< Interface > &tool, const std::string &type, const std::vector< std::string > &config, const std::string &progressFile="")
mostly useful for athena, which will otherwise re-use the previous tool
std::string find(const std::string &s)
return a remapped string
static const key_t ShapeCat
Index category for jet shapes.
static const key_t TagCat
Index category for jet tag info.
static const key_t InfoCat
Index category for general jet info.
static const key_t AssoCat
Index category for jet associations.