CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelCalibConfiguration Class Reference

#include <SiPixelCalibConfiguration.h>

List of all members.

Public Member Functions

std::vector< short > columnPatternForEvent (const uint32_t &eventnumber) const
uint32_t expectedTotalEvents () const
std::string getCalibrationMode () const
std::vector< short > getColumnPattern () const
short getNTriggers () const
std::vector< short > getRowPattern () const
const std::vector< short > getVCalValues () const
uint32_t nColumnPatterns () const
uint32_t nextPatternChangeForEvent (const uint32_t &eventnumber) const
uint32_t nPatterns () const
uint32_t nRowPatterns () const
uint32_t nVCal () const
uint32_t patternSize () const
std::vector< short > rowPatternForEvent (const uint32_t &eventnumber) const
void setCalibrationMode (const std::string &in)
void setColumnPattern (const std::vector< short > &in)
void setNTriggers (const short &in)
void setRowPattern (const std::vector< short > &in)
void setVCalValues (const std::vector< short > &in)
 SiPixelCalibConfiguration (const pos::PixelCalibConfiguration &fancyConfig)
 SiPixelCalibConfiguration ()
short vcalForEvent (const uint32_t &eventnumber) const
short vcalIndexForEvent (const uint32_t &eventnumber) const
virtual ~SiPixelCalibConfiguration ()

Private Attributes

std::vector< short > fColumnPattern
std::string fMode
short fNTriggers
std::vector< short > fRowPattern
std::vector< short > fVCalValues

Detailed Description

Definition at line 17 of file SiPixelCalibConfiguration.h.


Constructor & Destructor Documentation

SiPixelCalibConfiguration::SiPixelCalibConfiguration ( ) [inline]

Definition at line 22 of file SiPixelCalibConfiguration.h.

{;}
SiPixelCalibConfiguration::SiPixelCalibConfiguration ( const pos::PixelCalibConfiguration fancyConfig)

Definition at line 60 of file SiPixelCalibConfiguration.cc.

References pos::PixelCalibConfiguration::columnList(), gather_cfg::cout, fColumnPattern, fMode, fNTriggers, fRowPattern, fVCalValues, i, j, pos::PixelCalibConfiguration::mode(), pos::PixelCalibConfiguration::nTriggersPerPattern(), pos::PixelCalibConfiguration::rowList(), tablePrinter::rows, pos::PixelCalibConfiguration::scanName(), and pos::PixelCalibConfiguration::scanValues().

                                                                                                 :
  fNTriggers(0),
  fRowPattern(std::vector<short>(0)),
  fColumnPattern(std::vector<short>(0)),
  fVCalValues(std::vector<short>(0)),
  fMode("unknown")

{ // copy constructor that uses the complex object
  fNTriggers = fancyConfig.nTriggersPerPattern();
  std::vector<int> vcalpoints(0);
  std::cout << "scan name = " << fancyConfig.scanName(0) << std::endl;
  std::vector<uint32_t> vcalpointsuint32 = fancyConfig.scanValues(fancyConfig.scanName(0));
  for(size_t ical=0; ical<vcalpointsuint32.size(); ++ical){
    short vcalinput = vcalpointsuint32[ical];
  
    std::cout << "Vcal value " << ical << " = " << vcalinput << std::endl;
    fVCalValues.push_back(vcalinput);
  }
  // copy row and column patterns

  std::vector<std::vector<uint32_t> > cols=fancyConfig.columnList();
  std::vector<std::vector<uint32_t> > rows= fancyConfig.rowList();
  for(uint32_t i=0; i<cols.size(); ++i){
    for(uint32_t j=0; j<cols[i].size(); ++j){
      short colval = cols[i][j];
      fColumnPattern.push_back(colval);
    }
    fColumnPattern.push_back(-1);
  }
  for(uint32_t i=0; i<rows.size(); ++i){
    for(uint32_t j=0; j<rows[i].size(); ++j){
      short rowval = rows[i][j];
      fRowPattern.push_back(rowval);
    }
    fRowPattern.push_back(-1);
  }
  fMode = fancyConfig.mode();
}
virtual SiPixelCalibConfiguration::~SiPixelCalibConfiguration ( ) [inline, virtual]

Definition at line 25 of file SiPixelCalibConfiguration.h.

{;}

Member Function Documentation

std::vector< short > SiPixelCalibConfiguration::columnPatternForEvent ( const uint32_t &  eventnumber) const

Definition at line 14 of file SiPixelCalibConfiguration.cc.

References fColumnPattern, nColumnPatterns(), patternSize(), and query::result.

                                                                                                   {
  std::vector<short> result;
  uint32_t patternnumber = eventnumber/patternSize();
  uint32_t colpatternnumber = patternnumber%nColumnPatterns();

  uint32_t nminuscol=0;
  for(size_t icol=0; icol<fColumnPattern.size(); icol++){
    if(fColumnPattern[icol]==-1)
      nminuscol++;
    else if(nminuscol>colpatternnumber)
      break;
    else if(nminuscol==colpatternnumber){
      short val = fColumnPattern[icol];
      result.push_back(val);
    }
  }
  return result;
}
uint32_t SiPixelCalibConfiguration::expectedTotalEvents ( ) const

Definition at line 56 of file SiPixelCalibConfiguration.cc.

References nPatterns(), and patternSize().

                                                              {
  return patternSize()*nPatterns();
}
std::string SiPixelCalibConfiguration::getCalibrationMode ( ) const [inline]

Definition at line 39 of file SiPixelCalibConfiguration.h.

References fMode.

{return fMode;}
std::vector<short> SiPixelCalibConfiguration::getColumnPattern ( ) const [inline]

Definition at line 35 of file SiPixelCalibConfiguration.h.

References fColumnPattern.

{ return fColumnPattern;}
short SiPixelCalibConfiguration::getNTriggers ( ) const [inline]

Definition at line 29 of file SiPixelCalibConfiguration.h.

References fNTriggers.

Referenced by vcalIndexForEvent().

{ return fNTriggers;}
std::vector<short> SiPixelCalibConfiguration::getRowPattern ( ) const [inline]

Definition at line 32 of file SiPixelCalibConfiguration.h.

References fRowPattern.

{ return fRowPattern;}
const std::vector<short> SiPixelCalibConfiguration::getVCalValues ( ) const [inline]

Definition at line 41 of file SiPixelCalibConfiguration.h.

References fVCalValues.

{ return fVCalValues;}
uint32_t SiPixelCalibConfiguration::nColumnPatterns ( ) const

Definition at line 107 of file SiPixelCalibConfiguration.cc.

References fColumnPattern, and i.

Referenced by columnPatternForEvent(), nPatterns(), and rowPatternForEvent().

                                                         {
  uint32_t ncols = 0;
  
  for(std::vector<short>::const_iterator i=fColumnPattern.begin();i!=fColumnPattern.end();++i){
    if(*i == -1)
    ncols++;
  }
  return ncols;
}
uint32_t SiPixelCalibConfiguration::nextPatternChangeForEvent ( const uint32_t &  eventnumber) const

Definition at line 51 of file SiPixelCalibConfiguration.cc.

References patternSize().

                                                                                                {
  uint32_t relative_event = eventnumber/patternSize();
  relative_event+=1;
  return relative_event*patternSize();
}
uint32_t SiPixelCalibConfiguration::nPatterns ( ) const [inline]

Definition at line 52 of file SiPixelCalibConfiguration.h.

References nColumnPatterns(), and nRowPatterns().

Referenced by expectedTotalEvents().

uint32_t SiPixelCalibConfiguration::nRowPatterns ( ) const

Definition at line 99 of file SiPixelCalibConfiguration.cc.

References fRowPattern, and i.

Referenced by nPatterns().

                                                      {
 uint32_t nrows = 0;
 for(std::vector<short>::const_iterator i=fRowPattern.begin();i!=fRowPattern.end();++i){
   if(*i == -1)
    nrows++;
  }
  return nrows;
}
uint32_t SiPixelCalibConfiguration::nVCal ( ) const [inline]

Definition at line 55 of file SiPixelCalibConfiguration.h.

References fVCalValues.

{ return fVCalValues.size();}
uint32_t SiPixelCalibConfiguration::patternSize ( ) const [inline]
std::vector< short > SiPixelCalibConfiguration::rowPatternForEvent ( const uint32_t &  eventnumber) const

Definition at line 33 of file SiPixelCalibConfiguration.cc.

References fRowPattern, nColumnPatterns(), patternSize(), and query::result.

                                                                                                 {
  std::vector<short> result;
  uint32_t patternnumber = eventnumber/patternSize();
  uint32_t rowpatternnumber = patternnumber/nColumnPatterns();

  uint32_t nminusrow=0;
  for(size_t irow=0; irow<fRowPattern.size(); irow++){
    if(fRowPattern[irow]==-1)
      nminusrow++;
    else if(nminusrow>rowpatternnumber)
      break;
    else if(nminusrow==rowpatternnumber){
      short val = fRowPattern[irow];
      result.push_back(val);
    }
  }
  return result;
}
void SiPixelCalibConfiguration::setCalibrationMode ( const std::string &  in) [inline]

Definition at line 38 of file SiPixelCalibConfiguration.h.

References fMode, and recoMuon::in.

{ fMode = in; }
void SiPixelCalibConfiguration::setColumnPattern ( const std::vector< short > &  in) [inline]

Definition at line 36 of file SiPixelCalibConfiguration.h.

References fColumnPattern, and recoMuon::in.

void SiPixelCalibConfiguration::setNTriggers ( const short &  in) [inline]

Definition at line 30 of file SiPixelCalibConfiguration.h.

References fNTriggers, and recoMuon::in.

{ fNTriggers = in; }
void SiPixelCalibConfiguration::setRowPattern ( const std::vector< short > &  in) [inline]

Definition at line 33 of file SiPixelCalibConfiguration.h.

References fRowPattern, and recoMuon::in.

{ fRowPattern = in; }
void SiPixelCalibConfiguration::setVCalValues ( const std::vector< short > &  in) [inline]

Definition at line 42 of file SiPixelCalibConfiguration.h.

References fVCalValues, and recoMuon::in.

{ fVCalValues = in; }
short SiPixelCalibConfiguration::vcalForEvent ( const uint32_t &  eventnumber) const

Definition at line 10 of file SiPixelCalibConfiguration.cc.

References fVCalValues, query::result, and vcalIndexForEvent().

                                                                               {
  short result = fVCalValues[vcalIndexForEvent(eventnumber)];
  return result;
}
short SiPixelCalibConfiguration::vcalIndexForEvent ( const uint32_t &  eventnumber) const

Definition at line 5 of file SiPixelCalibConfiguration.cc.

References abs, getNTriggers(), and patternSize().

Referenced by vcalForEvent().

                                                                                    {
  uint32_t relative_event = abs(eventnumber-1)%patternSize();
  short relative_pattern = relative_event/getNTriggers();
  return relative_pattern; 
}

Member Data Documentation

std::vector<short> SiPixelCalibConfiguration::fColumnPattern [private]
std::string SiPixelCalibConfiguration::fMode [private]
std::vector<short> SiPixelCalibConfiguration::fRowPattern [private]
std::vector<short> SiPixelCalibConfiguration::fVCalValues [private]