CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MuonAssociatorByHits Class Reference

#include <MuonAssociatorByHits.h>

Public Member Functions

reco::RecoToSimCollection associateRecoToSim (edm::Handle< edm::View< reco::Track >> &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
 
reco::RecoToSimCollection associateRecoToSim (const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 Association Reco To Sim with Collections. More...
 
virtual reco::SimToRecoCollection associateSimToReco (edm::Handle< edm::View< reco::Track >> &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
 
reco::SimToRecoCollection associateSimToReco (const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
 Association Sim To Reco with Collections. More...
 
 MuonAssociatorByHits (const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
 
virtual ~MuonAssociatorByHits ()
 

Private Attributes

edm::ParameterSet const conf_
 
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumperdiagnostics_
 
MuonAssociatorByHitsHelper helper_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 

Detailed Description

Definition at line 25 of file MuonAssociatorByHits.h.

Constructor & Destructor Documentation

MuonAssociatorByHits::MuonAssociatorByHits ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)

Definition at line 137 of file MuonAssociatorByHits.cc.

References diagnostics_, edm::ParameterSet::getUntrackedParameter(), and eostools::move().

138  : helper_(conf), conf_(conf), trackerHitAssociatorConfig_(conf, std::move(iC)) {
139  // hack for consumes
140  RPCHitAssociator rpctruth(conf, std::move(iC));
141  GEMHitAssociator gemtruth(conf, std::move(iC));
142  DTHitAssociator dttruth(conf, std::move(iC));
143  CSCHitAssociator muonTruth(conf, std::move(iC));
144  if (conf.getUntrackedParameter<bool>("dumpInputCollections")) {
145  diagnostics_.reset(new InputDumper(conf, std::move(iC)));
146  }
147 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet const conf_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumper > diagnostics_
MuonAssociatorByHitsHelper helper_
def move(src, dest)
Definition: eostools.py:511
MuonAssociatorByHits::~MuonAssociatorByHits ( )
virtual

Definition at line 149 of file MuonAssociatorByHits.cc.

149 {}

Member Function Documentation

reco::RecoToSimCollection MuonAssociatorByHits::associateRecoToSim ( edm::Handle< edm::View< reco::Track >> &  tCH,
edm::Handle< TrackingParticleCollection > &  tPCH,
const edm::Event event,
const edm::EventSetup setup 
) const
inline

Definition at line 32 of file MuonAssociatorByHits.h.

References edm::HandleBase::id(), dqmiolumiharvest::j, edm::RefToBaseVector< T >::push_back(), and edm::RefVector< C, T, F >::push_back().

Referenced by MuonAssociatorEDProducer::produce().

35  {
37  for (unsigned int j = 0; j < tCH->size(); j++)
38  tc.push_back(tCH->refAt(j));
39 
41  for (unsigned int j = 0; j < tPCH->size(); j++)
43 
44  return associateRecoToSim(tc, tpc, event, setup);
45  }
ProductID id() const
Definition: HandleBase.cc:13
reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track >> &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
RecoToSimCollection MuonAssociatorByHits::associateRecoToSim ( const edm::RefToBaseVector< reco::Track > &  tC,
const edm::RefVector< TrackingParticleCollection > &  TPCollectionH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const

Association Reco To Sim with Collections.

Definition at line 151 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateRecoToSimIndices(), edm::RefToBaseVector< T >::begin(), conf_, MuonAssociatorByHitsHelper::Resources::diagnostics_, diagnostics_, MillePedeFileConverter_cfg::e, edm::RefToBaseVector< T >::end(), edm::EventSetup::get(), helper_, edm::ESHandle< T >::product(), edm::Event::productGetter(), mps_fire::resources, and trackerHitAssociatorConfig_.

155  {
156  RecoToSimCollection outputCollection(&e->productGetter());
157 
159  for (auto it = tC.begin(), ed = tC.end(); it != ed; ++it) {
160  tH.push_back(std::make_pair((*it)->recHitsBegin(), (*it)->recHitsEnd()));
161  }
162 
163  // Retrieve tracker topology from geometry
165  setup->get<TrackerTopologyRcd>().get(tTopoHand);
166  const TrackerTopology *tTopo = tTopoHand.product();
167 
168  // Tracker hit association
170  // CSC hit association
171  CSCHitAssociator csctruth(*e, *setup, conf_);
172  // DT hit association
173  bool printRtS(true);
174  DTHitAssociator dttruth(*e, *setup, conf_, printRtS);
175  // RPC hit association
176  RPCHitAssociator rpctruth(*e, *setup, conf_);
177  // GEM hit association
178  GEMHitAssociator gemtruth(*e, *setup, conf_);
179 
181  tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}};
182 
183  if (diagnostics_) {
184  resources.diagnostics_ = [this, e](const TrackHitsCollection &hC, const TrackingParticleCollection &pC) {
185  diagnostics_->dump(hC, pC, *e);
186  };
187  }
188 
189  auto bareAssoc = helper_.associateRecoToSimIndices(tH, TPCollectionH, resources);
190  for (auto it = bareAssoc.begin(), ed = bareAssoc.end(); it != ed; ++it) {
191  for (auto itma = it->second.begin(), edma = it->second.end(); itma != edma; ++itma) {
192  outputCollection.insert(tC[it->first], std::make_pair(TPCollectionH[itma->idx], itma->quality));
193  }
194  }
195 
196  outputCollection.post_insert(); // perhaps not even necessary
197  return outputCollection;
198 }
edm::ParameterSet const conf_
std::vector< TrackingParticle > TrackingParticleCollection
std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_
const_iterator end() const
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumper > diagnostics_
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
MuonAssociatorByHitsHelper::TrackHitsCollection TrackHitsCollection
const_iterator begin() const
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
T get() const
Definition: EventSetup.h:73
MuonAssociatorByHitsHelper helper_
T const * product() const
Definition: ESHandle.h:86
virtual reco::SimToRecoCollection MuonAssociatorByHits::associateSimToReco ( edm::Handle< edm::View< reco::Track >> &  tCH,
edm::Handle< TrackingParticleCollection > &  tPCH,
const edm::Event event,
const edm::EventSetup setup 
) const
inlinevirtual

Definition at line 47 of file MuonAssociatorByHits.h.

References edm::HandleBase::id(), dqmiolumiharvest::j, edm::RefToBaseVector< T >::push_back(), edm::RefVector< C, T, F >::push_back(), and singleTopDQM_cfi::setup.

Referenced by MuonAssociatorEDProducer::produce().

50  {
52  for (unsigned int j = 0; j < tCH->size(); j++)
53  tc.push_back(tCH->refAt(j));
54 
56  for (unsigned int j = 0; j < tPCH->size(); j++)
58 
59  return associateSimToReco(tc, tpc, event, setup);
60  }
ProductID id() const
Definition: HandleBase.cc:13
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track >> &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
SimToRecoCollection MuonAssociatorByHits::associateSimToReco ( const edm::RefToBaseVector< reco::Track > &  tC,
const edm::RefVector< TrackingParticleCollection > &  TPCollectionH,
const edm::Event event = 0,
const edm::EventSetup setup = 0 
) const

Association Sim To Reco with Collections.

Definition at line 200 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateSimToRecoIndices(), edm::RefToBaseVector< T >::begin(), conf_, edm::RefToBaseVector< T >::end(), edm::EventSetup::get(), helper_, edm::ESHandle< T >::product(), edm::Event::productGetter(), mps_fire::resources, and trackerHitAssociatorConfig_.

204  {
205  SimToRecoCollection outputCollection(&e->productGetter());
207  for (auto it = tC.begin(), ed = tC.end(); it != ed; ++it) {
208  tH.push_back(std::make_pair((*it)->recHitsBegin(), (*it)->recHitsEnd()));
209  }
210 
211  // Retrieve tracker topology from geometry
213  setup->get<TrackerTopologyRcd>().get(tTopoHand);
214  const TrackerTopology *tTopo = tTopoHand.product();
215 
216  // Tracker hit association
218  // CSC hit association
219  CSCHitAssociator csctruth(*e, *setup, conf_);
220  // DT hit association
221  bool printRtS = false;
222  DTHitAssociator dttruth(*e, *setup, conf_, printRtS);
223  // RPC hit association
224  RPCHitAssociator rpctruth(*e, *setup, conf_);
225  // GEM hit association
226  GEMHitAssociator gemtruth(*e, *setup, conf_);
227 
229  tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}};
230 
231  auto bareAssoc = helper_.associateSimToRecoIndices(tH, TPCollectionH, resources);
232  for (auto it = bareAssoc.begin(), ed = bareAssoc.end(); it != ed; ++it) {
233  for (auto itma = it->second.begin(), edma = it->second.end(); itma != edma; ++itma) {
234  outputCollection.insert(TPCollectionH[it->first], std::make_pair(tC[itma->idx], itma->quality));
235  }
236  }
237 
238  outputCollection.post_insert(); // perhaps not even necessary
239  return outputCollection;
240 }
edm::ParameterSet const conf_
const_iterator end() const
TrackerHitAssociator::Config trackerHitAssociatorConfig_
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
const_iterator begin() const
T get() const
Definition: EventSetup.h:73
MuonAssociatorByHitsHelper helper_
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

edm::ParameterSet const MuonAssociatorByHits::conf_
private

Definition at line 77 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

std::unique_ptr<muonAssociatorByHitsDiagnostics::InputDumper> MuonAssociatorByHits::diagnostics_
private

Definition at line 80 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and MuonAssociatorByHits().

MuonAssociatorByHitsHelper MuonAssociatorByHits::helper_
private

Definition at line 76 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

TrackerHitAssociator::Config MuonAssociatorByHits::trackerHitAssociatorConfig_
private

Definition at line 78 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().