CMS 3D CMS Logo

CSCNeutronReader.cc

Go to the documentation of this file.
00001 #include "SimMuon/CSCDigitizer/src/CSCNeutronReader.h"
00002 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00003 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00004 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
00005 
00006 
00007 void CSCNeutronReader::addHits(std::map<int, edm::PSimHitContainer> & hitMap)
00008 {
00009   std::vector<int> chambersDone;
00010 
00011   std::map<int, edm::PSimHitContainer> signalHits = hitMap;
00012   for(std::map<int, edm::PSimHitContainer>::const_iterator signalHitItr = signalHits.begin();
00013       signalHitItr != signalHits.end(); ++signalHitItr)
00014   {
00015     int chamberIndex = chamberId(signalHitItr->first);
00016 
00017     // see if this chamber has been done yet
00018     if(find(chambersDone.begin(), chambersDone.end(), chamberIndex) == chambersDone.end())
00019     {
00020       edm::PSimHitContainer neutronHits;
00021       generateChamberNoise(chamberType(chamberIndex), chamberIndex, neutronHits);
00022 
00023       // add these hits to the original map
00024       for(edm::PSimHitContainer::const_iterator neutronHitItr = neutronHits.begin();
00025           neutronHitItr != neutronHits.end(); ++neutronHitItr) 
00026       {
00027         uint32_t layerId = neutronHitItr->detUnitId();
00028         hitMap[layerId].push_back(*neutronHitItr);
00029       }
00030       // mark chamber as done
00031       chambersDone.push_back(chamberIndex);
00032     }
00033   }
00034 }
00035 
00036 
00037 int CSCNeutronReader::detId(int chamberIndex, int localDetId )
00038 {
00039   // add the layer bits
00040   return chamberIndex + localDetId;
00041 }
00042 
00043 
00044 int CSCNeutronReader::localDetId(int globalDetId) const
00045 {
00046   return CSCDetId(globalDetId).layer();
00047 }
00048 
00049 
00050 int CSCNeutronReader::chamberType(int globalDetId) const
00051 {
00052   CSCDetId id(globalDetId);
00053   return CSCChamberSpecs::whatChamberType(id.station(), id.ring());
00054 }
00055 
00056 
00057 int CSCNeutronReader::chamberId(int globalDetId) const
00058 {
00059   return CSCDetId(globalDetId).chamberId().rawId();
00060 }
00061 

Generated on Tue Jun 9 17:47:31 2009 for CMSSW by  doxygen 1.5.4