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
 
- 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
 
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
 
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 void PrintDetId (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 32 of file CTPPSGeometryInfo.cc.

Constructor & Destructor Documentation

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

Definition at line 55 of file CTPPSGeometryInfo.cc.

55  :
56  geometryType_ ( iConfig.getUntrackedParameter<std::string>( "geometryType", "real" ) ),
57  printRPInfo_ ( iConfig.getUntrackedParameter<bool>( "printRPInfo", true ) ),
58  printSensorInfo_( iConfig.getUntrackedParameter<bool>( "printSensorInfo", true ) )
59 {
60 }
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 65 of file CTPPSGeometryInfo.cc.

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

66 {
68 
69  if ( geometryType_ == "ideal" ) {
70  if ( watcherIdealGeometry_.check( iSetup ) ) {
71  iSetup.get<IdealGeometryRecord>().get( geometry );
72  PrintGeometry( *geometry, iEvent );
73  }
74  return;
75  }
76 
77  else if ( geometryType_ == "real" ) {
78  if ( watcherRealGeometry_.check( iSetup ) ) {
79  iSetup.get<VeryForwardRealGeometryRecord>().get( geometry );
80  PrintGeometry( *geometry, iEvent );
81  }
82  return;
83  }
84 
85  else if ( geometryType_ == "misaligned" ) {
86  if ( watcherMisalignedGeometry_.check( iSetup ) ) {
87  iSetup.get<VeryForwardMisalignedGeometryRecord>().get( geometry );
88  PrintGeometry( *geometry, iEvent );
89  }
90  return;
91  }
92 
93  throw cms::Exception("CTPPSGeometryInfo") << "Unknown geometry type: `" << geometryType_ << "'.";
94 }
std::string geometryType_
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry_
Event setup record containing the real (actual) geometry information.
void PrintGeometry(const CTPPSGeometry &, const edm::Event &)
edm::ESWatcher< VeryForwardMisalignedGeometryRecord > watcherMisalignedGeometry_
const T & get() const
Definition: EventSetup.h:55
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...
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
void CTPPSGeometryInfo::PrintDetId ( const CTPPSDetId id,
bool  printDetails = true 
)
staticprivate

Definition at line 99 of file CTPPSGeometryInfo.cc.

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

Referenced by PrintGeometry().

100 {
101  std::ostringstream oss;
102  oss << id.rawId();
103 
104  const unsigned int rpDecId = id.arm()*100 + id.station()*10 + id.rp();
105 
106  if ( id.subdetId() == CTPPSDetId::sdTrackingStrip ) {
107  TotemRPDetId fid( id );
108  oss << " (strip RP " << rpDecId;
109  if ( printDetails )
110  oss << ", plane " << fid.plane();
111  oss << ")";
112  }
113 
114  if ( id.subdetId() == CTPPSDetId::sdTrackingPixel ) {
115  CTPPSPixelDetId fid( id );
116  oss << " (pixel RP " << rpDecId;
117  if ( printDetails )
118  oss << ", plane " << fid.plane();
119  oss << ")";
120  }
121 
122  if (id.subdetId() == CTPPSDetId::sdTimingDiamond) {
123  CTPPSDiamondDetId fid( id );
124  oss << " (diamd RP " << rpDecId;
125  if ( printDetails )
126  oss << ", plane " << fid.plane() << ", channel " << fid.channel();
127  oss << ")";
128  }
129  edm::LogVerbatim("CTPPSGeometryInfo") << oss.str();
130 }
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 135 of file CTPPSGeometryInfo.cc.

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

Referenced by analyze().

136 {
137  time_t unixTime = event.time().unixTime();
138  char timeStr[50];
139  strftime( timeStr, 50, "%F %T", localtime( &unixTime ) );
140 
141  edm::LogVerbatim("CTPPSGeometryInfo")
142  << "new " << geometryType_ << " geometry found in run="
143  << event.id().run() << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime
144  << " (" << timeStr << ")";
145 
146  // RP geometry
147  if ( printRPInfo_ ) {
148  std::ostringstream oss;
149  oss << "* RPs:\n"
150  << " ce: RP center in global coordinates, in mm\n";
151  for ( auto it = geometry.beginRP(); it != geometry.endRP(); ++it ) {
152  const DDTranslation &t = it->second->translation();
153 
154  PrintDetId( CTPPSDetId( it->first ), false );
155  oss << std::fixed << std::setprecision( 3 ) << " | ce=(" << t.x() << ", " << t.y() << ", " << t.z() << ")";
156  }
157  edm::LogVerbatim("CTPPSGeometryInfo") << oss.str();
158  }
159 
160  // sensor geometry
161  if ( printSensorInfo_ ) {
162  edm::LogVerbatim("CTPPSGeometryInfo")
163  << "* sensors:\n"
164  << " ce: sensor center in global coordinates, in mm\n"
165  << " a1: local axis (1, 0, 0) in global coordinates\n"
166  << " a2: local axis (0, 1, 0) in global coordinates\n"
167  << " a3: local axis (0, 0, 1) in global coordinates";
168 
169  for ( auto it = geometry.beginSensor(); it != geometry.endSensor(); ++it ) {
170  CTPPSDetId detId( it->first );
171 
172  const CLHEP::Hep3Vector gl_o = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 0, 0 ) );
173  const CLHEP::Hep3Vector gl_a1 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 1, 0, 0 ) ) - gl_o;
174  const CLHEP::Hep3Vector gl_a2 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 1, 0 ) ) - gl_o;
175  const CLHEP::Hep3Vector gl_a3 = geometry.localToGlobal( detId, CLHEP::Hep3Vector( 0, 0, 1 ) ) - gl_o;
176 
177  PrintDetId( detId );
178 
179  edm::LogVerbatim("CTPPSGeometryInfo")
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() << ")";
184  }
185  }
186 }
std::string geometryType_
static void PrintDetId(const CTPPSDetId &id, bool printDetails=true)
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
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 38 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and PrintGeometry().

bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 40 of file CTPPSGeometryInfo.cc.

Referenced by PrintGeometry().

bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 40 of file CTPPSGeometryInfo.cc.

Referenced by PrintGeometry().

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

Definition at line 42 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

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

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

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

Definition at line 43 of file CTPPSGeometryInfo.cc.

Referenced by analyze().