#include <SimTracker/SiStripDigitizer/interface/SiStripDigitizer.h>
Public Member Functions | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
SiStripDigitizer (const edm::ParameterSet &conf) | |
virtual | ~SiStripDigitizer () |
Private Types | |
typedef std::map< unsigned int, std::vector< std::pair < PSimHit, int > >, std::less < unsigned int > > | simhit_map |
typedef simhit_map::iterator | simhit_map_iterator |
typedef std::vector< std::string > | vstring |
Private Attributes | |
std::string | alias |
edm::ParameterSet | conf_ |
std::string | geometryType |
int | numStrips |
CLHEP::HepRandomEngine * | rndEngine |
simhit_map | SimHitMap |
SimHitSelectorFromDB | SimHitSelectorFromDB_ |
std::map< uint32_t, std::vector< int > > | theDetIdList |
SiStripDigitizerAlgorithm * | theDigiAlgo |
std::vector< edm::DetSet < StripDigiSimLink > > | theDigiLinkVector |
std::vector< edm::DetSet < SiStripDigi > > | theDigiVector |
std::vector< edm::DetSet < SiStripRawDigi > > | theRawDigiVector |
SiStripFedZeroSuppression * | theSiFEDZeroSuppress |
vstring | trackerContainers |
bool | useConfFromDB |
bool | zeroSuppression |
Definition at line 35 of file SiStripDigitizer.h.
typedef std::map<unsigned int, std::vector<std::pair<PSimHit, int> >,std::less<unsigned int> > SiStripDigitizer::simhit_map [private] |
Definition at line 48 of file SiStripDigitizer.h.
typedef simhit_map::iterator SiStripDigitizer::simhit_map_iterator [private] |
Definition at line 49 of file SiStripDigitizer.h.
typedef std::vector<std::string> SiStripDigitizer::vstring [private] |
Definition at line 46 of file SiStripDigitizer.h.
SiStripDigitizer::SiStripDigitizer | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 64 of file SiStripDigitizer.cc.
References alias, conf_, Exception, geometryType, edm::ParameterSet::getParameter(), rndEngine, theDigiAlgo, trackerContainers, useConfFromDB, and zeroSuppression.
00064 : 00065 conf_(conf) 00066 { 00067 alias = conf.getParameter<std::string>("@module_label"); 00068 edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList"); 00069 00070 produces<edm::DetSetVector<SiStripDigi> >(ParamSet.getParameter<std::string>("ZSDigi")).setBranchAlias( ParamSet.getParameter<std::string>("ZSDigi") ); 00071 produces<edm::DetSetVector<StripDigiSimLink> >().setBranchAlias ( alias + "siStripDigiSimLink"); 00072 produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("SCDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("SCDigi") ); 00073 produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("VRDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("VRDigi") ); 00074 produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("PRDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("PRDigi") ); 00075 trackerContainers.clear(); 00076 trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList"); 00077 geometryType = conf.getParameter<std::string>("GeometryType"); 00078 useConfFromDB = conf.getParameter<bool>("TrackerConfigurationFromDB"); 00079 edm::Service<edm::RandomNumberGenerator> rng; 00080 if ( ! rng.isAvailable()) { 00081 throw cms::Exception("Configuration") 00082 << "SiStripDigitizer requires the RandomNumberGeneratorService\n" 00083 "which is not present in the configuration file. You must add the service\n" 00084 "in the configuration file or remove the modules that require it."; 00085 } 00086 00087 rndEngine = &(rng->getEngine()); 00088 zeroSuppression = conf_.getParameter<bool>("ZeroSuppression"); 00089 theDigiAlgo = new SiStripDigitizerAlgorithm(conf_,(*rndEngine)); 00090 00091 }
SiStripDigitizer::~SiStripDigitizer | ( | ) | [virtual] |
Definition at line 94 of file SiStripDigitizer.cc.
References theDigiAlgo.
00094 { 00095 delete theDigiAlgo; 00096 }
void SiStripDigitizer::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 99 of file SiStripDigitizer.cc.
References conf_, geometryType, edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventSetup::getData(), edm::ParameterSet::getParameter(), SimHitSelectorFromDB::getSimHit(), i, edm::ESHandle< T >::isValid(), SiStripDigitizerAlgorithm::make_link(), output(), edm::Handle< T >::product(), edm::Event::put(), SiStripDigitizerAlgorithm::run(), SiStripDigitizerAlgorithm::setParticleDataTable(), SimHitMap, SimHitSelectorFromDB_, theDetIdList, theDigiAlgo, theDigiLinkVector, theDigiVector, theRawDigiVector, trackerContainers, useConfFromDB, and zeroSuppression.
00100 { 00101 00102 // Step A: Get Inputs 00103 edm::ESHandle < ParticleDataTable > pdt; 00104 iSetup.getData( pdt ); 00105 00106 if(useConfFromDB){ 00107 edm::ESHandle<SiStripDetCabling> detCabling; 00108 iSetup.get<SiStripDetCablingRcd>().get( detCabling ); 00109 detCabling->addConnected(theDetIdList); 00110 } 00111 00112 edm::Handle<CrossingFrame<PSimHit> > cf_simhit; 00113 std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec; 00114 for(uint32_t i = 0; i< trackerContainers.size();i++){ 00115 iEvent.getByLabel("mix",trackerContainers[i],cf_simhit); 00116 cf_simhitvec.push_back(cf_simhit.product()); 00117 } 00118 00119 std::auto_ptr<MixCollection<PSimHit> > allTrackerHits(new MixCollection<PSimHit>(cf_simhitvec)); 00120 00121 //Loop on PSimHit 00122 SimHitMap.clear(); 00123 00124 //inside SimHitSelectorFromDb add the counter information from the original allhits collection 00125 std::vector<std::pair<PSimHit,int> > trackerHits = SimHitSelectorFromDB_.getSimHit(allTrackerHits,theDetIdList); 00126 00127 std::vector<std::pair<PSimHit,int> >::iterator isim; 00128 for (isim=trackerHits.begin() ; isim!= trackerHits.end();isim++) { 00129 //make a pair = <*isim, counter> and save also position in the vector for DigiSimLink 00130 SimHitMap[((*isim).first).detUnitId()].push_back(*isim); 00131 // std::cout << "Hit in the final MAP " << (*isim).second << std::endl; 00132 } 00133 00134 edm::ESHandle<TrackerGeometry> pDD; 00135 00136 iSetup.get<TrackerDigiGeometryRecord>().get(geometryType,pDD); 00137 00138 edm::ESHandle<MagneticField> pSetup; 00139 iSetup.get<IdealMagneticFieldRecord>().get(pSetup); 00140 00141 //get gain noise pedestal lorentzAngle from ES handle 00142 edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle; 00143 edm::ESHandle<SiStripGain> gainHandle; 00144 edm::ESHandle<SiStripNoises> noiseHandle; 00145 edm::ESHandle<SiStripThreshold> thresholdHandle; 00146 edm::ESHandle<SiStripPedestals> pedestalHandle; 00147 std::string LAname = conf_.getParameter<std::string>("LorentzAngle"); 00148 iSetup.get<SiStripLorentzAngleRcd>().get(LAname,lorentzAngleHandle); 00149 std::string gainLabel = conf_.getParameter<std::string>("Gain"); 00150 iSetup.get<SiStripGainRcd>().get(gainLabel,gainHandle); 00151 iSetup.get<SiStripNoisesRcd>().get(noiseHandle); 00152 iSetup.get<SiStripThresholdRcd>().get(thresholdHandle); 00153 iSetup.get<SiStripPedestalsRcd>().get(pedestalHandle); 00154 00155 00156 theDigiAlgo->setParticleDataTable(&*pdt); 00157 00158 // Step B: LOOP on StripGeomDetUnit // 00159 theDigiVector.reserve(10000); 00160 theDigiVector.clear(); 00161 00162 theDigiLinkVector.reserve(10000); 00163 theDigiLinkVector.clear(); 00164 00165 for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){ 00166 00167 if(useConfFromDB){ 00168 //apply the cable map _before_ digitization: consider only the detis that are connected 00169 if(theDetIdList.find((*iu)->geographicalId().rawId())==theDetIdList.end()) 00170 continue; 00171 } 00172 00173 GlobalVector bfield=pSetup->inTesla((*iu)->surface().position()); 00174 00175 StripGeomDetUnit* sgd = dynamic_cast<StripGeomDetUnit*>((*iu)); 00176 if (sgd != 0){ 00177 edm::DetSet<SiStripDigi> collectorZS((*iu)->geographicalId().rawId()); 00178 edm::DetSet<SiStripRawDigi> collectorRaw((*iu)->geographicalId().rawId()); 00179 edm::DetSet<StripDigiSimLink> linkcollector((*iu)->geographicalId().rawId()); 00180 00181 float langle=0.; 00182 if(lorentzAngleHandle.isValid())langle=lorentzAngleHandle->getLorentzAngle((*iu)->geographicalId().rawId()); 00183 theDigiAlgo->run(collectorZS,collectorRaw,SimHitMap[(*iu)->geographicalId().rawId()],sgd,bfield,langle, 00184 gainHandle,thresholdHandle,noiseHandle,pedestalHandle); 00185 00186 if(zeroSuppression){ 00187 if(collectorZS.data.size()>0){ 00188 theDigiVector.push_back(collectorZS); 00189 if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){ 00190 linkcollector.data = theDigiAlgo->make_link(); 00191 if(linkcollector.data.size()>0) 00192 theDigiLinkVector.push_back(linkcollector); 00193 } 00194 } 00195 }else{ 00196 if(collectorRaw.data.size()>0){ 00197 theRawDigiVector.push_back(collectorRaw); 00198 if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){ 00199 linkcollector.data = theDigiAlgo->make_link(); 00200 if(linkcollector.data.size()>0) 00201 theDigiLinkVector.push_back(linkcollector); 00202 } 00203 } 00204 } 00205 } 00206 } 00207 00208 if(zeroSuppression){ 00209 // Step C: create output collection 00210 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>()); 00211 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>()); 00212 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>()); 00213 std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(theDigiVector) ); 00214 std::auto_ptr<edm::DetSetVector<StripDigiSimLink> > outputlink(new edm::DetSetVector<StripDigiSimLink>(theDigiLinkVector) ); 00215 00216 // Step D: write output to file 00217 edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList"); 00218 00219 iEvent.put(output,ParamSet.getParameter<std::string>("ZSDigi")); 00220 iEvent.put(outputlink); 00221 iEvent.put(output_scopemode, ParamSet.getParameter<std::string>("SCDigi")); 00222 iEvent.put(output_virginraw, ParamSet.getParameter<std::string>("VRDigi")); 00223 iEvent.put(output_processedraw,ParamSet.getParameter<std::string>("PRDigi")); 00224 }else{ 00225 // Step C: create output collection 00226 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>(theRawDigiVector)); 00227 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>()); 00228 std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>()); 00229 std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>() ); 00230 std::auto_ptr<edm::DetSetVector<StripDigiSimLink> > outputlink(new edm::DetSetVector<StripDigiSimLink>(theDigiLinkVector) ); 00231 00232 // Step D: write output to file 00233 edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList"); 00234 00235 iEvent.put(output,ParamSet.getParameter<std::string>("ZSDigi")); 00236 iEvent.put(outputlink); 00237 iEvent.put(output_scopemode, ParamSet.getParameter<std::string>("SCDigi")); 00238 iEvent.put(output_virginraw, ParamSet.getParameter<std::string>("VRDigi")); 00239 iEvent.put(output_processedraw,ParamSet.getParameter<std::string>("PRDigi")); 00240 } 00241 }
std::string SiStripDigitizer::alias [private] |
edm::ParameterSet SiStripDigitizer::conf_ [private] |
std::string SiStripDigitizer::geometryType [private] |
int SiStripDigitizer::numStrips [private] |
Definition at line 61 of file SiStripDigitizer.h.
CLHEP::HepRandomEngine* SiStripDigitizer::rndEngine [private] |
simhit_map SiStripDigitizer::SimHitMap [private] |
std::map<uint32_t, std::vector<int> > SiStripDigitizer::theDetIdList [private] |
Definition at line 51 of file SiStripDigitizer.h.
Referenced by produce(), SiStripDigitizer(), and ~SiStripDigitizer().
std::vector<edm::DetSet<StripDigiSimLink> > SiStripDigitizer::theDigiLinkVector [private] |
std::vector<edm::DetSet<SiStripDigi> > SiStripDigitizer::theDigiVector [private] |
std::vector<edm::DetSet<SiStripRawDigi> > SiStripDigitizer::theRawDigiVector [private] |
Definition at line 52 of file SiStripDigitizer.h.
vstring SiStripDigitizer::trackerContainers [private] |
bool SiStripDigitizer::useConfFromDB [private] |
bool SiStripDigitizer::zeroSuppression [private] |