CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BeamSpotHistogramMaker Class Reference

#include <BeamSpotHistogramMaker.h>

Public Member Functions

 BeamSpotHistogramMaker (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 BeamSpotHistogramMaker (edm::ConsumesCollector &&iC)
 
void beginRun (const unsigned int nrun)
 
void book (const std::string dirname="")
 
void fill (const unsigned int orbit, const reco::BeamSpot &bs)
 
 ~BeamSpotHistogramMaker ()
 

Private Attributes

TFileDirectory_currdir
 
TH1F ** _hbssigmaxrun
 
TProfile ** _hbssigmaxvsorbrun
 
TH1F ** _hbssigmayrun
 
TProfile ** _hbssigmayvsorbrun
 
TH1F ** _hbssigmazrun
 
TProfile ** _hbssigmazvsorbrun
 
TH1F ** _hbsxrun
 
TProfile ** _hbsxvsorbrun
 
TH1F ** _hbsyrun
 
TProfile ** _hbsyvsorbrun
 
TH1F ** _hbszrun
 
TProfile ** _hbszvsorbrun
 
const edm::ParameterSet _histoParameters
 
RunHistogramManager _rhm
 

Detailed Description

Definition at line 21 of file BeamSpotHistogramMaker.h.

Constructor & Destructor Documentation

◆ BeamSpotHistogramMaker() [1/2]

BeamSpotHistogramMaker::BeamSpotHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 11 of file BeamSpotHistogramMaker.cc.

12  : _currdir(nullptr), _histoParameters(), _rhm(iC) {}

◆ BeamSpotHistogramMaker() [2/2]

BeamSpotHistogramMaker::BeamSpotHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 14 of file BeamSpotHistogramMaker.cc.

15  : _currdir(nullptr),
17  _rhm(iC) {}

◆ ~BeamSpotHistogramMaker()

BeamSpotHistogramMaker::~BeamSpotHistogramMaker ( )

Definition at line 19 of file BeamSpotHistogramMaker.cc.

19 { delete _currdir; }

References _currdir.

Member Function Documentation

◆ beginRun()

void BeamSpotHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 82 of file BeamSpotHistogramMaker.cc.

82  {
83  char runname[100];
84  sprintf(runname, "run_%d", nrun);
85 
86  TFileDirectory* currdir = _currdir;
87  if (currdir == nullptr) {
89  currdir = &(tfserv->tFileDirectory());
90  }
91 
92  _rhm.beginRun(nrun, *currdir);
93 
94  (*_hbsxrun)->GetXaxis()->SetTitle("X [cm]");
95  (*_hbsxrun)->GetYaxis()->SetTitle("Events");
96  (*_hbsyrun)->GetXaxis()->SetTitle("Y [cm]");
97  (*_hbsyrun)->GetYaxis()->SetTitle("Events");
98  (*_hbszrun)->GetXaxis()->SetTitle("Z [cm]");
99  (*_hbszrun)->GetYaxis()->SetTitle("Events");
100  (*_hbssigmaxrun)->GetXaxis()->SetTitle("sigmaX [cm]");
101  (*_hbssigmaxrun)->GetYaxis()->SetTitle("Events");
102  (*_hbssigmayrun)->GetXaxis()->SetTitle("sigmaY [cm]");
103  (*_hbssigmayrun)->GetYaxis()->SetTitle("Events");
104  (*_hbssigmazrun)->GetXaxis()->SetTitle("sigmaZ [cm]");
105  (*_hbssigmazrun)->GetYaxis()->SetTitle("Events");
106 
107  (*_hbsxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
108  (*_hbsxvsorbrun)->GetYaxis()->SetTitle("X [cm]");
109  (*_hbsxvsorbrun)->SetCanExtend(TH1::kAllAxes);
110  (*_hbsyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
111  (*_hbsyvsorbrun)->GetYaxis()->SetTitle("Y [cm]");
112  (*_hbsyvsorbrun)->SetCanExtend(TH1::kAllAxes);
113  (*_hbszvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
114  (*_hbszvsorbrun)->GetYaxis()->SetTitle("Z [cm]");
115  (*_hbszvsorbrun)->SetCanExtend(TH1::kAllAxes);
116  (*_hbssigmaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
117  (*_hbssigmaxvsorbrun)->GetYaxis()->SetTitle("sigmaX [cm]");
118  (*_hbssigmaxvsorbrun)->SetCanExtend(TH1::kAllAxes);
119  (*_hbssigmayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
120  (*_hbssigmayvsorbrun)->GetYaxis()->SetTitle("sigmaY [cm]");
121  (*_hbssigmayvsorbrun)->SetCanExtend(TH1::kAllAxes);
122  (*_hbssigmazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]");
123  (*_hbssigmazvsorbrun)->GetYaxis()->SetTitle("sigmaZ [cm]");
124  (*_hbssigmazvsorbrun)->SetCanExtend(TH1::kAllAxes);
125 }

References _currdir, _rhm, RunHistogramManager::beginRun(), and TFileService::tFileDirectory().

Referenced by AnotherBeamSpotAnalyzer::beginRun().

◆ book()

void BeamSpotHistogramMaker::book ( const std::string  dirname = "")

Definition at line 21 of file BeamSpotHistogramMaker.cc.

21  {
23  TFileDirectory* currdir = &(tfserv->tFileDirectory());
24 
25  if (!dirname.empty()) {
26  currdir = new TFileDirectory(tfserv->mkdir(dirname));
27  _currdir = currdir;
28  }
29 
30  edm::LogInfo("HistogramBooking") << "BeamSpot histogram booking in directory " << dirname;
31 
32  _hbsxrun = _rhm.makeTH1F("bsxrun",
33  "BeamSpot X position",
34  _histoParameters.getUntrackedParameter<unsigned int>("nBinX", 200),
35  _histoParameters.getUntrackedParameter<double>("xMin", -1.),
36  _histoParameters.getUntrackedParameter<double>("xMax", 1.));
37 
38  _hbsyrun = _rhm.makeTH1F("bsyrun",
39  "BeamSpot Y position",
40  _histoParameters.getUntrackedParameter<unsigned int>("nBinY", 200),
41  _histoParameters.getUntrackedParameter<double>("yMin", -1.),
42  _histoParameters.getUntrackedParameter<double>("yMax", 1.));
43 
44  _hbszrun = _rhm.makeTH1F("bszrun",
45  "BeamSpot Z position",
46  _histoParameters.getUntrackedParameter<unsigned int>("nBinZ", 200),
47  _histoParameters.getUntrackedParameter<double>("zMin", -1.),
48  _histoParameters.getUntrackedParameter<double>("zMax", 1.));
49 
50  _hbssigmaxrun = _rhm.makeTH1F("bssigmaxrun",
51  "BeamSpot sigmaX",
52  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaX", 200),
53  _histoParameters.getUntrackedParameter<double>("sigmaXMin", 0.),
54  _histoParameters.getUntrackedParameter<double>("sigmaXMax", 0.025));
55 
56  _hbssigmayrun = _rhm.makeTH1F("bssigmayrun",
57  "BeamSpot sigmaY",
58  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaY", 200),
59  _histoParameters.getUntrackedParameter<double>("sigmaYMin", 0.),
60  _histoParameters.getUntrackedParameter<double>("sigmaYMax", 0.025));
61 
62  _hbssigmazrun = _rhm.makeTH1F("bssigmazrun",
63  "BeamSpot sigmaZ",
64  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaZ", 200),
65  _histoParameters.getUntrackedParameter<double>("sigmaZMin", 0.),
66  _histoParameters.getUntrackedParameter<double>("sigmaZMax", 15.));
67 
69  _rhm.makeTProfile("bsxvsorbrun", "BeamSpot X position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
71  _rhm.makeTProfile("bsyvsorbrun", "BeamSpot Y position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
73  _rhm.makeTProfile("bszvsorbrun", "BeamSpot Z position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
75  _rhm.makeTProfile("bssigmaxvsorbrun", "BeamSpot sigmaX vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
77  _rhm.makeTProfile("bssigmayvsorbrun", "BeamSpot sigmaY vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
79  _rhm.makeTProfile("bssigmazvsorbrun", "BeamSpot sigmaZ vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5);
80 }

References _currdir, _hbssigmaxrun, _hbssigmaxvsorbrun, _hbssigmayrun, _hbssigmayvsorbrun, _hbssigmazrun, _hbssigmazvsorbrun, _hbsxrun, _hbsxvsorbrun, _hbsyrun, _hbsyvsorbrun, _hbszrun, _hbszvsorbrun, _histoParameters, _rhm, BTVHLTOfflineSource_cfi::dirname, edm::ParameterSet::getUntrackedParameter(), RunHistogramManager::makeTH1F(), RunHistogramManager::makeTProfile(), TFileService::mkdir(), and TFileService::tFileDirectory().

Referenced by AnotherBeamSpotAnalyzer::AnotherBeamSpotAnalyzer().

◆ fill()

void BeamSpotHistogramMaker::fill ( const unsigned int  orbit,
const reco::BeamSpot bs 
)

Definition at line 127 of file BeamSpotHistogramMaker.cc.

127  {
128  if (_hbsxrun && *_hbsxrun)
129  (*_hbsxrun)->Fill(bs.x0());
131  (*_hbsxvsorbrun)->Fill(orbit, bs.x0());
132 
133  if (_hbsyrun && *_hbsyrun)
134  (*_hbsyrun)->Fill(bs.y0());
136  (*_hbsyvsorbrun)->Fill(orbit, bs.y0());
137 
138  if (_hbszrun && *_hbszrun)
139  (*_hbszrun)->Fill(bs.z0());
141  (*_hbszvsorbrun)->Fill(orbit, bs.z0());
142 
144  (*_hbssigmaxrun)->Fill(bs.BeamWidthX());
146  (*_hbssigmayrun)->Fill(bs.BeamWidthY());
148  (*_hbssigmazrun)->Fill(bs.sigmaZ());
150  (*_hbssigmaxvsorbrun)->Fill(orbit, bs.BeamWidthX());
152  (*_hbssigmayvsorbrun)->Fill(orbit, bs.BeamWidthY());
154  (*_hbssigmazvsorbrun)->Fill(orbit, bs.sigmaZ());
155 }

References _hbssigmaxrun, _hbssigmaxvsorbrun, _hbssigmayrun, _hbssigmayvsorbrun, _hbssigmazrun, _hbssigmazvsorbrun, _hbsxrun, _hbsxvsorbrun, _hbsyrun, _hbsyvsorbrun, _hbszrun, _hbszvsorbrun, and cms::cuda::bs.

Referenced by AnotherBeamSpotAnalyzer::analyze().

Member Data Documentation

◆ _currdir

TFileDirectory* BeamSpotHistogramMaker::_currdir
private

Definition at line 33 of file BeamSpotHistogramMaker.h.

Referenced by beginRun(), book(), and ~BeamSpotHistogramMaker().

◆ _hbssigmaxrun

TH1F** BeamSpotHistogramMaker::_hbssigmaxrun
private

Definition at line 40 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbssigmaxvsorbrun

TProfile** BeamSpotHistogramMaker::_hbssigmaxvsorbrun
private

Definition at line 46 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbssigmayrun

TH1F** BeamSpotHistogramMaker::_hbssigmayrun
private

Definition at line 41 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbssigmayvsorbrun

TProfile** BeamSpotHistogramMaker::_hbssigmayvsorbrun
private

Definition at line 47 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbssigmazrun

TH1F** BeamSpotHistogramMaker::_hbssigmazrun
private

Definition at line 42 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbssigmazvsorbrun

TProfile** BeamSpotHistogramMaker::_hbssigmazvsorbrun
private

Definition at line 48 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbsxrun

TH1F** BeamSpotHistogramMaker::_hbsxrun
private

Definition at line 37 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbsxvsorbrun

TProfile** BeamSpotHistogramMaker::_hbsxvsorbrun
private

Definition at line 43 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbsyrun

TH1F** BeamSpotHistogramMaker::_hbsyrun
private

Definition at line 38 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbsyvsorbrun

TProfile** BeamSpotHistogramMaker::_hbsyvsorbrun
private

Definition at line 44 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbszrun

TH1F** BeamSpotHistogramMaker::_hbszrun
private

Definition at line 39 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _hbszvsorbrun

TProfile** BeamSpotHistogramMaker::_hbszvsorbrun
private

Definition at line 45 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

◆ _histoParameters

const edm::ParameterSet BeamSpotHistogramMaker::_histoParameters
private

Definition at line 34 of file BeamSpotHistogramMaker.h.

Referenced by book().

◆ _rhm

RunHistogramManager BeamSpotHistogramMaker::_rhm
private

Definition at line 36 of file BeamSpotHistogramMaker.h.

Referenced by beginRun(), and book().

BeamSpotHistogramMaker::_hbszvsorbrun
TProfile ** _hbszvsorbrun
Definition: BeamSpotHistogramMaker.h:45
BeamSpotHistogramMaker::_hbssigmazvsorbrun
TProfile ** _hbssigmazvsorbrun
Definition: BeamSpotHistogramMaker.h:48
TFileService::tFileDirectory
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
BeamSpotHistogramMaker::_hbssigmazrun
TH1F ** _hbssigmazrun
Definition: BeamSpotHistogramMaker.h:42
BeamSpotHistogramMaker::_hbssigmayrun
TH1F ** _hbssigmayrun
Definition: BeamSpotHistogramMaker.h:41
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory
Definition: TFileDirectory.h:24
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
BeamSpotHistogramMaker::_histoParameters
const edm::ParameterSet _histoParameters
Definition: BeamSpotHistogramMaker.h:34
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
cms::cuda::bs
bs
Definition: HistoContainer.h:127
BeamSpotHistogramMaker::_currdir
TFileDirectory * _currdir
Definition: BeamSpotHistogramMaker.h:33
BeamSpotHistogramMaker::_hbsxrun
TH1F ** _hbsxrun
Definition: BeamSpotHistogramMaker.h:37
BeamSpotHistogramMaker::_rhm
RunHistogramManager _rhm
Definition: BeamSpotHistogramMaker.h:36
BeamSpotHistogramMaker::_hbssigmayvsorbrun
TProfile ** _hbssigmayvsorbrun
Definition: BeamSpotHistogramMaker.h:47
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
RunHistogramManager::makeTH1F
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
Definition: RunHistogramManager.cc:33
edm::ParameterSet
Definition: ParameterSet.h:47
BeamSpotHistogramMaker::_hbsyrun
TH1F ** _hbsyrun
Definition: BeamSpotHistogramMaker.h:38
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
edm::Service< TFileService >
BeamSpotHistogramMaker::_hbssigmaxrun
TH1F ** _hbssigmaxrun
Definition: BeamSpotHistogramMaker.h:40
BeamSpotHistogramMaker::_hbsyvsorbrun
TProfile ** _hbsyvsorbrun
Definition: BeamSpotHistogramMaker.h:44
BeamSpotHistogramMaker::_hbssigmaxvsorbrun
TProfile ** _hbssigmaxvsorbrun
Definition: BeamSpotHistogramMaker.h:46
BeamSpotHistogramMaker::_hbszrun
TH1F ** _hbszrun
Definition: BeamSpotHistogramMaker.h:39
BeamSpotHistogramMaker::_hbsxvsorbrun
TProfile ** _hbsxvsorbrun
Definition: BeamSpotHistogramMaker.h:43
RunHistogramManager::makeTProfile
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
Definition: RunHistogramManager.cc:52