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

DTKeyedConfigCache cfgCache
 
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 47 of file DTConfigDBProducer.h.

Constructor & Destructor Documentation

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

Constructor.

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

35 {
36  // tell the framework what record is being produced
38 
39  cfgConfig = p.getParameter<bool>("cfgConfig");
40 
41  // get and store parameter set and config manager pointer
42  m_ps = p;
43 
44  // debug flags
45  m_debugDB = p.getParameter<bool>("debugDB");
46  m_debugBti = p.getParameter<int>("debugBti");
47  m_debugTraco = p.getParameter<int>("debugTraco");
48  m_debugTSP = p.getParameter<bool>("debugTSP");
49  m_debugTST = p.getParameter<bool>("debugTST");
50  m_debugTU = p.getParameter<bool>("debugTU");
51  m_debugSC = p.getParameter<bool>("debugSC");
52  m_debugLUTs = p.getParameter<bool>("debugLUTs");
53  m_debugPed = p.getParameter<bool>("debugPed");
54 
55  m_UseT0 = p.getParameter<bool>("UseT0"); // CB check for a better way to do it
56 
57 }
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 60 of file DTConfigDBProducer.cc.

61 {
62 
63 }

Member Function Documentation

DTConfigPedestals DTConfigDBProducer::buildTrivialPedestals ( )
private

SV for debugging purpose ONLY.

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

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

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

Referenced by produce().

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

SV for debugging purpose ONLY.

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

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

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

Referenced by configFromCfg().

596 {
597  int iwh = chambid.wheel();
598  std::ostringstream os;
599  os << "wh";
600  if (iwh < 0) {
601  os << 'm' << -iwh;
602  } else {
603  os << iwh;
604  }
605  os << "st" << chambid.station() << "se" << chambid.sector();
606  return os.str();
607 }
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
std::auto_ptr< DTConfigManager > DTConfigDBProducer::produce ( const DTConfigManagerRcd iRecord)

ES produce method.

Definition at line 70 of file DTConfigDBProducer.cc.

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

Referenced by DTConfigDBProducer().

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

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

Read CCB string configuration.

Definition at line 263 of file DTConfigDBProducer.cc.

References EnergyCorrector::c, alignmentValidation::c1, cfgCache, gather_cfg::cout, HLT_25ns14e33_v1_cff::distance, end, flagDBBti, flagDBLUTS, flagDBTraco, flagDBTSM, flagDBTSS, DTPosNegType::getCT(), DTKeyedConfigCache::getData(), edm::ParameterSet::getParameter(), DTPosNegType::getPN(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ParameterSet::getUntrackedParameter(), i, o2o::iov, getDQMSummary::iter, 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().

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

DTKeyedConfigCache DTConfigDBProducer::cfgCache
private

Definition at line 100 of file DTConfigDBProducer.h.

Referenced by readDTCCBConfig().

bool DTConfigDBProducer::cfgConfig
private

Definition at line 96 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and produce().

bool DTConfigDBProducer::flagDBBti
private

Definition at line 98 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBLUTS
private

Definition at line 98 of file DTConfigDBProducer.h.

Referenced by readDTCCBConfig().

bool DTConfigDBProducer::flagDBTraco
private

Definition at line 98 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSM
private

Definition at line 98 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

bool DTConfigDBProducer::flagDBTSS
private

Definition at line 98 of file DTConfigDBProducer.h.

Referenced by configFromCfg(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugBti
private

Definition at line 84 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugDB
private

Definition at line 83 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugLUTs
private

Definition at line 90 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

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

Definition at line 89 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

int DTConfigDBProducer::m_debugTraco
private

Definition at line 85 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTSP
private

Definition at line 86 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTST
private

Definition at line 87 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

bool DTConfigDBProducer::m_debugTU
private

Definition at line 88 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDTCCBConfig().

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

Definition at line 94 of file DTConfigDBProducer.h.

Referenced by DTConfigDBProducer(), and readDBPedestalsConfig().