test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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=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)
 
 ~MuonAssociatorByHits ()
 

Private Attributes

edm::ParameterSet const conf_
 
std::unique_ptr
< muonAssociatorByHitsDiagnostics::InputDumper
diagnostics_
 
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 138 of file MuonAssociatorByHits.cc.

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

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

Definition at line 155 of file MuonAssociatorByHits.cc.

156 {
157 }

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 33 of file MuonAssociatorByHits.h.

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

Referenced by MuonAssociatorEDProducer::produce().

36  {
38  for (unsigned int j=0; j<tCH->size();j++)
39  tc.push_back(tCH->refAt(j));
40 
42  for (unsigned int j=0; j<tPCH->size();j++)
44 
45  return associateRecoToSim(tc,tpc,event,setup);
46  }
ProductID id() const
Definition: HandleBase.cc:15
int j
Definition: DBlmapReader.cc:9
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:69
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 160 of file MuonAssociatorByHits.cc.

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

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

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

Referenced by MuonAssociatorEDProducer::produce().

51  {
53  for (unsigned int j=0; j<tCH->size();j++)
54  tc.push_back(tCH->refAt(j));
55 
57  for (unsigned int j=0; j<tPCH->size();j++)
59 
60  return associateSimToReco(tc,tpc,event,setup);
61  }
ProductID id() const
Definition: HandleBase.cc:15
int j
Definition: DBlmapReader.cc:9
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:69
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 208 of file MuonAssociatorByHits.cc.

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

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

Member Data Documentation

edm::ParameterSet const MuonAssociatorByHits::conf_
private

Definition at line 78 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

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

Definition at line 81 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and MuonAssociatorByHits().

MuonAssociatorByHitsHelper MuonAssociatorByHits::helper_
private

Definition at line 77 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().

TrackerHitAssociator::Config MuonAssociatorByHits::trackerHitAssociatorConfig_
private

Definition at line 79 of file MuonAssociatorByHits.h.

Referenced by associateRecoToSim(), and associateSimToReco().