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 47 of file ME0ReDigiProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 126 of file ME0ReDigiProducer.cc.

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

128  {
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
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 }
#define LogDebug(id)
std::vector< std::vector< double > > tofs
constexpr int nLayers
Definition: Common.h:13
class Point3DBase< float, LocalTag > LocalPoint
T y() const
Definition: PV3DBase.h:60
TrapezoidalStripTopology * buildTopo(const std::vector< float > &_p) 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)
float getPartCenter(const unsigned int partIdx) const
unsigned int numberOfPartitions
unsigned int numberOfStrips
T eta() const
Definition: PV3DBase.h:73
std::vector< TrapezoidalStripTopology * > stripTopos
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
ME0ReDigiProducer::TemporaryGeometry::~TemporaryGeometry ( )

Definition at line 242 of file ME0ReDigiProducer.cc.

References AlCaHLTBitMon_ParallelJobs::p, and stripTopos.

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

Member Function Documentation

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

Definition at line 248 of file ME0ReDigiProducer.cc.

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

Referenced by numLayers(), and TemporaryGeometry().

248  {
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 }
#define LogDebug(id)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static const std::string B
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
unsigned int ME0ReDigiProducer::TemporaryGeometry::findEtaPartition ( float  locY) const

Definition at line 227 of file ME0ReDigiProducer.cc.

References partitionTops, and stripTopos.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

227  {
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 }
std::vector< TrapezoidalStripTopology * > stripTopos
float ME0ReDigiProducer::TemporaryGeometry::getCentralTOF ( const ME0DetId me0Id,
unsigned int  partIdx 
) const
inline

Definition at line 56 of file ME0ReDigiProducer.cc.

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

Referenced by ME0ReDigiProducer::getCustomStripProperties().

56  {
57  return tofs[me0Id.layer() - 1][partIdx];
58  } //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
float ME0ReDigiProducer::TemporaryGeometry::getPartCenter ( const unsigned int  partIdx) const

Definition at line 238 of file ME0ReDigiProducer.cc.

References middleDistanceFromBeam, partIdx(), and stripTopos.

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

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

Definition at line 54 of file ME0ReDigiProducer.cc.

References getPartCenter(), partIdx(), and stripTopos.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

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

Definition at line 59 of file ME0ReDigiProducer.cc.

References buildTopo(), and tofs.

Referenced by ME0ReDigiProducer::beginRun().

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

Member Data Documentation

float ME0ReDigiProducer::TemporaryGeometry::middleDistanceFromBeam
private

Definition at line 65 of file ME0ReDigiProducer.cc.

Referenced by getPartCenter(), and TemporaryGeometry().

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

Definition at line 68 of file ME0ReDigiProducer.cc.

Referenced by findEtaPartition(), and TemporaryGeometry().

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

Definition at line 67 of file ME0ReDigiProducer.cc.

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