CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonPSimHitSelector.cc
Go to the documentation of this file.
1 
3 
6 
8 
9 // #include "SimTracker/Common/interface/SimHitSelectorFromDB.h"
10 
12  edm::Event const &event,
13  edm::EventSetup const &setup) const {
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)
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 }
void select(PSimHitCollection &, edm::Event const &, edm::EventSetup const &) const override
Pre-process event information.
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
const edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > cscBadToken_
std::vector< PSimHit > PSimHitCollection
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:70
PSimHitCollectionMap pSimHitCollectionMap_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
static constexpr int CSC
Definition: MuonSubdetId.h:12
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46