CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

EcalTrigTowerConstituentsMapBuilder Class Reference

#include <tmp/EcalTrigTowerConstituentsMapBuilder/interface/EcalTrigTowerConstituentsMapBuilder.h>

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

List of all members.

Public Types

typedef std::auto_ptr
< EcalTrigTowerConstituentsMap
ReturnType

Public Member Functions

 EcalTrigTowerConstituentsMapBuilder (const edm::ParameterSet &)
ReturnType produce (const IdealGeometryRecord &)
 ~EcalTrigTowerConstituentsMapBuilder ()

Private Member Functions

void parseTextMap (const std::string &filename, EcalTrigTowerConstituentsMap &theMap)

Private Attributes

std::string mapFile_

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 38 of file EcalTrigTowerConstituentsMapBuilder.h.


Member Typedef Documentation

Definition at line 43 of file EcalTrigTowerConstituentsMapBuilder.h.


Constructor & Destructor Documentation

EcalTrigTowerConstituentsMapBuilder::EcalTrigTowerConstituentsMapBuilder ( const edm::ParameterSet iConfig)

Definition at line 34 of file EcalTrigTowerConstituentsMapBuilder.cc.

References edm::ESProducer::setWhatProduced().

                                                                                                       :
  mapFile_(iConfig.getUntrackedParameter<std::string>("MapFile",""))
{
  //the following line is needed to tell the framework what
  // data is being produced
  setWhatProduced(this);
  
  //now do what ever other initialization is needed
}
EcalTrigTowerConstituentsMapBuilder::~EcalTrigTowerConstituentsMapBuilder ( )

Definition at line 45 of file EcalTrigTowerConstituentsMapBuilder.cc.

{ 
}

Member Function Documentation

void EcalTrigTowerConstituentsMapBuilder::parseTextMap ( const std::string &  filename,
EcalTrigTowerConstituentsMap theMap 
) [private]

Definition at line 65 of file EcalTrigTowerConstituentsMapBuilder.cc.

References EcalTrigTowerConstituentsMap::assign(), EcalEndcap, f, edm::FileInPath::fullPath(), and geometryCSVtoXML::line.

Referenced by produce().

                                                                                                                      {
  edm::FileInPath eff(filename);
  
  std::ifstream f(eff.fullPath().c_str());
  if (!f.good())
    return; 
  
  int ietaTower,iphiTower;
  int ix,iy,iz;
  char line[80];  // a buffer for the line to read
  char ch;        // a temporary for holding the end of line
  while ((ch = f.peek()) != '-') {
    f.get(line,80,'\n');            // read 80 characters to end of line
    f.get(ch);                      // eat out the '\n'
    // extract the numbers
/*
  int mod,cry;
    int nread = sscanf (line, " %d %d %d %d",&mod,&cry,&ietaTower,&iphiTower);
    if (nread == 4 )
      {
        EEDetId eeid(mod,cry,1,EEDetId::SCCRYSTALMODE);
        EcalTrigTowerDetId etid(1,EcalEndcap,ietaTower-45+17,iphiTower);
        //      std::cout << eeid << "\n->" << etid << std::endl;
        theMap.assign(DetId(eeid),etid);
      }
*/
    int nread = sscanf (line, " %d %d %d %d %d",&ix,&iy,&iz,&ietaTower, &iphiTower);
    if (nread == 5) {
      EEDetId eeid(ix,iy,iz,0);
      // std::cout << "-- manu ix eta phi " << DetId(eeid).rawId() << " " << iz << " " << ietaTower << " " << iphiTower << std::endl;
      EcalTrigTowerDetId etid(iz,EcalEndcap,ietaTower,iphiTower);
      theMap.assign(DetId(eeid),etid);
    }
    
  }
  // Pass comment line
  f.get(line,80,'\n');            // read 80 characters to end of line
  f.get(ch);                      // eat out the '\n'
  // Next info line
  f.get(line,80,'\n');            // read 80 characters to end of line
  f.get(ch);                      // eat out the '\n'
  // extract the numbers
  //   int nTE;
  //   sscanf (line, " %d",&nTE);
  //   nTowEta_e=nTE;
  //   while ((ch = f.peek()) != EOF) {
  //     f.get(line,80,'\n');            // read 80 characters to end of line
  //     f.get(ch);                      // eat out the '\n'
  //     // extract the numbers
  //     float bound;
  //     sscanf (line, " %f", &bound);
  //     eta_boundaries.push_back(bound);
  //   }
  
  f.close();
  return;
}
EcalTrigTowerConstituentsMapBuilder::ReturnType EcalTrigTowerConstituentsMapBuilder::produce ( const IdealGeometryRecord iRecord)

Definition at line 55 of file EcalTrigTowerConstituentsMapBuilder.cc.

References mapFile_, parseTextMap(), and parseEventContent::prod.

{
   std::auto_ptr<EcalTrigTowerConstituentsMap> prod(new EcalTrigTowerConstituentsMap());

   if (!mapFile_.empty()) {
     parseTextMap(mapFile_,*prod);
   }
   return prod;
}

Member Data Documentation

Definition at line 49 of file EcalTrigTowerConstituentsMapBuilder.h.

Referenced by produce().