CMS 3D CMS Logo

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::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &es) override
 
 EcalSRCondTools (const edm::ParameterSet &)
 
 ~EcalSRCondTools () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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

bool done_
 
edm::ParameterSet ps_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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),done_(false){
63 }
edm::ParameterSet ps_
EcalSRCondTools::~EcalSRCondTools ( )
override

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 
)
override

Called by CMSSW event loop

Parameters
evtthe event
esevents setup

Definition at line 70 of file EcalSRCondTools.cc.

References EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxGlobalOffset_, gather_cfg::cout, done_, Exception, f, alignmentValidation::fname, edm::EventSetup::get(), EcalTPGPhysicsConst::getMap(), edm::ParameterSet::getParameter(), importParameterSet(), importSrpConfigFile(), edm::ESHandleBase::isValid(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, edm::ESHandle< T >::product(), and ps_.

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

References EcalSRSettings::actions_, popcon2dropbox::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().

153  {
154  sr.deltaPhi_.resize(1);
155  sr.deltaPhi_[0] = ps.getParameter<int >("deltaPhi");
156  sr.deltaEta_.resize(1);
157  sr.deltaEta_[0] = ps.getParameter<int >("deltaEta");
158  sr.ecalDccZs1stSample_.resize(1);
159  sr.ecalDccZs1stSample_[0] = ps.getParameter<int >("ecalDccZs1stSample");
160  sr.ebDccAdcToGeV_ = ps.getParameter<double >("ebDccAdcToGeV");
161  sr.eeDccAdcToGeV_ = ps.getParameter<double >("eeDccAdcToGeV");
162  sr.dccNormalizedWeights_.resize(1);
163  const std::vector<double>& w = ps.getParameter<std::vector<double> >("dccNormalizedWeights");
164  sr.dccNormalizedWeights_[0].resize(w.size());
165  std::copy(w.begin(), w.end(), sr.dccNormalizedWeights_[0].begin());
166  sr.symetricZS_.resize(1);
167  sr.symetricZS_[0] = ps.getParameter<bool >("symetricZS");
168  sr.srpLowInterestChannelZS_.resize(2);
169  const int eb = 0;
170  const int ee = 1;
171  sr.srpLowInterestChannelZS_[eb] = ps.getParameter<double >("srpBarrelLowInterestChannelZS");
172  sr.srpLowInterestChannelZS_[ee] = ps.getParameter<double >("srpEndcapLowInterestChannelZS");
173  sr.srpHighInterestChannelZS_.resize(2);
174  sr.srpHighInterestChannelZS_[eb] = ps.getParameter<double >("srpBarrelHighInterestChannelZS");
175  sr.srpHighInterestChannelZS_[ee] = ps.getParameter<double >("srpEndcapHighInterestChannelZS");
176  //sr.trigPrimBypass_.resize(1);
177  //sr.trigPrimBypass_[0] = ps.getParameter<bool >("trigPrimBypass");
178  //sr.trigPrimBypassMode_.resize(1);
179  //sr.trigPrimBypassMode_[0] = ps.getParameter<int >("trigPrimBypassMode");
180  //sr.trigPrimBypassLTH_.resize(1);
181  //sr.trigPrimBypassLTH_[0] = ps.getParameter<double >("trigPrimBypassLTH");
182  //sr.trigPrimBypassHTH_.resize(1);
183  //sr.trigPrimBypassHTH_[0] = ps.getParameter<double >("trigPrimBypassHTH");
184  //sr.trigPrimBypassWithPeakFinder_.resize(1);
185  //sr.trigPrimBypassWithPeakFinder_[0] = ps.getParameter<bool >("trigPrimBypassWithPeakFinder");
186  //sr.defaultTtf_.resize(1);
187  //sr.defaultTtf_[0] = ps.getParameter<int >("defaultTtf");
188  sr.actions_ = ps.getParameter<std::vector<int> >("actions");
189 }
T getParameter(std::string const &) const
const double w
Definition: UKUtility.cc:23
def copy(args, dbName)
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_
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 191 of file EcalSRCondTools.cc.

References EcalSRSettings::actions_, patPFMETCorrections_cff::algo, EcalSRSettings::automaticMasks_, EcalSRSettings::automaticSrpSelect_, EcalSRSettings::bxOffsets_, gather_cfg::cout, EcalSRSettings::dccMasks_, dccNum, EcalSRSettings::deltaEta_, EcalSRSettings::deltaPhi_, Exception, mps_splice::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().

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

401  {
402  //Fix sign bit in case only the 12 least significant bits of hwWeight were set
403  //(hardware reprensentation uses only 12 bits)
404  if(hwWeight & (1<<11)) hwWeight |= ~0xEFF;
405  return hwWeight/1024.;
406 }
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 408 of file EcalSRCondTools.cc.

References spr::find().

Referenced by importSrpConfigFile().

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

Referenced by importSrpConfigFile().

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

Member Data Documentation

bool EcalSRCondTools::done_
private

Definition at line 74 of file EcalSRCondTools.h.

Referenced by analyze().

edm::ParameterSet EcalSRCondTools::ps_
private

Definition at line 72 of file EcalSRCondTools.h.

Referenced by analyze().