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 Attributes
BeamSpotHistogramMaker Class Reference

#include <BeamSpotHistogramMaker.h>

Public Member Functions

 BeamSpotHistogramMaker (edm::ConsumesCollector &&iC)
 
 BeamSpotHistogramMaker (const edm::ParameterSet &iConfig, 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::BeamSpotHistogramMaker ( edm::ConsumesCollector &&  iC)

Definition at line 12 of file BeamSpotHistogramMaker.cc.

12  :
13  _currdir(0), _histoParameters(), _rhm(iC) { }
const edm::ParameterSet _histoParameters
BeamSpotHistogramMaker::BeamSpotHistogramMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 15 of file BeamSpotHistogramMaker.cc.

15  :
16  _currdir(0),
18  _rhm(iC)
19 { }
T getUntrackedParameter(std::string const &, T const &) const
const edm::ParameterSet _histoParameters
BeamSpotHistogramMaker::~BeamSpotHistogramMaker ( )

Definition at line 22 of file BeamSpotHistogramMaker.cc.

References _currdir.

22  {
23 
24  delete _currdir;
25 
26 }

Member Function Documentation

void BeamSpotHistogramMaker::beginRun ( const unsigned int  nrun)

Definition at line 80 of file BeamSpotHistogramMaker.cc.

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

Referenced by AnotherBeamSpotAnalyzer::beginRun().

80  {
81 
82  char runname[100];
83  sprintf(runname,"run_%d",nrun);
84 
85  TFileDirectory* currdir = _currdir;
86  if(currdir==0) {
88  currdir = &(tfserv->tFileDirectory());
89  }
90 
91  _rhm.beginRun(nrun,*currdir);
92 
93  (*_hbsxrun)->GetXaxis()->SetTitle("X [cm]"); (*_hbsxrun)->GetYaxis()->SetTitle("Events");
94  (*_hbsyrun)->GetXaxis()->SetTitle("Y [cm]"); (*_hbsyrun)->GetYaxis()->SetTitle("Events");
95  (*_hbszrun)->GetXaxis()->SetTitle("Z [cm]"); (*_hbszrun)->GetYaxis()->SetTitle("Events");
96  (*_hbssigmaxrun)->GetXaxis()->SetTitle("sigmaX [cm]"); (*_hbssigmaxrun)->GetYaxis()->SetTitle("Events");
97  (*_hbssigmayrun)->GetXaxis()->SetTitle("sigmaY [cm]"); (*_hbssigmayrun)->GetYaxis()->SetTitle("Events");
98  (*_hbssigmazrun)->GetXaxis()->SetTitle("sigmaZ [cm]"); (*_hbssigmazrun)->GetYaxis()->SetTitle("Events");
99 
100  (*_hbsxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbsxvsorbrun)->GetYaxis()->SetTitle("X [cm]");
101  (*_hbsxvsorbrun)->SetCanExtend(TH1::kAllAxes);
102  (*_hbsyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbsyvsorbrun)->GetYaxis()->SetTitle("Y [cm]");
103  (*_hbsyvsorbrun)->SetCanExtend(TH1::kAllAxes);
104  (*_hbszvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbszvsorbrun)->GetYaxis()->SetTitle("Z [cm]");
105  (*_hbszvsorbrun)->SetCanExtend(TH1::kAllAxes);
106  (*_hbssigmaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmaxvsorbrun)->GetYaxis()->SetTitle("sigmaX [cm]");
107  (*_hbssigmaxvsorbrun)->SetCanExtend(TH1::kAllAxes);
108  (*_hbssigmayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmayvsorbrun)->GetYaxis()->SetTitle("sigmaY [cm]");
109  (*_hbssigmayvsorbrun)->SetCanExtend(TH1::kAllAxes);
110  (*_hbssigmazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmazvsorbrun)->GetYaxis()->SetTitle("sigmaZ [cm]");
111  (*_hbssigmazvsorbrun)->SetCanExtend(TH1::kAllAxes);
112 
113 
114 }
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
void beginRun(const edm::Run &iRun)
void BeamSpotHistogramMaker::book ( const std::string  dirname = "")

Definition at line 29 of file BeamSpotHistogramMaker.cc.

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

Referenced by AnotherBeamSpotAnalyzer::AnotherBeamSpotAnalyzer().

29  {
30 
32  TFileDirectory* currdir = &(tfserv->tFileDirectory());
33 
34  if(dirname!="") {
35  currdir = new TFileDirectory(tfserv->mkdir(dirname));
36  _currdir = currdir;
37  }
38 
39  edm::LogInfo("HistogramBooking") << "BeamSpot histogram booking in directory " << dirname;
40 
41  _hbsxrun = _rhm.makeTH1F("bsxrun","BeamSpot X position",
42  _histoParameters.getUntrackedParameter<unsigned int>("nBinX",200),
43  _histoParameters.getUntrackedParameter<double>("xMin",-1.),
44  _histoParameters.getUntrackedParameter<double>("xMax",1.));
45 
46  _hbsyrun = _rhm.makeTH1F("bsyrun","BeamSpot Y position",
47  _histoParameters.getUntrackedParameter<unsigned int>("nBinY",200),
48  _histoParameters.getUntrackedParameter<double>("yMin",-1.),
49  _histoParameters.getUntrackedParameter<double>("yMax",1.));
50 
51  _hbszrun = _rhm.makeTH1F("bszrun","BeamSpot Z position",
52  _histoParameters.getUntrackedParameter<unsigned int>("nBinZ",200),
53  _histoParameters.getUntrackedParameter<double>("zMin",-1.),
54  _histoParameters.getUntrackedParameter<double>("zMax",1.));
55 
56  _hbssigmaxrun = _rhm.makeTH1F("bssigmaxrun","BeamSpot sigmaX",
57  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaX",200),
58  _histoParameters.getUntrackedParameter<double>("sigmaXMin",0.),
59  _histoParameters.getUntrackedParameter<double>("sigmaXMax",0.025));
60 
61  _hbssigmayrun = _rhm.makeTH1F("bssigmayrun","BeamSpot sigmaY",
62  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaY",200),
63  _histoParameters.getUntrackedParameter<double>("sigmaYMin",0.),
64  _histoParameters.getUntrackedParameter<double>("sigmaYMax",0.025));
65 
66  _hbssigmazrun = _rhm.makeTH1F("bssigmazrun","BeamSpot sigmaZ",
67  _histoParameters.getUntrackedParameter<unsigned int>("nBinSigmaZ",200),
68  _histoParameters.getUntrackedParameter<double>("sigmaZMin",0.),
69  _histoParameters.getUntrackedParameter<double>("sigmaZMax",15.));
70 
71  _hbsxvsorbrun = _rhm.makeTProfile("bsxvsorbrun","BeamSpot X position vs orbit number",1600,0.5,1600.*16384+0.5);
72  _hbsyvsorbrun = _rhm.makeTProfile("bsyvsorbrun","BeamSpot Y position vs orbit number",1600,0.5,1600.*16384+0.5);
73  _hbszvsorbrun = _rhm.makeTProfile("bszvsorbrun","BeamSpot Z position vs orbit number",1600,0.5,1600.*16384+0.5);
74  _hbssigmaxvsorbrun = _rhm.makeTProfile("bssigmaxvsorbrun","BeamSpot sigmaX vs orbit number",1600,0.5,1600.*16384+0.5);
75  _hbssigmayvsorbrun = _rhm.makeTProfile("bssigmayvsorbrun","BeamSpot sigmaY vs orbit number",1600,0.5,1600.*16384+0.5);
76  _hbssigmazvsorbrun = _rhm.makeTProfile("bssigmazvsorbrun","BeamSpot sigmaZ vs orbit number",1600,0.5,1600.*16384+0.5);
77 
78 }
T getUntrackedParameter(std::string const &, T const &) const
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
TProfile ** makeTProfile(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
const edm::ParameterSet _histoParameters
void BeamSpotHistogramMaker::fill ( const unsigned int  orbit,
const reco::BeamSpot bs 
)

Definition at line 116 of file BeamSpotHistogramMaker.cc.

References _hbssigmaxrun, _hbssigmaxvsorbrun, _hbssigmayrun, _hbssigmayvsorbrun, _hbssigmazrun, _hbssigmazvsorbrun, _hbsxrun, _hbsxvsorbrun, _hbsyrun, _hbsyvsorbrun, _hbszrun, _hbszvsorbrun, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), reco::BeamSpot::sigmaZ(), reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

Referenced by AnotherBeamSpotAnalyzer::analyze().

116  {
117 
118  if(_hbsxrun && *_hbsxrun ) (*_hbsxrun)->Fill(bs.x0());
119  if(_hbsxvsorbrun && *_hbsxvsorbrun ) (*_hbsxvsorbrun)->Fill(orbit,bs.x0());
120 
121  if(_hbsyrun && *_hbsyrun ) (*_hbsyrun)->Fill(bs.y0());
122  if(_hbsyvsorbrun && *_hbsyvsorbrun ) (*_hbsyvsorbrun)->Fill(orbit,bs.y0());
123 
124  if(_hbszrun && *_hbszrun ) (*_hbszrun)->Fill(bs.z0());
125  if(_hbszvsorbrun && *_hbszvsorbrun ) (*_hbszvsorbrun)->Fill(orbit,bs.z0());
126 
127  if(_hbssigmaxrun && *_hbssigmaxrun ) (*_hbssigmaxrun)->Fill(bs.BeamWidthX());
128  if(_hbssigmayrun && *_hbssigmayrun ) (*_hbssigmayrun)->Fill(bs.BeamWidthY());
129  if(_hbssigmazrun && *_hbssigmazrun ) (*_hbssigmazrun)->Fill(bs.sigmaZ());
130  if(_hbssigmaxvsorbrun && *_hbssigmaxvsorbrun ) (*_hbssigmaxvsorbrun)->Fill(orbit,bs.BeamWidthX());
131  if(_hbssigmayvsorbrun && *_hbssigmayvsorbrun ) (*_hbssigmayvsorbrun)->Fill(orbit,bs.BeamWidthY());
132  if(_hbssigmazvsorbrun && *_hbssigmazvsorbrun ) (*_hbssigmazvsorbrun)->Fill(orbit,bs.sigmaZ());
133 
134 }
double z0() const
z coordinate
Definition: BeamSpot.h:68
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
double y0() const
y coordinate
Definition: BeamSpot.h:66
double x0() const
x coordinate
Definition: BeamSpot.h:64

Member Data Documentation

TFileDirectory* BeamSpotHistogramMaker::_currdir
private

Definition at line 35 of file BeamSpotHistogramMaker.h.

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

TH1F** BeamSpotHistogramMaker::_hbssigmaxrun
private

Definition at line 42 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbssigmaxvsorbrun
private

Definition at line 48 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TH1F** BeamSpotHistogramMaker::_hbssigmayrun
private

Definition at line 43 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbssigmayvsorbrun
private

Definition at line 49 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TH1F** BeamSpotHistogramMaker::_hbssigmazrun
private

Definition at line 44 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbssigmazvsorbrun
private

Definition at line 50 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TH1F** BeamSpotHistogramMaker::_hbsxrun
private

Definition at line 39 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbsxvsorbrun
private

Definition at line 45 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TH1F** BeamSpotHistogramMaker::_hbsyrun
private

Definition at line 40 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbsyvsorbrun
private

Definition at line 46 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TH1F** BeamSpotHistogramMaker::_hbszrun
private

Definition at line 41 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

TProfile** BeamSpotHistogramMaker::_hbszvsorbrun
private

Definition at line 47 of file BeamSpotHistogramMaker.h.

Referenced by book(), and fill().

const edm::ParameterSet BeamSpotHistogramMaker::_histoParameters
private

Definition at line 36 of file BeamSpotHistogramMaker.h.

Referenced by book().

RunHistogramManager BeamSpotHistogramMaker::_rhm
private

Definition at line 38 of file BeamSpotHistogramMaker.h.

Referenced by beginRun(), and book().