CMS 3D CMS Logo

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

TMom Class Reference

#include <TMom.h>

List of all members.

Public Member Functions

void addEntry (double val)
void addEntry (double val, std::vector< double > valcut)
double getM3 ()
double getMax ()
double getMean ()
double getMean2 ()
double getMean3 ()
double getMin ()
int getNevt ()
std::vector< double > getPeak ()
double getRMS ()
void setCut (double, double)
void setCut (std::vector< double >, std::vector< double >)
 TMom ()
 TMom (std::vector< double >, std::vector< double >)
 TMom (double, double)
virtual ~TMom ()

Public Attributes

int _dimCut

Private Member Functions

void init (double, double)
void init (std::vector< double >, std::vector< double >)

Private Attributes

std::vector< double > _ampl
std::vector< double > _cutHigh
std::vector< double > _cutLow
int bing [101]
double M3
double max
double mean
double mean2
double mean3
double min
int nevt
double peak
double rms
double sum
double sum2
double sum3

Detailed Description

Definition at line 7 of file TMom.h.


Constructor & Destructor Documentation

TMom::TMom ( )

Definition at line 20 of file TMom.cc.

References init.

{
  init(0.0,10.0e9);
}
TMom::TMom ( double  cutlow,
double  cuthigh 
)

Definition at line 26 of file TMom.cc.

References init.

{
  init(cutlow,cuthigh);
}
TMom::TMom ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
)

Definition at line 30 of file TMom.cc.

References init.

{
  init(cutlow,cuthigh);
}
TMom::~TMom ( ) [virtual]

Definition at line 36 of file TMom.cc.

{
}

Member Function Documentation

void TMom::addEntry ( double  val)

Definition at line 111 of file TMom.cc.

References revisionDML::addEntry().

Referenced by EcalABAnalyzer::analyze(), EcalLaserAnalyzer::analyze(), EcalLaserAnalyzer2::analyze(), and EcalTestPulseAnalyzer::endJob().

{
  std::vector<double> dumb;
  dumb.push_back(val);
  addEntry(val,dumb);
}
void TMom::addEntry ( double  val,
std::vector< double >  valcut 
)

Definition at line 118 of file TMom.cc.

References max(), and min.

{
  
  int passingAllCuts=1;
  
  for (int iCut=0;iCut<_dimCut;iCut++){
    int passing;
    if( valcut.at(iCut)>_cutLow.at(iCut) && valcut.at(iCut) <=_cutHigh.at(iCut) ){
      passing=1;
    }else passing=0;
    passingAllCuts*=passing; 
  }
  
  if( passingAllCuts == 1 ){
    
    nevt+=1;
    sum+=val;
    sum2+=val*val;
    sum3+=val*val*val;
    if(val>max) max=val;
    if(val<min) min=val;
    
    // for peak stuff 
    _ampl.push_back(val);
  }
  
}
double TMom::getM3 ( )

Definition at line 175 of file TMom.cc.

References m.

Referenced by EcalTestPulseAnalyzer::endJob().

                  {

  double m=getMean(); 
  double m2=getMean2();
  double m3=getMean3();
  double sig = getRMS();
  
  if(nevt!=0 && sig!=0) M3=( m3 - 3.0*m*(m2-m*m) - m*m*m )/(sig*sig*sig); 
  else M3=0.0;
  return M3;
}
double TMom::getMax ( )

Definition at line 188 of file TMom.cc.

References max().

Referenced by EcalTestPulseAnalyzer::endJob().

{return max;}
double TMom::getMean ( )
double TMom::getMean2 ( )

Definition at line 154 of file TMom.cc.

                      {
  if(nevt!=0) mean2=sum2/nevt;
  else mean2=0.0;
  return mean2;
}
double TMom::getMean3 ( )

Definition at line 159 of file TMom.cc.

                      {
  if(nevt!=0) mean3=sum3/nevt;
  else mean3=0.0;
  return mean3;
}
double TMom::getMin ( )

Definition at line 187 of file TMom.cc.

References min.

Referenced by EcalTestPulseAnalyzer::endJob().

{return min;}
int TMom::getNevt ( )

Definition at line 165 of file TMom.cc.

Referenced by EcalTestPulseAnalyzer::endJob().

{ return nevt;}
std::vector< double > TMom::getPeak ( )

Definition at line 190 of file TMom.cc.

References i, gen::k, max(), min, and L1TEmulatorMonitor_cff::p.

                               {
  
  std::vector<double> p;
  double wbin=(max-min)/100.;
  int bung;
  
  for(unsigned int i=0;i<_ampl.size();i++){
    if(wbin <= 0.0)
      bung=1;
    else
      bung= (int) ((_ampl.at(i)-min)/wbin)+1;
    if(1 <= bung && bung <= 100)
      bing[bung]++;
  }
  
  TMarkov *peakM = new TMarkov();

  int nbmax=0;
  int popmax=0;
  
  for(int k=1;k<101;k++) {
    if(bing[k] > popmax) {
      popmax=bing[k];
      nbmax=k;
    }
  }
  
  peakM -> peakFinder(&bing[0]);
  p.push_back(peakM -> getPeakValue(0));
  p.push_back(peakM -> getPeakValue(1));
        
  return p;
}
double TMom::getRMS ( )

Definition at line 167 of file TMom.cc.

References m, and plotscripts::rms().

Referenced by EcalTestPulseAnalyzer::endJob().

                    {
  double m=getMean(); 
  double m2=getMean2(); 
  if(nevt!=0) rms=TMath::Sqrt( m2 - m*m );
  else rms=0.0;
  return rms;
}
void TMom::init ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
) [private]

Definition at line 65 of file TMom.cc.

References i, max(), plotscripts::mean(), min, and plotscripts::rms().

{

  nevt=0;
  mean=0;
  mean2=0;
  mean3=0;
  sum=0;
  sum2=0;
  sum3=0;
  rms=0;
  M3=0;
  peak=0;
  min=10.0e9;
  max=0.;
  assert(cutlow.size()==cuthigh.size());  
  _cutLow.clear();
  _cutHigh.clear();
  _dimCut=cutlow.size();
  _cutLow=cutlow;
  _cutHigh=cuthigh;
  for(int i=0;i<101;i++){
    bing[i]=0;
  }
  
}
void TMom::init ( double  cutlow,
double  cuthigh 
) [private]

Definition at line 40 of file TMom.cc.

References i, max(), plotscripts::mean(), min, and plotscripts::rms().

{

  nevt=0;
  mean=0;
  mean2=0;
  mean3=0;
  sum=0;
  sum2=0;
  sum3=0;
  rms=0;
  M3=0;
  peak=0;
  min=10.0e9;
  max=0.;
  _cutLow.clear();
  _cutHigh.clear();
  _dimCut=1;
  _cutLow.push_back(cutlow);
  _cutHigh.push_back(cuthigh);
  for(int i=0;i<101;i++){
    bing[i]=0;
  }
  
}
void TMom::setCut ( std::vector< double >  cutlow,
std::vector< double >  cuthigh 
)

Definition at line 100 of file TMom.cc.

                                                                    {
  
  assert(cutlow.size( )== cuthigh.size());
  _cutLow.clear();
  _cutHigh.clear();
  _dimCut=cutlow.size();
  _cutLow=cutlow;
  _cutHigh=cuthigh;
  
}
void TMom::setCut ( double  cutlow,
double  cuthigh 
)

Definition at line 91 of file TMom.cc.

                                              {

  _cutLow.clear();
  _cutHigh.clear();
  _dimCut=1;
  _cutLow.push_back(cutlow);
  _cutHigh.push_back(cuthigh);

}

Member Data Documentation

std::vector<double> TMom::_ampl [private]

Definition at line 27 of file TMom.h.

std::vector<double> TMom::_cutHigh [private]

Definition at line 26 of file TMom.h.

std::vector<double> TMom::_cutLow [private]

Definition at line 25 of file TMom.h.

Definition at line 35 of file TMom.h.

int TMom::bing[101] [private]

Definition at line 24 of file TMom.h.

double TMom::M3 [private]

Definition at line 20 of file TMom.h.

double TMom::max [private]

Definition at line 23 of file TMom.h.

double TMom::mean [private]

Definition at line 13 of file TMom.h.

double TMom::mean2 [private]

Definition at line 14 of file TMom.h.

double TMom::mean3 [private]

Definition at line 15 of file TMom.h.

double TMom::min [private]

Definition at line 22 of file TMom.h.

int TMom::nevt [private]

Definition at line 12 of file TMom.h.

double TMom::peak [private]

Definition at line 21 of file TMom.h.

double TMom::rms [private]

Definition at line 19 of file TMom.h.

double TMom::sum [private]

Definition at line 16 of file TMom.h.

double TMom::sum2 [private]

Definition at line 17 of file TMom.h.

double TMom::sum3 [private]

Definition at line 18 of file TMom.h.