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

Constructor & Destructor Documentation

EMap::EMap ( )
inline

Definition at line 82 of file LMap.h.

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

Definition at line 83 of file LMap.h.

References genParticles_cff::map.

83 { read_map(filename); }
int read_map(std::string filename)
Definition: LMap.cc:268
EMap::EMap ( const HcalElectronicsMap map)

Definition at line 184 of file LMap.cc.

References photons_cff::_id, 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.

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

Definition at line 85 of file LMap.h.

85 {}

Member Function Documentation

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

Definition at line 268 of file LMap.cc.

References RooGKCounter::count(), EMap::EMapRow::crate, EMap::EMapRow::dcc, EMap::EMapRow::fiber, EMap::EMapRow::fiberchan, corrVsCorr::filename, RooGKCounter::getCount(), 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, AlCaHLTBitMon_QueryRunRegistry::string, EMap::EMapRow::subdet, and EMap::EMapRow::topbottom.

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

Member Data Documentation

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