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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 59 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>()),
65  tokMis_(esConsumes<CTPPSGeometry, VeryForwardMisalignedGeometryRecord>()) {}
const edm::ESGetToken< CTPPSGeometry, IdealGeometryRecord > tokIdeal_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokReal_
const edm::ESGetToken< CTPPSGeometry, VeryForwardMisalignedGeometryRecord > tokMis_
const std::string geometryType_
const bool printSensorInfo_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 69 of file CTPPSGeometryInfo.cc.

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

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_ << "'.";
95 }
const edm::ESGetToken< CTPPSGeometry, IdealGeometryRecord > tokIdeal_
edm::ESWatcher< VeryForwardRealGeometryRecord > watcherRealGeometry_
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokReal_
int iEvent
Definition: GenABIO.cc:224
edm::ESWatcher< VeryForwardMisalignedGeometryRecord > watcherMisalignedGeometry_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::ESGetToken< CTPPSGeometry, VeryForwardMisalignedGeometryRecord > tokMis_
const std::string geometryType_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void printGeometry(const CTPPSGeometry &, const edm::Event &)
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_

◆ formatDetId()

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

Definition at line 99 of file CTPPSGeometryInfo.cc.

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

Referenced by printGeometry().

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();
138 }
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 ...

◆ printGeometry()

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

Definition at line 142 of file CTPPSGeometryInfo.cc.

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

Referenced by analyze().

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();
192 }
Log< level::Info, true > LogVerbatim
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:36
static std::string formatDetId(const CTPPSDetId &id, bool printDetails=true)
Log< level::Info, false > LogInfo
const std::string geometryType_
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation
Definition: DetGeomDesc.h:55
const bool printSensorInfo_

Member Data Documentation

◆ geometryType_

const std::string CTPPSGeometryInfo::geometryType_
private

Definition at line 40 of file CTPPSGeometryInfo.cc.

Referenced by analyze(), and printGeometry().

◆ printRPInfo_

const bool CTPPSGeometryInfo::printRPInfo_
private

Definition at line 41 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ printSensorInfo_

const bool CTPPSGeometryInfo::printSensorInfo_
private

Definition at line 41 of file CTPPSGeometryInfo.cc.

Referenced by printGeometry().

◆ tokIdeal_

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

Definition at line 42 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ tokMis_

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

Definition at line 44 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ tokReal_

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

Definition at line 43 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherIdealGeometry_

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

Definition at line 46 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherMisalignedGeometry_

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

Definition at line 48 of file CTPPSGeometryInfo.cc.

Referenced by analyze().

◆ watcherRealGeometry_

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

Definition at line 47 of file CTPPSGeometryInfo.cc.

Referenced by analyze().