CMS 3D CMS Logo

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