CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes
EcalSRCondTools Class Reference

#include <EcalSRCondTools.h>

Inheritance diagram for EcalSRCondTools:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &es)
 
 EcalSRCondTools (const edm::ParameterSet &)
 
 ~EcalSRCondTools ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void importParameterSet (EcalSRSettings &sr, const edm::ParameterSet &ps)
 
static void importSrpConfigFile (EcalSRSettings &sr, std::istream &f, bool debug=false)
 
static double normalizeWeights (int hwWeight)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Static Private Member Functions

static std::string tokenize (const std::string &s, const std::string &delim, int &pos)
 
static std::string trim (std::string s)
 

Private Attributes

edm::ParameterSet ps_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 of file EcalSRCondTools.h.

Constructor & Destructor Documentation

EcalSRCondTools::EcalSRCondTools ( const edm::ParameterSet ps)

Constructor

Parameters
psanalyser configuration

Definition at line 62 of file EcalSRCondTools.cc.

62  :ps_(ps){
63 }
edm::ParameterSet ps_
EcalSRCondTools::~EcalSRCondTools ( )

Destructor

Definition at line 66 of file EcalSRCondTools.cc.

66  {
67 }

Member Function Documentation

void EcalSRCondTools::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
virtual

Called by CMSSW event loop

Parameters
evtthe event
esevents setup

Implements edm::EDAnalyzer.

Definition at line 70 of file EcalSRCondTools.cc.

References EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxGlobalOffset_, gather_cfg::cout, EcalCondDB::db, run_regression::done, edm::hlt::Exception, f, alignmentValidation::fname, edm::EventSetup::get(), EcalTPGPhysicsConst::getMap(), edm::ParameterSet::getParameter(), importParameterSet(), importSrpConfigFile(), edm::ESHandleBase::isValid(), alignBH_cfg::mode, edm::ESHandle< class >::product(), and ps_.

70  {
71  static bool done = false;
72  if(done) return;
74 
75  string mode = ps_.getParameter<string>("mode");
76  bool iomode;
77  const bool iomode_read = false;
78  const bool iomode_write = true;
79 
80  if(mode == "online_config" || mode == "combine_config"){
81  iomode =iomode_write;
82  string fname = ps_.getParameter<string>("onlineSrpConfigFile");
83  ifstream f(fname.c_str());
84  if(!f.good()){
85  throw cms::Exception("EcalSRCondTools") << "Failed to open file " << fname;
86  }
87  importSrpConfigFile(*sr, f, true);
88  }
89 
90  if(mode=="python_config" || mode=="combine_config"){
91  iomode = iomode_write;
92  importParameterSet(*sr, ps_);
93  }
94 
95  if(mode=="read"){
96  iomode = iomode_read;
97  }
98 
99  if(!(mode=="python_config" || mode == "online_config" || mode == "combine_config" || (mode=="read"))){
100  throw cms::Exception("Config") << "Invalid value," << mode << ", for parameter mode. "
101  << "Valid values: online_config, python_config, combine_config, read";
102  }
103 
104  if(iomode==iomode_write){
105  sr->bxGlobalOffset_ = ps_.getParameter<int>("bxGlobalOffset");
106  sr->automaticSrpSelect_ = ps_.getParameter<int>("automaticSrpSelect");
107  sr->automaticMasks_ = ps_.getParameter<int>("automaticMasks");
108 
110  if( !db.isAvailable() ){
111  throw cms::Exception("CondDBAccess") << "Failed to connect to PoolDBOutputService\n";
112  }
113  //fillup DB
114  //create new infinite IOV
115  cond::Time_t firstSinceTime = db->beginOfTime();
116  db->writeOne(sr,firstSinceTime,"EcalSRSettingsRcd");
117  done = true;
118  } else {//read mode
120  es.get<EcalSRSettingsRcd>().get(hSr);
121  if(!hSr.isValid()){
122  cout << "EcalSRSettings record not found. Check the Cond DB Global tag.\n";
123  } else{
124  const EcalSRSettings* sr = hSr.product();
125  cout << "ECAL Seletive readout settings:\n";
126  cout << *sr << "\n" << endl;
127  }
128 
129  //trigger tower thresholds (from FENIX configuration):
131  es.get<EcalTPGPhysicsConstRcd>().get(hTp);
132  if(!hTp.isValid()){
133  cout << "EcalTPGPhysicsConst record not found. Check the Cond DB Global tag.\n";
134  } else{
135  const EcalTPGPhysicsConst * tp = hTp.product();
136  const EcalTPGPhysicsConstMap mymap = tp->getMap();
137  if(mymap.size()!=2){
138  cout << "Error: TPG physics record is of unexpected size: "
139  << mymap.size() << " elements instead of two (one for EB, one for EE)\n";
140  } else{
141  EcalTPGPhysicsConstMap::const_iterator it=mymap.begin();
142  cout << "----------------------------------------------------------------------\n"
143  "Trigger tower Et thresholds extracted from TPG configuration \n"
144  "(EcalSRCondTools modules supports only read mode for these parameters):\n\n";
145  cout<< "EB: " << "LT = " << it->second.ttf_threshold_Low << " GeV "
146  << "HT = "<< it->second.ttf_threshold_High << " GeV\n";
147  ++it;
148  cout<< "EE: " << "LT = " << it->second.ttf_threshold_Low << " GeV "
149  << "HT = "<< it->second.ttf_threshold_High << " GeV\n";
150 
151  }
152  }
153  }
154 }
T getParameter(std::string const &) const
static void importSrpConfigFile(EcalSRSettings &sr, std::istream &f, bool debug=false)
edm::ParameterSet ps_
static void importParameterSet(EcalSRSettings &sr, const edm::ParameterSet &ps)
tuple db
Definition: EcalCondDB.py:151
unsigned long long Time_t
Definition: Time.h:16
double f[11][100]
const std::map< uint32_t, Item > & getMap() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
string fname
main script
tuple cout
Definition: gather_cfg.py:121
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
bool isValid() const
Definition: ESHandle.h:37
void EcalSRCondTools::importParameterSet ( EcalSRSettings sr,
const edm::ParameterSet ps 
)
static

Converts CMSSW python file selective readout setting ("parameter set") into a condition database object. Configuration from parameter set covers only part of the config, mainly the configuration needed for SR emulation in the MC. The parameters not supported by python configuration are left untouched in the sr object.

Parameters
sr[in] ECAL selective readout setting object to set
psCMSSW parameter set containing the SR parameters to set

Definition at line 156 of file EcalSRCondTools.cc.

References EcalSRSettings::actions_, filterCSVwithJSON::copy, EcalSRSettings::dccNormalizedWeights_, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, EcalSRSettings::ebDccAdcToGeV_, EcalSRSettings::ecalDccZs1stSample_, EcalSRSettings::eeDccAdcToGeV_, edm::ParameterSet::getParameter(), EcalSRSettings::srpHighInterestChannelZS_, EcalSRSettings::srpLowInterestChannelZS_, EcalSRSettings::symetricZS_, and w().

Referenced by analyze(), and EcalSelectiveReadoutProducer::EcalSelectiveReadoutProducer().

156  {
157  sr.deltaPhi_.resize(1);
158  sr.deltaPhi_[0] = ps.getParameter<int >("deltaPhi");
159  sr.deltaEta_.resize(1);
160  sr.deltaEta_[0] = ps.getParameter<int >("deltaEta");
161  sr.ecalDccZs1stSample_.resize(1);
162  sr.ecalDccZs1stSample_[0] = ps.getParameter<int >("ecalDccZs1stSample");
163  sr.ebDccAdcToGeV_ = ps.getParameter<double >("ebDccAdcToGeV");
164  sr.eeDccAdcToGeV_ = ps.getParameter<double >("eeDccAdcToGeV");
165  sr.dccNormalizedWeights_.resize(1);
166  const std::vector<double>& w = ps.getParameter<std::vector<double> >("dccNormalizedWeights");
167  sr.dccNormalizedWeights_[0].resize(w.size());
168  std::copy(w.begin(), w.end(), sr.dccNormalizedWeights_[0].begin());
169  sr.symetricZS_.resize(1);
170  sr.symetricZS_[0] = ps.getParameter<bool >("symetricZS");
171  sr.srpLowInterestChannelZS_.resize(2);
172  const int eb = 0;
173  const int ee = 1;
174  sr.srpLowInterestChannelZS_[eb] = ps.getParameter<double >("srpBarrelLowInterestChannelZS");
175  sr.srpLowInterestChannelZS_[ee] = ps.getParameter<double >("srpEndcapLowInterestChannelZS");
176  sr.srpHighInterestChannelZS_.resize(2);
177  sr.srpHighInterestChannelZS_[eb] = ps.getParameter<double >("srpBarrelHighInterestChannelZS");
178  sr.srpHighInterestChannelZS_[ee] = ps.getParameter<double >("srpEndcapHighInterestChannelZS");
179  //sr.trigPrimBypass_.resize(1);
180  //sr.trigPrimBypass_[0] = ps.getParameter<bool >("trigPrimBypass");
181  //sr.trigPrimBypassMode_.resize(1);
182  //sr.trigPrimBypassMode_[0] = ps.getParameter<int >("trigPrimBypassMode");
183  //sr.trigPrimBypassLTH_.resize(1);
184  //sr.trigPrimBypassLTH_[0] = ps.getParameter<double >("trigPrimBypassLTH");
185  //sr.trigPrimBypassHTH_.resize(1);
186  //sr.trigPrimBypassHTH_[0] = ps.getParameter<double >("trigPrimBypassHTH");
187  //sr.trigPrimBypassWithPeakFinder_.resize(1);
188  //sr.trigPrimBypassWithPeakFinder_[0] = ps.getParameter<bool >("trigPrimBypassWithPeakFinder");
189  //sr.defaultTtf_.resize(1);
190  //sr.defaultTtf_[0] = ps.getParameter<int >("defaultTtf");
191  sr.actions_ = ps.getParameter<std::vector<int> >("actions");
192 }
T getParameter(std::string const &) const
std::vector< std::vector< float > > dccNormalizedWeights_
std::vector< float > srpHighInterestChannelZS_
std::vector< int > actions_
std::vector< int > ecalDccZs1stSample_
std::vector< int > deltaPhi_
std::vector< int > symetricZS_
float ebDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EB.
std::vector< float > srpLowInterestChannelZS_
std::vector< int > deltaEta_
T w() const
float eeDccAdcToGeV_
ADC to GeV conversion factor used in ZS filter for EE.
void EcalSRCondTools::importSrpConfigFile ( EcalSRSettings sr,
std::istream &  f,
bool  debug = false 
)
static

Imports an SRP configuration file (stored in database "CLOB") into a Selective readout setting object.

Parameters
sr[in] ECAL selective readout setting object to set
fconfiguration file stream. A stringstream can be used if the configuration is available as an stl string of a c-string: stringstream buf; buf << s;
debugverbosity flag. If true, imported parameter are displayed on stdout.

Definition at line 194 of file EcalSRCondTools.cc.

References EcalSRSettings::actions_, EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxOffsets_, gather_cfg::cout, EcalSRSettings::dccMasks_, dccNum, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, edm::hlt::Exception, geometryCSVtoXML::line, nChs, EcalSRSettings::nDccs_, EcalSRSettings::nSrps_, EcalSRSettings::nTccs_, EcalSRSettings::srfMasks_, EcalSRSettings::srpMasksFromConfig_, EcalSRSettings::substitutionSrfs_, EcalSRSettings::tccMasksFromConfig_, tccNum, EcalSRSettings::testerDccTestSrpIds_, EcalSRSettings::testerSrpEmuSrpIds_, EcalSRSettings::testerSrpTestSrpIds_, EcalSRSettings::testerTccEmuSrpIds_, tokenize(), trim(), and relativeConstraints::value.

Referenced by analyze(), and popcon::EcalSRPHandler::getNewObjects().

194  {
195  //initialize vectors:
196  sr.deltaEta_ = vector<int>(1,0);
197  sr.deltaPhi_ = vector<int>(1,0);
198  sr.actions_ = vector<int>(4, 0);
199  sr.tccMasksFromConfig_ = vector<short>(EcalSRSettings::nTccs_, 0);
200  sr.srpMasksFromConfig_ = vector<vector<short> >(EcalSRSettings::nSrps_, vector<short>(8, 0));
201  sr.dccMasks_ = vector<short>(EcalSRSettings::nDccs_);
202  sr.srfMasks_ = vector<short>(EcalSRSettings::nDccs_);
203  sr.substitutionSrfs_ = vector<vector<short> >(EcalSRSettings::nSrps_, vector<short>(68,0));
204  sr.testerTccEmuSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
205  sr.testerSrpEmuSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
206  sr.testerDccTestSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
207  sr.testerSrpTestSrpIds_ = vector<int>(EcalSRSettings::nSrps_, 0);
208  sr.bxOffsets_ = vector<short>(EcalSRSettings::nSrps_, 0);
209  sr.automaticMasks_ = 0;
210  sr.automaticSrpSelect_ = 0;
211 
212  //string line;
213  int iLine = 0;
214  int iValueSet = -1;
215  const int nValueSets = 6*EcalSRSettings::nSrps_+9;
216  string line;
217  stringstream sErr("");
218  while(!f.eof() && sErr.str().empty()){
219  getline(f, line);
220  ++iLine;
221  line = trim(line);
222  if(line[0] == '#' || line.empty()){//comment line and empty line to ignore
223  continue;
224  } else{
225  ++iValueSet;
226  }
227  if(iValueSet>=nValueSets) break;
228  uint32_t value;
229  string sValue;
230  int pos = 0;
231  int iCh = 0;
232  int nChs[nValueSets] = {
233  //TCC masks: 0-11
234  12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
235  //SRP masks: 12-23
236  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
237  //DCC masks: 24-35
238  12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
239  //SRF Masks: 36-47
240  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
241  //substitution SRFs: 48-59
242  68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
243  //Tester card to emulate or test: 60-71
244  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
245  //Bx offsets: 72
246  12,
247  //algo type: 73
248  1,
249  //action flags: 74
250  4,
251  //pattern file directory: 75
252  1,
253  //VME slots: 76
254  12,
255  //card types: 77
256  12,
257  //config Mode
258  1,
259  //VME Interface card
260  1,
261  //Spy Mode
262  12,
263  };
264 
265  while(((sValue = tokenize(line, " \t", pos))!=string(""))
266  && (iCh<nChs[iValueSet]) && sErr.str().empty()){
267  value = strtoul(sValue.c_str(), 0, 0);
268  const int iSrp = iValueSet%EcalSRSettings::nSrps_;
269  if(iValueSet<12){//TCC
270  assert((unsigned)iSrp < sizeof(tccNum) / sizeof(tccNum[0]));
271  assert((unsigned)iCh < sizeof(tccNum[0]) / sizeof(tccNum[0][0]));
272  int tcc = tccNum[iSrp][iCh];
273  if(tcc>=0) {
274  if(d) cout << "tccMasksFromConfig_[" << tcc << "] <- "
275  << value << "\n";
276  sr.tccMasksFromConfig_[tcc-1] = value;
277  }
278  } else if(iValueSet<24){//SRP-SRP
279  if(d) cout << "srpMasks_[" << iSrp << "][" << iCh << "] <- "
280  << value << "\n";
281  sr.srpMasksFromConfig_[iSrp][iCh] = value;
282  } else if(iValueSet<36) {//DCC output
283  assert((unsigned)iSrp < sizeof(dccNum) / sizeof(dccNum[0]));
284  assert((unsigned)iCh < sizeof(dccNum[0]) / sizeof(dccNum[0][0]));
285  int dcc = dccNum[iSrp][iCh];
286  if(dcc > 0){
287  assert((unsigned)(dcc-1) < sr.dccMasks_.size());
288  if(d) cout << "dccMasks_[" << (dcc-1) << "] <- "
289  << value << "\n";
290  sr.dccMasks_[dcc-1] = value;
291  }
292  } else if(iValueSet<48){//SRF masks
293  assert((unsigned)iSrp < sizeof(dccNum) / sizeof(dccNum[0]));
294  assert((unsigned)iCh < sizeof(dccNum[0]) / sizeof(dccNum[0][0]));
295  int dcc = dccNum[iSrp][iCh];
296  if(dcc > 0){
297  if(d) cout << "srfMasks_[" << (dcc-1) << "] <- "
298  << value << "\n";
299  assert((unsigned)(dcc-1) < sr.srfMasks_.size());
300  sr.srfMasks_[dcc-1] = value;
301  }
302  } else if(iValueSet<60){//substiution SRFs
303  assert((unsigned)iSrp < sr.substitutionSrfs_.size());
304  assert((unsigned)iCh < sr.substitutionSrfs_[0].size());
305  if(d) cout << "substitutionMasks_[" << iSrp << "][" << iCh << "] <- "
306  << value << "\n";
307  sr.substitutionSrfs_[iSrp][iCh] = value;
308  } else if(iValueSet<72){//Tester card config
309  switch(iCh){
310  case 0:
311  assert((unsigned)iSrp < sr.testerTccEmuSrpIds_.size());
312  if(d) cout << "testerTccEmuSrpIds_[" << iSrp << "] <- "
313  << value << "\n";
314  sr.testerTccEmuSrpIds_[iSrp] = value;
315  break;
316  case 1:
317  assert((unsigned)iSrp < sr.testerSrpEmuSrpIds_.size());
318  if(d) cout << "testerSrpEmuSrpIds_[" << iSrp << "] <- "
319  << value << "\n";
320  sr.testerSrpEmuSrpIds_[iSrp] = value;
321  break;
322  case 2:
323  assert((unsigned)iSrp < sr.testerDccTestSrpIds_.size());
324  if(d) cout << "testerDccTestSrpIds_[" << iSrp << "] <- "
325  << value << "\n";
326  sr.testerDccTestSrpIds_[iSrp] = value;
327  break;
328  case 3:
329  assert((unsigned)iSrp < sr.testerSrpTestSrpIds_.size());
330  if(d) cout << "testerSrpTestSrpIds_[" << iSrp << "] <- "
331  << value << "\n";
332  sr.testerSrpTestSrpIds_[iSrp] = value;
333  break;
334  default:
335  sErr << "Syntax error in SRP system configuration "
336  << " line " << iLine << ".";
337  }
338  } else if(iValueSet<73){//bx offsets
339  assert((unsigned)iCh < sr.bxOffsets_.size());
340  if(d) cout << "bxOffset_[" << iCh << "] <- "
341  << value << "\n";
342  sr.bxOffsets_[iCh] = value;
343  } else if(iValueSet<74){//algo type
344  int algo = value;
345  switch(algo){
346  case 0:
347  sr.deltaEta_[0] = sr.deltaPhi_[0] = 1;
348  break;
349  case 1:
350  sr.deltaEta_[0] = sr.deltaPhi_[0] = 2;
351  break;
352  default:
353  throw cms::Exception("OutOfRange") << "Value of parameter algo ," << algo
354  << ", is invalid. Valid values are 0 and 1.";
355  }
356  if(d) cout << "deltaEta_[0] <- " << sr.deltaEta_[0] << "\t"
357  << "deltaPhi_[0] <- " << sr.deltaPhi_[0] << "\n";
358  } else if(iValueSet<75){//action flags
359  assert((unsigned)iCh < sr.actions_.size());
360  if(d) cout << "actions_[" << iCh << "] <- "
361  << value << "\n";
362  sr.actions_[iCh] = value;
363  } else if(iValueSet<76){//pattern file directory
364 // emuDir_ = sValue;
365 // if(d) cout << "emuDir_ <= "
366 // << value << "\n";
367  } else if(iValueSet<77){//VME slots
368  // slotIds_[iCh] = value;
369  // if(d) cout << "slotIds_[" << iCh << "] <= "
370  // << value << "\n";
371  } else if(iValueSet<78){//card types
372  // cardTypes_[iCh] = sValue[0];
373  // if(d) cout << "cardTypes_[" << iCh << "] <= "
374  // << value << "\n";
375  } else if (iValueSet<79){//config mode
376  //TODO validity check on value
377  // configMode_ = (ConfigMode)value;
378  // if(d) cout << "config mode <= " << value << "\n";
379  } else if (iValueSet<80){//VME I/F
380  //TODO validity check on value
381  // vmeInterface_ = (Vme::type_t)value;
382  //if(d) cout << "Vme Interface code <= " << value << "\n";
383  } else if (iValueSet<81){//Spy Mode
384  //TODO validity check on value
385  // spyMode_[iCh] = value & 0x3;
386  // if(d) cout << "Spy mode <= " << value << "\n";
387  } else{//should never be reached!
388  assert(false);
389  }
390  ++iCh;
391  }
392  if(iCh!=nChs[iValueSet]){//error
393  sErr << "Syntax error in imported SRP system configuration file "
394  /*<< filename <<*/ " line " << iLine << ".";
395  }
396  }
397  if(sErr.str().empty() && iValueSet!=(nValueSets-1)){//error
398  sErr << "Syntax Error in imported SRP system configuration file "
399  /*<< filename <<*/ " line " << iLine << ".";
400  }
401  if(sErr.str().size()!=0) throw cms::Exception("SyntaxError") << sErr.str();
402 }
static const int nTccs_
static const int nDccs_
static std::string tokenize(const std::string &s, const std::string &delim, int &pos)
constexpr int tccNum[12][12]
std::vector< short > srfMasks_
std::vector< int > testerSrpEmuSrpIds_
static std::string trim(std::string s)
std::vector< int > actions_
const int nChs
constexpr int dccNum[12][12]
std::vector< std::vector< short > > substitutionSrfs_
std::vector< int > testerDccTestSrpIds_
double f[11][100]
std::vector< short > tccMasksFromConfig_
std::vector< short > bxOffsets_
std::vector< short > dccMasks_
std::vector< int > deltaPhi_
std::vector< int > testerTccEmuSrpIds_
std::vector< int > deltaEta_
std::vector< int > testerSrpTestSrpIds_
tuple cout
Definition: gather_cfg.py:121
static const int nSrps_
std::vector< std::vector< short > > srpMasksFromConfig_
double EcalSRCondTools::normalizeWeights ( int  hwWeight)
static

convert hardware weights (interger weights) into normalized weights. The former reprensentation is used in DCC firmware and in online databaser, while the later is used in offline software.

Definition at line 404 of file EcalSRCondTools.cc.

404  {
405  //Fix sign bit in case only the 12 least significant bits of hwWeight were set
406  //(hardware reprensentation uses only 12 bits)
407  if(hwWeight & (1<<11)) hwWeight |= ~0xEFF;
408  return hwWeight/1024.;
409 }
string EcalSRCondTools::tokenize ( const std::string &  s,
const std::string &  delim,
int &  pos 
)
staticprivate

Help function to tokenize a string

Parameters
sstring to parse token delimiters internal string position pointer. Must be set to zero before the first call

Definition at line 411 of file EcalSRCondTools.cc.

References spr::find().

Referenced by importSrpConfigFile().

411  {
412  if(pos<0) return "";
413  int pos0 = pos;
414  int len = s.size();
415  //eats delimeters at beginning of the string
416  while(pos0<len && find(delim.begin(), delim.end(), s[pos0])!=delim.end()){
417  ++pos0;
418  }
419  if(pos0==len) return "";
420  pos = s.find_first_of(delim, pos0);
421  return s.substr(pos0, (pos>0?pos:len)-pos0);
422 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::string EcalSRCondTools::trim ( std::string  s)
staticprivate

Help function to trim spaces at beginning and end of a string

Parameters
sstring to trim

Definition at line 424 of file EcalSRCondTools.cc.

Referenced by importSrpConfigFile().

424  {
425  std::string::size_type pos0 = s.find_first_not_of(" \t");
426  if(pos0==string::npos){
427  pos0=0;
428  }
429  string::size_type pos1 = s.find_last_not_of(" \t") + 1;
430  if(pos1==string::npos){
431  pos1 = pos0;
432  }
433  return s.substr(pos0, pos1-pos0);
434 }
uint16_t size_type

Member Data Documentation

edm::ParameterSet EcalSRCondTools::ps_
private

Definition at line 72 of file EcalSRCondTools.h.

Referenced by analyze().