CMS 3D CMS Logo

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 genParticles_cff::map.

98 { read_map(filename); }
int read_map(std::string filename)
Definition: LMap.cc:260
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(), genParticles_cff::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 if (eId->htrTopBottom()==0) row.topbottom = "b";
191  else row.topbottom = "u";
192  //
193  HcalGenericDetId _gid( emap->lookup(*eId) );
194  if ( !(_gid.null()) &&
195  (_gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
196  _gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
197  _gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
198  _gid.genericSubdet()==HcalGenericDetId::HcalGenOuter
199  )
200  ){
201  HcalDetId _id( emap->lookup(*eId) );
202  row.rawId = _id.rawId();
203  row.ieta = _id.ieta();
204  row.iphi = _id.iphi();
205  row.idepth = _id.depth();
206  row.subdet = _ass.getSubdetectorString(_id.subdet());
207  // fill the map
208  map.push_back(row);
209  }
210  // ZDC channels
211  else if ( !(_gid.null()) &&
212  _gid.genericSubdet()==HcalGenericDetId::HcalGenZDC
213  ){
214  HcalZDCDetId _id( emap->lookup(*eId) );
215  row.zdc_channel = _id.channel();
216  row.zdc_section = _ass.getZDCSectionString(_id.section());
217  row.idepth = _id.depth();
218  row.zdc_zside = _id.zside();
219  // fill the map
220  map.push_back(row);
221  }
222  }
223  //
224  //_____ trigger channels __________________________________________
225  //
226  v_eId = emap->allElectronicsIdTrigger();
227  for (std::vector <HcalElectronicsId>::const_iterator eId=v_eId.begin();
228  eId!=v_eId.end();
229  eId++){
230  EMapRow row;
231  //row.rawId = eId->rawId();
232  row.crate = eId->readoutVMECrateId();
233  row.slot = eId->htrSlot();
234  row.dcc = eId->dccid();
235  row.spigot = eId->spigot();
236  row.fiber = eId->isVMEid() ? eId->slbSiteNumber() : eId->fiberIndex();
237  row.fiberchan = eId->isVMEid() ? eId->slbChannelIndex() : eId->fiberChanId();
238  if (eId->htrTopBottom()==1) row.topbottom = "t";
239  else if (eId->htrTopBottom()==0) row.topbottom = "b";
240  else row.topbottom = "u";
241  //
242  HcalTrigTowerDetId _id( emap->lookupTrigger(*eId) );
243  if ( !(_id.null()) ){
244  row.rawId = _id.rawId();
245  row.ieta = _id.ieta();
246  row.iphi = _id.iphi();
247  row.idepth = _id.depth();
248  row.subdet = _ass.getSubdetectorString(_id.subdet());
249  // fill the map
250  map.push_back(row);
251  }
252  }
253  }
254  else{
255  edm::LogError("EMap") << "Pointer to HcalElectronicsMap is 0!!!";
256  }
257 }
std::string getSubdetectorString(HcalSubdetector _det)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::string getZDCSectionString(HcalZDCDetId::Section _section)
std::vector< HcalElectronicsId > allElectronicsIdTrigger() const
int channel() const
get the channel
Definition: HcalZDCDetId.cc:62
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 260 of file LMap.cc.

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

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

Member Data Documentation

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