CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
MTDTrackQualityMVAProducer Class Reference
Inheritance diagram for MTDTrackQualityMVAProducer:
edm::stream::EDProducer<>

Public Member Functions

template<class H , class T >
void fillValueMap (edm::Event &iEvent, const edm::Handle< H > &handle, const std::vector< T > &vec, const std::string &name) const
 
 MTDTrackQualityMVAProducer (const ParameterSet &pset)
 
void produce (edm::Event &ev, const edm::EventSetup &es) final
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT
< edm::ValueMap< float > > 
btlMatchChi2Token_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
btlMatchTimeChi2Token_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
etlMatchChi2Token_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
etlMatchTimeChi2Token_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
mtdTimeToken_
 
MTDTrackQualityMVA mva_
 
edm::EDGetTokenT
< edm::ValueMap< int > > 
npixBarrelToken_
 
edm::EDGetTokenT
< edm::ValueMap< int > > 
npixEndcapToken_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
pathLengthToken_
 
edm::EDGetTokenT
< reco::TrackCollection
tracksMTDToken_
 
edm::EDGetTokenT
< reco::TrackCollection
tracksToken_
 

Static Private Attributes

static constexpr char mvaName [] = "mtdQualMVA"
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 21 of file MTDTrackQualityMVAProducer.cc.

Constructor & Destructor Documentation

MTDTrackQualityMVAProducer::MTDTrackQualityMVAProducer ( const ParameterSet pset)

Definition at line 53 of file MTDTrackQualityMVAProducer.cc.

References mvaName.

54  : tracksToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
55  btlMatchChi2Token_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("btlMatchChi2Src"))),
57  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("btlMatchTimeChi2Src"))),
58  etlMatchChi2Token_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("etlMatchChi2Src"))),
60  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("etlMatchTimeChi2Src"))),
61  mtdTimeToken_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("mtdTimeSrc"))),
62  pathLengthToken_(consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("pathLengthSrc"))),
63  npixBarrelToken_(consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("npixBarrelSrc"))),
64  npixEndcapToken_(consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("npixEndcapSrc"))),
65  mva_(iConfig.getParameter<edm::FileInPath>("qualityBDT_weights_file").fullPath()) {
66  produces<edm::ValueMap<float>>(mvaName);
67 }
edm::EDGetTokenT< edm::ValueMap< float > > mtdTimeToken_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
edm::EDGetTokenT< edm::ValueMap< float > > etlMatchTimeChi2Token_
edm::EDGetTokenT< edm::ValueMap< float > > btlMatchTimeChi2Token_
edm::EDGetTokenT< edm::ValueMap< float > > btlMatchChi2Token_
edm::EDGetTokenT< edm::ValueMap< int > > npixEndcapToken_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
std::string fullPath() const
Definition: FileInPath.cc:161
edm::EDGetTokenT< edm::ValueMap< float > > etlMatchChi2Token_
edm::EDGetTokenT< edm::ValueMap< int > > npixBarrelToken_

Member Function Documentation

void MTDTrackQualityMVAProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 70 of file MTDTrackQualityMVAProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

70  {
72  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"))->setComment("Input tracks collection");
73  desc.add<edm::InputTag>("btlMatchChi2Src", edm::InputTag("trackExtenderWithMTD", "btlMatchChi2"))
74  ->setComment("BTL Chi2 Matching value Map");
75  desc.add<edm::InputTag>("btlMatchTimeChi2Src", edm::InputTag("trackExtenderWithMTD", "btlMatchTimeChi2"))
76  ->setComment("BTL Chi2 Matching value Map");
77  desc.add<edm::InputTag>("etlMatchChi2Src", edm::InputTag("trackExtenderWithMTD", "etlMatchChi2"))
78  ->setComment("ETL Chi2 Matching value Map");
79  desc.add<edm::InputTag>("etlMatchTimeChi2Src", edm::InputTag("trackExtenderWithMTD", "etlMatchTimeChi2"))
80  ->setComment("ETL Chi2 Matching value Map");
81  desc.add<edm::InputTag>("mtdTimeSrc", edm::InputTag("trackExtenderWithMTD", "generalTracktmtd"))
82  ->setComment("MTD TIme value Map");
83  desc.add<edm::InputTag>("pathLengthSrc", edm::InputTag("trackExtenderWithMTD", "generalTrackPathLength"))
84  ->setComment("MTD PathLength value Map");
85  desc.add<edm::InputTag>("npixBarrelSrc", edm::InputTag("trackExtenderWithMTD", "npixBarrel"))
86  ->setComment("# of Barrel pixel associated to refitted tracks");
87  desc.add<edm::InputTag>("npixEndcapSrc", edm::InputTag("trackExtenderWithMTD", "npixEndcap"))
88  ->setComment("# of Endcap pixel associated to refitted tracks");
89  desc.add<edm::FileInPath>("qualityBDT_weights_file",
90  edm::FileInPath("RecoMTD/TimingIDTools/data/clf4D_MTDquality_bo.xml"))
91  ->setComment("Track MTD quality BDT weights");
92  descriptions.add("mtdTrackQualityMVAProducer", desc);
93 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<class H , class T >
void MTDTrackQualityMVAProducer::fillValueMap ( edm::Event iEvent,
const edm::Handle< H > &  handle,
const std::vector< T > &  vec,
const std::string &  name 
) const

Definition at line 96 of file MTDTrackQualityMVAProducer.cc.

References eostools::move(), submitPVResolutionJobs::out, and edm::Event::put().

Referenced by produce().

99  {
100  auto out = std::make_unique<edm::ValueMap<T>>();
101  typename edm::ValueMap<T>::Filler filler(*out);
102  filler.insert(handle, vec.begin(), vec.end());
103  filler.fill();
104  iEvent.put(std::move(out), name);
105 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
def move
Definition: eostools.py:511
void MTDTrackQualityMVAProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
final

Definition at line 107 of file MTDTrackQualityMVAProducer.cc.

References btlMatchChi2Token_, btlMatchTimeChi2Token_, etlMatchChi2Token_, etlMatchTimeChi2Token_, fillValueMap(), edm::Event::get(), edm::Event::getByToken(), mtdTimeToken_, mva_, mvaName, npixBarrelToken_, npixEndcapToken_, pathLengthToken_, tracks, and tracksToken_.

107  {
109  ev.getByToken(tracksToken_, tracksH);
110  const auto& tracks = *tracksH;
111 
112  const auto& btlMatchChi2 = ev.get(btlMatchChi2Token_);
113  const auto& btlMatchTimeChi2 = ev.get(btlMatchTimeChi2Token_);
114  const auto& etlMatchChi2 = ev.get(etlMatchChi2Token_);
115  const auto& etlMatchTimeChi2 = ev.get(etlMatchTimeChi2Token_);
116  const auto& pathLength = ev.get(pathLengthToken_);
117  const auto& npixBarrel = ev.get(npixBarrelToken_);
118  const auto& npixEndcap = ev.get(npixEndcapToken_);
119  const auto& mtdTime = ev.get(mtdTimeToken_);
120 
121  std::vector<float> mvaOutRaw;
122 
123  //Loop over tracks collection
124  for (unsigned int itrack = 0; itrack < tracks.size(); ++itrack) {
125  const reco::TrackRef trackref(tracksH, itrack);
126  if (pathLength[trackref] == -1.)
127  mvaOutRaw.push_back(-1.);
128  else {
129  mvaOutRaw.push_back(mva_(trackref,
130  npixBarrel,
131  npixEndcap,
132  btlMatchChi2,
133  btlMatchTimeChi2,
134  etlMatchChi2,
135  etlMatchTimeChi2,
136  mtdTime,
137  pathLength));
138  }
139  }
140  fillValueMap(ev, tracksH, mvaOutRaw, mvaName);
141 }
void fillValueMap(edm::Event &iEvent, const edm::Handle< H > &handle, const std::vector< T > &vec, const std::string &name) const
edm::EDGetTokenT< edm::ValueMap< float > > mtdTimeToken_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::ValueMap< float > > etlMatchTimeChi2Token_
auto const & tracks
cannot be loose
edm::EDGetTokenT< edm::ValueMap< float > > btlMatchTimeChi2Token_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::EDGetTokenT< edm::ValueMap< float > > btlMatchChi2Token_
edm::EDGetTokenT< edm::ValueMap< int > > npixEndcapToken_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
edm::EDGetTokenT< edm::ValueMap< float > > etlMatchChi2Token_
edm::EDGetTokenT< edm::ValueMap< int > > npixBarrelToken_

Member Data Documentation

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::btlMatchChi2Token_
private

Definition at line 41 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::btlMatchTimeChi2Token_
private

Definition at line 42 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::etlMatchChi2Token_
private

Definition at line 43 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::etlMatchTimeChi2Token_
private

Definition at line 44 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::mtdTimeToken_
private

Definition at line 45 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

MTDTrackQualityMVA MTDTrackQualityMVAProducer::mva_
private

Definition at line 50 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

constexpr char MTDTrackQualityMVAProducer::mvaName[] = "mtdQualMVA"
staticprivate

Definition at line 36 of file MTDTrackQualityMVAProducer.cc.

Referenced by MTDTrackQualityMVAProducer(), and produce().

edm::EDGetTokenT<edm::ValueMap<int> > MTDTrackQualityMVAProducer::npixBarrelToken_
private

Definition at line 47 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<int> > MTDTrackQualityMVAProducer::npixEndcapToken_
private

Definition at line 48 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<edm::ValueMap<float> > MTDTrackQualityMVAProducer::pathLengthToken_
private

Definition at line 46 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().

edm::EDGetTokenT<reco::TrackCollection> MTDTrackQualityMVAProducer::tracksMTDToken_
private

Definition at line 39 of file MTDTrackQualityMVAProducer.cc.

edm::EDGetTokenT<reco::TrackCollection> MTDTrackQualityMVAProducer::tracksToken_
private

Definition at line 38 of file MTDTrackQualityMVAProducer.cc.

Referenced by produce().