CMS 3D CMS Logo

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
 
float sumX0atEta (float eta, float r) const override
 
 ~MultipleScatteringX0Data () override
 
- Public Member Functions inherited from SumX0AtEtaDataProvider
virtual ~SumX0AtEtaDataProvider ()
 

Private Member Functions

std::string fileName ()
 

Private Attributes

std::unique_ptr< TH2F > theData
 

Detailed Description

Definition at line 19 of file MultipleScatteringX0Data.h.

Constructor & Destructor Documentation

MultipleScatteringX0Data::MultipleScatteringX0Data ( )

Definition at line 16 of file MultipleScatteringX0Data.cc.

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

17  : theData(nullptr)
18 {
19  string filename = fileName();
20  TFile theFile(filename.c_str(),"READ");
21  if (not theFile.IsZombie()) {
22  theData.reset(dynamic_cast<TH2F*> (theFile.GetKey("h100")->ReadObj()));
23  theData->SetDirectory(nullptr);
24  }
25  if (!theData) {
26  throw cms::Exception("Data not found")
27  << " ** MultipleScatteringX0Data ** file: "
28  << filename
29  <<" <-- no data found!!!";
30  }
31 }
std::unique_ptr< TH2F > theData
MultipleScatteringX0Data::~MultipleScatteringX0Data ( )
override

Definition at line 33 of file MultipleScatteringX0Data.cc.

34 {
35 }

Member Function Documentation

string MultipleScatteringX0Data::fileName ( )
private

Definition at line 37 of file MultipleScatteringX0Data.cc.

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

Referenced by MultipleScatteringX0Data().

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

Definition at line 56 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

57 {
58  if (theData) return theData->GetXaxis()->GetXmax();
59  else return 0;
60 }
std::unique_ptr< TH2F > theData
float MultipleScatteringX0Data::minEta ( ) const

Definition at line 50 of file MultipleScatteringX0Data.cc.

References theData.

51 {
52  if (theData) return theData->GetXaxis()->GetXmin();
53  else return 0;
54 }
std::unique_ptr< TH2F > theData
int MultipleScatteringX0Data::nBinsEta ( ) const

Definition at line 44 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

45 {
46  if (theData) return theData->GetNbinsX();
47  else return 0;
48 }
std::unique_ptr< TH2F > theData
float MultipleScatteringX0Data::sumX0atEta ( float  eta,
float  r 
) const
overridevirtual

Implements SumX0AtEtaDataProvider.

Definition at line 62 of file MultipleScatteringX0Data.cc.

References theData, and heppy_batch::val.

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

Member Data Documentation

std::unique_ptr<TH2F> MultipleScatteringX0Data::theData
private