CMS 3D CMS Logo

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

#include <L1TriggerConfig/DTTPGConfigProducers/interface/DTConfigDBProducer.h>

Inheritance diagram for DTConfigDBProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 DTConfigDBProducer (const edm::ParameterSet &)
 Constructor. More...
 
std::auto_ptr< DTConfigManagerproduce (const DTConfigManagerRcd &)
 ES produce method. More...
 
 ~DTConfigDBProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Private Member Functions

DTConfigPedestals buildTrivialPedestals ()
 Build Config Pedestals : 110204 SV for debugging purpose ONLY. More...
 
void configFromCfg ()
 CB ??? 110204 SV for debugging purpose ONLY. More...
 
std::string mapEntryName (const DTChamberId &chambid) const
 
void readDBPedestalsConfig (const DTConfigManagerRcd &iRecord)
 Read DTTPG pedestal configuration. More...
 
int readDTCCBConfig (const DTConfigManagerRcd &iRecord)
 Read CCB string configuration. More...
 

Private Attributes

bool cfgConfig
 
bool flagDBBti
 
bool flagDBLUTS
 
bool flagDBTraco
 
bool flagDBTSM
 
bool flagDBTSS
 
int m_debugBti
 
bool m_debugDB
 
bool m_debugLUTs
 
bool m_debugPed
 
bool m_debugSC
 
int m_debugTraco
 
bool m_debugTSP
 
bool m_debugTST
 
bool m_debugTU
 
DTConfigManagerm_manager
 
edm::ParameterSet m_ps
 
bool m_UseT0
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

Description: A Producer for the DT config, data retrieved from DB

Implementation: <Notes on="" implementation>="">

Definition at line 45 of file DTConfigDBProducer.h.

Constructor & Destructor Documentation

DTConfigDBProducer::DTConfigDBProducer ( const edm::ParameterSet p)

Constructor.

Definition at line 35 of file DTConfigDBProducer.cc.

References cfgConfig, flagDBBti, flagDBLUTS, flagDBTraco, flagDBTSM, flagDBTSS, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_debugBti, m_debugDB, m_debugLUTs, m_debugPed, m_debugSC, m_debugTraco, m_debugTSP, m_debugTST, m_debugTU, m_manager, m_ps, m_UseT0, L1TEmulatorMonitor_cff::p, produce(), DTConfigManager::setDTTPGDebug(), DTConfigManager::setLutFromDB(), DTConfigManager::setUseAcceptParam(), and edm::ESProducer::setWhatProduced().

36 {
37  // tell the framework what record is being produced
39 
40  cfgConfig = p.getParameter<bool>("cfgConfig");
41 
42  // get and store parameter set and config manager pointer
43  m_ps = p;
44  m_manager = new DTConfigManager();
45 
46  // debug flags
47  m_debugDB = p.getParameter<bool>("debugDB");
48  m_debugBti = p.getParameter<int>("debugBti");
49  m_debugTraco = p.getParameter<int>("debugTraco");
50  m_debugTSP = p.getParameter<bool>("debugTSP");
51  m_debugTST = p.getParameter<bool>("debugTST");
52  m_debugTU = p.getParameter<bool>("debugTU");
53  m_debugSC = p.getParameter<bool>("debugSC");
54  m_debugLUTs = p.getParameter<bool>("debugLUTs");
55  m_debugPed = p.getParameter<bool>("debugPed");
56 
57  m_UseT0 = p.getParameter<bool>("UseT0"); // CB check for a better way to do it
58 
59  // DB specific requests
60  bool tracoLutsFromDB = p.getParameter<bool>("TracoLutsFromDB");
61  bool useBtiAcceptParam = p.getParameter<bool>("UseBtiAcceptParam");
62 
63  // set specific DB requests
64  m_manager->setLutFromDB(tracoLutsFromDB);
65  m_manager->setUseAcceptParam(useBtiAcceptParam);
66 
67  // initialize flags to check if data are present in OMDS
68  flagDBBti = false;
69  flagDBTraco = false;
70  flagDBTSS = false;
71  flagDBTSM = false;
72  flagDBLUTS = false;
73 
74  // set debug
75  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
76  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
77  m_manager->setDTTPGDebug(dttpgdebug);
78 }
std::auto_ptr< DTConfigManager > produce(const DTConfigManagerRcd &)
ES produce method.
void setLutFromDB(bool lutFromDB)
Set lut from DB flag.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setDTTPGDebug(bool debug)
SetGlobalDebug flag.
DTConfigManager * m_manager
edm::ParameterSet m_ps
void setUseAcceptParam(bool acceptparam)
Set the use of Bti acceptance parameters (LL,LH,CL,CH,RL,RH)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
DTConfigDBProducer::~DTConfigDBProducer ( )

Destructor.

Definition at line 81 of file DTConfigDBProducer.cc.

82 {
83 
84 }

Member Function Documentation

DTConfigPedestals DTConfigDBProducer::buildTrivialPedestals ( )
private

Build Config Pedestals : 110204 SV for debugging purpose ONLY.

Definition at line 636 of file DTConfigDBProducer.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_debugPed, m_ps, DTTimeUnits::ns, DTTPGParameters::set(), DTConfigPedestals::setES(), and DTConfigPedestals::setUseT0().

Referenced by configFromCfg(), and produce().

637 {
638  DTTPGParameters* m_tpgParams = new DTTPGParameters();
639 
640  int counts = m_ps.getParameter<int>("bxOffset");
641  float fine = m_ps.getParameter<double>("finePhase");
642 
643  if (m_debugPed)
644  cout << "DTConfigTrivialProducer::buildPedestals()" << endl;
645 
646  //DTTPGParameters tpgParams;
647  for (int iwh=-2;iwh<=2;++iwh){
648  for (int ist=1;ist<=4;++ist){
649  for (int ise=1;ise<=14;++ise){
650  if (ise>12 && ist!=4) continue;
651 
652  DTChamberId chId(iwh,ist,ise);
653  m_tpgParams->set(chId,counts,fine,DTTimeUnits::ns);
654  }
655  }
656  }
657 
658  DTConfigPedestals tpgPedestals;
659  tpgPedestals.setUseT0(false);
660  tpgPedestals.setES(m_tpgParams);
661 
662  return tpgPedestals;
663 
664 }
T getParameter(std::string const &) const
edm::ParameterSet m_ps
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=0)
Set parameters from ES.
void setUseT0(bool useT0)
Set t0i subtraction.
tuple cout
Definition: gather_cfg.py:41
void DTConfigDBProducer::configFromCfg ( )
private

CB ??? 110204 SV for debugging purpose ONLY.

Definition at line 495 of file DTConfigDBProducer.cc.

References buildTrivialPedestals(), gather_cfg::cout, flagDBBti, flagDBTraco, flagDBTSM, flagDBTSS, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_manager, m_ps, mapEntryName(), DTChamberId::sector(), DTConfigManager::setCCBConfigValidity(), DTConfigManager::setDTConfigBti(), DTConfigManager::setDTConfigPedestals(), DTConfigManager::setDTConfigSectColl(), DTConfigManager::setDTConfigTraco(), DTConfigManager::setDTConfigTrigUnit(), DTConfigManager::setDTConfigTSPhi(), DTConfigManager::setDTConfigTSTheta(), DTChamberId::station(), and DTChamberId::wheel().

Referenced by produce().

495  {
496 
497  // ... but still set CCB validity flag to let the emulator run
499 
500  //create config classes&C.
501  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
503  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
504  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
505  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
506  DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
507  DTConfigTraco tracoconf(tups.getParameter<edm::ParameterSet>("TracoParameters"));
508  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
509  DTConfigTSPhi tsphiconf(tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
510  DTConfigTrigUnit trigunitconf(tups);
511  DTConfigLUTs lutconf(tups.getParameter<edm::ParameterSet>("LutParameters"));
512 
513 
514  for (int iwh=-2;iwh<=2;++iwh){
515  for (int ist=1;ist<=4;++ist){
516  for (int ise=1;ise<=12;++ise){
517  DTChamberId chambid(iwh,ist,ise);
518  vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
519 
520  if(dttpgdebug)
521  {
522  cout << " Filling configuration for chamber : wh " << chambid.wheel() <<
523  ", st " << chambid.station() <<
524  ", se " << chambid.sector() << endl;
525  }
526 
527  //fill the bti map
528  if(!flagDBBti){
529  for (int isl=1;isl<=3;isl++){
530  int ncell = nmap[isl-1];
531  // cout << ncell <<" , ";
532  for (int ibti=0;ibti<ncell;ibti++){
533  m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
534  if(dttpgdebug)
535  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
536  ", st " << chambid.station() <<
537  ", se " << chambid.sector() <<
538  "... sl " << isl <<
539  ", bti " << ibti+1 << endl;
540  }
541  }
542  }
543 
544  // fill the traco map
545  if(!flagDBTraco){
546  int ntraco = nmap[3];
547  //cout << ntraco << " }" << endl;
548  for (int itraco=0;itraco<ntraco;itraco++){
549  m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
550  if(dttpgdebug)
551  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
552  ", st " << chambid.station() <<
553  ", se " << chambid.sector() <<
554  ", traco " << itraco+1 << endl;
555  }
556  }
557 
558  // fill TS & TrigUnit
559  if(!flagDBTSS || !flagDBTSM)
560  {
561  m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
562  m_manager->setDTConfigTSPhi(chambid,tsphiconf);
563  m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
564  }
565 
566  }
567  }
568  }
569 
570  for (int iwh=-2;iwh<=2;++iwh){
571  for (int ise=13;ise<=14;++ise){
572  int ist =4;
573  DTChamberId chambid(iwh,ist,ise);
574  vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
575 
576  if(dttpgdebug)
577  {
578  cout << " Filling configuration for chamber : wh " << chambid.wheel() <<
579  ", st " << chambid.station() <<
580  ", se " << chambid.sector() << endl;
581  }
582 
583  //fill the bti map
584  if(!flagDBBti){
585  for (int isl=1;isl<=3;isl++){
586  int ncell = nmap[isl-1];
587  // cout << ncell <<" , ";
588  for (int ibti=0;ibti<ncell;ibti++){
589  m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
590  if(dttpgdebug)
591  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
592  ", st " << chambid.station() <<
593  ", se " << chambid.sector() <<
594  "... sl " << isl <<
595  ", bti " << ibti+1 << endl;
596  }
597  }
598  }
599 
600  // fill the traco map
601  if(!flagDBTraco){
602  int ntraco = nmap[3];
603  // cout << ntraco << " }" << endl;
604  for (int itraco=0;itraco<ntraco;itraco++){
605  m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
606  if(dttpgdebug)
607  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
608  ", st " << chambid.station() <<
609  ", se " << chambid.sector() <<
610  ", traco " << itraco+1 << endl;
611  }
612  }
613 
614  // fill TS & TrigUnit
615  if(!flagDBTSS || !flagDBTSM)
616  {
617  m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
618  m_manager->setDTConfigTSPhi(chambid,tsphiconf);
619  m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
620  }
621  }
622  }
623 
624  //loop on Sector Collectors
625  for (int wh=-2;wh<=2;wh++)
626  for (int se=1;se<=12;se++)
627  m_manager->setDTConfigSectColl(DTSectCollId(wh,se),sectcollconf);
628 
629  //fake collection of pedestals
631 
632  return;
633 
634 }
std::string mapEntryName(const DTChamberId &chambid) const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTConfigManager * m_manager
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
edm::ParameterSet m_ps
DTConfigPedestals buildTrivialPedestals()
Build Config Pedestals : 110204 SV for debugging purpose ONLY.
void setDTConfigTraco(DTTracoId, DTConfigTraco)
Set DTConfigTraco for desired chip.
void setDTConfigBti(DTBtiId, DTConfigBti)
Set DTConfigBti for desired chip.
void setDTConfigTSPhi(DTChamberId chambid, DTConfigTSPhi conf)
Set DTConfigTSPhi for desired chip.
void setDTConfigPedestals(DTConfigPedestals pedestals)
Set DTConfigPedestals configuration.
void setDTConfigSectColl(DTSectCollId sectcollid, DTConfigSectColl conf)
Set DTConfigSectColl for desired chip.
void setCCBConfigValidity(bool CCBValid)
Set the flag for CCB configuration validity.
tuple cout
Definition: gather_cfg.py:41
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
std::string DTConfigDBProducer::mapEntryName ( const DTChamberId chambid) const
private

Definition at line 480 of file DTConfigDBProducer.cc.

References DTChamberId::sector(), DTChamberId::station(), and DTChamberId::wheel().

Referenced by configFromCfg().

481 {
482  int iwh = chambid.wheel();
483  std::ostringstream os;
484  os << "wh";
485  if (iwh < 0) {
486  os << 'm' << -iwh;
487  } else {
488  os << iwh;
489  }
490  os << "st" << chambid.station() << "se" << chambid.sector();
491  return os.str();
492 }
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
std::auto_ptr< DTConfigManager > DTConfigDBProducer::produce ( const DTConfigManagerRcd iRecord)

ES produce method.

Definition at line 91 of file DTConfigDBProducer.cc.

References buildTrivialPedestals(), cfgConfig, configFromCfg(), m_manager, readDBPedestalsConfig(), readDTCCBConfig(), DTConfigManager::setCCBConfigValidity(), and DTConfigManager::setLutFromDB().

Referenced by DTConfigDBProducer().

92 {
93  using namespace edm;
94 
95  int code;
96  if(cfgConfig){
97  m_manager->setLutFromDB(false);
98  configFromCfg();
100  code = 2;
101  } else{
102  code = readDTCCBConfig(iRecord);
103  readDBPedestalsConfig(iRecord); // no return code if fails exception is raised by ESHandle getter
104  }
105  if(code==-1) {
106  //throw cms::Exception("DTTPG") << "DTConfigDBProducer::produce : " << endl
107  // << "generic error pharsing DT CCB config strings." << endl
108  // << "Run module with debug flags enable to get more info" << endl;
110  } else if(code==2) {
111  LogVerbatim ("DTTPG") << "DTConfigDBProducer::produce : Trivial : " << endl
112  << "configurations has been read from cfg" << endl;
113  } else if(code==0) {
114  LogVerbatim ("DTTPG") << "DTConfigDBProducer::produce : " << endl
115  << "Configurations successfully read from OMDS" << endl;
116  } else {
117  LogProblem ("DTTPG") << "DTConfigDBProducer::produce : " << endl
118  << "Wrong congiguration rertun CODE" << endl;
119  }
120 
121  std::auto_ptr<DTConfigManager> dtConfig = std::auto_ptr<DTConfigManager>( m_manager );
122 
123  return dtConfig ;
124 }
void setLutFromDB(bool lutFromDB)
Set lut from DB flag.
DTConfigManager * m_manager
DTConfigPedestals buildTrivialPedestals()
Build Config Pedestals : 110204 SV for debugging purpose ONLY.
void setCCBConfigValidity(bool CCBValid)
Set the flag for CCB configuration validity.
void configFromCfg()
CB ??? 110204 SV for debugging purpose ONLY.
int readDTCCBConfig(const DTConfigManagerRcd &iRecord)
Read CCB string configuration.
void readDBPedestalsConfig(const DTConfigManagerRcd &iRecord)
Read DTTPG pedestal configuration.
void DTConfigDBProducer::readDBPedestalsConfig ( const DTConfigManagerRcd iRecord)
private

Read DTTPG pedestal configuration.

Definition at line 126 of file DTConfigDBProducer.cc.

References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_debugPed, m_manager, m_UseT0, edm::ESHandle< class >::product(), DTConfigPedestals::setDebug(), DTConfigManager::setDTConfigPedestals(), DTConfigPedestals::setES(), and DTConfigPedestals::setUseT0().

Referenced by produce().

126  {
127 
128  edm::ESHandle<DTTPGParameters> dttpgParams;
129  iRecord.getRecord<DTTPGParametersRcd>().get(dttpgParams);
130 
131  DTConfigPedestals pedestals;
132  pedestals.setDebug(m_debugPed);
133 
134  if (m_UseT0) {
135 
137  iRecord.getRecord<DTT0Rcd>().get(t0i);
138 
139  pedestals.setUseT0(true);
140  pedestals.setES(dttpgParams.product(),t0i.product());
141 
142  } else {
143 
144  pedestals.setUseT0(false);
145  pedestals.setES(dttpgParams.product());
146 
147  }
148 
149  m_manager->setDTConfigPedestals(pedestals);
150 
151 }
DTConfigManager * m_manager
void setDebug(bool debug)
Set debug flag.
void setES(DTTPGParameters const *tpgParams, DTT0 const *t0Params=0)
Set parameters from ES.
void setUseT0(bool useT0)
Set t0i subtraction.
void setDTConfigPedestals(DTConfigPedestals pedestals)
Set DTConfigPedestals configuration.
T const * product() const
Definition: ESHandle.h:62
Definition: DTT0Rcd.h:9
int DTConfigDBProducer::readDTCCBConfig ( const DTConfigManagerRcd iRecord)
private

Read CCB string configuration.

Definition at line 153 of file DTConfigDBProducer.cc.

References trackerHits::c, alignmentValidation::c1, gather_cfg::cout, end, flagDBBti, flagDBLUTS, flagDBTraco, flagDBTSM, flagDBTSS, DTPosNegType::getCT(), DTConfigAbstractHandler::getInstance(), edm::ParameterSet::getParameter(), DTPosNegType::getPN(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ParameterSet::getUntrackedParameter(), i, o2o::iov, list(), DTConfigManager::lutFromDB(), m_debugBti, m_debugDB, m_debugLUTs, m_debugSC, m_debugTraco, m_debugTSP, m_debugTST, m_debugTU, m_manager, m_ps, DTChamberId::sector(), DTCCBId::sectorId, DTConfigManager::setCCBConfigValidity(), DTConfigTrigUnit::setDebug(), DTConfigSectColl::setDebug(), DTConfigManager::setDTConfigBti(), DTConfigManager::setDTConfigLUTs(), DTConfigManager::setDTConfigSectColl(), DTConfigManager::setDTConfigTraco(), DTConfigManager::setDTConfigTrigUnit(), DTConfigManager::setDTConfigTSPhi(), DTConfigManager::setDTConfigTSTheta(), DTChamberId::station(), DTCCBId::stationId, edm::eventsetup::EventSetupRecord::validityInterval(), DTChamberId::wheel(), and DTCCBId::wheelId.

Referenced by produce().

154 {
155  using namespace edm::eventsetup;
156 
157  // initialize CCB validity flag
159 
160  // get DTCCBConfigRcd from DTConfigManagerRcd (they are dependent records)
162  iRecord.getRecord<DTCCBConfigRcd>().get(ccb_conf);
163  int ndata = std::distance( ccb_conf->begin(), ccb_conf->end() );
164 
166  const DTKeyedConfigListRcd& keyRecord = iRecord.getRecord<DTKeyedConfigListRcd>();
167 
168  if(m_debugDB)
169  {
170  cout << ccb_conf->version() << endl;
171  cout << ndata << " data in the container" << endl;
172  }
173 
175  unsigned int currValidityStart = iov.first().eventID().run();
176  unsigned int currValidityEnd = iov.last( ).eventID().run();
177 
178  if(m_debugDB)
179  cout << "valid since run " << currValidityStart
180  << " to run " << currValidityEnd << endl;
181 
182  // if there are no data in the container, configuration from cfg files...
183  if( ndata==0 ){
184  //throw cms::Exception("DTTPG") << "DTConfigDBProducer::readDTCCBConfig : " << endl
185  // << "DTCCBConfigRcd is empty!" << endl;
187  }
188 
189  // get DTTPGMap for retrieving bti number and traco number
191 
192  // loop over chambers
193  DTCCBConfig::ccb_config_map configKeys( ccb_conf->configKeyMap() );
194  DTCCBConfig::ccb_config_iterator iter = configKeys.begin();
195  DTCCBConfig::ccb_config_iterator iend = configKeys.end();
196 
197  // read data from CCBConfig
198  while ( iter != iend ) {
199  // get chamber id
200  const DTCCBId& ccbId = iter->first;
201  if(m_debugDB)
202  cout << " Filling configuration for chamber : wh " << ccbId.wheelId << " st "
203  << ccbId.stationId << " se "
204  << ccbId.sectorId << " -> " << endl;
205 
206  // get chamber type and id from ccbId
207  int mbtype = DTPosNegType::getCT( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
208  int posneg = DTPosNegType::getPN( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
209  if(m_debugDB)
210  cout << "Chamber type : " << mbtype
211  << " posneg : " << posneg << endl;
212  DTChamberId chambid(ccbId.wheelId, ccbId.stationId, ccbId.sectorId);
213 
214  // get brick identifiers list
215  const std::vector<int>& ccbConf = iter->second;
216  std::vector<int>::const_iterator cfgIter = ccbConf.begin();
217  std::vector<int>::const_iterator cfgIend = ccbConf.end();
218 
219  //TSS-TSM buffers
220  unsigned short int tss_buffer[7][31];
221  unsigned short int tsm_buffer[9];
222  int ntss=0;
223 
224  // loop over configuration bricks
225  while ( cfgIter != cfgIend ) {
226  // get brick identifier
227  int id = *cfgIter++;
228  if(m_debugDB)
229  cout << " BRICK " << id << endl;
230 
231  // create strings list
232  std::vector<std::string> list;
233  cfgCache->getData( keyRecord, id, list );
234 
235  // loop over strings
236  std::vector<std::string>::const_iterator s_iter = list.begin();
237  std::vector<std::string>::const_iterator s_iend = list.end();
238  while ( s_iter != s_iend ) {
239  if(m_debugDB)
240  cout << " ----> " << *s_iter << endl;
241 
242  // copy string in unsigned int buffer
243  std::string str = *s_iter++;
244  unsigned short int buffer[100]; //2 bytes
245  int c = 0;
246  const char* cstr = str.c_str();
247  const char* ptr = cstr + 2;
248  const char* end = cstr + str.length();
249  while ( ptr < end ) {
250  char c1 = *ptr++;
251  int i1 = 0;
252  if ( ( c1 >= '0' ) && ( c1 <= '9' ) ) i1 = c1 - '0';
253  if ( ( c1 >= 'a' ) && ( c1 <= 'f' ) ) i1 = 10 + c1 - 'a';
254  if ( ( c1 >= 'A' ) && ( c1 <= 'F' ) ) i1 = 10 + c1 - 'A';
255  char c2 = *ptr++;
256  int i2 = 0;
257  if ( ( c2 >= '0' ) && ( c2 <= '9' ) ) i2 = c2 - '0';
258  if ( ( c2 >= 'a' ) && ( c2 <= 'f' ) ) i2 = 10 + c2 - 'a';
259  if ( ( c2 >= 'A' ) && ( c2 <= 'F' ) ) i2 = 10 + c2 - 'A';
260  buffer[c] = ( i1 * 16 ) + i2;
261  c++;
262  }// end loop over string
263 
264  // BTI configuration string
265  if (buffer[2]==0x54){
266  if(m_debugDB)
267  cout << "BTI STRING found in DB" << endl;
268 
269  // BTI configuration read for BTI
270  flagDBBti = true;
271 
272  // compute sl and bti number from board and chip
273  int brd=buffer[3]; // Board Nr.
274  int chip=buffer[4]; // Chip Nr.
275 
276  if (brd>7) {
277  cout << "Not existing board ... " << brd << endl;
278  return -1; // Non-existing board
279  }
280  if (chip>31) {
281  cout << "Not existing chip... " << chip << endl;
282  return -1; // Non existing chip
283  }
284 
285  // Is it Phi or Theta board?
286  bool ThetaSL, PhiSL;
287  PhiSL=false;
288  ThetaSL=false;
289  switch (mbtype) {
290  case 1: // mb1
291  if (brd==6 || brd==7) {
292  ThetaSL=true;
293  brd-=6;
294  }
295  else if ((brd<3 && chip<32) || (brd==3 && chip<8))
296  PhiSL=true;
297  break;
298  case 2: // mb2
299  if (brd==6 || brd==7) {
300  ThetaSL=true;
301  brd-=6;
302  }
303  else if (brd<4 && chip<32)
304  PhiSL=true;
305  break;
306  case 3: // mb3
307  if (brd==6 || brd==7) {
308  ThetaSL=true;
309  brd-=6;
310  }
311  else if (brd<5 && chip<32)
312  PhiSL=true;
313  break;
314  case 4: // mb4-s, mb4_8
315  if (brd<6 && chip<32)
316  PhiSL=true;
317  break;
318  case 5: // mb4-9
319  if (brd<3 && chip<32)
320  PhiSL=true;
321  break;
322  case 6: // mb4-4
323  if (brd<5 && chip<32)
324  PhiSL=true;
325  break;
326  case 7: // mb4-10
327  if (brd<4 && chip<32)
328  PhiSL=true;
329  break;
330  }
331  if (!PhiSL && !ThetaSL) {
332  cout << "MB type " << mbtype << endl;
333  cout << "Board " << brd << " chip " <<chip << endl;
334  cout << "Not phi SL nor Theta SL" << endl;
335  return -1; // Not PhiSL nor ThetaSL
336  }
337 
338  // compute SL number and bti number
339  int isl;
340  int ibti;
341  if (PhiSL) {
342  if ((chip%8)<4)
343  isl=1; // Phi1
344  else
345  isl=3; // Phi2
346  ibti=brd*16+(int)(chip/8)*4+(chip%4);
347  }
348  else if (ThetaSL){
349  isl=2; // Theta
350  if ((chip%8)<4)
351  ibti=brd*32+ chip-4*(int)(chip/8);
352  else
353  ibti=brd*32+ chip+12-4*(int)(chip/8);
354  }
355 
356  // BTI config constructor from strings
357  DTConfigBti bticonf(m_debugBti,buffer);
358 
359  m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
360 
361  if(m_debugDB)
362  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
363  ", st " << chambid.station() <<
364  ", se " << chambid.sector() <<
365  "... sl " << isl <<
366  ", bti " << ibti+1 << endl;
367  }
368 
369  // TRACO configuration string
370  if (buffer[2]==0x15){
371  if(m_debugDB)
372  cout << "TRACO STRING found in DB" << endl;
373  // TRACO configuration read from OMDS
374  flagDBTraco = true;
375 
376  // TRACO config constructor from strings
377  int traco_brd = buffer[3]; // Board Nr.;
378  int traco_chip = buffer[4]; // Chip Nr.;
379  int itraco = traco_brd * 4 + traco_chip + 1;
380  DTConfigTraco tracoconf(m_debugTraco,buffer);
381  m_manager->setDTConfigTraco(DTTracoId(chambid,itraco),tracoconf);
382 
383  if(m_debugDB)
384  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
385  ", st " << chambid.station() <<
386  ", se " << chambid.sector() <<
387  ", board " << traco_brd <<
388  ", chip " << traco_chip <<
389  ", traco " << itraco << endl;
390  }
391 
392 
393  // TSS configuration string
394  if (buffer[2]==0x16){
395  if(m_debugDB)
396  cout << "TSS STRING found in DB" << endl;
397  // TSS configuration read from OMDS
398  flagDBTSS = true;
399 
400  unsigned short int itss=buffer[3];
401  for (int i=0;i<31;i++)
402  tss_buffer[itss][i]=buffer[i];
403  ntss++;
404  }
405 
406  // TSM configuration string
407  if (buffer[2]==0x17){
408  if(m_debugDB)
409  cout << "TSM STRING found in DB" << endl;
410 
411  // TSM configuration read from OMDS
412  flagDBTSM = true;
413 
414  for (int i=0; i<9; i++)
415  tsm_buffer[i]=buffer[i];
416  }
417 
418  // LUT configuration string
419  if (buffer[2]==0xA8){
420  if(m_debugDB)
421  cout << "LUT STRING found in DB" << endl;
422 
423  // LUT parameters read from OMDS
424  flagDBLUTS = true;
425  DTConfigLUTs lutconf(m_debugLUTs,buffer);
426  //lutconf.setDebug(m_debugLUTs);
427  m_manager->setDTConfigLUTs(chambid,lutconf);
428  }
429 
430  }//end string iteration
431  }//end brick iteration
432 
433  //TSS + TSM configurations are set in DTConfigTSPhi constructor
434  if(flagDBTSM && flagDBTSS) {
435  DTConfigTSPhi tsphiconf(m_debugTSP,tss_buffer,ntss,tsm_buffer);
436  m_manager->setDTConfigTSPhi(chambid,tsphiconf);
437  }
438 
439  // get configuration for TSTheta, SC and TU from .cfg
440  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
441  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
442 
443  // TSTheta configuration from .cfg
444  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
445  tsthetaconf.setDebug(m_debugTST);
446  m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
447 
448  // SC configuration from .cfg
449  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
450  sectcollconf.setDebug(m_debugSC);
451  m_manager->setDTConfigSectColl(DTSectCollId(chambid.wheel(),chambid.sector()),sectcollconf);
452 
453  // TU configuration from .cfg
454  DTConfigTrigUnit trigunitconf(tups);
455  trigunitconf.setDebug(m_debugTU);
456  m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
457 
458  ++iter;
459  }
460 
461  // moved to exception handling no attempt to configure from cfg is DB is missing
462  // SV comment exception handling and activate flag in DTConfigManager
463  if(!flagDBBti || !flagDBTraco || !flagDBTSS || !flagDBTSM ){
464  //throw cms::Exception("DTTPG") << "DTConfigDBProducer::readDTCCBConfig :" << endl
465  // << "(at least) part of the CCB strings needed to configure" << endl
466  // << "DTTPG emulator were not found in DTCCBConfigRcd" << endl;
468 
469  }
470  if(!flagDBLUTS && m_manager->lutFromDB()==true){
471  //throw cms::Exception("DTTPG") << "DTConfigDBProducer::readDTCCBConfig : " << endl
472  // << "Asked to configure the emulator using Lut seeds from DB "
473  // << "but no configuration parameters found in DTCCBConfigRcd." << endl;
475  }
476 
477  return 0;
478 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
DTConfigManager * m_manager
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
ccb_config_map::const_iterator ccb_config_iterator
Definition: DTCCBConfig.h:88
int wheelId
Definition: DTCCBConfig.h:43
edm::ParameterSet m_ps
int sectorId
Definition: DTCCBConfig.h:45
void setDTConfigTraco(DTTracoId, DTConfigTraco)
Set DTConfigTraco for desired chip.
static int getPN(int whe, int sec, int sta)
Definition: DTPosNegType.cc:89
tuple iov
Definition: o2o.py:307
int stationId
Definition: DTCCBConfig.h:44
void setDTConfigBti(DTBtiId, DTConfigBti)
Set DTConfigBti for desired chip.
void setDTConfigTSPhi(DTChamberId chambid, DTConfigTSPhi conf)
Set DTConfigTSPhi for desired chip.
#define end
Definition: vmac.h:38
std::vector< std::pair< DTCCBId, std::vector< int > > > ccb_config_map
Definition: DTCCBConfig.h:87
void setDTConfigLUTs(DTChamberId chambid, DTConfigLUTs conf)
Set DTConfigLUTs for desired chamber.
static int getCT(int whe, int sec, int sta)
void setDTConfigSectColl(DTSectCollId sectcollid, DTConfigSectColl conf)
Set DTConfigSectColl for desired chip.
bool lutFromDB() const
Lut from DB flag.
void setCCBConfigValidity(bool CCBValid)
Set the flag for CCB configuration validity.
tuple cout
Definition: gather_cfg.py:41
static DTConfigAbstractHandler * getInstance()
get static object
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
ValidityInterval const & validityInterval() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Data Documentation

bool DTConfigDBProducer::cfgConfig
private

Definition at line 92 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and produce().

bool DTConfigDBProducer::flagDBBti
private

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBLUTS
private

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTraco
private

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSM
private

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSS
private

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), DTConfigDBProducer(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugBti
private

Definition at line 80 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugDB
private

Definition at line 79 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugLUTs
private

Definition at line 86 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugPed
private
bool DTConfigDBProducer::m_debugSC
private

Definition at line 85 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugTraco
private

Definition at line 81 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTSP
private

Definition at line 82 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTST
private

Definition at line 83 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTU
private

Definition at line 84 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

DTConfigManager* DTConfigDBProducer::m_manager
private
edm::ParameterSet DTConfigDBProducer::m_ps
private
bool DTConfigDBProducer::m_UseT0
private

Definition at line 90 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDBPedestalsConfig().