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 Attributes
cms::SiPixelDigitizer Class Reference

#include <SiPixelDigitizer.h>

Inheritance diagram for cms::SiPixelDigitizer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
 SiPixelDigitizer (const edm::ParameterSet &conf)
 
virtual ~SiPixelDigitizer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 
bool first
 
std::string geometryType
 
CLHEP::HepRandomEngine * rndEngine
 
simhit_map SimHitMap
 
std::vector< edm::DetSet
< PixelDigiSimLink > > 
theDigiLinkVector
 
std::vector< edm::DetSet
< PixelDigi > > 
theDigiVector
 
vstring trackerContainers
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 35 of file SiPixelDigitizer.h.

Member Typedef Documentation

typedef std::map<unsigned int, std::vector<PSimHit>,std::less<unsigned int> > cms::SiPixelDigitizer::simhit_map
private

Definition at line 52 of file SiPixelDigitizer.h.

typedef simhit_map::iterator cms::SiPixelDigitizer::simhit_map_iterator
private

Definition at line 53 of file SiPixelDigitizer.h.

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

Definition at line 50 of file SiPixelDigitizer.h.

Constructor & Destructor Documentation

SiPixelDigitizer::SiPixelDigitizer ( const edm::ParameterSet conf)
explicit

Definition at line 86 of file SiPixelDigitizer.cc.

References _pixeldigialgo, edm::hlt::Exception, geometryType, edm::ParameterSet::getParameter(), rndEngine, and trackerContainers.

86  :
87  conf_(iConfig),first(true)
88  {
89  edm::LogInfo ("PixelDigitizer ") <<"Enter the Pixel Digitizer";
90 
91  std::string alias ( iConfig.getParameter<std::string>("@module_label") );
92 
93  produces<edm::DetSetVector<PixelDigi> >().setBranchAlias( alias );
94  produces<edm::DetSetVector<PixelDigiSimLink> >().setBranchAlias ( alias + "siPixelDigiSimLink");
95  trackerContainers.clear();
96  trackerContainers = iConfig.getParameter<std::vector<std::string> >("ROUList");
97  geometryType = iConfig.getParameter<std::string>("GeometryType");
99  if ( ! rng.isAvailable()) {
100  throw cms::Exception("Configuration")
101  << "SiPixelDigitizer requires the RandomNumberGeneratorService\n"
102  "which is not present in the configuration file. You must add the service\n"
103  "in the configuration file or remove the modules that require it.";
104  }
105 
106  rndEngine = &(rng->getEngine());
108 
109  }
CLHEP::HepRandomEngine * rndEngine
SiPixelDigitizerAlgorithm * _pixeldigialgo
edm::ParameterSet conf_
SiPixelDigitizer::~SiPixelDigitizer ( )
virtual

Definition at line 111 of file SiPixelDigitizer.cc.

References _pixeldigialgo.

111  {
112  edm::LogInfo ("PixelDigitizer ") <<"Destruct the Pixel Digitizer";
113  delete _pixeldigialgo;
114  }
SiPixelDigitizerAlgorithm * _pixeldigialgo

Member Function Documentation

virtual void cms::SiPixelDigitizer::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 45 of file SiPixelDigitizer.h.

45 {}
void SiPixelDigitizer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 123 of file SiPixelDigitizer.cc.

References _pixeldigialgo, MixCollection< T >::begin(), edm::DetSet< T >::data, cond::rpcobgas::detid, MixCollection< T >::end(), first, geometryType, edm::EventSetup::get(), edm::Event::getByLabel(), i, SiPixelDigitizerAlgorithm::init(), LogDebug, SiPixelDigitizerAlgorithm::make_link(), convertSQLitetoXML_cfg::output, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::Handle< T >::product(), edm::Event::put(), SiPixelDigitizerAlgorithm::run(), SimHitMap, DetId::subdetId(), theDigiLinkVector, theDigiVector, and trackerContainers.

124  {
125 
126  if(first){
127  _pixeldigialgo->init(iSetup);
128  first = false;
129  }
130 
131  // Step A: Get Inputs
133  std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec;
134  for(uint32_t i = 0; i< trackerContainers.size();i++){
135  iEvent.getByLabel("mix",trackerContainers[i],cf_simhit);
136  cf_simhitvec.push_back(cf_simhit.product());
137  }
138 
139  std::auto_ptr<MixCollection<PSimHit> > allPixelTrackerHits(new MixCollection<PSimHit>(cf_simhitvec));
140 
142 
143  iSetup.get<TrackerDigiGeometryRecord> ().get(geometryType,pDD);
144 
146  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
147 
148  //Loop on PSimHit
149  SimHitMap.clear();
150 
152  for (isim=allPixelTrackerHits->begin(); isim!= allPixelTrackerHits->end();isim++) {
153  DetId detid=DetId((*isim).detUnitId());
154  unsigned int subid=detid.subdetId();
156  SimHitMap[(*isim).detUnitId()].push_back((*isim));
157  }
158  }
159 
160  // Step B: LOOP on PixelGeomDetUnit //
161  for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){
162  DetId idet=DetId((*iu)->geographicalId().rawId());
163  unsigned int isub=idet.subdetId();
164 
165 
167 
168 
169  //access to magnetic field in global coordinates
170  GlobalVector bfield=pSetup->inTesla((*iu)->surface().position());
171  LogDebug ("PixelDigitizer ") << "B-field(T) at "<<(*iu)->surface().position()<<"(cm): "
172  << pSetup->inTesla((*iu)->surface().position());
173  //
174 
175  edm::DetSet<PixelDigi> collector((*iu)->geographicalId().rawId());
176  edm::DetSet<PixelDigiSimLink> linkcollector((*iu)->geographicalId().rawId());
177 
178 
179  collector.data=
180  _pixeldigialgo->run(SimHitMap[(*iu)->geographicalId().rawId()],
181  dynamic_cast<PixelGeomDetUnit*>((*iu)),
182  bfield);
183  if (collector.data.size()>0){
184  theDigiVector.push_back(collector);
185 
186  //digisimlink
187  if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){
188  linkcollector.data=_pixeldigialgo->make_link();
189  if (linkcollector.data.size()>0) theDigiLinkVector.push_back(linkcollector);
190  }
191 
192  }
193  }
194 
195  }
196 
197  // Step C: create collection with the cache vector of DetSet
198  std::auto_ptr<edm::DetSetVector<PixelDigi> >
200  std::auto_ptr<edm::DetSetVector<PixelDigiSimLink> >
202 
203  // Step D: write output to file
204  iEvent.put(output);
205  iEvent.put(outputlink);
206  }
#define LogDebug(id)
void init(const edm::EventSetup &es)
int i
Definition: DBlmapReader.cc:9
std::vector< PixelDigiSimLink > make_link()
iterator end()
int iEvent
Definition: GenABIO.cc:243
std::vector< edm::DetSet< PixelDigiSimLink > > theDigiLinkVector
edm::DetSet< PixelDigi >::collection_type run(const std::vector< PSimHit > &input, PixelGeomDetUnit *pixdet, GlobalVector)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
SiPixelDigitizerAlgorithm * _pixeldigialgo
Definition: DetId.h:20
iterator begin()
T const * product() const
Definition: Handle.h:74
collection_type data
Definition: DetSet.h:79
std::vector< edm::DetSet< PixelDigi > > theDigiVector

Member Data Documentation

SiPixelDigitizerAlgorithm* cms::SiPixelDigitizer::_pixeldigialgo
private

Definition at line 49 of file SiPixelDigitizer.h.

Referenced by produce(), SiPixelDigitizer(), and ~SiPixelDigitizer().

edm::ParameterSet cms::SiPixelDigitizer::conf_
private

Definition at line 47 of file SiPixelDigitizer.h.

bool cms::SiPixelDigitizer::first
private

Definition at line 48 of file SiPixelDigitizer.h.

Referenced by produce().

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

Definition at line 57 of file SiPixelDigitizer.h.

Referenced by produce(), and SiPixelDigitizer().

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

Definition at line 58 of file SiPixelDigitizer.h.

Referenced by SiPixelDigitizer().

simhit_map cms::SiPixelDigitizer::SimHitMap
private

Definition at line 54 of file SiPixelDigitizer.h.

Referenced by produce().

std::vector<edm::DetSet<PixelDigiSimLink> > cms::SiPixelDigitizer::theDigiLinkVector
private

Definition at line 56 of file SiPixelDigitizer.h.

Referenced by produce().

std::vector<edm::DetSet<PixelDigi> > cms::SiPixelDigitizer::theDigiVector
private

Definition at line 55 of file SiPixelDigitizer.h.

Referenced by produce().

vstring cms::SiPixelDigitizer::trackerContainers
private

Definition at line 51 of file SiPixelDigitizer.h.

Referenced by produce(), and SiPixelDigitizer().