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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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::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::EDGetTokenT
< reco::VertexCollection
primaryVertexLabel_
 
edm::EDGetTokenT< reco::BeamSpotscalerLabel_
 
BeamFittertheBeamFitter_
 
PVFitterthePVFitter_
 
MonitorElementtheValuesContainer_
 
edm::EDGetTokenT
< reco::TrackCollection
trackLabel_
 
std::vector< std::string > varNamesV_
 
std::vector
< reco::VertexCollection
vertices_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 28 of file AlcaBeamMonitor.h.

Member Typedef Documentation

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

Definition at line 46 of file AlcaBeamMonitor.h.

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

Definition at line 48 of file AlcaBeamMonitor.h.

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

Definition at line 50 of file AlcaBeamMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file AlcaBeamMonitor.cc.

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

33  :
34  parameters_ (ps),
35  monitorName_ (parameters_.getUntrackedParameter<string>("MonitorName","YourSubsystemName")),
36  primaryVertexLabel_ (consumes<VertexCollection>(
37  parameters_.getUntrackedParameter<InputTag>("PrimaryVertexLabel"))),
38  trackLabel_ (consumes<reco::TrackCollection>(
40  scalerLabel_ (consumes<BeamSpot>(
41  parameters_.getUntrackedParameter<InputTag>("ScalerLabel"))),
44 {
46 
47  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
48 
54 
56 
57 
58  varNamesV_.push_back("x");
59  varNamesV_.push_back("y");
60  varNamesV_.push_back("z");
61  varNamesV_.push_back("sigmaX");
62  varNamesV_.push_back("sigmaY");
63  varNamesV_.push_back("sigmaZ");
64 
65  histoByCategoryNames_.insert( pair<string,string>("run", "Coordinate"));
66  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-DataBase"));
67  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-BeamFit"));
68  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex fit-Scalers"));
69  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-DataBase"));
70  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-BeamFit"));
71  histoByCategoryNames_.insert( pair<string,string>("run", "PrimaryVertex-Scalers"));
72 
73  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased BeamSpotFit"));
74  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex"));
75  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased DataBase"));
76  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased Scalers"));
77  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-DataBase fit"));
78  histoByCategoryNames_.insert( pair<string,string>("lumi", "Lumibased PrimaryVertex-Scalers fit"));
79  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased Scalers-DataBase fit"));
80  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-DataBase"));
81  histoByCategoryNames_.insert( pair<string,string>("validation", "Lumibased PrimaryVertex-Scalers"));
82 
83 
84  for(vector<string>::iterator itV=varNamesV_.begin(); itV!=varNamesV_.end(); itV++){
85  for(multimap<string,string>::iterator itM=histoByCategoryNames_.begin(); itM!=histoByCategoryNames_.end(); itM++){
86  if(itM->first=="run"){
87  histosMap_[*itV][itM->first][itM->second] = 0;
88  }
89  else{
90  positionsMap_[*itV][itM->first][itM->second] = 3*numberOfValuesToSave_;//value, error, ok
92  }
93  }
94  }
95 
96 // beamSpotsMap_["BF"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi the beamfitter will have a result
97 // beamSpotsMap_["PV"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi the PVfitter will have a result
98 // beamSpotsMap_["DB"] = map<LuminosityBlockNumber_t,BeamSpot>();//For each lumi we take the values that are stored in the database, already collapsed then
99 // 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
100 // beamSpotsMap_["BF"] = 0;//For each lumi the beamfitter will have a result
101 // beamSpotsMap_["PV"] = 0;//For each lumi the PVfitter will have a result
102 // beamSpotsMap_["DB"] = 0;//For each lumi we take the values that are stored in the database, already collapsed then
103 // 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
104 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackCollection > trackLabel_
edm::EDGetTokenT< reco::VertexCollection > primaryVertexLabel_
void resetTrkVector()
Definition: BeamFitter.h:53
PositionContainer positionsMap_
edm::InputTag beamSpotLabel_
std::vector< std::string > varNamesV_
edm::EDGetTokenT< reco::BeamSpot > scalerLabel_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
BeamFitter * theBeamFitter_
void resetLSRange()
Definition: BeamFitter.h:55
PVFitter * thePVFitter_
std::multimap< std::string, std::string > histoByCategoryNames_
HistosContainer histosMap_
std::string monitorName_
void resetPVFitter()
Definition: BeamFitter.h:69
edm::ParameterSet parameters_
void resetRefTime()
Definition: BeamFitter.h:56
AlcaBeamMonitor::~AlcaBeamMonitor ( )

Definition at line 107 of file AlcaBeamMonitor.cc.

References theBeamFitter_, and thePVFitter_.

107  {
108  if(theBeamFitter_ != 0){
109  delete theBeamFitter_;
110  }
111 
112  if(thePVFitter_ != 0){
113  delete thePVFitter_;
114  }
115 }
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 272 of file AlcaBeamMonitor.cc.

References beamSpotsMap_, cppFunctionSkipper::exception, reco::BeamSpot::Fake, MonitorElement::Fill(), edm::Event::getByToken(), 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().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 119 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.

119  {
120  string name;
121  string title;
123  for(HistosContainer::iterator itM=histosMap_.begin(); itM!=histosMap_.end(); itM++){
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);
130  }
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);
134  }
135  else{
136  //assert(0);
137  }
138  }
139  else if(itM->first == "z"){
140  if(itMM->first == "Coordinate"){
141  itMM->second = dbe_->book1D(name,title,101,-5.05,5.05);
142  }
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);
145  }
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);
148  }
149  else{
150  //assert(0);
151  }
152  }
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);
156  }
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"){
159  itMM->second = 0;
160  }
161  else{
162  //assert(0);
163  }
164  }
165  else if(itM->first == "sigmaZ"){
166  if(itMM->first == "Coordinate"){
167  itMM->second = dbe_->book1D(name,title,110,0,11);
168  }
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);
172  }
173  else{
174  //assert(0);
175  }
176  }
177  else{
178  //assert(0);
179  }
180  if(itMM->second != 0){
181  if(itMM->first == "Coordinate"){
182  itMM->second->setAxisTitle(itM->first + "_{0} (cm)",1);
183  }
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);
187  }
188  itMM->second->setAxisTitle("Entries",2);
189  }
190  }
191  }
192  dbe_->setCurrentFolder(monitorName_+"Service");
193  theValuesContainer_ = dbe_->bookProfile("hHistoLumiValues","Histo Lumi Values", 3*numberOfValuesToSave_, 0., 3*numberOfValuesToSave_, 100., -100., 9000., " ");
195 
196 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:873
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:1187
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:585
void AlcaBeamMonitor::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 213 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().

213  {
214  // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type!
215 
216  vertices_.clear();
218  beamSpotsMap_.clear();
219 
220  //Read BeamSpot from DB
221  ESHandle<BeamSpotObjects> bsDBHandle;
222  try{
223  iSetup.get<BeamSpotObjectsRcd>().get(bsDBHandle);
224  }
225  catch( cms::Exception& exception ){
226  LogInfo("AlcaBeamMonitor")
227  << exception.what();
228  return;
229  }
230  if(bsDBHandle.isValid()) { // check the product
231  const BeamSpotObjects *spotDB = bsDBHandle.product();
232 
233  // translate from BeamSpotObjects to reco::BeamSpot
234  BeamSpot::Point apoint( spotDB->GetX(), spotDB->GetY(), spotDB->GetZ() );
235 
237  for ( int i=0; i<7; ++i ) {
238  for ( int j=0; j<7; ++j ) {
239  matrix(i,j) = spotDB->GetCovariance(i,j);
240  }
241  }
242 
243  beamSpotsMap_["DB"] = BeamSpot( apoint,
244  spotDB->GetSigmaZ(),
245  spotDB->Getdxdz(),
246  spotDB->Getdydz(),
247  spotDB->GetBeamWidthX(),
248  matrix );
249 
250  BeamSpot* aSpot = &(beamSpotsMap_["DB"]);
251 
252  aSpot->setBeamWidthY( spotDB->GetBeamWidthY() );
253  aSpot->setEmittanceX( spotDB->GetEmittanceX() );
254  aSpot->setEmittanceY( spotDB->GetEmittanceY() );
255  aSpot->setbetaStar( spotDB->GetBetaStar() );
256 
257  if ( spotDB->GetBeamType() == 2 ) {
258  aSpot->setType( reco::BeamSpot::Tracker );
259  } else{
260  aSpot->setType( reco::BeamSpot::Fake );
261  }
262  //LogInfo("AlcaBeamMonitor")
263  // << *aSpot << std::endl;
264  }
265  else {
266  LogInfo("AlcaBeamMonitor")
267  << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
268  }
269 }
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:31
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:29
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setBeamWidthY(double v)
Definition: BeamSpot.h:109
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 199 of file AlcaBeamMonitor.cc.

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

199  {
200  // create and cd into new folder
201  dbe_->setCurrentFolder(monitorName_+"Validation");
202  //Book histograms
203  hD0Phi0_ = dbe_->bookProfile("hD0Phi0","d_{0} vs. #phi_{0} (All Tracks)",63,-3.15,3.15,100,-0.1,0.1,"");
204  hD0Phi0_->setAxisTitle("#phi_{0} (rad)",1);
205  hD0Phi0_->setAxisTitle("d_{0} (cm)",2);
206 
208  hDxyBS_ = dbe_->book1D("hDxyBS","dxy_{0} w.r.t. Beam spot (All Tracks)",100,-0.1,0.1);
209  hDxyBS_->setAxisTitle("dxy_{0} w.r.t. Beam spot (cm)",1);
210 }
MonitorElement * hD0Phi0_
MonitorElement * hDxyBS_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:873
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:1187
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:585
void AlcaBeamMonitor::endJob ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
protected

Definition at line 564 of file AlcaBeamMonitor.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 318 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_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 560 of file AlcaBeamMonitor.cc.

560  {
561 }

Member Data Documentation

edm::InputTag AlcaBeamMonitor::beamSpotLabel_
private

Definition at line 58 of file AlcaBeamMonitor.h.

BeamSpotContainer AlcaBeamMonitor::beamSpotsMap_
private

Definition at line 72 of file AlcaBeamMonitor.h.

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

DQMStore* AlcaBeamMonitor::dbe_
private

Definition at line 62 of file AlcaBeamMonitor.h.

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

MonitorElement* AlcaBeamMonitor::hD0Phi0_
private

Definition at line 67 of file AlcaBeamMonitor.h.

Referenced by analyze(), and beginRun().

MonitorElement* AlcaBeamMonitor::hDxyBS_
private

Definition at line 68 of file AlcaBeamMonitor.h.

Referenced by analyze(), and beginRun().

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

Definition at line 76 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

HistosContainer AlcaBeamMonitor::histosMap_
private

Definition at line 73 of file AlcaBeamMonitor.h.

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

std::string AlcaBeamMonitor::monitorName_
private

Definition at line 54 of file AlcaBeamMonitor.h.

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

int AlcaBeamMonitor::numberOfValuesToSave_
private

Definition at line 61 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and beginJob().

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

Definition at line 74 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

edm::EDGetTokenT<reco::VertexCollection> AlcaBeamMonitor::primaryVertexLabel_
private

Definition at line 55 of file AlcaBeamMonitor.h.

Referenced by analyze().

edm::EDGetTokenT<reco::BeamSpot> AlcaBeamMonitor::scalerLabel_
private

Definition at line 57 of file AlcaBeamMonitor.h.

Referenced by analyze().

BeamFitter* AlcaBeamMonitor::theBeamFitter_
private

Definition at line 63 of file AlcaBeamMonitor.h.

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

PVFitter* AlcaBeamMonitor::thePVFitter_
private

Definition at line 64 of file AlcaBeamMonitor.h.

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

MonitorElement* AlcaBeamMonitor::theValuesContainer_
private

Definition at line 69 of file AlcaBeamMonitor.h.

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

edm::EDGetTokenT<reco::TrackCollection> AlcaBeamMonitor::trackLabel_
private

Definition at line 56 of file AlcaBeamMonitor.h.

Referenced by analyze().

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

Definition at line 75 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and endLuminosityBlock().

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

Definition at line 77 of file AlcaBeamMonitor.h.

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