CMS 3D CMS Logo

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

MuonPSimHitSelector class. More...

#include <MuonPSimHitSelector.h>

Inheritance diagram for MuonPSimHitSelector:
PSimHitSelector

Public Member Functions

 MuonPSimHitSelector (edm::ParameterSet const &config, edm::ConsumesCollector &iC)
 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 &, edm::ConsumesCollector &)
 Constructor by pset. More...
 
virtual ~PSimHitSelector ()=default
 Virtual destructor. More...
 

Private Attributes

const edm::ESGetToken< CSCBadChambers, CSCBadChambersRcdcscBadToken_
 

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 10 of file MuonPSimHitSelector.h.

Constructor & Destructor Documentation

◆ MuonPSimHitSelector()

MuonPSimHitSelector::MuonPSimHitSelector ( edm::ParameterSet const &  config,
edm::ConsumesCollector iC 
)
inline

Constructor by pset.

Definition at line 17 of file MuonPSimHitSelector.h.

Definition: config.py:1
PSimHitSelector(edm::ParameterSet const &, edm::ConsumesCollector &)
Constructor by pset.
const edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > cscBadToken_

Member Function Documentation

◆ select()

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 11 of file MuonPSimHitSelector.cc.

References MuonSubdetId::CSC, cscBadToken_, DetId::det(), mps_fire::i, CSCBadChambers::isInBadChamber(), DetId::Muon, edm::Handle< T >::product(), PSimHitSelector::pSimHitCollectionMap_, corrVsCorr::selection, singleTopDQM_cfi::setup, and DetId::subdetId().

13  {
14  // Look for psimhit collection associated to the muon system
15  PSimHitCollectionMap::const_iterator pSimHitCollections = pSimHitCollectionMap_.find("muon");
16 
17  // Check that there are psimhit collections defined for the tracker
18  if (pSimHitCollections == pSimHitCollectionMap_.end())
19  return;
20 
21  // Grab all the PSimHit from the different sencitive volumes
23  std::vector<const CrossingFrame<PSimHit> *> cfPSimHitProductPointers;
24 
25  // Collect the product pointers to the different psimhit collection
26  for (std::size_t i = 0; i < pSimHitCollections->second.size(); ++i) {
27  event.getByLabel("mix", pSimHitCollections->second[i], cfPSimHits);
28  cfPSimHitProductPointers.push_back(cfPSimHits.product());
29  }
30 
31  // Create a mix collection from the different psimhit collections
32  std::unique_ptr<MixCollection<PSimHit>> pSimHits(new MixCollection<PSimHit>(cfPSimHitProductPointers));
33 
34  // Get CSC Bad Chambers (ME4/2)
35  edm::ESHandle<CSCBadChambers> cscBadChambers = setup.getHandle(cscBadToken_);
36 
37  // Select only psimhits from alive modules
38  for (MixCollection<PSimHit>::MixItr pSimHit = pSimHits->begin(); pSimHit != pSimHits->end(); ++pSimHit) {
39  DetId dId = DetId(pSimHit->detUnitId());
40 
41  if (dId.det() == DetId::Muon && dId.subdetId() == MuonSubdetId::CSC) {
42  if (!cscBadChambers->isInBadChamber(CSCDetId(dId)))
43  selection.push_back(*pSimHit);
44  } else
45  selection.push_back(*pSimHit);
46  }
47 }
T const * product() const
Definition: Handle.h:70
selection
main part
Definition: corrVsCorr.py:100
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
const edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > cscBadToken_
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
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
PSimHitCollectionMap pSimHitCollectionMap_
static constexpr int CSC
Definition: MuonSubdetId.h:12

Member Data Documentation

◆ cscBadToken_

const edm::ESGetToken<CSCBadChambers, CSCBadChambersRcd> MuonPSimHitSelector::cscBadToken_
private

Definition at line 24 of file MuonPSimHitSelector.h.

Referenced by select().