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.

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

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 }
std::unique_ptr< TH2F > theData

◆ ~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.

References f.

Referenced by MultipleScatteringX0Data().

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

◆ maxEta()

float MultipleScatteringX0Data::maxEta ( ) const

Definition at line 50 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::MSLayersKeeperX0AtEta().

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

◆ minEta()

float MultipleScatteringX0Data::minEta ( ) const

Definition at line 43 of file MultipleScatteringX0Data.cc.

References theData.

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

◆ nBinsEta()

int MultipleScatteringX0Data::nBinsEta ( ) const

Definition at line 36 of file MultipleScatteringX0Data.cc.

References theData.

Referenced by MSLayersKeeperX0AtEta::MSLayersKeeperX0AtEta().

36  {
37  if (theData)
38  return theData->GetNbinsX();
39  else
40  return 0;
41 }
std::unique_ptr< TH2F > theData

◆ sumX0atEta()

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

Implements SumX0AtEtaDataProvider.

Definition at line 57 of file MultipleScatteringX0Data.cc.

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

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 }
std::unique_ptr< TH2F > theData

Member Data Documentation

◆ theData

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