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 BlockElementImporterBase &)=delete
 
 BlockElementImporterBase (const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
 
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_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQuality_
 
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQualityGsf_
 
const double timeQualityThreshold_
 
const bool useTimeQuality_
 

Additional Inherited Members

- Public Types inherited from BlockElementImporterBase
typedef std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
 
enum  VetoMode { pfRecTrackCollection = 0, ticlSeedingRegion = 1, pfCandidateCollection = 2 }
 

Detailed Description

Definition at line 15 of file TrackTimingImporter.cc.

Constructor & Destructor Documentation

◆ TrackTimingImporter()

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

Definition at line 17 of file TrackTimingImporter.cc.

18  : BlockElementImporterBase(conf, sumes),
19  useTimeQuality_(conf.existsAs<edm::InputTag>("timeQualityMap")),
20  timeQualityThreshold_(useTimeQuality_ ? conf.getParameter<double>("timeQualityThreshold") : -99.),
21  srcTime_(sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeValueMap"))),
24  ? sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeQualityMap"))
26  srcTimeGsf_(sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeValueMapGsf"))),
29  conf.getParameter<edm::InputTag>("timeQualityMapGsf"))
31  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}

Member Function Documentation

◆ importToBlock()

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

Implements BlockElementImporterBase.

Definition at line 45 of file TrackTimingImporter.cc.

45  {
47 
48  auto const& time = e.get(srcTime_);
49  auto const& timeErr = e.get(srcTimeError_);
50  auto const& timeGsf = e.get(srcTimeGsf_);
51  auto const& timeErrGsf = e.get(srcTimeErrorGsf_);
52 
53  edm::Handle<edm::ValueMap<float>> timeQualH, timeQualGsfH;
54  if (useTimeQuality_) {
55  e.getByToken(srcTimeQuality_, timeQualH);
56  e.getByToken(srcTimeQualityGsf_, timeQualGsfH);
57  }
58 
59  for (auto& elem : elems) {
60  if (reco::PFBlockElement::TRACK == elem->type()) {
61  const auto& ref = elem->trackRef();
62  if (time.contains(ref.id())) {
63  const bool assocQuality = useTimeQuality_ ? (*timeQualH)[ref] > timeQualityThreshold_ : true;
64  if (assocQuality) {
65  elem->setTime(time[ref], timeErr[ref]);
66  } else {
67  elem->setTime(0., -1.);
68  }
69  }
70  if (debug_) {
71  edm::LogInfo("TrackTimingImporter")
72  << "Track with pT / eta " << ref->pt() << " / " << ref->eta() << " has time: " << elem->time() << " +/- "
73  << elem->timeError() << std::endl;
74  }
75  } else if (reco::PFBlockElement::GSF == elem->type()) {
76  const auto& ref = static_cast<const reco::PFBlockElementGsfTrack*>(elem.get())->GsftrackRef();
77  if (timeGsf.contains(ref.id())) {
78  const bool assocQuality = useTimeQuality_ ? (*timeQualGsfH)[ref] > timeQualityThreshold_ : true;
79  if (assocQuality) {
80  elem->setTime(timeGsf[ref], timeErrGsf[ref]);
81  } else {
82  elem->setTime(0., -1.);
83  }
84  }
85  if (debug_) {
86  edm::LogInfo("TrackTimingImporter")
87  << "Track with pT / eta " << ref->pt() << " / " << ref->eta() << " has time: " << elem->time() << " +/- "
88  << elem->timeError() << std::endl;
89  }
90  }
91  }
92 }

References debug_, MillePedeFileConverter_cfg::e, reco::PFBlockElement::GSF, srcTime_, srcTimeError_, srcTimeErrorGsf_, srcTimeGsf_, srcTimeQuality_, srcTimeQualityGsf_, protons_cff::time, timeQualityThreshold_, reco::PFBlockElement::TRACK, and useTimeQuality_.

Member Data Documentation

◆ debug_

const bool TrackTimingImporter::debug_
private

Definition at line 40 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTime_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeError_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeErrorGsf_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeGsf_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeQuality_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeQualityGsf_

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

Definition at line 38 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ timeQualityThreshold_

const double TrackTimingImporter::timeQualityThreshold_
private

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ useTimeQuality_

const bool TrackTimingImporter::useTimeQuality_
private

Definition at line 36 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT
Definition: EDGetToken.h:33
TrackTimingImporter::srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
Definition: TrackTimingImporter.cc:38
protons_cff.time
time
Definition: protons_cff.py:39
TrackTimingImporter::srcTimeGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_
Definition: TrackTimingImporter.cc:38
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::Handle
Definition: AssociativeIterator.h:50
TrackTimingImporter::debug_
const bool debug_
Definition: TrackTimingImporter.cc:40
BlockElementImporterBase::BlockElementImporterBase
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Definition: BlockElementImporterBase.h:17
reco::PFBlockElement::TRACK
Definition: PFBlockElement.h:32
TrackTimingImporter::srcTimeErrorGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
Definition: TrackTimingImporter.cc:38
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
reco::PFBlockElement::GSF
Definition: PFBlockElement.h:37
TrackTimingImporter::srcTimeQuality_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQuality_
Definition: TrackTimingImporter.cc:38
TrackTimingImporter::srcTime_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
Definition: TrackTimingImporter.cc:38
TrackTimingImporter::timeQualityThreshold_
const double timeQualityThreshold_
Definition: TrackTimingImporter.cc:37
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::ValueMap< float >
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackTimingImporter::srcTimeQualityGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQualityGsf_
Definition: TrackTimingImporter.cc:38
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackTimingImporter::useTimeQuality_
const bool useTimeQuality_
Definition: TrackTimingImporter.cc:36