CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCTriggerMappingFromFile Class Reference

#include <CSCTriggerMappingFromFile.h>

Inheritance diagram for CSCTriggerMappingFromFile:
CSCTriggerSimpleMapping CSCTriggerMapping

Public Member Functions

 CSCTriggerMappingFromFile (std::string filename)
 Constructor. More...
 
 CSCTriggerMappingFromFile ()
 
void fill (void) override
 Fill mapping store. More...
 
 ~CSCTriggerMappingFromFile () override
 Destructor. More...
 
- Public Member Functions inherited from CSCTriggerSimpleMapping
 CSCTriggerSimpleMapping ()
 Constructor. More...
 
 ~CSCTriggerSimpleMapping () override
 Destructor. More...
 
- Public Member Functions inherited from CSCTriggerMapping
void addRecord (int rendcap, int rstation, int rsector, int rsubsector, int rcscid, int cendcap, int cstation, int csector, int csubsector, int ccscid)
 
int chamber (int endcap, int station, int sector, int subsector, int cscid) const
 
 CSCTriggerMapping ()
 Default constructor. More...
 
bool debugV (void) const
 
CSCDetId detId (int endcap, int station, int sector, int subsector, int cscid, int layer=0) const
 
const std::string & myName (void) const
 
void setDebugV (bool dbg)
 
virtual ~CSCTriggerMapping ()
 Destructor. More...
 

Private Attributes

std::string filename_
 

Additional Inherited Members

- Public Types inherited from CSCTriggerMapping
typedef struct CSCTriggerMapping::CSCTriggerConnection Connection
 

Detailed Description

Author
Lindsey Gray A concrete CSCTriggerSimpleMapping to read mapping from Ascii file.

Definition at line 13 of file CSCTriggerMappingFromFile.h.

Constructor & Destructor Documentation

◆ CSCTriggerMappingFromFile() [1/2]

CSCTriggerMappingFromFile::CSCTriggerMappingFromFile ( std::string  filename)
explicit

Constructor.

Definition at line 6 of file CSCTriggerMappingFromFile.cc.

References fill().

6 : filename_(filename) { fill(); }
void fill(void) override
Fill mapping store.

◆ CSCTriggerMappingFromFile() [2/2]

CSCTriggerMappingFromFile::CSCTriggerMappingFromFile ( )
inline

Definition at line 17 of file CSCTriggerMappingFromFile.h.

17 {}

◆ ~CSCTriggerMappingFromFile()

CSCTriggerMappingFromFile::~CSCTriggerMappingFromFile ( )
override

Destructor.

Definition at line 8 of file CSCTriggerMappingFromFile.cc.

8 {}

Member Function Documentation

◆ fill()

void CSCTriggerMappingFromFile::fill ( void  )
overridevirtual

Fill mapping store.

Implements CSCTriggerMapping.

Definition at line 10 of file CSCTriggerMappingFromFile.cc.

References CSCTriggerMapping::addRecord(), gather_cfg::cout, CSCTriggerMapping::debugV(), filename_, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, recoMuon::in, mps_splice::line, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CSCTriggerMappingFromFile().

10  {
11  std::ifstream in(filename_.c_str());
13  const std::string commentFlag = "#";
14  if (!in) {
15  std::cout << "CSCTriggerMappingFromFile: ERROR! Failed to open file containing mapping, " << filename_ << std::endl;
16  } else {
17  std::cout << "CSCTriggerMappingFromFile: opened file containing mapping, " << filename_ << std::endl;
18 
19  while (getline(in, line)) { // getline() from <string>
20  if (debugV())
21  std::cout << line << std::endl;
22  if (line[0] != commentFlag[0]) {
23  int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
24  std::istringstream is(line);
25  if (!(is >> i1 >> i2 >> i3 >> i4 >> i5 >> i6 >> i7 >> i8 >> i9 >> i10))
26  continue;
27  if (debugV())
28  std::cout << i1 << " " << i2 << " " << i3 << " " << i4 << " " << i5 << " " << i6 << " " << i7 << " " << i8
29  << " " << i9 << " " << i10 << std::endl;
30  addRecord(i1, i2, i3, i4, i5, i6, i7, i8, i9, i10);
31  }
32  }
33  }
34 
35  return;
36 }
void addRecord(int rendcap, int rstation, int rsector, int rsubsector, int rcscid, int cendcap, int cstation, int csector, int csubsector, int ccscid)
bool debugV(void) const

Member Data Documentation

◆ filename_

std::string CSCTriggerMappingFromFile::filename_
private

Definition at line 26 of file CSCTriggerMappingFromFile.h.

Referenced by fill().