34 monitorName_ (parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
36 parameters_.getUntrackedParameter<
InputTag>(
"PrimaryVertexLabel"))),
38 parameters_.getUntrackedParameter<
InputTag>(
"TrackLabel"))),
40 parameters_.getUntrackedParameter<
InputTag>(
"ScalerLabel"))),
41 beamSpotLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"BeamSpotLabel")),
42 numberOfValuesToSave_ (0)
84 if(itM->first==
"run"){
85 histosMap_[*itV][itM->first][itM->second] =
nullptr;
122 for(map<string,MonitorElement*>::iterator itMM=itM->second[
"run"].begin(); itMM!=itM->second[
"run"].end(); itMM++){
123 name =
string(
"h") + itM->first + itMM->first;
124 title = itM->first +
"_{0} " + itMM->first;
125 if(itM->first ==
"x" || itM->first ==
"y"){
126 if(itMM->first ==
"Coordinate"){
127 itMM->second = ibooker.
book1D(name,title,1001,-0.2525,0.2525);
129 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 130 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
131 itMM->second = ibooker.
book1D(name,title,1001,-0.02525,0.02525);
137 else if(itM->first ==
"z"){
138 if(itMM->first ==
"Coordinate"){
139 itMM->second = ibooker.
book1D(name,title,101,-5.05,5.05);
141 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers"){
142 itMM->second = ibooker.
book1D(name,title,101,-0.505,0.505);
144 else if(itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
145 itMM->second = ibooker.
book1D(name,title,1001,-5.005,5.005);
151 else if(itM->first ==
"sigmaX" || itM->first ==
"sigmaY"){
152 if(itMM->first ==
"Coordinate"){
153 itMM->second = ibooker.
book1D(name,title,100,0,0.015);
155 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 156 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
157 itMM->second =
nullptr;
163 else if(itM->first ==
"sigmaZ"){
164 if(itMM->first ==
"Coordinate"){
165 itMM->second = ibooker.
book1D(name,title,110,0,11);
167 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 168 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
169 itMM->second = ibooker.
book1D(name,title,101,-5.05,5.05);
178 if(itMM->second !=
nullptr){
179 if(itMM->first ==
"Coordinate"){
182 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 183 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
184 itMM->second->setAxisTitle(itMM->first +
" " + itM->first +
"_{0} (cm)",1);
186 itMM->second->setAxisTitle(
"Entries",2);
197 hD0Phi0_ = ibooker.
bookProfile(
"hD0Phi0",
"d_{0} vs. #phi_{0} (All Tracks)",63,-3.15,3.15,100,-0.5,0.5,
"");
202 hDxyBS_ = ibooker.
book1D(
"hDxyBS",
"dxy_{0} w.r.t. Beam spot (All Tracks)",100,-0.1,0.1);
231 for (
int i=0;
i<7; ++
i ) {
232 for (
int j=0; j<7; ++j ) {
278 for ( reco::TrackCollection::const_iterator
track = tracks->begin();
track != tracks->end(); ++
track ) {
327 map<std::string,pair<double,double> > resultsMap;
328 vector<pair<double,double> > vertexResults;
336 resultsMap[itBS->first] = pair<double,double>(itBS->second.x0(),itBS->second.x0Error());
338 else if(*itV ==
"y"){
339 resultsMap[itBS->first] = pair<double,double>(itBS->second.y0(),itBS->second.y0Error());
341 else if(*itV ==
"z"){
342 resultsMap[itBS->first] = pair<double,double>(itBS->second.z0(),itBS->second.z0Error());
344 else if(*itV ==
"sigmaX"){
345 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthX(),itBS->second.BeamWidthXError());
347 else if(*itV ==
"sigmaY"){
348 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthY(),itBS->second.BeamWidthYError());
350 else if(*itV ==
"sigmaZ"){
351 resultsMap[itBS->first] = pair<double,double>(itBS->second.sigmaZ(),itBS->second.sigmaZ0Error());
355 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
360 vertexResults.clear();
361 for(vector<VertexCollection>::iterator itPV =
vertices_.begin(); itPV !=
vertices_.end(); itPV++){
363 for(VertexCollection::const_iterator
pv = itPV->begin();
pv != itPV->end();
pv++) {
364 if (
pv->isFake() ||
pv->tracksSize()<10)
continue;
366 vertexResults.push_back(pair<double,double>(
pv->x(),
pv->xError()));
368 else if(*itV ==
"y"){
369 vertexResults.push_back(pair<double,double>(
pv->y(),
pv->yError()));
371 else if(*itV ==
"z"){
372 vertexResults.push_back(pair<double,double>(
pv->z(),
pv->zError()));
374 else if(*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ"){
376 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
402 if(itM->first ==
"run" && (histo =
histosMap_[*itV][itM->first][itM->second]) ==
nullptr){
405 else if(itM->first !=
"run"){
408 if(itM->second ==
"Coordinate"){
413 else if(itM->second ==
"PrimaryVertex fit-DataBase"){
414 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
418 else if(itM->second ==
"PrimaryVertex fit-BeamFit"){
419 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
423 else if(itM->second ==
"PrimaryVertex fit-Scalers"){
424 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
428 else if(itM->second ==
"PrimaryVertex-DataBase"){
429 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
430 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
431 histo->
Fill(itPV->first-resultsMap[
"DB"].first);
435 else if(itM->second ==
"PrimaryVertex-BeamFit"){
436 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
437 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
438 histo->
Fill(itPV->first-resultsMap[
"BF"].first);
442 else if(itM->second ==
"PrimaryVertex-Scalers"){
443 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
444 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
445 histo->
Fill(itPV->first-resultsMap[
"SC"].first);
449 else if(itM->second ==
"Lumibased BeamSpotFit"){
450 if(resultsMap.find(
"BF") != resultsMap.end()){
456 else if(itM->second ==
"Lumibased PrimaryVertex"){
457 if(resultsMap.find(
"PV") != resultsMap.end()){
463 else if(itM->second ==
"Lumibased DataBase"){
464 if(resultsMap.find(
"DB") != resultsMap.end()){
470 else if(itM->second ==
"Lumibased Scalers"){
471 if(resultsMap.find(
"SC") != resultsMap.end()){
477 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase fit"){
478 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
484 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers fit"){
485 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
491 else if(itM->second ==
"Lumibased Scalers-DataBase fit"){
492 if(resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
498 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase"){
499 if(resultsMap.find(
"DB") != resultsMap.end() && !vertexResults.empty()){
500 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
518 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers"){
519 if(resultsMap.find(
"SC") != resultsMap.end() && !vertexResults.empty()){
520 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
545 <<
"The histosMap_ have a histogram named " << itM->second <<
" that I can't recognize in this loop!";
double Getdydz() const
get dydz slope, crossing angle in YZ
LuminosityBlockID id() const
TProfile * getTProfile() const
MonitorElement * hD0Phi0_
math::Error< dimension >::type CovarianceMatrix
edm::EDGetTokenT< reco::TrackCollection > trackLabel_
double GetY() const
get Y beam position
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void endLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
std::vector< Track > TrackCollection
collection of Tracks
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)
void beginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
double GetEmittanceX() const
get emittance
U second(std::pair< T, U > const &p)
std::vector< std::string > varNamesV_
AlcaBeamMonitor(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
void readEvent(const edm::Event &iEvent)
void setBeamWidthY(double v)
void setLumiFlag()
this ME is meant to be stored for each luminosity section
void setCurrentFolder(std::string const &fullpath)
int GetBeamType() const
get beam type
edm::EDGetTokenT< reco::BeamSpot > scalerLabel_
BeamSpotContainer beamSpotsMap_
BeamFitter * theBeamFitter_
MonitorElement * book1D(Args &&...args)
double GetZ() const
get Z beam position
int numberOfValuesToSave_
void Reset()
reset ME (ie. contents, errors, etc)
double Getdxdz() const
get dxdz slope, crossing angle in XZ
std::multimap< std::string, std::string > histoByCategoryNames_
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
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
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_