#include <SimTracker/SiPixelDigitizer/interface/SiPixelDigitizer.h>
Public Member Functions | |
virtual void | beginJob (const edm::EventSetup &es) |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
SiPixelDigitizer (const edm::ParameterSet &conf) | |
virtual | ~SiPixelDigitizer () |
Private Types | |
typedef std::map< unsigned int, std::vector< PSimHit >, std::less< unsigned int > > | simhit_map |
typedef simhit_map::iterator | simhit_map_iterator |
typedef std::vector< std::string > | vstring |
Private Attributes | |
SiPixelDigitizerAlgorithm | _pixeldigialgo |
edm::ParameterSet | conf_ |
std::string | geometryType |
simhit_map | SimHitMap |
std::vector< edm::DetSet < PixelDigiSimLink > > | theDigiLinkVector |
std::vector< edm::DetSet < PixelDigi > > | theDigiVector |
vstring | trackerContainers |
Definition at line 32 of file SiPixelDigitizer.h.
typedef std::map<unsigned int, std::vector<PSimHit>,std::less<unsigned int> > cms::SiPixelDigitizer::simhit_map [private] |
Definition at line 48 of file SiPixelDigitizer.h.
typedef simhit_map::iterator cms::SiPixelDigitizer::simhit_map_iterator [private] |
Definition at line 49 of file SiPixelDigitizer.h.
typedef std::vector<std::string> cms::SiPixelDigitizer::vstring [private] |
Definition at line 46 of file SiPixelDigitizer.h.
SiPixelDigitizer::SiPixelDigitizer | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 80 of file SiPixelDigitizer.cc.
References geometryType, edm::ParameterSet::getParameter(), and trackerContainers.
00080 : 00081 conf_(iConfig), 00082 _pixeldigialgo(iConfig) 00083 00084 { 00085 edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer"; 00086 00087 std::string alias ( iConfig.getParameter<std::string>("@module_label") ); 00088 00089 produces<edm::DetSetVector<PixelDigi> >().setBranchAlias( alias ); 00090 produces<edm::DetSetVector<PixelDigiSimLink> >().setBranchAlias ( alias + "siPixelDigiSimLink"); 00091 trackerContainers.clear(); 00092 trackerContainers = iConfig.getParameter<std::vector<std::string> >("ROUList"); 00093 geometryType = iConfig.getParameter<std::string>("GeometryType"); 00094 00095 00096 00097 }
SiPixelDigitizer::~SiPixelDigitizer | ( | ) | [virtual] |
Definition at line 103 of file SiPixelDigitizer.cc.
00104 { edm::LogInfo ("PixelDigitizer ") <<"Destruct the Pixel Digitizer";}
void SiPixelDigitizer::beginJob | ( | const edm::EventSetup & | es | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 99 of file SiPixelDigitizer.cc.
00099 { 00100 _pixeldigialgo.init(es); 00101 }
void SiPixelDigitizer::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 113 of file SiPixelDigitizer.cc.
References MixCollection< T >::begin(), MixCollection< T >::end(), edm::EventSetup::get(), edm::Event::getByLabel(), i, LogDebug, output(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::Handle< T >::product(), edm::Event::put(), and DetId::subdetId().
00114 { 00115 // Step A: Get Inputs 00116 edm::Handle<CrossingFrame<PSimHit> > cf_simhit; 00117 std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec; 00118 for(uint32_t i = 0; i< trackerContainers.size();i++){ 00119 iEvent.getByLabel("mix",trackerContainers[i],cf_simhit); 00120 cf_simhitvec.push_back(cf_simhit.product()); 00121 } 00122 00123 std::auto_ptr<MixCollection<PSimHit> > allPixelTrackerHits(new MixCollection<PSimHit>(cf_simhitvec)); 00124 00125 edm::ESHandle<TrackerGeometry> pDD; 00126 00127 iSetup.get<TrackerDigiGeometryRecord> ().get(geometryType,pDD); 00128 00129 edm::ESHandle<MagneticField> pSetup; 00130 iSetup.get<IdealMagneticFieldRecord>().get(pSetup); 00131 00132 //Loop on PSimHit 00133 SimHitMap.clear(); 00134 00135 MixCollection<PSimHit>::iterator isim; 00136 for (isim=allPixelTrackerHits->begin(); isim!= allPixelTrackerHits->end();isim++) { 00137 DetId detid=DetId((*isim).detUnitId()); 00138 unsigned int subid=detid.subdetId(); 00139 if ((subid== PixelSubdetector::PixelBarrel) || (subid== PixelSubdetector::PixelEndcap)) { 00140 SimHitMap[(*isim).detUnitId()].push_back((*isim)); 00141 } 00142 } 00143 00144 // Step B: LOOP on PixelGeomDetUnit // 00145 for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){ 00146 DetId idet=DetId((*iu)->geographicalId().rawId()); 00147 unsigned int isub=idet.subdetId(); 00148 00149 00150 if ((isub== PixelSubdetector::PixelBarrel) || (isub== PixelSubdetector::PixelEndcap)) { 00151 00152 00153 //access to magnetic field in global coordinates 00154 GlobalVector bfield=pSetup->inTesla((*iu)->surface().position()); 00155 LogDebug ("PixelDigitizer ") << "B-field(T) at "<<(*iu)->surface().position()<<"(cm): " 00156 << pSetup->inTesla((*iu)->surface().position()); 00157 // 00158 00159 edm::DetSet<PixelDigi> collector((*iu)->geographicalId().rawId()); 00160 edm::DetSet<PixelDigiSimLink> linkcollector((*iu)->geographicalId().rawId()); 00161 00162 00163 collector.data= 00164 _pixeldigialgo.run(SimHitMap[(*iu)->geographicalId().rawId()], 00165 dynamic_cast<PixelGeomDetUnit*>((*iu)), 00166 bfield); 00167 if (collector.data.size()>0){ 00168 theDigiVector.push_back(collector); 00169 00170 //digisimlink 00171 if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){ 00172 linkcollector.data=_pixeldigialgo.make_link(); 00173 if (linkcollector.data.size()>0) theDigiLinkVector.push_back(linkcollector); 00174 } 00175 00176 } 00177 } 00178 00179 } 00180 00181 // Step C: create collection with the cache vector of DetSet 00182 std::auto_ptr<edm::DetSetVector<PixelDigi> > 00183 output(new edm::DetSetVector<PixelDigi>(theDigiVector) ); 00184 std::auto_ptr<edm::DetSetVector<PixelDigiSimLink> > 00185 outputlink(new edm::DetSetVector<PixelDigiSimLink>(theDigiLinkVector) ); 00186 00187 // Step D: write output to file 00188 iEvent.put(output); 00189 iEvent.put(outputlink); 00190 }
Definition at line 45 of file SiPixelDigitizer.h.
Definition at line 44 of file SiPixelDigitizer.h.
std::string cms::SiPixelDigitizer::geometryType [private] |
simhit_map cms::SiPixelDigitizer::SimHitMap [private] |
Definition at line 50 of file SiPixelDigitizer.h.
std::vector<edm::DetSet<PixelDigiSimLink> > cms::SiPixelDigitizer::theDigiLinkVector [private] |
Definition at line 52 of file SiPixelDigitizer.h.
std::vector<edm::DetSet<PixelDigi> > cms::SiPixelDigitizer::theDigiVector [private] |
Definition at line 51 of file SiPixelDigitizer.h.