CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerGeometryImp1 Class Reference
Inheritance diagram for HGCalTriggerGeometryImp1:
HGCalTriggerGeometryGenericMapping HGCalTriggerGeometryBase

Public Member Functions

 HGCalTriggerGeometryImp1 (const edm::ParameterSet &conf)
 
void initialize (const CaloGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
- Public Member Functions inherited from HGCalTriggerGeometryGenericMapping
bool disconnectedModule (const unsigned module_id) const final
 
geom_set getCellsFromModule (const unsigned cell_det_id) const final
 
geom_set getCellsFromTriggerCell (const unsigned cell_det_id) const final
 
unsigned getLinksInModule (const unsigned module_id) const final
 
unsigned getModuleFromCell (const unsigned cell_det_id) const final
 
unsigned getModuleFromTriggerCell (const unsigned trigger_cell_det_id) const final
 
GlobalPoint getModulePosition (const unsigned module_det_id) const final
 
unsigned getModuleSize (const unsigned module_id) const final
 
geom_set getNeighborsFromTriggerCell (const unsigned trigger_cell_det_id) const final
 
geom_ordered_set getOrderedCellsFromModule (const unsigned cell_det_id) const final
 
geom_ordered_set getOrderedTriggerCellsFromModule (const unsigned trigger_cell_det_id) const final
 
unsigned getTriggerCellFromCell (const unsigned cell_det_id) const final
 
GlobalPoint getTriggerCellPosition (const unsigned trigger_cell_det_id) const final
 
geom_set getTriggerCellsFromModule (const unsigned trigger_cell_det_id) const final
 
 HGCalTriggerGeometryGenericMapping (const edm::ParameterSet &conf)
 
unsigned lastTriggerLayer () const final
 
void reset () final
 
unsigned triggerLayer (const unsigned id) const final
 
bool validCell (const unsigned cell_det_id) const final
 
bool validTriggerCell (const unsigned trigger_cell_det_id) const final
 
 ~HGCalTriggerGeometryGenericMapping () override
 
- Public Member Functions inherited from HGCalTriggerGeometryBase
const HcalGeometrybhGeometry () const
 
const HcalTopologybhTopology () const
 
const CaloGeometrycaloGeometry () const
 
const HGCalGeometryeeGeometry () const
 
const HGCalTopologyeeTopology () const
 
const HGCalGeometryfhGeometry () const
 
const HGCalTopologyfhTopology () const
 
 HGCalTriggerGeometryBase (const edm::ParameterSet &conf)
 
const HGCalGeometryhscGeometry () const
 
const HGCalTopologyhscTopology () const
 
const HGCalGeometryhsiGeometry () const
 
const HGCalTopologyhsiTopology () const
 
bool isV9Geometry () const
 
bool isWithNoseGeometry () const
 
const std::string & name () const
 
const HGCalGeometrynoseGeometry () const
 
const HGCalTopologynoseTopology () const
 
void setWithNoseGeometry (const bool isNose)
 
virtual ~HGCalTriggerGeometryBase ()
 

Private Member Functions

void buildMaps ()
 

Private Attributes

edm::FileInPath l1tCellsMapping_
 

Additional Inherited Members

- Public Types inherited from HGCalTriggerGeometryGenericMapping
typedef std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::Module > > module_map
 
typedef std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::TriggerCell > > trigger_cell_map
 
- Public Types inherited from HGCalTriggerGeometryBase
typedef std::unordered_map< unsigned, unsigned > geom_map
 
typedef std::set< unsigned > geom_ordered_set
 
typedef std::unordered_set< unsigned > geom_set
 
- Protected Member Functions inherited from HGCalTriggerGeometryBase
void setCaloGeometry (const CaloGeometry *geom)
 
void setEEGeometry (const HGCalGeometry *geom)
 
void setHScGeometry (const HGCalGeometry *geom)
 
void setHSiGeometry (const HGCalGeometry *geom)
 
void setNoseGeometry (const HGCalGeometry *geom)
 
- Protected Attributes inherited from HGCalTriggerGeometryGenericMapping
geom_map cells_to_trigger_cells_
 
module_map modules_
 
trigger_cell_map trigger_cells_
 
geom_map trigger_cells_to_modules_
 

Detailed Description

Definition at line 11 of file HGCalTriggerGeometryImp1.cc.

Constructor & Destructor Documentation

◆ HGCalTriggerGeometryImp1()

HGCalTriggerGeometryImp1::HGCalTriggerGeometryImp1 ( const edm::ParameterSet conf)

Definition at line 26 of file HGCalTriggerGeometryImp1.cc.

28  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping"))
29 /*****************************************************************/
30 {}

Member Function Documentation

◆ buildMaps()

void HGCalTriggerGeometryImp1::buildMaps ( )
private

Definition at line 65 of file HGCalTriggerGeometryImp1.cc.

67 {
68  //
69  // read trigger cell mapping file
70  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
71  if (!l1tCellsMappingStream.is_open())
72  edm::LogError("HGCalTriggerGeometry") << "Cannot open L1TCellsMapping file\n";
73  short layer = 0;
74  short subsector = 0;
75  short cell = 0;
76  short module = 0;
77  short triggercell = 0;
78  for (; l1tCellsMappingStream >> layer >> subsector >> cell >> module >> triggercell;) {
79  if (layer > 30 || layer <= 0) {
80  edm::LogWarning("HGCalTriggerGeometry") << "Bad layer index in L1TCellsMapping\n";
81  continue;
82  }
83  // Loop on all sectors
84  // FIXME: Number of sectors in each zside should not be hardcoded
85  for (unsigned z = 0; z <= 1; z++) {
86  int zside = (z == 0 ? -1 : 1);
87  for (unsigned sector = 1; sector <= 18; sector++) {
88  HGCEEDetId detid(HGCEE, zside, layer, sector, subsector, cell);
89  //
90  // Fill cell -> trigger cell mapping
91  HGCTriggerDetId triggerDetid(HGCTrigger, zside, layer, sector, module, triggercell);
92  const auto& ret = cells_to_trigger_cells_.insert(std::make_pair(detid, triggerDetid));
93  if (!ret.second)
94  edm::LogWarning("HGCalTriggerGeometry") << "Duplicate cell in L1TCellsMapping\n";
95  // Fill trigger cell -> module mapping
96  HGCTriggerDetId moduleDetid(HGCTrigger, zside, layer, sector, module, HGCTriggerDetId::UndefinedCell());
98  std::make_pair(triggerDetid, moduleDetid)); // do nothing if trigger cell has already been inserted
99  }
100  }
101  }
102  if (!l1tCellsMappingStream.eof())
103  edm::LogWarning("HGCalTriggerGeometry")
104  << "Error reading L1TCellsMapping'" << layer << " " << cell << " " << triggercell << " " << subsector << "' \n";
105  l1tCellsMappingStream.close();
106  //
107  // Build trigger cells and fill map
109  // make list of cells in trigger cells
110  std::map<unsigned, list_cells> trigger_cells_to_cells;
111  for (const auto& cell_triggercell : cells_to_trigger_cells_) {
112  unsigned cell = cell_triggercell.first;
113  unsigned triggercell = cell_triggercell.second;
114  trigger_cells_to_cells.insert(std::make_pair(triggercell, list_cells()));
115  trigger_cells_to_cells.at(triggercell).insert(cell);
116  }
117  for (const auto& triggercell_cells : trigger_cells_to_cells) {
118  unsigned triggercellId = triggercell_cells.first;
119  list_cells cellIds = triggercell_cells.second;
120  // Position: for the moment, barycenter of the trigger cell.
121  Basic3DVector<float> triggercellVector(0., 0., 0.);
122  for (const auto& cell : cellIds) {
123  HGCTriggerDetId cellId(cell);
124  triggercellVector += eeGeometry()->getPosition(cellId).basicVector();
125  }
126  GlobalPoint triggercellPoint(triggercellVector / cellIds.size());
127  const auto& tc2mItr = trigger_cells_to_modules_.find(triggercellId);
128  unsigned moduleId =
129  (tc2mItr != trigger_cells_to_modules_.end() ? tc2mItr->second
130  : 0); // 0 if the trigger cell doesn't belong to a module
131  // FIXME: empty neighbours
132  std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(
133  new HGCalTriggerGeometry::TriggerCell(triggercellId, moduleId, triggercellPoint, list_cells(), cellIds));
134  trigger_cells_.insert(std::make_pair(triggercellId, std::move(triggercellPtr)));
135  }
136  //
137  // Build modules and fill map
138  typedef HGCalTriggerGeometry::Module::list_type list_triggercells;
139  typedef HGCalTriggerGeometry::Module::tc_map_type tc_map_to_cells;
140  // make list of trigger cells in modules
141  std::map<unsigned, list_triggercells> modules_to_trigger_cells;
142  for (const auto& triggercell_module : trigger_cells_to_modules_) {
143  unsigned triggercell = triggercell_module.first;
144  unsigned module = triggercell_module.second;
145  modules_to_trigger_cells.insert(std::make_pair(module, list_triggercells()));
146  modules_to_trigger_cells.at(module).insert(triggercell);
147  }
148  for (const auto& module_triggercell : modules_to_trigger_cells) {
149  unsigned moduleId = module_triggercell.first;
150  list_triggercells triggercellIds = module_triggercell.second;
151  tc_map_to_cells cellsInTriggerCells;
152  // Position: for the moment, barycenter of the module, from trigger cell positions
153  Basic3DVector<float> moduleVector(0., 0., 0.);
154  for (const auto& triggercell : triggercellIds) {
155  const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
156  for (const unsigned cell : cells_in_tc) {
157  cellsInTriggerCells.emplace(triggercell, cell);
158  }
159  moduleVector += trigger_cells_.at(triggercell)->position().basicVector();
160  }
161  GlobalPoint modulePoint(moduleVector / triggercellIds.size());
162  // FIXME: empty neighbours
163  std::unique_ptr<const HGCalTriggerGeometry::Module> modulePtr(new HGCalTriggerGeometry::Module(
164  moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
165  modules_.insert(std::make_pair(moduleId, std::move(modulePtr)));
166  }
167 }

References PV3DBase< T, PVType, FrameType >::basicVector(), HGCalTriggerGeometryGenericMapping::cells_to_trigger_cells_, HGCalTriggerGeometryBase::eeGeometry(), edm::FileInPath::fullPath(), HGCalGeometry::getPosition(), HGCEE, HGCTrigger, l1tCellsMapping_, HGCalTriggerGeometryGenericMapping::modules_, eostools::move(), runTheMatrix::ret, HGCalTriggerGeometryGenericMapping::trigger_cells_, HGCalTriggerGeometryGenericMapping::trigger_cells_to_modules_, HGCTriggerDetId::UndefinedCell(), z, and ecaldqm::zside().

◆ initialize() [1/3]

void HGCalTriggerGeometryImp1::initialize ( const CaloGeometry calo_geometry)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 33 of file HGCalTriggerGeometryImp1.cc.

35 {
36  // FIXME: !!!Only for HGCEE for the moment!!!
37  edm::LogWarning("HGCalTriggerGeometry") << "WARNING: This HGCal trigger geometry is incomplete.\n"
38  << "WARNING: Only the EE part is covered.\n"
39  << "WARNING: There is no neighbor information.\n";
40  setCaloGeometry(calo_geometry);
41 }

References HGCalTriggerGeometryBase::setCaloGeometry().

◆ initialize() [2/3]

void HGCalTriggerGeometryImp1::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 44 of file HGCalTriggerGeometryImp1.cc.

48 {
49  throw cms::Exception("BadGeometry")
50  << "HGCalTriggerGeometryImp1 geometry cannot be initialized with the V9 HGCAL geometry";
51 }

References Exception.

◆ initialize() [3/3]

void HGCalTriggerGeometryImp1::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry,
const HGCalGeometry hgc_nose_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 54 of file HGCalTriggerGeometryImp1.cc.

59 {
60  throw cms::Exception("BadGeometry")
61  << "HGCalTriggerGeometryImp1 geometry cannot be initialized with the V9 HGCAL+NOSE geometry";
62 }

References Exception.

Member Data Documentation

◆ l1tCellsMapping_

edm::FileInPath HGCalTriggerGeometryImp1::l1tCellsMapping_
private

Definition at line 20 of file HGCalTriggerGeometryImp1.cc.

Referenced by buildMaps().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
HGCalTriggerGeometry::TriggerCell
Definition: HGCalTriggerGeometryGenericMapping.h:31
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
HGCalTriggerGeometryGenericMapping::trigger_cells_to_modules_
geom_map trigger_cells_to_modules_
Definition: HGCalTriggerGeometryGenericMapping.h:139
HGCalTriggerGeometry::Module
Definition: HGCalTriggerGeometryGenericMapping.h:58
HGCTriggerDetId
Definition: HGCTriggerDetId.h:8
edm::FileInPath
Definition: FileInPath.h:64
HGCalTriggerGeometry::Module::tc_map_type
std::unordered_multimap< unsigned, unsigned > tc_map_type
Definition: HGCalTriggerGeometryGenericMapping.h:61
DDAxes::z
Point3DBase< float, GlobalTag >
HGCalTriggerGeometryGenericMapping::HGCalTriggerGeometryGenericMapping
HGCalTriggerGeometryGenericMapping(const edm::ParameterSet &conf)
Definition: HGCalTriggerGeometryGenericMapping.cc:10
HGCalTriggerGeometry::Module::list_type
std::unordered_set< unsigned > list_type
Definition: HGCalTriggerGeometryGenericMapping.h:60
HGCEE
Definition: ForwardSubdetector.h:8
edm::LogWarning
Definition: MessageLogger.h:141
edm::LogError
Definition: MessageLogger.h:183
HGCalTriggerGeometryGenericMapping::cells_to_trigger_cells_
geom_map cells_to_trigger_cells_
Definition: HGCalTriggerGeometryGenericMapping.h:138
HGCTriggerDetId::UndefinedCell
const static uint32_t UndefinedCell()
Definition: HGCTriggerDetId.h:32
HGCalTriggerGeometryImp1::l1tCellsMapping_
edm::FileInPath l1tCellsMapping_
Definition: HGCalTriggerGeometryImp1.cc:20
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
HGCalTriggerGeometryGenericMapping::trigger_cells_
trigger_cell_map trigger_cells_
Definition: HGCalTriggerGeometryGenericMapping.h:142
module
Definition: vlib.h:198
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCTrigger
Definition: ForwardSubdetector.h:12
HGCalTriggerGeometryBase::eeGeometry
const HGCalGeometry * eeGeometry() const
Definition: HGCalTriggerGeometryBase.h:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:246
HGCalTriggerGeometryBase::setCaloGeometry
void setCaloGeometry(const CaloGeometry *geom)
Definition: HGCalTriggerGeometryBase.h:106
HGCEEDetId
Definition: HGCEEDetId.h:8
HGCalTriggerGeometry::TriggerCell::list_type
std::unordered_set< unsigned > list_type
Definition: HGCalTriggerGeometryGenericMapping.h:33
HGCalTriggerGeometryGenericMapping::modules_
module_map modules_
Definition: HGCalTriggerGeometryGenericMapping.h:141
Basic3DVector< float >
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163