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 37 of file ME0ReDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file ME0ReDigiProducer.cc.

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

24  {
25  //First test geometry to make sure that it is compatible with our assumptions
26  const auto& chambers = geometry->chambers();
27  if(chambers.empty())
28  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - No ME0Chambers in geometry.";
29  const auto* mainChamber = chambers.front();
30  const unsigned int nLayers = chambers.front()->nLayers();
31  if(!nLayers)
32  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Chamber has no layers.";
33  const auto* mainLayer = mainChamber->layers()[0];
34  if(!mainLayer->nEtaPartitions())
35  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0Layer has no partitions.";
36  if(mainLayer->nEtaPartitions() != 1)
37  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - This module is only compatitble with geometries that contain only one partition per ME0Layer.";
38 
39  const auto* mainPartition = mainLayer->etaPartitions()[0];
40  const TrapezoidalStripTopology * mainTopo = dynamic_cast<const TrapezoidalStripTopology*>(&mainPartition->topology());
41  if(!mainTopo)
42  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - ME0 strip topology must be of type TrapezoidalStripTopology. This module cannot be used";
43 
44  for(const auto& chamber : geometry->chambers() ){
45  if(chamber->nLayers() != int(nLayers))
46  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0Chambers have the same number of layers. This module cannot be used.";
47  for(unsigned int iL = 0; iL < nLayers; ++iL){
48  if(chamber->layers()[iL]->nEtaPartitions() != mainLayer->nEtaPartitions())
49  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0Layers have the same number of partitions. This module cannot be used.";
50  if(chamber->layers()[iL]->etaPartitions()[0]->specs()->parameters() != mainPartition->specs()->parameters())
51  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA partitions have the same properties. This module cannot be used.";
52  if(std::fabs(chamber->layers()[iL]->etaPartitions()[0]->position().z()) != std::fabs(mainChamber->layers()[iL]->etaPartitions()[0]->position().z()))
53  throw cms::Exception("Setup") << "ME0ReDigiProducer::TemporaryGeometry::TemporaryGeometry() - Not all ME0 ETA partitions in a single layer have the same Z position. This module cannot be used.";
54  }
55  }
56 
57  //Calculate radius to center of partition
58  middleDistanceFromBeam = mainTopo->radius();
59 
60  //calculate the top of each eta partition, assuming equal distance in eta between partitions
61  const auto localTop = LocalPoint(0,mainTopo->stripLength()/2);
62  const auto localBottom = LocalPoint(0,-1*mainTopo->stripLength()/2);
63  const auto globalTop = mainPartition->toGlobal(localTop);
64  const auto globalBottom = mainPartition->toGlobal(localBottom);
65  const double etaTop = globalTop.eta();
66  const double etaBottom = globalBottom.eta();
67  const double zBottom = globalBottom.z();
68 
69  //Build topologies
72  const auto& mainPars = mainPartition->specs()->parameters();
73  for(unsigned int iP = 0; iP < numberOfPartitions; ++iP){
74  const double eta = (etaTop -etaBottom)*double(iP + 1)/double(numberOfPartitions) + etaBottom;
75  const double distFromBeam = std::fabs(zBottom /std::sinh(eta));
76  partitionTops.push_back(distFromBeam - middleDistanceFromBeam);
77  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "Top of new partition: " <<partitionTops.back() << std::endl;
78 
79  std::vector<float> params(4,0);
80 
81  //half width of trapezoid at local coordinate Y
82  auto getWidth = [&] ( float locY ) -> float { return (mainPars[2]*(mainPars[1]+mainPars[0]) +locY*(mainPars[1] - mainPars[0]) )/(2*mainPars[2]);};
83 
84  params[0] = iP == 0 ? mainPars[0] : getWidth(partitionTops[iP -1]); // Half width of bottom of chamber
85  params[1] = iP +1 == numberOfPartitions ? mainPars[1] : getWidth(partitionTops[iP]); // Half width of top of chamber
86  params[2] = ((iP + 1 == numberOfPartitions ? localTop.y() : partitionTops[iP] ) - (iP == 0 ? localBottom.y() : partitionTops[iP-1] ) )/2; // Half width of height of chamber
87  params[3] = numberOfStrips;
88 
89  stripTopos.push_back(buildTopo(params));
90  }
91 
92  //Get TOF at center of each partition
93  tofs.resize(nLayers);
94  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "TOF numbers [layer][partition]: " ;
95  for(unsigned int iL = 0; iL < nLayers; ++iL){
96  tofs[iL].resize(numberOfPartitions);
97  for(unsigned int iP = 0; iP < numberOfPartitions; ++iP){
98  const LocalPoint partCenter(0., getPartCenter(iP), 0.);
99  const GlobalPoint centralGP(mainChamber->layers()[iL]->etaPartitions()[0]->toGlobal(partCenter));
100  tofs[iL][iP] = (centralGP.mag() / (CLHEP::c_light/CLHEP::cm)); //speed of light [cm/ns]
101  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "["<<iL<<"]["<<iP<<"]="<< tofs[iL][iP] <<" "<<std::endl;
102  }
103  }
104 }
#define LogDebug(id)
std::vector< std::vector< double > > tofs
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
T y() const
Definition: PV3DBase.h:63
TrapezoidalStripTopology * buildTopo(const std::vector< float > &_p) const
std::vector< TrapezoidalStripTopology * > stripTopos
const std::vector< const ME0Chamber * > & chambers() const
Return a vector of all ME0 chambers.
Definition: ME0Geometry.cc:49
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:76
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
ME0ReDigiProducer::TemporaryGeometry::~TemporaryGeometry ( )

Definition at line 116 of file ME0ReDigiProducer.cc.

References AlCaHLTBitMon_ParallelJobs::p, and stripTopos.

116  {
117  for(auto * p : stripTopos) { delete p;}
118 }
std::vector< TrapezoidalStripTopology * > stripTopos

Member Function Documentation

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

Definition at line 120 of file ME0ReDigiProducer.cc.

References TtFullHadDaughter::B, b, LogDebug, and RecoTauPiZeroBuilderPlugins_cfi::strips.

Referenced by TemporaryGeometry().

120  {
121  float b = _p[0];
122  float B = _p[1];
123  float h = _p[2];
124  float r0 = h*(B + b)/(B - b);
125  float striplength = h*2;
126  float strips = _p[3];
127  float pitch = (b + B)/strips;
128  int nstrip =static_cast<int>(strips);
129 
130  LogDebug("ME0ReDigiProducer::TemporaryGeometry") << "New partition parameters: " <<
131  "bottom width("<< 2*b <<") top width("<<2*B<<") height("<< 2*h <<") radius to center("<< r0 <<") nStrips("<< strips <<") pitch(" << pitch<<")"<< std::endl;
132 
133  return new TrapezoidalStripTopology(nstrip, pitch, striplength, r0);
134 }
#define LogDebug(id)
static const std::string B
double b
Definition: hdecay.h:120
unsigned int ME0ReDigiProducer::TemporaryGeometry::findEtaPartition ( float  locY) const

Definition at line 106 of file ME0ReDigiProducer.cc.

References partitionTops, and stripTopos.

Referenced by ME0ReDigiProducer::getCustomStripProperties().

106  {
107  unsigned int etaPart = stripTopos.size() -1;
108  for(unsigned int iP = 0; iP < stripTopos.size(); ++iP ){
109  if(locY < partitionTops[iP]) {etaPart = iP; break;}
110  }
111  return etaPart;
112 }
std::vector< TrapezoidalStripTopology * > stripTopos
float ME0ReDigiProducer::TemporaryGeometry::getCentralTOF ( const ME0DetId me0Id,
unsigned int  partIdx 
) const
inline

Definition at line 44 of file ME0ReDigiProducer.h.

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

Referenced by ME0ReDigiProducer::getCustomStripProperties().

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

Definition at line 114 of file ME0ReDigiProducer.cc.

References middleDistanceFromBeam, partIdx(), and stripTopos.

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

114 {return stripTopos[partIdx]->radius() - middleDistanceFromBeam ;}
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 42 of file ME0ReDigiProducer.h.

References partIdx().

Referenced by ME0ReDigiProducer::getCustomStripProperties().

42 {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 45 of file ME0ReDigiProducer.h.

Referenced by ME0ReDigiProducer::beginRun().

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

Member Data Documentation

float ME0ReDigiProducer::TemporaryGeometry::middleDistanceFromBeam
private

Definition at line 49 of file ME0ReDigiProducer.h.

Referenced by getPartCenter(), and TemporaryGeometry().

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

Definition at line 52 of file ME0ReDigiProducer.h.

Referenced by findEtaPartition(), and TemporaryGeometry().

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

Definition at line 51 of file ME0ReDigiProducer.h.

Referenced by TemporaryGeometry().