CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTConfigTrivialProducer Class Reference

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

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

List of all members.

Public Member Functions

 DTConfigTrivialProducer (const edm::ParameterSet &)
 Constructor.
std::auto_ptr< DTConfigManagerproduce (const DTConfigManagerRcd &)
 ES produce method.
 ~DTConfigTrivialProducer ()
 destructor

Private Member Functions

void buildManager ()
 Build Config Manager.
DTConfigPedestals buildTrivialPedestals ()
 Build Config Pedestals.
std::string mapEntryName (const DTChamberId &chambid) const

Private Attributes

bool m_debug
DTConfigManagerm_manager
edm::ParameterSet m_ps
DTTPGParametersm_tpgParams

Detailed Description

Description: A Producer for the DT config available via EventSetup

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

Definition at line 42 of file DTConfigTrivialProducer.h.


Constructor & Destructor Documentation

DTConfigTrivialProducer::DTConfigTrivialProducer ( const edm::ParameterSet ps)

Constructor.

Definition at line 15 of file DTConfigTrivialProducer.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_debug, m_manager, m_ps, m_tpgParams, DTConfigManager::setDTTPGDebug(), DTConfigManager::setLutFromDB(), DTConfigManager::setUseAcceptParam(), and edm::ESProducer::setWhatProduced().

{

  setWhatProduced(this);
  
  //get and store parameter set 
  m_ps = ps;
  m_manager = new DTConfigManager();
  m_tpgParams = new DTTPGParameters();

  // set debug
  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");  
  m_debug = conf_ps.getUntrackedParameter<bool>("Debug");

  if (m_debug) 
    cout << "DTConfigTrivialProducer::DTConfigTrivialProducer()" << endl;

  m_manager->setDTTPGDebug(m_debug);

  // DB specific requests
  bool tracoLutsFromDB = m_ps.getParameter<bool>("TracoLutsFromDB");
  bool useBtiAcceptParam = m_ps.getParameter<bool>("UseBtiAcceptParam");

  // set specific DB requests
  m_manager->setLutFromDB(tracoLutsFromDB);
  m_manager->setUseAcceptParam(useBtiAcceptParam);  // CB Are these needed here???
}
DTConfigTrivialProducer::~DTConfigTrivialProducer ( )

destructor

Definition at line 44 of file DTConfigTrivialProducer.cc.

References gather_cfg::cout, and m_debug.

{

  if (m_debug) 
    cout << "DTConfigTrivialProducer::~DTConfigTrivialProducer()" << endl;
 

}

Member Function Documentation

void DTConfigTrivialProducer::buildManager ( ) [private]

Build Config Manager.

Definition at line 75 of file DTConfigTrivialProducer.cc.

References buildTrivialPedestals(), gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_debug, m_manager, m_ps, mapEntryName(), DTChamberId::sector(), DTConfigManager::setDTConfigBti(), DTConfigManager::setDTConfigLUTs(), DTConfigManager::setDTConfigPedestals(), DTConfigManager::setDTConfigSectColl(), DTConfigManager::setDTConfigTraco(), DTConfigManager::setDTConfigTrigUnit(), DTConfigManager::setDTConfigTSPhi(), DTConfigManager::setDTConfigTSTheta(), DTConfigManager::setLutFromDB(), DTChamberId::station(), and DTChamberId::wheel().

Referenced by produce().

{

  if (m_debug) 
    cout << "DTConfigTrivialProducer::buildManager()" << endl;

  //create config classes&C.
  edm::ParameterSet conf_ps = m_ps.getParameter<edm::ParameterSet>("DTTPGParameters");
  edm::ParameterSet conf_map = m_ps.getUntrackedParameter<edm::ParameterSet>("DTTPGMap");
  DTConfigSectColl sectcollconf(conf_ps.getParameter<edm::ParameterSet>("SectCollParameters"));
  edm::ParameterSet tups = conf_ps.getParameter<edm::ParameterSet>("TUParameters");
  DTConfigBti bticonf(tups.getParameter<edm::ParameterSet>("BtiParameters"));
  DTConfigTraco tracoconf(tups.getParameter<edm::ParameterSet>("TracoParameters"));
  DTConfigLUTs lutconf(tups.getParameter<edm::ParameterSet>("LutParameters"));
  DTConfigTSTheta tsthetaconf(tups.getParameter<edm::ParameterSet>("TSThetaParameters"));
  DTConfigTSPhi tsphiconf(tups.getParameter<edm::ParameterSet>("TSPhiParameters"));
  DTConfigTrigUnit trigunitconf(tups);
   
  for (int iwh=-2;iwh<=2;++iwh){
    for (int ist=1;ist<=4;++ist){
      for (int ise=1;ise<=12;++ise){
        DTChamberId chambid(iwh,ist,ise);
        vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());

        if(m_debug)
          {
            std::cout << " Filling configuration for chamber : wh " << chambid.wheel() << 
              ", st " << chambid.station() << 
              ", se " << chambid.sector() << endl;
          }
        
        //fill the bti map
        for (int isl=1;isl<=3;isl++){
          int ncell = nmap[isl-1];
          //      std::cout << ncell <<" , ";
          for (int ibti=0;ibti<ncell;ibti++)
            {
              m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
              if(m_debug)
                std::cout << "Filling BTI config for chamber : wh " << chambid.wheel() << 
                  ", st " << chambid.station() << 
                  ", se " << chambid.sector() << 
                  "... sl " << isl << 
                  ", bti " << ibti+1 << endl;
            }     
        }
        
        // fill the traco map
        int ntraco = nmap[3];
        //std::cout << ntraco << " }" << std::endl;
        for (int itraco=0;itraco<ntraco;itraco++)
          { 
            m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
            if(m_debug)
              std::cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << 
                ", st " << chambid.station() << 
                ", se " << chambid.sector() << 
                ", traco " << itraco+1 << endl;
          }     
        
        // fill TS & TrigUnit
        m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
        m_manager->setDTConfigTSPhi(chambid,tsphiconf);
        m_manager->setDTConfigTrigUnit(chambid,trigunitconf);
        
        // fill LUTs
        m_manager->setDTConfigLUTs(chambid,lutconf);
        m_manager->setLutFromDB(false);    // 110204 SV to be sure to compute luts from geometry         
      }
    }
  }

  for (int iwh=-2;iwh<=2;++iwh){
    for (int ise=13;ise<=14;++ise){
      int ist =4;
      DTChamberId chambid(iwh,ist,ise);
      vector<int> nmap = conf_map.getUntrackedParameter<vector<int> >(mapEntryName(chambid).c_str());

      if(m_debug)
        {
          std::cout << " Filling configuration for chamber : wh " << chambid.wheel() << 
            ", st " << chambid.station() << 
            ", se " << chambid.sector() << endl;
        }
      
      //fill the bti map
      for (int isl=1;isl<=3;isl++){
        int ncell = nmap[isl-1];
//      std::cout << ncell <<" , ";
        for (int ibti=0;ibti<ncell;ibti++)
          {
            m_manager->setDTConfigBti(DTBtiId(chambid,isl,ibti+1),bticonf);
            if(m_debug)
              std::cout << "Filling BTI config for chamber : wh " << chambid.wheel() << 
                ", st " << chambid.station() << 
                ", se " << chambid.sector() << 
                "... sl " << isl << 
                ", bti " << ibti+1 << endl;
          }     
      }
      
      // fill the traco map
      int ntraco = nmap[3];
//       std::cout << ntraco << " }" << std::endl;
      for (int itraco=0;itraco<ntraco;itraco++)
        { 
          m_manager->setDTConfigTraco(DTTracoId(chambid,itraco+1),tracoconf);
          if(m_debug)
            std::cout << "Filling TRACO config for chamber : wh " << chambid.wheel() << 
              ", st " << chambid.station() << 
              ", se " << chambid.sector() << 
              ", traco " << itraco+1 << endl;
        }     
      
      // fill TS & TrigUnit
      m_manager->setDTConfigTSTheta(chambid,tsthetaconf);
      m_manager->setDTConfigTSPhi(chambid,tsphiconf);
      m_manager->setDTConfigTrigUnit(chambid,trigunitconf);

      // fill LUTs
      m_manager->setDTConfigLUTs(chambid,lutconf);
      m_manager->setLutFromDB(false);    // 110204 SV to be sure to compute luts from geometry         
    }
  }
  
  //loop on Sector Collectors
  for (int wh=-2;wh<=2;wh++)
    for (int se=1;se<=12;se++)
      m_manager->setDTConfigSectColl(DTSectCollId(wh,se),sectcollconf);

  //fake collection of pedestals
  m_manager->setDTConfigPedestals(buildTrivialPedestals());

}
DTConfigPedestals DTConfigTrivialProducer::buildTrivialPedestals ( ) [private]

Build Config Pedestals.

Definition at line 210 of file DTConfigTrivialProducer.cc.

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

Referenced by buildManager().

{

  int counts = m_ps.getParameter<int>("bxOffset");
  float fine = m_ps.getParameter<double>("finePhase");
   
  if (m_debug) 
    cout << "DTConfigTrivialProducer::buildPedestals()" << endl;

  //DTTPGParameters tpgParams;
  for (int iwh=-2;iwh<=2;++iwh){
    for (int ist=1;ist<=4;++ist){
      for (int ise=1;ise<=14;++ise){
        if (ise>12 && ist!=4) continue;

        DTChamberId chId(iwh,ist,ise);
        m_tpgParams->set(chId,counts,fine,DTTimeUnits::ns);
      }
    }
  }

  DTConfigPedestals tpgPedestals;
  tpgPedestals.setUseT0(false);
  tpgPedestals.setES(m_tpgParams);
 
  return tpgPedestals;

}
std::string DTConfigTrivialProducer::mapEntryName ( const DTChamberId chambid) const [private]

Definition at line 240 of file DTConfigTrivialProducer.cc.

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

Referenced by buildManager().

{
  int iwh = chambid.wheel();
  std::ostringstream os;
  os << "wh";
  if (iwh < 0) {
     os << 'm' << -iwh;
   } else {
     os << iwh;
  }
  os << "st" << chambid.station() << "se" << chambid.sector();
  return os.str();
}
std::auto_ptr< DTConfigManager > DTConfigTrivialProducer::produce ( const DTConfigManagerRcd iRecord)

ES produce method.

Definition at line 58 of file DTConfigTrivialProducer.cc.

References buildManager(), gather_cfg::cout, m_debug, and m_manager.

{

  if (m_debug) 
    cout << "DTConfigTrivialProducer::produce()" << endl;

   using namespace edm::es;
   buildManager();

   //m_manager->getDTConfigPedestals()->print();

   std::auto_ptr<DTConfigManager> dtConfig = std::auto_ptr<DTConfigManager>( m_manager );

   return dtConfig ;

}

Member Data Documentation

Definition at line 66 of file DTConfigTrivialProducer.h.

Referenced by buildManager(), DTConfigTrivialProducer(), and produce().

Definition at line 67 of file DTConfigTrivialProducer.h.

Referenced by buildTrivialPedestals(), and DTConfigTrivialProducer().