CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/L1TriggerConfig/DTTPGConfigProducers/src/DTConfigDBProducer.cc

Go to the documentation of this file.
00001 #include "L1TriggerConfig/DTTPGConfigProducers/src/DTConfigDBProducer.h"
00002 
00003 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
00004 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
00005 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
00006 
00007 #include "CondFormats/DTObjects/interface/DTCCBConfig.h"
00008 #include "CondFormats/DataRecord/interface/DTCCBConfigRcd.h"
00009 // @@@ add headers
00010 #include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
00011 #include "CondFormats/DataRecord/interface/DTKeyedConfigListRcd.h"
00012 #include "CondFormats/DTObjects/interface/DTConfigAbstractHandler.h"
00013 
00014 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigManagerRcd.h"
00015 
00016 //#include "CondTools/DT/interface/DTPosNeg.h"
00017 #include "L1TriggerConfig/DTTPGConfigProducers/src/DTPosNegType.h"
00018 
00019 #include "FWCore/Framework/interface/ESHandle.h"
00020 #include "FWCore/Framework/interface/MakerMacros.h"
00021 
00022 #include <iostream>
00023 #include <iomanip>
00024 
00025 using std::cout;
00026 using std::endl;
00027 using std::vector;
00028 using std::auto_ptr;
00029 
00030 
00031 //
00032 // constants, enums and typedefs
00033 //
00034 
00035 //
00036 // static data member definitions
00037 //
00038 
00039 //
00040 // constructors and destructor
00041 //
00042 DTConfigDBProducer::DTConfigDBProducer(const edm::ParameterSet& p)
00043 {
00044   // tell the framework what record is being produced
00045   setWhatProduced(this,&DTConfigDBProducer::produce);
00046 
00047   // parameters to setup 
00048 // @@@ remove
00049 //  contact   = p.getParameter< std::string >("contact");
00050 //  auth_path = p.getParameter< std::string >("authPath");
00051 //  token     = p.getParameter< std::string >("token");
00052 //  local     = p.getParameter< bool        >("siteLocalConfig");
00053 // @@@ add
00054   cfgConfig = p.getParameter< bool        >("cfgConfig");
00055 
00056 // @@@ remove direct DB access
00057 /*  
00058   if ( local ) catalog = "";
00059   else         catalog = p.getParameter< std::string >("catalog");
00060 
00061   // create DB session
00062   session = new DTDB1Session( contact, catalog, auth_path, local );
00063   session->connect( false );
00064 
00065   // create an interface to handle configurations list
00066   DTConfig1Handler::maxBrickNumber  = 100;
00067   DTConfig1Handler::maxStringNumber = 10000;
00068   DTConfig1Handler::maxByteNumber   = 1000000;
00069   rs = 0;
00070   ri = DTConfig1Handler::create( session, token );
00071   rs = ri->getContainer();  
00072 */
00073     
00074   // get and store parameter set and config manager pointer
00075   m_ps = p;
00076   m_manager = new DTConfigManager();
00077   
00078   // debug flags
00079   m_debugDB = p.getParameter< bool        >("debugDB"); 
00080   m_debugBti = p.getParameter< int        >("debugBti");
00081   m_debugTraco = p.getParameter< int        >("debugTraco");
00082   m_debugTSP = p.getParameter< bool        >("debugTSP");
00083   m_debugTST = p.getParameter< bool        >("debugTST");
00084   m_debugTU = p.getParameter< bool        >("debugTU");
00085   m_debugSC = p.getParameter< bool        >("debugSC");
00086   m_debugLUTs = p.getParameter< bool        >("debugLUTs");
00087 
00088   // DB specific requests
00089   bool tracoLutsFromDB = p.getParameter< bool        >("TracoLutsFromDB");
00090   bool useBtiAcceptParam = p.getParameter< bool        >("UseBtiAcceptParam");
00091 
00092   // initialize flags to check if data are present in OMDS 
00093   flagDBBti     = false;
00094   flagDBTraco   = false;
00095   flagDBTSS     = false;
00096   flagDBTSM     = false;
00097   flagDBLUTS    = false;
00098 
00099   // set debug
00100   edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");  
00101   bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
00102   m_manager->setDTTPGDebug(dttpgdebug);
00103 
00104   // set specific DB requests
00105   m_manager->setLutFromDB(tracoLutsFromDB);
00106   m_manager->setUseAcceptParam(useBtiAcceptParam);
00107 }
00108 
00109 
00110 DTConfigDBProducer::~DTConfigDBProducer()
00111 {
00112   // destruction time
00113 // @@@ remove
00114 //  DTConfig1Handler::remove( session );
00115 //  session->disconnect();
00116 //  delete session;
00117 }
00118 
00119 
00120 //
00121 // member functions
00122 //
00123 // ------------ method called to produce the data  ------------
00124 std::auto_ptr<DTConfigManager> DTConfigDBProducer::produce(const DTConfigManagerRcd& iRecord)
00125 {
00126    using namespace edm::es;
00127 
00128    int code; 
00129    if(cfgConfig){
00130         configFromCfg();
00131         code = 2;
00132    }    
00133    else
00134         code = readDTCCBConfig(iRecord);
00135 
00136    if(code==-1)
00137         cout << "ERROR code: please check!" << endl; 
00138 
00139    if(code==1)
00140         cout << "Empty DB: configurations has been read from cfg!" << endl; 
00141 
00142    if(code==2)
00143         cout << "Trivial : configurations has been read from cfg!" << endl; 
00144 
00145    if(code==0)
00146         cout << "Configurations successfully read from OMDS!" << endl; 
00147 
00148    std::auto_ptr<DTConfigManager> dtConfig = std::auto_ptr<DTConfigManager>( m_manager );
00149 
00150    return dtConfig ;
00151 }
00152 
00153 int DTConfigDBProducer::readDTCCBConfig(const DTConfigManagerRcd& iRecord)
00154 {
00155   using namespace edm::eventsetup;
00156   
00157 
00158   // get DTCCBConfigRcd from DTConfigManagerRcd (they are dependent records)
00159   edm::ESHandle<DTCCBConfig> ccb_conf;
00160   iRecord.getRecord<DTCCBConfigRcd>().get(ccb_conf);
00161   int ndata = std::distance( ccb_conf->begin(), ccb_conf->end() );
00162 
00163 // @@@ add
00164   DTConfigAbstractHandler* cfgCache = DTConfigAbstractHandler::getInstance();
00165   const DTKeyedConfigListRcd& keyRecord =
00166                               iRecord.getRecord<DTKeyedConfigListRcd>();
00167 
00168   if(m_debugDB)
00169   {
00170         cout << ccb_conf->version() << endl;
00171         cout << ndata << " data in the container" << endl;
00172 // SV 090928 : update for Paolo Ronchese new tags CondFormats/DTObjects V07-01-02 and CondTools/DT          V07-01-02
00173 //      cout << "Full config key: " << ccb_conf->fullKey() << endl;
00174   }
00175 
00176   edm::ValidityInterval iov(iRecord.getRecord<DTCCBConfigRcd>().validityInterval() );
00177   unsigned int currValidityStart = iov.first().eventID().run();
00178   unsigned int currValidityEnd   = iov.last( ).eventID().run();
00179 
00180   if(m_debugDB)
00181         cout    << "valid since run " << currValidityStart
00182                 << " to run "         << currValidityEnd << endl;  
00183             
00184   // if there are no data in the container, configuration from cfg files...         
00185   if( ndata==0 ){
00186         configFromCfg();
00187         return 1;       
00188   }
00189 
00190   // get DTTPGMap for retrieving bti number and traco number
00191   edm::ParameterSet conf_map = m_ps.getUntrackedParameter<edm::ParameterSet>("DTTPGMap");
00192 
00193   // loop over chambers
00194   DTCCBConfig::ccb_config_map configKeys( ccb_conf->configKeyMap() );
00195   DTCCBConfig::ccb_config_iterator iter = configKeys.begin();
00196   DTCCBConfig::ccb_config_iterator iend = configKeys.end();
00197 
00198   // read data from CCBConfig
00199   while ( iter != iend ) {
00200         // get chamber id
00201         const DTCCBId& ccbId = iter->first;
00202         if(m_debugDB)
00203                 cout << " Filling configuration for chamber : wh " << ccbId.wheelId   << " st "
00204                         << ccbId.stationId << " se "
00205                         << ccbId.sectorId  << " -> " << endl;
00206 
00207         // get chamber type and id from ccbId
00208         int mbtype = DTPosNegType::getCT( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
00209         int posneg = DTPosNegType::getPN( ccbId.wheelId, ccbId.sectorId, ccbId.stationId );
00210         if(m_debugDB)
00211                 cout << "Chamber type : " <<  mbtype
00212                         << " posneg : " << posneg << endl; 
00213         DTChamberId chambid(ccbId.wheelId, ccbId.stationId, ccbId.sectorId);
00214                         
00215         // get brick identifiers list
00216         const std::vector<int>& ccbConf = iter->second;
00217         std::vector<int>::const_iterator cfgIter = ccbConf.begin();
00218         std::vector<int>::const_iterator cfgIend = ccbConf.end();
00219 
00220         //TSS-TSM buffers
00221         unsigned short int tss_buffer[7][31];
00222         unsigned short int tsm_buffer[9];
00223         int ntss=0;
00224 
00225         // loop over configuration bricks
00226         while ( cfgIter != cfgIend ) {
00227                 // get brick identifier
00228                 int id = *cfgIter++;
00229                 if(m_debugDB)
00230                         cout << " BRICK " << id << endl;  
00231 
00232                 // create strings list
00233 // @@@ change to vector of strings in place of vector of pointers to string
00234 //              std::vector<const std::string*> list;
00235                 std::vector<std::string> list;
00236 // @@@ change access to DB
00237 //              ri->getData( id, list );
00238 //                const DTKeyedConfig* kBrick = 0;
00239                 cfgCache->getData( keyRecord, id, list );
00240 
00241                 // loop over strings
00242 // @@@ change to vector of strings in place of vector of pointers to string
00243 //              std::vector<const std::string*>::const_iterator s_iter = list.begin();
00244 //              std::vector<const std::string*>::const_iterator s_iend = list.end();
00245                 std::vector<std::string>::const_iterator s_iter = list.begin();
00246                 std::vector<std::string>::const_iterator s_iend = list.end();
00247                 while ( s_iter != s_iend ) {
00248 // @@@ change to string in place of pointer to string
00249                         if(m_debugDB)
00250                                 cout << "        ----> " << *s_iter << endl;
00251 //                              cout << "        ----> " << **s_iter << endl;
00252                                 
00253                         // copy string in unsigned int buffer
00254 // @@@ change to string in place of pointer to string
00255 //                      std::string str = **s_iter++;
00256                         std::string str = *s_iter++;
00257                         unsigned short int buffer[100];         //2 bytes
00258                         int c = 0;
00259                         const char* cstr = str.c_str();
00260                         const char* ptr = cstr + 2;
00261                         const char* end = cstr + str.length();
00262                         while ( ptr < end ) {
00263                                 char c1 = *ptr++;
00264                                 int i1 = 0;
00265                                 if ( ( c1 >= '0' ) && ( c1 <= '9' ) ) i1 =      c1 - '0';
00266                                 if ( ( c1 >= 'a' ) && ( c1 <= 'f' ) ) i1 = 10 + c1 - 'a';
00267                                 if ( ( c1 >= 'A' ) && ( c1 <= 'F' ) ) i1 = 10 + c1 - 'A';
00268                                 char c2 = *ptr++;
00269                                 int i2 = 0;
00270                                 if ( ( c2 >= '0' ) && ( c2 <= '9' ) ) i2 =      c2 - '0';
00271                                 if ( ( c2 >= 'a' ) && ( c2 <= 'f' ) ) i2 = 10 + c2 - 'a';
00272                                 if ( ( c2 >= 'A' ) && ( c2 <= 'F' ) ) i2 = 10 + c2 - 'A';
00273                                 buffer[c] = ( i1 * 16 ) + i2;
00274                                 c++;
00275                         }// end loop over string
00276 
00277                         // BTI configuration string     
00278                         if (buffer[2]==0x54){
00279                                 // BTI configuration read for BTI
00280                                 flagDBBti = true;
00281                                 
00282                                 // compute sl and bti number from board and chip
00283                                 int brd=buffer[3]; // Board Nr.
00284                                 int chip=buffer[4]; // Chip Nr.
00285 
00286                                 if (brd>7) {
00287                                         cout << "Not existing board ... " << brd << endl;
00288                                         return -1; // Non-existing board
00289                                 }       
00290                                 if (chip>31) {
00291                                         cout << "Not existing chip... " << chip << endl;
00292                                         return -1; // Non existing chip 
00293                                 }
00294                                 
00295                                 // Is it Phi or Theta board?
00296                                 bool ThetaSL, PhiSL;
00297                                 PhiSL=false;
00298                                 ThetaSL=false;
00299                                 switch (mbtype) {
00300                                         case 1: // mb1
00301                                                 if (brd==6 || brd==7) {
00302                                                         ThetaSL=true; 
00303                                                         brd-=6;
00304                                                 }
00305                                                 else if ((brd<3 && chip<32) || (brd==3 && chip<8)) 
00306                                                         PhiSL=true;
00307                                                 break;
00308                                         case 2: // mb2
00309                                                 if (brd==6 || brd==7) {
00310                                                         ThetaSL=true; 
00311                                                         brd-=6;
00312                                                 }
00313                                                 else if (brd<4 && chip<32) 
00314                                                         PhiSL=true;
00315                                                 break;
00316                                         case 3: // mb3
00317                                                 if (brd==6 || brd==7) {
00318                                                         ThetaSL=true; 
00319                                                         brd-=6;
00320                                                 }
00321                                                 else if (brd<5 && chip<32) 
00322                                                         PhiSL=true;
00323                                                 break;
00324                                         case 4: // mb4-s, mb4_8
00325                                                 if (brd<6 && chip<32) 
00326                                                         PhiSL=true;
00327                                                 break;
00328                                         case 5: // mb4-9
00329                                                 if (brd<3 && chip<32) 
00330                                                         PhiSL=true;
00331                                                 break;
00332                                         case 6: // mb4-4
00333                                                 if (brd<5 && chip<32) 
00334                                                         PhiSL=true;
00335                                                 break;
00336                                         case 7: // mb4-10
00337                                                 if (brd<4 && chip<32) 
00338                                                         PhiSL=true;
00339                                                 break;
00340                                 }
00341                                 if (!PhiSL && !ThetaSL) {
00342                                         cout << "MB type " << mbtype << endl; 
00343                                         cout << "Board " << brd << " chip " <<chip << endl;
00344                                         cout << "Not phi SL nor Theta SL" << endl; 
00345                                         return -1; // Not PhiSL nor ThetaSL 
00346                                 }        
00347                                         
00348                                 // compute SL number and bti number
00349                                 int isl;
00350                                 int ibti;
00351                                 if (PhiSL) {
00352                                         if ((chip%8)<4) 
00353                                                 isl=1;  // Phi1 
00354                                         else 
00355                                                 isl=3;  // Phi2 
00356                                         ibti=brd*16+(int)(chip/8)*4+(chip%4); 
00357                                 }
00358                                 else if (ThetaSL){
00359                                         isl=2;          // Theta 
00360                                         if ((chip%8)<4)
00361                                                 ibti=brd*32+ chip-4*(int)(chip/8);
00362                                         else
00363                                                 ibti=brd*32+ chip+12-4*(int)(chip/8);
00364                                 }                
00365                         
00366                                 // BTI config constructor from strings  
00367                                 DTConfigBti bticonf(buffer);
00368                                 bticonf.setDebug(m_debugBti);                                   
00369                                  
00370                                 m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
00371                                 
00372                                 if(m_debugDB)
00373                                         cout <<         "Filling BTI config for chamber : wh " << chambid.wheel() << 
00374                                                         ", st " << chambid.station() << 
00375                                                         ", se " << chambid.sector() << 
00376                                                         "... sl " << isl << 
00377                                                         ", bti " << ibti+1 << endl;                             
00378                         }
00379                                 
00380                         // TRACO configuration string                   
00381                         if (buffer[2]==0x15){
00382                                 // TRACO configuration read from OMDS
00383                                 flagDBTraco = true;
00384                                 
00385                                 // TRACO config constructor from strings        
00386                                 int traco_brd = buffer[3];      // Board Nr.;
00387                                 int traco_chip = buffer[4];     // Chip Nr.;
00388                                 int itraco = traco_brd * 4 + traco_chip + 1;
00389                                 DTConfigTraco tracoconf(buffer);
00390                                 tracoconf.setDebug(m_debugTraco);
00391                                 m_manager->setDTConfigTraco(DTTracoId(chambid,itraco),tracoconf);
00392                                 
00393                                 if(m_debugDB)
00394                                         cout <<         "Filling TRACO config for chamber : wh " << chambid.wheel() <<
00395                                                         ", st " << chambid.station() <<
00396                                                         ", se " << chambid.sector() <<
00397                                                         ", board " << traco_brd <<
00398                                                         ", chip " << traco_chip <<
00399                                                         ", traco " << itraco << endl;   
00400                         }
00401                         
00402                         
00403                         // TSS configuration string     
00404                         if (buffer[2]==0x16){
00405                                 // TSS configuration read from OMDS
00406                                 flagDBTSS = true;
00407                                 
00408                                 unsigned short int itss=buffer[3];
00409                                 for (int i=0;i<31;i++) 
00410                                         tss_buffer[itss][i]=buffer[i];
00411                                 ntss++;
00412                         }
00413                         
00414                         // TSM configuration string
00415                         if (buffer[2]==0x17){
00416                                 // TSM configuration read from OMDS
00417                                 flagDBTSM = true;                        
00418                          
00419                                 for (int i=0; i<9; i++) 
00420                                         tsm_buffer[i]=buffer[i];
00421                         } 
00422                         
00423                         // LUT configuration string
00424                         if (buffer[2]==0xA8){
00425 
00426                                 // LUT parameters read from OMDS
00427                                 flagDBLUTS = true;
00428                                 DTConfigLUTs lutconf(buffer);
00429                                 lutconf.setDebug(m_debugLUTs);
00430                                 m_manager->setDTConfigLUTs(chambid,lutconf);
00431                         }
00432                         
00433                 }//end string iteration                                 
00434         }//end brick iteration
00435         
00436         //TSS + TSM configurations are set in DTConfigTSPhi constructor
00437         DTConfigTSPhi tsphiconf(m_debugTSP,tss_buffer,ntss,tsm_buffer);
00438         m_manager->setDTConfigTSPhi(chambid,tsphiconf);
00439 
00440         // get configuration for TSTheta, SC and TU from .cfg
00441         edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");  
00442         edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
00443 
00444         // TSTheta configuration from .cfg
00445         DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
00446         tsthetaconf.setDebug(m_debugTST);
00447         m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
00448 
00449         // SC configuration from .cfg
00450         DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
00451         sectcollconf.setDebug(m_debugSC);
00452         m_manager->setDTConfigSectColl(DTSectCollId(chambid.wheel(),chambid.sector()),sectcollconf);
00453 
00454         // TU configuration from .cfg
00455         DTConfigTrigUnit trigunitconf(tups);
00456         trigunitconf.setDebug(m_debugTU);
00457         m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
00458        
00459         ++iter;
00460   }
00461   
00462   // SV 100511 add check flag for lut configuration
00463   // if no lut configuration is found, luts are computed from geometry!
00464   if(!flagDBLUTS && m_manager->lutFromDB()==true){
00465         cout << "*** ATTENTION: Lut configuration parameters NOT found in OMDS:" << endl;
00466         cout << "*** RE_RUN with the option TracoLutsFromDB = cms.bool(False)" << endl;
00467         cout << "*** in L1TriggerConfig/DTTPGConfigProducers/python/L1DTConfigFromDB_cfi.py" << endl;
00468         cout << "*** In this run LUTS are computed FROM GEOMETRY! " << endl;
00469         m_manager->setLutFromDB(false);
00470         return -1;
00471   } 
00472   if(!flagDBBti || !flagDBTraco || !flagDBTSS || !flagDBTSM ){
00473         configFromCfg();
00474         return 1;
00475   }
00476          
00477   return 0;
00478 }
00479 
00480 std::string DTConfigDBProducer::mapEntryName(const DTChamberId & chambid) const
00481 {
00482   int iwh = chambid.wheel();
00483   std::ostringstream os;
00484   os << "wh";
00485   if (iwh < 0) {
00486      os << 'm' << -iwh;
00487    } else {
00488      os << iwh;
00489   }
00490   os << "st" << chambid.station() << "se" << chambid.sector();
00491   return os.str();
00492 }
00493 
00494 
00495 void DTConfigDBProducer::configFromCfg(){
00496 
00497   //create config classes&C.
00498   edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
00499   edm::ParameterSet conf_map = m_ps.getUntrackedParameter<edm::ParameterSet>("DTTPGMap");
00500   bool dttpgdebug = conf_ps.getUntrackedParameter<bool>("Debug");
00501   DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
00502   edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
00503   DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
00504   DTConfigTraco tracoconf(tups.getParameter<edm::ParameterSet>("TracoParameters"));
00505   DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
00506   DTConfigTSPhi tsphiconf(tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
00507   DTConfigTrigUnit trigunitconf(tups);
00508   
00509   for (int iwh=-2;iwh<=2;++iwh){
00510     for (int ist=1;ist<=4;++ist){
00511       for (int ise=1;ise<=12;++ise){
00512         DTChamberId chambid(iwh,ist,ise);
00513         vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
00514 
00515         if(dttpgdebug)
00516           {
00517             cout << " Filling configuration for chamber : wh " << chambid.wheel() << 
00518               ", st " << chambid.station() << 
00519               ", se " << chambid.sector() << endl;
00520           }
00521         
00522         //fill the bti map
00523         if(!flagDBBti){
00524                 for (int isl=1;isl<=3;isl++){
00525                         int ncell = nmap[isl-1];
00526                         //        cout << ncell <<" , ";
00527                         for (int ibti=0;ibti<ncell;ibti++){
00528                                 m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
00529                                 if(dttpgdebug)
00530                                         cout << "Filling BTI config for chamber : wh " << chambid.wheel() << 
00531                                                 ", st " << chambid.station() << 
00532                                                 ", se " << chambid.sector() << 
00533                                                 "... sl " << isl << 
00534                                                 ", bti " << ibti+1 << endl;
00535                         }     
00536                 }
00537         }               
00538         
00539         // fill the traco map
00540         if(!flagDBTraco){
00541                 int ntraco = nmap[3];
00542                 //cout << ntraco << " }" << endl;
00543                 for (int itraco=0;itraco<ntraco;itraco++){ 
00544                         m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
00545                         if(dttpgdebug)
00546                                 cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << 
00547                                         ", st " << chambid.station() << 
00548                                         ", se " << chambid.sector() << 
00549                                         ", traco " << itraco+1 << endl;
00550                 }     
00551         }
00552         
00553         // fill TS & TrigUnit
00554         if(!flagDBTSS || !flagDBTSM)
00555         {       
00556                 m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
00557                 m_manager->setDTConfigTSPhi(chambid,tsphiconf);
00558                 m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
00559         }
00560       }
00561     }
00562   }
00563 
00564   for (int iwh=-2;iwh<=2;++iwh){
00565     for (int ise=13;ise<=14;++ise){
00566       int ist =4;
00567       DTChamberId chambid(iwh,ist,ise);
00568       vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());
00569 
00570       if(dttpgdebug)
00571         {
00572           cout << " Filling configuration for chamber : wh " << chambid.wheel() << 
00573             ", st " << chambid.station() << 
00574             ", se " << chambid.sector() << endl;
00575         }
00576       
00577       //fill the bti map
00578       if(!flagDBBti){
00579                 for (int isl=1;isl<=3;isl++){
00580                         int ncell = nmap[isl-1];
00581                         //      cout << ncell <<" , ";
00582                         for (int ibti=0;ibti<ncell;ibti++){
00583                                 m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
00584                                 if(dttpgdebug)
00585                                         cout << "Filling BTI config for chamber : wh " << chambid.wheel() << 
00586                                                 ", st " << chambid.station() << 
00587                                                 ", se " << chambid.sector() << 
00588                                                 "... sl " << isl << 
00589                                                 ", bti " << ibti+1 << endl;
00590                         }     
00591                 }
00592       } 
00593       
00594       // fill the traco map
00595       if(!flagDBTraco){
00596                 int ntraco = nmap[3];   
00597                 //       cout << ntraco << " }" << endl;
00598                 for (int itraco=0;itraco<ntraco;itraco++){ 
00599                         m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
00600                         if(dttpgdebug)
00601                                 cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << 
00602                                 ", st " << chambid.station() << 
00603                                 ", se " << chambid.sector() << 
00604                                 ", traco " << itraco+1 << endl;
00605                 }     
00606       }
00607       
00608       // fill TS & TrigUnit
00609       if(!flagDBTSS || !flagDBTSM)
00610       {
00611                 m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
00612                 m_manager->setDTConfigTSPhi(chambid,tsphiconf);
00613                 m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
00614       }
00615     }
00616   }
00617   
00618   //loop on Sector Collectors
00619   for (int wh=-2;wh<=2;wh++)
00620     for (int se=1;se<=12;se++)
00621       m_manager->setDTConfigSectColl(DTSectCollId(wh,se),sectcollconf);
00622       
00623 
00624   return;          
00625 
00626 }
00627