CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
cms::SiPixelDigitizer Class Reference

#include <SiPixelDigitizer.h>

Inheritance diagram for cms::SiPixelDigitizer:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c) override
 
virtual void beginJob ()
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c) override
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c) override
 
 SiPixelDigitizer (const edm::ParameterSet &conf, edm::EDProducer &mixMod)
 
virtual ~SiPixelDigitizer ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef std::vector< std::string > vstring
 

Private Member Functions

void accumulatePixelHits (edm::Handle< std::vector< PSimHit > >)
 

Private Attributes

std::unique_ptr
< SiPixelDigitizerAlgorithm
_pixeldigialgo
 
std::map< unsigned int,
PixelGeomDetUnit * > 
detectorUnits
 
bool first
 
const std::string geometryType
 
const std::string hitsProducer
 
edm::ESHandle< TrackerGeometrypDD
 
edm::ESHandle< MagneticFieldpSetup
 
CLHEP::HepRandomEngine * rndEngine
 
const vstring trackerContainers
 

Detailed Description

Definition at line 44 of file SiPixelDigitizer.h.

Member Typedef Documentation

typedef std::vector<std::string> cms::SiPixelDigitizer::vstring
private

Definition at line 61 of file SiPixelDigitizer.h.

Constructor & Destructor Documentation

SiPixelDigitizer::SiPixelDigitizer ( const edm::ParameterSet conf,
edm::EDProducer mixMod 
)
explicit

Definition at line 89 of file SiPixelDigitizer.cc.

References _pixeldigialgo, edm::hlt::Exception, edm::RandomNumberGenerator::getEngine(), edm::Service< T >::isAvailable(), rndEngine, and AlCaHLTBitMon_QueryRunRegistry::string.

89  :
90  first(true),
92  hitsProducer(iConfig.getParameter<std::string>("hitsProducer")),
93  trackerContainers(iConfig.getParameter<std::vector<std::string> >("ROUList")),
94  geometryType(iConfig.getParameter<std::string>("GeometryType"))
95  {
96  edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer";
97 
98  const std::string alias ("simSiPixelDigis");
99 
100  mixMod.produces<edm::DetSetVector<PixelDigi> >().setBranchAlias(alias);
101  mixMod.produces<edm::DetSetVector<PixelDigiSimLink> >().setBranchAlias(alias + "siPixelDigiSimLink");
103  if ( ! rng.isAvailable()) {
104  throw cms::Exception("Configuration")
105  << "SiPixelDigitizer requires the RandomNumberGeneratorService\n"
106  "which is not present in the configuration file. You must add the service\n"
107  "in the configuration file or remove the modules that require it.";
108  }
109 
110  rndEngine = &(rng->getEngine());
111  _pixeldigialgo.reset(new SiPixelDigitizerAlgorithm(iConfig,(*rndEngine)));
112 
113  }
CLHEP::HepRandomEngine * rndEngine
const std::string hitsProducer
bool isAvailable() const
Definition: Service.h:47
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
std::unique_ptr< SiPixelDigitizerAlgorithm > _pixeldigialgo
const std::string geometryType
const vstring trackerContainers
SiPixelDigitizer::~SiPixelDigitizer ( )
virtual

Definition at line 115 of file SiPixelDigitizer.cc.

115  {
116  edm::LogInfo ("PixelDigitizer ") <<"Destruct the Pixel Digitizer";
117  }

Member Function Documentation

void SiPixelDigitizer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 174 of file SiPixelDigitizer.cc.

References accumulatePixelHits(), edm::Event::getByLabel(), hitsProducer, i, trackerHits::simHits, GlobalPosition_Frontier_DevDB_cff::tag, and trackerContainers.

174  {
175  // Step A: Get Inputs
176  for(vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) {
179 
180  iEvent.getByLabel(tag, simHits);
181  accumulatePixelHits(simHits);
182  }
183  }
int i
Definition: DBlmapReader.cc:9
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >)
const std::string hitsProducer
int iEvent
Definition: GenABIO.cc:243
tuple simHits
Definition: trackerHits.py:16
const vstring trackerContainers
void SiPixelDigitizer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 186 of file SiPixelDigitizer.cc.

References accumulatePixelHits(), PileUpEventPrincipal::getByLabel(), hitsProducer, i, trackerHits::simHits, GlobalPosition_Frontier_DevDB_cff::tag, and trackerContainers.

186  {
187  // Step A: Get Inputs
188  for(vstring::const_iterator i = trackerContainers.begin(), iEnd = trackerContainers.end(); i != iEnd; ++i) {
191 
192  iEvent.getByLabel(tag, simHits);
193  accumulatePixelHits(simHits);
194  }
195  }
int i
Definition: DBlmapReader.cc:9
void accumulatePixelHits(edm::Handle< std::vector< PSimHit > >)
const std::string hitsProducer
int iEvent
Definition: GenABIO.cc:243
tuple simHits
Definition: trackerHits.py:16
const vstring trackerContainers
void SiPixelDigitizer::accumulatePixelHits ( edm::Handle< std::vector< PSimHit > >  hSimHits)
private

Definition at line 125 of file SiPixelDigitizer.cc.

References _pixeldigialgo, detectorUnits, LogDebug, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GloballyPositioned< T >::position(), pSetup, trackerHits::simHits, DetId::subdetId(), and GeomDet::surface().

Referenced by accumulate().

125  {
126  if(hSimHits.isValid()) {
127  std::set<unsigned int> detIds;
128  std::vector<PSimHit> const& simHits = *hSimHits.product();
129  for(std::vector<PSimHit>::const_iterator it = simHits.begin(), itEnd = simHits.end(); it != itEnd; ++it) {
130  unsigned int detId = (*it).detUnitId();
131  if(detIds.insert(detId).second) {
132  // The insert succeeded, so this detector element has not yet been processed.
133  unsigned int isub = DetId(detId).subdetId();
135  PixelGeomDetUnit* pixdet = detectorUnits[detId];
136  //access to magnetic field in global coordinates
137  GlobalVector bfield = pSetup->inTesla(pixdet->surface().position());
138  LogDebug ("PixelDigitizer ") << "B-field(T) at " << pixdet->surface().position() << "(cm): "
139  << pSetup->inTesla(pixdet->surface().position());
140  _pixeldigialgo->accumulateSimHits(it, itEnd, pixdet, bfield);
141  }
142  }
143  }
144  }
145  }
#define LogDebug(id)
edm::ESHandle< MagneticField > pSetup
std::map< unsigned int, PixelGeomDetUnit * > detectorUnits
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::unique_ptr< SiPixelDigitizerAlgorithm > _pixeldigialgo
Definition: DetId.h:20
tuple simHits
Definition: trackerHits.py:16
T const * product() const
Definition: Handle.h:74
const PositionType & position() const
virtual void cms::SiPixelDigitizer::beginJob ( void  )
inlinevirtual

Definition at line 56 of file SiPixelDigitizer.h.

56 {}
void SiPixelDigitizer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 199 of file SiPixelDigitizer.cc.

References _pixeldigialgo, edm::EventSetup::get(), convertSQLitetoXML_cfg::output, pDD, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::ESHandle< class >::product(), edm::Event::put(), and DetId::subdetId().

199  {
200 
202  iSetup.get<IdealGeometryRecord>().get(tTopoHand);
203  const TrackerTopology *tTopo=tTopoHand.product();
204 
205  std::vector<edm::DetSet<PixelDigi> > theDigiVector;
206  std::vector<edm::DetSet<PixelDigiSimLink> > theDigiLinkVector;
207 
208  for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){
209  DetId idet=DetId((*iu)->geographicalId().rawId());
210  unsigned int isub=idet.subdetId();
211 
213 
214  //
215 
216  edm::DetSet<PixelDigi> collector((*iu)->geographicalId().rawId());
217  edm::DetSet<PixelDigiSimLink> linkcollector((*iu)->geographicalId().rawId());
218 
219 
220  _pixeldigialgo->digitize(dynamic_cast<PixelGeomDetUnit*>((*iu)),
221  collector.data,
222  linkcollector.data,
223  tTopo);
224  if(collector.data.size() > 0) {
225  theDigiVector.push_back(std::move(collector));
226  }
227  if(linkcollector.data.size() > 0) {
228  theDigiLinkVector.push_back(std::move(linkcollector));
229  }
230  }
231  }
232 
233  // Step C: create collection with the cache vector of DetSet
234  std::auto_ptr<edm::DetSetVector<PixelDigi> >
235  output(new edm::DetSetVector<PixelDigi>(theDigiVector) );
236  std::auto_ptr<edm::DetSetVector<PixelDigiSimLink> >
237  outputlink(new edm::DetSetVector<PixelDigiSimLink>(theDigiLinkVector) );
238 
239  // Step D: write output to file
240  iEvent.put(output);
241  iEvent.put(outputlink);
242  }
int iEvent
Definition: GenABIO.cc:243
edm::ESHandle< TrackerGeometry > pDD
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::unique_ptr< SiPixelDigitizerAlgorithm > _pixeldigialgo
Definition: DetId.h:20
T const * product() const
Definition: ESHandle.h:62
void SiPixelDigitizer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Implements DigiAccumulatorMixMod.

Definition at line 148 of file SiPixelDigitizer.cc.

References _pixeldigialgo, detectorUnits, first, geometryType, edm::EventSetup::get(), pDD, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, pSetup, and DetId::subdetId().

148  {
149  if(first){
150  _pixeldigialgo->init(iSetup);
151  first = false;
152  }
153  _pixeldigialgo->initializeEvent();
154  iSetup.get<TrackerDigiGeometryRecord>().get(geometryType, pDD);
155  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
156 
157  // FIX THIS! We only need to clear and (re)fill this map when the geometry type IOV changes. Use ESWatcher to determine this.
158  if(true) { // Replace with ESWatcher
159  detectorUnits.clear();
160  for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); ++iu) {
161  unsigned int detId = (*iu)->geographicalId().rawId();
162  DetId idet=DetId(detId);
163  unsigned int isub=idet.subdetId();
165  PixelGeomDetUnit* pixdet = dynamic_cast<PixelGeomDetUnit*>((*iu));
166  assert(pixdet != 0);
167  detectorUnits.insert(std::make_pair(detId, pixdet));
168  }
169  }
170  }
171  }
edm::ESHandle< MagneticField > pSetup
std::map< unsigned int, PixelGeomDetUnit * > detectorUnits
edm::ESHandle< TrackerGeometry > pDD
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::unique_ptr< SiPixelDigitizerAlgorithm > _pixeldigialgo
Definition: DetId.h:20
const std::string geometryType

Member Data Documentation

std::unique_ptr<SiPixelDigitizerAlgorithm> cms::SiPixelDigitizer::_pixeldigialgo
private
std::map<unsigned int, PixelGeomDetUnit*> cms::SiPixelDigitizer::detectorUnits
private

Definition at line 67 of file SiPixelDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

bool cms::SiPixelDigitizer::first
private

Definition at line 59 of file SiPixelDigitizer.h.

Referenced by initializeEvent().

const std::string cms::SiPixelDigitizer::geometryType
private

Definition at line 64 of file SiPixelDigitizer.h.

Referenced by initializeEvent().

const std::string cms::SiPixelDigitizer::hitsProducer
private

Definition at line 62 of file SiPixelDigitizer.h.

Referenced by accumulate().

edm::ESHandle<TrackerGeometry> cms::SiPixelDigitizer::pDD
private

Definition at line 65 of file SiPixelDigitizer.h.

Referenced by finalizeEvent(), and initializeEvent().

edm::ESHandle<MagneticField> cms::SiPixelDigitizer::pSetup
private

Definition at line 66 of file SiPixelDigitizer.h.

Referenced by accumulatePixelHits(), and initializeEvent().

CLHEP::HepRandomEngine* cms::SiPixelDigitizer::rndEngine
private

Definition at line 68 of file SiPixelDigitizer.h.

Referenced by SiPixelDigitizer().

const vstring cms::SiPixelDigitizer::trackerContainers
private

Definition at line 63 of file SiPixelDigitizer.h.

Referenced by accumulate().