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
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::CTPPSGeometryInfo ( const edm::ParameterSet iConfig)
explicit

Definition at line 57 of file CTPPSGeometryInfo.cc.

59  : geometryType_(iConfig.getUntrackedParameter<std::string>("geometryType", "real")),
60  printRPInfo_(iConfig.getUntrackedParameter<bool>("printRPInfo", true)),

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 64 of file CTPPSGeometryInfo.cc.

65  {
67 
68  if (geometryType_ == "ideal") {
69  if (watcherIdealGeometry_.check(iSetup)) {
72  }
73  return;
74  }
75 
76  else if (geometryType_ == "real") {
77  if (watcherRealGeometry_.check(iSetup)) {
80  }
81  return;
82  }
83 
84  else if (geometryType_ == "misaligned") {
85  if (watcherMisalignedGeometry_.check(iSetup)) {
88  }
89  return;
90  }
91 
92  throw cms::Exception("CTPPSGeometryInfo") << "Unknown geometry type: `" << geometryType_ << "'.";

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

◆ formatDetId()

std::string CTPPSGeometryInfo::formatDetId ( const CTPPSDetId id,
bool  printDetails = true 
)
staticprivate

Definition at line 96 of file CTPPSGeometryInfo.cc.

97  {
98  std::ostringstream oss;
99  oss << id.rawId();
100 
101  const unsigned int rpDecId = id.arm() * 100 + id.station() * 10 + id.rp();
102 
103  if (id.subdetId() == CTPPSDetId::sdTrackingStrip) {
104  TotemRPDetId fid(id);
105  oss << " (strip RP " << std::setw(3) << rpDecId;
106  if (printDetails)
107  oss << ", plane " << fid.plane();
108  oss << ")";
109  }
110 
111  else if (id.subdetId() == CTPPSDetId::sdTrackingPixel) {
112  CTPPSPixelDetId fid(id);
113  oss << " (pixel RP " << std::setw(3) << rpDecId;
114  if (printDetails)
115  oss << ", plane " << fid.plane();
116  oss << ")";
117  }
118 
119  else if (id.subdetId() == CTPPSDetId::sdTimingDiamond) {
120  CTPPSDiamondDetId fid(id);
121  oss << " (diamd RP " << std::setw(3) << rpDecId;
122  if (printDetails)
123  oss << ", plane " << fid.plane() << ", channel " << std::setw(2) << fid.channel();
124  oss << ")";
125  }
126 
127  else if (id.subdetId() == CTPPSDetId::sdTimingFastSilicon) {
128  TotemTimingDetId fid(id);
129  oss << " (totim RP " << std::setw(3) << rpDecId;
130  if (printDetails)
131  oss << ", plane " << fid.plane() << ", channel " << std::setw(2) << fid.channel();
132  oss << ")";
133  }
134 
135  return oss.str();

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

Referenced by printGeometry().

◆ printGeometry()

void CTPPSGeometryInfo::printGeometry ( const CTPPSGeometry geometry,
const edm::Event event 
)
private

Definition at line 139 of file CTPPSGeometryInfo.cc.

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 DetGeomDesc::Translation& t = it->second->translation();
154 
155  oss << formatDetId(CTPPSDetId(it->first), false) << std::fixed << std::setprecision(3) << std::showpos
156  << " | 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 auto gl_o = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 0));
174  const auto gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o;
175  const auto gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o;
176  const auto gl_a3 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 1)) - gl_o;
177 
178  oss << formatDetId(detId) << std::fixed << std::setprecision(3) << std::showpos << " | ce=(" << gl_o.x() << ", "
179  << gl_o.y() << ", " << gl_o.z() << ")"
180  << " | a1=(" << gl_a1.x() << ", " << gl_a1.y() << ", " << gl_a1.z() << ")"
181  << " | a2=(" << gl_a2.x() << ", " << gl_a2.y() << ", " << gl_a2.z() << ")"
182  << " | a3=(" << gl_a3.x() << ", " << gl_a3.y() << ", " << gl_a3.z() << ")\n";
183  }
184  }
185 
186  edm::LogInfo("CTPPSGeometryInfo") << "New " << geometryType_ << " geometry found in run=" << event.id().run()
187  << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime << " ("
188  << timeStr << ")\n"
189  << oss.str();

References alignBH_cfg::fixed, formatDetId(), geometryType_, printRPInfo_, printSensorInfo_, and submitPVValidationJobs::t.

Referenced by analyze().

Member Data Documentation

◆ geometryType_

std::string CTPPSGeometryInfo::geometryType_
private

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and printGeometry().

◆ printRPInfo_

bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ printSensorInfo_

bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ watcherIdealGeometry_

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

Definition at line 48 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherMisalignedGeometry_

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

Definition at line 50 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherRealGeometry_

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

Definition at line 49 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
VeryForwardRealGeometryRecord
Event setup record containing the real (actual) geometry information.
Definition: VeryForwardRealGeometryRecord.h:22
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
CTPPSGeometryInfo::watcherRealGeometry_
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry_
Definition: CTPPSGeometryInfo.cc:49
CTPPSGeometryInfo::geometryType_
std::string geometryType_
Definition: CTPPSGeometryInfo.cc:44
geometry
Definition: geometry.py:1
relativeConstraints.geometry
geometry
Definition: relativeConstraints.py:39
CTPPSDetId::sdTimingFastSilicon
Definition: CTPPSDetId.h:44
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CTPPSGeometryInfo::printRPInfo_
bool printRPInfo_
Definition: CTPPSGeometryInfo.cc:46
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSGeometryInfo::formatDetId
static std::string formatDetId(const CTPPSDetId &id, bool printDetails=true)
Definition: CTPPSGeometryInfo.cc:96
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
CTPPSGeometryInfo::printSensorInfo_
bool printSensorInfo_
Definition: CTPPSGeometryInfo.cc:46
edm::ESHandle< CTPPSGeometry >
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TotemTimingDetId
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...
Definition: TotemTimingDetId.h:26
CTPPSGeometryInfo::watcherMisalignedGeometry_
edm::ESWatcher< VeryForwardMisalignedGeometryRecord > watcherMisalignedGeometry_
Definition: CTPPSGeometryInfo.cc:50
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
CTPPSDetId
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSPixelDetId
Definition: CTPPSPixelDetId.h:16
get
#define get
VeryForwardMisalignedGeometryRecord
Event setup record containing the misaligned geometry information. It is used for alignment studies o...
Definition: VeryForwardMisalignedGeometryRecord.h:23
DetGeomDesc::Translation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation
Definition: DetGeomDesc.h:53
CTPPSGeometryInfo::printGeometry
void printGeometry(const CTPPSGeometry &, const edm::Event &)
Definition: CTPPSGeometryInfo.cc:139
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:245
CTPPSGeometryInfo::watcherIdealGeometry_
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
Definition: CTPPSGeometryInfo.cc:48
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
CTPPSGeometry::Vector
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:39