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
 

Detailed Description

Definition at line 14 of file TrackTimingImporter.cc.

Constructor & Destructor Documentation

◆ TrackTimingImporter()

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

Definition at line 16 of file TrackTimingImporter.cc.

17  : BlockElementImporterBase(conf, sumes),
18  useTimeQuality_(conf.existsAs<edm::InputTag>("timeQualityMap")),
19  timeQualityThreshold_(useTimeQuality_ ? conf.getParameter<double>("timeQualityThreshold") : -99.),
20  srcTime_(sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeValueMap"))),
23  ? sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeQualityMap"))
25  srcTimeGsf_(sumes.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeValueMapGsf"))),
28  conf.getParameter<edm::InputTag>("timeQualityMapGsf"))
30  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 44 of file TrackTimingImporter.cc.

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

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

Member Data Documentation

◆ debug_

const bool TrackTimingImporter::debug_
private

Definition at line 39 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTime_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeError_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeErrorGsf_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeGsf_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeQuality_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ srcTimeQualityGsf_

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

Definition at line 37 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ timeQualityThreshold_

const double TrackTimingImporter::timeQualityThreshold_
private

Definition at line 36 of file TrackTimingImporter.cc.

Referenced by importToBlock().

◆ useTimeQuality_

const bool TrackTimingImporter::useTimeQuality_
private

Definition at line 35 of file TrackTimingImporter.cc.

Referenced by importToBlock().

edm::EDGetTokenT
Definition: EDGetToken.h:33
TrackTimingImporter::srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
Definition: TrackTimingImporter.cc:37
TrackTimingImporter::srcTimeGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_
Definition: TrackTimingImporter.cc:37
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:39
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:37
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:37
TrackTimingImporter::srcTime_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
Definition: TrackTimingImporter.cc:37
TrackTimingImporter::timeQualityThreshold_
const double timeQualityThreshold_
Definition: TrackTimingImporter.cc:36
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
ntuplemaker.time
time
Definition: ntuplemaker.py:310
TrackTimingImporter::srcTimeQualityGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQualityGsf_
Definition: TrackTimingImporter.cc:37
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackTimingImporter::useTimeQuality_
const bool useTimeQuality_
Definition: TrackTimingImporter.cc:35