CMS 3D CMS Logo

MuonPSimHitSelector.cc
Go to the documentation of this file.
1 
4 
6 
9 
11 
12 // #include "SimTracker/Common/interface/SimHitSelectorFromDB.h"
13 
15  edm::Event const &event,
16  edm::EventSetup const &setup) const {
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)
38  edm::ESHandle<CSCBadChambers> cscBadChambers;
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 }
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
mps_fire.i
i
Definition: mps_fire.py:428
PSimHitSelector::PSimHitCollection
std::vector< PSimHit > PSimHitCollection
Definition: PSimHitSelector.h:17
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ESHandle.h
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
CrossingFrame.h
edm::Handle
Definition: AssociativeIterator.h:50
MixCollection::MixItr
Definition: MixCollection.h:62
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
PSimHitSelector::pSimHitCollectionMap_
PSimHitCollectionMap pSimHitCollectionMap_
Definition: PSimHitSelector.h:36
DetId
Definition: DetId.h:17
MixCollection.h
MixCollection
Definition: MixCollection.h:11
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
edm::ESHandle< CSCBadChambers >
MuonPSimHitSelector::select
void select(PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
Pre-process event information.
Definition: MuonPSimHitSelector.cc:14
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
CSCBadChambers::isInBadChamber
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index 'ichamber' flagged as bad?
Definition: CSCBadChambers.cc:4
CSCDetId
Definition: CSCDetId.h:26
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
CSCBadChambersRcd.h
MuonPSimHitSelector.h
CSCBadChambersRcd
Definition: CSCBadChambersRcd.h:5
DetId::Muon
Definition: DetId.h:26
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
CSCBadChambers.h