CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PPSGeometryBuilder Class Reference
Inheritance diagram for PPSGeometryBuilder:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 PPSGeometryBuilder (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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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 buildPDetGeomDesc (DDFilteredView *, PDetGeomDesc *)
 
uint32_t getGeographicalID (DDFilteredView *)
 

Private Attributes

std::string compactViewTag_
 
edm::Service< cond::service::PoolDBOutputServicedbservice_
 
edm::ESWatcher< IdealGeometryRecordwatcherIdealGeometry_
 

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>
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)
 
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

Definition at line 42 of file PPSGeometryBuilder.cc.

Constructor & Destructor Documentation

◆ PPSGeometryBuilder()

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

Definition at line 58 of file PPSGeometryBuilder.cc.

59  : compactViewTag_(iConfig.getUntrackedParameter<std::string>("compactViewTag", "XMLIdealGeometryESSource_CTPPS")) {}

Member Function Documentation

◆ analyze()

void PPSGeometryBuilder::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 63 of file PPSGeometryBuilder.cc.

63  {
65 
66  // Get DDCompactView from IdealGeometryRecord
67  if (watcherIdealGeometry_.check(iSetup)) {
68  iSetup.get<IdealGeometryRecord>().get(compactViewTag_.c_str(), cpv);
69  }
70 
71  // Create DDFilteredView and apply the filter
73  DDFilteredView fv((*cpv), filter);
74 
75  // Persistent geometry data
76  PDetGeomDesc* pdet = new PDetGeomDesc;
77  // Build geometry
78  buildPDetGeomDesc(&fv, pdet);
79 
80  // Save geometry in the database
81  if (pdet->container_.empty()) {
82  throw cms::Exception("PPSGeometryBuilder") << "PDetGeomDesc is empty, no geometry to save in the database.";
83  } else {
84  if (dbservice_.isAvailable()) {
85  dbservice_->writeOne(pdet, dbservice_->beginOfTime(), "VeryForwardIdealGeometryRecord");
86  } else {
87  throw cms::Exception("PoolDBService required.");
88  }
89  }
90 
91  return;
92 }

References cond::service::PoolDBOutputService::beginOfTime(), buildPDetGeomDesc(), edm::ESWatcher< T >::check(), compactViewTag_, PDetGeomDesc::container_, dbservice_, Exception, ALCARECOTkAlBeamHalo_cff::filter, edm::EventSetup::get(), get, edm::Service< T >::isAvailable(), watcherIdealGeometry_, and cond::service::PoolDBOutputService::writeOne().

◆ buildPDetGeomDesc()

void PPSGeometryBuilder::buildPDetGeomDesc ( DDFilteredView fv,
PDetGeomDesc gd 
)
private

Definition at line 96 of file PPSGeometryBuilder.cc.

96  {
97  // try to dive into next level
98  if (!fv->firstChild())
99  return;
100 
101  // loop over siblings in the level
102  do {
103  // Create a PDetGeomDesc::Item node and add it to the parent's (gd) list
105 
106  // =======================================================================
107  // Fill Item
108  // =======================================================================
109 
110  item.dx_ = fv->translation().X();
111  item.dy_ = fv->translation().Y();
112  item.dz_ = fv->translation().Z();
113  const DDRotationMatrix& rot = fv->rotation();
114  double xx, xy, xz, yx, yy, yz, zx, zy, zz;
115  rot.GetComponents(xx, xy, xz, yx, yy, yz, zx, zy, zz);
116  item.axx_ = xx;
117  item.axy_ = xy;
118  item.axz_ = xz;
119  item.ayx_ = yx;
120  item.ayy_ = yy;
121  item.ayz_ = yz;
122  item.azx_ = zx;
123  item.azy_ = zy;
124  item.azz_ = zz;
125  item.name_ = ((fv->logicalPart()).ddname()).name();
126  item.params_ = ((fv->logicalPart()).solid()).parameters();
127  item.copy_ = fv->copyno();
128  item.z_ = fv->geoHistory().back().absTranslation().z();
129  // Sensor Type
130  item.sensorType_ = "";
131  std::string sensor_name = fv->geoHistory().back().logicalPart().name().fullname();
132  std::size_t found = sensor_name.find(DDD_CTPPS_PIXELS_SENSOR_NAME);
133  if (found != std::string::npos && sensor_name.substr(found - 4, 3) == DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2) {
135  }
136  // Geographical ID
137  item.geographicalID_ = getGeographicalID(fv);
138 
139  // =======================================================================
140 
141  // add component
142  gd->container_.push_back(item);
143 
144  // recursion
145  buildPDetGeomDesc(fv, gd);
146  } while (fv->nextSibling());
147 
148  // go a level up
149  fv->parent();
150 }

References PDetGeomDesc::container_, DDFilteredView::copyno(), DDD_CTPPS_PIXELS_SENSOR_NAME, DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2, DDFilteredView::firstChild(), newFWLiteAna::found, DDFilteredView::geoHistory(), getGeographicalID(), B2GTnPMonitor_cfi::item, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDFilteredView::nextSibling(), DDFilteredView::parent(), makeMuonMisalignmentScenario::rot, DDFilteredView::rotation(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

Referenced by analyze().

◆ getGeographicalID()

uint32_t PPSGeometryBuilder::getGeographicalID ( DDFilteredView view)
private

Definition at line 154 of file PPSGeometryBuilder.cc.

154  {
155  uint32_t geoID = 0;
156  const std::string name = view->logicalPart().name().name();
157 
158  // strip sensors
160  const std::vector<int>& copy_num = view->copyNumbers();
161  // check size of copy numubers array
162  if (copy_num.size() < 3)
163  throw cms::Exception("DDDTotemRPContruction")
164  << "size of copyNumbers for strip sensor is " << copy_num.size() << ". It must be >= 3.";
165 
166  // extract information
167  const unsigned int decRPId = copy_num[copy_num.size() - 3];
168  const unsigned int arm = decRPId / 100;
169  const unsigned int station = (decRPId % 100) / 10;
170  const unsigned int rp = decRPId % 10;
171  const unsigned int detector = copy_num[copy_num.size() - 1];
172  geoID = TotemRPDetId(arm, station, rp, detector);
173  }
174 
175  // strip and pixels RPs
177  unsigned int decRPId = view->copyno();
178 
179  // check if it is a pixel RP
180  if (decRPId >= 10000) {
181  decRPId = decRPId % 10000;
182  const unsigned int armIdx = (decRPId / 100) % 10;
183  const unsigned int stIdx = (decRPId / 10) % 10;
184  const unsigned int rpIdx = decRPId % 10;
185  geoID = CTPPSPixelDetId(armIdx, stIdx, rpIdx);
186  } else {
187  const unsigned int armIdx = (decRPId / 100) % 10;
188  const unsigned int stIdx = (decRPId / 10) % 10;
189  const unsigned int rpIdx = decRPId % 10;
190  geoID = TotemRPDetId(armIdx, stIdx, rpIdx);
191  }
192  }
193 
194  else if (std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) {
195  const std::vector<int>& copy_num = view->copyNumbers();
196  // check size of copy numbers array
197  if (copy_num.size() < 4)
198  throw cms::Exception("DDDTotemRPContruction")
199  << "size of copyNumbers for TOTEM timing sensor is " << copy_num.size() << ". It must be >= 4.";
200 
201  const unsigned int decRPId = copy_num[copy_num.size() - 4];
202  const unsigned int arm = decRPId / 100, station = (decRPId % 100) / 10, rp = decRPId % 10;
203  const unsigned int plane = copy_num[copy_num.size() - 2], channel = copy_num[copy_num.size() - 1];
204  geoID = TotemTimingDetId(arm, station, rp, plane, channel);
205  }
206 
207  else if (name == DDD_TOTEM_TIMING_RP_NAME) {
208  const unsigned int arm = view->copyno() / 100, station = (view->copyno() % 100) / 10, rp = view->copyno() % 10;
209  geoID = TotemTimingDetId(arm, station, rp);
210  }
211 
212  // pixel sensors
213  else if (name == DDD_CTPPS_PIXELS_SENSOR_NAME) {
214  const std::vector<int>& copy_num = view->copyNumbers();
215  // check size of copy numubers array
216  if (copy_num.size() < 4)
217  throw cms::Exception("DDDTotemRPContruction")
218  << "size of copyNumbers for pixel sensor is " << copy_num.size() << ". It must be >= 4.";
219 
220  // extract information
221  const unsigned int decRPId = copy_num[copy_num.size() - 4] % 10000;
222  const unsigned int arm = decRPId / 100;
223  const unsigned int station = (decRPId % 100) / 10;
224  const unsigned int rp = decRPId % 10;
225  const unsigned int detector = copy_num[copy_num.size() - 2] - 1;
226  geoID = CTPPSPixelDetId(arm, station, rp, detector);
227  }
228 
229  // diamond/UFSD sensors
231  const std::vector<int>& copy_num = view->copyNumbers();
232 
233  const unsigned int id = copy_num[copy_num.size() - 1];
234  const unsigned int arm = copy_num[1] - 1;
235  const unsigned int station = 1;
236  const unsigned int rp = 6;
237  const unsigned int plane = (id / 100);
238  const unsigned int channel = id % 100;
239 
240  geoID = CTPPSDiamondDetId(arm, station, rp, plane, channel);
241  }
242 
243  // diamond/UFSD RPs
244  else if (name == DDD_CTPPS_DIAMONDS_RP_NAME) {
245  const std::vector<int>& copy_num = view->copyNumbers();
246 
247  // check size of copy numubers array
248  if (copy_num.size() < 2)
249  throw cms::Exception("DDDTotemRPContruction")
250  << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2.";
251 
252  const unsigned int arm = copy_num[1] - 1;
253  const unsigned int station = 1;
254  const unsigned int rp = 6;
255 
256  geoID = CTPPSDiamondDetId(arm, station, rp);
257  }
258 
259  return geoID;
260 }

References DDFilteredView::copyno(), DDFilteredView::copyNumbers(), DDD_CTPPS_DIAMONDS_RP_NAME, DDD_CTPPS_DIAMONDS_SEGMENT_NAME, DDD_CTPPS_PIXELS_RP_NAME, DDD_CTPPS_PIXELS_SENSOR_NAME, DDD_CTPPS_UFSD_SEGMENT_NAME, DDD_TOTEM_RP_RP_NAME, DDD_TOTEM_RP_SENSOR_NAME, DDD_TOTEM_TIMING_RP_NAME, DDD_TOTEM_TIMING_SENSOR_TMPL, hgcalTestNeighbor_cfi::detector, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by buildPDetGeomDesc().

Member Data Documentation

◆ compactViewTag_

std::string PPSGeometryBuilder::compactViewTag_
private

Definition at line 58 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ dbservice_

edm::Service<cond::service::PoolDBOutputService> PPSGeometryBuilder::dbservice_
private

Definition at line 60 of file PPSGeometryBuilder.cc.

Referenced by analyze().

◆ watcherIdealGeometry_

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

Definition at line 59 of file PPSGeometryBuilder.cc.

Referenced by analyze().

PPSGeometryBuilder::watcherIdealGeometry_
edm::ESWatcher< IdealGeometryRecord > watcherIdealGeometry_
Definition: PPSGeometryBuilder.cc:59
PPSGeometryBuilder::buildPDetGeomDesc
void buildPDetGeomDesc(DDFilteredView *, PDetGeomDesc *)
Definition: PPSGeometryBuilder.cc:96
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
DDD_CTPPS_UFSD_SEGMENT_NAME
const std::string DDD_CTPPS_UFSD_SEGMENT_NAME
Definition: CTPPSDDDNames.h:17
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
geometryCSVtoXML.yz
yz
Definition: geometryCSVtoXML.py:19
DDD_CTPPS_PIXELS_SENSOR_NAME
const std::string DDD_CTPPS_PIXELS_SENSOR_NAME
Definition: CTPPSDDDNames.h:14
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:177
PPSGeometryBuilder::compactViewTag_
std::string compactViewTag_
Definition: PPSGeometryBuilder.cc:58
PDetGeomDesc::Item
Definition: PDetGeomDesc.h:14
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
DDFilteredView::copyNumbers
nav_type copyNumbers() const
return the stack of copy numbers
Definition: DDFilteredView.cc:193
DDD_CTPPS_PIXELS_RP_NAME
const std::string DDD_CTPPS_PIXELS_RP_NAME
Definition: CTPPSDDDNames.h:22
DDD_TOTEM_TIMING_RP_NAME
const std::string DDD_TOTEM_TIMING_RP_NAME
Definition: CTPPSDDDNames.h:25
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2
const std::string DDD_CTPPS_PIXELS_SENSOR_TYPE_2x2
Definition: CTPPSDDDNames.h:15
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DDD_CTPPS_DIAMONDS_SEGMENT_NAME
const std::string DDD_CTPPS_DIAMONDS_SEGMENT_NAME
Definition: CTPPSDDDNames.h:16
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DDBase::name
const N & name() const
Definition: DDBase.h:59
edm::ESHandle
Definition: DTSurvey.h:22
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
PDetGeomDesc::container_
std::vector< Item > container_
Definition: PDetGeomDesc.h:29
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
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
CTPPSDiamondDetId
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: CTPPSDiamondDetId.h:24
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
DDD_CTPPS_DIAMONDS_RP_NAME
const std::string DDD_CTPPS_DIAMONDS_RP_NAME
Definition: CTPPSDDDNames.h:24
geometryCSVtoXML.xz
xz
Definition: geometryCSVtoXML.py:19
DDD_TOTEM_TIMING_SENSOR_TMPL
const std::string DDD_TOTEM_TIMING_SENSOR_TMPL
Definition: CTPPSDDDNames.h:18
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
DDD_TOTEM_RP_RP_NAME
const std::string DDD_TOTEM_RP_RP_NAME
DDD names of RP volumes.
Definition: CTPPSDDDNames.h:21
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
CTPPSPixelDetId
Definition: CTPPSPixelDetId.h:16
PDetGeomDesc
Definition: PDetGeomDesc.h:9
get
#define get
PPSGeometryBuilder::dbservice_
edm::Service< cond::service::PoolDBOutputService > dbservice_
Definition: PPSGeometryBuilder.cc:60
DDPassAllFilter
A DDFilter that always returns true.
Definition: DDFilter.h:26
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
Exception
Definition: hltDiff.cc:246
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:56
DDD_TOTEM_RP_SENSOR_NAME
const std::string DDD_TOTEM_RP_SENSOR_NAME
DDD names of sensors.
Definition: CTPPSDDDNames.h:13
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
PPSGeometryBuilder::getGeographicalID
uint32_t getGeographicalID(DDFilteredView *)
Definition: PPSGeometryBuilder.cc:154
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
DDFilteredView
Definition: DDFilteredView.h:20
cms::Exception
Definition: Exception.h:70
TotemRPDetId
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:29
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
DDFilteredView::copyno
int copyno() const
Copy number associated with the current node.
Definition: DDFilteredView.cc:48