CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Attributes
EMap Class Reference

#include <LMap.h>

Classes

class  EMapRow
 

Public Member Functions

 EMap ()
 
 EMap (std::string filename)
 
 EMap (const HcalElectronicsMap *map)
 
std::vector< EMap::EMapRow > & get_map (void)
 
int read_map (std::string filename)
 
 ~EMap ()
 

Protected Attributes

std::vector< EMapRowmap
 

Detailed Description

Definition at line 94 of file LMap.h.

Constructor & Destructor Documentation

EMap::EMap ( )
inline

Definition at line 97 of file LMap.h.

97 {}
EMap::EMap ( std::string  filename)
inline

Definition at line 98 of file LMap.h.

References read_map().

98 { read_map(filename); }
int read_map(std::string filename)
Definition: LMap.cc:257
tuple filename
Definition: lut2db_cfg.py:20
EMap::EMap ( const HcalElectronicsMap map)

Definition at line 170 of file LMap.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), HcalElectronicsMap::allElectronicsIdTrigger(), ecal_dqm_sourceclient-live_cfg::cerr, EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, HcalAssistant::getSubdetectorString(), HcalAssistant::getZDCSectionString(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenZDC, EMap::EMapRow::idepth, EMap::EMapRow::ieta, EMap::EMapRow::iphi, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), python.multivaluedict::map(), EMap::EMapRow::rawId, EMap::EMapRow::slot, EMap::EMapRow::spigot, EMap::EMapRow::subdet, EMap::EMapRow::topbottom, EMap::EMapRow::zdc_channel, EMap::EMapRow::zdc_section, and EMap::EMapRow::zdc_zside.

170  {
171  if (emap){
172  HcalAssistant _ass;
173  //
174  //_____ precision channels __________________________________________
175  //
176  std::vector <HcalElectronicsId> v_eId = emap->allElectronicsIdPrecision();
177  for (std::vector <HcalElectronicsId>::const_iterator eId=v_eId.begin();
178  eId!=v_eId.end();
179  eId++){
180  EMapRow row;
181  //row.rawId = eId->rawId();
182  row.crate = eId->readoutVMECrateId();
183  row.slot = eId->htrSlot();
184  row.dcc = eId->dccid();
185  row.spigot = eId->spigot();
186  row.fiber = eId->fiberIndex();
187  row.fiberchan = eId->fiberChanId();
188  if (eId->htrTopBottom()==1) row.topbottom = "t";
189  else row.topbottom = "b";
190  //
191  HcalGenericDetId _gid( emap->lookup(*eId) );
192  if ( !(_gid.null()) &&
193  (_gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
194  _gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
195  _gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
196  _gid.genericSubdet()==HcalGenericDetId::HcalGenOuter
197  )
198  ){
199  HcalDetId _id( emap->lookup(*eId) );
200  row.rawId = _id.rawId();
201  row.ieta = _id.ieta();
202  row.iphi = _id.iphi();
203  row.idepth = _id.depth();
204  row.subdet = _ass.getSubdetectorString(_id.subdet());
205  // fill the map
206  map.push_back(row);
207  }
208  // ZDC channels
209  else if ( !(_gid.null()) &&
210  _gid.genericSubdet()==HcalGenericDetId::HcalGenZDC
211  ){
212  HcalZDCDetId _id( emap->lookup(*eId) );
213  row.zdc_channel = _id.channel();
214  row.zdc_section = _ass.getZDCSectionString(_id.section());
215  row.idepth = _id.depth();
216  row.zdc_zside = _id.zside();
217  // fill the map
218  map.push_back(row);
219  }
220  }
221  //
222  //_____ trigger channels __________________________________________
223  //
224  v_eId = emap->allElectronicsIdTrigger();
225  for (std::vector <HcalElectronicsId>::const_iterator eId=v_eId.begin();
226  eId!=v_eId.end();
227  eId++){
228  EMapRow row;
229  //row.rawId = eId->rawId();
230  row.crate = eId->readoutVMECrateId();
231  row.slot = eId->htrSlot();
232  row.dcc = eId->dccid();
233  row.spigot = eId->spigot();
234  row.fiber = eId->slbSiteNumber();
235  row.fiberchan = eId->slbChannelIndex();
236  if (eId->htrTopBottom()==1) row.topbottom = "t";
237  else row.topbottom = "b";
238  //
239  HcalTrigTowerDetId _id( emap->lookupTrigger(*eId) );
240  if ( !(_id.null()) ){
241  row.rawId = _id.rawId();
242  row.ieta = _id.ieta();
243  row.iphi = _id.iphi();
244  row.idepth = _id.depth();
245  row.subdet = _ass.getSubdetectorString(_id.subdet());
246  // fill the map
247  map.push_back(row);
248  }
249  }
250  }
251  else{
252  std::cerr << "Pointer to HcalElectronicsMap is 0!!!" << std::endl;
253  }
254 }
std::string getSubdetectorString(HcalSubdetector _det)
std::string getZDCSectionString(HcalZDCDetId::Section _section)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
int channel() const
get the channel
Definition: HcalZDCDetId.h:40
EMap::~EMap ( )
inline

Definition at line 100 of file LMap.h.

100 {}

Member Function Documentation

std::vector< EMap::EMapRow > & EMap::get_map ( void  )
int EMap::read_map ( std::string  filename)

Definition at line 257 of file LMap.cc.

References prof2calltree::count, gather_cfg::cout, EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, EMap::EMapRow::idepth, EMap::EMapRow::ieta, recoMuon::in, EMap::EMapRow::iphi, groupFilesInBlocks::lines, python.multivaluedict::map(), EMap::EMapRow::rawId, EMap::EMapRow::slot, EMap::EMapRow::spigot, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EMap().

258 {
260 
261  std::string _row;
262  ifstream inFile( filename . c_str(), std::ios::in );
263  if (!inFile){
264  std::cout << "Unable to open file with the electronic map: " << filename << std::endl;
265  }
266  else{
267  std::cout << "File with the electronic map opened successfully: " << filename << std::endl;
268  }
269  while (getline( inFile, _row )) {
270  EMapRow aRow;
271  char fpga[32];
272  char subdet[32];
273 
274  int _read;
275  const char * _format = "%d %d %d %s %d %d %d %d %s %d %d %d";
276  _read = sscanf( _row . c_str(), _format,
277  &(aRow.rawId),
278  &(aRow.crate), &(aRow.slot),
279  fpga,
280  &(aRow.dcc),
281  &(aRow.spigot),&(aRow.fiber),&(aRow.fiberchan),
282  subdet,
283  &(aRow.ieta), &(aRow.iphi), &(aRow.idepth) );
284  if ( _read >= 12 ){
285  lines . count();
286 
287  aRow . subdet .append( subdet );
288  aRow . topbottom .append( fpga );
289 
290  map . push_back( aRow );
291  //std::cout << "DEBUG: " << _row << std::endl;
292  //std::cout << "DEBUG: " << aRow.ieta << std::endl;
293  }
294  }
295  inFile.close();
296  std::cout << "EMap: " << lines . getCount() << " lines read" << std::endl;
297 
298  return 0;
299 }
std::vector< EMapRow > map
Definition: LMap.h:140
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector<EMapRow> EMap::map
protected

Definition at line 140 of file LMap.h.