CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

MultipleScatteringX0Data Class Reference

#include <MultipleScatteringX0Data.h>

Inheritance diagram for MultipleScatteringX0Data:
SumX0AtEtaDataProvider

List of all members.

Public Member Functions

float maxEta () const
float minEta () const
 MultipleScatteringX0Data ()
int nBinsEta () const
virtual float sumX0atEta (float eta, float r) const
virtual ~MultipleScatteringX0Data ()

Private Member Functions

std::string fileName ()

Private Attributes

TH2F * theData
TFile * theFile

Detailed Description

Definition at line 17 of file MultipleScatteringX0Data.h.


Constructor & Destructor Documentation

MultipleScatteringX0Data::MultipleScatteringX0Data ( )

Definition at line 16 of file MultipleScatteringX0Data.cc.

References Exception, fileName(), lut2db_cfg::filename, theData, and theFile.

  : theFile(0), theData(0)
{
  string filename = fileName(); 
  theFile = new TFile(filename.c_str(),"READ");
  if (theFile) {
    theData = dynamic_cast<TH2F*> (theFile->GetKey("h100")->ReadObj());
  }
  if (!theData)  {
    throw cms::Exception("Data not found")  
         << " ** MultipleScatteringX0Data ** file: "
         << filename 
         <<" <-- no data found!!!";
  }
}
MultipleScatteringX0Data::~MultipleScatteringX0Data ( ) [virtual]

Definition at line 32 of file MultipleScatteringX0Data.cc.

References theFile.

{
  if(theFile) {
    theFile->Close();
    delete theFile;
  }
}

Member Function Documentation

string MultipleScatteringX0Data::fileName ( ) [private]

Definition at line 40 of file MultipleScatteringX0Data.cc.

References f, and edm::FileInPath::fullPath().

Referenced by MultipleScatteringX0Data().

{
  string defName="RecoTracker/TkMSParametrization/data/MultipleScatteringX0Data.root";
  edm::FileInPath f(defName);
  return f.fullPath();
} 
float MultipleScatteringX0Data::maxEta ( ) const

Definition at line 59 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

{
  if (theData) return theData->GetXaxis()->GetXmax();
  else return 0;
}
float MultipleScatteringX0Data::minEta ( ) const

Definition at line 53 of file MultipleScatteringX0Data.cc.

References theData.

{
  if (theData) return theData->GetXaxis()->GetXmin();
  else return 0;
}
int MultipleScatteringX0Data::nBinsEta ( ) const

Definition at line 47 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

{
  if (theData) return theData->GetNbinsX();
  else return 0;
}
float MultipleScatteringX0Data::sumX0atEta ( float  eta,
float  r 
) const [virtual]

Implements SumX0AtEtaDataProvider.

Definition at line 65 of file MultipleScatteringX0Data.cc.

References theData.

{
  if(!theData) return 0.;
  eta = fabs(eta);

  int ieta = theData->GetXaxis()->FindBin(eta);
  int irad = theData->GetYaxis()->FindBin(r);

  if (irad < theData->GetNbinsY()) { 
    return theData->GetBinContent(ieta,irad);
  } 
  else {
    float sumX0 = 0;
    for(int ir = theData->GetNbinsY(); ir > 0; ir--) {
      float val = theData->GetBinContent(ieta, ir);
      if (val > sumX0) sumX0 = val;
    }
    return sumX0;
  }
}

Member Data Documentation