CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMDigitizer.cc
Go to the documentation of this file.
5 
9 
10 
11 GEMDigitizer::GEMDigitizer(const edm::ParameterSet& config, CLHEP::HepRandomEngine& eng)
12 {
13  modelName_ = config.getParameter<std::string>("digiModel");
14  gemSim_ = GEMSimFactory::get()->create(modelName_, config.getParameter<edm::ParameterSet>("digiModelConfig"));
15  gemSim_->setRandomEngine(eng);
16 }
17 
18 
20 {
21  if(gemSim_) delete gemSim_;
22 }
23 
24 
26  GEMDigiCollection & digis,
27  StripDigiSimLinks & digiSimLinks)
28 {
30 
31  // arrange the hits by roll
32  std::map<int, edm::PSimHitContainer> hitMap;
33  for(auto &hit: simHits)
34  {
35  hitMap[hit.detUnitId()].push_back(hit);
36  }
37 
38  if ( ! geometry_)
39  {
40  throw cms::Exception("Configuration")
41  << "GEMDigitizer::digitize() - No GEMGeometry present in the configuration file."
42  << "Add the service in the configuration file or remove the modules that require it.";
43  }
44 
45  auto etaPartitions = geometry_->etaPartitions() ;
46  for(auto &p: etaPartitions)
47  {
48  const auto & partSimHits = hitMap[p->id()];
49 
50  //LogDebug("GEMDigitizer") << "GEMDigitizer: found " << partSimHits.size() <<" hit(s) in the eta partition";
51 
52  gemSim_->simulate(p, partSimHits);
54  gemSim_->fillDigis(p->id(), digis);
55  digiSimLinks.insert(gemSim_->stripDigiSimLinks());
56  }
57 }
58 
59 
60 const GEMEtaPartition * GEMDigitizer::findDet(int detId) const
61 {
62  assert(geometry_ != 0);
63  return dynamic_cast<const GEMEtaPartition *>(geometry_->idToDetUnit(GEMDetId(detId)));
64 }
65 
T getParameter(std::string const &) const
virtual void fillDigis(int rollDetId, GEMDigiCollection &digis)
Definition: GEMSim.cc:6
const GEMEtaPartition * findDet(int detId) const
finds the GEM det unit in the geometry associated with this det ID
Definition: GEMDigitizer.cc:60
GEMSim * gemSim_
Definition: GEMDigitizer.h:55
GEMDigitizer(const edm::ParameterSet &config, CLHEP::HepRandomEngine &)
Definition: GEMDigitizer.cc:11
const StripDigiSimLinks & stripDigiSimLinks() const
Definition: GEMSim.h:46
std::string modelName_
Definition: GEMDigitizer.h:57
const GEMGeometry * geometry_
Definition: GEMDigitizer.h:54
void setGEMSimSetUp(GEMSimSetUp *setup)
Definition: GEMSim.h:42
virtual void simulate(const GEMEtaPartition *roll, const edm::PSimHitContainer &rpcHits)=0
void digitize(MixCollection< PSimHit > &simHits, GEMDigiCollection &rpcDigis, StripDigiSimLinks &digiSimLinks)
Definition: GEMDigitizer.cc:25
GEMSimSetUp * simSetUp_
Definition: GEMDigitizer.h:56
tuple simHits
Definition: trackerHits.py:16
void insert(detset const &s)
Insert the given DetSet.
Definition: DetSetVector.h:234
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: GEMGeometry.cc:40
virtual void simulateNoise(const GEMEtaPartition *roll)=0
T get(const Candidate &c)
Definition: component.h:55
const std::vector< GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:57