#include <CSCDigitizer.h>
Digitizer class for endcap muon CSCs.
Definition at line 37 of file CSCDigitizer.h.
Definition at line 40 of file CSCDigitizer.h.
CSCDigitizer::CSCDigitizer | ( | const edm::ParameterSet & | p | ) | [explicit] |
configurable parameters
Definition at line 16 of file CSCDigitizer.cc.
References edm::ParameterSet::getParameter(), and theNeutronReader.
: theDriftSim(new CSCDriftSim()), theWireHitSim(new CSCWireHitSim(theDriftSim)), theStripHitSim(new CSCStripHitSim()), theWireElectronicsSim(new CSCWireElectronicsSim(p.getParameter<edm::ParameterSet>("wires"))), theStripElectronicsSim(new CSCStripElectronicsSim(p.getParameter<edm::ParameterSet>("strips"))), theNeutronReader(0), theCSCGeometry(0), theLayersNeeded(p.getParameter<unsigned int>("layersNeeded")), digitizeBadChambers_(p.getParameter<bool>("digitizeBadChambers")) { if(p.getParameter<bool>("doNeutrons")) { theNeutronReader = new CSCNeutronReader(p.getParameter<edm::ParameterSet>("neutrons")); } }
CSCDigitizer::~CSCDigitizer | ( | ) |
Definition at line 34 of file CSCDigitizer.cc.
References theDriftSim, theNeutronReader, theStripElectronicsSim, theStripHitSim, theWireElectronicsSim, and theWireHitSim.
{ delete theNeutronReader; delete theStripElectronicsSim; delete theWireElectronicsSim; delete theStripHitSim; delete theWireHitSim; delete theDriftSim; }
void CSCDigitizer::doAction | ( | MixCollection< PSimHit > & | simHits, |
CSCWireDigiCollection & | wireDigis, | ||
CSCStripDigiCollection & | stripDigis, | ||
CSCComparatorDigiCollection & | comparators, | ||
DigiSimLinks & | wireDigiSimLinks, | ||
DigiSimLinks & | stripDigiSimLinks | ||
) |
digitize
Definition at line 45 of file CSCDigitizer.cc.
References CSCNeutronReader::addHits(), MixCollection< T >::begin(), CSCDetId::chamber(), CSCDetId::chamberId(), CSCDetId, CSCBaseElectronicsSim::digiSimLinks(), digitizeBadChambers_, MixCollection< T >::end(), CSCDetId::endcap(), CSCStripElectronicsSim::fillDigis(), CSCWireElectronicsSim::fillDigis(), CSCStripElectronicsSim::fillMissingLayer(), findLayer(), CSCLayer::id(), edm::DetSetVector< T >::insert(), CSCStripConditions::isInBadChamber(), CSCDetId::layer(), layersMissing(), LogTrace, CSCDetId::ring(), CSCBaseElectronicsSim::simulate(), CSCWireHitSim::simulate(), CSCStripHitSim::simulate(), CSCDetId::station(), theConditions, theLayersNeeded, theNeutronReader, theStripElectronicsSim, theStripHitSim, theWireElectronicsSim, and theWireHitSim.
Referenced by CSCDigiProducer::produce().
{ // arrange the hits by layer std::map<int, edm::PSimHitContainer> hitMap; for(MixCollection<PSimHit>::MixItr hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) { hitMap[hitItr->detUnitId()].push_back(*hitItr); } // count how many layers on each chamber are hit std::map<int, std::set<int> > layersInChamberHit; for(std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin(); hitMapItr != hitMap.end(); ++hitMapItr) { CSCDetId cscDetId(hitMapItr->first); int chamberId = cscDetId.chamberId(); layersInChamberHit[chamberId].insert(cscDetId.layer()); } // add neutron background, if needed if(theNeutronReader != 0) { theNeutronReader->addHits(hitMap); } // now loop over layers and run the simulation for each one for(std::map<int, edm::PSimHitContainer>::const_iterator hitMapItr = hitMap.begin(); hitMapItr != hitMap.end(); ++hitMapItr) { int chamberId = CSCDetId(hitMapItr->first).chamberId(); unsigned int nLayersInChamberHit = layersInChamberHit[chamberId].size(); if(nLayersInChamberHit < theLayersNeeded) continue; // skip bad chambers if ( !digitizeBadChambers_ && theConditions->isInBadChamber( CSCDetId(hitMapItr->first) ) ) continue; const CSCLayer * layer = findLayer(hitMapItr->first); const edm::PSimHitContainer & layerSimHits = hitMapItr->second; std::vector<CSCDetectorHit> newWireHits, newStripHits; LogTrace("CSCDigitizer") << "CSCDigitizer: found " << layerSimHits.size() <<" hit(s) in layer" << " E" << layer->id().endcap() << " S" << layer->id().station() << " R" << layer->id().ring() << " C" << layer->id().chamber() << " L" << layer->id().layer(); // turn the edm::PSimHits into WireHits, using the WireHitSim { newWireHits.swap(theWireHitSim->simulate(layer, layerSimHits)); } if(!newWireHits.empty()) { newStripHits.swap(theStripHitSim->simulate(layer, newWireHits)); } // turn the hits into wire digis, using the electronicsSim { theWireElectronicsSim->simulate(layer, newWireHits); theWireElectronicsSim->fillDigis(wireDigis); wireDigiSimLinks.insert( theWireElectronicsSim->digiSimLinks() ); } { theStripElectronicsSim->simulate(layer, newStripHits); theStripElectronicsSim->fillDigis(stripDigis, comparators); stripDigiSimLinks.insert( theStripElectronicsSim->digiSimLinks() ); } } // fill in the layers were missing from this chamber std::list<int> missingLayers = layersMissing(stripDigis); for(std::list<int>::const_iterator missingLayerItr = missingLayers.begin(); missingLayerItr != missingLayers.end(); ++missingLayerItr) { const CSCLayer * layer = findLayer(*missingLayerItr); theStripElectronicsSim->fillMissingLayer(layer, comparators, stripDigis); } }
const CSCLayer * CSCDigitizer::findLayer | ( | int | detId | ) | const [private] |
finds the layer in the geometry associated with this det ID
Definition at line 199 of file CSCDigitizer.cc.
References CSCDetId, Exception, CSCGeometry::idToDetUnit(), and theCSCGeometry.
Referenced by doAction().
{ assert(theCSCGeometry != 0); const GeomDetUnit* detUnit = theCSCGeometry->idToDetUnit(CSCDetId(detId)); if(detUnit == 0) { throw cms::Exception("CSCDigiProducer") << "Invalid DetUnit: " << CSCDetId(detId) << "\nPerhaps your signal or pileup dataset are not compatible with the current release?"; } return dynamic_cast<const CSCLayer *>(detUnit); }
std::list< int > CSCDigitizer::layersMissing | ( | const CSCStripDigiCollection & | stripDigis | ) | const [private] |
finds which layers, 1-6, aren't in the current list
Definition at line 127 of file CSCDigitizer.cc.
References CSCDetId::chamberId(), i, j, CSCDetId::layer(), python::multivaluedict::map(), query::result, and theLayersNeeded.
Referenced by doAction().
{ std::list<int> result; std::map<int, std::list<int> > layersInChamberWithDigi; for (CSCStripDigiCollection::DigiRangeIterator j=stripDigis.begin(); j!=stripDigis.end(); j++) { CSCDetId layerId((*j).first); // make sure the vector of digis isn't empty if((*j).second.first != (*j).second.second) { int chamberId = layerId.chamberId(); layersInChamberWithDigi[chamberId].push_back(layerId.layer()); } } std::list<int> oneThruSix; for(int i = 1; i <=6; ++i) oneThruSix.push_back(i); for(std::map<int, std::list<int> >::iterator layersInChamberWithDigiItr = layersInChamberWithDigi.begin(); layersInChamberWithDigiItr != layersInChamberWithDigi.end(); ++ layersInChamberWithDigiItr) { std::list<int> & layersHit = layersInChamberWithDigiItr->second; if (layersHit.size() < 6 && layersHit.size() >= theLayersNeeded) { layersHit.sort(); std::list<int> missingLayers(6); std::list<int>::iterator lastLayerMissing = set_difference(oneThruSix.begin(), oneThruSix.end(), layersHit.begin(), layersHit.end(), missingLayers.begin()); int chamberId = layersInChamberWithDigiItr->first; for(std::list<int>::iterator layerMissingItr = missingLayers.begin(); layerMissingItr != lastLayerMissing; ++layerMissingItr) { // got from layer 1-6 to layer ID result.push_back(chamberId + *layerMissingItr); } } } return result; }
void CSCDigitizer::setGeometry | ( | const CSCGeometry * | geom | ) | [inline] |
sets geometry
Definition at line 57 of file CSCDigitizer.h.
References relativeConstraints::geom, and theCSCGeometry.
Referenced by CSCDigiProducer::produce().
{theCSCGeometry = geom;}
void CSCDigitizer::setMagneticField | ( | const MagneticField * | field | ) |
sets the magnetic field
Definition at line 172 of file CSCDigitizer.cc.
References CSCDriftSim::setMagneticField(), and theDriftSim.
Referenced by CSCDigiProducer::produce().
{ theDriftSim->setMagneticField(field); }
void CSCDigitizer::setParticleDataTable | ( | const ParticleDataTable * | pdt | ) |
Definition at line 184 of file CSCDigitizer.cc.
References CSCWireHitSim::setParticleDataTable(), and theWireHitSim.
Referenced by CSCDigiProducer::produce().
{ theWireHitSim->setParticleDataTable(pdt); }
void CSCDigitizer::setRandomEngine | ( | CLHEP::HepRandomEngine & | engine | ) |
Definition at line 190 of file CSCDigitizer.cc.
References SubsystemNeutronReader::setRandomEngine(), CSCWireHitSim::setRandomEngine(), CSCBaseElectronicsSim::setRandomEngine(), theNeutronReader, theStripElectronicsSim, theWireElectronicsSim, and theWireHitSim.
Referenced by CSCDigiProducer::CSCDigiProducer().
{ theWireHitSim->setRandomEngine(engine); theWireElectronicsSim->setRandomEngine(engine); theStripElectronicsSim->setRandomEngine(engine); if(theNeutronReader) theNeutronReader->setRandomEngine(engine); }
void CSCDigitizer::setStripConditions | ( | CSCStripConditions * | cond | ) |
Definition at line 177 of file CSCDigitizer.cc.
References CSCStripElectronicsSim::setStripConditions(), theConditions, and theStripElectronicsSim.
Referenced by CSCDigiProducer::CSCDigiProducer().
{ theConditions = cond; // cache here theStripElectronicsSim->setStripConditions(cond); // percolate downwards }
bool CSCDigitizer::digitizeBadChambers_ [private] |
Definition at line 84 of file CSCDigitizer.h.
Referenced by doAction().
CSCStripConditions* CSCDigitizer::theConditions [private] |
Definition at line 82 of file CSCDigitizer.h.
Referenced by doAction(), and setStripConditions().
const CSCGeometry* CSCDigitizer::theCSCGeometry [private] |
Definition at line 81 of file CSCDigitizer.h.
Referenced by findLayer(), and setGeometry().
CSCDriftSim* CSCDigitizer::theDriftSim [private] |
Definition at line 75 of file CSCDigitizer.h.
Referenced by setMagneticField(), and ~CSCDigitizer().
unsigned int CSCDigitizer::theLayersNeeded [private] |
Definition at line 83 of file CSCDigitizer.h.
Referenced by doAction(), and layersMissing().
CSCNeutronReader* CSCDigitizer::theNeutronReader [private] |
Definition at line 80 of file CSCDigitizer.h.
Referenced by CSCDigitizer(), doAction(), setRandomEngine(), and ~CSCDigitizer().
Definition at line 79 of file CSCDigitizer.h.
Referenced by doAction(), setRandomEngine(), setStripConditions(), and ~CSCDigitizer().
CSCStripHitSim* CSCDigitizer::theStripHitSim [private] |
Definition at line 77 of file CSCDigitizer.h.
Referenced by doAction(), and ~CSCDigitizer().
Definition at line 78 of file CSCDigitizer.h.
Referenced by doAction(), setRandomEngine(), and ~CSCDigitizer().
CSCWireHitSim* CSCDigitizer::theWireHitSim [private] |
Definition at line 76 of file CSCDigitizer.h.
Referenced by doAction(), setParticleDataTable(), setRandomEngine(), and ~CSCDigitizer().