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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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

const std::string geometryType_
 
const bool printRPInfo_
 
const bool printSensorInfo_
 
const edm::ESGetToken< CTPPSGeometry, IdealGeometryRecordtokIdeal_
 
const edm::ESGetToken< CTPPSGeometry, VeryForwardMisalignedGeometryRecordtokMis_
 
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecordtokReal_
 
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 34 of file CTPPSGeometryInfo.cc.

Constructor & Destructor Documentation

◆ CTPPSGeometryInfo()

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

Definition at line 58 of file CTPPSGeometryInfo.cc.

60  : geometryType_(iConfig.getUntrackedParameter<std::string>("geometryType", "real")),
61  printRPInfo_(iConfig.getUntrackedParameter<bool>("printRPInfo", true)),
62  printSensorInfo_(iConfig.getUntrackedParameter<bool>("printSensorInfo", true)),
63  tokIdeal_(esConsumes<CTPPSGeometry, IdealGeometryRecord>()),
64  tokReal_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>()),

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 68 of file CTPPSGeometryInfo.cc.

69  {
70  if (geometryType_ == "ideal") {
71  if (watcherIdealGeometry_.check(iSetup)) {
72  const auto& geometry = iSetup.getData(tokIdeal_);
74  }
75  return;
76  }
77 
78  else if (geometryType_ == "real") {
79  if (watcherRealGeometry_.check(iSetup)) {
80  const auto& geometry = iSetup.getData(tokReal_);
82  }
83  return;
84  }
85 
86  else if (geometryType_ == "misaligned") {
87  if (watcherMisalignedGeometry_.check(iSetup)) {
88  const auto& geometry = iSetup.getData(tokMis_);
90  }
91  return;
92  }
93 
94  throw cms::Exception("CTPPSGeometryInfo") << "Unknown geometry type: `" << geometryType_ << "'.";

References edm::ESWatcher< T >::check(), Exception, geometryType_, edm::EventSetup::getData(), iEvent, printGeometry(), tokIdeal_, tokMis_, tokReal_, watcherIdealGeometry_, watcherMisalignedGeometry_, and watcherRealGeometry_.

◆ formatDetId()

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

Definition at line 98 of file CTPPSGeometryInfo.cc.

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

142  {
143  time_t unixTime = event.time().unixTime();
144  char timeStr[50];
145  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
146 
147  std::ostringstream oss;
148 
149  // RP geometry
150  if (printRPInfo_) {
151  oss << "* RPs:\n"
152  << " ce: RP center in global coordinates, in mm\n";
153 
154  for (auto it = geometry.beginRP(); it != geometry.endRP(); ++it) {
155  const DetGeomDesc::Translation& t = it->second->translation();
156 
157  oss << formatDetId(CTPPSDetId(it->first), false) << std::fixed << std::setprecision(3) << std::showpos
158  << " | ce=(" << t.x() << ", " << t.y() << ", " << t.z() << ")\n";
159  }
160 
161  edm::LogVerbatim("CTPPSGeometryInfo") << oss.str();
162  }
163 
164  // sensor geometry
165  if (printSensorInfo_) {
166  oss << "* sensors:\n"
167  << " ce: sensor center in global coordinates, in mm\n"
168  << " a1: local axis (1, 0, 0) in global coordinates\n"
169  << " a2: local axis (0, 1, 0) in global coordinates\n"
170  << " a3: local axis (0, 0, 1) in global coordinates\n";
171 
172  for (auto it = geometry.beginSensor(); it != geometry.endSensor(); ++it) {
173  CTPPSDetId detId(it->first);
174 
175  const auto gl_o = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 0));
176  const auto gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o;
177  const auto gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o;
178  const auto gl_a3 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 0, 1)) - gl_o;
179 
180  oss << formatDetId(detId) << std::fixed << std::setprecision(3) << std::showpos << " | ce=(" << gl_o.x() << ", "
181  << gl_o.y() << ", " << gl_o.z() << ")"
182  << " | a1=(" << gl_a1.x() << ", " << gl_a1.y() << ", " << gl_a1.z() << ")"
183  << " | a2=(" << gl_a2.x() << ", " << gl_a2.y() << ", " << gl_a2.z() << ")"
184  << " | a3=(" << gl_a3.x() << ", " << gl_a3.y() << ", " << gl_a3.z() << ")\n";
185  }
186  }
187 
188  edm::LogInfo("CTPPSGeometryInfo") << "New " << geometryType_ << " geometry found in run=" << event.id().run()
189  << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime << " ("
190  << timeStr << ")\n"
191  << oss.str();

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

Referenced by analyze().

Member Data Documentation

◆ geometryType_

const std::string CTPPSGeometryInfo::geometryType_
private

Definition at line 43 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and printGeometry().

◆ printRPInfo_

const bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ printSensorInfo_

const bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ tokIdeal_

const edm::ESGetToken<CTPPSGeometry, IdealGeometryRecord> CTPPSGeometryInfo::tokIdeal_
private

Definition at line 45 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ tokMis_

const edm::ESGetToken<CTPPSGeometry, VeryForwardMisalignedGeometryRecord> CTPPSGeometryInfo::tokMis_
private

Definition at line 47 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ tokReal_

const edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> CTPPSGeometryInfo::tokReal_
private

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherIdealGeometry_

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

Definition at line 49 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherMisalignedGeometry_

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

Definition at line 51 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherRealGeometry_

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

Definition at line 50 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
CTPPSGeometryInfo::watcherRealGeometry_
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry_
Definition: CTPPSGeometryInfo.cc:50
geometry
Definition: geometry.py:1
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
CTPPSDetId::sdTrackingStrip
Definition: CTPPSDetId.h:44
CTPPSGeometryInfo::formatDetId
static std::string formatDetId(const CTPPSDetId &id, bool printDetails=true)
Definition: CTPPSGeometryInfo.cc:98
CTPPSGeometryInfo::tokReal_
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokReal_
Definition: CTPPSGeometryInfo.cc:46
CTPPSDetId::sdTimingDiamond
Definition: CTPPSDetId.h:44
CTPPSDetId::sdTrackingPixel
Definition: CTPPSDetId.h:44
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:51
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
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
CTPPSGeometryInfo::tokMis_
const edm::ESGetToken< CTPPSGeometry, VeryForwardMisalignedGeometryRecord > tokMis_
Definition: CTPPSGeometryInfo.cc:47
CTPPSGeometryInfo::printRPInfo_
const bool printRPInfo_
Definition: CTPPSGeometryInfo.cc:44
DetGeomDesc::Translation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation
Definition: DetGeomDesc.h:54
CTPPSGeometryInfo::printGeometry
void printGeometry(const CTPPSGeometry &, const edm::Event &)
Definition: CTPPSGeometryInfo.cc:141
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:245
CTPPSGeometryInfo::geometryType_
const std::string geometryType_
Definition: CTPPSGeometryInfo.cc:43
CTPPSGeometryInfo::printSensorInfo_
const bool printSensorInfo_
Definition: CTPPSGeometryInfo.cc:44
CTPPSGeometryInfo::watcherIdealGeometry_
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
Definition: CTPPSGeometryInfo.cc:49
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
CTPPSGeometryInfo::tokIdeal_
const edm::ESGetToken< CTPPSGeometry, IdealGeometryRecord > tokIdeal_
Definition: CTPPSGeometryInfo.cc:45
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
CTPPSGeometry::Vector
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:39