CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

PixelToFEDAssociateFromAscii Class Reference

#include <PixelToFEDAssociateFromAscii.h>

Inheritance diagram for PixelToFEDAssociateFromAscii:
PixelToFEDAssociate

List of all members.

Classes

struct  Bdu
struct  Edu

Public Member Functions

virtual int operator() (const PixelModuleName &) const
 FED id for module.
virtual int operator() (const PixelEndcapName &) const
 FED id to which endcape modul (identified by name) should be assigned.
virtual int operator() (const PixelBarrelName &) const
 FED id to which barrel modul (identified by name) should be assigned.
 PixelToFEDAssociateFromAscii (const std::string &fileName)
virtual std::string version () const
 version

Private Types

typedef std::vector< std::pair
< int, std::vector< Bdu > > > 
BarrelConnections
typedef std::vector< std::pair
< int, std::vector< Edu > > > 
EndcapConnections
typedef TRange< int > Range

Private Member Functions

Bdu getBdu (std::string) const
Edu getEdu (std::string) const
void init (const std::string &fileName)
 initialisatin (read file)
Range readRange (const std::string &) const
void send (std::pair< int, std::vector< Bdu > > &, std::pair< int, std::vector< Edu > > &) const
 initialisation (read input file)

Private Attributes

std::string theVersion

Static Private Attributes

static BarrelConnections theBarrel = PixelToFEDAssociateFromAscii::BarrelConnections()
static EndcapConnections theEndcap = PixelToFEDAssociateFromAscii::EndcapConnections()

Detailed Description

Check to which FED pixel module belongs to. The associacions are read from the datafile

Definition at line 21 of file PixelToFEDAssociateFromAscii.h.


Member Typedef Documentation

typedef std::vector< std::pair< int, std::vector<Bdu> > > PixelToFEDAssociateFromAscii::BarrelConnections [private]

Definition at line 54 of file PixelToFEDAssociateFromAscii.h.

typedef std::vector< std::pair< int, std::vector<Edu> > > PixelToFEDAssociateFromAscii::EndcapConnections [private]

Definition at line 55 of file PixelToFEDAssociateFromAscii.h.

Definition at line 44 of file PixelToFEDAssociateFromAscii.h.


Constructor & Destructor Documentation

PixelToFEDAssociateFromAscii::PixelToFEDAssociateFromAscii ( const std::string &  fileName)

Definition at line 20 of file PixelToFEDAssociateFromAscii.cc.

References init.

                                                                            {
  init(fn);
}

Member Function Documentation

PixelToFEDAssociateFromAscii::Bdu PixelToFEDAssociateFromAscii::getBdu ( std::string  ) const [private]

Definition at line 180 of file PixelToFEDAssociateFromAscii.cc.

References PixelToFEDAssociateFromAscii::Bdu::b, PixelToFEDAssociateFromAscii::Bdu::f, PixelToFEDAssociateFromAscii::Bdu::l, pos, query::result, and PixelToFEDAssociateFromAscii::Bdu::z.

{
  Bdu result;
  string::size_type pos;

  result.b =  readRange(line).first;

  pos = line.find("L:");
  if (pos != string::npos) line = line.substr(pos+2);
  result.l = readRange(line);

  pos = line.find("Z:");
  if (pos != string::npos) line = line.substr(pos+2);
  result.z = readRange(line);

  pos = line.find("F:");
  if (pos != string::npos) line = line.substr(pos+2);
  result.f = readRange(line);

  return result;
}
PixelToFEDAssociateFromAscii::Edu PixelToFEDAssociateFromAscii::getEdu ( std::string  ) const [private]

Definition at line 202 of file PixelToFEDAssociateFromAscii.cc.

References PixelToFEDAssociateFromAscii::Edu::b, PixelToFEDAssociateFromAscii::Edu::d, PixelToFEDAssociateFromAscii::Edu::e, pos, and query::result.

{
  Edu result;
  string::size_type pos;

  result.e = readRange(line).first;

  pos = line.find("D:");
  if (pos != string::npos) line = line.substr(pos+2);
  result.d = readRange(line);

  pos = line.find("B:");
  if (pos != string::npos) line = line.substr(pos+2);
  result.b = readRange(line);
  
  return result;
}
void PixelToFEDAssociateFromAscii::init ( const std::string &  fileName) [private]

initialisatin (read file)

int PixelToFEDAssociateFromAscii::operator() ( const PixelModuleName id) const [virtual]

FED id for module.

Reimplemented from PixelToFEDAssociate.

Definition at line 28 of file PixelToFEDAssociateFromAscii.cc.

{
  return id.isBarrel() ?
    operator()(dynamic_cast<const PixelBarrelName & >(id)) :
    operator()(dynamic_cast<const PixelEndcapName & >(id)) ;
}
int PixelToFEDAssociateFromAscii::operator() ( const PixelEndcapName id) const [virtual]

FED id to which endcape modul (identified by name) should be assigned.

Definition at line 52 of file PixelToFEDAssociateFromAscii.cc.

{
  for (EndcapConnections::const_iterator
      iec = theEndcap.begin(); iec != theEndcap.end(); iec++) {
    for (vector<Edu>::const_iterator
        ied = (*iec).second.begin(); ied != (*iec).second.end(); ied++) {
      if (    ied->e == id.halfCylinder() 
           && ied->d.inside( id.diskName() )
           && ied->b.inside( id.bladeName() ) ) return iec->first; 
    }
  }
  edm::LogError("** PixelToFEDAssociateFromAscii WARNING, name: ")
       << id.name()<<" not associated to FED";
  return -1;
}
int PixelToFEDAssociateFromAscii::operator() ( const PixelBarrelName id) const [virtual]

FED id to which barrel modul (identified by name) should be assigned.

Definition at line 35 of file PixelToFEDAssociateFromAscii.cc.

{
  for (BarrelConnections::const_iterator
      ibc = theBarrel.begin(); ibc != theBarrel.end(); ibc++) {
    for (vector<Bdu>::const_iterator
        ibd = (*ibc).second.begin(); ibd != (*ibc).second.end(); ibd++) {
      if (    ibd->b == id.shell() 
           && ibd->l.inside( id.layerName() )
           && ibd->z.inside( id.moduleName() )
           && ibd->f.inside( id.ladderName() ) ) return (*ibc).first; 
    }
  }
  edm::LogError("** PixelToFEDAssociateFromAscii WARNING, name: ")
       << id.name()<<" not associated to FED";
  return -1;
}
Range PixelToFEDAssociateFromAscii::readRange ( const std::string &  ) const [private]
void PixelToFEDAssociateFromAscii::send ( std::pair< int, std::vector< Bdu > > &  ,
std::pair< int, std::vector< Edu > > &   
) const [private]

initialisation (read input file)

std::string PixelToFEDAssociateFromAscii::version ( ) const [virtual]

version

Implements PixelToFEDAssociate.

Definition at line 23 of file PixelToFEDAssociateFromAscii.cc.

{
  return theVersion; 
}

Member Data Documentation

Definition at line 56 of file PixelToFEDAssociateFromAscii.h.

Definition at line 57 of file PixelToFEDAssociateFromAscii.h.

Definition at line 61 of file PixelToFEDAssociateFromAscii.h.