35 monitorName_ (parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
37 parameters_.getUntrackedParameter<
InputTag>(
"PrimaryVertexLabel"))),
39 parameters_.getUntrackedParameter<
InputTag>(
"TrackLabel"))),
41 parameters_.getUntrackedParameter<
InputTag>(
"ScalerLabel"))),
42 beamSpotLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"BeamSpotLabel")),
43 numberOfValuesToSave_ (0)
86 if(itM->first==
"run"){
124 for(map<string,MonitorElement*>::iterator itMM=itM->second[
"run"].begin(); itMM!=itM->second[
"run"].end(); itMM++){
125 name =
string(
"h") + itM->first + itMM->first;
126 title = itM->first +
"_{0} " + itMM->first;
127 if(itM->first ==
"x" || itM->first ==
"y"){
128 if(itMM->first ==
"Coordinate"){
129 itMM->second =
dbe_->book1D(name,title,1001,-0.2525,0.2525);
131 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 132 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
133 itMM->second =
dbe_->book1D(name,title,1001,-0.02525,0.02525);
139 else if(itM->first ==
"z"){
140 if(itMM->first ==
"Coordinate"){
141 itMM->second =
dbe_->book1D(name,title,101,-5.05,5.05);
143 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers"){
144 itMM->second =
dbe_->book1D(name,title,101,-0.505,0.505);
146 else if(itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
147 itMM->second =
dbe_->book1D(name,title,1001,-5.005,5.005);
153 else if(itM->first ==
"sigmaX" || itM->first ==
"sigmaY"){
154 if(itMM->first ==
"Coordinate"){
155 itMM->second =
dbe_->book1D(name,title,100,0,0.015);
157 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 158 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
165 else if(itM->first ==
"sigmaZ"){
166 if(itMM->first ==
"Coordinate"){
167 itMM->second =
dbe_->book1D(name,title,110,0,11);
169 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 170 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
171 itMM->second =
dbe_->book1D(name,title,101,-5.05,5.05);
180 if(itMM->second != 0){
181 if(itMM->first ==
"Coordinate"){
182 itMM->second->setAxisTitle(itM->first +
"_{0} (cm)",1);
184 else if(itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" || itMM->first ==
"PrimaryVertex fit-Scalers" 185 || itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers"){
186 itMM->second->setAxisTitle(itMM->first +
" " + itM->first +
"_{0} (cm)",1);
188 itMM->second->setAxisTitle(
"Entries",2);
203 hD0Phi0_ =
dbe_->bookProfile(
"hD0Phi0",
"d_{0} vs. #phi_{0} (All Tracks)",63,-3.15,3.15,100,-0.5,0.5,
"");
208 hDxyBS_ =
dbe_->book1D(
"hDxyBS",
"dxy_{0} w.r.t. Beam spot (All Tracks)",100,-0.1,0.1);
237 for (
int i=0;
i<7; ++
i ) {
238 for (
int j=0;
j<7; ++
j ) {
284 for ( reco::TrackCollection::const_iterator
track = tracks->begin();
track != tracks->end(); ++
track ) {
333 map<std::string,pair<double,double> > resultsMap;
334 vector<pair<double,double> > vertexResults;
342 resultsMap[itBS->first] = pair<double,double>(itBS->second.x0(),itBS->second.x0Error());
344 else if(*itV ==
"y"){
345 resultsMap[itBS->first] = pair<double,double>(itBS->second.y0(),itBS->second.y0Error());
347 else if(*itV ==
"z"){
348 resultsMap[itBS->first] = pair<double,double>(itBS->second.z0(),itBS->second.z0Error());
350 else if(*itV ==
"sigmaX"){
351 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthX(),itBS->second.BeamWidthXError());
353 else if(*itV ==
"sigmaY"){
354 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthY(),itBS->second.BeamWidthYError());
356 else if(*itV ==
"sigmaZ"){
357 resultsMap[itBS->first] = pair<double,double>(itBS->second.sigmaZ(),itBS->second.sigmaZ0Error());
361 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
366 vertexResults.clear();
367 for(vector<VertexCollection>::iterator itPV =
vertices_.begin(); itPV !=
vertices_.end(); itPV++){
368 if(itPV->size() != 0){
369 for(VertexCollection::const_iterator
pv = itPV->begin();
pv != itPV->end();
pv++) {
370 if (
pv->isFake() ||
pv->tracksSize()<10)
continue;
372 vertexResults.push_back(pair<double,double>(
pv->x(),
pv->xError()));
374 else if(*itV ==
"y"){
375 vertexResults.push_back(pair<double,double>(
pv->y(),
pv->yError()));
377 else if(*itV ==
"z"){
378 vertexResults.push_back(pair<double,double>(
pv->z(),
pv->zError()));
380 else if(*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ"){
382 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
408 if(itM->first ==
"run" && (histo =
histosMap_[*itV][itM->first][itM->second]) == 0){
411 else if(itM->first !=
"run"){
414 if(itM->second ==
"Coordinate"){
419 else if(itM->second ==
"PrimaryVertex fit-DataBase"){
420 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
424 else if(itM->second ==
"PrimaryVertex fit-BeamFit"){
425 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
429 else if(itM->second ==
"PrimaryVertex fit-Scalers"){
430 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
434 else if(itM->second ==
"PrimaryVertex-DataBase"){
435 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
436 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
437 histo->
Fill(itPV->first-resultsMap[
"DB"].first);
441 else if(itM->second ==
"PrimaryVertex-BeamFit"){
442 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
443 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
444 histo->
Fill(itPV->first-resultsMap[
"BF"].first);
448 else if(itM->second ==
"PrimaryVertex-Scalers"){
449 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
450 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
451 histo->
Fill(itPV->first-resultsMap[
"SC"].first);
455 else if(itM->second ==
"Lumibased BeamSpotFit"){
456 if(resultsMap.find(
"BF") != resultsMap.end()){
462 else if(itM->second ==
"Lumibased PrimaryVertex"){
463 if(resultsMap.find(
"PV") != resultsMap.end()){
469 else if(itM->second ==
"Lumibased DataBase"){
470 if(resultsMap.find(
"DB") != resultsMap.end()){
476 else if(itM->second ==
"Lumibased Scalers"){
477 if(resultsMap.find(
"SC") != resultsMap.end()){
483 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase fit"){
484 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
490 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers fit"){
491 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
497 else if(itM->second ==
"Lumibased Scalers-DataBase fit"){
498 if(resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
504 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase"){
505 if(resultsMap.find(
"DB") != resultsMap.end() && vertexResults.size() != 0){
506 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
524 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers"){
525 if(resultsMap.find(
"SC") != resultsMap.end() && vertexResults.size() != 0){
526 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
551 <<
"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
virtual char const * what() const
LuminosityBlockID id() const
MonitorElement * hD0Phi0_
math::Error< dimension >::type CovarianceMatrix
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< reco::TrackCollection > trackLabel_
double GetY() const
get Y beam position
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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
PositionContainer positionsMap_
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
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 &)
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_
double GetZ() const
get Z beam position
int numberOfValuesToSave_
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
void beginJob(void) 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]
TProfile * getTProfile(void) const
double GetEmittanceY() const
get emittance
reco::BeamSpot getBeamSpot()
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
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_