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 ()
 SV for debugging purpose ONLY. More...
 
int checkDTCCBConfig (DTConfigManager &dttpgConfig)
 110629 SV function for CCB configuration check More...
 
void configFromCfg (DTConfigManager &dttpgConfig)
 SV for debugging purpose ONLY. More...
 
std::string mapEntryName (const DTChamberId &chambid) const
 
void readDBPedestalsConfig (const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
 Read DTTPG pedestal configuration. More...
 
int readDTCCBConfig (const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
 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
 
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
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- 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, edm::ParameterSet::getParameter(), m_debugBti, m_debugDB, m_debugLUTs, m_debugPed, m_debugSC, m_debugTraco, m_debugTSP, m_debugTST, m_debugTU, m_ps, m_UseT0, AlCaHLTBitMon_ParallelJobs::p, produce(), 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 
45  // debug flags
46  m_debugDB = p.getParameter<bool>("debugDB");
47  m_debugBti = p.getParameter<int>("debugBti");
48  m_debugTraco = p.getParameter<int>("debugTraco");
49  m_debugTSP = p.getParameter<bool>("debugTSP");
50  m_debugTST = p.getParameter<bool>("debugTST");
51  m_debugTU = p.getParameter<bool>("debugTU");
52  m_debugSC = p.getParameter<bool>("debugSC");
53  m_debugLUTs = p.getParameter<bool>("debugLUTs");
54  m_debugPed = p.getParameter<bool>("debugPed");
55 
56  m_UseT0 = p.getParameter<bool>("UseT0"); // CB check for a better way to do it
57 
58 }
std::auto_ptr< DTConfigManager > produce(const DTConfigManagerRcd &)
ES produce method.
T getParameter(std::string const &) const
edm::ParameterSet m_ps
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
DTConfigDBProducer::~DTConfigDBProducer ( )

Destructor.

Definition at line 61 of file DTConfigDBProducer.cc.

62 {
63 
64 }

Member Function Documentation

DTConfigPedestals DTConfigDBProducer::buildTrivialPedestals ( )
private

SV for debugging purpose ONLY.

Definition at line 753 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().

754 {
755  DTTPGParameters* m_tpgParams = new DTTPGParameters();
756 
757  int counts = m_ps.getParameter<int>("bxOffset");
758  float fine = m_ps.getParameter<double>("finePhase");
759 
760  if (m_debugPed)
761  cout << "DTConfigTrivialProducer::buildPedestals()" << endl;
762 
763  //DTTPGParameters tpgParams;
764  for (int iwh=-2;iwh<=2;++iwh){
765  for (int ist=1;ist<=4;++ist){
766  for (int ise=1;ise<=14;++ise){
767  if (ise>12 && ist!=4) continue;
768 
769  DTChamberId chId(iwh,ist,ise);
770  m_tpgParams->set(chId,counts,fine,DTTimeUnits::ns);
771  }
772  }
773  }
774 
775  DTConfigPedestals tpgPedestals;
776  tpgPedestals.setUseT0(false);
777  tpgPedestals.setES(m_tpgParams);
778 
779  return tpgPedestals;
780 
781 }
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:121
int DTConfigDBProducer::checkDTCCBConfig ( DTConfigManager dttpgConfig)
private

110629 SV function for CCB configuration check

Definition at line 149 of file DTConfigDBProducer.cc.

References DTConfigManager::getDTConfigBtiMap(), DTConfigManager::getDTConfigTracoMap(), DTConfigManager::getDTConfigTSPhi(), DTConfigTSPhi::nValidTSM(), and DTConfigTSPhi::nValidTSS().

Referenced by produce().

150 {
151  // 110627 SV test if configuration from CCB has correct number of chips,
152  // return error code:
153  // check_cfg_code = 1 : NO correct BTI number
154  // check_cfg_code = 2 : NO correct TRACO number
155  // check_cfg_code = 3 : NO correct valid TSS number
156  // check_cfg_code = 4 : NO correct valid TSM number
157 
158  int check_cfg_code = 0;
159 
160  // do not take chambers from MuonGeometryRecord to avoid geometry dependency
161  for(int iwh=-2;iwh<=2;iwh++){
162  for(int ise=1;ise<=12;ise++){
163  for(int ist=1;ist<=4;ist++){
164 
165  check_cfg_code = 0;
166  DTChamberId chid(iwh,ist,ise);
167 
168  //retrive number of configurated chip
169  int nbti = dttpgConfig.getDTConfigBtiMap(chid).size();
170  int ntraco = dttpgConfig.getDTConfigTracoMap(chid).size();
171  int ntss = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSS();
172  int ntsm = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSM();
173 
174  //check BTIs
175  if((ist==1 && nbti!=168) ||
176  (ist==2 && nbti!=192) ||
177  (ist==3 && nbti!=224) ||
178  (ist==4 && (ise==1||ise==2||ise==3||ise==5||ise==6||ise==7||ise==8||ise==12) && nbti!=192) ||
179  (ist==4 && (ise==9||ise==11) && nbti!=96) ||
180  (ist==4 && ise==10 && nbti!=128) ||
181  (ist==4 && ise==4 && nbti!=160)){
182  check_cfg_code = 1;
183  return check_cfg_code;
184  }
185 
186  //check TRACOs
187  if((ist==1 && ntraco!=13) ||
188  (ist==2 && ntraco!=16) ||
189  (ist==3 && ntraco!=20) ||
190  (ist==4 && (ise==1||ise==2||ise==3||ise==5||ise==6||ise==7||ise==8||ise==12) && ntraco!=24) ||
191  (ist==4 && (ise==9||ise==11) && ntraco!=12) ||
192  (ist==4 && ise==10 && ntraco!=16) ||
193  (ist==4 && ise==4 && ntraco!=20)){
194  check_cfg_code = 2;
195  return check_cfg_code;
196  }
197 
198  //check TSS
199  if((ist==1 && ntss!=4) ||
200  (ist==2 && ntss!=4) ||
201  (ist==3 && ntss!=5) ||
202  (ist==4 && (ise==1||ise==2||ise==3||ise==5||ise==6||ise==7||ise==8||ise==12) && ntss!=6) ||
203  (ist==4 && (ise==9||ise==11) && ntss!=3) ||
204  (ist==4 && ise==10 && ntss!=4) ||
205  (ist==4 && ise==4 && ntss!=5) ){
206  check_cfg_code = 3;
207  return check_cfg_code;
208  }
209 
210  //check TSM
211  if(ntsm!=1){
212  check_cfg_code = 4;
213  return check_cfg_code;
214  }
215 
216  //if(check_cfg_code){
217  //cout << "nbti " << nbti << " ntraco " << ntraco << " ntss " << ntss << " ntsm " << ntsm << endl;
218  //cout << "Check: ch " << ist << " sec " << ise << " wh " << iwh << " == >check_cfg_code " << check_cfg_code << endl;
219  //}
220  }// end st loop
221  }// end sec loop
222 
223  // SV MB4 has two more chambers
224  for(int ise=13;ise<=14;ise++){
225 
226  DTChamberId chid(iwh,4,ise);
227 
228  int nbti = dttpgConfig.getDTConfigBtiMap(chid).size();
229  int ntraco = dttpgConfig.getDTConfigTracoMap(chid).size();
230  int ntss = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSS();
231  int ntsm = dttpgConfig.getDTConfigTSPhi(chid)->nValidTSM();
232 
233  if((ise==13 && nbti != 160) ||
234  (ise==14 && nbti != 128)){
235  check_cfg_code = 1;
236  return check_cfg_code;
237  }
238  if((ise==13 && ntraco != 20) ||
239  (ise==14 && ntraco != 16)){
240  check_cfg_code = 2;
241  return check_cfg_code;
242  }
243  if((ise==13 && ntss != 5) ||
244  (ise==14 && ntss != 4)) {
245  check_cfg_code = 3;
246  return check_cfg_code;
247  }
248  if(ntsm != 1){
249  check_cfg_code = 4;
250  return check_cfg_code;
251  }
252  //if(check_cfg_code){
253  //cout << "nbti " << nbti << " ntraco " << ntraco << " ntss " << ntss << " ntsm " << ntsm << endl;
254  //cout << "Check: ch " << 4 << " sec " << ise << " wh " << iwh << " == >check_cfg_code " << check_cfg_code << endl;
255  //}
256  }// end sec 13 14
257 
258  }// end wh loop
259 
260  //cout << "CheckDTCCB: config OK! check_cfg_code = " << check_cfg_code << endl;
261  return check_cfg_code;
262 }
int nValidTSS()
Number of correctly configured TSS.
const std::map< DTBtiId, DTConfigBti > & getDTConfigBtiMap(DTChamberId) const
Get desired BTI configuration map for a given DTChamber.
const std::map< DTTracoId, DTConfigTraco > & getDTConfigTracoMap(DTChamberId) const
Get desired TRACO configuration map for a given DTChamber.
int nValidTSM()
Number of correctly configured TSS.
DTConfigTSPhi * getDTConfigTSPhi(DTChamberId) const
Get desired Trigger Server Phi configuration.
void DTConfigDBProducer::configFromCfg ( DTConfigManager dttpgConfig)
private

SV for debugging purpose ONLY.

Definition at line 612 of file DTConfigDBProducer.cc.

References buildTrivialPedestals(), gather_cfg::cout, flagDBBti, flagDBTraco, flagDBTSM, flagDBTSS, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), 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().

612  {
613 
614  // ... but still set CCB validity flag to let the emulator run
615  dttpgConfig.setCCBConfigValidity(true);
616 
617  //create config classes&C.
618  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
620  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
621  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
622  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
623  DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
624  DTConfigTraco tracoconf(tups.getParameter<edm::ParameterSet>("TracoParameters"));
625  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
626  DTConfigTSPhi tsphiconf(tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
627  DTConfigTrigUnit trigunitconf(tups);
628  DTConfigLUTs lutconf(tups.getParameter<edm::ParameterSet>("LutParameters"));
629 
630 
631  for (int iwh=-2;iwh<=2;++iwh){
632  for (int ist=1;ist<=4;++ist){
633  for (int ise=1;ise<=12;++ise){
634  DTChamberId chambid(iwh,ist,ise);
635  vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
636 
637  if(dttpgdebug)
638  {
639  cout << " Filling configuration for chamber : wh " << chambid.wheel() <<
640  ", st " << chambid.station() <<
641  ", se " << chambid.sector() << endl;
642  }
643 
644  //fill the bti map
645  if(!flagDBBti){
646  for (int isl=1;isl<=3;isl++){
647  int ncell = nmap[isl-1];
648  // cout << ncell <<" , ";
649  for (int ibti=0;ibti<ncell;ibti++){
650  dttpgConfig.setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
651  if(dttpgdebug)
652  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
653  ", st " << chambid.station() <<
654  ", se " << chambid.sector() <<
655  "... sl " << isl <<
656  ", bti " << ibti+1 << endl;
657  }
658  }
659  }
660 
661  // fill the traco map
662  if(!flagDBTraco){
663  int ntraco = nmap[3];
664  //cout << ntraco << " }" << endl;
665  for (int itraco=0;itraco<ntraco;itraco++){
666  dttpgConfig.setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
667  if(dttpgdebug)
668  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
669  ", st " << chambid.station() <<
670  ", se " << chambid.sector() <<
671  ", traco " << itraco+1 << endl;
672  }
673  }
674 
675  // fill TS & TrigUnit
676  if(!flagDBTSS || !flagDBTSM)
677  {
678  dttpgConfig.setDTConfigTSTheta(chambid,tsthetaconf);
679  dttpgConfig.setDTConfigTSPhi(chambid,tsphiconf);
680  dttpgConfig.setDTConfigTrigUnit(chambid,trigunitconf);
681  }
682 
683  }
684  }
685  }
686 
687  for (int iwh=-2;iwh<=2;++iwh){
688  for (int ise=13;ise<=14;++ise){
689  int ist =4;
690  DTChamberId chambid(iwh,ist,ise);
691  vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
692 
693  if(dttpgdebug)
694  {
695  cout << " Filling configuration for chamber : wh " << chambid.wheel() <<
696  ", st " << chambid.station() <<
697  ", se " << chambid.sector() << endl;
698  }
699 
700  //fill the bti map
701  if(!flagDBBti){
702  for (int isl=1;isl<=3;isl++){
703  int ncell = nmap[isl-1];
704  // cout << ncell <<" , ";
705  for (int ibti=0;ibti<ncell;ibti++){
706  dttpgConfig.setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
707  if(dttpgdebug)
708  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
709  ", st " << chambid.station() <<
710  ", se " << chambid.sector() <<
711  "... sl " << isl <<
712  ", bti " << ibti+1 << endl;
713  }
714  }
715  }
716 
717  // fill the traco map
718  if(!flagDBTraco){
719  int ntraco = nmap[3];
720  // cout << ntraco << " }" << endl;
721  for (int itraco=0;itraco<ntraco;itraco++){
722  dttpgConfig.setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
723  if(dttpgdebug)
724  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
725  ", st " << chambid.station() <<
726  ", se " << chambid.sector() <<
727  ", traco " << itraco+1 << endl;
728  }
729  }
730 
731  // fill TS & TrigUnit
732  if(!flagDBTSS || !flagDBTSM)
733  {
734  dttpgConfig.setDTConfigTSTheta(chambid,tsthetaconf);
735  dttpgConfig.setDTConfigTSPhi(chambid,tsphiconf);
736  dttpgConfig.setDTConfigTrigUnit(chambid,trigunitconf);
737  }
738  }
739  }
740 
741  //loop on Sector Collectors
742  for (int wh=-2;wh<=2;wh++)
743  for (int se=1;se<=12;se++)
744  dttpgConfig.setDTConfigSectColl(DTSectCollId(wh,se),sectcollconf);
745 
746  //fake collection of pedestals
748 
749  return;
750 
751 }
std::string mapEntryName(const DTChamberId &chambid) const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setDTConfigTSTheta(DTChamberId chambid, DTConfigTSTheta conf)
Set DTConfigTSTheta for desired chip.
edm::ParameterSet m_ps
DTConfigPedestals buildTrivialPedestals()
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:121
void setDTConfigTrigUnit(DTChamberId chambid, DTConfigTrigUnit conf)
Set DTConfigTrigUnit for desired chamber.
std::string DTConfigDBProducer::mapEntryName ( const DTChamberId chambid) const
private

Definition at line 597 of file DTConfigDBProducer.cc.

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

Referenced by configFromCfg().

598 {
599  int iwh = chambid.wheel();
600  std::ostringstream os;
601  os << "wh";
602  if (iwh < 0) {
603  os << 'm' << -iwh;
604  } else {
605  os << iwh;
606  }
607  os << "st" << chambid.station() << "se" << chambid.sector();
608  return os.str();
609 }
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 71 of file DTConfigDBProducer.cc.

References cfgConfig, checkDTCCBConfig(), configFromCfg(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_ps, readDBPedestalsConfig(), and readDTCCBConfig().

Referenced by DTConfigDBProducer().

72 {
73  using namespace edm;
74 
75  std::auto_ptr<DTConfigManager> dtConfig = std::auto_ptr<DTConfigManager>( new DTConfigManager() );
76  DTConfigManager & dttpgConfig = *(dtConfig.get());
77 
78  // DB specific requests
79  bool tracoLutsFromDB = m_ps.getParameter<bool>("TracoLutsFromDB");
80  bool useBtiAcceptParam = m_ps.getParameter<bool>("UseBtiAcceptParam");
81 
82  // set specific DB requests
83  dttpgConfig.setLutFromDB(tracoLutsFromDB);
84  dttpgConfig.setUseAcceptParam(useBtiAcceptParam);
85 
86  // set debug
87  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
88  bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
89  dttpgConfig.setDTTPGDebug(dttpgdebug);
90 
91  int code;
92  if(cfgConfig){
93  dttpgConfig.setLutFromDB(false);
94  configFromCfg(dttpgConfig);
95  code = 2;
96  } else{
97  code = readDTCCBConfig(iRecord,dttpgConfig);
98  readDBPedestalsConfig(iRecord,dttpgConfig);
99  // 110628 SV add config check
100  if(code != -1 && checkDTCCBConfig(dttpgConfig) > 0)
101  code=-1;
102  }
103  //cout << "DTConfigDBProducer::produce CODE " << code << endl;
104  if(code==-1) {
105  dttpgConfig.setCCBConfigValidity(false);
106  } else if(code==2) {
107  LogVerbatim ("DTTPG") << "DTConfigDBProducer::produce : Trivial : " << endl
108  << "configurations has been read from cfg" << endl;
109  } else if(code==0) {
110  LogVerbatim ("DTTPG") << "DTConfigDBProducer::produce : " << endl
111  << "Configurations successfully read from OMDS" << endl;
112  } else {
113  LogProblem ("DTTPG") << "DTConfigDBProducer::produce : " << endl
114  << "Wrong configuration return CODE" << endl;
115  }
116 
117  return dtConfig ;
118 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int readDTCCBConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read CCB string configuration.
edm::ParameterSet m_ps
int checkDTCCBConfig(DTConfigManager &dttpgConfig)
110629 SV function for CCB configuration check
void configFromCfg(DTConfigManager &dttpgConfig)
SV for debugging purpose ONLY.
void readDBPedestalsConfig(const DTConfigManagerRcd &iRecord, DTConfigManager &dttpgConfig)
Read DTTPG pedestal configuration.
void DTConfigDBProducer::readDBPedestalsConfig ( const DTConfigManagerRcd iRecord,
DTConfigManager dttpgConfig 
)
private

Read DTTPG pedestal configuration.

Definition at line 120 of file DTConfigDBProducer.cc.

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

Referenced by produce().

121  {
122 
123  edm::ESHandle<DTTPGParameters> dttpgParams;
124  iRecord.getRecord<DTTPGParametersRcd>().get(dttpgParams);
125 
126  DTConfigPedestals pedestals;
127  pedestals.setDebug(m_debugPed);
128 
129  if (m_UseT0) {
130 
132  iRecord.getRecord<DTT0Rcd>().get(t0i);
133 
134  pedestals.setUseT0(true);
135  pedestals.setES(dttpgParams.product(),t0i.product());
136  //cout << "checkDTCCBConfig CODE is " << checkDTCCBConfig() << endl;
137 
138  } else {
139 
140  pedestals.setUseT0(false);
141  pedestals.setES(dttpgParams.product());
142 
143  }
144 
145  dttpgConfig.setDTConfigPedestals(pedestals);
146 
147 }
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,
DTConfigManager dttpgConfig 
)
private

Read CCB string configuration.

Definition at line 264 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_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, AlCaHLTBitMon_QueryRunRegistry::string, edm::eventsetup::EventSetupRecord::validityInterval(), DTChamberId::wheel(), and DTCCBId::wheelId.

Referenced by produce().

266 {
267  using namespace edm::eventsetup;
268 
269  // initialize CCB validity flag
270  dttpgConfig.setCCBConfigValidity(true);
271 
272  // get DTCCBConfigRcd from DTConfigManagerRcd (they are dependent records)
274  iRecord.getRecord<DTCCBConfigRcd>().get(ccb_conf);
275  int ndata = std::distance( ccb_conf->begin(), ccb_conf->end() );
276 
278  const DTKeyedConfigListRcd& keyRecord = iRecord.getRecord<DTKeyedConfigListRcd>();
279 
280  if(m_debugDB)
281  {
282  cout << ccb_conf->version() << endl;
283  cout << ndata << " data in the container" << endl;
284  }
285 
287  unsigned int currValidityStart = iov.first().eventID().run();
288  unsigned int currValidityEnd = iov.last( ).eventID().run();
289 
290  if(m_debugDB)
291  cout << "valid since run " << currValidityStart
292  << " to run " << currValidityEnd << endl;
293 
294  // if there are no data in the container, configuration from cfg files...
295  if( ndata==0 ){
296  return -1;
297  }
298 
299  // get DTTPGMap for retrieving bti number and traco number
301 
302  // loop over chambers
303  DTCCBConfig::ccb_config_map configKeys( ccb_conf->configKeyMap() );
304  DTCCBConfig::ccb_config_iterator iter = configKeys.begin();
305  DTCCBConfig::ccb_config_iterator iend = configKeys.end();
306 
307  // 110628 SV check that number of CCB is equal to total number of chambers
308  if(ccb_conf->configKeyMap().size() != 250) //check the number of chambers!!!
309  return -1;
310 
311  // read data from CCBConfig
312  while ( iter != iend ) {
313  // 110628 SV moved here from constructor, to check config consistency for EVERY chamber
314  // initialize flags to check if data are present in OMDS
315  flagDBBti = false;
316  flagDBTraco = false;
317  flagDBTSS = false;
318  flagDBTSM = false;
319  flagDBLUTS = false;
320 
321  // get chamber id
322  const DTCCBId& ccbId = iter->first;
323  if(m_debugDB)
324  cout << " Filling configuration for chamber : wh " << ccbId.wheelId << " st "
325  << ccbId.stationId << " se "
326  << ccbId.sectorId << " -> " << endl;
327 
328  // get chamber type and id from ccbId
329  int mbtype = DTPosNegType::getCT( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
330  int posneg = DTPosNegType::getPN( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
331  if(m_debugDB)
332  cout << "Chamber type : " << mbtype
333  << " posneg : " << posneg << endl;
334  DTChamberId chambid(ccbId.wheelId, ccbId.stationId, ccbId.sectorId);
335 
336  // get brick identifiers list
337  const std::vector<int>& ccbConf = iter->second;
338  std::vector<int>::const_iterator cfgIter = ccbConf.begin();
339  std::vector<int>::const_iterator cfgIend = ccbConf.end();
340 
341  //TSS-TSM buffers
342  unsigned short int tss_buffer[7][31];
343  unsigned short int tsm_buffer[9];
344  int ntss=0;
345 
346  // loop over configuration bricks
347  while ( cfgIter != cfgIend ) {
348  // get brick identifier
349  int id = *cfgIter++;
350  if(m_debugDB)
351  cout << " BRICK " << id << endl;
352 
353  // create strings list
354  std::vector<std::string> list;
355  cfgCache->getData( keyRecord, id, list );
356 
357  // loop over strings
358  std::vector<std::string>::const_iterator s_iter = list.begin();
359  std::vector<std::string>::const_iterator s_iend = list.end();
360  while ( s_iter != s_iend ) {
361  if(m_debugDB)
362  cout << " ----> " << *s_iter << endl;
363 
364  // copy string in unsigned int buffer
365  std::string str = *s_iter++;
366  unsigned short int buffer[100]; //2 bytes
367  int c = 0;
368  const char* cstr = str.c_str();
369  const char* ptr = cstr + 2;
370  const char* end = cstr + str.length();
371  while ( ptr < end ) {
372  char c1 = *ptr++;
373  int i1 = 0;
374  if ( ( c1 >= '0' ) && ( c1 <= '9' ) ) i1 = c1 - '0';
375  if ( ( c1 >= 'a' ) && ( c1 <= 'f' ) ) i1 = 10 + c1 - 'a';
376  if ( ( c1 >= 'A' ) && ( c1 <= 'F' ) ) i1 = 10 + c1 - 'A';
377  char c2 = *ptr++;
378  int i2 = 0;
379  if ( ( c2 >= '0' ) && ( c2 <= '9' ) ) i2 = c2 - '0';
380  if ( ( c2 >= 'a' ) && ( c2 <= 'f' ) ) i2 = 10 + c2 - 'a';
381  if ( ( c2 >= 'A' ) && ( c2 <= 'F' ) ) i2 = 10 + c2 - 'A';
382  buffer[c] = ( i1 * 16 ) + i2;
383  c++;
384  }// end loop over string
385 
386  // BTI configuration string
387  if (buffer[2]==0x54){
388  if(m_debugDB)
389  cout << "BTI STRING found in DB" << endl;
390 
391  // BTI configuration read for BTI
392  flagDBBti = true;
393 
394  // compute sl and bti number from board and chip
395  int brd=buffer[3]; // Board Nr.
396  int chip=buffer[4]; // Chip Nr.
397 
398  if (brd>7) {
399  cout << "Not existing board ... " << brd << endl;
400  return -1; // Non-existing board
401  }
402  if (chip>31) {
403  cout << "Not existing chip... " << chip << endl;
404  return -1; // Non existing chip
405  }
406 
407  // Is it Phi or Theta board?
408  bool ThetaSL, PhiSL;
409  PhiSL=false;
410  ThetaSL=false;
411  switch (mbtype) {
412  case 1: // mb1
413  if (brd==6 || brd==7) {
414  ThetaSL=true;
415  brd-=6;
416  }
417  else if ((brd<3 && chip<32) || (brd==3 && chip<8))
418  PhiSL=true;
419  break;
420  case 2: // mb2
421  if (brd==6 || brd==7) {
422  ThetaSL=true;
423  brd-=6;
424  }
425  else if (brd<4 && chip<32)
426  PhiSL=true;
427  break;
428  case 3: // mb3
429  if (brd==6 || brd==7) {
430  ThetaSL=true;
431  brd-=6;
432  }
433  else if (brd<5 && chip<32)
434  PhiSL=true;
435  break;
436  case 4: // mb4-s, mb4_8
437  if (brd<6 && chip<32)
438  PhiSL=true;
439  break;
440  case 5: // mb4-9
441  if (brd<3 && chip<32)
442  PhiSL=true;
443  break;
444  case 6: // mb4-4
445  if (brd<5 && chip<32)
446  PhiSL=true;
447  break;
448  case 7: // mb4-10
449  if (brd<4 && chip<32)
450  PhiSL=true;
451  break;
452  }
453  if (!PhiSL && !ThetaSL) {
454  cout << "MB type " << mbtype << endl;
455  cout << "Board " << brd << " chip " <<chip << endl;
456  cout << "Not phi SL nor Theta SL" << endl;
457  return -1; // Not PhiSL nor ThetaSL
458  }
459 
460  // compute SL number and bti number
461  int isl;
462  int ibti;
463  if (PhiSL) {
464  if ((chip%8)<4)
465  isl=1; // Phi1
466  else
467  isl=3; // Phi2
468  ibti=brd*16+(int)(chip/8)*4+(chip%4);
469  }
470  else if (ThetaSL){
471  isl=2; // Theta
472  if ((chip%8)<4)
473  ibti=brd*32+ chip-4*(int)(chip/8);
474  else
475  ibti=brd*32+ chip+12-4*(int)(chip/8);
476  }
477 
478  // BTI config constructor from strings
479  DTConfigBti bticonf(m_debugBti,buffer);
480 
481  dttpgConfig.setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
482 
483  if(m_debugDB)
484  cout << "Filling BTI config for chamber : wh " << chambid.wheel() <<
485  ", st " << chambid.station() <<
486  ", se " << chambid.sector() <<
487  "... sl " << isl <<
488  ", bti " << ibti+1 << endl;
489  }
490 
491  // TRACO configuration string
492  if (buffer[2]==0x15){
493  if(m_debugDB)
494  cout << "TRACO STRING found in DB" << endl;
495  // TRACO configuration read from OMDS
496  flagDBTraco = true;
497 
498  // TRACO config constructor from strings
499  int traco_brd = buffer[3]; // Board Nr.;
500  int traco_chip = buffer[4]; // Chip Nr.;
501  int itraco = traco_brd * 4 + traco_chip + 1;
502  DTConfigTraco tracoconf(m_debugTraco,buffer);
503  dttpgConfig.setDTConfigTraco(DTTracoId(chambid,itraco),tracoconf);
504 
505  if(m_debugDB)
506  cout << "Filling TRACO config for chamber : wh " << chambid.wheel() <<
507  ", st " << chambid.station() <<
508  ", se " << chambid.sector() <<
509  ", board " << traco_brd <<
510  ", chip " << traco_chip <<
511  ", traco " << itraco << endl;
512  }
513 
514 
515  // TSS configuration string
516  if (buffer[2]==0x16){
517  if(m_debugDB)
518  cout << "TSS STRING found in DB" << endl;
519  // TSS configuration read from OMDS
520  flagDBTSS = true;
521 
522  unsigned short int itss=buffer[3];
523  for (int i=0;i<31;i++)
524  tss_buffer[itss][i]=buffer[i];
525  ntss++;
526  }
527 
528  // TSM configuration string
529  if (buffer[2]==0x17){
530  if(m_debugDB)
531  cout << "TSM STRING found in DB" << endl;
532 
533  // TSM configuration read from OMDS
534  flagDBTSM = true;
535 
536  for (int i=0; i<9; i++)
537  tsm_buffer[i]=buffer[i];
538  }
539 
540  // LUT configuration string
541  if (buffer[2]==0xA8){
542  if(m_debugDB)
543  cout << "LUT STRING found in DB" << endl;
544 
545  // LUT parameters read from OMDS
546  flagDBLUTS = true;
547  DTConfigLUTs lutconf(m_debugLUTs,buffer);
548  //lutconf.setDebug(m_debugLUTs);
549  dttpgConfig.setDTConfigLUTs(chambid,lutconf);
550  }
551 
552  }//end string iteration
553  }//end brick iteration
554 
555  //TSS + TSM configurations are set in DTConfigTSPhi constructor
556  if(flagDBTSM && flagDBTSS) {
557  DTConfigTSPhi tsphiconf(m_debugTSP,tss_buffer,ntss,tsm_buffer);
558  dttpgConfig.setDTConfigTSPhi(chambid,tsphiconf);
559  }
560 
561  // get configuration for TSTheta, SC and TU from .cfg
562  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
563  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
564 
565  // TSTheta configuration from .cfg
566  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
567  tsthetaconf.setDebug(m_debugTST);
568  dttpgConfig.setDTConfigTSTheta(chambid,tsthetaconf);
569 
570  // SC configuration from .cfg
571  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
572  sectcollconf.setDebug(m_debugSC);
573  dttpgConfig.setDTConfigSectColl(DTSectCollId(chambid.wheel(),chambid.sector()),sectcollconf);
574 
575  // TU configuration from .cfg
576  DTConfigTrigUnit trigunitconf(tups);
577  trigunitconf.setDebug(m_debugTU);
578  dttpgConfig.setDTConfigTrigUnit(chambid,trigunitconf);
579 
580  ++iter;
581 
582  // 110628 SV moved inside CCB loop to check for every chamber
583  // moved to exception handling no attempt to configure from cfg is DB is missing
584  // SV comment exception handling and activate flag in DTConfigManager
585  if(!flagDBBti || !flagDBTraco || !flagDBTSS || !flagDBTSM ){
586  return -1;
587  }
588  if(!flagDBLUTS && dttpgConfig.lutFromDB()==true){
589  return -1;
590  }
591  } // end loop over CCB
592 
593 
594  return 0;
595 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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:121
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 94 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and produce().

bool DTConfigDBProducer::flagDBBti
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBLUTS
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by readDTCCBConfig().

bool DTConfigDBProducer::flagDBTraco
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSM
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSS
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugBti
private

Definition at line 82 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugDB
private

Definition at line 81 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugLUTs
private

Definition at line 88 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

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

Definition at line 87 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugTraco
private

Definition at line 83 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTSP
private

Definition at line 84 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTST
private

Definition at line 85 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTU
private

Definition at line 86 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

edm::ParameterSet DTConfigDBProducer::m_ps
private
bool DTConfigDBProducer::m_UseT0
private

Definition at line 92 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDBPedestalsConfig().