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=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::InputDumperdiagnostics_
 
DTHitAssociator::Config dtHitAssociatorConfig_
 
GEMHitAssociator::Config gemHitAssociatorConfig_
 
MuonAssociatorByHitsHelper helper_
 
RPCHitAssociator::Config rpcHitAssociatorConfig_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdttopoToken_
 

Detailed Description

Definition at line 31 of file MuonAssociatorByHits.h.

Constructor & Destructor Documentation

◆ MuonAssociatorByHits()

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

Definition at line 135 of file MuonAssociatorByHits.cc.

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

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

◆ ~MuonAssociatorByHits()

MuonAssociatorByHits::~MuonAssociatorByHits ( )
virtual

Definition at line 149 of file MuonAssociatorByHits.cc.

149 {}

Member Function Documentation

◆ associateRecoToSim() [1/2]

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(), edm::RefVector< C, T, F >::push_back(), and singleTopDQM_cfi::setup.

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  }
reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track >> &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
ProductID id() const
Definition: HandleBase.cc:29
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
Definition: event.py:1

◆ associateRecoToSim() [2/2]

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 151 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateRecoToSimIndices(), edm::RefToBaseVector< T >::begin(), cscHitAssociatorConfig_, diagnostics_, dtHitAssociatorConfig_, MillePedeFileConverter_cfg::e, edm::RefToBaseVector< T >::end(), gemHitAssociatorConfig_, helper_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, valuemaptraslator_cfi::outputCollection, mps_fire::resources, rpcHitAssociatorConfig_, singleTopDQM_cfi::setup, trackerHitAssociatorConfig_, and ttopoToken_.

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
164  const TrackerTopology *tTopo = &setup->getData(ttopoToken_);
165 
166  // Tracker hit association
168  // CSC hit association
170  // DT hit association
171  bool printRtS(true);
172  DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS);
173  // RPC hit association
175  // GEM hit association
177 
179  tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}};
180 
181  if (diagnostics_) {
182  resources.diagnostics_ = [this, e](const TrackHitsCollection &hC, const TrackingParticleCollection &pC) {
183  diagnostics_->dump(hC, pC, *e);
184  };
185  }
186 
187  auto bareAssoc = helper_.associateRecoToSimIndices(tH, TPCollectionH, resources);
188  for (auto it = bareAssoc.begin(), ed = bareAssoc.end(); it != ed; ++it) {
189  for (auto itma = it->second.begin(), edma = it->second.end(); itma != edma; ++itma) {
190  outputCollection.insert(tC[it->first], std::make_pair(TPCollectionH[itma->idx], itma->quality));
191  }
192  }
193 
194  outputCollection.post_insert(); // perhaps not even necessary
195  return outputCollection;
196 }
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
GEMHitAssociator::Config gemHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::unique_ptr< muonAssociatorByHitsDiagnostics::InputDumper > diagnostics_
const_iterator begin() const
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
const_iterator end() const
CSCHitAssociator::Config cscHitAssociatorConfig_
MuonAssociatorByHitsHelper::TrackHitsCollection TrackHitsCollection
RPCHitAssociator::Config rpcHitAssociatorConfig_
MuonAssociatorByHitsHelper helper_
std::vector< TrackingParticle > TrackingParticleCollection
DTHitAssociator::Config dtHitAssociatorConfig_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_

◆ associateSimToReco() [1/2]

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(), edm::RefVector< C, T, F >::push_back(), and singleTopDQM_cfi::setup.

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
virtual reco::SimToRecoCollection associateSimToReco(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
Definition: event.py:1

◆ associateSimToReco() [2/2]

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 198 of file MuonAssociatorByHits.cc.

References MuonAssociatorByHitsHelper::associateSimToRecoIndices(), edm::RefToBaseVector< T >::begin(), cscHitAssociatorConfig_, dtHitAssociatorConfig_, MillePedeFileConverter_cfg::e, edm::RefToBaseVector< T >::end(), gemHitAssociatorConfig_, helper_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, valuemaptraslator_cfi::outputCollection, mps_fire::resources, rpcHitAssociatorConfig_, singleTopDQM_cfi::setup, trackerHitAssociatorConfig_, and ttopoToken_.

202  {
203  SimToRecoCollection outputCollection(&e->productGetter());
205  for (auto it = tC.begin(), ed = tC.end(); it != ed; ++it) {
206  tH.push_back(std::make_pair((*it)->recHitsBegin(), (*it)->recHitsEnd()));
207  }
208 
209  // Retrieve tracker topology from geometry
210  const TrackerTopology *tTopo = &setup->getData(ttopoToken_);
211 
212  // Tracker hit association
214  // CSC hit association
216  // DT hit association
217  bool printRtS = false;
218  DTHitAssociator dttruth(*e, *setup, dtHitAssociatorConfig_, printRtS);
219  // RPC hit association
221  // GEM hit association
223 
225  tTopo, &trackertruth, &csctruth, &dttruth, &rpctruth, &gemtruth, {}};
226 
227  auto bareAssoc = helper_.associateSimToRecoIndices(tH, TPCollectionH, resources);
228  for (auto it = bareAssoc.begin(), ed = bareAssoc.end(); it != ed; ++it) {
229  for (auto itma = it->second.begin(), edma = it->second.end(); itma != edma; ++itma) {
230  outputCollection.insert(TPCollectionH[it->first], std::make_pair(tC[itma->idx], itma->quality));
231  }
232  }
233 
234  outputCollection.post_insert(); // perhaps not even necessary
235  return outputCollection;
236 }
GEMHitAssociator::Config gemHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
const_iterator begin() const
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
const_iterator end() const
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
CSCHitAssociator::Config cscHitAssociatorConfig_
RPCHitAssociator::Config rpcHitAssociatorConfig_
MuonAssociatorByHitsHelper helper_
DTHitAssociator::Config dtHitAssociatorConfig_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_

Member Data Documentation

◆ cscHitAssociatorConfig_

CSCHitAssociator::Config MuonAssociatorByHits::cscHitAssociatorConfig_
private

Definition at line 86 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ diagnostics_

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

Definition at line 90 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and MuonAssociatorByHits().

◆ dtHitAssociatorConfig_

DTHitAssociator::Config MuonAssociatorByHits::dtHitAssociatorConfig_
private

Definition at line 87 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ gemHitAssociatorConfig_

GEMHitAssociator::Config MuonAssociatorByHits::gemHitAssociatorConfig_
private

Definition at line 84 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ helper_

MuonAssociatorByHitsHelper MuonAssociatorByHits::helper_
private

Definition at line 82 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ rpcHitAssociatorConfig_

RPCHitAssociator::Config MuonAssociatorByHits::rpcHitAssociatorConfig_
private

Definition at line 85 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config MuonAssociatorByHits::trackerHitAssociatorConfig_
private

Definition at line 83 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

◆ ttopoToken_

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

Definition at line 89 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().