CMS 3D CMS Logo

RPCTriggerConfig.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: RPCTriggerConfig
4 // Class: RPCTriggerConfig
5 //
13 //
14 // Original Author: Tomasz Maciej Frueboes
15 // Created: Tue Mar 20 12:30:19 CET 2007
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
29 
32 #include <string>
33 
35 //
36 // class decleration
37 //
38 
40 public:
42  ~RPCTriggerConfig() override;
43 
44  typedef std::unique_ptr<L1RPCConfig> ReturnType;
45 
47 
48 private:
49  // ----------member data ---------------------------
50 
51  int m_ppt;
53 };
54 
55 //
56 // constants, enums and typedefs
57 //
58 
59 //
60 // static data member definitions
61 //
62 
63 //
64 // constructors and destructor
65 //
67  //the following line is needed to tell the framework what
68  // data is being produced
69  setWhatProduced(this);
70 
71  //now do what ever other initialization is needed
72 
73  m_ppt = iConfig.getUntrackedParameter<int>("PACsPerTower");
74  std::string dataDir = iConfig.getUntrackedParameter<std::string>("filedir");
75 
76  edm::FileInPath fp(dataDir + "pacPat_t0sc0sg0.xml");
77  std::string patternsDirNameUnstriped = fp.fullPath();
78  m_patternsDir = patternsDirNameUnstriped.substr(0, patternsDirNameUnstriped.find_last_of("/") + 1);
79 }
80 
82  // do anything here that needs to be done at desctruction time
83  // (e.g. close files, deallocate resources etc.)
84 }
85 
86 //
87 // member functions
88 //
89 
90 // ------------ method called to produce the data ------------
92  auto pL1RPCConfig = std::make_unique<L1RPCConfig>();
93 
94  pL1RPCConfig->setPPT(m_ppt);
95 
96  // parse and isert patterns
97  int scCnt = 0, sgCnt = 0;
98  if (m_ppt == 1) {
99  scCnt = 1;
100  sgCnt = 1;
101  } else if (m_ppt == 12) {
102  scCnt = 1;
103  sgCnt = 12;
104  } else if (m_ppt == 144) {
105  scCnt = 12;
106  sgCnt = 12;
107  } else {
108  throw cms::Exception("BadConfig") << "Bad number of ppt requested: " << m_ppt << "\n";
109  }
110 
111  for (int tower = 0; tower < RPCConst::m_TOWER_COUNT; ++tower) {
112  for (int logSector = 0; logSector < scCnt; ++logSector) {
113  for (int logSegment = 0; logSegment < sgCnt; ++logSegment) {
114  std::stringstream fname;
115  fname << m_patternsDir << "pacPat_t" << tower << "sc" << logSector << "sg" << logSegment << ".xml";
116 
117  // TODO: this should go to logSth
118  LogDebug("RPCTriggerConfig") << "Parsing: " << fname.str() << std::endl;
119 
121  parser.parse(fname.str());
122 
123  RPCPattern::RPCPatVec npats = parser.getPatternsVec(tower, logSector, logSegment);
124  for (unsigned int ip = 0; ip < npats.size(); ip++) {
125  npats[ip].setCoords(tower, logSector, logSegment);
126  pL1RPCConfig->m_pats.push_back(npats[ip]);
127  }
128 
129  RPCPattern::TQualityVec nquals = parser.getQualityVec();
130  for (unsigned int iq = 0; iq < nquals.size(); iq++) {
131  nquals[iq].m_tower = tower;
132  nquals[iq].m_logsector = logSector;
133  nquals[iq].m_logsegment = logSegment;
134  pL1RPCConfig->m_quals.push_back(nquals[iq]);
135  }
136 
137  LogDebug("RPCTriggerConfig") << " RPCPatterns: " << npats.size() << " qualities: " << nquals.size()
138  << std::endl;
139 
140  } // segments
141  } // sectors
142  } // towers
143 
144  return pL1RPCConfig;
145 }
146 
147 //define this as a plug-in
RPCPattern::TQualityVec
std::vector< TQuality > TQualityVec
Definition: RPCPattern.h:49
L1RPCConfigRcd.h
ESHandle.h
RPCTriggerConfig::ReturnType
std::unique_ptr< L1RPCConfig > ReturnType
Definition: RPCTriggerConfig.cc:44
RPCConst::m_TOWER_COUNT
static const int m_TOWER_COUNT
Only half of the detector.
Definition: RPCConst.h:41
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
ESProducer.h
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
L1RPCConfigRcd
Definition: L1RPCConfigRcd.h:30
personalPlayback.fp
fp
Definition: personalPlayback.py:523
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
RPCTriggerConfig::produce
ReturnType produce(const L1RPCConfigRcd &)
Definition: RPCTriggerConfig.cc:91
FileInPath.h
edm::FileInPath
Definition: FileInPath.h:64
RPCTriggerConfig::m_ppt
int m_ppt
Definition: RPCTriggerConfig.cc:51
RPCPatternsParser
Definition: RPCPatternsParser.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
RPCPatternsParser.h
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
ModuleFactory.h
RPCPattern::RPCPatVec
std::vector< RPCPattern > RPCPatVec
Definition: RPCPattern.h:36
L1RPCConfig.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
Exception
Definition: hltDiff.cc:246
edm::ESProducer
Definition: ESProducer.h:101
ParameterSet.h
RPCTriggerConfig::RPCTriggerConfig
RPCTriggerConfig(const edm::ParameterSet &)
Definition: RPCTriggerConfig.cc:66
RPCTriggerConfig
Definition: RPCTriggerConfig.cc:39
RPCTriggerConfig::~RPCTriggerConfig
~RPCTriggerConfig() override
Definition: RPCTriggerConfig.cc:81
RPCTriggerConfig::m_patternsDir
std::string m_patternsDir
Definition: RPCTriggerConfig.cc:52