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::get(), reco::PFBlockElement::GSF, srcTime_, srcTimeError_, srcTimeErrorGsf_, srcTimeGsf_, protons_cff::time, and reco::PFBlockElement::TRACK.

Referenced by TrackTimingImporter().

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