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 95 of file LMap.h.

Constructor & Destructor Documentation

EMap::EMap ( )
inline

Definition at line 98 of file LMap.h.

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

Definition at line 99 of file LMap.h.

References read_map().

99 { 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(), dtNoiseDBValidation_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.

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->slbSiteNumber();
236  row.fiberchan = eId->slbChannelIndex();
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  std::cerr << "Pointer to HcalElectronicsMap is 0!!!" << std::endl;
254  }
255 }
std::string getSubdetectorString(HcalSubdetector _det)
std::string getZDCSectionString(HcalZDCDetId::Section _section)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
int channel() const
get the channel
Definition: HcalZDCDetId.h:42
EMap::~EMap ( )
inline

Definition at line 101 of file LMap.h.

101 {}

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 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, and EMap::EMapRow::spigot.

Referenced by EMap().

259 {
261 
262  std::string _row;
263  ifstream inFile( filename . c_str(), std::ios::in );
264  if (!inFile){
265  std::cout << "Unable to open file with the electronic map: " << filename << std::endl;
266  }
267  else{
268  std::cout << "File with the electronic map opened successfully: " << filename << std::endl;
269  }
270  while ( getline( inFile, _row ) > 0 ){
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  std::cout << "EMap: " << lines . getCount() << " lines read" << std::endl;
298 
299  return 0;
300 }
std::vector< EMapRow > map
Definition: LMap.h:141
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 141 of file LMap.h.