test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelJetPuId Class Reference

#include <RecoBTag/PixelJetPuId/src/PixelJetPuId.cc>

Inheritance diagram for PixelJetPuId:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelJetPuId (const edm::ParameterSet &)
 
virtual ~PixelJetPuId ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< edm::View
< reco::Jet > > 
generaljetsToken
 
edm::EDGetTokenT< edm::View
< reco::CaloJet > > 
jetsToken
 
bool m_fwjets
 
edm::InputTag m_jets
 
double m_MaxTrackChi2
 
double m_MaxTrackDistanceToJet
 
double m_minet_fwjets
 
double m_mineta_fwjets
 
double m_MinGoodJetTrackPt
 
double m_MinGoodJetTrackPtRatio
 
double m_MinTrackPt
 
edm::InputTag m_primaryVertex
 
edm::InputTag m_tracks
 
edm::EDGetTokenT
< reco::VertexCollection
primaryVertexToken
 
edm::EDGetTokenT< std::vector
< reco::Track > > 
tracksToken
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: The PixelJetPuId module select all the pixel tracks compatible with a jet. If the sum of the tracks momentum is under a threshold the jet is tagged as "PUjets".

Implementation: [Notes on implementation]

Definition at line 56 of file PixelJetPuId.cc.

Constructor & Destructor Documentation

PixelJetPuId::PixelJetPuId ( const edm::ParameterSet iConfig)

Definition at line 91 of file PixelJetPuId.cc.

References generaljetsToken, edm::ParameterSet::getParameter(), jetsToken, m_fwjets, m_jets, m_MaxTrackChi2, m_MaxTrackDistanceToJet, m_minet_fwjets, m_mineta_fwjets, m_MinGoodJetTrackPt, m_MinGoodJetTrackPtRatio, m_MinTrackPt, m_primaryVertex, m_tracks, primaryVertexToken, and tracksToken.

92 {
93  //InputTag
94  m_tracks = iConfig.getParameter<edm::InputTag>("tracks");
95  tracksToken = consumes<std::vector<reco::Track> >(m_tracks);
96  m_jets = iConfig.getParameter<edm::InputTag>("jets");
97  jetsToken = consumes<edm::View<reco::CaloJet> >(m_jets);
98  generaljetsToken = consumes<edm::View<reco::Jet> >(m_jets);
99  m_primaryVertex = iConfig.getParameter<edm::InputTag>("primaryVertex");
100  primaryVertexToken = consumes<reco::VertexCollection>(m_primaryVertex);
101 
102  //Tracks Selection
103  m_MinTrackPt = iConfig.getParameter<double>("MinTrackPt");
104  m_MaxTrackDistanceToJet = iConfig.getParameter<double>("MaxTrackDistanceToJet");
105  m_MaxTrackChi2 = iConfig.getParameter<double>("MaxTrackChi2");
106 
107  //A jet is defined as a signal jet if Sum(trackPt) > minPt or Sum(comp.trackPt)/CaloJetPt > minPtRatio
108  m_MinGoodJetTrackPt = iConfig.getParameter<double>("MinGoodJetTrackPt");
109  m_MinGoodJetTrackPtRatio = iConfig.getParameter<double>("MinGoodJetTrackPtRatio");
110 
111  m_fwjets = iConfig.getParameter<bool>("UseForwardJetsAsNoPU");
112  m_mineta_fwjets = iConfig.getParameter<double>("MinEtaForwardJets");
113  m_minet_fwjets = iConfig.getParameter<double>("MinEtForwardJets");
114 
115  produces<std::vector<reco::CaloJet> >();
116  produces<std::vector<reco::CaloJet> >("PUjets");
117  produces<reco::JetTagCollection>();
118 }
T getParameter(std::string const &) const
double m_MinGoodJetTrackPt
Definition: PixelJetPuId.cc:83
edm::InputTag m_jets
Definition: PixelJetPuId.cc:69
double m_MaxTrackChi2
Definition: PixelJetPuId.cc:76
edm::EDGetTokenT< edm::View< reco::Jet > > generaljetsToken
Definition: PixelJetPuId.cc:72
edm::EDGetTokenT< edm::View< reco::CaloJet > > jetsToken
Definition: PixelJetPuId.cc:71
edm::InputTag m_primaryVertex
Definition: PixelJetPuId.cc:67
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken
Definition: PixelJetPuId.cc:73
double m_MaxTrackDistanceToJet
Definition: PixelJetPuId.cc:77
double m_minet_fwjets
Definition: PixelJetPuId.cc:81
double m_mineta_fwjets
Definition: PixelJetPuId.cc:80
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
Definition: PixelJetPuId.cc:70
edm::InputTag m_tracks
Definition: PixelJetPuId.cc:68
double m_MinTrackPt
Definition: PixelJetPuId.cc:75
double m_MinGoodJetTrackPtRatio
Definition: PixelJetPuId.cc:84
PixelJetPuId::~PixelJetPuId ( )
virtual

Definition at line 121 of file PixelJetPuId.cc.

121 {}

Member Function Documentation

void PixelJetPuId::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 125 of file PixelJetPuId.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_25ns10e33_v2_cff::InputTag.

125  {
127  desc.add<edm::InputTag> ("jets",edm::InputTag("hltCaloJetL1FastJetCorrected"));
128  desc.add<edm::InputTag> ("tracks",edm::InputTag("hltPixelTracksNoPU"));
129  desc.add<edm::InputTag> ("primaryVertex",edm::InputTag("hltFastPVPixelVertices"));
130  desc.add<double>("MinGoodJetTrackPtRatio",0.045);
131  desc.add<double>("MinGoodJetTrackPt",1.8);
132  desc.add<double>("MaxTrackDistanceToJet",0.04);
133  desc.add<double>("MinTrackPt",0.6);
134  desc.add<double>("MaxTrackChi2",20.);
135  desc.add<bool>("UseForwardJetsAsNoPU",true);
136  desc.add<double>("MinEtaForwardJets",2.4);
137  desc.add<double>("MinEtForwardJets",40.);
138  descriptions.add("pixelJetPuId",desc);
139 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PixelJetPuId::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 146 of file PixelJetPuId.cc.

References reco::deltaR2(), generaljetsToken, edm::EventSetup::get(), edm::Event::getByToken(), i, fwrapper::jets, jetsToken, IPTools::jetTrackDistance(), findQualityFiles::jj, m_fwjets, m_MaxTrackChi2, m_MaxTrackDistanceToJet, m_minet_fwjets, m_mineta_fwjets, m_MinGoodJetTrackPt, m_MinGoodJetTrackPtRatio, m_MinTrackPt, edm::makeRefToBaseProdFrom(), eostools::move(), HLT_25ns10e33_v2_cff::primaryVertex, primaryVertexToken, edm::Event::put(), MetAnalyzer::pv(), edm::second(), testEve_cfg::tracks, and tracksToken.

147 {
148  using namespace edm;
149  std::unique_ptr<std::vector<reco::CaloJet> > pOut(new std::vector<reco::CaloJet> );
150  std::unique_ptr<std::vector<reco::CaloJet> > pOut_PUjets(new std::vector<reco::CaloJet> );
151  std::unique_ptr<reco::JetTagCollection > pOut_jetTagCollection(new reco::JetTagCollection );
152 
153  //get tracks
155  iEvent.getByToken(tracksToken, tracks);
156  unsigned int tsize = tracks->size();
157  float teta[tsize], tphi[tsize];
158  unsigned int i=0;
159  for (auto const & tr : *tracks) { teta[i]=tr.eta(); tphi[i]=tr.phi();++i;}
160 
161  //get jets
163  iEvent.getByToken(jetsToken, jets);
164 
165  Handle<edm::View<reco::Jet> > generaljets;
166  iEvent.getByToken(generaljetsToken, generaljets);
167 
168  //get primary vertices
171 
172  //get Transient Track Builder
174  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
175 
176  //init JetTagCollection
177  if(generaljets.product()->size()>0)
178  {
180  pOut_jetTagCollection.reset(new reco::JetTagCollection(edm::makeRefToBaseProdFrom(jj, iEvent)));
181  }
182 
183  //loop on trackIPTagInfos
184  if(primaryVertex->size()>0)
185  {
186  const reco::Vertex* pv = &*primaryVertex->begin();
187  //loop on jets
188  for(edm::View<reco::CaloJet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++ ) {
189 
190  math::XYZVector jetMomentum = itJet->momentum();
191  GlobalVector direction(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
192 
193  math::XYZVector trMomentum;
194 
195  if(fabs(itJet->eta())>m_mineta_fwjets)
196  {
197  if((m_fwjets) && (itJet->et()>m_minet_fwjets))
198  pOut->push_back(*itJet);// fill forward jet as signal jet
199  }
200  else
201  {
202  //loop on tracks
203  std::vector<reco::Track>::const_iterator itTrack = tracks->begin();
204  for (unsigned int i=0; i<tsize; ++i) {
205  float deltaR2=reco::deltaR2(itJet->eta(),itJet->phi(), teta[i],tphi[i]);
206  if(deltaR2<0.25) {
207  reco::TransientTrack transientTrack = builder->build(*itTrack);
208  float jetTrackDistance = -((IPTools::jetTrackDistance(transientTrack, direction, *pv)).second).value();
209 
210  //select the tracks compabible with the jet
211  if(( itTrack->pt() > m_MinTrackPt) && ( itTrack->normalizedChi2() < m_MaxTrackChi2) && (jetTrackDistance<m_MaxTrackDistanceToJet))
212  {
213  trMomentum += itTrack->momentum(); //calculate the Sum(trackPt)
214  }
215  }
216  itTrack++;
217  }
218  //if Sum(comp.trackPt)/CaloJetPt > minPtRatio or Sum(trackPt) > minPt the jet is a signal jet
219  if(trMomentum.rho()/jetMomentum.rho() > m_MinGoodJetTrackPtRatio || trMomentum.rho() > m_MinGoodJetTrackPt )
220  {
221  pOut->push_back(*itJet); // fill it as signal jet
222  }
223  else//else it is a PUjet
224  {
225  pOut_PUjets->push_back(*itJet); // fill it as PUjets
226  }
227  }
228  RefToBase<reco::Jet> jRef(generaljets, itJet-jets->begin());
229  (*pOut_jetTagCollection)[jRef] = trMomentum.rho(); // fill jetTagCollection
230  }
231  }
232  iEvent.put(std::move(pOut));
233  iEvent.put(std::move(pOut_PUjets),"PUjets");
234  iEvent.put(std::move(pOut_jetTagCollection));
235 }
int i
Definition: DBlmapReader.cc:9
double m_MinGoodJetTrackPt
Definition: PixelJetPuId.cc:83
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
double m_MaxTrackChi2
Definition: PixelJetPuId.cc:76
edm::EDGetTokenT< edm::View< reco::Jet > > generaljetsToken
Definition: PixelJetPuId.cc:72
edm::EDGetTokenT< edm::View< reco::CaloJet > > jetsToken
Definition: PixelJetPuId.cc:71
std::pair< double, Measurement1D > jetTrackDistance(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:200
U second(std::pair< T, U > const &p)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
vector< PseudoJet > jets
def move
Definition: eostools.py:510
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken
Definition: PixelJetPuId.cc:73
double m_MaxTrackDistanceToJet
Definition: PixelJetPuId.cc:77
double m_minet_fwjets
Definition: PixelJetPuId.cc:81
double m_mineta_fwjets
Definition: PixelJetPuId.cc:80
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
Definition: PixelJetPuId.cc:70
double m_MinTrackPt
Definition: PixelJetPuId.cc:75
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:56
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
double m_MinGoodJetTrackPtRatio
Definition: PixelJetPuId.cc:84

Member Data Documentation

edm::EDGetTokenT<edm::View<reco::Jet> > PixelJetPuId::generaljetsToken
private

Definition at line 72 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::EDGetTokenT<edm::View<reco::CaloJet> > PixelJetPuId::jetsToken
private

Definition at line 71 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

bool PixelJetPuId::m_fwjets
private

Definition at line 79 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::InputTag PixelJetPuId::m_jets
private

Definition at line 69 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

double PixelJetPuId::m_MaxTrackChi2
private

Definition at line 76 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MaxTrackDistanceToJet
private

Definition at line 77 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_minet_fwjets
private

Definition at line 81 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_mineta_fwjets
private

Definition at line 80 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinGoodJetTrackPt
private

Definition at line 83 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinGoodJetTrackPtRatio
private

Definition at line 84 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinTrackPt
private

Definition at line 75 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::InputTag PixelJetPuId::m_primaryVertex
private

Definition at line 67 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

edm::InputTag PixelJetPuId::m_tracks
private

Definition at line 68 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

edm::EDGetTokenT<reco::VertexCollection> PixelJetPuId::primaryVertexToken
private

Definition at line 73 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::EDGetTokenT<std::vector<reco::Track> > PixelJetPuId::tracksToken
private

Definition at line 70 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().