23 theLayersNeeded(p.getParameter<unsigned
int>(
"layersNeeded")),
24 digitizeBadChambers_(p.getParameter<
bool>(
"digitizeBadChambers")) {
45 CLHEP::HepRandomEngine *engine) {
47 std::map<int, edm::PSimHitContainer> hitMap;
49 hitMap[hitItr->detUnitId()].push_back(*hitItr);
53 std::map<int, std::set<int>> layersInChamberHit;
54 for (std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin(); hitMapItr != hitMap.end();
58 layersInChamberHit[chamberId].insert(cscDetId.
layer());
67 for (std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin(); hitMapItr != hitMap.end();
76 unsigned int nLayersInChamberHitForWireDigis = 0;
77 if (stat == 1 && ring == 1) {
78 std::set<int> layersInME1a = layersInChamberHit[
CSCDetId(endc, stat, 4, cham, 0)];
79 std::set<int> layersInME11 = layersInChamberHit[chamberId];
80 layersInME11.insert(layersInME1a.begin(), layersInME1a.end());
81 nLayersInChamberHitForWireDigis = layersInME11.size();
82 }
else if (stat == 1 && ring == 4) {
83 std::set<int> layersInME1b = layersInChamberHit[
CSCDetId(endc, stat, 1, cham, 0)];
84 std::set<int> layersInME11 = layersInChamberHit[chamberId];
85 layersInME11.insert(layersInME1b.begin(), layersInME1b.end());
86 nLayersInChamberHitForWireDigis = layersInME11.size();
88 nLayersInChamberHitForWireDigis = layersInChamberHit[chamberId].size();
90 unsigned int nLayersInChamberHitForStripDigis = layersInChamberHit[chamberId].size();
101 std::vector<CSCDetectorHit> newWireHits, newStripHits;
105 edm::LogVerbatim(
"CSCDigitizer") <<
"[CSCDigitizer] found " << layerSimHits.size() <<
" hit(s) in layer" 113 if (!newWireHits.empty()) {
132 for (std::list<int>::const_iterator missingLayerItr = missingLayers.begin(); missingLayerItr != missingLayers.end();
142 std::map<int, std::list<int>> layersInChamberWithDigi;
146 if ((*j).second.first != (*j).second.second) {
148 layersInChamberWithDigi[chamberId].push_back(layerId.
layer());
152 std::list<int> oneThruSix;
153 for (
int i = 1;
i <= 6; ++
i)
154 oneThruSix.push_back(
i);
156 for (
std::map<
int, std::list<int>>::iterator layersInChamberWithDigiItr = layersInChamberWithDigi.begin();
157 layersInChamberWithDigiItr != layersInChamberWithDigi.end();
158 ++layersInChamberWithDigiItr) {
159 std::list<int> &layersHit = layersInChamberWithDigiItr->second;
162 std::list<int> missingLayers(6);
163 std::list<int>::iterator lastLayerMissing = set_difference(
164 oneThruSix.begin(), oneThruSix.end(), layersHit.begin(), layersHit.end(), missingLayers.begin());
165 int chamberId = layersInChamberWithDigiItr->first;
166 for (std::list<int>::iterator layerMissingItr = missingLayers.begin(); layerMissingItr != lastLayerMissing;
169 result.push_back(chamberId + *layerMissingItr);
188 if (detUnit ==
nullptr) {
190 <<
"\nPerhaps your signal or pileup dataset are not compatible with " 191 "the current release?";
193 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