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::MultipleScatteringX0Data ( )

Definition at line 15 of file MultipleScatteringX0Data.cc.

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

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

◆ ~MultipleScatteringX0Data()

MultipleScatteringX0Data::~MultipleScatteringX0Data ( )
override

Definition at line 28 of file MultipleScatteringX0Data.cc.

28 {}

Member Function Documentation

◆ fileName()

string MultipleScatteringX0Data::fileName ( )
private

Definition at line 30 of file MultipleScatteringX0Data.cc.

30  {
31  string defName = "RecoTracker/TkMSParametrization/data/MultipleScatteringX0Data.root";
32  edm::FileInPath f(defName);
33  return f.fullPath();
34 }

References f.

Referenced by MultipleScatteringX0Data().

◆ maxEta()

float MultipleScatteringX0Data::maxEta ( ) const

Definition at line 50 of file MultipleScatteringX0Data.cc.

50  {
51  if (theData)
52  return theData->GetXaxis()->GetXmax();
53  else
54  return 0;
55 }

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

◆ minEta()

float MultipleScatteringX0Data::minEta ( ) const

Definition at line 43 of file MultipleScatteringX0Data.cc.

43  {
44  if (theData)
45  return theData->GetXaxis()->GetXmin();
46  else
47  return 0;
48 }

References theData.

◆ nBinsEta()

int MultipleScatteringX0Data::nBinsEta ( ) const

Definition at line 36 of file MultipleScatteringX0Data.cc.

36  {
37  if (theData)
38  return theData->GetNbinsX();
39  else
40  return 0;
41 }

References theData.

Referenced by MSLayersKeeperX0AtEta::init().

◆ sumX0atEta()

float MultipleScatteringX0Data::sumX0atEta ( float  eta,
float  r 
) const
overridevirtual

Implements SumX0AtEtaDataProvider.

Definition at line 57 of file MultipleScatteringX0Data.cc.

57  {
58  if (!theData)
59  return 0.;
60  eta = fabs(eta);
61 
62  int ieta = theData->GetXaxis()->FindBin(eta);
63  int irad = theData->GetYaxis()->FindBin(r);
64 
65  if (irad < theData->GetNbinsY()) {
66  return theData->GetBinContent(ieta, irad);
67  } else {
68  float sumX0 = 0;
69  for (int ir = theData->GetNbinsY(); ir > 0; ir--) {
70  float val = theData->GetBinContent(ieta, ir);
71  if (val > sumX0)
72  sumX0 = val;
73  }
74  return sumX0;
75  }
76 }

References PVValHelper::eta, LEDCalibrationChannels::ieta, alignCSCRings::r, theData, and heppy_batch::val.

Member Data Documentation

◆ theData

std::unique_ptr<TH2F> MultipleScatteringX0Data::theData
private
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MultipleScatteringX0Data::fileName
std::string fileName()
Definition: MultipleScatteringX0Data.cc:30
edm::FileInPath
Definition: FileInPath.h:61
interactiveExample.theFile
theFile
Definition: interactiveExample.py:17
PVValHelper::eta
Definition: PVValidationHelpers.h:70
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
alignCSCRings.r
r
Definition: alignCSCRings.py:93
heppy_batch.val
val
Definition: heppy_batch.py:351
Exception
Definition: hltDiff.cc:245
MultipleScatteringX0Data::theData
std::unique_ptr< TH2F > theData
Definition: MultipleScatteringX0Data.h:31