CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
FWTGeoRecoGeometryESProducer Class Reference

#include <FWTGeoRecoGeometryESProducer.h>

Inheritance diagram for FWTGeoRecoGeometryESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 FWTGeoRecoGeometryESProducer (const edm::ParameterSet &)
 
std::unique_ptr< FWTGeoRecoGeometryproduce (const FWTGeoRecoGeometryRecord &)
 
 ~FWTGeoRecoGeometryESProducer (void) override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Types

enum  ERecoDet {
  kDummy, kSiPixel, kSiStrip, kMuonDT,
  kMuonRPC, kMuonCSC, kMuonGEM, kMuonME0,
  kECal, kHCal, kCaloTower, kHGCE,
  kHGCH
}
 

Private Member Functions

void addCaloTowerGeometry ()
 
void addCSCGeometry ()
 
void addDTGeometry ()
 
void addEcalCaloGeometry ()
 
void addGEMGeometry ()
 
void addHcalCaloGeometryBarrel ()
 
void addHcalCaloGeometryEndcap ()
 
void addHcalCaloGeometryForward ()
 
void addHcalCaloGeometryOuter ()
 
void addME0Geometry ()
 
void addPixelBarrelGeometry ()
 
void addPixelForwardGeometry ()
 
void addRPCGeometry ()
 
void addTECGeometry ()
 
void addTIBGeometry ()
 
void addTIDGeometry ()
 
void addTOBGeometry ()
 
TGeoManager * createManager (int level)
 
TGeoShape * createShape (const GeomDet *det)
 
TGeoVolume * createVolume (const std::string &name, const GeomDet *det, ERecoDet=kDummy)
 
 FWTGeoRecoGeometryESProducer (const FWTGeoRecoGeometryESProducer &)
 
TGeoVolume * GetDaughter (TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
 
TGeoVolume * GetDaughter (TGeoVolume *mother, const char *prefix, ERecoDet cidx)
 
TGeoMedium * GetMedium (ERecoDet)
 
TGeoVolume * GetTopHolder (const char *prefix, ERecoDet cidx)
 
const FWTGeoRecoGeometryESProduceroperator= (const FWTGeoRecoGeometryESProducer &)
 

Private Attributes

bool m_calo
 
const CaloGeometrym_caloGeom = nullptr
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordm_caloGeomToken
 
TGeoMedium * m_dummyMedium = nullptr
 
bool m_gem
 
bool m_muon
 
std::map< std::string, TGeoShape * > m_nameToShape
 
std::map< ERecoDet, TGeoMedium * > m_recoMedium
 
std::map< TGeoShape *, TGeoVolume * > m_shapeToVolume
 
bool m_tracker
 
const TrackerGeometrym_trackerGeom = nullptr
 
const TrackerTopologym_trackerTopology = nullptr
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdm_trackerTopologyToken
 
const GlobalTrackingGeometrym_trackingGeom = nullptr
 
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordm_trackingGeomToken
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 31 of file FWTGeoRecoGeometryESProducer.h.

Member Enumeration Documentation

◆ ERecoDet

Constructor & Destructor Documentation

◆ FWTGeoRecoGeometryESProducer() [1/2]

FWTGeoRecoGeometryESProducer::FWTGeoRecoGeometryESProducer ( const edm::ParameterSet pset)

Definition at line 63 of file FWTGeoRecoGeometryESProducer.cc.

References m_calo, m_caloGeomToken, m_gem, m_muon, m_tracker, m_trackerTopologyToken, m_trackingGeomToken, muonDTDigis_cfi::pset, and edm::ESProducer::setWhatProduced().

63  : m_dummyMedium(nullptr) {
64  m_tracker = pset.getUntrackedParameter<bool>("Tracker", true);
65  m_muon = pset.getUntrackedParameter<bool>("Muon", true);
66  m_gem = pset.getUntrackedParameter<bool>("GEM", false);
67  m_calo = pset.getUntrackedParameter<bool>("Calo", true);
68 
69  if (m_muon)
70  m_gem = true;
71 
72  auto cc = setWhatProduced(this);
73  if (m_tracker || m_muon || m_gem) {
74  m_trackingGeomToken = cc.consumes();
75  }
76  if (m_tracker) {
77  m_trackerTopologyToken = cc.consumes();
78  }
79  if (m_calo) {
80  m_caloGeomToken = cc.consumes();
81  }
82 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_trackingGeomToken
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_trackerTopologyToken
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_caloGeomToken

◆ ~FWTGeoRecoGeometryESProducer()

FWTGeoRecoGeometryESProducer::~FWTGeoRecoGeometryESProducer ( void  )
override

Definition at line 84 of file FWTGeoRecoGeometryESProducer.cc.

84 {}

◆ FWTGeoRecoGeometryESProducer() [2/2]

FWTGeoRecoGeometryESProducer::FWTGeoRecoGeometryESProducer ( const FWTGeoRecoGeometryESProducer )
private

Member Function Documentation

◆ addCaloTowerGeometry()

void FWTGeoRecoGeometryESProducer::addCaloTowerGeometry ( )
private

Definition at line 1074 of file FWTGeoRecoGeometryESProducer.cc.

References c, DetId::Calo, PVValHelper::dz, mps_fire::end, CaloCellGeometry::etaPos(), CaloCellGeometry::getCorners(), GetDaughter(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), CaloTowerDetId::ieta(), kCaloTower, IdealObliquePrism::localCorners(), m_caloGeom, CaloCellGeometry::param(), CaloCellGeometry::phiPos(), hiPixelPairStep_cff::points, makeMuonMisalignmentScenario::rot, CaloTowerDetId::SubdetId, and CaloTowerDetId::zside().

Referenced by produce().

1074  {
1075  CaloVolMap caloShapeMapP;
1076  CaloVolMap caloShapeMapN;
1077 
1078  TGeoVolume* tv = GetTopHolder("CaloTower", kCaloTower);
1079  TGeoVolume* assembly = GetDaughter(tv, "CaloTower", kCaloTower);
1080 
1082  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
1083  CaloTowerDetId detid = CaloTowerDetId(it->rawId());
1084  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
1085  const IdealObliquePrism* cell = dynamic_cast<const IdealObliquePrism*>(cellb);
1086  if (!cell) {
1087  printf("EC not oblique \n");
1088  continue;
1089  }
1090  TGeoVolume* volume = nullptr;
1091  CaloVolMap& caloShapeMap = (cell->etaPos() > 0) ? caloShapeMapP : caloShapeMapN;
1092  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
1093  if (volIt == caloShapeMap.end()) {
1096  IdealObliquePrism::localCorners(lc, cell->param(), ref);
1097  HepGeom::Vector3D<float> lCenter;
1098  for (int c = 0; c < 8; ++c)
1099  lCenter += lc[c];
1100  lCenter *= 0.125;
1101 
1102  static const int arrP[] = {3, 2, 1, 0, 7, 6, 5, 4};
1103  static const int arrN[] = {7, 6, 5, 4, 3, 2, 1, 0};
1104  const int* arr = (detid.ieta() > 0) ? &arrP[0] : &arrN[0];
1105 
1106  double points[16];
1107  for (int c = 0; c < 8; ++c) {
1108  points[c * 2 + 0] = lc[arr[c]].x() - lCenter.x();
1109  points[c * 2 + 1] = lc[arr[c]].y() - lCenter.y();
1110  }
1111 
1112  float dz = (lc[4].z() - lc[0].z()) * 0.5;
1113  TGeoShape* solid = new TGeoArb8(dz, &points[0]);
1114  volume = new TGeoVolume("ecal oblique prism", solid, GetMedium(kCaloTower));
1115  caloShapeMap[cell->param()] = volume;
1116  } else {
1117  volume = volIt->second;
1118  }
1119 
1120  HepGeom::Vector3D<float> gCenter;
1121  CaloCellGeometry::CornersVec const& gc = cell->getCorners();
1122  for (int c = 0; c < 8; ++c) {
1123  gCenter += HepGeom::Vector3D<float>(gc[c].x(), gc[c].y(), gc[c].z());
1124  }
1125  gCenter *= 0.125;
1126 
1127  TGeoTranslation gtr(gCenter.x(), gCenter.y(), gCenter.z());
1128  TGeoRotation rot;
1129  rot.SetAngles(cell->phiPos() * TMath::RadToDeg(), 0, 0);
1130 
1131  TGeoVolume* holder = GetDaughter(assembly, "side", kCaloTower, detid.zside());
1132  holder = GetDaughter(holder, "ieta", kCaloTower, detid.ieta());
1133  std::stringstream nname;
1134  nname << detid;
1135  AddLeafNode(holder, volume, nname.str().c_str(), new TGeoCombiTrans(gtr, rot));
1136  }
1137 }
virtual float phiPos() const
virtual float etaPos() const
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
static const int SubdetId
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
int ieta() const
get the tower ieta
int zside() const
get the z-side of the tower (1/-1)
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const
CaloCellGeometry::Pt3DVec Pt3DVec

◆ addCSCGeometry()

void FWTGeoRecoGeometryESProducer::addCSCGeometry ( )
private

Definition at line 635 of file FWTGeoRecoGeometryESProducer.cc.

References relativeConstraints::chamber, dd4hep::createPlacement(), createVolume(), TrackingGeometry::dets(), GetDaughter(), GetTopHolder(), kMuonCSC, kMuonRPC, phase1PixelTopology::layer, m_trackingGeom, Skims_PA_cff::name, alignCSCRings::s, GlobalTrackingGeometry::slaveGeometry(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

635  {
637  throw cms::Exception("FatalError") << "Cannnot find CSCGeometry\n";
638 
639  TGeoVolume* tv = GetTopHolder("Muon", kMuonRPC);
640  TGeoVolume* assembly = GetDaughter(tv, "CSC", kMuonCSC);
641 
642  auto const& cscGeom = m_trackingGeom->slaveGeometry(CSCDetId())->dets();
643  for (auto it = cscGeom.begin(), itEnd = cscGeom.end(); it != itEnd; ++it) {
644  unsigned int rawid = (*it)->geographicalId();
645  CSCDetId detId(rawid);
646  std::stringstream s;
647  s << "CSC" << detId;
648  std::string name = s.str();
649 
650  TGeoVolume* child = nullptr;
651 
652  if (auto chamber = dynamic_cast<const CSCChamber*>(*it))
654  else if (auto* layer = dynamic_cast<const CSCLayer*>(*it))
656 
657  if (child) {
658  TGeoVolume* holder = GetDaughter(assembly, "Endcap", kMuonCSC, detId.endcap());
659  holder = GetDaughter(holder, "Station", kMuonCSC, detId.station());
660  holder = GetDaughter(holder, "Ring", kMuonCSC, detId.ring());
661  holder = GetDaughter(holder, "Chamber", kMuonCSC, detId.chamber());
662 
663  // holder->AddNode(child, 1, createPlacement( *it ));
664  AddLeafNode(holder, child, name.c_str(), createPlacement(*it));
665  }
666  }
667 }
const GlobalTrackingGeometry * m_trackingGeom
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
constexpr std::array< uint8_t, layerIndexSize > layer
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
virtual const DetContainer & dets() const =0
Returm a vector of all GeomDet (including all GeomDetUnits)
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addDTGeometry()

void FWTGeoRecoGeometryESProducer::addDTGeometry ( )
private

Definition at line 561 of file FWTGeoRecoGeometryESProducer.cc.

References relativeConstraints::chamber, dd4hep::createPlacement(), createVolume(), TrackingGeometry::dets(), mps_fire::end, GetDaughter(), GetTopHolder(), kMuonDT, kMuonRPC, phase1PixelTopology::layer, m_trackingGeom, Skims_PA_cff::name, alignCSCRings::s, GlobalTrackingGeometry::slaveGeometry(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

561  {
562  TGeoVolume* tv = GetTopHolder("Muon", kMuonRPC);
563  TGeoVolume* assemblyTop = GetDaughter(tv, "DT", kMuonDT);
564 
565  //
566  // DT chambers geometry
567  //
568  {
569  TGeoVolume* assembly = GetDaughter(assemblyTop, "DTChamber", kMuonDT);
570  auto const& dtChamberGeom = m_trackingGeom->slaveGeometry(DTChamberId())->dets();
571  for (auto it = dtChamberGeom.begin(), end = dtChamberGeom.end(); it != end; ++it) {
572  if (auto chamber = dynamic_cast<const DTChamber*>(*it)) {
573  DTChamberId detid = chamber->geographicalId();
574  std::stringstream s;
575  s << detid;
576  std::string name = s.str();
577 
578  TGeoVolume* child = createVolume(name, chamber, kMuonDT);
579  TGeoVolume* holder = GetDaughter(assembly, "Wheel", kMuonDT, detid.wheel());
580  holder = GetDaughter(holder, "Station", kMuonDT, detid.station());
581  holder = GetDaughter(holder, "Sector", kMuonDT, detid.sector());
582 
583  AddLeafNode(holder, child, name.c_str(), createPlacement(chamber));
584  }
585  }
586  }
587 
588  // Fill in DT super layer parameters
589  {
590  TGeoVolume* assembly = GetDaughter(assemblyTop, "DTSuperLayer", kMuonDT);
591  auto const& dtSuperLayerGeom = m_trackingGeom->slaveGeometry(DTSuperLayerId())->dets();
592  for (auto it = dtSuperLayerGeom.begin(), end = dtSuperLayerGeom.end(); it != end; ++it) {
593  if (auto* superlayer = dynamic_cast<const DTSuperLayer*>(*it)) {
594  DTSuperLayerId detid(DetId(superlayer->geographicalId()));
595  std::stringstream s;
596  s << detid;
597  std::string name = s.str();
598 
599  TGeoVolume* child = createVolume(name, superlayer, kMuonDT);
600 
601  TGeoVolume* holder = GetDaughter(assembly, "Wheel", kMuonDT, detid.wheel());
602  holder = GetDaughter(holder, "Station", kMuonDT, detid.station());
603  holder = GetDaughter(holder, "Sector", kMuonDT, detid.sector());
604  holder = GetDaughter(holder, "SuperLayer", kMuonDT, detid.superlayer());
605  AddLeafNode(holder, child, name.c_str(), createPlacement(superlayer));
606  }
607  }
608  }
609  // Fill in DT layer parameters
610  {
611  TGeoVolume* assembly = GetDaughter(assemblyTop, "DTLayer", kMuonDT);
612  auto const& dtLayerGeom = m_trackingGeom->slaveGeometry(DTLayerId())->dets();
613  for (auto it = dtLayerGeom.begin(), end = dtLayerGeom.end(); it != end; ++it) {
614  if (auto layer = dynamic_cast<const DTLayer*>(*it)) {
615  DTLayerId detid(DetId(layer->geographicalId()));
616 
617  std::stringstream s;
618  s << detid;
619  std::string name = s.str();
620 
621  TGeoVolume* child = createVolume(name, layer, kMuonDT);
622 
623  TGeoVolume* holder = GetDaughter(assembly, "Wheel", kMuonDT, detid.wheel());
624  holder = GetDaughter(holder, "Station", kMuonDT, detid.station());
625  holder = GetDaughter(holder, "Sector", kMuonDT, detid.sector());
626  holder = GetDaughter(holder, "SuperLayer", kMuonDT, detid.superlayer());
627  holder = GetDaughter(holder, "Layer", kMuonDT, detid.layer());
628  AddLeafNode(holder, child, name.c_str(), createPlacement(layer));
629  }
630  }
631  }
632 }
const GlobalTrackingGeometry * m_trackingGeom
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
constexpr std::array< uint8_t, layerIndexSize > layer
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
virtual const DetContainer & dets() const =0
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addEcalCaloGeometry()

void FWTGeoRecoGeometryESProducer::addEcalCaloGeometry ( void  )
private

Definition at line 1201 of file FWTGeoRecoGeometryESProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, mps_fire::end, CaloCellGeometry::getCorners(), GetDaughter(), getEcalTrans(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), EBDetId::ieta(), EEDetId::ix(), kECal, m_caloGeom, makeEcalShape(), CaloCellGeometry::param(), EBDetId::zside(), and EEDetId::zside().

Referenced by produce().

1201  {
1202  TGeoVolume* tv = GetTopHolder("ECal", kECal);
1203  CaloVolMap caloShapeMap;
1204 
1205  {
1206  TGeoVolume* assembly = GetDaughter(tv, "ECalBarrel", kECal);
1207 
1209  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
1210  EBDetId detid(*it);
1211  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
1212  const TruncatedPyramid* cell = dynamic_cast<const TruncatedPyramid*>(cellb);
1213  if (!cell) {
1214  printf("ecalBarrel cell not a TruncatedPyramid !!\n");
1215  return;
1216  }
1217 
1218  TGeoVolume* volume = nullptr;
1219  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
1220  if (volIt == caloShapeMap.end()) {
1221  volume = new TGeoVolume("EE TruncatedPyramid", makeEcalShape(cell), GetMedium(kECal));
1222  caloShapeMap[cell->param()] = volume;
1223  } else {
1224  volume = volIt->second;
1225  }
1226  TGeoHMatrix* mtx = getEcalTrans(cell->getCorners());
1227  TGeoVolume* holder = GetDaughter(assembly, "side", kECal, detid.zside());
1228  holder = GetDaughter(holder, "ieta", kECal, detid.ieta());
1229  std::stringstream nname;
1230  nname << detid;
1231  AddLeafNode(holder, volume, nname.str().c_str(), mtx);
1232  }
1233  }
1234 
1235  {
1236  TGeoVolume* assembly = GetDaughter(tv, "ECalEndcap", kECal);
1237 
1239  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
1240  EEDetId detid(*it);
1241  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
1242  const TruncatedPyramid* cell = dynamic_cast<const TruncatedPyramid*>(cellb);
1243  if (!cell) {
1244  printf("ecalEndcap cell not a TruncatedPyramid !!\n");
1245  continue;
1246  }
1247 
1248  TGeoVolume* volume = nullptr;
1249  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
1250  if (volIt == caloShapeMap.end()) {
1251  volume = new TGeoVolume("EE TruncatedPyramid", makeEcalShape(cell), GetMedium(kECal));
1252  caloShapeMap[cell->param()] = volume;
1253  } else {
1254  volume = volIt->second;
1255  }
1256  TGeoHMatrix* mtx = getEcalTrans(cell->getCorners());
1257  TGeoVolume* holder = GetDaughter(assembly, "side", kECal, detid.zside());
1258  holder = GetDaughter(holder, "ix", kECal, detid.ix());
1259  std::stringstream nname;
1260  nname << detid;
1261  AddLeafNode(holder, volume, nname.str().c_str(), mtx);
1262  }
1263  }
1264 }
TGeoHMatrix * getEcalTrans(CaloCellGeometry::CornersVec const &gc)
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoShape * makeEcalShape(const TruncatedPyramid *cell)
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const

◆ addGEMGeometry()

void FWTGeoRecoGeometryESProducer::addGEMGeometry ( )
private

Definition at line 671 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), mps_fire::end, GEMGeometry::etaPartitions(), cppFunctionSkipper::exception, MuonSubdetId::GEM, GeomDet::geographicalId(), GetDaughter(), GetTopHolder(), kMuonGEM, kMuonRPC, m_trackingGeom, DetId::Muon, Skims_PA_cff::name, alignCSCRings::s, GlobalTrackingGeometry::slaveGeometry(), AlCaHLTBitMon_QueryRunRegistry::string, and GEMGeometry::superChambers().

Referenced by produce().

671  {
672  try {
674  const GEMGeometry* gemGeom = static_cast<const GEMGeometry*>(m_trackingGeom->slaveGeometry(detId));
675 
676  TGeoVolume* tv = GetTopHolder("Muon", kMuonRPC);
677  TGeoVolume* assemblyTop = GetDaughter(tv, "GEM", kMuonGEM);
678 
679  {
680  TGeoVolume* assembly = GetDaughter(assemblyTop, "GEMSuperChambers", kMuonGEM);
681  for (auto it = gemGeom->superChambers().begin(), end = gemGeom->superChambers().end(); it != end; ++it) {
682  const GEMSuperChamber* sc = (*it);
683  if (sc) {
684  GEMDetId detid = sc->geographicalId();
685  std::stringstream s;
686  s << detid;
687  std::string name = s.str();
688 
689  TGeoVolume* child = createVolume(name, sc, kMuonGEM);
690 
691  TGeoVolume* holder = GetDaughter(assembly, "SuperChamber Region", kMuonGEM, detid.region());
692  holder = GetDaughter(holder, "Ring", kMuonGEM, detid.ring());
693  holder = GetDaughter(holder, "Station", kMuonGEM, detid.station());
694  holder = GetDaughter(holder, "Chamber", kMuonGEM, detid.chamber());
695 
696  AddLeafNode(holder, child, name.c_str(), createPlacement(*it));
697  }
698  }
699  }
700 
701  {
702  TGeoVolume* assembly = GetDaughter(assemblyTop, "GEMetaPartitions", kMuonGEM);
703  for (auto it = gemGeom->etaPartitions().begin(), end = gemGeom->etaPartitions().end(); it != end; ++it) {
704  const GEMEtaPartition* roll = (*it);
705  if (roll) {
706  GEMDetId detid = roll->geographicalId();
707  std::stringstream s;
708  s << detid;
709  std::string name = s.str();
710 
711  TGeoVolume* child = createVolume(name, roll, kMuonGEM);
712 
713  TGeoVolume* holder = GetDaughter(assembly, "ROLL Region", kMuonGEM, detid.region());
714  holder = GetDaughter(holder, "Ring", kMuonGEM, detid.ring());
715  holder = GetDaughter(holder, "Station", kMuonGEM, detid.station());
716  holder = GetDaughter(holder, "Layer", kMuonGEM, detid.layer());
717  holder = GetDaughter(holder, "Chamber", kMuonGEM, detid.chamber());
718 
719  AddLeafNode(holder, child, name.c_str(), createPlacement(*it));
720  }
721  }
722  }
723  } catch (cms::Exception& exception) {
724  edm::LogInfo("FWRecoGeometry") << "failed to produce GEM geometry " << exception.what() << std::endl;
725  }
726 }
const GlobalTrackingGeometry * m_trackingGeom
static constexpr int GEM
Definition: MuonSubdetId.h:14
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Log< level::Info, false > LogInfo
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
Definition: GEMGeometry.cc:36
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40

◆ addHcalCaloGeometryBarrel()

void FWTGeoRecoGeometryESProducer::addHcalCaloGeometryBarrel ( void  )
private

Definition at line 792 of file FWTGeoRecoGeometryESProducer.cc.

References c, PVValHelper::dz, mps_fire::end, CaloCellGeometry::etaPos(), CaloCellGeometry::getCorners(), GetDaughter(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), DetId::Hcal, HcalBarrel, HcalDetId::ieta(), kHCal, IdealObliquePrism::localCorners(), m_caloGeom, CaloCellGeometry::param(), CaloCellGeometry::phiPos(), hiPixelPairStep_cff::points, makeMuonMisalignmentScenario::rot, x, y, z, and HcalDetId::zside().

Referenced by produce().

792  {
793  TGeoVolume* tv = GetTopHolder("HCal", kHCal);
794  TGeoVolume* assembly = GetDaughter(tv, "HCalBarrel", kHCal);
795 
797 
798  CaloVolMap caloShapeMapP;
799  CaloVolMap caloShapeMapN;
800  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
801  //HcalDetId detid = HcalDetId(it->rawId());
802  HcalDetId detid(*it);
803  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
804  const IdealObliquePrism* cell = dynamic_cast<const IdealObliquePrism*>(cellb);
805 
806  if (!cell) {
807  printf("HB not oblique !!!\n");
808  continue;
809  }
810 
811  TGeoVolume* volume = nullptr;
812  CaloVolMap& caloShapeMap = (cell->etaPos() > 0) ? caloShapeMapP : caloShapeMapN;
813  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
814  if (volIt == caloShapeMap.end()) {
815  // printf("FIREWORKS NEW SHAPE BEGIN eta = %f etaPos = %f, phiPos %f >>>>>> \n", cell->eta(), cell->etaPos(), cell->phiPos());
818  IdealObliquePrism::localCorners(lc, cell->param(), ref);
819  HepGeom::Vector3D<float> lCenter;
820  for (int c = 0; c < 8; ++c)
821  lCenter += lc[c];
822  lCenter *= 0.125;
823 
824  static const int arr[] = {1, 0, 3, 2, 5, 4, 7, 6};
825  double points[16];
826  for (int c = 0; c < 8; ++c) {
827  if (cell->etaPos() > 0)
828  points[c * 2 + 0] = -(lc[arr[c]].z() - lCenter.z());
829  else
830  points[c * 2 + 0] = (lc[arr[c]].z() - lCenter.z());
831  points[c * 2 + 1] = (lc[arr[c]].y() - lCenter.y());
832  // printf("AMT xy[%d] <=>[%d] = (%.4f, %.4f) \n", arr[c], c, points[c*2], points[c*2+1]);
833  }
834 
835  float dz = (lc[4].x() - lc[0].x()) * 0.5;
836  TGeoShape* solid = new TGeoArb8(dz, &points[0]);
837  volume = new TGeoVolume("hcal oblique prism", solid, GetMedium(kHCal));
838  caloShapeMap[cell->param()] = volume;
839  } else {
840  volume = volIt->second;
841  }
842 
843  HepGeom::Vector3D<float> gCenter;
844  CaloCellGeometry::CornersVec const& gc = cell->getCorners();
845  for (int c = 0; c < 8; ++c)
846  gCenter += HepGeom::Vector3D<float>(gc[c].x(), gc[c].y(), gc[c].z());
847  gCenter *= 0.125;
848 
849  TGeoTranslation gtr(gCenter.x(), gCenter.y(), gCenter.z());
850  TGeoRotation rot;
851  rot.RotateY(90);
852 
853  TGeoRotation rotPhi;
854  rotPhi.SetAngles(0, -cell->phiPos() * TMath::RadToDeg(), 0);
855  rot.MultiplyBy(&rotPhi);
856 
857  TGeoVolume* holder = GetDaughter(assembly, "side", kHCal, detid.zside());
858  holder = GetDaughter(holder, "ieta", kHCal, detid.ieta());
859  std::stringstream nname;
860  nname << detid;
861  AddLeafNode(holder, volume, nname.str().c_str(), new TGeoCombiTrans(gtr, rot));
862  }
863 
864  // printf("HB map size P = %lu , N = %lu", caloShapeMapP.size(),caloShapeMapN.size() );
865 }
virtual float phiPos() const
virtual float etaPos() const
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const
CaloCellGeometry::Pt3DVec Pt3DVec

◆ addHcalCaloGeometryEndcap()

void FWTGeoRecoGeometryESProducer::addHcalCaloGeometryEndcap ( void  )
private

Definition at line 868 of file FWTGeoRecoGeometryESProducer.cc.

References c, PVValHelper::dz, mps_fire::end, CaloCellGeometry::etaPos(), CaloCellGeometry::getCorners(), GetDaughter(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), DetId::Hcal, HcalEndcap, HcalDetId::ieta(), kHCal, IdealObliquePrism::localCorners(), m_caloGeom, CaloCellGeometry::param(), CaloCellGeometry::phiPos(), hiPixelPairStep_cff::points, makeMuonMisalignmentScenario::rot, and HcalDetId::zside().

Referenced by produce().

868  {
869  CaloVolMap caloShapeMapP;
870  CaloVolMap caloShapeMapN;
871 
872  TGeoVolume* tv = GetTopHolder("HCal", kHCal);
873  TGeoVolume* assembly = GetDaughter(tv, "HCalEndcap", kHCal);
874 
876 
877  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
878  HcalDetId detid = HcalDetId(it->rawId());
879  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
880  const IdealObliquePrism* cell = dynamic_cast<const IdealObliquePrism*>(cellb);
881 
882  if (!cell) {
883  printf("EC not oblique \n");
884  continue;
885  }
886 
887  TGeoVolume* volume = nullptr;
888  CaloVolMap& caloShapeMap = (cell->etaPos() > 0) ? caloShapeMapP : caloShapeMapN;
889  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
890  if (volIt == caloShapeMap.end()) {
893  IdealObliquePrism::localCorners(lc, cell->param(), ref);
894  HepGeom::Vector3D<float> lCenter;
895  for (int c = 0; c < 8; ++c)
896  lCenter += lc[c];
897  lCenter *= 0.125;
898 
899  //for( int c = 0; c < 8; ++c)
900  // printf("lc.push_back(TEveVector(%.4f, %.4f, %.4f));\n", lc[c].x(), lc[c].y(), lc[c].z() );
901 
902  static const int arrP[] = {3, 2, 1, 0, 7, 6, 5, 4};
903  static const int arrN[] = {7, 6, 5, 4, 3, 2, 1, 0};
904  const int* arr = (detid.ieta() > 0) ? &arrP[0] : &arrN[0];
905 
906  double points[16];
907  for (int c = 0; c < 8; ++c) {
908  points[c * 2 + 0] = lc[arr[c]].x() - lCenter.x();
909  points[c * 2 + 1] = lc[arr[c]].y() - lCenter.y();
910  }
911 
912  float dz = (lc[4].z() - lc[0].z()) * 0.5;
913  TGeoShape* solid = new TGeoArb8(dz, &points[0]);
914  volume = new TGeoVolume("ecal oblique prism", solid, GetMedium(kHCal));
915  caloShapeMap[cell->param()] = volume;
916  } else {
917  volume = volIt->second;
918  }
919 
920  HepGeom::Vector3D<float> gCenter;
921  CaloCellGeometry::CornersVec const& gc = cell->getCorners();
922  for (int c = 0; c < 8; ++c) {
923  gCenter += HepGeom::Vector3D<float>(gc[c].x(), gc[c].y(), gc[c].z());
924  // printf("gc.push_back(TEveVector(%.4f, %.4f, %.4f));\n", gc[c].x(), gc[c].y(),gc[c].z() );
925  }
926  gCenter *= 0.125;
927 
928  TGeoTranslation gtr(gCenter.x(), gCenter.y(), gCenter.z());
929  TGeoRotation rot;
930  rot.SetAngles(cell->phiPos() * TMath::RadToDeg(), 0, 0);
931 
932  TGeoVolume* holder = GetDaughter(assembly, "side", kHCal, detid.zside());
933  holder = GetDaughter(holder, "ieta", kHCal, detid.ieta());
934  std::stringstream nname;
935  nname << detid;
936  AddLeafNode(holder, volume, nname.str().c_str(), new TGeoCombiTrans(gtr, rot));
937  }
938 
939  // printf("HE map size P = %lu , N = %lu", caloShapeMapP.size(),caloShapeMapN.size() );
940 }
virtual float phiPos() const
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
virtual float etaPos() const
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const
CaloCellGeometry::Pt3DVec Pt3DVec

◆ addHcalCaloGeometryForward()

void FWTGeoRecoGeometryESProducer::addHcalCaloGeometryForward ( )
private

Definition at line 1008 of file FWTGeoRecoGeometryESProducer.cc.

References c, PVValHelper::dz, mps_fire::end, CaloCellGeometry::etaPos(), CaloCellGeometry::getCorners(), GetDaughter(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), DetId::Hcal, HcalForward, HcalDetId::ieta(), kHCal, IdealZPrism::localCorners(), m_caloGeom, CaloCellGeometry::param(), CaloCellGeometry::phiPos(), hiPixelPairStep_cff::points, makeMuonMisalignmentScenario::rot, and HcalDetId::zside().

Referenced by produce().

1008  {
1009  CaloVolMap caloShapeMapP;
1010  CaloVolMap caloShapeMapN;
1011 
1012  TGeoVolume* tv = GetTopHolder("HCal", kHCal);
1013  TGeoVolume* assembly = GetDaughter(tv, "HCalForward", kHCal);
1014 
1016 
1017  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
1018  HcalDetId detid = HcalDetId(it->rawId());
1019  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
1020  const IdealZPrism* cell = dynamic_cast<const IdealZPrism*>(cellb);
1021 
1022  if (!cell) {
1023  printf("EC not Z prism \n");
1024  continue;
1025  }
1026 
1027  TGeoVolume* volume = nullptr;
1028  CaloVolMap& caloShapeMap = (cell->etaPos() > 0) ? caloShapeMapP : caloShapeMapN;
1029  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
1030  if (volIt == caloShapeMap.end()) {
1031  IdealZPrism::Pt3DVec lc(8);
1032  IdealZPrism::Pt3D ref;
1033  IdealZPrism::localCorners(lc, cell->param(), ref);
1034  HepGeom::Vector3D<float> lCenter;
1035  for (int c = 0; c < 8; ++c)
1036  lCenter += lc[c];
1037  lCenter *= 0.125;
1038  static const int arrP[] = {3, 2, 1, 0, 7, 6, 5, 4};
1039  static const int arrN[] = {7, 6, 5, 4, 3, 2, 1, 0};
1040  const int* arr = (detid.ieta() > 0) ? &arrP[0] : &arrN[0];
1041 
1042  double points[16];
1043  for (int c = 0; c < 8; ++c) {
1044  points[c * 2 + 0] = lc[arr[c]].x() - lCenter.x();
1045  points[c * 2 + 1] = lc[arr[c]].y() - lCenter.y();
1046  }
1047 
1048  float dz = (lc[4].z() - lc[0].z()) * 0.5;
1049  TGeoShape* solid = new TGeoArb8(dz, &points[0]);
1050  volume = new TGeoVolume("ecal oblique prism", solid, GetMedium(kHCal));
1051  caloShapeMap[cell->param()] = volume;
1052  } else {
1053  volume = volIt->second;
1054  }
1055  HepGeom::Vector3D<float> gCenter;
1056  CaloCellGeometry::CornersVec const& gc = cell->getCorners();
1057  for (int c = 0; c < 8; ++c) {
1058  gCenter += HepGeom::Vector3D<float>(gc[c].x(), gc[c].y(), gc[c].z());
1059  }
1060  gCenter *= 0.125;
1061 
1062  TGeoTranslation gtr(gCenter.x(), gCenter.y(), gCenter.z());
1063  TGeoRotation rot;
1064  rot.SetAngles(cell->phiPos() * TMath::RadToDeg(), 0, 0);
1065 
1066  TGeoVolume* holder = GetDaughter(assembly, "side", kHCal, detid.zside());
1067  holder = GetDaughter(holder, "ieta", kHCal, detid.ieta());
1068  std::stringstream nname;
1069  nname << detid;
1070  AddLeafNode(holder, volume, nname.str().c_str(), new TGeoCombiTrans(gtr, rot));
1071  }
1072 }
virtual float phiPos() const
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
virtual float etaPos() const
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealZPrism.cc:73
CaloCellGeometry::Pt3D Pt3D
Definition: IdealZPrism.h:31
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: IdealZPrism.h:32
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const

◆ addHcalCaloGeometryOuter()

void FWTGeoRecoGeometryESProducer::addHcalCaloGeometryOuter ( )
private

Definition at line 942 of file FWTGeoRecoGeometryESProducer.cc.

References c, PVValHelper::dz, mps_fire::end, CaloCellGeometry::etaPos(), CaloCellGeometry::getCorners(), GetDaughter(), CaloGeometry::getGeometry(), GetMedium(), GetTopHolder(), CaloGeometry::getValidDetIds(), DetId::Hcal, HcalOuter, HcalDetId::ieta(), kHCal, IdealObliquePrism::localCorners(), m_caloGeom, CaloCellGeometry::param(), CaloCellGeometry::phiPos(), hiPixelPairStep_cff::points, makeMuonMisalignmentScenario::rot, and HcalDetId::zside().

Referenced by produce().

942  {
943  CaloVolMap caloShapeMapP;
944  CaloVolMap caloShapeMapN;
945 
946  TGeoVolume* tv = GetTopHolder("HCal", kHCal);
947  TGeoVolume* assembly = GetDaughter(tv, "HCalOuter", kHCal);
948 
950 
951  for (std::vector<DetId>::const_iterator it = vid.begin(), end = vid.end(); it != end; ++it) {
952  HcalDetId detid = HcalDetId(it->rawId());
953  const CaloCellGeometry* cellb = (m_caloGeom->getGeometry(*it)).get();
954  const IdealObliquePrism* cell = dynamic_cast<const IdealObliquePrism*>(cellb);
955 
956  if (!cell) {
957  printf("EC not oblique \n");
958  continue;
959  }
960 
961  TGeoVolume* volume = nullptr;
962  CaloVolMap& caloShapeMap = (cell->etaPos() > 0) ? caloShapeMapP : caloShapeMapN;
963  CaloVolMap::iterator volIt = caloShapeMap.find(cell->param());
964  if (volIt == caloShapeMap.end()) {
967  IdealObliquePrism::localCorners(lc, cell->param(), ref);
968  HepGeom::Vector3D<float> lCenter;
969  for (int c = 0; c < 8; ++c)
970  lCenter += lc[c];
971  lCenter *= 0.125;
972  static const int arrP[] = {3, 2, 1, 0, 7, 6, 5, 4};
973  static const int arrN[] = {7, 6, 5, 4, 3, 2, 1, 0};
974  const int* arr = (detid.ieta() > 0) ? &arrP[0] : &arrN[0];
975 
976  double points[16];
977  for (int c = 0; c < 8; ++c) {
978  points[c * 2 + 0] = lc[arr[c]].x() - lCenter.x();
979  points[c * 2 + 1] = lc[arr[c]].y() - lCenter.y();
980  }
981 
982  float dz = (lc[4].z() - lc[0].z()) * 0.5;
983  TGeoShape* solid = new TGeoArb8(dz, &points[0]);
984  volume = new TGeoVolume("ecal oblique prism", solid, GetMedium(kHCal));
985  caloShapeMap[cell->param()] = volume;
986  } else {
987  volume = volIt->second;
988  }
989  HepGeom::Vector3D<float> gCenter;
990  CaloCellGeometry::CornersVec const& gc = cell->getCorners();
991  for (int c = 0; c < 8; ++c) {
992  gCenter += HepGeom::Vector3D<float>(gc[c].x(), gc[c].y(), gc[c].z());
993  }
994  gCenter *= 0.125;
995 
996  TGeoTranslation gtr(gCenter.x(), gCenter.y(), gCenter.z());
997  TGeoRotation rot;
998  rot.SetAngles(cell->phiPos() * TMath::RadToDeg(), 0, 0);
999 
1000  TGeoVolume* holder = GetDaughter(assembly, "side", kHCal, detid.zside());
1001  holder = GetDaughter(holder, "ieta", kHCal, detid.ieta());
1002  std::stringstream nname;
1003  nname << detid;
1004  AddLeafNode(holder, volume, nname.str().c_str(), new TGeoCombiTrans(gtr, rot));
1005  }
1006 }
virtual float phiPos() const
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
virtual float etaPos() const
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:60
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const CCGFloat * param() const
CaloCellGeometry::Pt3DVec Pt3DVec

◆ addME0Geometry()

void FWTGeoRecoGeometryESProducer::addME0Geometry ( )
private

Definition at line 758 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), ME0Geometry::etaPartitions(), cppFunctionSkipper::exception, GetDaughter(), GetTopHolder(), kMuonME0, m_trackingGeom, DetId::Muon, Skims_PA_cff::name, alignCSCRings::s, GlobalTrackingGeometry::slaveGeometry(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

758  {
759  TGeoVolume* tv = GetTopHolder("Muon", kMuonME0);
760  TGeoVolume* assembly = GetDaughter(tv, "ME0", kMuonME0);
761 
762  DetId detId(DetId::Muon, 5);
763  try {
764  const ME0Geometry* me0Geom = static_cast<const ME0Geometry*>(m_trackingGeom->slaveGeometry(detId));
765 
766  for (auto roll : me0Geom->etaPartitions()) {
767  if (roll) {
768  unsigned int rawid = roll->geographicalId().rawId();
769  //std::cout << "AMT FWTTTTRecoGeometryES\n" << rawid ;
770 
771  ME0DetId detid(rawid);
772  std::stringstream s;
773  s << detid;
774  std::string name = s.str();
775  TGeoVolume* child = createVolume(name, roll, kMuonME0);
776 
777  TGeoVolume* holder = GetDaughter(assembly, "Region", kMuonME0, detid.region());
778  holder = GetDaughter(holder, "Layer", kMuonME0, detid.layer());
779  holder = GetDaughter(holder, "Chamber", kMuonME0, detid.chamber());
780  AddLeafNode(holder, child, name.c_str(), createPlacement(roll));
781  }
782  }
783  } catch (cms::Exception& exception) {
784  edm::LogInfo("FWRecoGeometry") << "failed to produce ME0 geometry " << exception.what() << std::endl;
785  }
786 }
const GlobalTrackingGeometry * m_trackingGeom
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Log< level::Info, false > LogInfo
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
Definition: ME0Geometry.cc:33
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addPixelBarrelGeometry()

void FWTGeoRecoGeometryESProducer::addPixelBarrelGeometry ( )
private

Definition at line 432 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsPXB(), GetDaughter(), GetTopHolder(), kSiPixel, PVValHelper::ladder, phase1PixelTopology::layer, m_trackerGeom, m_trackerTopology, callgraph::module, Skims_PA_cff::name, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

432  {
433  TGeoVolume* tv = GetTopHolder("SiPixel", kSiPixel);
434  TGeoVolume* assembly = GetDaughter(tv, "PXB", kSiPixel);
435 
436  for (auto it : m_trackerGeom->detsPXB()) {
437  DetId detid = it->geographicalId();
438  unsigned int layer = m_trackerTopology->pxbLayer(detid);
439  unsigned int module = m_trackerTopology->pxbModule(detid);
440  unsigned int ladder = m_trackerTopology->pxbLadder(detid);
441 
442  std::string name = Form("PXB Ly:%d, Md:%d Ld:%d ", layer, module, ladder);
443  TGeoVolume* child = createVolume(name, it, kSiPixel);
444 
445  TGeoVolume* holder = GetDaughter(assembly, "Layer", kSiPixel, layer);
446  holder = GetDaughter(holder, "Module", kSiPixel, module);
447 
448  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
449  }
450 }
unsigned int pxbLayer(const DetId &id) const
const DetContainer & detsPXB() const
unsigned int pxbLadder(const DetId &id) const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
constexpr std::array< uint8_t, layerIndexSize > layer
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
unsigned int pxbModule(const DetId &id) const
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addPixelForwardGeometry()

void FWTGeoRecoGeometryESProducer::addPixelForwardGeometry ( )
private

Definition at line 452 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsPXF(), GetDaughter(), GetTopHolder(), kSiPixel, m_trackerGeom, m_trackerTopology, Skims_PA_cff::name, TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfPanel(), TrackerTopology::side(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

452  {
453  TGeoVolume* tv = GetTopHolder("SiPixel", kSiPixel);
454  TGeoVolume* assembly = GetDaughter(tv, "PXF", kSiPixel);
455 
456  for (auto it : m_trackerGeom->detsPXF()) {
457  DetId detid = it->geographicalId();
458  unsigned int disk = m_trackerTopology->pxfDisk(detid);
459  unsigned int blade = m_trackerTopology->pxfBlade(detid);
460  unsigned int panel = m_trackerTopology->pxfPanel(detid);
461  unsigned int side = m_trackerTopology->side(detid);
462 
463  std::string name = Form("PXF D:%d, B:%d, P:%d, S:%d", disk, blade, panel, side);
464  TGeoVolume* child = createVolume(name, it, kSiPixel);
465 
466  TGeoVolume* holder = GetDaughter(assembly, "Side", kSiPixel, side);
467  holder = GetDaughter(holder, "Disk", kSiPixel, disk);
468  holder = GetDaughter(holder, "Blade", kSiPixel, blade);
469  holder = GetDaughter(holder, "Panel", kSiPixel, panel);
470 
471  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
472  }
473 }
unsigned int pxfBlade(const DetId &id) const
const DetContainer & detsPXF() const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
unsigned int side(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
unsigned int pxfPanel(const DetId &id) const
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addRPCGeometry()

void FWTGeoRecoGeometryESProducer::addRPCGeometry ( )
private

Definition at line 730 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), mps_fire::end, GeomDet::geographicalId(), GetDaughter(), GetTopHolder(), kMuonRPC, m_trackingGeom, DetId::Muon, Skims_PA_cff::name, RPCGeometry::rolls(), MuonSubdetId::RPC, alignCSCRings::s, GlobalTrackingGeometry::slaveGeometry(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

730  {
731  TGeoVolume* tv = GetTopHolder("Muon", kMuonRPC);
732  TGeoVolume* assembly = GetDaughter(tv, "RPC", kMuonRPC);
733 
735  const RPCGeometry* rpcGeom = static_cast<const RPCGeometry*>(m_trackingGeom->slaveGeometry(detId));
736  for (auto it = rpcGeom->rolls().begin(), end = rpcGeom->rolls().end(); it != end; ++it) {
737  RPCRoll const* roll = (*it);
738  if (roll) {
739  RPCDetId detid = roll->geographicalId();
740  std::stringstream s;
741  s << detid;
742  std::string name = s.str();
743 
744  TGeoVolume* child = createVolume(name, roll, kMuonRPC);
745 
746  TGeoVolume* holder = GetDaughter(assembly, "ROLL Region", kMuonRPC, detid.region());
747  holder = GetDaughter(holder, "Ring", kMuonRPC, detid.ring());
748  holder = GetDaughter(holder, "Station", kMuonRPC, detid.station());
749  holder = GetDaughter(holder, "Sector", kMuonRPC, detid.sector());
750  holder = GetDaughter(holder, "Layer", kMuonRPC, detid.layer());
751  holder = GetDaughter(holder, "Subsector", kMuonRPC, detid.subsector());
752 
753  AddLeafNode(holder, child, name.c_str(), createPlacement(*it));
754  }
755  };
756 }
const GlobalTrackingGeometry * m_trackingGeom
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
static constexpr int RPC
Definition: MuonSubdetId.h:13
const std::vector< const RPCRoll * > & rolls() const
Return a vector of all RPC rolls.
Definition: RPCGeometry.cc:44
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addTECGeometry()

void FWTGeoRecoGeometryESProducer::addTECGeometry ( )
private

Definition at line 535 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsTEC(), GetDaughter(), GetTopHolder(), kSiStrip, m_trackerGeom, m_trackerTopology, callgraph::module, Skims_PA_cff::name, eventshapeDQM_cfi::order, TrackerTopology::print(), relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, TrackerTopology::tecModule(), TrackerTopology::tecOrder(), and TrackerTopology::tecRing().

Referenced by produce().

535  {
536  TGeoVolume* tv = GetTopHolder("SiStrip", kSiStrip);
537  TGeoVolume* assembly = GetDaughter(tv, "TEC", kSiStrip);
538 
539  for (auto it : m_trackerGeom->detsTEC()) {
540  DetId detid = it->geographicalId();
541  unsigned int order = m_trackerTopology->tecOrder(detid);
542  unsigned int ring = m_trackerTopology->tecRing(detid);
543  unsigned int module = m_trackerTopology->tecModule(detid);
544 
546 
547  TGeoVolume* child = createVolume(name, it, kSiStrip);
548 
549  TGeoVolume* holder = GetDaughter(assembly, "Order", kSiStrip, order);
550  holder = GetDaughter(holder, "Ring", kSiStrip, ring);
551  holder = GetDaughter(holder, "Module", kSiStrip, module);
552  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
553  }
554 }
std::string print(DetId detid) const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
unsigned int tecRing(const DetId &id) const
ring id
unsigned int tecModule(const DetId &id) const
unsigned int tecOrder(const DetId &id) const
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
const DetContainer & detsTEC() const
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addTIBGeometry()

void FWTGeoRecoGeometryESProducer::addTIBGeometry ( )
private

Definition at line 475 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsTIB(), GetDaughter(), GetTopHolder(), kSiStrip, m_trackerGeom, m_trackerTopology, callgraph::module, Skims_PA_cff::name, eventshapeDQM_cfi::order, TrackerTopology::print(), AlCaHLTBitMon_QueryRunRegistry::string, TrackerTopology::tibModule(), TrackerTopology::tibOrder(), and TrackerTopology::tibSide().

Referenced by produce().

475  {
476  TGeoVolume* tv = GetTopHolder("SiStrip", kSiStrip);
477  TGeoVolume* assembly = GetDaughter(tv, "TIB", kSiStrip);
478 
479  for (auto it : m_trackerGeom->detsTIB()) {
480  DetId detid = it->geographicalId();
481  unsigned int module = m_trackerTopology->tibModule(detid);
482  unsigned int order = m_trackerTopology->tibOrder(detid);
483  unsigned int side = m_trackerTopology->tibSide(detid);
484 
486 
487  TGeoVolume* child = createVolume(name, it, kSiStrip);
488  TGeoVolume* holder = GetDaughter(assembly, "Module", kSiStrip, module);
489  holder = GetDaughter(holder, "Order", kSiStrip, order);
490  holder = GetDaughter(holder, "Side", kSiStrip, side);
491  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
492  }
493 }
const DetContainer & detsTIB() const
unsigned int tibSide(const DetId &id) const
unsigned int tibOrder(const DetId &id) const
unsigned int tibModule(const DetId &id) const
std::string print(DetId detid) const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ addTIDGeometry()

void FWTGeoRecoGeometryESProducer::addTIDGeometry ( )
private

Definition at line 495 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsTID(), GetDaughter(), GetTopHolder(), kSiStrip, m_trackerGeom, m_trackerTopology, Skims_PA_cff::name, TrackerTopology::print(), relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, TrackerTopology::tidRing(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), and makeMuonMisalignmentScenario::wheel.

Referenced by produce().

495  {
496  TGeoVolume* tv = GetTopHolder("SiStrip", kSiStrip);
497  TGeoVolume* assembly = GetDaughter(tv, "TID", kSiStrip);
498 
499  for (auto it : m_trackerGeom->detsTID()) {
500  DetId detid = it->geographicalId();
501  unsigned int side = m_trackerTopology->tidSide(detid);
502  unsigned int wheel = m_trackerTopology->tidWheel(detid);
503  unsigned int ring = m_trackerTopology->tidRing(detid);
504 
506 
507  TGeoVolume* child = createVolume(name, it, kSiStrip);
508  TGeoVolume* holder = GetDaughter(assembly, "Side", kSiStrip, side);
509  holder = GetDaughter(holder, "Wheel", kSiStrip, wheel);
510  holder = GetDaughter(holder, "Ring", kSiStrip, ring);
511  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
512  }
513 }
unsigned int tidSide(const DetId &id) const
std::string print(DetId detid) const
unsigned int tidWheel(const DetId &id) const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
unsigned int tidRing(const DetId &id) const
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)
const DetContainer & detsTID() const

◆ addTOBGeometry()

void FWTGeoRecoGeometryESProducer::addTOBGeometry ( )
private

Definition at line 515 of file FWTGeoRecoGeometryESProducer.cc.

References dd4hep::createPlacement(), createVolume(), TrackerGeometry::detsTOB(), GetDaughter(), GetTopHolder(), kSiStrip, m_trackerGeom, m_trackerTopology, callgraph::module, Skims_PA_cff::name, TrackerTopology::print(), AlCaHLTBitMon_QueryRunRegistry::string, TrackerTopology::tobModule(), TrackerTopology::tobRod(), and TrackerTopology::tobSide().

Referenced by produce().

515  {
516  TGeoVolume* tv = GetTopHolder("SiStrip", kSiStrip);
517  TGeoVolume* assembly = GetDaughter(tv, "TOB", kSiStrip);
518 
519  for (auto it : m_trackerGeom->detsTOB()) {
520  DetId detid = it->geographicalId();
521  unsigned int rod = m_trackerTopology->tobRod(detid);
522  unsigned int side = m_trackerTopology->tobSide(detid);
523  unsigned int module = m_trackerTopology->tobModule(detid);
524 
526 
527  TGeoVolume* child = createVolume(name, it, kSiStrip);
528  TGeoVolume* holder = GetDaughter(assembly, "Rod", kSiStrip, rod);
529  holder = GetDaughter(holder, "Side", kSiStrip, side);
530  holder = GetDaughter(holder, "Module", kSiStrip, module);
531  AddLeafNode(holder, child, name.c_str(), createPlacement(it));
532  }
533 }
unsigned int tobSide(const DetId &id) const
std::string print(DetId detid) const
TGeoCombiTrans * createPlacement(const Rotation3D &iRot, const Position &iTrans)
const DetContainer & detsTOB() const
TGeoVolume * GetDaughter(TGeoVolume *mother, const char *prefix, ERecoDet cidx, int id)
Definition: DetId.h:17
unsigned int tobRod(const DetId &id) const
unsigned int tobModule(const DetId &id) const
TGeoVolume * GetTopHolder(const char *prefix, ERecoDet cidx)
TGeoVolume * createVolume(const std::string &name, const GeomDet *det, ERecoDet=kDummy)

◆ createManager()

TGeoManager* FWTGeoRecoGeometryESProducer::createManager ( int  level)
private

◆ createShape()

TGeoShape * FWTGeoRecoGeometryESProducer::createShape ( const GeomDet det)
private

Create TGeo shape for GeomDet

Definition at line 346 of file FWTGeoRecoGeometryESProducer.cc.

References b, b2, Surface::bounds(), Bounds::length(), m_nameToShape, Skims_PA_cff::name, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, GeomDet::surface(), Bounds::thickness(), Calorimetry_cff::thickness, ApeEstimator_cff::width, and Bounds::width().

Referenced by createVolume().

346  {
347  TGeoShape* shape = nullptr;
348 
349  // Trapezoidal
350  const Bounds* b = &((det->surface()).bounds());
351  const TrapezoidalPlaneBounds* b2 = dynamic_cast<const TrapezoidalPlaneBounds*>(b);
352  if (b2) {
353  std::array<const float, 4> const& par = b2->parameters();
354 
355  // These parameters are half-lengths, as in CMSIM/GEANT3
356  float hBottomEdge = par[0];
357  float hTopEdge = par[1];
358  float thickness = par[2];
359  float apothem = par[3];
360 
361  std::stringstream s;
362  s << "T_" << hBottomEdge << "_" << hTopEdge << "_" << thickness << "_" << apothem;
363  std::string name = s.str();
364 
365  // Do not create identical shape,
366  // if one already exists
367  shape = m_nameToShape[name];
368  if (nullptr == shape) {
369  shape = new TGeoTrap(name.c_str(),
370  thickness, //dz
371  0, //theta
372  0, //phi
373  apothem, //dy1
374  hBottomEdge, //dx1
375  hTopEdge, //dx2
376  0, //alpha1
377  apothem, //dy2
378  hBottomEdge, //dx3
379  hTopEdge, //dx4
380  0); //alpha2
381 
382  m_nameToShape[name] = shape;
383  }
384  }
385  if (dynamic_cast<const RectangularPlaneBounds*>(b) != nullptr) {
386  // Rectangular
387  float length = det->surface().bounds().length();
388  float width = det->surface().bounds().width();
389  float thickness = det->surface().bounds().thickness();
390 
391  std::stringstream s;
392  s << "R_" << width << "_" << length << "_" << thickness;
393  std::string name = s.str();
394 
395  // Do not create identical shape,
396  // if one already exists
397  shape = m_nameToShape[name];
398  if (nullptr == shape) {
399  shape = new TGeoBBox(name.c_str(), width / 2., length / 2., thickness / 2.); // dx, dy, dz
400 
401  m_nameToShape[name] = shape;
402  }
403  }
404 
405  return shape;
406 }
virtual float length() const =0
virtual float thickness() const =0
std::map< std::string, TGeoShape * > m_nameToShape
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
double b
Definition: hdecay.h:118
Definition: Bounds.h:18
static constexpr float b2
virtual float width() const =0
const Bounds & bounds() const
Definition: Surface.h:87

◆ createVolume()

TGeoVolume * FWTGeoRecoGeometryESProducer::createVolume ( const std::string &  name,
const GeomDet det,
ERecoDet  mid = kDummy 
)
private

Create TGeo volume for GeomDet

Definition at line 409 of file FWTGeoRecoGeometryESProducer.cc.

References createShape(), GetMedium(), m_shapeToVolume, and Skims_PA_cff::name.

Referenced by addCSCGeometry(), addDTGeometry(), addGEMGeometry(), addME0Geometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), and addTOBGeometry().

409  {
410  TGeoShape* solid = createShape(det);
411 
412  std::map<TGeoShape*, TGeoVolume*>::iterator vIt = m_shapeToVolume.find(solid);
413  if (vIt != m_shapeToVolume.end())
414  return vIt->second;
415 
416  TGeoVolume* volume = new TGeoVolume(name.c_str(), solid, GetMedium(mid));
417 
418  m_shapeToVolume[solid] = volume;
419 
420  return volume;
421 }
TGeoShape * createShape(const GeomDet *det)
std::map< TGeoShape *, TGeoVolume * > m_shapeToVolume

◆ GetDaughter() [1/2]

TGeoVolume * FWTGeoRecoGeometryESProducer::GetDaughter ( TGeoVolume *  mother,
const char *  prefix,
ERecoDet  cidx,
int  id 
)
private

Definition at line 125 of file FWTGeoRecoGeometryESProducer.cc.

References GetMedium(), dqmiodumpmetadata::n, and hcallasereventfilter2012_cfi::prefix.

Referenced by addCaloTowerGeometry(), addCSCGeometry(), addDTGeometry(), addEcalCaloGeometry(), addGEMGeometry(), addHcalCaloGeometryBarrel(), addHcalCaloGeometryEndcap(), addHcalCaloGeometryForward(), addHcalCaloGeometryOuter(), addME0Geometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), addTOBGeometry(), and GetTopHolder().

125  {
126  TGeoVolume* res = nullptr;
127  if (mother->GetNdaughters()) {
128  TGeoNode* n = mother->FindNode(Form("%s_%d_1", prefix, id));
129  if (n)
130  res = n->GetVolume();
131  }
132 
133  if (!res) {
134  res = new TGeoVolumeAssembly(Form("%s_%d", prefix, id));
135  res->SetMedium(GetMedium(cidx));
136  mother->AddNode(res, 1);
137  }
138 
139  return res;
140 }
Definition: Electron.h:6

◆ GetDaughter() [2/2]

TGeoVolume * FWTGeoRecoGeometryESProducer::GetDaughter ( TGeoVolume *  mother,
const char *  prefix,
ERecoDet  cidx 
)
private

Definition at line 142 of file FWTGeoRecoGeometryESProducer.cc.

References GetMedium(), dqmiodumpmetadata::n, and hcallasereventfilter2012_cfi::prefix.

142  {
143  TGeoVolume* res = nullptr;
144  if (mother->GetNdaughters()) {
145  TGeoNode* n = mother->FindNode(Form("%s_1", prefix));
146  if (n)
147  res = n->GetVolume();
148  }
149 
150  if (!res) {
151  // printf("GetDau... new holder %s for mother %s \n", mother->GetName(), prefix);
152  res = new TGeoVolumeAssembly(prefix);
153  res->SetMedium(GetMedium(cidx));
154  mother->AddNode(res, 1);
155  }
156 
157  return res;
158 }
Definition: Electron.h:6

◆ GetMedium()

TGeoMedium * FWTGeoRecoGeometryESProducer::GetMedium ( ERecoDet  det)
private

Definition at line 185 of file FWTGeoRecoGeometryESProducer.cc.

References kCaloTower, kECal, kHCal, kHGCE, kHGCH, kMuonCSC, kMuonDT, kMuonGEM, kMuonME0, kMuonRPC, kSiPixel, kSiStrip, m_dummyMedium, m_recoMedium, Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and Phase2TrackerMonitorDigi_cff::switch.

Referenced by addCaloTowerGeometry(), addEcalCaloGeometry(), addHcalCaloGeometryBarrel(), addHcalCaloGeometryEndcap(), addHcalCaloGeometryForward(), addHcalCaloGeometryOuter(), createVolume(), and GetDaughter().

185  {
186  std::map<ERecoDet, TGeoMedium*>::iterator it = m_recoMedium.find(det);
187  if (it != m_recoMedium.end())
188  return it->second;
189 
191  int color;
192 
193  switch (det) {
194  // TRACKER
195  case kSiPixel:
196  name = "SiPixel";
197  color = GMCol::Green;
198  break;
199 
200  case kSiStrip:
201  name = "SiStrip";
202  color = GMCol::Gray;
203  break;
204  // MUON
205  case kMuonDT:
206  name = "MuonDT";
207  color = GMCol::Blue2;
208  break;
209 
210  case kMuonRPC:
211  name = "MuonRPC";
212  color = GMCol::Red;
213  break;
214 
215  case kMuonGEM:
216  name = "MuonGEM";
217  color = GMCol::Yellow1;
218  break;
219 
220  case kMuonCSC:
221  name = "MuonCSC";
222  color = GMCol::Gray;
223  break;
224 
225  case kMuonME0:
226  name = "MuonME0";
227  color = GMCol::Yellow0;
228  break;
229 
230  // CALO
231  case kECal:
232  name = "ECal";
233  color = GMCol::Blue2;
234  break;
235  case kHCal:
236  name = "HCal";
237  color = GMCol::Orange1;
238  break;
239  case kCaloTower:
240  name = "CaloTower";
241  color = GMCol::Green;
242  break;
243  case kHGCE:
244  name = "HGCEE";
245  color = GMCol::Blue2;
246  break;
247  case kHGCH:
248  name = "HGCEH";
249  color = GMCol::Blue1;
250  break;
251  default:
252  printf("invalid medium id \n");
253  return m_dummyMedium;
254  }
255 
256  TGeoMaterial* mat = new TGeoMaterial(name.c_str(), 0, 0, 0);
257  mat->SetZ(color);
258  m_recoMedium[det] = new TGeoMedium(name.c_str(), 0, mat);
259  mat->SetFillStyle(3000); // tansparency 3000-3100
260  mat->SetDensity(1); // disable override of transparency in TGeoManager::DefaultColors()
261 
262  return m_recoMedium[det];
263 }
std::map< ERecoDet, TGeoMedium * > m_recoMedium

◆ GetTopHolder()

TGeoVolume * FWTGeoRecoGeometryESProducer::GetTopHolder ( const char *  prefix,
ERecoDet  cidx 
)
private

◆ operator=()

const FWTGeoRecoGeometryESProducer& FWTGeoRecoGeometryESProducer::operator= ( const FWTGeoRecoGeometryESProducer )
private

◆ produce()

std::unique_ptr< FWTGeoRecoGeometry > FWTGeoRecoGeometryESProducer::produce ( const FWTGeoRecoGeometryRecord record)

Definition at line 267 of file FWTGeoRecoGeometryESProducer.cc.

References addCaloTowerGeometry(), addCSCGeometry(), addDTGeometry(), addEcalCaloGeometry(), addGEMGeometry(), addHcalCaloGeometryBarrel(), addHcalCaloGeometryEndcap(), addHcalCaloGeometryForward(), addHcalCaloGeometryOuter(), addME0Geometry(), addPixelBarrelGeometry(), addPixelForwardGeometry(), addRPCGeometry(), addTECGeometry(), addTIBGeometry(), addTIDGeometry(), addTOBGeometry(), relativeConstraints::geom, m_calo, m_caloGeom, m_caloGeomToken, m_dummyMedium, m_gem, m_muon, m_tracker, m_trackerGeom, m_trackerTopology, m_trackerTopologyToken, m_trackingGeom, m_trackingGeomToken, AlCaHarvesting_cff::record, GlobalTrackingGeometry::slaveGeometry(), and DetId::Tracker.

267  {
268  using namespace edm;
269 
270  auto fwTGeoRecoGeometry = std::make_unique<FWTGeoRecoGeometry>();
271 
272  if (m_calo) {
274  }
275 
276  TGeoManager* geom = new TGeoManager("cmsGeo", "CMS Detector");
277  if (nullptr == gGeoIdentity) {
278  gGeoIdentity = new TGeoIdentity("Identity");
279  }
280 
281  fwTGeoRecoGeometry->manager(geom);
282 
283  // Default material is Vacuum
284  TGeoMaterial* vacuum = new TGeoMaterial("Vacuum", 0, 0, 0);
285  m_dummyMedium = new TGeoMedium("reco", 0, vacuum);
286 
287  TGeoVolume* top = geom->MakeBox("CMS", m_dummyMedium, 270., 270., 120.);
288 
289  if (nullptr == top) {
290  return std::unique_ptr<FWTGeoRecoGeometry>();
291  }
292  geom->SetTopVolume(top);
293  // ROOT chokes unless colors are assigned
294  top->SetVisibility(kFALSE);
295  top->SetLineColor(kBlue);
296 
297  if (m_tracker || m_muon || m_gem) {
299  }
300 
301  if (m_tracker) {
302  DetId detId(DetId::Tracker, 0);
303  m_trackerGeom = static_cast<const TrackerGeometry*>(m_trackingGeom->slaveGeometry(detId));
304 
306 
309 
310  addTIBGeometry();
311  addTIDGeometry();
312  addTOBGeometry();
313  addTECGeometry();
314  }
315 
316  if (m_muon) {
317  addDTGeometry();
318  addCSCGeometry();
319  addRPCGeometry();
320  addME0Geometry();
321  }
322 
323  if (m_gem) {
324  addGEMGeometry();
325  }
326 
327  if (m_calo) {
334  }
335 
336  geom->CloseGeometry();
337 
338  geom->DefaultColors();
339  // printf("==== geo manager NNodes = %d \n", geom->GetNNodes());
340  geom->CloseGeometry();
341 
342  return fwTGeoRecoGeometry;
343 }
const GlobalTrackingGeometry * m_trackingGeom
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_trackingGeomToken
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_trackerTopologyToken
Definition: DetId.h:17
HLT enums.
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_caloGeomToken

Member Data Documentation

◆ m_calo

bool FWTGeoRecoGeometryESProducer::m_calo
private

Definition at line 105 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_caloGeom

const CaloGeometry* FWTGeoRecoGeometryESProducer::m_caloGeom = nullptr
private

◆ m_caloGeomToken

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> FWTGeoRecoGeometryESProducer::m_caloGeomToken
private

Definition at line 93 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_dummyMedium

TGeoMedium* FWTGeoRecoGeometryESProducer::m_dummyMedium = nullptr
private

Definition at line 100 of file FWTGeoRecoGeometryESProducer.h.

Referenced by GetMedium(), and produce().

◆ m_gem

bool FWTGeoRecoGeometryESProducer::m_gem
private

Definition at line 104 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_muon

bool FWTGeoRecoGeometryESProducer::m_muon
private

Definition at line 103 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_nameToShape

std::map<std::string, TGeoShape*> FWTGeoRecoGeometryESProducer::m_nameToShape
private

Definition at line 87 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createShape().

◆ m_recoMedium

std::map<ERecoDet, TGeoMedium*> FWTGeoRecoGeometryESProducer::m_recoMedium
private

Definition at line 89 of file FWTGeoRecoGeometryESProducer.h.

Referenced by GetMedium().

◆ m_shapeToVolume

std::map<TGeoShape*, TGeoVolume*> FWTGeoRecoGeometryESProducer::m_shapeToVolume
private

Definition at line 88 of file FWTGeoRecoGeometryESProducer.h.

Referenced by createVolume().

◆ m_tracker

bool FWTGeoRecoGeometryESProducer::m_tracker
private

Definition at line 102 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_trackerGeom

const TrackerGeometry* FWTGeoRecoGeometryESProducer::m_trackerGeom = nullptr
private

◆ m_trackerTopology

const TrackerTopology* FWTGeoRecoGeometryESProducer::m_trackerTopology = nullptr
private

◆ m_trackerTopologyToken

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> FWTGeoRecoGeometryESProducer::m_trackerTopologyToken
private

Definition at line 92 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().

◆ m_trackingGeom

const GlobalTrackingGeometry* FWTGeoRecoGeometryESProducer::m_trackingGeom = nullptr
private

◆ m_trackingGeomToken

edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> FWTGeoRecoGeometryESProducer::m_trackingGeomToken
private

Definition at line 91 of file FWTGeoRecoGeometryESProducer.h.

Referenced by FWTGeoRecoGeometryESProducer(), and produce().