CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MultipleScatteringX0Data Class Reference

#include <MultipleScatteringX0Data.h>

Inheritance diagram for MultipleScatteringX0Data:
SumX0AtEtaDataProvider

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 18 of file MultipleScatteringX0Data.h.

Constructor & Destructor Documentation

MultipleScatteringX0Data::MultipleScatteringX0Data ( )

Definition at line 16 of file MultipleScatteringX0Data.cc.

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

17  : theFile(0), theData(0)
18 {
19  string filename = fileName();
20  theFile = new TFile(filename.c_str(),"READ");
21  if (theFile) {
22  theData = dynamic_cast<TH2F*> (theFile->GetKey("h100")->ReadObj());
23  }
24  if (!theData) {
25  throw cms::Exception("Data not found")
26  << " ** MultipleScatteringX0Data ** file: "
27  << filename
28  <<" <-- no data found!!!";
29  }
30 }
tuple filename
Definition: lut2db_cfg.py:20
MultipleScatteringX0Data::~MultipleScatteringX0Data ( )
virtual

Definition at line 32 of file MultipleScatteringX0Data.cc.

References theFile.

33 {
34  if(theFile) {
35  theFile->Close();
36  delete theFile;
37  }
38 }

Member Function Documentation

string MultipleScatteringX0Data::fileName ( )
private

Definition at line 40 of file MultipleScatteringX0Data.cc.

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

Referenced by MultipleScatteringX0Data().

41 {
42  string defName="RecoTracker/TkMSParametrization/data/MultipleScatteringX0Data.root";
43  edm::FileInPath f(defName);
44  return f.fullPath();
45 }
double f[11][100]
float MultipleScatteringX0Data::maxEta ( ) const

Definition at line 59 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

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

Definition at line 53 of file MultipleScatteringX0Data.cc.

References theData.

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

Definition at line 47 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

48 {
49  if (theData) return theData->GetNbinsX();
50  else return 0;
51 }
float MultipleScatteringX0Data::sumX0atEta ( float  eta,
float  r 
) const
virtual

Implements SumX0AtEtaDataProvider.

Definition at line 65 of file MultipleScatteringX0Data.cc.

References theData.

66 {
67  if(!theData) return 0.;
68  eta = fabs(eta);
69 
70  int ieta = theData->GetXaxis()->FindBin(eta);
71  int irad = theData->GetYaxis()->FindBin(r);
72 
73  if (irad < theData->GetNbinsY()) {
74  return theData->GetBinContent(ieta,irad);
75  }
76  else {
77  float sumX0 = 0;
78  for(int ir = theData->GetNbinsY(); ir > 0; ir--) {
79  float val = theData->GetBinContent(ieta, ir);
80  if (val > sumX0) sumX0 = val;
81  }
82  return sumX0;
83  }
84 }
T eta() const

Member Data Documentation

TH2F* MultipleScatteringX0Data::theData
private
TFile* MultipleScatteringX0Data::theFile
private