36 monitorName_ (parameters_.getUntrackedParameter<string>(
"MonitorName",
"YourSubsystemName")),
37 primaryVertexLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"PrimaryVertexLabel")),
38 beamSpotLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"BeamSpotLabel")),
39 trackLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"TrackLabel")),
40 scalerLabel_ (parameters_.getUntrackedParameter<
InputTag>(
"ScalerLabel")),
41 numberOfValuesToSave_ (0)
84 if(itM->first==
"run"){
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 =
dbe_->
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 =
dbe_->
book1D(name,title,1001,-0.02525,0.02525);
137 else if(itM->first ==
"z"){
138 if(itMM->first ==
"Coordinate"){
139 itMM->second =
dbe_->
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 =
dbe_->
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 =
dbe_->
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 =
dbe_->
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"){
163 else if(itM->first ==
"sigmaZ"){
164 if(itMM->first ==
"Coordinate"){
165 itMM->second =
dbe_->
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 =
dbe_->
book1D(name,title,101,-5.05,5.05);
178 if(itMM->second != 0){
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);
206 hDxyBS_ =
dbe_->
book1D(
"hDxyBS",
"dxy_{0} w.r.t. Beam spot (All Tracks)",100,-0.1,0.1);
235 for (
int i=0;
i<7; ++
i ) {
236 for (
int j=0;
j<7; ++
j ) {
282 for ( reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track ) {
331 map<std::string,pair<double,double> > resultsMap;
332 vector<pair<double,double> > vertexResults;
340 resultsMap[itBS->first] = pair<double,double>(itBS->second.x0(),itBS->second.x0Error());
342 else if(*itV ==
"y"){
343 resultsMap[itBS->first] = pair<double,double>(itBS->second.y0(),itBS->second.y0Error());
345 else if(*itV ==
"z"){
346 resultsMap[itBS->first] = pair<double,double>(itBS->second.z0(),itBS->second.z0Error());
348 else if(*itV ==
"sigmaX"){
349 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthX(),itBS->second.BeamWidthXError());
351 else if(*itV ==
"sigmaY"){
352 resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthY(),itBS->second.BeamWidthYError());
354 else if(*itV ==
"sigmaZ"){
355 resultsMap[itBS->first] = pair<double,double>(itBS->second.sigmaZ(),itBS->second.sigmaZ0Error());
359 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
364 vertexResults.clear();
365 for(vector<VertexCollection>::iterator itPV =
vertices_.begin(); itPV !=
vertices_.end(); itPV++){
366 if(itPV->size() != 0){
367 for(VertexCollection::const_iterator pv = itPV->begin(); pv != itPV->end(); pv++) {
368 if (pv->isFake() || pv->tracksSize()<10)
continue;
370 vertexResults.push_back(pair<double,double>(pv->x(),pv->xError()));
372 else if(*itV ==
"y"){
373 vertexResults.push_back(pair<double,double>(pv->y(),pv->yError()));
375 else if(*itV ==
"z"){
376 vertexResults.push_back(pair<double,double>(pv->z(),pv->zError()));
378 else if(*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ"){
380 <<
"The histosMap_ has been built with the name " << *itV <<
" that I can't recognize!";
406 if(itM->first ==
"run" && (histo =
histosMap_[*itV][itM->first][itM->second]) == 0){
409 else if(itM->first !=
"run"){
412 if(itM->second ==
"Coordinate"){
417 else if(itM->second ==
"PrimaryVertex fit-DataBase"){
418 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
422 else if(itM->second ==
"PrimaryVertex fit-BeamFit"){
423 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
427 else if(itM->second ==
"PrimaryVertex fit-Scalers"){
428 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
432 else if(itM->second ==
"PrimaryVertex-DataBase"){
433 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
434 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
435 histo->
Fill(itPV->first-resultsMap[
"DB"].first);
439 else if(itM->second ==
"PrimaryVertex-BeamFit"){
440 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()){
441 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
442 histo->
Fill(itPV->first-resultsMap[
"BF"].first);
446 else if(itM->second ==
"PrimaryVertex-Scalers"){
447 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
448 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
449 histo->
Fill(itPV->first-resultsMap[
"SC"].first);
453 else if(itM->second ==
"Lumibased BeamSpotFit"){
454 if(resultsMap.find(
"BF") != resultsMap.end()){
460 else if(itM->second ==
"Lumibased PrimaryVertex"){
461 if(resultsMap.find(
"PV") != resultsMap.end()){
467 else if(itM->second ==
"Lumibased DataBase"){
468 if(resultsMap.find(
"DB") != resultsMap.end()){
474 else if(itM->second ==
"Lumibased Scalers"){
475 if(resultsMap.find(
"SC") != resultsMap.end()){
481 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase fit"){
482 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
488 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers fit"){
489 if(resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()){
495 else if(itM->second ==
"Lumibased Scalers-DataBase fit"){
496 if(resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()){
502 else if(itM->second ==
"Lumibased PrimaryVertex-DataBase"){
503 if(resultsMap.find(
"DB") != resultsMap.end() && vertexResults.size() != 0){
504 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
522 else if(itM->second ==
"Lumibased PrimaryVertex-Scalers"){
523 if(resultsMap.find(
"SC") != resultsMap.end() && vertexResults.size() != 0){
524 for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
549 <<
"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
edm::InputTag trackLabel_
virtual char const * what() const
LuminosityBlockID id() const
MonitorElement * hD0Phi0_
math::Error< dimension >::type CovarianceMatrix
double GetY() const
get Y beam position
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
#define DEFINE_FWK_MODULE(type)
edm::InputTag primaryVertexLabel_
std::vector< Track > TrackCollection
collection of Tracks
double GetSigmaZ() const
get sigma Z, RMS bunch length
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
double GetBeamWidthX() const
get average transverse beam width
math::XYZPoint Point
point in the space
PositionContainer positionsMap_
double GetBeamWidthY() const
get average transverse beam width
void readEvent(const edm::Event &iEvent)
static int position[TOTALCHAMBERS][3]
double GetEmittanceX() const
get emittance
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup)
U second(std::pair< T, U > const &p)
std::vector< std::string > varNamesV_
AlcaBeamMonitor(const edm::ParameterSet &)
void readEvent(const edm::Event &iEvent)
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup)
void setBeamWidthY(double v)
int GetBeamType() const
get beam type
BeamSpotContainer beamSpotsMap_
BeamFitter * theBeamFitter_
double GetZ() const
get Z beam position
int numberOfValuesToSave_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
double Getdxdz() const
get dxdz slope, crossing angle in XZ
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::multimap< std::string, std::string > histoByCategoryNames_
double GetX() const
get X beam position
void beginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
HistosContainer histosMap_
T const * product() const
LuminosityBlockNumber_t luminosityBlock() const
double GetBetaStar() const
get beta star
T const * product() const
void endLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
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)
edm::ParameterSet parameters_
MonitorElement * theValuesContainer_
reco::BeamSpot getBeamSpot()
Power< A, B >::type pow(const A &a, const B &b)
void setCurrentFolder(const std::string &fullpath)
edm::InputTag scalerLabel_
std::vector< reco::VertexCollection > vertices_