Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:12

0001 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0002 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
0003 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0004 #include "SimMuon/CSCDigitizer/src/CSCNeutronReader.h"
0005 
0006 void CSCNeutronReader::addHits(std::map<int, edm::PSimHitContainer> &hitMap, CLHEP::HepRandomEngine *engine) {
0007   std::vector<int> chambersDone;
0008 
0009   std::map<int, edm::PSimHitContainer> signalHits = hitMap;
0010   for (std::map<int, edm::PSimHitContainer>::const_iterator signalHitItr = signalHits.begin();
0011        signalHitItr != signalHits.end();
0012        ++signalHitItr) {
0013     int chamberIndex = chamberId(signalHitItr->first);
0014 
0015     // see if this chamber has been done yet
0016     if (find(chambersDone.begin(), chambersDone.end(), chamberIndex) == chambersDone.end()) {
0017       edm::PSimHitContainer neutronHits;
0018       generateChamberNoise(chamberType(chamberIndex), chamberIndex, neutronHits, engine);
0019 
0020       // add these hits to the original map
0021       for (edm::PSimHitContainer::const_iterator neutronHitItr = neutronHits.begin();
0022            neutronHitItr != neutronHits.end();
0023            ++neutronHitItr) {
0024         uint32_t layerId = neutronHitItr->detUnitId();
0025         hitMap[layerId].push_back(*neutronHitItr);
0026       }
0027       // mark chamber as done
0028       chambersDone.push_back(chamberIndex);
0029     }
0030   }
0031 }
0032 
0033 int CSCNeutronReader::detId(int chamberIndex, int localDetId) {
0034   // add the layer bits
0035   return chamberIndex + localDetId;
0036 }
0037 
0038 int CSCNeutronReader::localDetId(int globalDetId) const { return CSCDetId(globalDetId).layer(); }
0039 
0040 int CSCNeutronReader::chamberType(int globalDetId) const {
0041   CSCDetId id(globalDetId);
0042   return CSCChamberSpecs::whatChamberType(id.station(), id.ring());
0043 }
0044 
0045 int CSCNeutronReader::chamberId(int globalDetId) const { return CSCDetId(globalDetId).chamberId().rawId(); }