CMS 3D CMS Logo

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

#include <JetVertexAssociation.h>

Inheritance diagram for cms::JetVertexAssociation:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetVertexAssociation (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
 ~JetVertexAssociation ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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 (const std::string &iProcessName, std::vector< const char * > &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 ()
 

Private Types

typedef std::vector< double > ResultCollection1
 
typedef std::vector< bool > ResultCollection2
 

Private Attributes

edm::EDGetTokenT
< reco::CaloJetCollection
jet_token
 
JetVertexMain m_algo
 
edm::EDGetTokenT
< reco::TrackCollection
track_token
 
edm::EDGetTokenT
< reco::VertexCollection
vertex_token
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 27 of file JetVertexAssociation.h.

Member Typedef Documentation

typedef std::vector<double> cms::JetVertexAssociation::ResultCollection1
private

Definition at line 38 of file JetVertexAssociation.h.

typedef std::vector<bool> cms::JetVertexAssociation::ResultCollection2
private

Definition at line 39 of file JetVertexAssociation.h.

Constructor & Destructor Documentation

JetVertexAssociation::JetVertexAssociation ( const edm::ParameterSet ps)

Definition at line 58 of file JetVertexAssociation.cc.

58  : m_algo(iConfig),
59  jet_token(consumes<CaloJetCollection>(edm::InputTag(iConfig.getParameter<std::string>("JET_ALGO")))),
60  track_token(consumes<TrackCollection>(edm::InputTag(iConfig.getParameter<std::string>("TRACK_ALGO")))),
61  vertex_token(consumes<VertexCollection>(edm::InputTag(iConfig.getParameter<std::string>("VERTEX_ALGO")))) {
62 
63 
64 
65  produces<ResultCollection1>("Var");
66  produces<ResultCollection2>("JetType");
67 
68 
69  }
edm::EDGetTokenT< reco::VertexCollection > vertex_token
edm::EDGetTokenT< reco::TrackCollection > track_token
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
cms::JetVertexAssociation::~JetVertexAssociation ( )
inline

Definition at line 33 of file JetVertexAssociation.h.

33 {}

Member Function Documentation

void JetVertexAssociation::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 71 of file JetVertexAssociation.cc.

References edm::Event::getByToken(), metsig::jet, jet_token, fwrapper::jets, m_algo, JetVertexMain::Main(), EnergyCorrector::pt, edm::Event::put(), query::result, track_token, testEve_cfg::tracks, and vertex_token.

71  {
72 
74  iEvent.getByToken(jet_token, jets);
75 
77  iEvent.getByToken(track_token, tracks);
78 
80  iEvent.getByToken(vertex_token, vertexes);
81 
82  double SIGNAL_V_Z = 0.;
83  double SIGNAL_V_Z_ERROR = 0.;
84  double ptmax = -100.;
85 
86  VertexCollection::const_iterator vert = vertexes->begin ();
87  if(vertexes->size() > 0 ) {
88  for (; vert != vertexes->end (); vert++) {
89 
90  SIGNAL_V_Z = vert->z();
91  double pt = 0.;
92  reco::Vertex::trackRef_iterator tr = vert->tracks_begin();
93  for (; tr != vert->tracks_end(); tr++) pt += (*tr)->pt();
94  if( pt >= ptmax ){
95 
96  ptmax = pt;
97  SIGNAL_V_Z = vert->z();
98  SIGNAL_V_Z_ERROR = vert->zError();
99 
100  }
101 
102  }
103  }
104 
105  pair<double, bool> result;
106  std::auto_ptr<ResultCollection1> result1 (new ResultCollection1) ;
107  std::auto_ptr<ResultCollection2> result2 (new ResultCollection2) ;
108 
109  CaloJetCollection::const_iterator jet = jets->begin ();
110 
111  if(jets->size() > 0 ) {
112  for (; jet != jets->end (); jet++) {
113  result = m_algo.Main(*jet, tracks, SIGNAL_V_Z, SIGNAL_V_Z_ERROR);
114  result1->push_back(result.first);
115  result2->push_back(result.second);
116 
117  }
118  }
119 
120  iEvent.put(result1, "Var");
121  iEvent.put(result2, "JetType");
122 
123  }
std::pair< double, bool > Main(const reco::CaloJet &jet, edm::Handle< reco::TrackCollection > tracks, double SIGNAL_V_Z, double SIGNAL_V_Z_Error)
edm::EDGetTokenT< reco::VertexCollection > vertex_token
edm::EDGetTokenT< reco::TrackCollection > track_token
std::vector< double > ResultCollection1
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
int iEvent
Definition: GenABIO.cc:230
vector< PseudoJet > jets
tuple result
Definition: query.py:137
std::vector< bool > ResultCollection2
tuple tracks
Definition: testEve_cfg.py:39
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37

Member Data Documentation

edm::EDGetTokenT<reco::CaloJetCollection> cms::JetVertexAssociation::jet_token
private

Definition at line 42 of file JetVertexAssociation.h.

Referenced by produce().

JetVertexMain cms::JetVertexAssociation::m_algo
private

Definition at line 41 of file JetVertexAssociation.h.

Referenced by produce().

edm::EDGetTokenT<reco::TrackCollection> cms::JetVertexAssociation::track_token
private

Definition at line 43 of file JetVertexAssociation.h.

Referenced by produce().

edm::EDGetTokenT<reco::VertexCollection> cms::JetVertexAssociation::vertex_token
private

Definition at line 44 of file JetVertexAssociation.h.

Referenced by produce().