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 | Private Types | Private Member Functions | Private Attributes
TrackMCQuality Class Referencefinal

#include <SimTracker/TrackMCQuality/src/TrackMCQuality.cc>

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

Public Member Functions

 TrackMCQuality (const edm::ParameterSet &)
 
 ~TrackMCQuality ()
 
- 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 (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

using Product = std::vector< float >
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< reco::TrackToTrackingParticleAssociator
label_assoc
 
edm::EDGetTokenT
< TrackingParticleCollection
label_tp
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
label_tr
 

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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file TrackMCQuality.cc.

Member Typedef Documentation

using TrackMCQuality::Product = std::vector<float>
private

Definition at line 56 of file TrackMCQuality.cc.

Constructor & Destructor Documentation

TrackMCQuality::TrackMCQuality ( const edm::ParameterSet pset)
explicit

Definition at line 72 of file TrackMCQuality.cc.

72  :
73  label_assoc(consumes<reco::TrackToTrackingParticleAssociator>(pset.getParameter< edm::InputTag >("associator"))),
74  label_tp(consumes<TrackingParticleCollection>(pset.getParameter< edm::InputTag >("trackingParticles"))),
76 {
77  produces<Product>();
78 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
edm::EDGetTokenT< TrackingParticleCollection > label_tp
TrackMCQuality::~TrackMCQuality ( )

Definition at line 81 of file TrackMCQuality.cc.

82 {
83 }

Member Function Documentation

void TrackMCQuality::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 92 of file TrackMCQuality.cc.

References plotBeamSpotDB::first, edm::Event::getByToken(), label_assoc, label_tp, label_tr, eostools::move(), parseEventContent::prod, edm::Event::put(), ecalTPGAnalyzer_cfg::TPCollection, and HLT_25ns14e33_v3_cff::trackCollection.

93 {
94 
95  using namespace edm;
97  iEvent.getByToken(label_assoc,associator);
98 
101 
104 
105  reco::RecoToSimCollection recSimColl=associator->associateRecoToSim(trackCollection,
106  TPCollection);
107 
108  //then loop the track collection
109  std::unique_ptr<Product> product(new Product(trackCollection->size(),0));
110 
111 
112  for (unsigned int iT=0;iT!=trackCollection->size();++iT){
113  auto & prod = (*product)[iT];
114 
116 
117  //find it in the map
118  if (recSimColl.find(track)==recSimColl.end()) continue;
119 
120  auto const & tp = recSimColl[track];
121 
122  if (tp.empty()) continue; // can it be?
123  // nSimHits = tp[0].first->numberOfTrackerHits();
124  prod = tp[0].second;
125  // if (tp[0].first->charge() != track->charge()) isChargeMatched = false;
126  if ( (tp[0].first->eventId().event() != 0) || (tp[0].first->eventId().bunchCrossing() != 0) ) prod=-prod;
127 
128 
129  }
130 
131  iEvent.put(std::move(product));
132 }
edm::EDGetTokenT< edm::View< reco::Track > > label_tr
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< float > Product
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
def move
Definition: eostools.py:510
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > label_assoc
edm::EDGetTokenT< TrackingParticleCollection > label_tp

Member Data Documentation

edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> TrackMCQuality::label_assoc
private

Definition at line 52 of file TrackMCQuality.cc.

Referenced by produce().

edm::EDGetTokenT<TrackingParticleCollection> TrackMCQuality::label_tp
private

Definition at line 53 of file TrackMCQuality.cc.

Referenced by produce().

edm::EDGetTokenT<edm::View<reco::Track> > TrackMCQuality::label_tr
private

Definition at line 54 of file TrackMCQuality.cc.

Referenced by produce().