![]() |
![]() |
#include <SiStripDigitizer.h>
Public Member Functions | |
virtual void | accumulate (edm::Event const &e, edm::EventSetup const &c) |
virtual void | accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c) |
virtual void | finalizeEvent (edm::Event &e, edm::EventSetup const &c) |
virtual void | initializeEvent (edm::Event const &e, edm::EventSetup const &c) |
SiStripDigitizer (const edm::ParameterSet &conf, edm::EDProducer &mixMod) | |
virtual | ~SiStripDigitizer () |
Private Types | |
typedef std::map< unsigned int, std::vector< std::pair< const PSimHit *, int > >, std::less < unsigned int > > | simhit_map |
typedef simhit_map::iterator | simhit_map_iterator |
typedef std::vector< std::string > | vstring |
Private Member Functions | |
void | accumulateStripHits (edm::Handle< std::vector< PSimHit > >) |
Private Attributes | |
std::map< unsigned int, StripGeomDetUnit * > | detectorUnits |
const std::string | gainLabel |
const std::string | geometryType |
const std::string | hitsProducer |
edm::ESHandle< TrackerGeometry > | pDD |
const std::string | PRDigi |
edm::ESHandle< MagneticField > | pSetup |
CLHEP::HepRandomEngine * | rndEngine |
const std::string | SCDigi |
std::map< uint32_t, std::vector< int > > | theDetIdList |
std::unique_ptr < SiStripDigitizerAlgorithm > | theDigiAlgo |
const vstring | trackerContainers |
const bool | useConfFromDB |
const std::string | VRDigi |
const bool | zeroSuppression |
const std::string | ZSDigi |
SiStripDigitizer to convert hits to digis
Definition at line 37 of file SiStripDigitizer.h.
typedef std::map<unsigned int, std::vector<std::pair<const PSimHit*, int> >,std::less<unsigned int> > SiStripDigitizer::simhit_map [private] |
Definition at line 52 of file SiStripDigitizer.h.
typedef simhit_map::iterator SiStripDigitizer::simhit_map_iterator [private] |
Definition at line 53 of file SiStripDigitizer.h.
typedef std::vector<std::string> SiStripDigitizer::vstring [private] |
Definition at line 51 of file SiStripDigitizer.h.
SiStripDigitizer::SiStripDigitizer | ( | const edm::ParameterSet & | conf, |
edm::EDProducer & | mixMod | ||
) | [explicit] |
Definition at line 55 of file SiStripDigitizer.cc.
References Exception, edm::Service< T >::isAvailable(), PRDigi, rndEngine, SCDigi, AlCaHLTBitMon_QueryRunRegistry::string, theDigiAlgo, VRDigi, and ZSDigi.
: gainLabel(conf.getParameter<std::string>("Gain")), hitsProducer(conf.getParameter<std::string>("hitsProducer")), trackerContainers(conf.getParameter<std::vector<std::string> >("ROUList")), ZSDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("ZSDigi")), SCDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("SCDigi")), VRDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("VRDigi")), PRDigi(conf.getParameter<edm::ParameterSet>("DigiModeList").getParameter<std::string>("PRDigi")), geometryType(conf.getParameter<std::string>("GeometryType")), useConfFromDB(conf.getParameter<bool>("TrackerConfigurationFromDB")), zeroSuppression(conf.getParameter<bool>("ZeroSuppression")) { const std::string alias("simSiStripDigis"); mixMod.produces<edm::DetSetVector<SiStripDigi> >(ZSDigi).setBranchAlias(ZSDigi); mixMod.produces<edm::DetSetVector<SiStripRawDigi> >(SCDigi).setBranchAlias(alias + SCDigi); mixMod.produces<edm::DetSetVector<SiStripRawDigi> >(VRDigi).setBranchAlias(alias + VRDigi); mixMod.produces<edm::DetSetVector<SiStripRawDigi> >(PRDigi).setBranchAlias(alias + PRDigi); edm::Service<edm::RandomNumberGenerator> rng; if ( ! rng.isAvailable()) { throw cms::Exception("Configuration") << "SiStripDigitizer requires the RandomNumberGeneratorService\n" "which is not present in the configuration file. You must add the service\n" "in the configuration file or remove the modules that require it."; } rndEngine = &(rng->getEngine()); theDigiAlgo.reset(new SiStripDigitizerAlgorithm(conf,(*rndEngine))); }
SiStripDigitizer::~SiStripDigitizer | ( | ) | [virtual] |
Definition at line 87 of file SiStripDigitizer.cc.
{ }
void SiStripDigitizer::accumulate | ( | edm::Event const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 111 of file SiStripDigitizer.cc.
References accumulateStripHits(), edm::Event::getByLabel(), hitsProducer, i, trackerHits::simHits, GlobalPosition_Frontier_DevDB_cff::tag, and trackerContainers.
{ // Step A: Get Inputs for(vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) { edm::Handle<std::vector<PSimHit> > simHits; edm::InputTag tag(hitsProducer, *i); iEvent.getByLabel(tag, simHits); accumulateStripHits(simHits); } }
void SiStripDigitizer::accumulate | ( | PileUpEventPrincipal const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 123 of file SiStripDigitizer.cc.
References accumulateStripHits(), PileUpEventPrincipal::getByLabel(), hitsProducer, i, trackerHits::simHits, GlobalPosition_Frontier_DevDB_cff::tag, and trackerContainers.
{ // Step A: Get Inputs for(vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) { edm::Handle<std::vector<PSimHit> > simHits; edm::InputTag tag(hitsProducer, *i); iEvent.getByLabel(tag, simHits); accumulateStripHits(simHits); } }
void SiStripDigitizer::accumulateStripHits | ( | edm::Handle< std::vector< PSimHit > > | hSimHits | ) | [private] |
Definition at line 90 of file SiStripDigitizer.cc.
References detectorUnits, LogDebug, GloballyPositioned< T >::position(), pSetup, trackerHits::simHits, GeomDet::surface(), and theDigiAlgo.
Referenced by accumulate().
{ if(hSimHits.isValid()) { std::set<unsigned int> detIds; std::vector<PSimHit> const& simHits = *hSimHits.product(); for(std::vector<PSimHit>::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it) { unsigned int detId = (*it).detUnitId(); if(detIds.insert(detId).second) { // The insert succeeded, so this detector element has not yet been processed. StripGeomDetUnit* stripdet = detectorUnits[detId]; //access to magnetic field in global coordinates GlobalVector bfield = pSetup->inTesla(stripdet->surface().position()); LogDebug ("Digitizer ") << "B-field(T) at " << stripdet->surface().position() << "(cm): " << pSetup->inTesla(stripdet->surface().position()); theDigiAlgo->accumulateSimHits(it, itEnd, stripdet, bfield); } } } }
void SiStripDigitizer::finalizeEvent | ( | edm::Event & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 172 of file SiStripDigitizer.cc.
References gainLabel, edm::EventSetup::get(), convertSQLitetoXML_cfg::output, pDD, PRDigi, edm::Event::put(), SCDigi, theDetIdList, theDigiAlgo, useConfFromDB, VRDigi, zeroSuppression, and ZSDigi.
{ edm::ESHandle<SiStripGain> gainHandle; edm::ESHandle<SiStripNoises> noiseHandle; edm::ESHandle<SiStripThreshold> thresholdHandle; edm::ESHandle<SiStripPedestals> pedestalHandle; iSetup.get<SiStripGainSimRcd>().get(gainLabel,gainHandle); iSetup.get<SiStripNoisesRcd>().get(noiseHandle); iSetup.get<SiStripThresholdRcd>().get(thresholdHandle); iSetup.get<SiStripPedestalsRcd>().get(pedestalHandle); std::vector<edm::DetSet<SiStripDigi> > theDigiVector; std::vector<edm::DetSet<SiStripRawDigi> > theRawDigiVector; // Step B: LOOP on StripGeomDetUnit theDigiVector.reserve(10000); theDigiVector.clear(); for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){ if(useConfFromDB){ //apply the cable map _before_ digitization: consider only the detis that are connected if(theDetIdList.find((*iu)->geographicalId().rawId())==theDetIdList.end()) continue; } StripGeomDetUnit* sgd = dynamic_cast<StripGeomDetUnit*>((*iu)); if (sgd != 0){ edm::DetSet<SiStripDigi> collectorZS((*iu)->geographicalId().rawId()); edm::DetSet<SiStripRawDigi> collectorRaw((*iu)->geographicalId().rawId()); theDigiAlgo->digitize(collectorZS,collectorRaw,sgd, gainHandle,thresholdHandle,noiseHandle,pedestalHandle); if(zeroSuppression){ if(collectorZS.data.size()>0){ theDigiVector.push_back(collectorZS); } }else{ if(collectorRaw.data.size()>0){ theRawDigiVector.push_back(collectorRaw); } } } } if(zeroSuppression){ // Step C: create output collection std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>()); std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>()); std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>()); std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(theDigiVector) ); // Step D: write output to file iEvent.put(output, ZSDigi); iEvent.put(output_scopemode, SCDigi); iEvent.put(output_virginraw, VRDigi); iEvent.put(output_processedraw, PRDigi); }else{ // Step C: create output collection std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>(theRawDigiVector)); std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>()); std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>()); std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>() ); // Step D: write output to file iEvent.put(output, ZSDigi); iEvent.put(output_scopemode, SCDigi); iEvent.put(output_virginraw, VRDigi); iEvent.put(output_processedraw, PRDigi); } }
void SiStripDigitizer::initializeEvent | ( | edm::Event const & | e, |
edm::EventSetup const & | c | ||
) | [virtual] |
Implements DigiAccumulatorMixMod.
Definition at line 135 of file SiStripDigitizer.cc.
References detectorUnits, geometryType, edm::EventSetup::get(), pDD, pSetup, DetId::subdetId(), StripSubdetector::TEC, theDetIdList, theDigiAlgo, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and useConfFromDB.
{ // Step A: Get Inputs if(useConfFromDB){ edm::ESHandle<SiStripDetCabling> detCabling; iSetup.get<SiStripDetCablingRcd>().get(detCabling); detCabling->addConnected(theDetIdList); } theDigiAlgo->initializeEvent(iSetup); iSetup.get<TrackerDigiGeometryRecord>().get(geometryType,pDD); iSetup.get<IdealMagneticFieldRecord>().get(pSetup); // FIX THIS! We only need to clear and (re)fill detectorUnits when the geometry type IOV changes. Use ESWatcher to determine this. bool changes = true; if(changes) { // Replace with ESWatcher detectorUnits.clear(); } for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); ++iu) { unsigned int detId = (*iu)->geographicalId().rawId(); DetId idet=DetId(detId); unsigned int isub=idet.subdetId(); if((isub == StripSubdetector::TIB) || (isub == StripSubdetector::TID) || (isub == StripSubdetector::TOB) || (isub == StripSubdetector::TEC)) { StripGeomDetUnit* stripdet = dynamic_cast<StripGeomDetUnit*>((*iu)); assert(stripdet != 0); if(changes) { // Replace with ESWatcher detectorUnits.insert(std::make_pair(detId, stripdet)); } theDigiAlgo->initializeDetUnit(stripdet, iSetup); } } }
std::map<unsigned int, StripGeomDetUnit*> SiStripDigitizer::detectorUnits [private] |
Definition at line 70 of file SiStripDigitizer.h.
Referenced by accumulateStripHits(), and initializeEvent().
const std::string SiStripDigitizer::gainLabel [private] |
Definition at line 55 of file SiStripDigitizer.h.
Referenced by finalizeEvent().
const std::string SiStripDigitizer::geometryType [private] |
Definition at line 62 of file SiStripDigitizer.h.
Referenced by initializeEvent().
const std::string SiStripDigitizer::hitsProducer [private] |
Definition at line 56 of file SiStripDigitizer.h.
Referenced by accumulate().
edm::ESHandle<TrackerGeometry> SiStripDigitizer::pDD [private] |
Definition at line 68 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and initializeEvent().
const std::string SiStripDigitizer::PRDigi [private] |
Definition at line 61 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and SiStripDigitizer().
edm::ESHandle<MagneticField> SiStripDigitizer::pSetup [private] |
Definition at line 69 of file SiStripDigitizer.h.
Referenced by accumulateStripHits(), and initializeEvent().
CLHEP::HepRandomEngine* SiStripDigitizer::rndEngine [private] |
Definition at line 72 of file SiStripDigitizer.h.
Referenced by SiStripDigitizer().
const std::string SiStripDigitizer::SCDigi [private] |
Definition at line 59 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and SiStripDigitizer().
std::map<uint32_t, std::vector<int> > SiStripDigitizer::theDetIdList [private] |
Definition at line 67 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and initializeEvent().
std::unique_ptr<SiStripDigitizerAlgorithm> SiStripDigitizer::theDigiAlgo [private] |
Definition at line 66 of file SiStripDigitizer.h.
Referenced by accumulateStripHits(), finalizeEvent(), initializeEvent(), and SiStripDigitizer().
const vstring SiStripDigitizer::trackerContainers [private] |
Definition at line 57 of file SiStripDigitizer.h.
Referenced by accumulate().
const bool SiStripDigitizer::useConfFromDB [private] |
Definition at line 63 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and initializeEvent().
const std::string SiStripDigitizer::VRDigi [private] |
Definition at line 60 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and SiStripDigitizer().
const bool SiStripDigitizer::zeroSuppression [private] |
Definition at line 64 of file SiStripDigitizer.h.
Referenced by finalizeEvent().
const std::string SiStripDigitizer::ZSDigi [private] |
Definition at line 58 of file SiStripDigitizer.h.
Referenced by finalizeEvent(), and SiStripDigitizer().