CMS 3D CMS Logo

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

#include <BeamSpotOnlineProducer.h>

Inheritance diagram for BeamSpotOnlineProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Types

typedef std::vector
< edm::ParameterSet
Parameters
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 BeamSpotOnlineProducer (const edm::ParameterSet &iConf)
 constructor More...
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 produce a beam spot class More...
 
 ~BeamSpotOnlineProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

bool changeFrame_
 
edm::InputTag scalertag_
 
edm::InputTag thel1GtEvmReadoutRecordTag
 
double theMaxR2
 
double theMaxZ
 
double theSetSigmaZ
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description


class: BeamSpotOnlineProducer.h package: RecoVertex/BeamSpotProducer

author: Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)

version

Id:
BeamSpotOnlineProducer.h,v 1.6 2010/07/21 04:23:26 wmtan Exp

Definition at line 22 of file BeamSpotOnlineProducer.h.

Member Typedef Documentation

Definition at line 25 of file BeamSpotOnlineProducer.h.

Constructor & Destructor Documentation

BeamSpotOnlineProducer::BeamSpotOnlineProducer ( const edm::ParameterSet iConf)
explicit

constructor

Definition at line 19 of file BeamSpotOnlineProducer.cc.

References edm::ParameterSet::getParameter().

20 {
21 
22  scalertag_ = iconf.getParameter<InputTag>("label");
23  changeFrame_ = iconf.getParameter<bool>("changeToCMSCoordinates");
24 
25  theMaxR2 = iconf.getParameter<double>("maxRadius");
26  theMaxR2*=theMaxR2;
27  theMaxZ = iconf.getParameter<double>("maxZ");
28 
29  theSetSigmaZ = iconf.getParameter<double>("setSigmaZ");
30 
31  thel1GtEvmReadoutRecordTag = iconf.getParameter<InputTag>("gtEvmLabel");
32 
33  produces<reco::BeamSpot>();
34 
35 }
edm::InputTag thel1GtEvmReadoutRecordTag
BeamSpotOnlineProducer::~BeamSpotOnlineProducer ( )

destructor

Definition at line 37 of file BeamSpotOnlineProducer.cc.

37 {}

Member Function Documentation

void BeamSpotOnlineProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

produce a beam spot class

Implements edm::EDProducer.

Definition at line 40 of file BeamSpotOnlineProducer.cc.

References align::BeamSpot, BeamSpotOnline::dxdz(), BeamSpotOnline::dydz(), BeamSpotOnline::err_sigma_z(), BeamSpotOnline::err_x(), BeamSpotOnline::err_y(), BeamSpotOnline::err_z(), f, edm::EventSetup::get(), BeamSpotObjects::GetBeamWidthX(), BeamSpotObjects::GetBeamWidthY(), BeamSpotObjects::GetBetaStar(), edm::Event::getByLabel(), BeamSpotObjects::GetCovariance(), BeamSpotObjects::Getdxdz(), BeamSpotObjects::Getdydz(), BeamSpotObjects::GetEmittanceX(), BeamSpotObjects::GetEmittanceY(), BeamSpotObjects::GetSigmaZ(), BeamSpotObjects::GetX(), BeamSpotObjects::GetY(), BeamSpotObjects::GetZ(), i, j, reco::BeamSpot::LHC, edm::ESHandle< class >::product(), edm::Event::put(), query::result, reco::BeamSpot::setBeamWidthY(), reco::BeamSpot::setbetaStar(), reco::BeamSpot::setEmittanceX(), reco::BeamSpot::setEmittanceY(), reco::BeamSpot::setType(), BeamSpotOnline::sigma_z(), reco::BeamSpot::Tracker, BeamSpotOnline::width_x(), BeamSpotOnline::width_y(), BeamSpotOnline::x(), BeamSpotOnline::y(), and BeamSpotOnline::z().

41 {
42  //shout MODE only in stable beam
43  bool shoutMODE=false;
45  if (iEvent.getByLabel(thel1GtEvmReadoutRecordTag, gtEvmReadoutRecord)){
46  const boost::uint16_t beamModeValue = (gtEvmReadoutRecord->gtfeWord()).beamMode();
47  if (beamModeValue == 11) shoutMODE=true;
48  }
49  else{
50  shoutMODE=true;
51  }
52 
53  // get scalar collection
55  iEvent.getByLabel( scalertag_, handleScaler);
56 
57  // beam spot scalar object
58  BeamSpotOnline spotOnline;
59 
60  // product is a reco::BeamSpot object
61  std::auto_ptr<reco::BeamSpot> result(new reco::BeamSpot);
62 
63  reco::BeamSpot aSpot;
64 
65  bool fallBackToDB=false;
66  if (handleScaler->size()!=0){
67  // get one element
68  spotOnline = * ( handleScaler->begin() );
69 
70  // in case we need to switch to LHC reference frame
71  // ignore for the moment rotations, and translations
72  double f = 1.;
73  if (changeFrame_) f = -1.;
74 
75  reco::BeamSpot::Point apoint( f* spotOnline.x(), spotOnline.y(), f* spotOnline.z() );
76 
78  matrix(0,0) = spotOnline.err_x()*spotOnline.err_x();
79  matrix(1,1) = spotOnline.err_y()*spotOnline.err_y();
80  matrix(2,2) = spotOnline.err_z()*spotOnline.err_z();
81  matrix(3,3) = spotOnline.err_sigma_z()*spotOnline.err_sigma_z();
82 
83  double sigmaZ = spotOnline.sigma_z();
84  if (theSetSigmaZ>0)
85  sigmaZ = theSetSigmaZ;
86 
87  aSpot = reco::BeamSpot( apoint,
88  sigmaZ,
89  spotOnline.dxdz(),
90  f* spotOnline.dydz(),
91  spotOnline.width_x(),
92  matrix);
93 
94  aSpot.setBeamWidthY( spotOnline.width_y() );
95  aSpot.setEmittanceX( 0. );
96  aSpot.setEmittanceY( 0. );
97  aSpot.setbetaStar( 0.) ;
98  aSpot.setType( reco::BeamSpot::LHC ); // flag value from scalars
99 
100  // check if we have a valid beam spot fit result from online DQM
101  if ( spotOnline.x() == 0 &&
102  spotOnline.y() == 0 &&
103  spotOnline.z() == 0 &&
104  spotOnline.width_x() == 0 &&
105  spotOnline.width_y() == 0 )
106  {
107  if (shoutMODE){
108  edm::LogWarning("BeamSpotFromDB")
109  << "Online Beam Spot producer falls back to DB value because the scaler values are zero ";
110  }
111  fallBackToDB=true;
112  }
113  double r2=spotOnline.x()*spotOnline.x() + spotOnline.y()*spotOnline.y();
114  if (fabs(spotOnline.z())>=theMaxZ || r2>=theMaxR2){
115  if (shoutMODE){
116  edm::LogError("BeamSpotFromDB")
117  << "Online Beam Spot producer falls back to DB value because the scaler values are too big to be true :"
118  <<spotOnline.x()<<" "<<spotOnline.y()<<" "<<spotOnline.z();
119  }
120  fallBackToDB=true;
121  }
122  }
123  else{
124  //empty online beamspot collection: FED data was empty
125  //the error should probably have been send at unpacker level
126  fallBackToDB=true;
127  }
128 
129  if (fallBackToDB){
130 
132  iSetup.get<BeamSpotObjectsRcd>().get(beamhandle);
133  const BeamSpotObjects *spotDB = beamhandle.product();
134 
135  // translate from BeamSpotObjects to reco::BeamSpot
136  reco::BeamSpot::Point apoint( spotDB->GetX(), spotDB->GetY(), spotDB->GetZ() );
137 
139  for ( int i=0; i<7; ++i ) {
140  for ( int j=0; j<7; ++j ) {
141  matrix(i,j) = spotDB->GetCovariance(i,j);
142  }
143  }
144 
145  // this assume beam width same in x and y
146  aSpot = reco::BeamSpot( apoint,
147  spotDB->GetSigmaZ(),
148  spotDB->Getdxdz(),
149  spotDB->Getdydz(),
150  spotDB->GetBeamWidthX(),
151  matrix );
152  aSpot.setBeamWidthY( spotDB->GetBeamWidthY() );
153  aSpot.setEmittanceX( spotDB->GetEmittanceX() );
154  aSpot.setEmittanceY( spotDB->GetEmittanceY() );
155  aSpot.setbetaStar( spotDB->GetBetaStar() );
157 
158  }
159 
160  *result = aSpot;
161 
162  iEvent.put(result);
163 
164 }
double Getdydz() const
get dydz slope, crossing angle in YZ
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:32
int i
Definition: DBlmapReader.cc:9
float err_y() const
float dxdz() const
double GetY() const
get Y beam position
void setbetaStar(double v)
Definition: BeamSpot.h:136
float err_x() const
float dydz() const
float sigma_z() const
float y() const
float x() const
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
float z() const
edm::InputTag thel1GtEvmReadoutRecordTag
float width_y() const
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:122
void setBeamWidthY(double v)
Definition: BeamSpot.h:100
void setEmittanceY(double v)
Definition: BeamSpot.h:135
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
double GetZ() const
get Z beam position
double f[11][100]
double Getdxdz() const
get dxdz slope, crossing angle in XZ
float err_z() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
double GetX() const
get X beam position
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
double GetBetaStar() const
get beta star
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
float width_x() const
double GetEmittanceY() const
get emittance
float err_sigma_z() const
void setEmittanceX(double v)
Definition: BeamSpot.h:134

Member Data Documentation

bool BeamSpotOnlineProducer::changeFrame_
private

Definition at line 38 of file BeamSpotOnlineProducer.h.

edm::InputTag BeamSpotOnlineProducer::scalertag_
private

Definition at line 37 of file BeamSpotOnlineProducer.h.

edm::InputTag BeamSpotOnlineProducer::thel1GtEvmReadoutRecordTag
private

Definition at line 40 of file BeamSpotOnlineProducer.h.

double BeamSpotOnlineProducer::theMaxR2
private

Definition at line 39 of file BeamSpotOnlineProducer.h.

double BeamSpotOnlineProducer::theMaxZ
private

Definition at line 39 of file BeamSpotOnlineProducer.h.

double BeamSpotOnlineProducer::theSetSigmaZ
private

Definition at line 39 of file BeamSpotOnlineProducer.h.