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 | 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=nullptr, const edm::EventSetup *setup=nullptr) 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=nullptr, const edm::EventSetup *setup=nullptr) const
 Association Sim To Reco with Collections. More...
 
 MuonAssociatorByHits (const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
 
virtual ~MuonAssociatorByHits ()
 

Private Attributes

CSCHitAssociator::Config cscHitAssociatorConfig_
 
std::unique_ptr
< muonAssociatorByHitsDiagnostics::InputDumper
diagnostics_
 
DTHitAssociator::Config dtHitAssociatorConfig_
 
GEMHitAssociator::Config gemHitAssociatorConfig_
 
MuonAssociatorByHitsHelper helper_
 
RPCHitAssociator::Config rpcHitAssociatorConfig_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
ttopoToken_
 

Detailed Description

Definition at line 31 of file MuonAssociatorByHits.h.

Constructor & Destructor Documentation

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

Definition at line 139 of file MuonAssociatorByHits.cc.

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

140  : helper_(conf),
142  gemHitAssociatorConfig_(conf, iC),
143  rpcHitAssociatorConfig_(conf, iC),
144  cscHitAssociatorConfig_(conf, iC),
145  dtHitAssociatorConfig_(conf, iC),
146  ttopoToken_(iC.esConsumes()) {
147  // hack for consumes
148  if (conf.getUntrackedParameter<bool>("dumpInputCollections")) {
149  diagnostics_ = std::make_unique<InputDumper>(conf, std::move(iC));
150  }
151 }
T getUntrackedParameter(std::string const &, T const &) const
GEMHitAssociator::Config gemHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumper > diagnostics_
def move
Definition: eostools.py:511
CSCHitAssociator::Config cscHitAssociatorConfig_
RPCHitAssociator::Config rpcHitAssociatorConfig_
MuonAssociatorByHitsHelper helper_
DTHitAssociator::Config dtHitAssociatorConfig_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
MuonAssociatorByHits::~MuonAssociatorByHits ( )
virtual

Definition at line 153 of file MuonAssociatorByHits.cc.

153 {}

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

41  {
43  for (unsigned int j = 0; j < tCH->size(); j++)
44  tc.push_back(tCH->refAt(j));
45 
47  for (unsigned int j = 0; j < tPCH->size(); j++)
49 
50  return associateRecoToSim(tc, tpc, event, setup);
51  }
ProductID id() const
Definition: HandleBase.cc:29
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&lt;C, T&gt; 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 = nullptr,
const edm::EventSetup setup = nullptr 
) const

Association Reco To Sim with Collections.

Definition at line 155 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateRecoToSimIndices(), edm::RefToBaseVector< T >::begin(), cscHitAssociatorConfig_, MuonAssociatorByHitsHelper::Resources::diagnostics_, diagnostics_, dtHitAssociatorConfig_, alignCSCRings::e, edm::RefToBaseVector< T >::end(), gemHitAssociatorConfig_, edm::EventSetup::getData(), helper_, edm::Event::productGetter(), mps_fire::resources, rpcHitAssociatorConfig_, trackerHitAssociatorConfig_, and ttopoToken_.

159  {
160  RecoToSimCollection outputCollection(&e->productGetter());
161 
163  for (auto it = tC.begin(), ed = tC.end(); it != ed; ++it) {
164  tH.push_back(std::make_pair((*it)->recHitsBegin(), (*it)->recHitsEnd()));
165  }
166 
167  // Retrieve tracker topology from geometry
168  const TrackerTopology *tTopo = &setup->getData(ttopoToken_);
169 
170  // Tracker hit association
172  // CSC hit association
173  CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_);
174  // DT hit association
175  bool printRtS(true);
176  DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS);
177  // RPC hit association
179  // GEM hit association
181 
183  tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}};
184 
185  if (diagnostics_) {
186  resources.diagnostics_ = [this, e](const TrackHitsCollection &hC, const TrackingParticleCollection &pC) {
187  diagnostics_->dump(hC, pC, *e);
188  };
189  }
190 
191  auto bareAssoc = helper_.associateRecoToSimIndices(tH, TPCollectionH, resources);
192  for (auto it = bareAssoc.begin(), ed = bareAssoc.end(); it != ed; ++it) {
193  for (auto itma = it->second.begin(), edma = it->second.end(); itma != edma; ++itma) {
194  outputCollection.insert(tC[it->first], std::make_pair(TPCollectionH[itma->idx], itma->quality));
195  }
196  }
197 
198  outputCollection.post_insert(); // perhaps not even necessary
199  return outputCollection;
200 }
GEMHitAssociator::Config gemHitAssociatorConfig_
std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_
const_iterator end() const
tuple resources
Definition: mps_fire.py:263
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumper > diagnostics_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
CSCHitAssociator::Config cscHitAssociatorConfig_
MuonAssociatorByHitsHelper::TrackHitsCollection TrackHitsCollection
RPCHitAssociator::Config rpcHitAssociatorConfig_
const_iterator begin() const
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
MuonAssociatorByHitsHelper helper_
std::vector< TrackingParticle > TrackingParticleCollection
DTHitAssociator::Config dtHitAssociatorConfig_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
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 53 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().

56  {
58  for (unsigned int j = 0; j < tCH->size(); j++)
59  tc.push_back(tCH->refAt(j));
60 
62  for (unsigned int j = 0; j < tPCH->size(); j++)
64 
65  return associateSimToReco(tc, tpc, event, setup);
66  }
ProductID id() const
Definition: HandleBase.cc:29
void push_back(const RefToBase< T > &)
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; 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 = nullptr,
const edm::EventSetup setup = nullptr 
) const

Association Sim To Reco with Collections.

Definition at line 202 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateSimToRecoIndices(), edm::RefToBaseVector< T >::begin(), cscHitAssociatorConfig_, dtHitAssociatorConfig_, edm::RefToBaseVector< T >::end(), gemHitAssociatorConfig_, edm::EventSetup::getData(), helper_, edm::Event::productGetter(), mps_fire::resources, rpcHitAssociatorConfig_, trackerHitAssociatorConfig_, and ttopoToken_.

206  {
207  SimToRecoCollection outputCollection(&e->productGetter());
209  for (auto it = tC.begin(), ed = tC.end(); it != ed; ++it) {
210  tH.push_back(std::make_pair((*it)->recHitsBegin(), (*it)->recHitsEnd()));
211  }
212 
213  // Retrieve tracker topology from geometry
214  const TrackerTopology *tTopo = &setup->getData(ttopoToken_);
215 
216  // Tracker hit association
218  // CSC hit association
219  CSCHitAssociator csctruth(*e, *setup, cscHitAssociatorConfig_);
220  // DT hit association
221  bool printRtS = false;
222  DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS);
223  // RPC hit association
225  // GEM hit association
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 }
GEMHitAssociator::Config gemHitAssociatorConfig_
const_iterator end() const
tuple resources
Definition: mps_fire.py:263
TrackerHitAssociator::Config trackerHitAssociatorConfig_
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
bool getData(T &iHolder) const
Definition: EventSetup.h:128
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
CSCHitAssociator::Config cscHitAssociatorConfig_
RPCHitAssociator::Config rpcHitAssociatorConfig_
const_iterator begin() const
MuonAssociatorByHitsHelper helper_
DTHitAssociator::Config dtHitAssociatorConfig_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_

Member Data Documentation

CSCHitAssociator::Config MuonAssociatorByHits::cscHitAssociatorConfig_
private

Definition at line 86 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

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

Definition at line 90 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and MuonAssociatorByHits().

DTHitAssociator::Config MuonAssociatorByHits::dtHitAssociatorConfig_
private

Definition at line 87 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

GEMHitAssociator::Config MuonAssociatorByHits::gemHitAssociatorConfig_
private

Definition at line 84 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

MuonAssociatorByHitsHelper MuonAssociatorByHits::helper_
private

Definition at line 82 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

RPCHitAssociator::Config MuonAssociatorByHits::rpcHitAssociatorConfig_
private

Definition at line 85 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

TrackerHitAssociator::Config MuonAssociatorByHits::trackerHitAssociatorConfig_
private

Definition at line 83 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> MuonAssociatorByHits::ttopoToken_
private

Definition at line 89 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().