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(); }
SubsystemNeutronReader::generateChamberNoise
void generateChamberNoise(int chamberType, int chamberIndex, edm::PSimHitContainer &result, CLHEP::HepRandomEngine *)
Definition: SubsystemNeutronReader.cc:35
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCNeutronReader.h
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CSCDetId.h
CSCNeutronReader::chamberType
int chamberType(int globalDetId) const
Definition: CSCNeutronReader.cc:40
CSCNeutronReader::addHits
void addHits(std::map< int, edm::PSimHitContainer > &hitMap, CLHEP::HepRandomEngine *)
Definition: CSCNeutronReader.cc:6
PSimHit.h
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
CSCNeutronReader::detId
int detId(int chamberIndex, int localDetId) override
Definition: CSCNeutronReader.cc:33
CSCDetId
Definition: CSCDetId.h:26
CSCDetId::chamberId
CSCDetId chamberId() const
Definition: CSCDetId.h:47
CSCNeutronReader::localDetId
int localDetId(int globalDetId) const
Definition: CSCNeutronReader.cc:38
CSCChamberSpecs::whatChamberType
static int whatChamberType(int istation, int iring)
Definition: CSCChamberSpecs.cc:164
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CSCChamberSpecs.h
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
CSCNeutronReader::chamberId
int chamberId(int globalDetId) const
Definition: CSCNeutronReader.cc:45