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
MuonPSimHitSelector Class Reference

MuonPSimHitSelector class. More...

#include <MuonPSimHitSelector.h>

Inheritance diagram for MuonPSimHitSelector:
PSimHitSelector

Public Member Functions

 MuonPSimHitSelector (edm::ParameterSet const &config)
 Constructor by pset. More...
 
void select (PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
 Pre-process event information. More...
 
- Public Member Functions inherited from PSimHitSelector
 PSimHitSelector (edm::ParameterSet const &)
 Constructor by pset. More...
 
virtual ~PSimHitSelector ()
 Virtual destructor. More...
 

Additional Inherited Members

- Public Types inherited from PSimHitSelector
typedef std::vector< PSimHitPSimHitCollection
 
- Public Attributes inherited from PSimHitSelector
std::string mixLabel_
 
- Protected Types inherited from PSimHitSelector
typedef std::map< std::string,
std::vector< std::string > > 
PSimHitCollectionMap
 
- Protected Attributes inherited from PSimHitSelector
PSimHitCollectionMap pSimHitCollectionMap_
 

Detailed Description

MuonPSimHitSelector class.

Definition at line 7 of file MuonPSimHitSelector.h.

Constructor & Destructor Documentation

MuonPSimHitSelector::MuonPSimHitSelector ( edm::ParameterSet const &  config)
inline

Constructor by pset.

Definition at line 14 of file MuonPSimHitSelector.h.

PSimHitSelector(edm::ParameterSet const &)
Constructor by pset.
tuple config
parse the configuration file

Member Function Documentation

void MuonPSimHitSelector::select ( PSimHitCollection selection,
edm::Event const &  event,
edm::EventSetup const &  setup 
) const
overridevirtual

Pre-process event information.

Reimplemented from PSimHitSelector.

Definition at line 14 of file MuonPSimHitSelector.cc.

References MuonSubdetId::CSC, CSC_BadChambers_cfi::cscBadChambers, DetId::det(), edm::EventSetup::get(), mps_fire::i, DetId::Muon, edm::Handle< T >::product(), PSimHitSelector::pSimHitCollectionMap_, and DetId::subdetId().

16  {
17  // Look for psimhit collection associated to the muon system
18  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("muon");
19 
20  // Check that there are psimhit collections defined for the tracker
21  if (pSimHitCollections == pSimHitCollectionMap_.end())
22  return;
23 
24  // Grab all the PSimHit from the different sencitive volumes
26  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
27 
28  // Collect the product pointers to the different psimhit collection
29  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) {
30  event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits);
31  cfPSimHitProductPointers.push_back(cfPSimHits.product());
32  }
33 
34  // Create a mix collection from the different psimhit collections
35  std::unique_ptr<MixCollection<PSimHit>> pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
36 
37  // Get CSC Bad Chambers (ME4/2)
39  setup.get<CSCBadChambersRcd>().get(cscBadChambers);
40 
41  // Select only psimhits from alive modules
42  for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit) {
43  DetId dId = DetId(pSimHit->detUnitId());
44 
45  if (dId.det() == DetId::Muon && dId.subdetId() == MuonSubdetId::CSC) {
46  if (!cscBadChambers->isInBadChamber(CSCDetId(dId)))
47  selection.push_back(*pSimHit);
48  } else
49  selection.push_back(*pSimHit);
50  }
51 }
selection
main part
Definition: corrVsCorr.py:100
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:70
PSimHitCollectionMap pSimHitCollectionMap_
static constexpr int CSC
Definition: MuonSubdetId.h:12
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46