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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< 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 30 of file GeometryInfoModule.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file GeometryInfoModule.cc.

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

Definition at line 95 of file GeometryInfoModule.cc.

96 {
97 }

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 113 of file GeometryInfoModule.cc.

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

114 {
116 
117  if (!geometryType.compare("ideal"))
118  {
119  if (watcherIdealGeometry.check(es))
120  {
121  es.get<IdealGeometryRecord>().get(geometry);
122  PrintGeometry(*geometry, event);
123  }
124  return;
125  }
126 
127  if (!geometryType.compare("real"))
128  {
129  if (watcherRealGeometry.check(es))
130  {
131  es.get<VeryForwardRealGeometryRecord>().get(geometry);
132  PrintGeometry(*geometry, event);
133  }
134  return;
135  }
136 
137  if (!geometryType.compare("misaligned"))
138  {
140  {
141  es.get<VeryForwardMisalignedGeometryRecord>().get(geometry);
142  PrintGeometry(*geometry, event);
143  }
144  return;
145  }
146 
147  throw cms::Exception("GeometryInfoModule") << "Unknown geometry type: `" << geometryType << "'.";
148 }
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry
Event setup record containing the real (actual) 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 101 of file GeometryInfoModule.cc.

102 {
103 }
void GeometryInfoModule::endJob ( void  )
privatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 107 of file GeometryInfoModule.cc.

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

Definition at line 152 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, lumiQTWidget::t, x, y, and z.

Referenced by analyze().

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

Referenced by analyze(), and PrintGeometry().

bool GeometryInfoModule::printMeanSensorInfo
private

Definition at line 66 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

bool GeometryInfoModule::printRPInfo
private

Definition at line 66 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

bool GeometryInfoModule::printSensorInfo
private

Definition at line 66 of file GeometryInfoModule.cc.

Referenced by PrintGeometry().

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

Definition at line 68 of file GeometryInfoModule.cc.

Referenced by analyze().

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

Definition at line 70 of file GeometryInfoModule.cc.

Referenced by analyze().

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

Definition at line 69 of file GeometryInfoModule.cc.

Referenced by analyze().