CMS 3D CMS Logo

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

EnergyLossPlain Class Reference

#include <EnergyLossPlain.h>

List of all members.

Public Member Functions

 EnergyLossPlain (const TrackerGeometry *theTracker_, double pixelToStripMultiplier, double pixelToStripExponent)
int estimate (const Trajectory *trajectory, std::vector< std::pair< int, double > > &arithmeticMean, std::vector< std::pair< int, double > > &truncatedMean)
void loadOptimalWeights ()
 ~EnergyLossPlain ()

Private Member Functions

double average (std::vector< std::pair< double, double > > &values)
double expected (double Delta1, double Delta2)
double logTruncate (std::vector< std::pair< double, double > > &values)
double optimal (std::vector< std::pair< double, double > > &values)
void process (LocalVector ldir, const SiPixelRecHit *recHit, std::vector< std::pair< double, double > > &values)
void process (LocalVector ldir, const SiStripRecHit2D *recHit, std::vector< std::pair< double, double > > &values)
double truncate (std::vector< std::pair< double, double > > &values)

Private Attributes

double pixelToStripExponent
double pixelToStripMultiplier
const TrackerGeometrytheTracker

Static Private Attributes

static bool isFirst = true
static float optimalWeight [61][61]

Detailed Description

Definition at line 12 of file EnergyLossPlain.h.


Constructor & Destructor Documentation

EnergyLossPlain::EnergyLossPlain ( const TrackerGeometry theTracker_,
double  pixelToStripMultiplier,
double  pixelToStripExponent 
)

Definition at line 52 of file EnergyLossPlain.cc.

                                   : theTracker(theTracker_),
      pixelToStripMultiplier(pixelToStripMultiplier_),
      pixelToStripExponent  (pixelToStripExponent_  )
{
  // Load data
  if(isFirst == true)
  {
    loadOptimalWeights();
    isFirst = false;
  }
}
EnergyLossPlain::~EnergyLossPlain ( )

Definition at line 67 of file EnergyLossPlain.cc.

{
}

Member Function Documentation

double EnergyLossPlain::average ( std::vector< std::pair< double, double > > &  values) [private]
int EnergyLossPlain::estimate ( const Trajectory trajectory,
std::vector< std::pair< int, double > > &  arithmeticMean,
std::vector< std::pair< int, double > > &  truncatedMean 
)
double EnergyLossPlain::expected ( double  Delta1,
double  Delta2 
) [private]

Definition at line 205 of file EnergyLossPlain.cc.

References funct::log().

{
  return log(Delta2/Delta1) / (1/Delta1 - 1/Delta2);
//    return 1 + (Delta2*log(Delta1) - Delta1*log(Delta2)) / (Delta2 - Delta1);
}
void EnergyLossPlain::loadOptimalWeights ( )

Definition at line 73 of file EnergyLossPlain.cc.

References edm::FileInPath::fullPath(), i, LogTrace, n, optimalWeight, and w().

{
  edm::FileInPath
    fileInPath("QCDAnalysis/ChargedHadronSpectra/data/energyWeights.dat");
  ifstream inFile(fileInPath.fullPath().c_str());

  while(inFile.eof() == false)
  {
    int i; float w; int n;
    inFile >> i;
    inFile >> w;
    inFile >> n;

    EnergyLossPlain::optimalWeight[n][i] = w;
  }

  inFile.close();

  LogTrace("MinBiasTracking")
    << " [EnergyLossEstimator] optimal weights loaded";
}
double EnergyLossPlain::logTruncate ( std::vector< std::pair< double, double > > &  values) [private]

Definition at line 111 of file EnergyLossPlain.cc.

References i, funct::pow(), python::multivaluedict::sort(), v, makeHLTPrescaleTable::values, and CommonMethods::weight().

{
  std::vector<double> values;
  for(std::vector<pair<double,double> >::iterator
      v = values_.begin(); v!= values_.end(); v++)
    values.push_back((*v).first);

  sort(values.begin(), values.end());

  int num = values.size();
  double sum[2] = {0.,1.};

  for(int i = 0; i < (num+1)/2; i++)
  { 
    double weight = 1.;

    if(num%2 == 1 && i == (num-1)/2) weight = 1./2;
  
    sum[1] *= pow(values[i], weight); 
    sum[0] += weight;

  }
  
  return pow(sum[1], 1./sum[0]);
} 
double EnergyLossPlain::optimal ( std::vector< std::pair< double, double > > &  values) [private]

Definition at line 164 of file EnergyLossPlain.cc.

References first, i, funct::log(), edm::second(), python::multivaluedict::sort(), v, makeHLTPrescaleTable::values, and CommonMethods::weight().

{
  std::vector<double> values;
  for(std::vector<pair<double,double> >::iterator
      v = values_.begin(); v!= values_.end(); v++)
    values.push_back((*v).first);

  int num = values.size();
  sort(values.begin(), values.end());

  // First guess
  double sum = 0.;
  for(int i = 0; i < num; i++)
  {
    double weight = optimalWeight[num][i];
    sum += weight * values[i];
  }

  // Correct every deposit with log(path)
  for(int i = 0; i < num; i++)
    values_[i].first -= 0.178*log(values_[i].second/0.03) * 0.38 * sum;

  // Sort again 
  values.clear();
  for(std::vector<pair<double,double> >::iterator
      v = values_.begin(); v!= values_.end(); v++)
    values.push_back((*v).first);
  sort(values.begin(), values.end()); 

  // Corrected estimate
  sum = 0.;
  for(int i = 0; i < num; i++)
  {
    double weight = optimalWeight[num][i];
    sum += weight * values[i];
  }

  return sum;
}
void EnergyLossPlain::process ( LocalVector  ldir,
const SiPixelRecHit recHit,
std::vector< std::pair< double, double > > &  values 
) [private]
void EnergyLossPlain::process ( LocalVector  ldir,
const SiStripRecHit2D *  recHit,
std::vector< std::pair< double, double > > &  values 
) [private]
double EnergyLossPlain::truncate ( std::vector< std::pair< double, double > > &  values) [private]

Member Data Documentation

bool EnergyLossPlain::isFirst = true [static, private]

Definition at line 40 of file EnergyLossPlain.h.

float EnergyLossPlain::optimalWeight [static, private]

Definition at line 41 of file EnergyLossPlain.h.

Referenced by loadOptimalWeights().

Definition at line 38 of file EnergyLossPlain.h.

Definition at line 38 of file EnergyLossPlain.h.

Definition at line 37 of file EnergyLossPlain.h.