34 monitorName_(parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
38 scalerLabel_(consumes<
BeamSpot>(parameters_.getUntrackedParameter<
InputTag>(
"ScalerLabel"))),
39 beamSpotLabel_(parameters_.getUntrackedParameter<
InputTag>(
"BeamSpotLabel")),
40 numberOfValuesToSave_(0) {
80 if (itM->first ==
"run") {
81 histosMap_[*itV][itM->first][itM->second] =
nullptr;
115 for (map<string, MonitorElement*>::iterator itMM = itM->second[
"run"].begin(); itMM != itM->second[
"run"].end();
117 name =
string(
"h") + itM->first + itMM->first;
118 title = itM->first +
"_{0} " + itMM->first;
119 if (itM->first ==
"x" || itM->first ==
"y") {
120 if (itMM->first ==
"Coordinate") {
121 itMM->second = ibooker.
book1D(name, title, 1001, -0.2525, 0.2525);
122 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
123 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
124 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
125 itMM->second = ibooker.
book1D(name, title, 1001, -0.02525, 0.02525);
129 }
else if (itM->first ==
"z") {
130 if (itMM->first ==
"Coordinate") {
131 itMM->second = ibooker.
book1D(name, title, 101, -5.05, 5.05);
132 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
133 itMM->first ==
"PrimaryVertex fit-Scalers") {
134 itMM->second = ibooker.
book1D(name, title, 101, -0.505, 0.505);
135 }
else if (itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" ||
136 itMM->first ==
"PrimaryVertex-Scalers") {
137 itMM->second = ibooker.
book1D(name, title, 1001, -5.005, 5.005);
141 }
else if (itM->first ==
"sigmaX" || itM->first ==
"sigmaY") {
142 if (itMM->first ==
"Coordinate") {
143 itMM->second = ibooker.
book1D(name, title, 100, 0, 0.015);
144 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
145 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
146 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
147 itMM->second =
nullptr;
151 }
else if (itM->first ==
"sigmaZ") {
152 if (itMM->first ==
"Coordinate") {
153 itMM->second = ibooker.
book1D(name, title, 110, 0, 11);
154 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
155 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
156 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
157 itMM->second = ibooker.
book1D(name, title, 101, -5.05, 5.05);
164 if (itMM->second !=
nullptr) {
165 if (itMM->first ==
"Coordinate") {
166 itMM->second->
setAxisTitle(itM->first +
"_{0} (cm)", 1);
167 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
168 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
169 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
170 itMM->second->setAxisTitle(itMM->first +
" " + itM->first +
"_{0} (cm)", 1);
172 itMM->second->setAxisTitle(
"Entries", 2);
191 hD0Phi0_ = ibooker.
bookProfile(
"hD0Phi0",
"d_{0} vs. #phi_{0} (All Tracks)", 63, -3.15, 3.15, 100, -0.5, 0.5,
"");
196 hDxyBS_ = ibooker.
book1D(
"hDxyBS",
"dxy_{0} w.r.t. Beam spot (All Tracks)", 100, -0.1, 0.1);
223 for (
int i = 0;
i < 7; ++
i) {
224 for (
int j = 0;
j < 7; ++
j) {
263 for (reco::TrackCollection::const_iterator
track = tracks->begin();
track != tracks->end(); ++
track) {
309 map<std::string, pair<double, double> > resultsMap;
310 vector<pair<double, double> > vertexResults;
318 resultsMap[itBS->first] = pair<double, double>(itBS->second.x0(), itBS->second.x0Error());
319 }
else if (*itV ==
"y") {
320 resultsMap[itBS->first] = pair<double, double>(itBS->second.y0(), itBS->second.y0Error());
321 }
else if (*itV ==
"z") {
322 resultsMap[itBS->first] = pair<double, double>(itBS->second.z0(), itBS->second.z0Error());
323 }
else if (*itV ==
"sigmaX") {
324 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthX(), itBS->second.BeamWidthXError());
325 }
else if (*itV ==
"sigmaY") {
326 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthY(), itBS->second.BeamWidthYError());
327 }
else if (*itV ==
"sigmaZ") {
328 resultsMap[itBS->first] = pair<double, double>(itBS->second.sigmaZ(), itBS->second.sigmaZ0Error());
330 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
331 <<
" that I can't recognize!";
336 vertexResults.clear();
337 for (vector<VertexCollection>::iterator itPV =
vertices_.begin(); itPV !=
vertices_.end(); itPV++) {
338 if (!itPV->empty()) {
339 for (VertexCollection::const_iterator
pv = itPV->begin();
pv != itPV->end();
pv++) {
340 if (
pv->isFake() ||
pv->tracksSize() < 10)
343 vertexResults.push_back(pair<double, double>(
pv->x(),
pv->xError()));
344 }
else if (*itV ==
"y") {
345 vertexResults.push_back(pair<double, double>(
pv->y(),
pv->yError()));
346 }
else if (*itV ==
"z") {
347 vertexResults.push_back(pair<double, double>(
pv->z(),
pv->zError()));
348 }
else if (*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ") {
349 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
350 <<
" that I can't recognize!";
377 if (itM->first ==
"run" && (histo =
histosMap_[*itV][itM->first][itM->second]) ==
nullptr) {
379 }
else if (itM->first !=
"run") {
382 if (itM->second ==
"Coordinate") {
386 }
else if (itM->second ==
"PrimaryVertex fit-DataBase") {
387 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
390 }
else if (itM->second ==
"PrimaryVertex fit-BeamFit") {
391 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
394 }
else if (itM->second ==
"PrimaryVertex fit-Scalers") {
395 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
398 }
else if (itM->second ==
"PrimaryVertex-DataBase") {
399 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
400 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
402 histo->
Fill(itPV->first - resultsMap[
"DB"].first);
405 }
else if (itM->second ==
"PrimaryVertex-BeamFit") {
406 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
407 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
409 histo->
Fill(itPV->first - resultsMap[
"BF"].first);
412 }
else if (itM->second ==
"PrimaryVertex-Scalers") {
413 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
414 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
416 histo->
Fill(itPV->first - resultsMap[
"SC"].first);
419 }
else if (itM->second ==
"Lumibased BeamSpotFit") {
420 if (resultsMap.find(
"BF") != resultsMap.end()) {
425 }
else if (itM->second ==
"Lumibased PrimaryVertex") {
426 if (resultsMap.find(
"PV") != resultsMap.end()) {
431 }
else if (itM->second ==
"Lumibased DataBase") {
432 if (resultsMap.find(
"DB") != resultsMap.end()) {
437 }
else if (itM->second ==
"Lumibased Scalers") {
438 if (resultsMap.find(
"SC") != resultsMap.end()) {
443 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase fit") {
444 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
451 }
else if (itM->second ==
"Lumibased PrimaryVertex-Scalers fit") {
452 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
459 }
else if (itM->second ==
"Lumibased Scalers-DataBase fit") {
460 if (resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
467 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase") {
468 if (resultsMap.find(
"DB") != resultsMap.end() && !vertexResults.empty()) {
469 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
488 }
else if (itM->second ==
"Lumibased PrimaryVertex-Scalers") {
489 if (resultsMap.find(
"SC") != resultsMap.end() && !vertexResults.empty()) {
490 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
516 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ have a histogram named " << itM->second
517 <<
" that I can't recognize in this loop!";
double Getdydz() const
get dydz slope, crossing angle in YZ
LuminosityBlockID id() const
MonitorElement * hD0Phi0_
math::Error< dimension >::type CovarianceMatrix
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
edm::EDGetTokenT< reco::TrackCollection > trackLabel_
double GetY() const
get Y beam position
void dqmEndLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
void dqmBeginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
std::vector< Track > TrackCollection
collection of Tracks
std::multimap< std::string, std::string > histoByCategoryNames_
void setLumiFlag()
this ME is meant to be stored for each luminosity section
double GetSigmaZ() const
get sigma Z, RMS bunch length
edm::EDGetTokenT< reco::VertexCollection > primaryVertexLabel_
double GetBeamWidthX() const
get average transverse beam width
std::vector< Vertex > VertexCollection
collection of Vertex objects
math::XYZPoint Point
point in the space
char const * what() const override
PositionContainer positionsMap_
double GetBeamWidthY() const
get average transverse beam width
void readEvent(const edm::Event &iEvent)
double GetEmittanceX() const
get emittance
U second(std::pair< T, U > const &p)
virtual void Reset()
reset ME (ie. contents, errors, etc)
std::vector< std::string > varNamesV_
AlcaBeamMonitor(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
void readEvent(const edm::Event &iEvent)
void setBeamWidthY(double v)
int GetBeamType() const
get beam type
edm::EDGetTokenT< reco::BeamSpot > scalerLabel_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
BeamSpotContainer beamSpotsMap_
BeamFitter * theBeamFitter_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
double GetZ() const
get Z beam position
int numberOfValuesToSave_
double Getdxdz() const
get dxdz slope, crossing angle in XZ
virtual TProfile * getTProfile()
double GetX() const
get X beam position
T const * product() const
HistosContainer histosMap_
LuminosityBlockNumber_t luminosityBlock() const
double GetBetaStar() const
get beta star
~AlcaBeamMonitor() override
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
static int position[264][3]
double GetEmittanceY() const
get emittance
reco::BeamSpot getBeamSpot()
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
T const * product() const
edm::ParameterSet parameters_
MonitorElement * theValuesContainer_
reco::BeamSpot getBeamSpot()
Power< A, B >::type pow(const A &a, const B &b)
std::vector< reco::VertexCollection > vertices_
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)