CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
GeometryInfoModule Class Reference

Class to print out information on current geometry. More...

Inheritance diagram for GeometryInfoModule:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  MeanRPData
 

Public Member Functions

 GeometryInfoModule (const edm::ParameterSet &)
 
 ~GeometryInfoModule ()
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
void PrintGeometry (const TotemRPGeometry &, const edm::Event &)
 

Private Attributes

std::string geometryType
 
bool printMeanSensorInfo
 
bool printRPInfo
 
bool printSensorInfo
 
edm::ESWatcher
< IdealGeometryRecord
watcherIdealGeometry
 
edm::ESWatcher
< VeryForwardMeasuredGeometryRecord
watcherMeasuredGeometry
 
edm::ESWatcher
< VeryForwardMisalignedGeometryRecord
watcherMisalignedGeometry
 
edm::ESWatcher
< VeryForwardRealGeometryRecord
watcherRealGeometry
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Class to print out information on current geometry.

See schema of TOTEM RP geometry classes

Definition at line 31 of file GeometryInfoModule.cc.

Constructor & Destructor Documentation

GeometryInfoModule::GeometryInfoModule ( const edm::ParameterSet ps)
explicit

Definition at line 87 of file GeometryInfoModule.cc.

87  :
88  geometryType(ps.getUntrackedParameter<string>("geometryType", "real")),
89  printRPInfo(ps.getUntrackedParameter<bool>("printRPInfo", true)),
90  printSensorInfo(ps.getUntrackedParameter<bool>("printSensorInfo", true)),
91  printMeanSensorInfo(ps.getUntrackedParameter<bool>("printMeanSensorInfo", true))
92 {
93 }
T getUntrackedParameter(std::string const &, T const &) const
GeometryInfoModule::~GeometryInfoModule ( )

Definition at line 97 of file GeometryInfoModule.cc.

98 {
99 }

Member Function Documentation

void GeometryInfoModule::analyze ( const edm::Event event,
const edm::EventSetup es 
)
privatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 115 of file GeometryInfoModule.cc.

References edm::ESWatcher< T >::check(), Exception, geometry, geometryType, edm::EventSetup::get(), PrintGeometry(), watcherIdealGeometry, watcherMeasuredGeometry, watcherMisalignedGeometry, and watcherRealGeometry.

116 {
118 
119  if (!geometryType.compare("ideal"))
120  {
121  if (watcherIdealGeometry.check(es))
122  {
123  es.get<IdealGeometryRecord>().get(geometry);
124  PrintGeometry(*geometry, event);
125  }
126  return;
127  }
128 
129  if (!geometryType.compare("measured"))
130  {
132  {
133  es.get<VeryForwardMeasuredGeometryRecord>().get(geometry);
134  PrintGeometry(*geometry, event);
135  }
136  return;
137  }
138 
139  if (!geometryType.compare("real"))
140  {
141  if (watcherRealGeometry.check(es))
142  {
143  es.get<VeryForwardRealGeometryRecord>().get(geometry);
144  PrintGeometry(*geometry, event);
145  }
146  return;
147  }
148 
149  if (!geometryType.compare("misaligned"))
150  {
152  {
153  es.get<VeryForwardMisalignedGeometryRecord>().get(geometry);
154  PrintGeometry(*geometry, event);
155  }
156  return;
157  }
158 
159  throw cms::Exception("GeometryInfoModule") << "Unknown geometry type: `" << geometryType << "'.";
160 }
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry
Event setup record containing the real (actual) geometry information.
edm::ESWatcher< VeryForwardMeasuredGeometryRecord > watcherMeasuredGeometry
Event setup record containing the Measured (measured) geometry information.
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry
const T & get() const
Definition: EventSetup.h:56
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
ESHandle< TrackerGeometry > geometry
void PrintGeometry(const TotemRPGeometry &, const edm::Event &)
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
edm::ESWatcher< VeryForwardMisalignedGeometryRecord > watcherMisalignedGeometry
void GeometryInfoModule::beginRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
privatevirtual

Definition at line 103 of file GeometryInfoModule.cc.

104 {
105 }
void GeometryInfoModule::endJob ( void  )
privatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 109 of file GeometryInfoModule.cc.

110 {
111 }
void GeometryInfoModule::PrintGeometry ( const TotemRPGeometry geometry,
const edm::Event event 
)
private

Definition at line 164 of file GeometryInfoModule.cc.

References TotemRPGeometry::beginDet(), TotemRPGeometry::beginRP(), ztail::d, data, TotemRPGeometry::endDet(), TotemRPGeometry::endRP(), geometryType, TotemRPGeometry::GetReadoutDirection(), TotemRPDetId::getRPDecimalId(), TotemRPDetId::isStripsCoordinateUDirection(), GeometryInfoModule::MeanRPData::N, GeometryInfoModule::MeanRPData::N_u, GeometryInfoModule::MeanRPData::N_v, printMeanSensorInfo, printRPInfo, printSensorInfo, GeometryInfoModule::MeanRPData::Sdx_u, GeometryInfoModule::MeanRPData::Sdx_v, GeometryInfoModule::MeanRPData::Sdy_u, GeometryInfoModule::MeanRPData::Sdy_v, GeometryInfoModule::MeanRPData::Sx, GeometryInfoModule::MeanRPData::Sy, GeometryInfoModule::MeanRPData::Sz, t, x, y, and z.

Referenced by analyze().

165 {
166  time_t unixTime = event.time().unixTime();
167  char timeStr[50];
168  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
169  printf(">> GeometryInfoModule::PrintGeometry\n\tnew %s geometry found in run=%u, event=%llu, UNIX timestamp=%lu (%s)\n",
170  geometryType.c_str(), event.id().run(), event.id().event(), unixTime, timeStr);
171 
172  // RP geometry
173  if (printRPInfo)
174  {
175  printf("\n* RPs:\n");
176  printf(" ID | x (mm) | y (mm) | z (m) |\n");
177  for (TotemRPGeometry::RPDeviceMapType::const_iterator it = geometry.beginRP(); it != geometry.endRP(); ++it)
178  {
179  const DDTranslation &t = it->second->translation();
180  printf(" %3i | %+11.3f | %+11.3f | %+9.4f |\n", it->first, t.x(), t.y(), t.z() * 1E-3);
181  }
182  }
183 
184  // sensor geometry
185  if (printSensorInfo)
186  {
187  printf("\n* silicon sensors:\n");
188  printf("DetId | detector center | readout direction |\n");
189  printf(" | x (mm) | y (mm) | z (m) | dx | dy |\n");
190  for (TotemRPGeometry::mapType::const_iterator it = geometry.beginDet(); it != geometry.endDet(); ++it)
191  {
192  TotemRPDetId id(it->first);
193 
194  double x = it->second->translation().x();
195  double y = it->second->translation().y();
196  double z = it->second->translation().z() * 1E-3;
197 
198  double dx = 0., dy = 0.;
199  geometry.GetReadoutDirection(it->first, dx, dy);
200 
201  printf("%4i | %8.3f | %8.3f | %9.4f | %8.3f | %8.3f |\n", id.getPlaneDecimalId(), x, y, z, dx, dy);
202  }
203  }
204 
205  // sensor geometry averaged over 1 RP
207  {
208  printf("\n* average over silicon sensors of 1 RP:\n");
209 
210  map<unsigned int, MeanRPData> data; // map: RP Id --> sums of geometrical info
211 
212  for (TotemRPGeometry::mapType::const_iterator it = geometry.beginDet(); it != geometry.endDet(); ++it)
213  {
214  TotemRPDetId plId(it->first);
215  unsigned int rpDecId = plId.getRPDecimalId();
216  bool uDirection = plId.isStripsCoordinateUDirection();
217 
218  double x = it->second->translation().x();
219  double y = it->second->translation().y();
220  double z = it->second->translation().z() * 1E-3;
221 
222  double dx = 0., dy = 0.;
223  geometry.GetReadoutDirection(it->first, dx, dy);
224 
225  data[rpDecId].Fill(x, y, z, uDirection, dx, dy);
226  }
227 
228  printf("RPId | center | U direction | V direction |\n");
229  printf(" | x (mm) | y (mm) | z (m) | dx | dy | dx | dy |\n");
230 
231  for (map<unsigned int, MeanRPData>::iterator it = data.begin(); it != data.end(); ++it)
232  {
233  const MeanRPData &d = it->second;
234 
235  double mx = (d.N > 0) ? d.Sx / d.N : 0.;
236  double my = (d.N > 0) ? d.Sy / d.N : 0.;
237  double mz = (d.N > 0) ? d.Sz / d.N : 0.;
238 
239  double mdx_u = (d.N_u > 0) ? d.Sdx_u / d.N_u : 0.;
240  double mdy_u = (d.N_u > 0) ? d.Sdy_u / d.N_u : 0.;
241 
242  double mdx_v = (d.N_v > 0) ? d.Sdx_v / d.N_v : 0.;
243  double mdy_v = (d.N_v > 0) ? d.Sdy_v / d.N_v : 0.;
244 
245 
246  printf(" %3i | %8.3f | %8.3f | %9.4f | %8.3f | %8.3f | %8.3f | %8.3f |\n", it->first, mx, my, mz, mdx_u, mdy_u, mdx_v, mdy_v);
247  }
248  }
249 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
RPDeviceMapType::const_iterator endRP() const
end iterator over RPs
void GetReadoutDirection(unsigned int id, double &dx, double &dy) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
mapType::const_iterator endDet() const
end iterator over (silicon) detectors
tuple d
Definition: ztail.py:151
RPDeviceMapType::const_iterator beginRP() const
begin iterator over RPs
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
mapType::const_iterator beginDet() const
begin iterator over (silicon) detectors

Member Data Documentation

std::string GeometryInfoModule::geometryType
private

Definition at line 65 of file GeometryInfoModule.cc.

Referenced by analyze(), and PrintGeometry().

bool GeometryInfoModule::printMeanSensorInfo
private

Definition at line 67 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

bool GeometryInfoModule::printRPInfo
private

Definition at line 67 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

bool GeometryInfoModule::printSensorInfo
private

Definition at line 67 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

edm::ESWatcher<IdealGeometryRecord> GeometryInfoModule::watcherIdealGeometry
private

Definition at line 69 of file GeometryInfoModule.cc.

Referenced by analyze().

edm::ESWatcher<VeryForwardMeasuredGeometryRecord> GeometryInfoModule::watcherMeasuredGeometry
private

Definition at line 70 of file GeometryInfoModule.cc.

Referenced by analyze().

edm::ESWatcher<VeryForwardMisalignedGeometryRecord> GeometryInfoModule::watcherMisalignedGeometry
private

Definition at line 72 of file GeometryInfoModule.cc.

Referenced by analyze().

edm::ESWatcher<VeryForwardRealGeometryRecord> GeometryInfoModule::watcherRealGeometry
private

Definition at line 71 of file GeometryInfoModule.cc.

Referenced by analyze().