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:258
tuple filename
Definition: lut2db_cfg.py:20
EMap::EMap ( const HcalElectronicsMap map)

Definition at line 171 of file LMap.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), HcalElectronicsMap::allElectronicsIdTrigger(), 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(), 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.

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

References KineDebug3::count(), EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, lut2db_cfg::filename, EMap::EMapRow::idepth, EMap::EMapRow::ieta, recoMuon::in, EMap::EMapRow::iphi, groupFilesInBlocks::lines, EMap::EMapRow::rawId, EMap::EMapRow::slot, EMap::EMapRow::spigot, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EMap().

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

Member Data Documentation

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

Definition at line 140 of file LMap.h.