CMS 3D CMS Logo

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

Public Member Functions

 HGCalTriggerGeometryImp1 (const edm::ParameterSet &conf)
 
virtual void initialize (const es_info &) override final
 
- Public Member Functions inherited from HGCalTriggerGeometryGenericMapping
virtual geom_set getCellsFromModule (const unsigned cell_det_id) const override final
 
virtual geom_set getCellsFromTriggerCell (const unsigned cell_det_id) const override final
 
virtual unsigned getModuleFromCell (const unsigned cell_det_id) const override final
 
virtual unsigned getModuleFromTriggerCell (const unsigned trigger_cell_det_id) const override final
 
virtual GlobalPoint getModulePosition (const unsigned module_det_id) const override final
 
virtual geom_set getNeighborsFromTriggerCell (const unsigned trigger_cell_det_id) const override final
 
virtual geom_ordered_set getOrderedCellsFromModule (const unsigned cell_det_id) const override final
 
virtual geom_ordered_set getOrderedTriggerCellsFromModule (const unsigned trigger_cell_det_id) const override final
 
virtual unsigned getTriggerCellFromCell (const unsigned cell_det_id) const override final
 
virtual GlobalPoint getTriggerCellPosition (const unsigned trigger_cell_det_id) const override final
 
virtual geom_set getTriggerCellsFromModule (const unsigned trigger_cell_det_id) const override final
 
 HGCalTriggerGeometryGenericMapping (const edm::ParameterSet &conf)
 
virtual void reset () override final
 
virtual bool validTriggerCell (const unsigned trigger_cell_det_id) const override final
 
virtual ~HGCalTriggerGeometryGenericMapping ()
 
- Public Member Functions inherited from HGCalTriggerGeometryBase
const std::string & bhSDName () const
 
const std::string & eeSDName () const
 
const std::string & fhSDName () const
 
 HGCalTriggerGeometryBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~HGCalTriggerGeometryBase ()
 

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 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 ( const edm::ParameterSet conf)

Definition at line 24 of file HGCalTriggerGeometryImp1.cc.

24  :
26  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping"))
27 /*****************************************************************/
28 {
29 }
T getParameter(std::string const &) const
HGCalTriggerGeometryGenericMapping(const edm::ParameterSet &conf)

Member Function Documentation

void HGCalTriggerGeometryImp1::initialize ( const es_info esInfo)
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 33 of file HGCalTriggerGeometryImp1.cc.

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

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  //
41  // read trigger cell mapping file
42  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
43  if(!l1tCellsMappingStream.is_open()) edm::LogError("HGCalTriggerGeometry") << "Cannot open L1TCellsMapping file\n";
44  short layer = 0;
45  short subsector = 0;
46  short cell = 0;
47  short module = 0;
48  short triggercell = 0;
49  for(; l1tCellsMappingStream>>layer>>subsector>>cell>>module>>triggercell; )
50  {
51  if(layer>30 || layer<=0)
52  {
53  edm::LogWarning("HGCalTriggerGeometry") << "Bad layer index in L1TCellsMapping\n";
54  continue;
55  }
56  // Loop on all sectors
57  // FIXME: Number of sectors in each zside should not be hardcoded
58  for(unsigned z=0; z<=1; z++)
59  {
60  int zside = (z==0 ? -1 : 1);
61  for(unsigned sector=1; sector<=18; sector++)
62  {
63  HGCEEDetId detid(HGCEE, zside, layer, sector, subsector, cell);
64  //
65  // Fill cell -> trigger cell mapping
66  HGCTriggerDetId triggerDetid(HGCTrigger, zside, layer, sector, module, triggercell);
67  const auto& ret = cells_to_trigger_cells_.insert( std::make_pair(detid, triggerDetid) );
68  if(!ret.second) edm::LogWarning("HGCalTriggerGeometry") << "Duplicate cell in L1TCellsMapping\n";
69  // Fill trigger cell -> module mapping
70  HGCTriggerDetId moduleDetid(HGCTrigger, zside, layer, sector, module, HGCTriggerDetId::UndefinedCell() );
71  trigger_cells_to_modules_.insert( std::make_pair(triggerDetid, moduleDetid) ); // do nothing if trigger cell has already been inserted
72  }
73  }
74  }
75  if(!l1tCellsMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsMapping'"<<layer<<" "<<cell<<" "<<triggercell<<" "<<subsector<<"' \n";
76  l1tCellsMappingStream.close();
77  //
78  // Build trigger cells and fill map
80  // make list of cells in trigger cells
81  std::map<unsigned, list_cells> trigger_cells_to_cells;
82  for(const auto& cell_triggercell : cells_to_trigger_cells_)
83  {
84  unsigned cell = cell_triggercell.first;
85  unsigned triggercell = cell_triggercell.second;
86  trigger_cells_to_cells.insert( std::make_pair(triggercell, list_cells()) );
87  trigger_cells_to_cells.at(triggercell).insert(cell);
88  }
89  for(const auto& triggercell_cells : trigger_cells_to_cells)
90  {
91  unsigned triggercellId = triggercell_cells.first;
92  list_cells cellIds = triggercell_cells.second;
93  // Position: for the moment, barycenter of the trigger cell.
94  Basic3DVector<float> triggercellVector(0.,0.,0.);
95  for(const auto& cell : cellIds)
96  {
97  HGCTriggerDetId cellId(cell);
98  triggercellVector += esInfo.geom_ee->getPosition(cellId).basicVector();
99  }
100  GlobalPoint triggercellPoint( triggercellVector/cellIds.size() );
101  const auto& tc2mItr = trigger_cells_to_modules_.find(triggercellId);
102  unsigned moduleId = (tc2mItr!=trigger_cells_to_modules_.end() ? tc2mItr->second : 0); // 0 if the trigger cell doesn't belong to a module
103  //unsigned moduleId = trigger_cells_to_modules_.at(triggercellId);
104  // FIXME: empty neighbours
105  std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(new HGCalTriggerGeometry::TriggerCell(triggercellId, moduleId, triggercellPoint, list_cells(), cellIds));
106  trigger_cells_.insert( std::make_pair(triggercellId, std::move(triggercellPtr)) );
107  }
108  //
109  // Build modules and fill map
110  typedef HGCalTriggerGeometry::Module::list_type list_triggercells;
111  typedef HGCalTriggerGeometry::Module::tc_map_type tc_map_to_cells;
112  // make list of trigger cells in modules
113  std::map<unsigned, list_triggercells> modules_to_trigger_cells;
114  for(const auto& triggercell_module : trigger_cells_to_modules_)
115  {
116  unsigned triggercell = triggercell_module.first;
117  unsigned module = triggercell_module.second;
118  modules_to_trigger_cells.insert( std::make_pair(module, list_triggercells()) );
119  modules_to_trigger_cells.at(module).insert(triggercell);
120  }
121  for(const auto& module_triggercell : modules_to_trigger_cells)
122  {
123  unsigned moduleId = module_triggercell.first;
124  list_triggercells triggercellIds = module_triggercell.second;
125  tc_map_to_cells cellsInTriggerCells;
126  // Position: for the moment, barycenter of the module, from trigger cell positions
127  Basic3DVector<float> moduleVector(0.,0.,0.);
128  for(const auto& triggercell : triggercellIds)
129  {
130  const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
131  for( const unsigned cell : cells_in_tc ) {
132  cellsInTriggerCells.emplace(triggercell,cell);
133  }
134  moduleVector += trigger_cells_.at(triggercell)->position().basicVector();
135  }
136  GlobalPoint modulePoint( moduleVector/triggercellIds.size() );
137  // FIXME: empty neighbours
138  std::unique_ptr<const HGCalTriggerGeometry::Module> modulePtr(new HGCalTriggerGeometry::Module(moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
139  modules_.insert( std::make_pair(moduleId, std::move(modulePtr)) );
140  }
141 }
std::unordered_set< unsigned > list_type
std::unordered_multimap< unsigned, unsigned > tc_map_type
static const uint32_t UndefinedCell()
std::string fullPath() const
Definition: FileInPath.cc:184
Definition: vlib.h:208
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::FileInPath HGCalTriggerGeometryImp1::l1tCellsMapping_
private

Definition at line 19 of file HGCalTriggerGeometryImp1.cc.

Referenced by initialize().