CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Attributes
AlcaBeamMonitor Class Reference

#include <AlcaBeamMonitor.h>

Inheritance diagram for AlcaBeamMonitor:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AlcaBeamMonitor (const edm::ParameterSet &)
 
 ~AlcaBeamMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void beginJob (void)
 
void beginLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
 
void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup)
 
void endJob (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
 
void endLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup)
 
void endRun (const edm::Run &iRun, const edm::EventSetup &iSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Types

typedef std::map< std::string,
reco::BeamSpot
BeamSpotContainer
 
typedef std::map< std::string,
std::map< std::string,
std::map< std::string,
MonitorElement * > > > 
HistosContainer
 
typedef std::map< std::string,
std::map< std::string,
std::map< std::string, int > > > 
PositionContainer
 

Private Attributes

edm::InputTag beamSpotLabel_
 
BeamSpotContainer beamSpotsMap_
 
DQMStoredbe_
 
MonitorElementhD0Phi0_
 
MonitorElementhDxyBS_
 
std::multimap< std::string,
std::string > 
histoByCategoryNames_
 
HistosContainer histosMap_
 
std::string monitorName_
 
int numberOfValuesToSave_
 
edm::ParameterSet parameters_
 
PositionContainer positionsMap_
 
edm::InputTag primaryVertexLabel_
 
edm::InputTag scalerLabel_
 
BeamFittertheBeamFitter_
 
PVFitterthePVFitter_
 
MonitorElementtheValuesContainer_
 
edm::InputTag trackLabel_
 
std::vector< std::string > varNamesV_
 
std::vector
< reco::VertexCollection
vertices_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 30 of file AlcaBeamMonitor.h.

Member Typedef Documentation

typedef std::map<std::string,reco::BeamSpot> AlcaBeamMonitor::BeamSpotContainer
private

Definition at line 48 of file AlcaBeamMonitor.h.

typedef std::map<std::string,std::map<std::string,std::map<std::string,MonitorElement*> > > AlcaBeamMonitor::HistosContainer
private

Definition at line 50 of file AlcaBeamMonitor.h.

typedef std::map<std::string,std::map<std::string,std::map<std::string,int> > > AlcaBeamMonitor::PositionContainer
private

Definition at line 52 of file AlcaBeamMonitor.h.

Constructor & Destructor Documentation

AlcaBeamMonitor::AlcaBeamMonitor ( const edm::ParameterSet ps)

Definition at line 34 of file AlcaBeamMonitor.cc.

References dbe_, histoByCategoryNames_, histosMap_, monitorName_, numberOfValuesToSave_, cppFunctionSkipper::operator, parameters_, positionsMap_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), theBeamFitter_, thePVFitter_, and varNamesV_.

34  :
35  parameters_ (ps),
36  monitorName_ (parameters_.getUntrackedParameter<string>("MonitorName","YourSubsystemName")),
42 {
44 
45  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
46 
52 
54 
55 
56  varNamesV_.push_back("x");
57  varNamesV_.push_back("y");
58  varNamesV_.push_back("z");
59  varNamesV_.push_back("sigmaX");
60  varNamesV_.push_back("sigmaY");
61  varNamesV_.push_back("sigmaZ");
62 
63  histoByCategoryNames_.insert( pair<string,string>("run", "Coordinate"));
64  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-DataBase"));
65  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-BeamFit"));
66  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-Scalers"));
67  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-DataBase"));
68  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-BeamFit"));
69  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-Scalers"));
70 
71  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased BeamSpotFit"));
72  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex"));
73  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased DataBase"));
74  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased Scalers"));
75  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-DataBase fit"));
76  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-Scalers fit"));
77  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased Scalers-DataBase fit"));
78  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-DataBase"));
79  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-Scalers"));
80 
81 
82  for(vector<string>::iterator itV=varNamesV_.begin(); itV!=varNamesV_.end(); itV++){
83  for(multimap<string,string>::iterator itM=histoByCategoryNames_.begin(); itM!=histoByCategoryNames_.end(); itM++){
84  if(itM->first=="run"){
85  histosMap_[*itV][itM->first][itM->second] = 0;
86  }
87  else{
88  positionsMap_[*itV][itM->first][itM->second] = 3*numberOfValuesToSave_;//value, error, ok
90  }
91  }
92  }
93 
94 // beamSpotsMap_["BF"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi the beamfitter will have a result
95 // beamSpotsMap_["PV"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi the PVfitter will have a result
96 // beamSpotsMap_["DB"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi we take the values that are stored in the database, already collapsed then
97 // beamSpotsMap_["SC"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi we take the beamspot value in the file that is the same as the scaler for the alca reco stream
98 // beamSpotsMap_["BF"] = 0;//For each lumi the beamfitter will have a result
99 // beamSpotsMap_["PV"] = 0;//For each lumi the PVfitter will have a result
100 // beamSpotsMap_["DB"] = 0;//For each lumi we take the values that are stored in the database, already collapsed then
101 // beamSpotsMap_["SC"] = 0;//For each lumi we take the beamspot value in the file that is the same as the scaler for the alca reco stream
102 }
edm::InputTag trackLabel_
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag primaryVertexLabel_
void resetTrkVector()
Definition: BeamFitter.h:48
PositionContainer positionsMap_
edm::InputTag beamSpotLabel_
std::vector< std::string > varNamesV_
BeamFitter * theBeamFitter_
void resetLSRange()
Definition: BeamFitter.h:50
PVFitter * thePVFitter_
std::multimap< std::string, std::string > histoByCategoryNames_
HistosContainer histosMap_
std::string monitorName_
void resetPVFitter()
Definition: BeamFitter.h:64
edm::ParameterSet parameters_
edm::InputTag scalerLabel_
void resetRefTime()
Definition: BeamFitter.h:51
AlcaBeamMonitor::~AlcaBeamMonitor ( )

Definition at line 105 of file AlcaBeamMonitor.cc.

References theBeamFitter_, and thePVFitter_.

105  {
106  if(theBeamFitter_ != 0){
107  delete theBeamFitter_;
108  }
109 
110  if(thePVFitter_ != 0){
111  delete thePVFitter_;
112  }
113 }
BeamFitter * theBeamFitter_
PVFitter * thePVFitter_

Member Function Documentation

void AlcaBeamMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
protectedvirtual

Implements edm::EDAnalyzer.

Definition at line 270 of file AlcaBeamMonitor.cc.

References beamSpotsMap_, cppFunctionSkipper::exception, reco::BeamSpot::Fake, MonitorElement::Fill(), edm::Event::getByLabel(), hD0Phi0_, hDxyBS_, position, primaryVertexLabel_, edm::Handle< T >::product(), BeamFitter::readEvent(), PVFitter::readEvent(), scalerLabel_, theBeamFitter_, thePVFitter_, reco::BeamSpot::Tracker, trackLabel_, testEve_cfg::tracks, vertices_, and cms::Exception::what().

270  {
271 
272  //------ BeamFitter
273  theBeamFitter_->readEvent(iEvent);
274  //------ PVFitter
275  thePVFitter_->readEvent(iEvent);
276 
277  if(beamSpotsMap_.find("DB") != beamSpotsMap_.end()){
278  //------ Tracks
280  iEvent.getByLabel(trackLabel_, TrackCollection);
281  const reco::TrackCollection *tracks = TrackCollection.product();
282  for ( reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track ) {
283  hD0Phi0_->Fill(track->phi(), -1*track->dxy(beamSpotsMap_["DB"].position()));
284  hDxyBS_->Fill(-1*track->dxy(beamSpotsMap_["DB"].position()));
285  }
286  }
287 
288  //------ Primary Vertices
289  Handle<VertexCollection > PVCollection;
290  if (iEvent.getByLabel(primaryVertexLabel_, PVCollection )) {
291  vertices_.push_back(*PVCollection.product());
292  }
293 
294  if(beamSpotsMap_.find("SC") == beamSpotsMap_.end()){
295  //BeamSpot from file for this stream is = to the scalar BeamSpot
296  Handle<BeamSpot> recoBeamSpotHandle;
297  try{
298  iEvent.getByLabel(scalerLabel_,recoBeamSpotHandle);
299  }
300  catch( cms::Exception& exception ){
301  LogInfo("AlcaBeamMonitor")
302  << exception.what();
303  return;
304  }
305  beamSpotsMap_["SC"] = *recoBeamSpotHandle;
306  if ( beamSpotsMap_["SC"].BeamWidthX() != 0 ) {
307  beamSpotsMap_["SC"].setType( reco::BeamSpot::Tracker );
308  } else{
309  beamSpotsMap_["SC"].setType( reco::BeamSpot::Fake );
310  }
311  }
312 }
edm::InputTag trackLabel_
virtual char const * what() const
Definition: Exception.cc:141
MonitorElement * hD0Phi0_
MonitorElement * hDxyBS_
edm::InputTag primaryVertexLabel_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:223
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
void Fill(long long x)
void readEvent(const edm::Event &iEvent)
Definition: PVFitter.cc:84
BeamSpotContainer beamSpotsMap_
BeamFitter * theBeamFitter_
PVFitter * thePVFitter_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
tuple tracks
Definition: testEve_cfg.py:39
T const * product() const
Definition: Handle.h:74
edm::InputTag scalerLabel_
std::vector< reco::VertexCollection > vertices_
void AlcaBeamMonitor::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file AlcaBeamMonitor.cc.

References DQMStore::book1D(), DQMStore::bookProfile(), dbe_, histosMap_, monitorName_, mergeVDriftHistosByStation::name, numberOfValuesToSave_, MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), AlCaHLTBitMon_QueryRunRegistry::string, theValuesContainer_, and indexGen::title.

117  {
118  string name;
119  string title;
121  for(HistosContainer::iterator itM=histosMap_.begin(); itM!=histosMap_.end(); itM++){
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);
128  }
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);
132  }
133  else{
134  //assert(0);
135  }
136  }
137  else if(itM->first == "z"){
138  if(itMM->first == "Coordinate"){
139  itMM->second = dbe_->book1D(name,title,101,-5.05,5.05);
140  }
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);
143  }
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);
146  }
147  else{
148  //assert(0);
149  }
150  }
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);
154  }
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 = 0;
158  }
159  else{
160  //assert(0);
161  }
162  }
163  else if(itM->first == "sigmaZ"){
164  if(itMM->first == "Coordinate"){
165  itMM->second = dbe_->book1D(name,title,110,0,11);
166  }
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);
170  }
171  else{
172  //assert(0);
173  }
174  }
175  else{
176  //assert(0);
177  }
178  if(itMM->second != 0){
179  if(itMM->first == "Coordinate"){
180  itMM->second->setAxisTitle(itM->first + "_{0} (cm)",1);
181  }
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);
185  }
186  itMM->second->setAxisTitle("Entries",2);
187  }
188  }
189  }
190  dbe_->setCurrentFolder(monitorName_+"Service");
191  theValuesContainer_ = dbe_->bookProfile("hHistoLumiValues","Histo Lumi Values", 3*numberOfValuesToSave_, 0., 3*numberOfValuesToSave_, 100., -100., 9000., " ");
193 
194 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
HistosContainer histosMap_
std::string monitorName_
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)
MonitorElement * theValuesContainer_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void AlcaBeamMonitor::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 211 of file AlcaBeamMonitor.cc.

References align::BeamSpot, beamSpotsMap_, cppFunctionSkipper::exception, reco::BeamSpot::Fake, edm::EventSetup::get(), BeamSpotObjects::GetBeamType(), BeamSpotObjects::GetBeamWidthX(), BeamSpotObjects::GetBeamWidthY(), BeamSpotObjects::GetBetaStar(), BeamSpotObjects::GetCovariance(), BeamSpotObjects::Getdxdz(), BeamSpotObjects::Getdydz(), BeamSpotObjects::GetEmittanceX(), BeamSpotObjects::GetEmittanceY(), BeamSpotObjects::GetSigmaZ(), BeamSpotObjects::GetX(), BeamSpotObjects::GetY(), BeamSpotObjects::GetZ(), i, edm::LuminosityBlockBase::id(), edm::ESHandleBase::isValid(), j, edm::LuminosityBlockID::luminosityBlock(), makeMuonMisalignmentScenario::matrix, edm::ESHandle< class >::product(), MonitorElement::Reset(), reco::BeamSpot::setBeamWidthY(), theValuesContainer_, reco::BeamSpot::Tracker, vertices_, and cms::Exception::what().

211  {
212  // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type!
213 
214  vertices_.clear();
216  beamSpotsMap_.clear();
217 
218  //Read BeamSpot from DB
219  ESHandle<BeamSpotObjects> bsDBHandle;
220  try{
221  iSetup.get<BeamSpotObjectsRcd>().get(bsDBHandle);
222  }
223  catch( cms::Exception& exception ){
224  LogInfo("AlcaBeamMonitor")
225  << exception.what();
226  return;
227  }
228  if(bsDBHandle.isValid()) { // check the product
229  const BeamSpotObjects *spotDB = bsDBHandle.product();
230 
231  // translate from BeamSpotObjects to reco::BeamSpot
232  BeamSpot::Point apoint( spotDB->GetX(), spotDB->GetY(), spotDB->GetZ() );
233 
235  for ( int i=0; i<7; ++i ) {
236  for ( int j=0; j<7; ++j ) {
237  matrix(i,j) = spotDB->GetCovariance(i,j);
238  }
239  }
240 
241  beamSpotsMap_["DB"] = BeamSpot( apoint,
242  spotDB->GetSigmaZ(),
243  spotDB->Getdxdz(),
244  spotDB->Getdydz(),
245  spotDB->GetBeamWidthX(),
246  matrix );
247 
248  BeamSpot* aSpot = &(beamSpotsMap_["DB"]);
249 
250  aSpot->setBeamWidthY( spotDB->GetBeamWidthY() );
251  aSpot->setEmittanceX( spotDB->GetEmittanceX() );
252  aSpot->setEmittanceY( spotDB->GetEmittanceY() );
253  aSpot->setbetaStar( spotDB->GetBetaStar() );
254 
255  if ( spotDB->GetBeamType() == 2 ) {
256  aSpot->setType( reco::BeamSpot::Tracker );
257  } else{
258  aSpot->setType( reco::BeamSpot::Fake );
259  }
260  //LogInfo("AlcaBeamMonitor")
261  // << *aSpot << std::endl;
262  }
263  else {
264  LogInfo("AlcaBeamMonitor")
265  << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
266  }
267 }
double Getdydz() const
get dydz slope, crossing angle in YZ
virtual char const * what() const
Definition: Exception.cc:141
LuminosityBlockID id() const
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:32
int i
Definition: DBlmapReader.cc:9
double GetY() const
get Y beam position
double GetSigmaZ() const
get sigma Z, RMS bunch length
double GetBeamWidthX() const
get average transverse beam width
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setBeamWidthY(double v)
Definition: BeamSpot.h:110
int GetBeamType() const
get beam type
BeamSpotContainer beamSpotsMap_
int j
Definition: DBlmapReader.cc:9
double GetZ() const
get Z beam position
double Getdxdz() const
get dxdz slope, crossing angle in XZ
double GetX() const
get X beam position
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
LuminosityBlockNumber_t luminosityBlock() const
double GetBetaStar() const
get beta star
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
double GetEmittanceY() const
get emittance
bool isValid() const
Definition: ESHandle.h:37
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * theValuesContainer_
std::vector< reco::VertexCollection > vertices_
void AlcaBeamMonitor::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 197 of file AlcaBeamMonitor.cc.

References DQMStore::book1D(), DQMStore::bookProfile(), dbe_, hD0Phi0_, hDxyBS_, monitorName_, MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

197  {
198  // create and cd into new folder
199  dbe_->setCurrentFolder(monitorName_+"Validation");
200  //Book histograms
201  hD0Phi0_ = dbe_->bookProfile("hD0Phi0","d_{0} vs. #phi_{0} (All Tracks)",63,-3.15,3.15,100,-0.1,0.1,"");
202  hD0Phi0_->setAxisTitle("#phi_{0} (rad)",1);
203  hD0Phi0_->setAxisTitle("d_{0} (cm)",2);
204 
206  hDxyBS_ = dbe_->book1D("hDxyBS","dxy_{0} w.r.t. Beam spot (All Tracks)",100,-0.1,0.1);
207  hDxyBS_->setAxisTitle("dxy_{0} w.r.t. Beam spot (cm)",1);
208 }
MonitorElement * hD0Phi0_
MonitorElement * hDxyBS_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1036
std::string monitorName_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void AlcaBeamMonitor::endJob ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
protected

Definition at line 562 of file AlcaBeamMonitor.cc.

562  {
563 }
void AlcaBeamMonitor::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 316 of file AlcaBeamMonitor.cc.

References beamSpotsMap_, MonitorElement::Fill(), first, PVFitter::getBeamSpot(), BeamFitter::getBeamSpot(), MonitorElement::getTProfile(), timingPdfMaker::histo, histoByCategoryNames_, histosMap_, position, positionsMap_, funct::pow(), PVFitter::resetAll(), BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), PVFitter::runFitter(), BeamFitter::runPVandTrkFitter(), edm::second(), mathSSE::sqrt(), theBeamFitter_, thePVFitter_, theValuesContainer_, align::Tracker, varNamesV_, and vertices_.

316  {
319  }
324 
325  if ( thePVFitter_->runFitter() ) {
327  }
329 
330  // "PV,BF..." Value,Error
331  map<std::string,pair<double,double> > resultsMap;
332  vector<pair<double,double> > vertexResults;
334  int position = 0;
335  for(vector<string>::iterator itV=varNamesV_.begin(); itV!=varNamesV_.end(); itV++){
336  resultsMap.clear();
337  for(BeamSpotContainer::iterator itBS = beamSpotsMap_.begin(); itBS != beamSpotsMap_.end(); itBS++){
338  if(itBS->second.type() == BeamSpot::Tracker){
339  if(*itV == "x"){
340  resultsMap[itBS->first] = pair<double,double>(itBS->second.x0(),itBS->second.x0Error());
341  }
342  else if(*itV == "y"){
343  resultsMap[itBS->first] = pair<double,double>(itBS->second.y0(),itBS->second.y0Error());
344  }
345  else if(*itV == "z"){
346  resultsMap[itBS->first] = pair<double,double>(itBS->second.z0(),itBS->second.z0Error());
347  }
348  else if(*itV == "sigmaX"){
349  resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthX(),itBS->second.BeamWidthXError());
350  }
351  else if(*itV == "sigmaY"){
352  resultsMap[itBS->first] = pair<double,double>(itBS->second.BeamWidthY(),itBS->second.BeamWidthYError());
353  }
354  else if(*itV == "sigmaZ"){
355  resultsMap[itBS->first] = pair<double,double>(itBS->second.sigmaZ(),itBS->second.sigmaZ0Error());
356  }
357  else{
358  LogInfo("AlcaBeamMonitor")
359  << "The histosMap_ has been built with the name " << *itV << " that I can't recognize!";
360  //assert(0);
361  }
362  }
363  }
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;
369  if(*itV == "x"){
370  vertexResults.push_back(pair<double,double>(pv->x(),pv->xError()));
371  }
372  else if(*itV == "y"){
373  vertexResults.push_back(pair<double,double>(pv->y(),pv->yError()));
374  }
375  else if(*itV == "z"){
376  vertexResults.push_back(pair<double,double>(pv->z(),pv->zError()));
377  }
378  else if(*itV != "sigmaX" && *itV != "sigmaY" && *itV != "sigmaZ"){
379  LogInfo("AlcaBeamMonitor")
380  << "The histosMap_ has been built with the name " << *itV << " that I can't recognize!";
381  //assert(0);
382  }
383  }
384  }
385  }
386 /*
387  histoByCategoryNames_.insert( pair<string,string>("run", "Coordinate"));
388  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-DataBase"));
389  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-BeamFit"));
390  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-Scalers"));
391  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-DataBase"));
392  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-BeamFit"));
393  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-Scalers"));
394 
395  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased BeamSpotFit"));
396  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex"));
397  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased DataBase"));
398  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased Scalers"));
399  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-DataBase fit"));
400  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-Scalers fit"));
401  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased Scalers-DataBase fit"));
402  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-DataBase"));
403  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-Scalers"));
404 */
405  for(multimap<string,string>::iterator itM=histoByCategoryNames_.begin(); itM!=histoByCategoryNames_.end(); itM++){
406  if(itM->first == "run" && (histo = histosMap_[*itV][itM->first][itM->second]) == 0){
407  continue;
408  }
409  else if(itM->first != "run"){
410  position = positionsMap_[*itV][itM->first][itM->second];
411  }
412  if(itM->second == "Coordinate"){
413  if(beamSpotsMap_.find("DB") != beamSpotsMap_.end()){
414  histo->Fill(resultsMap["DB"].first);
415  }
416  }
417  else if(itM->second == "PrimaryVertex fit-DataBase"){
418  if(resultsMap.find("PV") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){
419  histo->Fill(resultsMap["PV"].first-resultsMap["DB"].first);
420  }
421  }
422  else if(itM->second == "PrimaryVertex fit-BeamFit"){
423  if(resultsMap.find("PV") != resultsMap.end() && resultsMap.find("BF") != resultsMap.end()){
424  histo->Fill(resultsMap["PV"].first-resultsMap["BF"].first);
425  }
426  }
427  else if(itM->second == "PrimaryVertex fit-Scalers"){
428  if(resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()){
429  histo->Fill(resultsMap["PV"].first-resultsMap["SC"].first);
430  }
431  }
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);
436  }
437  }
438  }
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);
443  }
444  }
445  }
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);
450  }
451  }
452  }
453  else if(itM->second == "Lumibased BeamSpotFit"){
454  if(resultsMap.find("BF") != resultsMap.end()){
455  theValuesContainer_->Fill(position ,resultsMap["BF"].first);//Value
456  theValuesContainer_->Fill(position+1,resultsMap["BF"].second);//Error
457  theValuesContainer_->Fill(position+2,1);//ok
458  }
459  }
460  else if(itM->second == "Lumibased PrimaryVertex"){
461  if(resultsMap.find("PV") != resultsMap.end()){
462  theValuesContainer_->Fill(position ,resultsMap["PV"].first);//Value
463  theValuesContainer_->Fill(position+1,resultsMap["PV"].second);//Error
464  theValuesContainer_->Fill(position+2,1);//ok
465  }
466  }
467  else if(itM->second == "Lumibased DataBase"){
468  if(resultsMap.find("DB") != resultsMap.end()){
469  theValuesContainer_->Fill(position ,resultsMap["DB"].first);//Value
470  theValuesContainer_->Fill(position+1,resultsMap["DB"].second);//Error
471  theValuesContainer_->Fill(position+2,1);//ok
472  }
473  }
474  else if(itM->second == "Lumibased Scalers"){
475  if(resultsMap.find("SC") != resultsMap.end()){
476  theValuesContainer_->Fill(position ,resultsMap["SC"].first);//Value
477  theValuesContainer_->Fill(position+1,resultsMap["SC"].second);//Error
478  theValuesContainer_->Fill(position+2,1);//ok
479  }
480  }
481  else if(itM->second == "Lumibased PrimaryVertex-DataBase fit"){
482  if(resultsMap.find("PV") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){
483  theValuesContainer_->Fill(position ,resultsMap["PV"].first-resultsMap["DB"].first);//Value
484  theValuesContainer_->Fill(position+1,std::sqrt(std::pow(resultsMap["PV"].second,2)+std::pow(resultsMap["DB"].second,2)));//Error
485  theValuesContainer_->Fill(position+2,1);//ok
486  }
487  }
488  else if(itM->second == "Lumibased PrimaryVertex-Scalers fit"){
489  if(resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()){
490  theValuesContainer_->Fill(position ,resultsMap["PV"].first-resultsMap["SC"].first);//Value
491  theValuesContainer_->Fill(position+1,std::sqrt(std::pow(resultsMap["PV"].second,2)+std::pow(resultsMap["SC"].second,2)));//Error
492  theValuesContainer_->Fill(position+2,1);//ok
493  }
494  }
495  else if(itM->second == "Lumibased Scalers-DataBase fit"){
496  if(resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){
497  theValuesContainer_->Fill(position ,resultsMap["SC"].first-resultsMap["DB"].first);//Value
498  theValuesContainer_->Fill(position+1,std::sqrt(std::pow(resultsMap["SC"].second,2)+std::pow(resultsMap["DB"].second,2)));//Error
499  theValuesContainer_->Fill(position+2,1);//ok
500  }
501  }
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++){
505  theValuesContainer_->Fill(position ,(*itPV).first-resultsMap["DB"].first);//Value
506  }
507 /*
508  double error = 0;
509  if(vertexResults.size() != 0){
510  for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
511  error += std::pow((*itPV).first-resultsMap["DB"].first-theValuesContainer_->getTProfile()->GetBinContent(position+1),2.);
512  }
513  error = std::sqrt(error)/vertexResults.size();
514  }
515 // theValuesContainer_->Fill(position+1,std::sqrt(std::pow((*itPV).second,2)+std::pow(resultsMap["DB"].second,2)));//Error
516  theValuesContainer_->Fill(position+1,error);//Error
517 */
518  theValuesContainer_->Fill(position+1,theValuesContainer_->getTProfile()->GetBinError(position+1));//Error
519  theValuesContainer_->Fill(position+2,1);//ok
520  }
521  }
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++){
525  theValuesContainer_->Fill(position ,(*itPV).first-resultsMap["SC"].first);//Value
526  }
527 /*
528  double error = 0;
529  if(vertexResults.size() != 0){
530  for(vector<pair<double,double> >::iterator itPV=vertexResults.begin(); itPV!=vertexResults.end(); itPV++){
531  error += std::pow((*itPV).first-resultsMap["SC"].first-theValuesContainer_->getTProfile()->GetBinContent(position+1),2.);
532  }
533  error = std::sqrt(error)/vertexResults.size();
534  }
535 // theValuesContainer_->Fill(position+1,std::sqrt(std::pow((*itPV).second,2)+std::pow(resultsMap["SC"].second,2)));//Error
536  theValuesContainer_->Fill(position+1,error);//Error
537 */
538  theValuesContainer_->Fill(position+1,theValuesContainer_->getTProfile()->GetBinError(position+1));//Error
539  theValuesContainer_->Fill(position+2,1);//ok
540  }
541  }
542 // else if(itM->second == "Lumibased Scalers-DataBase"){
543 // if(resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){
544 // itHHH->second->Fill(bin,resultsMap["SC"].first-resultsMap["DB"].first);
545 // }
546 // }
547  else{
548  LogInfo("AlcaBeamMonitor")
549  << "The histosMap_ have a histogram named " << itM->second << " that I can't recognize in this loop!";
550  //assert(0);
551 
552  }
553  }
554  }
555 }
bool runPVandTrkFitter()
Definition: BeamFitter.cc:409
void resetTrkVector()
Definition: BeamFitter.h:48
PositionContainer positionsMap_
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
void Fill(long long x)
U second(std::pair< T, U > const &p)
std::vector< std::string > varNamesV_
T sqrt(T t)
Definition: SSEVec.h:48
BeamSpotContainer beamSpotsMap_
BeamFitter * theBeamFitter_
void resetLSRange()
Definition: BeamFitter.h:50
bool first
Definition: L1TdeRCT.cc:94
PVFitter * thePVFitter_
std::multimap< std::string, std::string > histoByCategoryNames_
bool runFitter()
Definition: PVFitter.cc:320
HistosContainer histosMap_
void resetAll()
Definition: PVFitter.h:74
void resetPVFitter()
Definition: BeamFitter.h:64
TProfile * getTProfile(void) const
reco::BeamSpot getBeamSpot()
Definition: PVFitter.h:85
MonitorElement * theValuesContainer_
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:89
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< reco::VertexCollection > vertices_
void resetRefTime()
Definition: BeamFitter.h:51
void AlcaBeamMonitor::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 558 of file AlcaBeamMonitor.cc.

558  {
559 }

Member Data Documentation

edm::InputTag AlcaBeamMonitor::beamSpotLabel_
private

Definition at line 58 of file AlcaBeamMonitor.h.

BeamSpotContainer AlcaBeamMonitor::beamSpotsMap_
private

Definition at line 74 of file AlcaBeamMonitor.h.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

DQMStore* AlcaBeamMonitor::dbe_
private

Definition at line 64 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), beginJob(), and beginRun().

MonitorElement* AlcaBeamMonitor::hD0Phi0_
private

Definition at line 69 of file AlcaBeamMonitor.h.

Referenced by analyze(), and beginRun().

MonitorElement* AlcaBeamMonitor::hDxyBS_
private

Definition at line 70 of file AlcaBeamMonitor.h.

Referenced by analyze(), and beginRun().

std::multimap<std::string,std::string> AlcaBeamMonitor::histoByCategoryNames_
private

Definition at line 78 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

HistosContainer AlcaBeamMonitor::histosMap_
private

Definition at line 75 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), beginJob(), and endLuminosityBlock().

std::string AlcaBeamMonitor::monitorName_
private

Definition at line 56 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), beginJob(), and beginRun().

int AlcaBeamMonitor::numberOfValuesToSave_
private

Definition at line 63 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and beginJob().

edm::ParameterSet AlcaBeamMonitor::parameters_
private
PositionContainer AlcaBeamMonitor::positionsMap_
private

Definition at line 76 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

edm::InputTag AlcaBeamMonitor::primaryVertexLabel_
private

Definition at line 57 of file AlcaBeamMonitor.h.

Referenced by analyze().

edm::InputTag AlcaBeamMonitor::scalerLabel_
private

Definition at line 60 of file AlcaBeamMonitor.h.

Referenced by analyze().

BeamFitter* AlcaBeamMonitor::theBeamFitter_
private

Definition at line 65 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), analyze(), endLuminosityBlock(), and ~AlcaBeamMonitor().

PVFitter* AlcaBeamMonitor::thePVFitter_
private

Definition at line 66 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), analyze(), endLuminosityBlock(), and ~AlcaBeamMonitor().

MonitorElement* AlcaBeamMonitor::theValuesContainer_
private

Definition at line 71 of file AlcaBeamMonitor.h.

Referenced by beginJob(), beginLuminosityBlock(), and endLuminosityBlock().

edm::InputTag AlcaBeamMonitor::trackLabel_
private

Definition at line 59 of file AlcaBeamMonitor.h.

Referenced by analyze().

std::vector<std::string> AlcaBeamMonitor::varNamesV_
private

Definition at line 77 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

std::vector<reco::VertexCollection> AlcaBeamMonitor::vertices_
private

Definition at line 79 of file AlcaBeamMonitor.h.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().