CMS 3D CMS Logo

EcalTPParameters Class Reference

Author: P.Paganini, Ursula Berthon Created: 20 March 2007
Id
EcalTPParameters.h,v 1.5 2007/06/14 17:14:33 uberthon Exp
. More...

#include <CondFormats/L1TObjects/interface/EcalTPParameters.h>

List of all members.

Public Member Functions

void changeThresholds (double ttfLowEB, double ttfHighEB, double ttfLowEE, double ttfHighEE)
 EcalTPParameters ()
double getEtSatEB () const
double getEtSatEE () const
std::vector< unsigned int > const * getStripParameters (int SM, int towerInSM, int stripInTower, bool print=false) const
std::vector< unsigned int > const * getTowerParameters (int SM, int towerInSM, bool print=false) const
double getTPGinGeVEB (unsigned int nrSM, unsigned int nrTowerInSM, unsigned int compressedEt) const
double getTPGinGeVEE (unsigned int nrSM, unsigned int nrTowerInSM, unsigned int compressedEt) const
std::vector< unsigned int > const * getXtalParameters (int SM, int towerInSM, int stripInTower, int xtalInStrip, bool print=false) const
void setConstants (const int nbMaxTowers, const int nbMaxStrips, const int nbMaxXtals, const int nrMinTccEB, const int nrMaxTccEB)
void setPhysicsParameters (std::vector< float > params)
void setStripParameters (int SM, int towerInSM, int stripInTower, std::vector< unsigned int > params)
void setTowerParameters (int SM, int towerInSM, std::vector< unsigned int > params)
void setXtalParameters (int SM, int towerInSM, int stripInTower, int xtalInStrip, std::vector< unsigned int > params)
 ~EcalTPParameters ()

Static Public Attributes

static int nbMaxStrips_ = 0
static int nbMaxTowers_ = 0
static int nbMaxXtals_ = 0
static int nrMaxTccEB_ = 0
static int nrMinTccEB_ = 0
 Author: P.Paganini, Ursula Berthon Created: 20 March 2007
Id
EcalTPParameters.cc,v 1.7 2008/01/22 18:50:24 muzaffar Exp
.

Private Member Functions

int getIndex (int SM, int towerInSM, int stripInTower=0, int xtalInStrip=0) const
void update ()

Private Attributes

double EtSatEB_
double EtSatEE_
std::map< int, std::vector
< unsigned int > > 
stripParam_
std::map< int, std::vector
< unsigned int > > 
towerParam_
double ttfHighEB_
double ttfHighEE_
double ttfLowEB_
double ttfLowEE_
double xtalLsbEB_
double xtalLsbEE_
std::map< int, std::vector
< unsigned int > > 
xtalParam_


Detailed Description

Author: P.Paganini, Ursula Berthon Created: 20 March 2007
Id
EcalTPParameters.h,v 1.5 2007/06/14 17:14:33 uberthon Exp
.

Definition at line 12 of file EcalTPParameters.h.


Constructor & Destructor Documentation

EcalTPParameters::EcalTPParameters (  ) 

Definition at line 17 of file EcalTPParameters.cc.

References ttfHighEB_, ttfHighEE_, ttfLowEB_, and ttfLowEE_.

00017                                      {
00018   //FIXME should be those used in TPG.txt.... could they be put in TPG.txt?
00019   ttfLowEB_=0;
00020   ttfHighEB_= 0;
00021   ttfLowEE_= 0;
00022   ttfHighEE_=0;
00023 }

EcalTPParameters::~EcalTPParameters (  ) 

Definition at line 25 of file EcalTPParameters.cc.

00025                                     {
00026 
00027 }


Member Function Documentation

void EcalTPParameters::changeThresholds ( double  ttfLowEB,
double  ttfHighEB,
double  ttfLowEE,
double  ttfHighEE 
)

Definition at line 36 of file EcalTPParameters.cc.

References ttfHighEB_, ttfHighEE_, ttfLowEB_, ttfLowEE_, and update().

00036                                                                                                             {
00037   if (  ttfLowEB_==ttfLowEB &&  ttfHighEB_== ttfHighEB &&  ttfLowEE_== ttfLowEE &&  ttfHighEE_==ttfHighEE) return;
00038   ttfLowEB_=ttfLowEB ;
00039   ttfHighEB_= ttfHighEB;
00040   ttfLowEE_= ttfLowEE;
00041   ttfHighEE_=ttfHighEE;
00042   update();
00043 }

double EcalTPParameters::getEtSatEB (  )  const [inline]

Definition at line 23 of file EcalTPParameters.h.

References EtSatEB_.

00023 {return EtSatEB_;}

double EcalTPParameters::getEtSatEE (  )  const [inline]

Definition at line 24 of file EcalTPParameters.h.

References EtSatEE_.

00024 {return EtSatEE_;}

int EcalTPParameters::getIndex ( int  SM,
int  towerInSM,
int  stripInTower = 0,
int  xtalInStrip = 0 
) const [private]

Definition at line 104 of file EcalTPParameters.cc.

References i, nbMaxStrips_, nbMaxTowers_, and nbMaxXtals_.

Referenced by getStripParameters(), getTowerParameters(), getXtalParameters(), setStripParameters(), setTowerParameters(), and setXtalParameters().

00104                                                                                                 { 
00105 
00106   int i=nbMaxTowers_*TCC + towerInTCC ;
00107   if (stripInTower>0) i=i*nbMaxStrips_+stripInTower;
00108   if (xtalInStrip>0) i=i*nbMaxXtals_+xtalInStrip;
00109   return i;
00110 }

std::vector< unsigned int > const * EcalTPParameters::getStripParameters ( int  SM,
int  towerInSM,
int  stripInTower,
bool  print = false 
) const

Definition at line 67 of file EcalTPParameters.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Exception, getIndex(), i, it, and stripParam_.

00068 {
00069   std::map<int, std::vector<unsigned int> >::const_iterator it ;
00070   it = stripParam_.find(getIndex(TCC,towerInTCC,stripInTower));
00071   if (it == stripParam_.end()) {
00072     throw cms::Exception("EcalTPG")<<"===> EcalTPParameters::getStripParameters("<<std::dec<<TCC<<", "<<towerInTCC<<", "<<stripInTower<<")";
00073   }
00074   if (print) {
00075     std::vector<unsigned int> param = it->second ;
00076     param = it->second ;
00077     std::cout<<"===> EcalTPParameters::getStripParameters("<<std::dec<<TCC<<", "<<towerInTCC<<", "<<stripInTower<<")"<<std::endl ;
00078     std::cout<<"sliding window = "<<std::hex<<param[0]<<std::endl ;
00079     for (int i=0 ; i<5 ; i++) std::cout<<"Weight["<<std::dec<<i<<"] ="<<std::hex<<param[i+1]<<std::endl ;
00080   }
00081   return &(it->second);
00082 }

std::vector< unsigned int > const * EcalTPParameters::getTowerParameters ( int  SM,
int  towerInSM,
bool  print = false 
) const

Definition at line 45 of file EcalTPParameters.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Exception, getIndex(), it, nrMaxTccEB_, nrMinTccEB_, and towerParam_.

Referenced by getTPGinGeVEB(), getTPGinGeVEE(), and update().

00046 {
00047   std::map<int, std::vector<unsigned int> >::const_iterator it ;
00048   it = towerParam_.find(getIndex(TCC,towerInTCC));
00049   if (it == towerParam_.end()) {
00050     throw cms::Exception("EcalTPG")<<"===> EcalTPParameters::getTowerParameters("<<std::dec<<TCC<<", "<<towerInTCC<<")";
00051   }
00052   if (print) {
00053     std::vector<unsigned int> param = it->second ;
00054     if (TCC>=nrMinTccEB_   && TCC<= nrMaxTccEB_ ) {
00055       std::cout<<"===> EcalTPParameters::getTowerParameters("<<std::dec<<TCC<<", "<<towerInTCC<<")"<<std::endl ;
00056       //    for (int i=0 ; i<1024 ; i++) std::cout<<"LUT["<<std::dec<<i<<"] = "<<std::hex<<param[i]<<std::endl ;
00057       // barrel only
00058       std::cout<<"Fine Grain:  el="<<param[1024]<<", eh="<<param[1025]  //FIXME 
00059                <<", tl="<<param[1026]<<",  th="<<param[1027]
00060                <<", lut_fg="<<param[1028]<<std::endl ;
00061     } else
00062       std::cout<<"Fine Grain:  tower_lut_fg="<<std::hex<<param[1024]<<std::endl ;
00063   }
00064   return &(it->second);
00065 }

double EcalTPParameters::getTPGinGeVEB ( unsigned int  nrSM,
unsigned int  nrTowerInSM,
unsigned int  compressedEt 
) const

Definition at line 112 of file EcalTPParameters.cc.

References EtSatEB_, getTowerParameters(), i, and lut.

00112                                                                                                                  {
00113   //FIXME!! 1024 should be a database constant....
00114     
00115   double lsb_tcp = EtSatEB_/1024 ;//FIXME!!
00116   std::vector<unsigned int> const *lut;
00117   lut=this->getTowerParameters(TCC,towerInTCC,lut) ;
00118   if (lut->size() <1024) { //FIXME!!
00119     // FIXME should throw an exception!
00120     return 0. ;
00121   }
00122 
00123   unsigned int lin_TPG = 1024 ;
00124   for (unsigned int i=0 ; i<1024 ; i++) {
00125     if ((*lut)[i] == compressedEt) {
00126       lin_TPG = i ;
00127       break ;
00128     }
00129   }
00130   if (lin_TPG >= 1024) {
00131     // FIXME should throw an exception!
00132     return 0. ;
00133   } 
00134 
00135   return lin_TPG*lsb_tcp ;
00136 }

double EcalTPParameters::getTPGinGeVEE ( unsigned int  nrSM,
unsigned int  nrTowerInSM,
unsigned int  compressedEt 
) const

Definition at line 138 of file EcalTPParameters.cc.

References EtSatEE_, getTowerParameters(), i, and lut.

00138                                                                                                                  {
00139 //FIXME!! 1024 should be a database constant....
00140     
00141   double lsb_tcp = EtSatEE_/1024 ;//FIXME!!
00142   std::vector<unsigned int> *lut;
00143   this->getTowerParameters(TCC,towerInTCC,lut) ;
00144    if (lut->size() <1024) { //FIXME!!
00145     // FIXME should throw an exception!
00146     return 0. ;
00147   }
00148 
00149   unsigned int lin_TPG = 1024 ;
00150   for (unsigned int i=0 ; i<1024 ; i++) {
00151    if ((*lut)[i] == compressedEt) {
00152      lin_TPG = i ;
00153      break ;
00154    }
00155   }
00156   if (lin_TPG >= 1024) {
00157     // FIXME should throw an exception!
00158     return 0. ;
00159   } 
00160 
00161   return lin_TPG*lsb_tcp ;
00162 }

std::vector< unsigned int > const * EcalTPParameters::getXtalParameters ( int  SM,
int  towerInSM,
int  stripInTower,
int  xtalInStrip,
bool  print = false 
) const

Definition at line 84 of file EcalTPParameters.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), Exception, getIndex(), it, and xtalParam_.

00085 {
00086 
00087   std::map<int, std::vector<unsigned int> >::const_iterator it ;
00088   it = xtalParam_.find(getIndex(TCC,towerInTCC,stripInTower,xtalInStrip));
00089   if (it == xtalParam_.end()) {
00090     throw cms::Exception("EcalTPG")<<"===> EcalTPParameters::couldnt find entry for getXtalParameters("<<std::dec<<TCC<<", "
00091                                    <<towerInTCC<<", "<<stripInTower<<", "<<xtalInStrip<<")";
00092   }
00093   if (print) {
00094     std::vector<unsigned int> param = it->second ;
00095     std::cout<<"===> EcalTPParameters::getXtalParameters("<<std::dec<<TCC<<", "
00096              <<towerInTCC<<", "<<stripInTower<<", "<<xtalInStrip<<")"<<std::endl ;
00097     std::cout<<"Gain12, ped = "<<std::hex<<param[0]<<", mult = "<<param[1]<<", shift = "<<param[2]<<std::endl ;
00098     std::cout<<"Gain6,  ped = "<<std::hex<<param[3]<<", mult = "<<param[4]<<", shift = "<<param[5]<<std::endl ;
00099     std::cout<<"Gain1,  ped = "<<std::hex<<param[6]<<", mult = "<<param[7]<<", shift = "<<param[8]<<std::endl ;
00100   }
00101   return &(it->second);
00102 }

void EcalTPParameters::setConstants ( const int  nbMaxTowers,
const int  nbMaxStrips,
const int  nbMaxXtals,
const int  nrMinTccEB,
const int  nrMaxTccEB 
)

Definition at line 28 of file EcalTPParameters.cc.

References nbMaxStrips_, nbMaxTowers_, nbMaxXtals_, nrMaxTccEB_, and nrMinTccEB_.

00028                                                                                                                                                   {
00029   nbMaxTowers_=nbMaxTowers;
00030   nbMaxStrips_=nbMaxStrips;
00031   nbMaxXtals_=nbMaxXtals;
00032   nrMinTccEB_=nrMinTccEB;
00033   nrMaxTccEB_=nrMaxTccEB;
00034 }

void EcalTPParameters::setPhysicsParameters ( std::vector< float >  params  )  [inline]

Definition at line 37 of file EcalTPParameters.h.

References EtSatEB_, ttfHighEB_, ttfLowEB_, and xtalLsbEB_.

00038     {xtalLsbEB_ = params[0]; EtSatEB_ = params[1]; ttfLowEB_ = params[2]; ttfHighEB_ = params[3]; }         

void EcalTPParameters::setStripParameters ( int  SM,
int  towerInSM,
int  stripInTower,
std::vector< unsigned int params 
) [inline]

Definition at line 32 of file EcalTPParameters.h.

References getIndex(), and stripParam_.

00033     {stripParam_[getIndex(SM,towerInSM,stripInTower)]=params;}

void EcalTPParameters::setTowerParameters ( int  SM,
int  towerInSM,
std::vector< unsigned int params 
) [inline]

Definition at line 29 of file EcalTPParameters.h.

References getIndex(), and towerParam_.

Referenced by update().

00030     {towerParam_[getIndex(SM,towerInSM)]=params;
00031     }         

void EcalTPParameters::setXtalParameters ( int  SM,
int  towerInSM,
int  stripInTower,
int  xtalInStrip,
std::vector< unsigned int params 
) [inline]

Definition at line 34 of file EcalTPParameters.h.

References getIndex(), and xtalParam_.

00035     {xtalParam_[getIndex(SM,towerInSM,stripInTower,xtalInStrip)]=params;
00036     }

void EcalTPParameters::update (  )  [private]

Definition at line 164 of file EcalTPParameters.cc.

References EtSatEB_, getTowerParameters(), i, lut, nbMaxTowers_, nrMaxTccEB_, nrMinTccEB_, setTowerParameters(), ttfHighEB_, and ttfLowEB_.

Referenced by changeThresholds().

00164                               {
00165   //FIXME: endcap?
00166 
00167   // 1st ttf thresholds:
00168   double lsb_tcp_EB = EtSatEB_/1024 ;
00169   unsigned int ttfLowEB_ADC = static_cast<unsigned int>(ttfLowEB_/lsb_tcp_EB) ;
00170   unsigned int ttfHighEB_ADC =  static_cast<unsigned int>(ttfHighEB_/lsb_tcp_EB );
00171 
00172    for (int tcc=nrMinTccEB_ ; tcc<=nrMaxTccEB_ ; tcc++) {
00173     for (int tower=1 ; tower<=nbMaxTowers_ ; tower++) {
00174        std::vector<unsigned int> * lut;
00175        lut= const_cast<std::vector<unsigned int> *> (getTowerParameters(tcc, tower));
00176        for (unsigned int i=0 ; i<1024 ; i++) {
00177         int ttf = 0 ;
00178         if (i>=ttfHighEB_ADC) ttf = 3 ; 
00179         if (i>=ttfLowEB_ADC && i<ttfHighEB_ADC) ttf = 1 ;
00180         ttf = ttf<<8 ; 
00181         (*lut)[i] = ((*lut)[i] & 0xff) + ttf ;
00182       }
00183       setTowerParameters(tcc, tower, (*lut)) ;
00184     } 
00185   }
00186 }


Member Data Documentation

double EcalTPParameters::EtSatEB_ [private]

Definition at line 62 of file EcalTPParameters.h.

Referenced by getEtSatEB(), getTPGinGeVEB(), setPhysicsParameters(), and update().

double EcalTPParameters::EtSatEE_ [private]

Definition at line 63 of file EcalTPParameters.h.

Referenced by getEtSatEE(), and getTPGinGeVEE().

int EcalTPParameters::nbMaxStrips_ = 0 [static]

Definition at line 43 of file EcalTPParameters.h.

Referenced by getIndex(), and setConstants().

int EcalTPParameters::nbMaxTowers_ = 0 [static]

Definition at line 42 of file EcalTPParameters.h.

Referenced by getIndex(), setConstants(), and update().

int EcalTPParameters::nbMaxXtals_ = 0 [static]

Definition at line 44 of file EcalTPParameters.h.

Referenced by getIndex(), and setConstants().

int EcalTPParameters::nrMaxTccEB_ = 0 [static]

Definition at line 46 of file EcalTPParameters.h.

Referenced by getTowerParameters(), setConstants(), and update().

int EcalTPParameters::nrMinTccEB_ = 0 [static]

Author: P.Paganini, Ursula Berthon Created: 20 March 2007

Id
EcalTPParameters.cc,v 1.7 2008/01/22 18:50:24 muzaffar Exp
.

Definition at line 45 of file EcalTPParameters.h.

Referenced by getTowerParameters(), setConstants(), and update().

std::map<int, std::vector<unsigned int> > EcalTPParameters::stripParam_ [private]

Definition at line 66 of file EcalTPParameters.h.

Referenced by getStripParameters(), and setStripParameters().

std::map<int, std::vector<unsigned int> > EcalTPParameters::towerParam_ [private]

Definition at line 65 of file EcalTPParameters.h.

Referenced by getTowerParameters(), and setTowerParameters().

double EcalTPParameters::ttfHighEB_ [private]

Definition at line 56 of file EcalTPParameters.h.

Referenced by changeThresholds(), EcalTPParameters(), setPhysicsParameters(), and update().

double EcalTPParameters::ttfHighEE_ [private]

Definition at line 58 of file EcalTPParameters.h.

Referenced by changeThresholds(), and EcalTPParameters().

double EcalTPParameters::ttfLowEB_ [private]

Definition at line 55 of file EcalTPParameters.h.

Referenced by changeThresholds(), EcalTPParameters(), setPhysicsParameters(), and update().

double EcalTPParameters::ttfLowEE_ [private]

Definition at line 57 of file EcalTPParameters.h.

Referenced by changeThresholds(), and EcalTPParameters().

double EcalTPParameters::xtalLsbEB_ [private]

Definition at line 60 of file EcalTPParameters.h.

Referenced by setPhysicsParameters().

double EcalTPParameters::xtalLsbEE_ [private]

Definition at line 61 of file EcalTPParameters.h.

std::map<int, std::vector<unsigned int> > EcalTPParameters::xtalParam_ [private]

Definition at line 67 of file EcalTPParameters.h.

Referenced by getXtalParameters(), and setXtalParameters().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:00 2009 for CMSSW by  doxygen 1.5.4