CMS 3D CMS Logo

CSCNeutronReader.cc
Go to the documentation of this file.
5 
6 void CSCNeutronReader::addHits(std::map<int, edm::PSimHitContainer> &hitMap, CLHEP::HepRandomEngine *engine) {
7  std::vector<int> chambersDone;
8 
9  std::map<int, edm::PSimHitContainer> signalHits = hitMap;
10  for (std::map<int, edm::PSimHitContainer>::const_iterator signalHitItr = signalHits.begin();
11  signalHitItr != signalHits.end();
12  ++signalHitItr) {
13  int chamberIndex = chamberId(signalHitItr->first);
14 
15  // see if this chamber has been done yet
16  if (find(chambersDone.begin(), chambersDone.end(), chamberIndex) == chambersDone.end()) {
17  edm::PSimHitContainer neutronHits;
18  generateChamberNoise(chamberType(chamberIndex), chamberIndex, neutronHits, engine);
19 
20  // add these hits to the original map
21  for (edm::PSimHitContainer::const_iterator neutronHitItr = neutronHits.begin();
22  neutronHitItr != neutronHits.end();
23  ++neutronHitItr) {
24  uint32_t layerId = neutronHitItr->detUnitId();
25  hitMap[layerId].push_back(*neutronHitItr);
26  }
27  // mark chamber as done
28  chambersDone.push_back(chamberIndex);
29  }
30  }
31 }
32 
33 int CSCNeutronReader::detId(int chamberIndex, int localDetId) {
34  // add the layer bits
35  return chamberIndex + localDetId;
36 }
37 
38 int CSCNeutronReader::localDetId(int globalDetId) const { return CSCDetId(globalDetId).layer(); }
39 
40 int CSCNeutronReader::chamberType(int globalDetId) const {
41  CSCDetId id(globalDetId);
43 }
44 
45 int CSCNeutronReader::chamberId(int globalDetId) const { return CSCDetId(globalDetId).chamberId().rawId(); }
int detId(int chamberIndex, int localDetId) override
int localDetId(int globalDetId) const
static int whatChamberType(int istation, int iring)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int chamberId(int globalDetId) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
int layer() const
Definition: CSCDetId.h:56
int chamberType(int globalDetId) const
CSCDetId chamberId() const
Definition: CSCDetId.h:47
void generateChamberNoise(int chamberType, int chamberIndex, edm::PSimHitContainer &result, CLHEP::HepRandomEngine *)
void addHits(std::map< int, edm::PSimHitContainer > &hitMap, CLHEP::HepRandomEngine *)
std::vector< PSimHit > PSimHitContainer