CMS 3D CMS Logo

Public Member Functions | Private Attributes

EcalMappingElectronicsHandler Class Reference

#include <EcalMappingElectronicsHandler.h>

Inheritance diagram for EcalMappingElectronicsHandler:
popcon::PopConSourceHandler< EcalMappingElectronics >

List of all members.

Public Member Functions

 EcalMappingElectronicsHandler (edm::ParameterSet const &)
virtual void getNewObjects ()
virtual std::string id () const
virtual ~EcalMappingElectronicsHandler ()

Private Attributes

std::string m_name
const EcalMappingElectronicsmyMap
long long since_
std::string txtFileSource_

Detailed Description

Definition at line 36 of file EcalMappingElectronicsHandler.h.


Constructor & Destructor Documentation

EcalMappingElectronicsHandler::EcalMappingElectronicsHandler ( edm::ParameterSet const &  ps)

Definition at line 14 of file EcalMappingElectronicsHandler.cc.

References gather_cfg::cout.

                                                                                      :           
  txtFileSource_(ps.getUntrackedParameter<std::string>("txtFile")),
  m_name(ps.getUntrackedParameter<std::string>("name","EcalMappingElectronicsHandler")),
  since_(ps.getUntrackedParameter<long long>("since",1)) 
{
  std::cout << "EcalMappingElectronics Source handler constructor\n" << std::endl;
}
EcalMappingElectronicsHandler::~EcalMappingElectronicsHandler ( ) [virtual]

Definition at line 22 of file EcalMappingElectronicsHandler.cc.

{
}

Member Function Documentation

void EcalMappingElectronicsHandler::getNewObjects ( ) [virtual]

Implements popcon::PopConSourceHandler< EcalMappingElectronics >.

Definition at line 27 of file EcalMappingElectronicsHandler.cc.

References gather_cfg::cout, cond::rpcobgas::detid, EcalMappingElement::electronicsid, Exception, f, edm::FileInPath::fullPath(), popcon::PopConSourceHandler< EcalMappingElectronics >::m_to_transfer, EcalElectronicsId::rawId(), EcalTriggerElectronicsId::rawId(), since_, EcalMappingElement::triggerid, txtFileSource_, and EEDetId::XYMODE.

{

  std::cout << "------- Ecal - > getNewObjects\n";
  EcalMappingElectronics *payload = new EcalMappingElectronics ;
  std::auto_ptr<EcalMappingElectronics> mapping = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
  //Filling map reading from file 
  edm::LogInfo("EcalMappingElectronicsHandler") << "Reading mapping from file " << edm::FileInPath(txtFileSource_).fullPath().c_str() ;
  
  std::ifstream f(edm::FileInPath(txtFileSource_).fullPath().c_str());
  if (!f.good())
    {
      edm::LogError("EcalMappingElectronicsHandler") << "File not found";
      throw cms::Exception("FileNotFound");
    }
  
  // uint32_t detid, elecid, triggerid;
  
  int ix, iy, iz, CL;
  // int dccid, towerid, stripid, xtalid;
  // int tccid, tower, ipseudostrip, xtalinps;
  int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
  int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
  
  while ( ! f.eof()) 
    {
      // f >> detid >> elecid >> triggerid; 
      f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >> 
        pseudostrip_in_TCC >> pseudostrip_in_TT ;
      
      //       if (!EEDetId::validDetId(ix,iy,iz))
      //          continue;
      
      EEDetId detid(ix,iy,iz,EEDetId::XYMODE);
      // std::cout << " dcc tower ps_in_SC xtal_in_ps " << dccid << " " << towerid << " " << pseudostrip_in_SC << " " << xtal_in_pseudostrip << std::endl;
      EcalElectronicsId elecid(dccid,towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
      // std::cout << " tcc tt ps_in_TT xtal_in_ps " << tccid << " " << tower << " " << pseudostrip_in_TT << " " << xtal_in_pseudostrip << std::endl;
      EcalTriggerElectronicsId triggerid(tccid, tower, pseudostrip_in_TT, xtal_in_pseudostrip);
      EcalMappingElement aElement;
      aElement.electronicsid = elecid.rawId();
      aElement.triggerid = triggerid.rawId();
      (*payload).setValue(detid, aElement);
    }
  
  f.close();
  edm::LogInfo("EcalMappingElectronicsHandler") << "Reading completed ready to insert in DB";  
  //Filling completed transferring to DB
  m_to_transfer.push_back(std::make_pair(payload,since_));
  //  delete payload;
}
virtual std::string EcalMappingElectronicsHandler::id ( void  ) const [inline, virtual]

Implements popcon::PopConSourceHandler< EcalMappingElectronics >.

Definition at line 42 of file EcalMappingElectronicsHandler.h.

References m_name.

{ return m_name;}

Member Data Documentation

Definition at line 49 of file EcalMappingElectronicsHandler.h.

Referenced by id().

Definition at line 46 of file EcalMappingElectronicsHandler.h.

Definition at line 51 of file EcalMappingElectronicsHandler.h.

Referenced by getNewObjects().

Definition at line 48 of file EcalMappingElectronicsHandler.h.

Referenced by getNewObjects().