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 35 of file CTPPSGeometryInfo.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file CTPPSGeometryInfo.cc.

58  :
59  geometryType_ ( iConfig.getUntrackedParameter<std::string>( "geometryType", "real" ) ),
60  printRPInfo_ ( iConfig.getUntrackedParameter<bool>( "printRPInfo", true ) ),
61  printSensorInfo_( iConfig.getUntrackedParameter<bool>( "printSensorInfo", true ) )
62 {
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_
const T & get() const
Definition: EventSetup.h:59
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...
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(), CTPPSPixelDetId::plane(), TotemRPDetId::plane(), CTPPSDiamondDetId::plane(), CTPPSDetId::sdTimingDiamond, 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  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  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  return oss.str();
134 }
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...
void CTPPSGeometryInfo::printGeometry ( const CTPPSGeometry geometry,
const edm::Event event 
)
private

Definition at line 139 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().

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

Member Data Documentation

std::string CTPPSGeometryInfo::geometryType_
private

Definition at line 41 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and printGeometry().

bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 43 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 43 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

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

Definition at line 45 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

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

Definition at line 47 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

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

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by analyze().