CMS 3D CMS Logo

ME0ReDigiProducer.cc
Go to the documentation of this file.
1 #ifndef SimMuon_GEMDigitizer_ME0ReDigiProducer_h
2 #define SimMuon_GEMDigitizer_ME0ReDigiProducer_h
3 
4 /*
5  * This module smears and discretizes the timing and position of the
6  * ME0 pseudo digis.
7  */
8 
20 
23 
28 
29 #include "CLHEP/Random/RandGaussQ.h"
30 #include "CLHEP/Random/RandFlat.h"
31 #include "CLHEP/Units/PhysicalConstants.h"
32 
33 #include <sstream>
34 #include <string>
35 #include <map>
36 #include <vector>
37 
39 
41 private:
42  //Class used to define custom geometry, if required
43  //assume that all ME0 chambers have the same dimension
44  //and for the same layer have the same radial and Z position
45  //Good for now, can build in support for more varied geos later
46  //if necessary
48  public:
50  const unsigned int numberOfStrips,
51  const unsigned int numberOfPartitions);
53  unsigned int findEtaPartition(float locY) const;
54  const TrapezoidalStripTopology* getTopo(const unsigned int partIdx) const { return stripTopos[partIdx]; }
55  float getPartCenter(const unsigned int partIdx) const; //position of part. in chamber
56  float getCentralTOF(const ME0DetId& me0Id, unsigned int partIdx) const {
57  return tofs[me0Id.layer() - 1][partIdx];
58  } //in detId layer numbers stat at 1
59  unsigned int numLayers() const { return tofs.size(); }
60 
61  private:
62  TrapezoidalStripTopology* buildTopo(const std::vector<float>& _p) const;
63 
64  private:
65  float middleDistanceFromBeam; // radiusOfMainPartitionInCenter;
66  std::vector<TrapezoidalStripTopology*> stripTopos; // vector of Topos, one for each part
67  std::vector<std::vector<double>> tofs; //TOF to center of the partition: [layer][part]
68  std::vector<float> partitionTops; //Top of each partition in the chamber's local coords
69  };
70 
71 public:
72  explicit ME0ReDigiProducer(const edm::ParameterSet& ps);
73 
74  ~ME0ReDigiProducer() override;
75 
76  void beginRun(const edm::Run&, const edm::EventSetup&) override;
77 
78  void produce(edm::Event&, const edm::EventSetup&) override;
79 
83  CLHEP::HepRandomEngine* engine);
84 
85 private:
86  void fillCentralTOFs();
87  void getStripProperties(const ME0EtaPartition* etaPart,
88  const ME0DigiPreReco* inDigi,
89  float& tof,
90  int& strip,
91  LocalPoint& digiLocalPoint,
92  LocalError& digiLocalError) const;
93  int getCustomStripProperties(const ME0DetId& detId,
94  const ME0DigiPreReco* inDigi,
95  float& tof,
96  int& strip,
97  LocalPoint& digiLocalPoint,
98  LocalError& digiLocalError) const;
99 
100  typedef std::tuple<unsigned int, unsigned int, unsigned int> DigiIndicies;
101  typedef std::map<DigiIndicies, unsigned int> ChamberDigiMap;
102  //fills map...returns -1 if digi is not already in the map
103  unsigned int fillDigiMap(
104  ChamberDigiMap& chDigiMap, unsigned int bx, unsigned int part, unsigned int strip, unsigned int currentIDX) const;
105 
106  //paramters
107  const float bxWidth; // ns
108  bool useCusGeoFor1PartGeo; //Use custom strips and partitions for digitization for single partition geometry
109  bool usePads; //sets strip granularity to x2 coarser
110  unsigned int numberOfStrips; // Custom number of strips per partition
111  unsigned int numberOfPartitions; // Custom number of partitions per chamber
112  double neutronAcceptance; // fraction of neutron events to keep in event (>= 1 means no filtering)
113  double timeResolution; // smear time by gaussian with this sigma (in ns)....negative for no smearing
114  int minBXReadout; // Minimum BX to readout
115  int maxBXReadout; // Maximum BX to readout
116  std::vector<int> layerReadout; // Don't readout layer if entry is 0 (Layer number 1 in the numbering scheme is idx 0)
117  bool mergeDigis; // Keep only one digi at the same chamber, strip, partition, and BX
119 
123  std::vector<std::vector<double>> tofs; //used for built in geo
124 };
125 
127  const unsigned int numberOfStrips,
128  const unsigned int numberOfPartitions) {
129  //First test geometry to make sure that it is compatible with our assumptions
130  const auto& chambers = geometry->chambers();
131  if (chambers.empty())
132  throw cms::Exception("Setup")
133  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - No ME0Chambers in geometry.";
134  const auto* mainChamber = chambers.front();
135  const unsigned int nLayers = chambers.front()->nLayers();
136  if (!nLayers)
137  throw cms::Exception("Setup")
138  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Chamber has no layers.";
139  const auto* mainLayer = mainChamber->layers()[0];
140  if (!mainLayer->nEtaPartitions())
141  throw cms::Exception("Setup")
142  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Layer has no partitions.";
143  if (mainLayer->nEtaPartitions() != 1)
144  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - This module is only "
145  "compatitble with geometries that contain only one partition per ME0Layer.";
146 
147  const auto* mainPartition = mainLayer->etaPartitions()[0];
148  const TrapezoidalStripTopology* mainTopo = dynamic_cast<const TrapezoidalStripTopology*>(&mainPartition->topology());
149  if (!mainTopo)
150  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0 strip topology "
151  "must be of type TrapezoidalStripTopology. This module cannot be used";
152 
153  for (const auto& chamber : geometry->chambers()) {
154  if (chamber->nLayers() != int(nLayers))
155  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all "
156  "ME0Chambers have the same number of layers. This module cannot be used.";
157  for (unsigned int iL = 0; iL < nLayers; ++iL) {
158  if (chamber->layers()[iL]->nEtaPartitions() != mainLayer->nEtaPartitions())
159  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all "
160  "ME0Layers have the same number of partitions. This module cannot be used.";
161  if (chamber->layers()[iL]->etaPartitions()[0]->specs()->parameters() != mainPartition->specs()->parameters())
162  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA "
163  "partitions have the same properties. This module cannot be used.";
164  if (std::fabs(chamber->layers()[iL]->etaPartitions()[0]->position().z()) !=
165  std::fabs(mainChamber->layers()[iL]->etaPartitions()[0]->position().z()))
166  throw cms::Exception("Setup")
167  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA partitions in a single "
168  "layer have the same Z position. This module cannot be used.";
169  }
170  }
171 
172  //Calculate radius to center of partition
173  middleDistanceFromBeam = mainTopo->radius();
174 
175  //calculate the top of each eta partition, assuming equal distance in eta between partitions
176  const auto localTop = LocalPoint(0, mainTopo->stripLength() / 2);
177  const auto localBottom = LocalPoint(0, -1 * mainTopo->stripLength() / 2);
178  const auto globalTop = mainPartition->toGlobal(localTop);
179  const auto globalBottom = mainPartition->toGlobal(localBottom);
180  const double etaTop = globalTop.eta();
181  const double etaBottom = globalBottom.eta();
182  const double zBottom = globalBottom.z();
183 
184  //Build topologies
185  partitionTops.reserve(numberOfPartitions);
186  stripTopos.reserve(numberOfPartitions);
187  const auto& mainPars = mainPartition->specs()->parameters();
188  for (unsigned int iP = 0; iP < numberOfPartitions; ++iP) {
189  const double eta = (etaTop - etaBottom) * double(iP + 1) / double(numberOfPartitions) + etaBottom;
190  const double distFromBeam = std::fabs(zBottom / std::sinh(eta));
191  partitionTops.push_back(distFromBeam - middleDistanceFromBeam);
192  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "Top of new partition: " << partitionTops.back() << std::endl;
193 
194  std::vector<float> params(4, 0);
195 
196  //half width of trapezoid at local coordinate Y
197  auto getWidth = [&](float locY) -> float {
198  return (mainPars[2] * (mainPars[1] + mainPars[0]) + locY * (mainPars[1] - mainPars[0])) / (2 * mainPars[2]);
199  };
200 
201  params[0] = iP == 0 ? mainPars[0] : getWidth(partitionTops[iP - 1]); // Half width of bottom of chamber
202  params[1] =
203  iP + 1 == numberOfPartitions ? mainPars[1] : getWidth(partitionTops[iP]); // Half width of top of chamber
204  params[2] = ((iP + 1 == numberOfPartitions ? localTop.y() : partitionTops[iP]) -
205  (iP == 0 ? localBottom.y() : partitionTops[iP - 1])) /
206  2; // Half width of height of chamber
207  params[3] = numberOfStrips;
208 
209  stripTopos.push_back(buildTopo(params));
210  }
211 
212  //Get TOF at center of each partition
213  tofs.resize(nLayers);
214  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "TOF numbers [layer][partition]: ";
215  for (unsigned int iL = 0; iL < nLayers; ++iL) {
216  tofs[iL].resize(numberOfPartitions);
217  for (unsigned int iP = 0; iP < numberOfPartitions; ++iP) {
218  const LocalPoint partCenter(0., getPartCenter(iP), 0.);
219  const GlobalPoint centralGP(mainChamber->layers()[iL]->etaPartitions()[0]->toGlobal(partCenter));
220  tofs[iL][iP] = (centralGP.mag() / (CLHEP::c_light / CLHEP::cm)); //speed of light [cm/ns]
221  LogDebug("ME0ReDigiProducer::TemporaryGeometry")
222  << "[" << iL << "][" << iP << "]=" << tofs[iL][iP] << " " << std::endl;
223  }
224  }
225 }
226 
228  unsigned int etaPart = stripTopos.size() - 1;
229  for (unsigned int iP = 0; iP < stripTopos.size(); ++iP) {
230  if (locY < partitionTops[iP]) {
231  etaPart = iP;
232  break;
233  }
234  }
235  return etaPart;
236 }
237 
239  return stripTopos[partIdx]->radius() - middleDistanceFromBeam;
240 }
241 
243  for (auto* p : stripTopos) {
244  delete p;
245  }
246 }
247 
249  float b = _p[0];
250  float B = _p[1];
251  float h = _p[2];
252  float r0 = h * (B + b) / (B - b);
253  float striplength = h * 2;
254  float strips = _p[3];
255  float pitch = (b + B) / strips;
256  int nstrip = static_cast<int>(strips);
257 
258  LogDebug("ME0ReDigiProducer::TemporaryGeometry")
259  << "New partition parameters: "
260  << "bottom width(" << 2 * b << ") top width(" << 2 * B << ") height(" << 2 * h << ") radius to center(" << r0
261  << ") nStrips(" << strips << ") pitch(" << pitch << ")" << std::endl;
262 
263  return new TrapezoidalStripTopology(nstrip, pitch, striplength, r0);
264 }
265 
267  : bxWidth(25.0),
268  useCusGeoFor1PartGeo(ps.getParameter<bool>("useCusGeoFor1PartGeo")),
269  usePads(ps.getParameter<bool>("usePads")),
270  numberOfStrips(ps.getParameter<unsigned int>("numberOfStrips")),
271  numberOfPartitions(ps.getParameter<unsigned int>("numberOfPartitions")),
272  neutronAcceptance(ps.getParameter<double>("neutronAcceptance")),
273  timeResolution(ps.getParameter<double>("timeResolution")),
274  minBXReadout(ps.getParameter<int>("minBXReadout")),
275  maxBXReadout(ps.getParameter<int>("maxBXReadout")),
276  layerReadout(ps.getParameter<std::vector<int>>("layerReadout")),
277  mergeDigis(ps.getParameter<bool>("mergeDigis")),
278  token(consumes<ME0DigiPreRecoCollection>(edm::InputTag(ps.getParameter<std::string>("inputCollection")))) {
279  produces<ME0DigiPreRecoCollection>();
280  produces<ME0DigiPreRecoMap>();
281 
283  if (!rng.isAvailable()) {
284  throw cms::Exception("Configuration")
285  << "ME0ReDigiProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration "
286  "file.\n"
287  << "Add the service in the configuration file or remove the modules that require it.";
288  }
289  geometry = nullptr;
290  tempGeo = nullptr;
291  useBuiltinGeo = true;
292 
293  if (useCusGeoFor1PartGeo) {
294  if (usePads)
296  if (numberOfStrips == 0)
297  throw cms::Exception("Setup")
298  << "ME0ReDigiProducer::ME0PreRecoDigiProducer() - Must have at least one strip if using custom geometry.";
299  if (numberOfPartitions == 0)
300  throw cms::Exception("Setup")
301  << "ME0ReDigiProducer::ME0PreRecoDigiProducer() - Must have at least one partition if using custom geometry.";
302  }
303 
304  if (neutronAcceptance < 0)
305  throw cms::Exception("Setup") << "ME0ReDigiProducer::ME0PreRecoDigiProducer() - neutronAcceptance must be >= 0.";
306 }
307 
309  if (tempGeo)
310  delete tempGeo;
311 }
312 
313 void ME0ReDigiProducer::beginRun(const edm::Run&, const edm::EventSetup& eventSetup) {
314  // set geometry
316  eventSetup.get<MuonGeometryRecord>().get(hGeom);
317  geometry = &*hGeom;
318 
319  const auto& chambers = geometry->chambers();
320  if (chambers.empty())
321  throw cms::Exception("Setup") << "ME0ReDigiProducer::beginRun() - No ME0Chambers in geometry.";
322 
323  const unsigned int nLayers = chambers.front()->nLayers();
324  if (!nLayers)
325  throw cms::Exception("Setup") << "ME0ReDigiProducer::beginRun() - No layers in ME0 geometry.";
326 
327  const unsigned int nPartitions = chambers.front()->layers()[0]->nEtaPartitions();
328 
329  if (useCusGeoFor1PartGeo && nPartitions == 1) {
330  useBuiltinGeo = false;
331  }
332 
333  if (useBuiltinGeo) {
334  if (nLayers != layerReadout.size())
335  throw cms::Exception("Configuration")
336  << "ME0ReDigiProducer::beginRun() - The geometry has " << nLayers << " layers, but the readout of "
337  << layerReadout.size() << " were specified with the layerReadout parameter.";
338  fillCentralTOFs();
339  } else {
340  LogDebug("ME0ReDigiProducer") << "Building temporary geometry:" << std::endl;
342  LogDebug("ME0ReDigiProducer") << "Done building temporary geometry!" << std::endl;
343 
344  if (tempGeo->numLayers() != layerReadout.size())
345  throw cms::Exception("Configuration")
346  << "ME0ReDigiProducer::beginRun() - The geometry has " << tempGeo->numLayers()
347  << " layers, but the readout of " << layerReadout.size()
348  << " were specified with the layerReadout parameter.";
349  }
350 }
351 
354  CLHEP::HepRandomEngine* engine = &rng->getEngine(e.streamID());
355 
357  e.getByToken(token, input_digis);
358 
359  std::unique_ptr<ME0DigiPreRecoCollection> output_digis(new ME0DigiPreRecoCollection());
360  std::unique_ptr<ME0DigiPreRecoMap> output_digimap(new ME0DigiPreRecoMap());
361 
362  // build the digis
363  buildDigis(*(input_digis.product()), *output_digis, *output_digimap, engine);
364 
365  // store them in the event
366  e.put(std::move(output_digis));
367  e.put(std::move(output_digimap));
368 }
369 
371  ME0DigiPreRecoCollection& output_digis,
372  ME0DigiPreRecoMap& output_digimap,
373  CLHEP::HepRandomEngine* engine) {
374  /*
375  Starting form the incoming pseudo-digi, which has perfect time and position resolution:
376  1A. Smear time using sigma_t by some value
377  1B. Correct the smeared time with the central arrival time for partition
378  1C. Apply discretization: if the smeared time is outside the BX window (-12.5ns;+12.5ns),
379  the hit should be assigned to the next (or previous) BX
380 
381  2A. Find strip that the digi belongs to
382  2B. Get the center of this strip and the error on the position assuming the geometry
383 
384  3A. Filter event if a digi at this partition/strip/BX already exists
385  3B. Add to collection
386  */
387 
388  LogDebug("ME0ReDigiProducer::buildDigis") << "Begin building digis." << std::endl;
390  for (me0dgIt = input_digis.begin(); me0dgIt != input_digis.end(); ++me0dgIt) {
391  const auto& me0Id = (*me0dgIt).first;
392  LogTrace("ME0ReDigiProducer::buildDigis") << "Starting with roll: " << me0Id << std::endl;
393 
394  //setup map for this chamber/eta partition
395  ChamberDigiMap chDigiMap;
396 
397  int newDigiIdx = 0;
398  const ME0DigiPreRecoCollection::Range& range = (*me0dgIt).second;
399  for (ME0DigiPreRecoCollection::const_iterator digi = range.first; digi != range.second; digi++) {
400  LogTrace("ME0ReDigiProducer::buildDigis") << std::endl
401  << "(" << digi->x() << "," << digi->y() << "," << digi->tof() << ","
402  << digi->pdgid() << "," << digi->prompt() << ")-> ";
403 
404  //If we don't readout this layer skip
405  if (!layerReadout[me0Id.layer() - 1]) {
406  output_digimap.insertDigi(me0Id, -1);
407  continue;
408  }
409 
410  //if neutron and we are filtering skip
411  if (!digi->prompt() && neutronAcceptance < 1.0)
412  if (CLHEP::RandFlat::shoot(engine) > neutronAcceptance) {
413  output_digimap.insertDigi(me0Id, -1);
414  continue;
415  }
416 
417  //smear TOF if necessary
418  float tof = digi->tof() + (timeResolution < 0 ? 0.0 : CLHEP::RandGaussQ::shoot(engine, 0, timeResolution));
419 
420  //Values used to fill objet
421  int mapPartIDX = me0Id.roll() - 1;
422  int strip = 0;
423  LocalPoint digiLocalPoint;
424  LocalError digiLocalError;
425  if (useBuiltinGeo) {
426  getStripProperties(geometry->etaPartition(me0Id), &*digi, tof, strip, digiLocalPoint, digiLocalError);
427  } else {
428  mapPartIDX = getCustomStripProperties(me0Id, &*digi, tof, strip, digiLocalPoint, digiLocalError);
429  }
430 
431  //filter if outside of readout window
432  const int bxIdx = std::round(tof / bxWidth);
433  LogTrace("ME0ReDigiProducer::buildDigis") << tof << "(" << bxIdx << ") ";
434  if (bxIdx < minBXReadout) {
435  output_digimap.insertDigi(me0Id, -1);
436  continue;
437  }
438  if (bxIdx > maxBXReadout) {
439  output_digimap.insertDigi(me0Id, -1);
440  continue;
441  }
442  tof = bxIdx * bxWidth;
443 
444  //If we are merging check to see if it already exists
445  LogTrace("ME0ReDigiProducer::buildDigis") << "(" << bxIdx << "," << mapPartIDX << "," << strip << ") ";
446  if (mergeDigis) {
447  int matchIDX = fillDigiMap(chDigiMap, bxIdx, mapPartIDX, strip, newDigiIdx);
448  if (matchIDX >= 0) {
449  output_digimap.insertDigi(me0Id, matchIDX);
450  continue;
451  }
452  }
453 
454  //Digis store sigmaX,sigmaY, correlationCoef
455  const float sigmaX = std::sqrt(digiLocalError.xx());
456  const float sigmaY = std::sqrt(digiLocalError.yy());
457  const float corrCoef = digiLocalError.xy() / (sigmaX * sigmaY);
458 
459  //Fill in the new collection
460  ME0DigiPreReco out_digi(
461  digiLocalPoint.x(), digiLocalPoint.y(), sigmaX, sigmaY, corrCoef, tof, digi->pdgid(), digi->prompt());
462  output_digis.insertDigi(me0Id, out_digi);
463 
464  // store index of previous detid and digi
465  output_digimap.insertDigi(me0Id, newDigiIdx);
466  newDigiIdx++;
467 
468  LogTrace("ME0ReDigiProducer::buildDigis") << "(" << digiLocalPoint.x() << "," << digiLocalPoint.y() << ","
469  << sigmaX << "," << sigmaY << "," << tof << ") ";
470  }
471 
472  chDigiMap.clear();
473  }
474 }
475 
477  const auto* mainChamber = geometry->chambers().front();
478  const unsigned int nLayers = mainChamber->nLayers();
479  //Get TOF at center of each partition
480  tofs.clear();
481  tofs.resize(nLayers);
482  LogDebug("ME0ReDigiProducer::fillCentralTOFs()") << "TOF numbers [layer][partition]: ";
483  for (unsigned int iL = 0; iL < nLayers; ++iL) {
484  const auto* layer = mainChamber->layers()[iL];
485  const unsigned int mapLayIDX = layer->id().layer() - 1;
486  const unsigned int nPartitions = layer->nEtaPartitions();
487  if (!nPartitions)
488  throw cms::Exception("Setup") << "ME0ReDigiProducer::fillCentralTOFs() - ME0Layer has no partitions.";
489  tofs[mapLayIDX].resize(nPartitions);
490  for (unsigned int iP = 0; iP < nPartitions; ++iP) {
491  const unsigned int mapPartIDX = layer->etaPartitions()[iP]->id().roll() - 1;
492  const GlobalPoint centralGP(layer->etaPartitions()[iP]->position());
493  tofs[mapLayIDX][mapPartIDX] = (centralGP.mag() / (CLHEP::c_light / CLHEP::cm)); //speed of light [cm/ns]
494  LogDebug("ME0ReDigiProducer::fillCentralTOFs()")
495  << "[" << mapLayIDX << "][" << mapPartIDX << "]=" << tofs[mapLayIDX][mapPartIDX] << " " << std::endl;
496  }
497  }
498 }
500  const ME0DigiPreReco* inDigi,
501  float& tof,
502  int& strip,
503  LocalPoint& digiLocalPoint,
504  LocalError& digiLocalError) const {
505  const unsigned int partIdx = tempGeo->findEtaPartition(inDigi->y());
506  LogTrace("ME0ReDigiProducer::buildDigis") << partIdx << " ";
507  const float partMeanTof = tempGeo->getCentralTOF(detId, partIdx);
508 
509  //convert to relative to partition
510  tof -= partMeanTof;
511 
512  //get coordinates and errors
513  const float partCenter = tempGeo->getPartCenter(partIdx);
514  const auto* topo = tempGeo->getTopo(partIdx);
515 
516  //find channel
517  const LocalPoint partLocalPoint(inDigi->x(), inDigi->y() - partCenter, 0.);
518  strip = topo->channel(partLocalPoint);
519  const float stripF = float(strip) + 0.5;
520 
521  //get digitized location
522  LocalPoint digiPartLocalPoint = topo->localPosition(stripF);
523  digiLocalError = topo->localError(
524  stripF,
525  1. /
526  sqrt(
527  12.)); //std dev. flat distribution with length L is L/sqrt(12). The strip topology expects the error in units of strips.
528  digiLocalPoint = LocalPoint(digiPartLocalPoint.x(), digiPartLocalPoint.y() + partCenter, 0.0);
529  return partIdx;
530 }
532  const ME0DigiPreReco* inDigi,
533  float& tof,
534  int& strip,
535  LocalPoint& digiLocalPoint,
536  LocalError& digiLocalError) const {
537  //convert to relative to partition
538  tof -= tofs[etaPart->id().layer() - 1][etaPart->id().roll() - 1];
539 
540  const TrapezoidalStripTopology* origTopo = (const TrapezoidalStripTopology*)(&etaPart->specificTopology());
541  TrapezoidalStripTopology padTopo(
542  origTopo->nstrips() / 2, origTopo->pitch() * 2, origTopo->stripLength(), origTopo->radius());
543  const auto& topo = usePads ? padTopo : etaPart->specificTopology();
544 
545  //find channel
546  const LocalPoint partLocalPoint(inDigi->x(), inDigi->y(), 0.);
547  strip = topo.channel(partLocalPoint);
548  const float stripF = float(strip) + 0.5;
549 
550  //get digitized location
551  digiLocalPoint = topo.localPosition(stripF);
552  digiLocalError = topo.localError(stripF, 1. / sqrt(12.));
553 }
554 
556  ChamberDigiMap& chDigiMap, unsigned int bx, unsigned int part, unsigned int strip, unsigned int currentIDX) const {
557  DigiIndicies newIDX(bx, part, strip);
558  auto it1 = chDigiMap.find(newIDX);
559  if (it1 == chDigiMap.end()) {
560  chDigiMap[newIDX] = currentIDX;
561  return -1;
562  }
563  return it1->second;
564 }
565 
567 #endif
#define LogDebug(id)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< std::vector< double > > tofs
float xx() const
Definition: LocalError.h:22
const StripTopology & specificTopology() const
constexpr int nLayers
Definition: Common.h:13
class Point3DBase< float, LocalTag > LocalPoint
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
float y() const
const ME0Geometry * geometry
int getCustomStripProperties(const ME0DetId &detId, const ME0DigiPreReco *inDigi, float &tof, int &strip, LocalPoint &digiLocalPoint, LocalError &digiLocalError) const
float getCentralTOF(const ME0DetId &me0Id, unsigned int partIdx) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< ME0DigiPreRecoCollection > token
void buildDigis(const ME0DigiPreRecoCollection &, ME0DigiPreRecoCollection &, ME0DigiPreRecoMap &, CLHEP::HepRandomEngine *engine)
std::vector< int > layerReadout
T y() const
Definition: PV3DBase.h:60
~ME0ReDigiProducer() override
void insertDigi(const IndexType &index, const DigiType &digi)
insert a digi for a given DetUnit
unsigned int fillDigiMap(ChamberDigiMap &chDigiMap, unsigned int bx, unsigned int part, unsigned int strip, unsigned int currentIDX) const
std::tuple< unsigned int, unsigned int, unsigned int > DigiIndicies
TemporaryGeometry(const ME0Geometry *geometry, const unsigned int numberOfStrips, const unsigned int numberOfPartitions)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
TrapezoidalStripTopology * buildTopo(const std::vector< float > &_p) const
float xy() const
Definition: LocalError.h:23
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
float yy() const
Definition: LocalError.h:24
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
T sqrt(T t)
Definition: SSEVec.h:19
ME0DetId id() const
const std::vector< const ME0Chamber * > & chambers() const
Return a vector of all ME0 chambers.
Definition: ME0Geometry.cc:29
float stripLength() const override
det heigth (strip length in the middle)
static const std::string B
#define LogTrace(id)
std::map< DigiIndicies, unsigned int > ChamberDigiMap
unsigned int findEtaPartition(float locY) const
float getPartCenter(const unsigned int partIdx) const
TemporaryGeometry * tempGeo
float x() const
T const * product() const
Definition: Handle.h:69
part
Definition: HCALResponse.h:20
unsigned int numberOfPartitions
unsigned int numberOfStrips
std::pair< const_iterator, const_iterator > Range
double b
Definition: hdecay.h:118
std::vector< DigiType >::const_iterator const_iterator
MuonDigiCollection< ME0DetId, int > ME0DigiPreRecoMap
int roll() const
Definition: ME0DetId.h:48
T eta() const
Definition: PV3DBase.h:73
std::vector< TrapezoidalStripTopology * > stripTopos
ME0ReDigiProducer(const edm::ParameterSet &ps)
HLT enums.
T get() const
Definition: EventSetup.h:73
StreamID streamID() const
Definition: Event.h:96
std::vector< std::vector< double > > tofs
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
Definition: DigiDM_cff.py:32
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:44
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
T x() const
Definition: PV3DBase.h:59
void produce(edm::Event &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:511
const TrapezoidalStripTopology * getTopo(const unsigned int partIdx) const
Definition: Run.h:45
void getStripProperties(const ME0EtaPartition *etaPart, const ME0DigiPreReco *inDigi, float &tof, int &strip, LocalPoint &digiLocalPoint, LocalError &digiLocalError) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...