24 theLayersNeeded(p.getParameter<unsigned
int>(
"layersNeeded")),
25 digitizeBadChambers_(p.getParameter<
bool>(
"digitizeBadChambers"))
51 CLHEP::HepRandomEngine* engine)
54 std::map<int, edm::PSimHitContainer> hitMap;
56 hitItr != simHits.
end(); ++hitItr)
58 hitMap[hitItr->detUnitId()].push_back(*hitItr);
62 std::map<int, std::set<int> > layersInChamberHit;
63 for(std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin();
64 hitMapItr != hitMap.end(); ++hitMapItr)
68 layersInChamberHit[chamberId].insert(cscDetId.
layer());
78 for(std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin();
79 hitMapItr != hitMap.end(); ++hitMapItr)
88 unsigned int nLayersInChamberHitForWireDigis = 0;
89 if (stat == 1 && ring == 1) {
90 std::set<int> layersInME1a = layersInChamberHit[
CSCDetId(endc,stat,4,cham,0)];
91 std::set<int> layersInME11 = layersInChamberHit[chamberId];
92 layersInME11.insert(layersInME1a.begin(),layersInME1a.end());
93 nLayersInChamberHitForWireDigis = layersInME11.size();
95 else if (stat == 1 && ring == 4) {
96 std::set<int> layersInME1b = layersInChamberHit[
CSCDetId(endc,stat,1,cham,0)];
97 std::set<int> layersInME11 = layersInChamberHit[chamberId];
98 layersInME11.insert(layersInME1b.begin(),layersInME1b.end());
99 nLayersInChamberHitForWireDigis = layersInME11.size();
101 else nLayersInChamberHitForWireDigis = layersInChamberHit[chamberId].size();
103 unsigned int nLayersInChamberHitForStripDigis = layersInChamberHit[chamberId].size();
112 std::vector<CSCDetectorHit> newWireHits, newStripHits;
115 edm::LogVerbatim(
"CSCDigitizer") <<
"[CSCDigitizer] found " << layerSimHits.size() <<
" hit(s) in layer" 124 if(!newWireHits.empty()) {
143 for(std::list<int>::const_iterator missingLayerItr = missingLayers.begin();
144 missingLayerItr != missingLayers.end(); ++missingLayerItr)
156 std::map<int, std::list<int> > layersInChamberWithDigi;
158 j!=stripDigis.end(); j++)
162 if((*j).second.first != (*j).second.second)
165 layersInChamberWithDigi[chamberId].push_back(layerId.
layer());
169 std::list<int> oneThruSix;
170 for(
int i = 1;
i <=6; ++
i)
171 oneThruSix.push_back(
i);
173 for(
std::map<
int, std::list<int> >::iterator layersInChamberWithDigiItr = layersInChamberWithDigi.begin();
174 layersInChamberWithDigiItr != layersInChamberWithDigi.end(); ++ layersInChamberWithDigiItr)
176 std::list<int> & layersHit = layersInChamberWithDigiItr->second;
180 std::list<int> missingLayers(6);
181 std::list<int>::iterator lastLayerMissing =
182 set_difference(oneThruSix.begin(), oneThruSix.end(),
183 layersHit.begin(), layersHit.end(), missingLayers.begin());
184 int chamberId = layersInChamberWithDigiItr->first;
185 for(std::list<int>::iterator layerMissingItr = missingLayers.begin();
186 layerMissingItr != lastLayerMissing; ++layerMissingItr)
189 result.push_back(chamberId + *layerMissingItr);
218 if(detUnit ==
nullptr)
221 <<
"\nPerhaps your signal or pileup dataset are not compatible with the current release?";
223 return dynamic_cast<const CSCLayer *
>(detUnit);
CSCDriftSim * theDriftSim
T getParameter(std::string const &) const
std::vector< CSCDetectorHit > & simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &wireHits)
unsigned int theLayersNeeded
HepPDT::ParticleDataTable ParticleDataTable
std::vector< CSCDetectorHit > & simulate(const CSCLayer *layer, const edm::PSimHitContainer &simHits, CLHEP::HepRandomEngine *)
const CSCLayer * findLayer(int detId) const
finds the layer in the geometry associated with this det ID
void setStripConditions(CSCStripConditions *cond)
std::list< int > layersMissing(const CSCStripDigiCollection &stripDigis) const
finds which layers, 1-6, aren't in the current list
void setMagneticField(const MagneticField *field)
bool digitizeBadChambers_
const DigiSimLinks & digiSimLinks() const
CSCStripElectronicsSim * theStripElectronicsSim
CSCDigitizer(const edm::ParameterSet &p)
configurable parameters
CSCNeutronReader * theNeutronReader
const CSCGeometry * theCSCGeometry
void fillDigis(CSCWireDigiCollection &digis, CLHEP::HepRandomEngine *)
CSCDetId chamberId() const
void fillMissingLayer(const CSCLayer *layer, const CSCComparatorDigiCollection &comparators, CSCStripDigiCollection &digis, CLHEP::HepRandomEngine *)
void setStripConditions(CSCStripConditions *cond)
CSCWireHitSim * theWireHitSim
void setParticleDataTable(const ParticleDataTable *pdt)
void doAction(MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks, CLHEP::HepRandomEngine *)
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
void insert(detset const &s)
Insert the given DetSet.
CSCWireElectronicsSim * theWireElectronicsSim
void fillDigis(CSCStripDigiCollection &digis, CSCComparatorDigiCollection &comparators, CLHEP::HepRandomEngine *)
void addHits(std::map< int, edm::PSimHitContainer > &hitMap, CLHEP::HepRandomEngine *)
std::vector< PSimHit > PSimHitContainer
virtual bool isInBadChamber(const CSCDetId &id) const
is supplied layer/chamber flagged as bad? (default impl. is no)
void simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits, CLHEP::HepRandomEngine *)
void setMagneticField(const MagneticField *field)
sets the magnetic field
void setParticleDataTable(const ParticleDataTable *pdt)
CSCStripHitSim * theStripHitSim
CSCStripConditions * theConditions