CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
CTPPSGeometryInfo Class Reference

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

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

Public Member Functions

 CTPPSGeometryInfo (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void printGeometry (const CTPPSGeometry &, const edm::Event &)
 

Static Private Member Functions

static std::string formatDetId (const CTPPSDetId &id, bool printDetails=true)
 

Private Attributes

std::string geometryType_
 
bool printRPInfo_
 
bool printSensorInfo_
 
edm::ESWatcher< IdealGeometryRecordwatcherIdealGeometry_
 
edm::ESWatcher< VeryForwardMisalignedGeometryRecordwatcherMisalignedGeometry_
 
edm::ESWatcher< VeryForwardRealGeometryRecordwatcherRealGeometry_
 

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.

Definition at line 36 of file CTPPSGeometryInfo.cc.

Constructor & Destructor Documentation

CTPPSGeometryInfo::CTPPSGeometryInfo ( const edm::ParameterSet iConfig)
explicit

Definition at line 59 of file CTPPSGeometryInfo.cc.

59  :
60  geometryType_ ( iConfig.getUntrackedParameter<std::string>( "geometryType", "real" ) ),
61  printRPInfo_ ( iConfig.getUntrackedParameter<bool>( "printRPInfo", true ) ),
62  printSensorInfo_( iConfig.getUntrackedParameter<bool>( "printSensorInfo", true ) )
63 {}
std::string geometryType_
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

void CTPPSGeometryInfo::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 68 of file CTPPSGeometryInfo.cc.

References edm::ESWatcher< T >::check(), Exception, geometry, geometryType_, edm::EventSetup::get(), printGeometry(), AlCaHLTBitMon_QueryRunRegistry::string, watcherIdealGeometry_, watcherMisalignedGeometry_, and watcherRealGeometry_.

69 {
71 
72  if ( geometryType_ == "ideal" ) {
73  if ( watcherIdealGeometry_.check( iSetup ) ) {
74  iSetup.get<IdealGeometryRecord>().get( geometry );
75  printGeometry( *geometry, iEvent );
76  }
77  return;
78  }
79 
80  else if ( geometryType_ == "real" ) {
81  if ( watcherRealGeometry_.check( iSetup ) ) {
82  iSetup.get<VeryForwardRealGeometryRecord>().get( geometry );
83  printGeometry( *geometry, iEvent );
84  }
85  return;
86  }
87 
88  else if ( geometryType_ == "misaligned" ) {
89  if ( watcherMisalignedGeometry_.check( iSetup ) ) {
90  iSetup.get<VeryForwardMisalignedGeometryRecord>().get( geometry );
91  printGeometry( *geometry, iEvent );
92  }
93  return;
94  }
95 
96  throw cms::Exception("CTPPSGeometryInfo") << "Unknown geometry type: `" << geometryType_ << "'.";
97 }
std::string geometryType_
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry_
Event setup record containing the real (actual) geometry information.
edm::ESWatcher< VeryForwardMisalignedGeometryRecord > watcherMisalignedGeometry_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
ESHandle< TrackerGeometry > geometry
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
T get() const
Definition: EventSetup.h:62
void printGeometry(const CTPPSGeometry &, const edm::Event &)
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
std::string CTPPSGeometryInfo::formatDetId ( const CTPPSDetId id,
bool  printDetails = true 
)
staticprivate

Definition at line 102 of file CTPPSGeometryInfo.cc.

References CTPPSDiamondDetId::channel(), TotemTimingDetId::channel(), CTPPSPixelDetId::plane(), TotemRPDetId::plane(), CTPPSDiamondDetId::plane(), TotemTimingDetId::plane(), CTPPSDetId::sdTimingDiamond, CTPPSDetId::sdTimingFastSilicon, CTPPSDetId::sdTrackingPixel, and CTPPSDetId::sdTrackingStrip.

Referenced by printGeometry().

103 {
104  std::ostringstream oss;
105  oss << id.rawId();
106 
107  const unsigned int rpDecId = id.arm()*100 + id.station()*10 + id.rp();
108 
109  if ( id.subdetId() == CTPPSDetId::sdTrackingStrip ) {
110  TotemRPDetId fid( id );
111  oss << " (strip RP " << std::setw(3) << rpDecId;
112  if ( printDetails )
113  oss << ", plane " << fid.plane();
114  oss << ")";
115  }
116 
117  else if ( id.subdetId() == CTPPSDetId::sdTrackingPixel ) {
118  CTPPSPixelDetId fid( id );
119  oss << " (pixel RP " << std::setw(3) << rpDecId;
120  if ( printDetails )
121  oss << ", plane " << fid.plane();
122  oss << ")";
123  }
124 
125  else if ( id.subdetId() == CTPPSDetId::sdTimingDiamond ) {
126  CTPPSDiamondDetId fid( id );
127  oss << " (diamd RP " << std::setw(3) << rpDecId;
128  if ( printDetails )
129  oss << ", plane " << fid.plane() << ", channel " << std::setw(2) << fid.channel();
130  oss << ")";
131  }
132 
133  else if ( id.subdetId() == CTPPSDetId::sdTimingFastSilicon ) {
134  TotemTimingDetId fid( id );
135  oss << " (totim RP " << std::setw(3) << rpDecId;
136  if ( printDetails )
137  oss << ", plane " << fid.plane() << ", channel " << std::setw(2) << fid.channel();
138  oss << ")";
139  }
140 
141  return oss.str();
142 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...
void CTPPSGeometryInfo::printGeometry ( const CTPPSGeometry geometry,
const edm::Event event 
)
private

Definition at line 147 of file CTPPSGeometryInfo.cc.

References CTPPSGeometry::beginRP(), CTPPSGeometry::beginSensor(), DEFINE_FWK_MODULE, CTPPSGeometry::endRP(), CTPPSGeometry::endSensor(), alignBH_cfg::fixed, formatDetId(), geometryType_, CTPPSGeometry::localToGlobal(), printRPInfo_, printSensorInfo_, and lumiQTWidget::t.

Referenced by analyze().

148 {
149  time_t unixTime = event.time().unixTime();
150  char timeStr[50];
151  strftime( timeStr, 50, "%F %T", localtime( &unixTime ) );
152 
153  std::ostringstream oss;
154 
155  // RP geometry
156  if ( printRPInfo_ ) {
157  oss << "* RPs:\n"
158  << " ce: RP center in global coordinates, in mm\n";
159 
160  for ( auto it = geometry.beginRP(); it != geometry.endRP(); ++it ) {
161  const DDTranslation &t = it->second->translation();
162 
163  oss << formatDetId( CTPPSDetId( it->first ), false )
164  << std::fixed << std::setprecision( 3 ) << std::showpos
165  << " | ce=(" << t.x() << ", " << t.y() << ", " << t.z() << ")\n";
166  }
167 
168  edm::LogVerbatim("CTPPSGeometryInfo") << oss.str();
169  }
170 
171  // sensor geometry
172  if ( printSensorInfo_ ) {
173  oss << "* sensors:\n"
174  << " ce: sensor center in global coordinates, in mm\n"
175  << " a1: local axis (1, 0, 0) in global coordinates\n"
176  << " a2: local axis (0, 1, 0) in global coordinates\n"
177  << " a3: local axis (0, 0, 1) in global coordinates\n";
178 
179  for ( auto it = geometry.beginSensor(); it != geometry.endSensor(); ++it ) {
180  CTPPSDetId detId( it->first );
181 
182  const CLHEP::Hep3Vector gl_o = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 0, 0 ) );
183  const CLHEP::Hep3Vector gl_a1 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 1, 0, 0 ) ) - gl_o;
184  const CLHEP::Hep3Vector gl_a2 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 1, 0 ) ) - gl_o;
185  const CLHEP::Hep3Vector gl_a3 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 0, 1 ) ) - gl_o;
186 
187  oss << formatDetId( detId )
188  << std::fixed << std::setprecision( 3 ) << std::showpos
189  << " | ce=(" << gl_o.x() << ", " << gl_o.y() << ", " << gl_o.z() << ")"
190  << " | a1=(" << gl_a1.x() << ", " << gl_a1.y() << ", " << gl_a1.z() << ")"
191  << " | a2=(" << gl_a2.x() << ", " << gl_a2.y() << ", " << gl_a2.z() << ")"
192  << " | a3=(" << gl_a3.x() << ", " << gl_a3.y() << ", " << gl_a3.z() << ")\n";
193  }
194  }
195 
196  edm::LogInfo("CTPPSGeometryInfo")
197  << "New " << geometryType_ << " geometry found in run="
198  << event.id().run() << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime
199  << " (" << timeStr << ")\n"
200  << oss.str();
201 }
std::string geometryType_
mapType::const_iterator beginSensor() const
begin iterator over sensors
Definition: CTPPSGeometry.h:72
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
RPDeviceMapType::const_iterator beginRP() const
begin iterator over RPs
Definition: CTPPSGeometry.h:77
static std::string formatDetId(const CTPPSDetId &id, bool printDetails=true)
CLHEP::Hep3Vector localToGlobal(const DetGeomDesc *, const CLHEP::Hep3Vector &) const
mapType::const_iterator endSensor() const
end iterator over sensors
Definition: CTPPSGeometry.h:74
RPDeviceMapType::const_iterator endRP() const
end iterator over RPs
Definition: CTPPSGeometry.h:79
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32

Member Data Documentation

std::string CTPPSGeometryInfo::geometryType_
private

Definition at line 42 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and printGeometry().

bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

edm::ESWatcher<IdealGeometryRecord> CTPPSGeometryInfo::watcherIdealGeometry_
private

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

edm::ESWatcher<VeryForwardMisalignedGeometryRecord> CTPPSGeometryInfo::watcherMisalignedGeometry_
private

Definition at line 48 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

edm::ESWatcher<VeryForwardRealGeometryRecord> CTPPSGeometryInfo::watcherRealGeometry_
private

Definition at line 47 of file CTPPSGeometryInfo.cc.

Referenced by analyze().