CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ME0ReDigiProducer::TemporaryGeometry Class Reference

Public Member Functions

unsigned int findEtaPartition (float locY) const
 
float getCentralTOF (const ME0DetId &me0Id, unsigned int partIdx) const
 
float getPartCenter (const unsigned int partIdx) const
 
const TrapezoidalStripTopologygetTopo (const unsigned int partIdx) const
 
unsigned int numLayers () const
 
 TemporaryGeometry (const ME0Geometry *geometry, const unsigned int numberOfStrips, const unsigned int numberOfPartitions)
 
 ~TemporaryGeometry ()
 

Private Member Functions

TrapezoidalStripTopologybuildTopo (const std::vector< float > &_p) const
 

Private Attributes

float middleDistanceFromBeam
 
std::vector< float > partitionTops
 
std::vector< TrapezoidalStripTopology * > stripTopos
 
std::vector< std::vector< double > > tofs
 

Detailed Description

Definition at line 48 of file ME0ReDigiProducer.cc.

Constructor & Destructor Documentation

◆ TemporaryGeometry()

ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry ( const ME0Geometry geometry,
const unsigned int  numberOfStrips,
const unsigned int  numberOfPartitions 
)

Definition at line 128 of file ME0ReDigiProducer.cc.

References buildTopo(), relativeConstraints::chamber, chambers, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), Exception, getPartCenter(), createfilelist::int, LogDebug, middleDistanceFromBeam, MuonTCMETValueMapProducer_cff::nLayers, ME0ReDigiProducer::numberOfPartitions, ME0ReDigiProducer::numberOfStrips, submitPVValidationJobs::params, partitionTops, TrapezoidalStripTopology::radius(), TrapezoidalStripTopology::stripLength(), stripTopos, tofs, and PV3DBase< T, PVType, FrameType >::y().

130  {
131  //First test geometry to make sure that it is compatible with our assumptions
132  const auto& chambers = geometry->chambers();
133  if (chambers.empty())
134  throw cms::Exception("Setup")
135  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - No ME0Chambers in geometry.";
136  const auto* mainChamber = chambers.front();
137  const unsigned int nLayers = chambers.front()->nLayers();
138  if (!nLayers)
139  throw cms::Exception("Setup")
140  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Chamber has no layers.";
141  const auto* mainLayer = mainChamber->layers()[0];
142  if (!mainLayer->nEtaPartitions())
143  throw cms::Exception("Setup")
144  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Layer has no partitions.";
145  if (mainLayer->nEtaPartitions() != 1)
146  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - This module is only "
147  "compatitble with geometries that contain only one partition per ME0Layer.";
148 
149  const auto* mainPartition = mainLayer->etaPartitions()[0];
150  const TrapezoidalStripTopology* mainTopo = dynamic_cast<const TrapezoidalStripTopology*>(&mainPartition->topology());
151  if (!mainTopo)
152  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0 strip topology "
153  "must be of type TrapezoidalStripTopology. This module cannot be used";
154 
155  for (const auto& chamber : geometry->chambers()) {
156  if (chamber->nLayers() != int(nLayers))
157  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all "
158  "ME0Chambers have the same number of layers. This module cannot be used.";
159  for (unsigned int iL = 0; iL < nLayers; ++iL) {
160  if (chamber->layers()[iL]->nEtaPartitions() != mainLayer->nEtaPartitions())
161  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all "
162  "ME0Layers have the same number of partitions. This module cannot be used.";
163  if (chamber->layers()[iL]->etaPartitions()[0]->specs()->parameters() != mainPartition->specs()->parameters())
164  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA "
165  "partitions have the same properties. This module cannot be used.";
166  if (std::fabs(chamber->layers()[iL]->etaPartitions()[0]->position().z()) !=
167  std::fabs(mainChamber->layers()[iL]->etaPartitions()[0]->position().z()))
168  throw cms::Exception("Setup")
169  << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA partitions in a single "
170  "layer have the same Z position. This module cannot be used.";
171  }
172  }
173 
174  //Calculate radius to center of partition
175  middleDistanceFromBeam = mainTopo->radius();
176 
177  //calculate the top of each eta partition, assuming equal distance in eta between partitions
178  const auto localTop = LocalPoint(0, mainTopo->stripLength() / 2);
179  const auto localBottom = LocalPoint(0, -1 * mainTopo->stripLength() / 2);
180  const auto globalTop = mainPartition->toGlobal(localTop);
181  const auto globalBottom = mainPartition->toGlobal(localBottom);
182  const double etaTop = globalTop.eta();
183  const double etaBottom = globalBottom.eta();
184  const double zBottom = globalBottom.z();
185 
186  //Build topologies
189  const auto& mainPars = mainPartition->specs()->parameters();
190  for (unsigned int iP = 0; iP < numberOfPartitions; ++iP) {
191  const double eta = (etaTop - etaBottom) * double(iP + 1) / double(numberOfPartitions) + etaBottom;
192  const double distFromBeam = std::fabs(zBottom / std::sinh(eta));
193  partitionTops.push_back(distFromBeam - middleDistanceFromBeam);
194  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "Top of new partition: " << partitionTops.back() << std::endl;
195 
196  std::vector<float> params(4, 0);
197 
198  //half width of trapezoid at local coordinate Y
199  auto getWidth = [&](float locY) -> float {
200  return (mainPars[2] * (mainPars[1] + mainPars[0]) + locY * (mainPars[1] - mainPars[0])) / (2 * mainPars[2]);
201  };
202 
203  params[0] = iP == 0 ? mainPars[0] : getWidth(partitionTops[iP - 1]); // Half width of bottom of chamber
204  params[1] =
205  iP + 1 == numberOfPartitions ? mainPars[1] : getWidth(partitionTops[iP]); // Half width of top of chamber
206  params[2] = ((iP + 1 == numberOfPartitions ? localTop.y() : partitionTops[iP]) -
207  (iP == 0 ? localBottom.y() : partitionTops[iP - 1])) /
208  2; // Half width of height of chamber
209  params[3] = numberOfStrips;
210 
211  stripTopos.push_back(buildTopo(params));
212  }
213 
214  //Get TOF at center of each partition
215  tofs.resize(nLayers);
216  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "TOF numbers [layer][partition]: ";
217  for (unsigned int iL = 0; iL < nLayers; ++iL) {
218  tofs[iL].resize(numberOfPartitions);
219  for (unsigned int iP = 0; iP < numberOfPartitions; ++iP) {
220  const LocalPoint partCenter(0., getPartCenter(iP), 0.);
221  const GlobalPoint centralGP(mainChamber->layers()[iL]->etaPartitions()[0]->toGlobal(partCenter));
222  tofs[iL][iP] = (centralGP.mag() / (CLHEP::c_light / CLHEP::cm)); //speed of light [cm/ns]
223  LogDebug("ME0ReDigiProducer::TemporaryGeometry")
224  << "[" << iL << "][" << iP << "]=" << tofs[iL][iP] << " " << std::endl;
225  }
226  }
227 }
std::vector< std::vector< double > > tofs
class Point3DBase< float, LocalTag > LocalPoint
TrapezoidalStripTopology * buildTopo(const std::vector< float > &_p) const
T eta() const
Definition: PV3DBase.h:73
float getPartCenter(const unsigned int partIdx) const
T y() const
Definition: PV3DBase.h:60
unsigned int numberOfPartitions
unsigned int numberOfStrips
std::vector< TrapezoidalStripTopology * > stripTopos
float stripLength() const override
det heigth (strip length in the middle)
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
#define LogDebug(id)

◆ ~TemporaryGeometry()

ME0ReDigiProducer::TemporaryGeometry::~TemporaryGeometry ( )

Definition at line 244 of file ME0ReDigiProducer.cc.

References AlCaHLTBitMon_ParallelJobs::p.

244  {
245  for (auto* p : stripTopos) {
246  delete p;
247  }
248 }
std::vector< TrapezoidalStripTopology * > stripTopos

Member Function Documentation

◆ buildTopo()

TrapezoidalStripTopology * ME0ReDigiProducer::TemporaryGeometry::buildTopo ( const std::vector< float > &  _p) const
private

Definition at line 250 of file ME0ReDigiProducer.cc.

References B, b, h, LogDebug, and DigiDM_cff::strips.

Referenced by TemporaryGeometry().

250  {
251  float b = _p[0];
252  float B = _p[1];
253  float h = _p[2];
254  float r0 = h * (B + b) / (B - b);
255  float striplength = h * 2;
256  float strips = _p[3];
257  float pitch = (b + B) / strips;
258  int nstrip = static_cast<int>(strips);
259 
260  LogDebug("ME0ReDigiProducer::TemporaryGeometry")
261  << "New partition parameters: "
262  << "bottom width(" << 2 * b << ") top width(" << 2 * B << ") height(" << 2 * h << ") radius to center(" << r0
263  << ") nStrips(" << strips << ") pitch(" << pitch << ")" << std::endl;
264 
265  return new TrapezoidalStripTopology(nstrip, pitch, striplength, r0);
266 }
Definition: APVGainStruct.h:7
double b
Definition: hdecay.h:118
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define LogDebug(id)

◆ findEtaPartition()

unsigned int ME0ReDigiProducer::TemporaryGeometry::findEtaPartition ( float  locY) const

Definition at line 229 of file ME0ReDigiProducer.cc.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

229  {
230  unsigned int etaPart = stripTopos.size() - 1;
231  for (unsigned int iP = 0; iP < stripTopos.size(); ++iP) {
232  if (locY < partitionTops[iP]) {
233  etaPart = iP;
234  break;
235  }
236  }
237  return etaPart;
238 }
std::vector< TrapezoidalStripTopology * > stripTopos

◆ getCentralTOF()

float ME0ReDigiProducer::TemporaryGeometry::getCentralTOF ( const ME0DetId me0Id,
unsigned int  partIdx 
) const
inline

Definition at line 57 of file ME0ReDigiProducer.cc.

References ME0DetId::layer(), partIdx(), and tofs.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

57  {
58  return tofs[me0Id.layer() - 1][partIdx];
59  } //in detId layer numbers stat at 1
std::vector< std::vector< double > > tofs
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
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

◆ getPartCenter()

float ME0ReDigiProducer::TemporaryGeometry::getPartCenter ( const unsigned int  partIdx) const

Definition at line 240 of file ME0ReDigiProducer.cc.

References partIdx().

Referenced by ME0ReDigiProducer::getCustomStripProperties(), and TemporaryGeometry().

240  {
241  return stripTopos[partIdx]->radius() - middleDistanceFromBeam;
242 }
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
std::vector< TrapezoidalStripTopology * > stripTopos

◆ getTopo()

const TrapezoidalStripTopology* ME0ReDigiProducer::TemporaryGeometry::getTopo ( const unsigned int  partIdx) const
inline

Definition at line 55 of file ME0ReDigiProducer.cc.

References partIdx(), and stripTopos.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

55 { return stripTopos[partIdx]; }
static unsigned int partIdx(const InputGenJetsParticleSelector::ParticleVector &p, const reco::Candidate *particle)
std::vector< TrapezoidalStripTopology * > stripTopos

◆ numLayers()

unsigned int ME0ReDigiProducer::TemporaryGeometry::numLayers ( ) const
inline

Definition at line 60 of file ME0ReDigiProducer.cc.

References tofs.

Referenced by ME0ReDigiProducer::beginRun().

60 { return tofs.size(); }
std::vector< std::vector< double > > tofs

Member Data Documentation

◆ middleDistanceFromBeam

float ME0ReDigiProducer::TemporaryGeometry::middleDistanceFromBeam
private

Definition at line 66 of file ME0ReDigiProducer.cc.

Referenced by TemporaryGeometry().

◆ partitionTops

std::vector<float> ME0ReDigiProducer::TemporaryGeometry::partitionTops
private

Definition at line 69 of file ME0ReDigiProducer.cc.

Referenced by TemporaryGeometry().

◆ stripTopos

std::vector<TrapezoidalStripTopology*> ME0ReDigiProducer::TemporaryGeometry::stripTopos
private

Definition at line 67 of file ME0ReDigiProducer.cc.

Referenced by getTopo(), and TemporaryGeometry().

◆ tofs

std::vector<std::vector<double> > ME0ReDigiProducer::TemporaryGeometry::tofs
private

Definition at line 68 of file ME0ReDigiProducer.cc.

Referenced by getCentralTOF(), numLayers(), and TemporaryGeometry().