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 &cc)
 
- Public Member Functions inherited from BlockElementImporterBase
 BlockElementImporterBase (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 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_
 
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 cc 
)
inline

Definition at line 17 of file TrackTimingImporter.cc.

18  : BlockElementImporterBase(conf, cc),
19  useTimeQuality_(conf.existsAs<edm::InputTag>("timeQualityMap")),
20  timeQualityThreshold_(useTimeQuality_ ? conf.getParameter<double>("timeQualityThreshold") : -99.),
24  ? cc.consumes<edm::ValueMap<float>>(conf.getParameter<edm::InputTag>("timeQualityMap"))
31  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQuality_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
BlockElementImporterBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
const double timeQualityThreshold_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQualityGsf_

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.

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

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 }
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQuality_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeErrorGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_
const double timeQualityThreshold_
Log< level::Info, false > LogInfo
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeGsf_
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeQualityGsf_

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().