CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackTimingImporter Class Reference
Inheritance diagram for TrackTimingImporter:
BlockElementImporterBase

Public Member Functions

void importToBlock (const edm::Event &, ElementList &) const override
 
 TrackTimingImporter (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
- Public Member Functions inherited from BlockElementImporterBase
 BlockElementImporterBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
 BlockElementImporterBase (const BlockElementImporterBase &)=delete
 
const std::string & name () const
 
BlockElementImporterBaseoperator= (const BlockElementImporterBase &)=delete
 
virtual void updateEventSetup (const edm::EventSetup &)
 
virtual ~BlockElementImporterBase ()=default
 

Private Attributes

const bool debug_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_
 

Additional Inherited Members

- Public Types inherited from BlockElementImporterBase
typedef std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
 

Detailed Description

Definition at line 16 of file TrackTimingImporter.cc.

Constructor & Destructor Documentation

TrackTimingImporter::TrackTimingImporter ( const edm::ParameterSet conf,
edm::ConsumesCollector sumes 
)
inline

Definition at line 18 of file TrackTimingImporter.cc.

References importToBlock().

19  :
20  BlockElementImporterBase(conf,sumes),
21  srcTime_( sumes.consumes<edm::ValueMap<float> >(conf.getParameter<edm::InputTag>("timeValueMap")) ),
22  srcTimeError_( sumes.consumes<edm::ValueMap<float> >(conf.getParameter<edm::InputTag>("timeErrorMap")) ),
23  srcTimeGsf_( sumes.consumes<edm::ValueMap<float> >(conf.getParameter<edm::InputTag>("timeValueMapGsf")) ),
24  srcTimeErrorGsf_( sumes.consumes<edm::ValueMap<float> >(conf.getParameter<edm::InputTag>("timeErrorMapGsf")) ),
25  debug_(conf.getUntrackedParameter<bool>("debug",false)) {
26  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_

Member Function Documentation

void TrackTimingImporter::importToBlock ( const edm::Event e,
BlockElementImporterBase::ElementList elems 
) const
overridevirtual

Implements BlockElementImporterBase.

Definition at line 43 of file TrackTimingImporter.cc.

References debug_, HTMLExport::elem(), edm::Event::getByToken(), reco::PFBlockElement::GSF, srcTime_, srcTimeError_, srcTimeErrorGsf_, srcTimeGsf_, and reco::PFBlockElement::TRACK.

Referenced by TrackTimingImporter().

44  {
46 
47  edm::Handle<edm::ValueMap<float> > timeH, timeErrH, timeGsfH, timeErrGsfH;
48 
49  e.getByToken(srcTime_, timeH);
50  e.getByToken(srcTimeError_, timeErrH);
51  e.getByToken(srcTimeGsf_, timeGsfH);
52  e.getByToken(srcTimeErrorGsf_, timeErrGsfH);
53 
54  for( auto& elem : elems ) {
55  if( reco::PFBlockElement::TRACK == elem->type() ) {
56  const auto& ref = elem->trackRef();
57  if (timeH->contains(ref.id())) {
58  elem->setTime( (*timeH)[ref], (*timeErrH)[ref] );
59  }
60  if( debug_ ) {
61  edm::LogInfo("TrackTimingImporter")
62  << "Track with pT / eta " << ref->pt() << " / " << ref->eta()
63  << " has time: " << elem->time() << " +/- " << elem->timeError() << std::endl;
64  }
65  } else if ( reco::PFBlockElement::GSF == elem->type() ) {
66  const auto& ref = static_cast<const reco::PFBlockElementGsfTrack*>(elem.get())->GsftrackRef();
67  if (timeGsfH->contains(ref.id())) {
68  elem->setTime( (*timeGsfH)[ref], (*timeErrGsfH)[ref] );
69  }
70  if( debug_ ) {
71  edm::LogInfo("TrackTimingImporter")
72  << "Track with pT / eta " << ref->pt() << " / " << ref->eta()
73  << " has time: " << elem->time() << " +/- " << elem->timeError() << std::endl;
74  }
75  }
76  }
77 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_

Member Data Documentation

const bool TrackTimingImporter::debug_
private

Definition at line 34 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<edm::ValueMap<float> > TrackTimingImporter::srcTime_
private

Definition at line 33 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<edm::ValueMap<float> > TrackTimingImporter::srcTimeError_
private

Definition at line 33 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<edm::ValueMap<float> > TrackTimingImporter::srcTimeErrorGsf_
private

Definition at line 33 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT<edm::ValueMap<float> > TrackTimingImporter::srcTimeGsf_
private

Definition at line 33 of file TrackTimingImporter.cc.

Referenced by importToBlock().