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 (const HcalElectronicsMap *map)
 
 EMap (std::string filename)
 
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() [1/3]

EMap::EMap ( )
inline

Definition at line 82 of file LMap.h.

82 {}

◆ EMap() [2/3]

EMap::EMap ( std::string  filename)
inline

Definition at line 83 of file LMap.h.

83 { read_map(filename); }

References corrVsCorr::filename, and read_map().

◆ EMap() [3/3]

EMap::EMap ( const HcalElectronicsMap map)

Definition at line 184 of file LMap.cc.

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 }

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.

◆ ~EMap()

EMap::~EMap ( )
inline

Definition at line 85 of file LMap.h.

85 {}

Member Function Documentation

◆ get_map()

std::vector< EMap::EMapRow > & EMap::get_map ( void  )

◆ read_map()

int EMap::read_map ( std::string  filename)

Definition at line 268 of file LMap.cc.

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 }

References 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, AlCaHLTBitMon_QueryRunRegistry::string, EMap::EMapRow::subdet, and EMap::EMapRow::topbottom.

Referenced by EMap().

Member Data Documentation

◆ map

std::vector<EMapRow> EMap::map
protected
HcalGenericDetId
Definition: HcalGenericDetId.h:15
edm::LogInfo
Definition: MessageLogger.h:254
HcalZDCDetId::channel
int channel() const
get the channel
Definition: HcalZDCDetId.cc:63
HcalAssistant::getZDCSectionString
std::string getZDCSectionString(HcalZDCDetId::Section _section)
Definition: HcalAssistant.cc:172
HcalGenericDetId::HcalGenEndcap
Definition: HcalGenericDetId.h:20
HcalGenericDetId::HcalGenZDC
Definition: HcalGenericDetId.h:24
HcalZDCDetId
Definition: HcalZDCDetId.h:16
EMap::map
std::vector< EMapRow > map
Definition: LMap.h:124
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
RooGKCounter
Definition: RooGKCounter.h:10
HcalAssistant
Definition: HcalAssistant.h:43
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogError
Definition: MessageLogger.h:183
groupFilesInBlocks.lines
lines
Definition: groupFilesInBlocks.py:95
recoMuon::in
Definition: RecoMuonEnumerators.h:6
HcalDetId
Definition: HcalDetId.h:12
HcalGenericDetId::HcalGenBarrel
Definition: HcalGenericDetId.h:19
HcalAssistant::getSubdetectorString
std::string getSubdetectorString(HcalSubdetector _det)
Definition: HcalAssistant.cc:155
EMap::read_map
int read_map(std::string filename)
Definition: LMap.cc:268
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalGenericDetId::HcalGenOuter
Definition: HcalGenericDetId.h:21
HcalGenericDetId::HcalGenForward
Definition: HcalGenericDetId.h:22
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14