CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlcaBeamSpotManager Class Reference

#include <AlcaBeamSpotManager.h>

Public Types

typedef std::map< edm::LuminosityBlockNumber_t, std::pair< edm::Timestamp, reco::BeamSpot > >::iterator bsMap_iterator
 

Public Member Functions

 AlcaBeamSpotManager (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
 AlcaBeamSpotManager (void)
 
void createWeightedPayloads (void)
 
const std::map< edm::LuminosityBlockNumber_t, std::pair< edm::Timestamp, reco::BeamSpot > > & getPayloads (void)
 
void readLumi (const edm::LuminosityBlock &)
 
void reset (void)
 
virtual ~AlcaBeamSpotManager (void)
 

Private Member Functions

std::pair< float, float > delta (const float &x, const float &xError, const float &nextX, const float &nextXError)
 
float deltaSig (const float &num, const float &den)
 
reco::BeamSpot weight (const bsMap_iterator &begin, const bsMap_iterator &end)
 
void weight (double &mean, double &meanError, const double &val, const double &valError)
 

Private Attributes

std::string beamSpotLabel_
 
std::map< edm::LuminosityBlockNumber_t, std::pair< edm::Timestamp, reco::BeamSpot > > beamSpotMap_
 
std::string beamSpotModuleName_
 
std::string beamSpotOutputBase_
 
edm::InputTag beamSpotTag_
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double sigmaZCut_
 

Detailed Description

No description available.

Author
L. Uplegger F. Yumiceva - Fermilab

Definition at line 18 of file AlcaBeamSpotManager.h.

Member Typedef Documentation

◆ bsMap_iterator

Definition at line 31 of file AlcaBeamSpotManager.h.

Constructor & Destructor Documentation

◆ AlcaBeamSpotManager() [1/2]

AlcaBeamSpotManager::AlcaBeamSpotManager ( void  )

Definition at line 20 of file AlcaBeamSpotManager.cc.

20 {}

◆ AlcaBeamSpotManager() [2/2]

AlcaBeamSpotManager::AlcaBeamSpotManager ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 23 of file AlcaBeamSpotManager.cc.

24  : beamSpotOutputBase_(iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters")
25  .getUntrackedParameter<std::string>("BeamSpotOutputBase")),
26  beamSpotModuleName_(iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters")
27  .getUntrackedParameter<std::string>("BeamSpotModuleName")),
28  beamSpotLabel_(iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters")
29  .getUntrackedParameter<std::string>("BeamSpotLabel")),
30  sigmaZCut_(iConfig.getParameter<ParameterSet>("AlcaBeamSpotHarvesterParameters")
31  .getUntrackedParameter<double>("SigmaZCut")) {
34  LogInfo("AlcaBeamSpotManager") << "Output base: " << beamSpotOutputBase_ << std::endl;
35  reset();
36 }

References align::BeamSpot, beamSpotLabel_, beamSpotModuleName_, beamSpotOutputBase_, beamSpotTag_, beamSpotToken_, edm::InLumi, and reset().

◆ ~AlcaBeamSpotManager()

AlcaBeamSpotManager::~AlcaBeamSpotManager ( void  )
virtual

Definition at line 39 of file AlcaBeamSpotManager.cc.

39 {}

Member Function Documentation

◆ createWeightedPayloads()

void AlcaBeamSpotManager::createWeightedPayloads ( void  )

Definition at line 62 of file AlcaBeamSpotManager.cc.

62  {
63  vector<bsMap_iterator> listToErase;
64  for (bsMap_iterator it = beamSpotMap_.begin(); it != beamSpotMap_.end(); it++) {
65  if (it->second.second.type() != BeamSpot::Tracker || it->second.second.sigmaZ() < sigmaZCut_) {
66  listToErase.push_back(it);
67  }
68  }
69  for (vector<bsMap_iterator>::iterator it = listToErase.begin(); it != listToErase.end(); it++) {
70  beamSpotMap_.erase(*it);
71  }
72  if (beamSpotMap_.size() <= 1) {
73  return;
74  }
75  // Return only if lumibased since the collapsing alghorithm requires the next
76  // and next to next lumi sections
77  else if (beamSpotMap_.size() == 2 && beamSpotOutputBase_ == "lumibased") {
78  return;
79  }
80  if (beamSpotOutputBase_ == "lumibased") {
81  // bsMap_iterator referenceBS = beamSpotMap_.begin();
82  bsMap_iterator firstBS = beamSpotMap_.begin();
83  // bsMap_iterator lastBS = beamSpotMap_.begin();
84  bsMap_iterator currentBS = beamSpotMap_.begin();
85  bsMap_iterator nextBS = ++beamSpotMap_.begin();
86  bsMap_iterator nextNextBS = ++(++(beamSpotMap_.begin()));
87 
88  reco::BeamSpot currentBSObj;
89  reco::BeamSpot nextBSObj;
90 
91  map<LuminosityBlockNumber_t, std::pair<edm::Timestamp, BeamSpot>> tmpBeamSpotMap_;
92  bool docreate = true;
93  bool endOfRun = false; // Added
94  bool docheck = true; // Added
95  bool foundShift = false;
96  long countlumi = 0; // Added
97  string tmprun = ""; // Added
98  long maxNlumis = 20; // Added
99  // if weighted:
100  // maxNlumis = 999999999
101 
102  unsigned int iteration = 0;
103  // while(nextNextBS!=beamSpotMap_.end()){
104  while (nextBS != beamSpotMap_.end()) {
105  LogInfo("AlcaBeamSpotManager") << "Iteration: " << iteration << " size: " << beamSpotMap_.size() << "\n"
106  << "Lumi: " << currentBS->first << "\n"
107  << currentBS->second.second << "\n"
108  << nextBS->first << "\n"
109  << nextBS->second.second << endl;
110  if (nextNextBS != beamSpotMap_.end())
111  LogInfo("AlcaBeamSpotManager") << nextNextBS->first << "\n" << nextNextBS->second.second << endl;
112 
113  if (docreate) {
114  firstBS = currentBS;
115  docreate = false; // Added
116  }
117  // if(iteration >= beamSpotMap_.size()-3){
118  if (iteration >= beamSpotMap_.size() - 2) {
119  LogInfo("AlcaBeamSpotManager") << "Reached lumi " << currentBS->first
120  << " now close payload because end of data has been reached.";
121  docreate = true;
122  endOfRun = true;
123  }
124  // check we run over the same run
125  // if (ibeam->first.Run() != inextbeam->first.Run()){
126  // LogInfo("AlcaBeamSpotManager")
127  // << "close payload because end of run.";
128  // docreate = true;
129  // }
130  // check maximum lumi counts
131  if (countlumi == maxNlumis - 1) {
132  LogInfo("AlcaBeamSpotManager") << "close payload because maximum lumi "
133  "sections accumulated within run ";
134  docreate = true;
135  countlumi = 0;
136  }
137  // if weighted:
138  // docheck = False
139  // check offsets
140  if (docheck) {
141  foundShift = false;
142  LogInfo("AlcaBeamSpotManager") << "Checking checking!" << endl;
143  float limit = 0;
144  pair<float, float> adelta1;
145  pair<float, float> adelta2;
146  pair<float, float> adelta;
147  pair<float, float> adelta1dxdz;
148  pair<float, float> adelta2dxdz;
149  pair<float, float> adelta1dydz;
150  pair<float, float> adelta2dydz;
151  pair<float, float> adelta1widthX;
152  pair<float, float> adelta2widthX;
153  pair<float, float> adelta1widthY;
154  pair<float, float> adelta2widthY;
155  pair<float, float> adelta1z0;
156  pair<float, float> adelta1sigmaZ;
157 
158  // define minimum limit
159  float min_limit = 0.0025;
160 
161  // limit for x and y
162  limit = currentBS->second.second.BeamWidthX() / 2.;
163  if (limit < min_limit) {
164  limit = min_limit;
165  }
166 
167  currentBSObj = currentBS->second.second;
168  nextBSObj = nextBS->second.second;
169 
170  // check movements in X
171  adelta1 = delta(currentBSObj.x0(), currentBSObj.x0Error(), nextBSObj.x0(), nextBSObj.x0Error());
172  adelta2 = pair<float, float>(0., 1.e9);
173  if (nextNextBS->second.second.type() != -1) {
174  adelta2 = delta(nextBS->second.second.x0(),
175  nextBSObj.x0Error(),
176  nextNextBS->second.second.x0(),
177  nextNextBS->second.second.x0Error());
178  }
179  bool deltaX = (deltaSig(adelta1.first, adelta1.second) > 3.5 && adelta1.first >= limit) ? true : false;
180  if (iteration < beamSpotMap_.size() - 2) {
181  if (!deltaX && adelta1.first * adelta2.first > 0. && fabs(adelta1.first + adelta2.first) >= limit) {
182  LogInfo("AlcaBeamSpotManager")
183  << " positive, " << (adelta1.first + adelta2.first) << " limit=" << limit << endl;
184  deltaX = true;
185  } else if (deltaX && adelta1.first * adelta2.first < 0 && adelta2.first != 0 &&
186  fabs(adelta1.first / adelta2.first) > 0.33 && fabs(adelta1.first / adelta2.first) < 3) {
187  LogInfo("AlcaBeamSpotManager") << " negative, " << adelta1.first / adelta2.first << endl;
188  deltaX = false;
189  }
190  }
191 
192  // calculating all deltas
193  adelta1dxdz = delta(currentBSObj.dxdz(), currentBSObj.dxdzError(), nextBSObj.dxdz(), nextBSObj.dxdzError());
194  adelta2dxdz = pair<float, float>(0., 1.e9);
195  adelta1dydz = delta(currentBSObj.dydz(), currentBSObj.dydzError(), nextBSObj.dydz(), nextBSObj.dydzError());
196  adelta2dydz = pair<float, float>(0., 1.e9);
197  adelta1widthX = delta(currentBSObj.BeamWidthX(),
198  currentBSObj.BeamWidthXError(),
199  nextBSObj.BeamWidthX(),
200  nextBSObj.BeamWidthXError());
201  adelta2widthX = pair<float, float>(0., 1.e9);
202  adelta1widthY = delta(currentBSObj.BeamWidthY(),
203  currentBSObj.BeamWidthYError(),
204  nextBSObj.BeamWidthY(),
205  nextBSObj.BeamWidthYError());
206  adelta2widthY = pair<float, float>(0., 1.e9);
207  adelta1z0 = delta(currentBSObj.z0(), currentBSObj.z0Error(), nextBSObj.z0(), nextBSObj.z0Error());
208  adelta1sigmaZ =
209  delta(currentBSObj.sigmaZ(), currentBSObj.sigmaZ0Error(), nextBSObj.sigmaZ(), nextBSObj.sigmaZ0Error());
210 
211  // check movements in Y
212  adelta1 = delta(currentBSObj.y0(), currentBSObj.y0Error(), nextBSObj.y0(), nextBSObj.y0Error());
213  adelta2 = pair<float, float>(0., 1.e9);
214  if (nextNextBS->second.second.type() != BeamSpot::Unknown) {
215  adelta2 = delta(
216  nextBSObj.y0(), nextBSObj.y0Error(), nextNextBS->second.second.y0(), nextNextBS->second.second.y0Error());
217  adelta2dxdz = delta(nextBSObj.dxdz(),
218  nextBSObj.dxdzError(),
219  nextNextBS->second.second.dxdz(),
220  nextNextBS->second.second.dxdzError());
221  adelta2dydz = delta(nextBSObj.dydz(),
222  nextBSObj.dydzError(),
223  nextNextBS->second.second.dydz(),
224  nextNextBS->second.second.dydzError());
225  adelta2widthX = delta(nextBSObj.BeamWidthX(),
226  nextBSObj.BeamWidthXError(),
227  nextNextBS->second.second.BeamWidthX(),
228  nextNextBS->second.second.BeamWidthXError());
229  adelta2widthY = delta(nextBSObj.BeamWidthY(),
230  nextBSObj.BeamWidthYError(),
231  nextNextBS->second.second.BeamWidthY(),
232  nextNextBS->second.second.BeamWidthYError());
233  }
234  bool deltaY = (deltaSig(adelta1.first, adelta1.second) > 3.5 && adelta1.first >= limit) ? true : false;
235  if (iteration < beamSpotMap_.size() - 2) {
236  if (!deltaY && adelta1.first * adelta2.first > 0. && fabs(adelta1.first + adelta2.first) >= limit) {
237  LogInfo("AlcaBeamSpotManager")
238  << " positive, " << (adelta1.first + adelta2.first) << " limit=" << limit << endl;
239  deltaY = true;
240  } else if (deltaY && adelta1.first * adelta2.first < 0 && adelta2.first != 0 &&
241  fabs(adelta1.first / adelta2.first) > 0.33 && fabs(adelta1.first / adelta2.first) < 3) {
242  LogInfo("AlcaBeamSpotManager") << " negative, " << adelta1.first / adelta2.first << endl;
243  deltaY = false;
244  }
245  }
246 
247  limit = currentBSObj.sigmaZ() / 2.;
248  bool deltaZ =
249  (deltaSig(adelta1z0.first, adelta1z0.second) > 3.5 && fabs(adelta1z0.first) >= limit) ? true : false;
250  adelta =
251  delta(currentBSObj.sigmaZ(), currentBSObj.sigmaZ0Error(), nextBSObj.sigmaZ(), nextBSObj.sigmaZ0Error());
252  bool deltasigmaZ = (deltaSig(adelta.first, adelta.second) > 5.0) ? true : false;
253  bool deltadxdz = false;
254  bool deltadydz = false;
255  bool deltawidthX = false;
256  bool deltawidthY = false;
257 
258  if (iteration < beamSpotMap_.size() - 2) {
259  adelta = delta(currentBSObj.dxdz(), currentBSObj.dxdzError(), nextBSObj.dxdz(), nextBSObj.dxdzError());
260  deltadxdz = (deltaSig(adelta.first, adelta.second) > 5.0) ? true : false;
261  if (deltadxdz && (adelta1dxdz.first * adelta2dxdz.first) < 0 && adelta2dxdz.first != 0 &&
262  fabs(adelta1dxdz.first / adelta2dxdz.first) > 0.33 && fabs(adelta1dxdz.first / adelta2dxdz.first) < 3) {
263  deltadxdz = false;
264  }
265 
266  adelta = delta(currentBSObj.dydz(), currentBSObj.dydzError(), nextBSObj.dydz(), nextBSObj.dydzError());
267  deltadydz = (deltaSig(adelta.first, adelta.second) > 5.0) ? true : false;
268  if (deltadydz && (adelta1dydz.first * adelta2dydz.first) < 0 && adelta2dydz.first != 0 &&
269  fabs(adelta1dydz.first / adelta2dydz.first) > 0.33 && fabs(adelta1dydz.first / adelta2dydz.first) < 3) {
270  deltadydz = false;
271  }
272 
273  adelta = delta(currentBSObj.BeamWidthX(),
274  currentBSObj.BeamWidthXError(),
275  nextBSObj.BeamWidthX(),
276  nextBSObj.BeamWidthXError());
277  deltawidthX = (deltaSig(adelta.first, adelta.second) > 5.0) ? true : false;
278  if (deltawidthX && (adelta1widthX.first * adelta2widthX.first) < 0 && adelta2widthX.first != 0 &&
279  fabs(adelta1widthX.first / adelta2widthX.first) > 0.33 &&
280  fabs(adelta1widthX.first / adelta2widthX.first) < 3) {
281  deltawidthX = false;
282  }
283 
284  adelta = delta(currentBSObj.BeamWidthY(),
285  currentBSObj.BeamWidthYError(),
286  nextBSObj.BeamWidthY(),
287  nextBSObj.BeamWidthYError());
288  deltawidthY = (deltaSig(adelta.first, adelta.second) > 5.0) ? true : false;
289  if (deltawidthY && (adelta1widthY.first * adelta2widthY.first) < 0 && adelta2widthY.first != 0 &&
290  fabs(adelta1widthY.first / adelta2widthY.first) > 0.33 &&
291  fabs(adelta1widthY.first / adelta2widthY.first) < 3) {
292  deltawidthY = false;
293  }
294  }
295  if (deltaX || deltaY || deltaZ || deltasigmaZ || deltadxdz || deltadydz || deltawidthX || deltawidthY) {
296  docreate = true;
297  foundShift = true;
298  LogInfo("AlcaBeamSpotManager") << "close payload because of movement in"
299  << " X=" << deltaX << ", Y=" << deltaY << ", Z=" << deltaZ
300  << ", sigmaZ=" << deltasigmaZ << ", dxdz=" << deltadxdz
301  << ", dydz=" << deltadydz << ", widthX=" << deltawidthX
302  << ", widthY=" << deltawidthY << endl;
303  }
304  }
305  if (docreate) {
306  std::pair<edm::Timestamp, reco::BeamSpot> thepair;
307  if (foundShift) {
308  thepair = std::make_pair(currentBS->second.first, weight(firstBS, nextBS));
309  tmpBeamSpotMap_[firstBS->first] = thepair;
310  if (endOfRun) {
311  // if we're here, then we need to found a shift in the last LS
312  // We already created a new IOV, now create one just for the last LS
313  thepair = std::make_pair(nextBS->second.first, nextBSObj);
314  tmpBeamSpotMap_[nextBS->first] = thepair;
315  }
316  } else if (!foundShift && !endOfRun) { // maxLS reached
317  thepair = std::make_pair(currentBS->second.first, weight(firstBS, nextBS));
318  tmpBeamSpotMap_[firstBS->first] = thepair;
319  } else { // end of run with no shift detectred in last LS
320  thepair = std::make_pair(currentBS->second.first, weight(firstBS, beamSpotMap_.end()));
321  tmpBeamSpotMap_[firstBS->first] = thepair;
322  }
323  firstBS = nextBS;
324  countlumi = 0;
325  }
326  // tmprun = currentBS->second.Run
327  // increase the counter by one only if the IOV hasn't been closed
328  if (!docreate)
329  ++countlumi;
330 
331  currentBS = nextBS;
332  nextBS = nextNextBS;
333  nextNextBS++;
334  ++iteration;
335  }
336  beamSpotMap_.clear();
337  beamSpotMap_ = tmpBeamSpotMap_;
338  } else if (beamSpotOutputBase_ == "runbased") {
339  LuminosityBlockNumber_t firstLumi = beamSpotMap_.begin()->first;
340  std::pair<edm::Timestamp, reco::BeamSpot> thepair(beamSpotMap_.begin()->second.first,
341  weight(beamSpotMap_.begin(), beamSpotMap_.end()));
342  beamSpotMap_.clear();
343  beamSpotMap_[firstLumi] = thepair;
344  } else {
345  LogInfo("AlcaBeamSpotManager") << "Unrecognized BeamSpotOutputBase parameter: " << beamSpotOutputBase_ << endl;
346  }
347 }

References beamSpotMap_, beamSpotOutputBase_, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthXError(), reco::BeamSpot::BeamWidthY(), reco::BeamSpot::BeamWidthYError(), delta(), deltaSig(), reco::BeamSpot::dxdz(), reco::BeamSpot::dxdzError(), reco::BeamSpot::dydz(), reco::BeamSpot::dydzError(), align_cfg::iteration, remoteMonitoring_LED_IterMethod_cfg::limit, reco::BeamSpot::sigmaZ(), reco::BeamSpot::sigmaZ0Error(), sigmaZCut_, ntuplemaker::tmprun, align::Tracker, funct::true, reco::Unknown, weight(), reco::BeamSpot::x0(), reco::BeamSpot::x0Error(), reco::BeamSpot::y0(), reco::BeamSpot::y0Error(), reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

Referenced by AlcaBeamSpotHarvester::endRun().

◆ delta()

pair< float, float > AlcaBeamSpotManager::delta ( const float &  x,
const float &  xError,
const float &  nextX,
const float &  nextXError 
)
private

Definition at line 405 of file AlcaBeamSpotManager.cc.

408  {
409  return pair<float, float>(x - nextX, sqrt(pow(xError, 2) + pow(nextXError, 2)));
410 }

References funct::pow(), mathSSE::sqrt(), and x.

Referenced by createWeightedPayloads().

◆ deltaSig()

float AlcaBeamSpotManager::deltaSig ( const float &  num,
const float &  den 
)
private

Definition at line 413 of file AlcaBeamSpotManager.cc.

413  {
414  if (den != 0) {
415  return fabs(num / den);
416  } else {
417  return float(LONG_MAX);
418  }
419 }

References dqmMemoryStats::float, and EgammaValidation_cff::num.

Referenced by createWeightedPayloads().

◆ getPayloads()

const std::map<edm::LuminosityBlockNumber_t, std::pair<edm::Timestamp, reco::BeamSpot> >& AlcaBeamSpotManager::getPayloads ( void  )
inline

Definition at line 27 of file AlcaBeamSpotManager.h.

27  {
28  return beamSpotMap_;
29  }

References beamSpotMap_.

Referenced by AlcaBeamSpotHarvester::endRun().

◆ readLumi()

void AlcaBeamSpotManager::readLumi ( const edm::LuminosityBlock iLumi)

Definition at line 44 of file AlcaBeamSpotManager.cc.

44  {
45  Handle<BeamSpot> beamSpotHandle;
46  iLumi.getByToken(beamSpotToken_, beamSpotHandle);
47 
48  if (beamSpotHandle.isValid()) { // check the product
49  std::pair<edm::Timestamp, reco::BeamSpot> time_bs(iLumi.beginTime(), *beamSpotHandle);
50  beamSpotMap_[iLumi.luminosityBlock()] = time_bs;
51  const BeamSpot *aBeamSpot = &beamSpotMap_[iLumi.luminosityBlock()].second;
52  aBeamSpot = beamSpotHandle.product();
53  LogInfo("AlcaBeamSpotManager") << "Lumi: " << iLumi.luminosityBlock() << std::endl;
54  LogInfo("AlcaBeamSpotManager") << *aBeamSpot << std::endl;
55  } else {
56  LogInfo("AlcaBeamSpotManager") << "Lumi: " << iLumi.luminosityBlock() << std::endl;
57  LogInfo("AlcaBeamSpotManager") << " BS is not valid!" << std::endl;
58  }
59 }

References beamSpotMap_, beamSpotToken_, edm::LuminosityBlockBase::beginTime(), edm::LuminosityBlock::getByToken(), edm::HandleBase::isValid(), edm::LuminosityBlockBase::luminosityBlock(), and edm::Handle< T >::product().

Referenced by AlcaBeamSpotHarvester::endLuminosityBlock().

◆ reset()

void AlcaBeamSpotManager::reset ( void  )

◆ weight() [1/2]

BeamSpot AlcaBeamSpotManager::weight ( const bsMap_iterator begin,
const bsMap_iterator end 
)
private

Definition at line 350 of file AlcaBeamSpotManager.cc.

350  {
351  double x, xError = 0;
352  double y, yError = 0;
353  double z, zError = 0;
354  double sigmaZ, sigmaZError = 0;
355  double dxdz, dxdzError = 0;
356  double dydz, dydzError = 0;
357  double widthX, widthXError = 0;
358  double widthY, widthYError = 0;
359  LogInfo("AlcaBeamSpotManager") << "Weighted BeamSpot will span lumi " << begin->first << " to " << end->first << endl;
360 
362  for (bsMap_iterator it = begin; it != end; it++) {
363  weight(x, xError, it->second.second.x0(), it->second.second.x0Error());
364  weight(y, yError, it->second.second.y0(), it->second.second.y0Error());
365  weight(z, zError, it->second.second.z0(), it->second.second.z0Error());
366  weight(sigmaZ, sigmaZError, it->second.second.sigmaZ(), it->second.second.sigmaZ0Error());
367  weight(dxdz, dxdzError, it->second.second.dxdz(), it->second.second.dxdzError());
368  weight(dydz, dydzError, it->second.second.dydz(), it->second.second.dydzError());
369  weight(widthX, widthXError, it->second.second.BeamWidthX(), it->second.second.BeamWidthXError());
370  weight(widthY, widthYError, it->second.second.BeamWidthY(), it->second.second.BeamWidthYError());
371  if (it->second.second.type() == BeamSpot::Tracker) {
373  }
374  }
375  BeamSpot::Point bsPosition(x, y, z);
377  error(0, 0) = xError * xError;
378  error(1, 1) = yError * yError;
379  error(2, 2) = zError * zError;
380  error(3, 3) = sigmaZError * sigmaZError;
381  error(4, 4) = dxdzError * dxdzError;
382  error(5, 5) = dydzError * dydzError;
383  error(6, 6) = widthXError * widthXError;
384  BeamSpot weightedBeamSpot(bsPosition, sigmaZ, dxdz, dydz, widthX, error, type);
385  weightedBeamSpot.setBeamWidthY(widthY);
386  LogInfo("AlcaBeamSpotManager") << "Weighted BeamSpot will be:" << '\n' << weightedBeamSpot << endl;
387  return weightedBeamSpot;
388 }

References BeamSpotPI::dxdz, BeamSpotPI::dydz, mps_fire::end, relativeConstraints::error, reco::BeamSpot::setBeamWidthY(), BeamSpotPI::sigmaZ, align::Tracker, reco::Unknown, ApeEstimator_cff::widthX, ApeEstimator_cff::widthY, x, y, and z.

Referenced by createWeightedPayloads().

◆ weight() [2/2]

void AlcaBeamSpotManager::weight ( double &  mean,
double &  meanError,
const double &  val,
const double &  valError 
)
private

Definition at line 391 of file AlcaBeamSpotManager.cc.

391  {
392  double tmpError = 0;
393  if (meanError < 1e-8) {
394  tmpError = 1 / (valError * valError);
395  mean = val * tmpError;
396  } else {
397  tmpError = 1 / (meanError * meanError) + 1 / (valError * valError);
398  mean = mean / (meanError * meanError) + val / (valError * valError);
399  }
400  mean = mean / tmpError;
401  meanError = sqrt(1 / tmpError);
402 }

References MillePedeFileConverter_cfg::e, SiStripPI::mean, mathSSE::sqrt(), and heppy_batch::val.

Member Data Documentation

◆ beamSpotLabel_

std::string AlcaBeamSpotManager::beamSpotLabel_
private

Definition at line 42 of file AlcaBeamSpotManager.h.

Referenced by AlcaBeamSpotManager().

◆ beamSpotMap_

std::map<edm::LuminosityBlockNumber_t, std::pair<edm::Timestamp, reco::BeamSpot> > AlcaBeamSpotManager::beamSpotMap_
private

Definition at line 38 of file AlcaBeamSpotManager.h.

Referenced by createWeightedPayloads(), getPayloads(), readLumi(), and reset().

◆ beamSpotModuleName_

std::string AlcaBeamSpotManager::beamSpotModuleName_
private

Definition at line 41 of file AlcaBeamSpotManager.h.

Referenced by AlcaBeamSpotManager().

◆ beamSpotOutputBase_

std::string AlcaBeamSpotManager::beamSpotOutputBase_
private

Definition at line 40 of file AlcaBeamSpotManager.h.

Referenced by AlcaBeamSpotManager(), and createWeightedPayloads().

◆ beamSpotTag_

edm::InputTag AlcaBeamSpotManager::beamSpotTag_
private

Definition at line 44 of file AlcaBeamSpotManager.h.

Referenced by AlcaBeamSpotManager().

◆ beamSpotToken_

edm::EDGetTokenT<reco::BeamSpot> AlcaBeamSpotManager::beamSpotToken_
private

Definition at line 45 of file AlcaBeamSpotManager.h.

Referenced by AlcaBeamSpotManager(), and readLumi().

◆ sigmaZCut_

double AlcaBeamSpotManager::sigmaZCut_
private

Definition at line 43 of file AlcaBeamSpotManager.h.

Referenced by createWeightedPayloads().

DDAxes::y
AlcaBeamSpotManager::deltaSig
float deltaSig(const float &num, const float &den)
Definition: AlcaBeamSpotManager.cc:413
ApeEstimator_cff.widthX
widthX
Definition: ApeEstimator_cff.py:30
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
reco::BeamSpot::BeamWidthXError
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:99
edm::Handle::product
T const * product() const
Definition: Handle.h:70
BeamSpotPI::sigmaZ
Definition: BeamSpotPayloadInspectorHelper.h:35
align::BeamSpot
Definition: StructureType.h:89
ApeEstimator_cff.widthY
widthY
Definition: ApeEstimator_cff.py:31
reco::BeamSpot::z0
double z0() const
z coordinate
Definition: BeamSpot.h:65
AlcaBeamSpotManager::reset
void reset(void)
Definition: AlcaBeamSpotManager.cc:42
edm::LuminosityBlockBase::beginTime
Timestamp const & beginTime() const
Definition: LuminosityBlockBase.h:46
reco::Unknown
Definition: MuonSimInfo.h:32
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
reco::BeamSpot::dxdz
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
reco::BeamSpot::dxdzError
double dxdzError() const
error on dxdz
Definition: BeamSpot.h:94
edm::Handle
Definition: AssociativeIterator.h:50
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
relativeConstraints.error
error
Definition: relativeConstraints.py:53
AlcaBeamSpotManager::beamSpotOutputBase_
std::string beamSpotOutputBase_
Definition: AlcaBeamSpotManager.h:40
align::Tracker
Definition: StructureType.h:70
reco::BeamSpot::y0Error
double y0Error() const
error on y
Definition: BeamSpot.h:88
reco::BeamSpot::sigmaZ
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
edm::LuminosityBlock::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: LuminosityBlock.h:319
AlcaBeamSpotManager::weight
reco::BeamSpot weight(const bsMap_iterator &begin, const bsMap_iterator &end)
Definition: AlcaBeamSpotManager.cc:350
ntuplemaker.tmprun
tmprun
Definition: ntuplemaker.py:244
reco::BeamSpot::dydzError
double dydzError() const
error on dydz
Definition: BeamSpot.h:96
edm::LuminosityBlockBase::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockBase.h:40
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
AlcaBeamSpotManager::beamSpotTag_
edm::InputTag beamSpotTag_
Definition: AlcaBeamSpotManager.h:44
mps_fire.end
end
Definition: mps_fire.py:242
reco::BeamSpot
Definition: BeamSpot.h:21
DDAxes::z
AlcaBeamSpotManager::beamSpotToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
Definition: AlcaBeamSpotManager.h:45
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
BeamSpotPI::dxdz
Definition: BeamSpotPayloadInspectorHelper.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
funct::true
true
Definition: Factorize.h:173
edm::ParameterSet
Definition: ParameterSet.h:47
edm::InLumi
Definition: BranchType.h:11
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
BeamSpotPI::dydz
Definition: BeamSpotPayloadInspectorHelper.h:37
AlcaBeamSpotManager::sigmaZCut_
double sigmaZCut_
Definition: AlcaBeamSpotManager.h:43
reco::BeamSpot::z0Error
double z0Error() const
error on z
Definition: BeamSpot.h:90
reco::BeamSpot::BeamWidthYError
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:101
reco::BeamSpot::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
reco::BeamSpot::BeamWidthX
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:82
reco::BeamSpot::BeamType
BeamType
beam spot flags
Definition: BeamSpot.h:24
AlcaBeamSpotManager::bsMap_iterator
std::map< edm::LuminosityBlockNumber_t, std::pair< edm::Timestamp, reco::BeamSpot > >::iterator bsMap_iterator
Definition: AlcaBeamSpotManager.h:31
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
AlcaBeamSpotManager::beamSpotModuleName_
std::string beamSpotModuleName_
Definition: AlcaBeamSpotManager.h:41
AlcaBeamSpotManager::delta
std::pair< float, float > delta(const float &x, const float &xError, const float &nextX, const float &nextXError)
Definition: AlcaBeamSpotManager.cc:405
reco::BeamSpot::dydz
double dydz() const
dydz slope
Definition: BeamSpot.h:80
reco::BeamSpot::x0
double x0() const
x coordinate
Definition: BeamSpot.h:61
AlcaBeamSpotManager::beamSpotLabel_
std::string beamSpotLabel_
Definition: AlcaBeamSpotManager.h:42
heppy_batch.val
val
Definition: heppy_batch.py:351
remoteMonitoring_LED_IterMethod_cfg.limit
limit
Definition: remoteMonitoring_LED_IterMethod_cfg.py:427
reco::BeamSpot::x0Error
double x0Error() const
error on x
Definition: BeamSpot.h:86
reco::BeamSpot::sigmaZ0Error
double sigmaZ0Error() const
error on sigma z
Definition: BeamSpot.h:92
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
reco::BeamSpot::Point
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
reco::BeamSpot::y0
double y0() const
y coordinate
Definition: BeamSpot.h:63
align_cfg.iteration
iteration
Definition: align_cfg.py:5
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1
AlcaBeamSpotManager::beamSpotMap_
std::map< edm::LuminosityBlockNumber_t, std::pair< edm::Timestamp, reco::BeamSpot > > beamSpotMap_
Definition: AlcaBeamSpotManager.h:38
reco::BeamSpot::BeamWidthY
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:84
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37