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
SiStripDigitizer Class Reference

#include <SiStripDigitizer.h>

Inheritance diagram for SiStripDigitizer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
 SiStripDigitizer (const edm::ParameterSet &conf)
 
virtual ~SiStripDigitizer ()
 
- 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< 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 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
 
SiStripDigitizerAlgorithmtheDigiAlgo
 
std::vector< edm::DetSet
< StripDigiSimLink > > 
theDigiLinkVector
 
std::vector< edm::DetSet
< SiStripDigi > > 
theDigiVector
 
std::vector< edm::DetSet
< SiStripRawDigi > > 
theRawDigiVector
 
SiStripFedZeroSuppressiontheSiFEDZeroSuppress
 
vstring trackerContainers
 
bool useConfFromDB
 
bool zeroSuppression
 

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)
 
- 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

SiStripDigitizer to convert hits to digis

Definition at line 35 of file SiStripDigitizer.h.

Member Typedef Documentation

typedef std::map<unsigned int, std::vector<std::pair<const PSimHit*, int> >,std::less<unsigned int> > SiStripDigitizer::simhit_map
private

Definition at line 47 of file SiStripDigitizer.h.

typedef simhit_map::iterator SiStripDigitizer::simhit_map_iterator
private

Definition at line 48 of file SiStripDigitizer.h.

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

Definition at line 46 of file SiStripDigitizer.h.

Constructor & Destructor Documentation

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

Definition at line 63 of file SiStripDigitizer.cc.

References alias, conf_, edm::hlt::Exception, geometryType, edm::ParameterSet::getParameter(), rndEngine, theDigiAlgo, trackerContainers, useConfFromDB, and zeroSuppression.

63  :
64  conf_(conf)
65 {
66  alias = conf.getParameter<std::string>("@module_label");
67  edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList");
68 
69  produces<edm::DetSetVector<SiStripDigi> >(ParamSet.getParameter<std::string>("ZSDigi")).setBranchAlias( ParamSet.getParameter<std::string>("ZSDigi") );
70  produces<edm::DetSetVector<StripDigiSimLink> >().setBranchAlias ( alias + "siStripDigiSimLink");
71  produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("SCDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("SCDigi") );
72  produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("VRDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("VRDigi") );
73  produces<edm::DetSetVector<SiStripRawDigi> >(ParamSet.getParameter<std::string>("PRDigi")).setBranchAlias( alias + ParamSet.getParameter<std::string>("PRDigi") );
74  trackerContainers.clear();
75  trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
76  geometryType = conf.getParameter<std::string>("GeometryType");
77  useConfFromDB = conf.getParameter<bool>("TrackerConfigurationFromDB");
79  if ( ! rng.isAvailable()) {
80  throw cms::Exception("Configuration")
81  << "SiStripDigitizer requires the RandomNumberGeneratorService\n"
82  "which is not present in the configuration file. You must add the service\n"
83  "in the configuration file or remove the modules that require it.";
84  }
85 
86  rndEngine = &(rng->getEngine());
87  zeroSuppression = conf_.getParameter<bool>("ZeroSuppression");
89 
90 }
T getParameter(std::string const &) const
SiStripDigitizerAlgorithm * theDigiAlgo
edm::ParameterSet conf_
std::string geometryType
CLHEP::HepRandomEngine * rndEngine
SiStripDigitizer::~SiStripDigitizer ( )
virtual

Definition at line 93 of file SiStripDigitizer.cc.

References theDigiAlgo.

93  {
94  delete theDigiAlgo;
95 }
SiStripDigitizerAlgorithm * theDigiAlgo

Member Function Documentation

void SiStripDigitizer::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 98 of file SiStripDigitizer.cc.

References conf_, geometryType, edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventSetup::getData(), edm::ParameterSet::getParameter(), SimHitSelectorFromDB::getSimHit(), i, edm::ESHandleBase::isValid(), SiStripDigitizerAlgorithm::make_link(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), SiStripDigitizerAlgorithm::run(), SiStripDigitizerAlgorithm::setParticleDataTable(), SimHitMap, SimHitSelectorFromDB_, theDetIdList, theDigiAlgo, theDigiLinkVector, theDigiVector, theRawDigiVector, trackerContainers, useConfFromDB, and zeroSuppression.

99 {
100  // Step A: Get Inputs
102  iSetup.getData( pdt );
103 
104  if(useConfFromDB){
106  iSetup.get<SiStripDetCablingRcd>().get( detCabling );
107  detCabling->addConnected(theDetIdList);
108  }
109 
111  std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec;
112  for(uint32_t i = 0; i< trackerContainers.size();i++){
113  iEvent.getByLabel("mix",trackerContainers[i],cf_simhit);
114  cf_simhitvec.push_back(cf_simhit.product());
115  }
116 
117  std::auto_ptr<MixCollection<PSimHit> > allTrackerHits(new MixCollection<PSimHit>(cf_simhitvec));
118 
119  //Loop on PSimHit
120  SimHitMap.clear();
121 
122  //inside SimHitSelectorFromDb add the counter information from the original allhits collection
123  std::vector<std::pair<const PSimHit*,int> > trackerHits(SimHitSelectorFromDB_.getSimHit(allTrackerHits,theDetIdList));
124  std::vector<std::pair<const PSimHit*,int> >::iterator isim;
125  for (isim=trackerHits.begin() ; isim!= trackerHits.end();isim++) {
126  //make a pair = <*isim, counter> and save also position in the vector for DigiSimLink
127  SimHitMap[((*isim).first)->detUnitId()].push_back(*isim);
128  }
129 
131  iSetup.get<TrackerDigiGeometryRecord>().get(geometryType,pDD);
132 
134  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
135 
136  //get gain noise pedestal lorentzAngle from ES handle
137  edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle;
138  edm::ESHandle<SiStripGain> gainHandle;
139  edm::ESHandle<SiStripNoises> noiseHandle;
140  edm::ESHandle<SiStripThreshold> thresholdHandle;
141  edm::ESHandle<SiStripPedestals> pedestalHandle;
142  edm::ESHandle<SiStripBadStrip> deadChannelHandle;
143  std::string LAname = conf_.getParameter<std::string>("LorentzAngle");
144  iSetup.get<SiStripLorentzAngleSimRcd>().get(LAname,lorentzAngleHandle);
145  std::string gainLabel = conf_.getParameter<std::string>("Gain");
146  iSetup.get<SiStripGainSimRcd>().get(gainLabel,gainHandle);
147  iSetup.get<SiStripNoisesRcd>().get(noiseHandle);
148  iSetup.get<SiStripThresholdRcd>().get(thresholdHandle);
149  iSetup.get<SiStripPedestalsRcd>().get(pedestalHandle);
150  iSetup.get<SiStripBadChannelRcd>().get(deadChannelHandle);
151 
153 
154  // Step B: LOOP on StripGeomDetUnit
155  theDigiVector.reserve(10000);
156  theDigiVector.clear();
157  theDigiLinkVector.reserve(10000);
158  theDigiLinkVector.clear();
159 
160  for(TrackingGeometry::DetUnitContainer::const_iterator iu = pDD->detUnits().begin(); iu != pDD->detUnits().end(); iu ++){
161  if(useConfFromDB){
162  //apply the cable map _before_ digitization: consider only the detis that are connected
163  if(theDetIdList.find((*iu)->geographicalId().rawId())==theDetIdList.end())
164  continue;
165  }
166  GlobalVector bfield=pSetup->inTesla((*iu)->surface().position());
167  StripGeomDetUnit* sgd = dynamic_cast<StripGeomDetUnit*>((*iu));
168  if (sgd != 0){
169  edm::DetSet<SiStripDigi> collectorZS((*iu)->geographicalId().rawId());
170  edm::DetSet<SiStripRawDigi> collectorRaw((*iu)->geographicalId().rawId());
171  edm::DetSet<StripDigiSimLink> linkcollector((*iu)->geographicalId().rawId());
172  float langle = (lorentzAngleHandle.isValid()) ? lorentzAngleHandle->getLorentzAngle((*iu)->geographicalId().rawId()) : 0.;
173  theDigiAlgo->run(collectorZS,collectorRaw,SimHitMap[(*iu)->geographicalId().rawId()],sgd,bfield,langle,
174  gainHandle,thresholdHandle,noiseHandle,pedestalHandle, deadChannelHandle);
175  if(zeroSuppression){
176  if(collectorZS.data.size()>0){
177  theDigiVector.push_back(collectorZS);
178  if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){
179  linkcollector.data = theDigiAlgo->make_link();
180  if(linkcollector.data.size()>0)
181  theDigiLinkVector.push_back(linkcollector);
182  }
183  }
184  }else{
185  if(collectorRaw.data.size()>0){
186  theRawDigiVector.push_back(collectorRaw);
187  if(SimHitMap[(*iu)->geographicalId().rawId()].size()>0){
188  linkcollector.data = theDigiAlgo->make_link();
189  if(linkcollector.data.size()>0)
190  theDigiLinkVector.push_back(linkcollector);
191  }
192  }
193  }
194  }
195  }
196 
197  if(zeroSuppression){
198  // Step C: create output collection
199  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>());
200  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>());
201  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>());
202  std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>(theDigiVector) );
203  std::auto_ptr<edm::DetSetVector<StripDigiSimLink> > outputlink(new edm::DetSetVector<StripDigiSimLink>(theDigiLinkVector) );
204  // Step D: write output to file
205  edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList");
206  iEvent.put(output,ParamSet.getParameter<std::string>("ZSDigi"));
207  iEvent.put(outputlink);
208  iEvent.put(output_scopemode, ParamSet.getParameter<std::string>("SCDigi"));
209  iEvent.put(output_virginraw, ParamSet.getParameter<std::string>("VRDigi"));
210  iEvent.put(output_processedraw,ParamSet.getParameter<std::string>("PRDigi"));
211  }else{
212  // Step C: create output collection
213  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_virginraw(new edm::DetSetVector<SiStripRawDigi>(theRawDigiVector));
214  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_scopemode(new edm::DetSetVector<SiStripRawDigi>());
215  std::auto_ptr<edm::DetSetVector<SiStripRawDigi> > output_processedraw(new edm::DetSetVector<SiStripRawDigi>());
216  std::auto_ptr<edm::DetSetVector<SiStripDigi> > output(new edm::DetSetVector<SiStripDigi>() );
217  std::auto_ptr<edm::DetSetVector<StripDigiSimLink> > outputlink(new edm::DetSetVector<StripDigiSimLink>(theDigiLinkVector) );
218  // Step D: write output to file
219  edm::ParameterSet ParamSet=conf_.getParameter<edm::ParameterSet>("DigiModeList");
220  iEvent.put(output,ParamSet.getParameter<std::string>("ZSDigi"));
221  iEvent.put(outputlink);
222  iEvent.put(output_scopemode, ParamSet.getParameter<std::string>("SCDigi"));
223  iEvent.put(output_virginraw, ParamSet.getParameter<std::string>("VRDigi"));
224  iEvent.put(output_processedraw,ParamSet.getParameter<std::string>("PRDigi"));
225  }
226 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
simhit_map SimHitMap
std::map< uint32_t, std::vector< int > > theDetIdList
SiStripDigitizerAlgorithm * theDigiAlgo
std::vector< std::pair< const PSimHit *, int > > getSimHit(std::auto_ptr< MixCollection< PSimHit > > &, std::map< uint32_t, std::vector< int > > &)
std::vector< edm::DetSet< SiStripDigi > > theDigiVector
int iEvent
Definition: GenABIO.cc:243
edm::ParameterSet conf_
void setParticleDataTable(const ParticleDataTable *pardt)
T const * product() const
Definition: Handle.h:74
std::vector< edm::DetSet< StripDigiSimLink > > theDigiLinkVector
std::vector< StripDigiSimLink > make_link()
SimHitSelectorFromDB SimHitSelectorFromDB_
std::string geometryType
void run(edm::DetSet< SiStripDigi > &, edm::DetSet< SiStripRawDigi > &, const std::vector< std::pair< const PSimHit *, int > > &, StripGeomDetUnit *, GlobalVector, float, edm::ESHandle< SiStripGain > &, edm::ESHandle< SiStripThreshold > &, edm::ESHandle< SiStripNoises > &, edm::ESHandle< SiStripPedestals > &, edm::ESHandle< SiStripBadStrip > &)
bool isValid() const
Definition: ESHandle.h:37
std::vector< edm::DetSet< SiStripRawDigi > > theRawDigiVector

Member Data Documentation

std::string SiStripDigitizer::alias
private

Definition at line 63 of file SiStripDigitizer.h.

Referenced by SiStripDigitizer().

edm::ParameterSet SiStripDigitizer::conf_
private

Definition at line 57 of file SiStripDigitizer.h.

Referenced by produce(), and SiStripDigitizer().

std::string SiStripDigitizer::geometryType
private

Definition at line 62 of file SiStripDigitizer.h.

Referenced by produce(), and SiStripDigitizer().

int SiStripDigitizer::numStrips
private

Definition at line 60 of file SiStripDigitizer.h.

CLHEP::HepRandomEngine* SiStripDigitizer::rndEngine
private

Definition at line 61 of file SiStripDigitizer.h.

Referenced by SiStripDigitizer().

simhit_map SiStripDigitizer::SimHitMap
private

Definition at line 59 of file SiStripDigitizer.h.

Referenced by produce().

SimHitSelectorFromDB SiStripDigitizer::SimHitSelectorFromDB_
private

Definition at line 53 of file SiStripDigitizer.h.

Referenced by produce().

std::map<uint32_t, std::vector<int> > SiStripDigitizer::theDetIdList
private

Definition at line 52 of file SiStripDigitizer.h.

Referenced by produce().

SiStripDigitizerAlgorithm* SiStripDigitizer::theDigiAlgo
private

Definition at line 50 of file SiStripDigitizer.h.

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

std::vector<edm::DetSet<StripDigiSimLink> > SiStripDigitizer::theDigiLinkVector
private

Definition at line 56 of file SiStripDigitizer.h.

Referenced by produce().

std::vector<edm::DetSet<SiStripDigi> > SiStripDigitizer::theDigiVector
private

Definition at line 54 of file SiStripDigitizer.h.

Referenced by produce().

std::vector<edm::DetSet<SiStripRawDigi> > SiStripDigitizer::theRawDigiVector
private

Definition at line 55 of file SiStripDigitizer.h.

Referenced by produce().

SiStripFedZeroSuppression* SiStripDigitizer::theSiFEDZeroSuppress
private

Definition at line 51 of file SiStripDigitizer.h.

vstring SiStripDigitizer::trackerContainers
private

Definition at line 58 of file SiStripDigitizer.h.

Referenced by produce(), and SiStripDigitizer().

bool SiStripDigitizer::useConfFromDB
private

Definition at line 65 of file SiStripDigitizer.h.

Referenced by produce(), and SiStripDigitizer().

bool SiStripDigitizer::zeroSuppression
private

Definition at line 64 of file SiStripDigitizer.h.

Referenced by produce(), and SiStripDigitizer().