CMS 3D CMS Logo

TkLasBeamFitter.cc
Go to the documentation of this file.
1 
15 // framework include files
27 
33 
34 // data formats
35 // for edm::InRun
37 
38 // laser data formats
41 
42 // further includes
47 
48 #include <iostream>
49 #include "TMinuit.h"
50 #include "TGraphErrors.h"
51 #include "TF1.h"
52 #include "TH1.h"
53 #include "TH2.h"
54 
55 using namespace edm;
56 using namespace std;
57 
58 //
59 // class declaration
60 //
61 
62 class TkLasBeamFitter : public edm::one::EDProducer<edm::EndRunProducer> {
63 public:
64  explicit TkLasBeamFitter(const edm::ParameterSet &config);
65  ~TkLasBeamFitter() override;
66 
67  //virtual void beginJob(const edm::EventSetup& /*access deprecated*/) {}
68  void produce(edm::Event &event, const edm::EventSetup &setup) override;
69  // virtual void beginRun(edm::Run &run, const edm::EventSetup &setup);
70  void endRunProduce(edm::Run &run, const edm::EventSetup &setup) override;
71  //virtual void endJob() {}
72 
73 private:
76  void getLasBeams(TkFittedLasBeam &beam, vector<TrajectoryStateOnSurface> &tsosLas);
77  void getLasHits(TkFittedLasBeam &beam,
79  vector<const GeomDetUnit *> &gd,
80  vector<GlobalPoint> &globHit,
81  unsigned int &hitsAtTecPlus);
82  // void fillVectors(TkFittedLasBeam &beam);
83 
84  // need static functions to be used in fitter(..);
85  // all parameters used therein have to be static, as well (see below)
86  static double tecPlusFunction(double *x, double *par);
87  static double tecMinusFunction(double *x, double *par);
88  static double atFunction(double *x, double *par);
89 
90  void fitter(TkFittedLasBeam &beam,
91  AlgebraicSymMatrix &covMatrix,
92  unsigned int &hitsAtTecPlus,
93  unsigned int &nFitParams,
94  std::vector<double> &hitPhi,
95  std::vector<double> &hitPhiError,
96  std::vector<double> &hitZprimeError,
97  double &zMin,
98  double &zMax,
99  double &bsAngleParam,
100  double &offset,
101  double &offsetError,
102  double &slope,
103  double &slopeError,
104  double &phiAtMinusParam,
105  double &phiAtPlusParam,
106  double &atThetaSplitParam);
107 
109  unsigned int &hit,
110  double &trackPhi,
111  double &trackPhiRef,
112  double &offset,
113  double &slope,
114  double &bsAngleParam,
115  double &phiAtMinusParam,
116  double &phiAtPlusParam,
117  double &atThetaSplitParam,
118  std::vector<GlobalPoint> &globHit);
119 
120  void globalTrackPoint(TkFittedLasBeam &beam,
121  unsigned int &hit,
122  unsigned int &hitsAtTecPlus,
123  double &trackPhi,
124  double &trackPhiRef,
125  std::vector<GlobalPoint> &globHit,
126  std::vector<GlobalPoint> &globPtrack,
127  GlobalPoint &globPref,
128  std::vector<double> &hitPhiError);
129 
130  void buildTrajectory(TkFittedLasBeam &beam,
131  unsigned int &hit,
132  vector<const GeomDetUnit *> &gd,
133  std::vector<GlobalPoint> &globPtrack,
134  vector<TrajectoryStateOnSurface> &tsosLas,
135  GlobalPoint &globPref);
136 
137  bool fitBeam(TkFittedLasBeam &beam,
138  AlgebraicSymMatrix &covMatrix,
139  unsigned int &hitsAtTecPlus,
140  unsigned int &nFitParams,
141  double &offset,
142  double &slope,
143  vector<GlobalPoint> &globPtrack,
144  double &bsAngleParam,
145  double &chi2);
146 
147  // ----------member data ---------------------------
150  unsigned int nAtParameters_;
151 
153 
154  // static parameters used in static parametrization functions
155  static vector<double> gHitZprime;
156  static vector<double> gBarrelModuleRadius;
157  static vector<double> gBarrelModuleOffset;
158  static float gTIBparam;
159  static float gTOBparam;
160  static double gBeamR;
161  static double gBeamZ0;
162  static double gBeamSplitterZprime;
163  static unsigned int gHitsAtTecMinus;
164  static double gBSparam;
165  static bool gFitBeamSplitters;
166  static bool gIsInnerBarrel;
167 
168  // histograms
169  TH1F *h_bsAngle, *h_hitX, *h_hitXTecPlus, *h_hitXTecMinus, *h_hitXAt, *h_chi2, *h_chi2ndof, *h_pull, *h_res,
170  *h_resTecPlus, *h_resTecMinus, *h_resAt;
171  TH2F *h_bsAngleVsBeam, *h_hitXvsZTecPlus, *h_hitXvsZTecMinus, *h_hitXvsZAt, *h_resVsZTecPlus, *h_resVsZTecMinus,
172  *h_resVsZAt, *h_resVsHitTecPlus, *h_resVsHitTecMinus, *h_resVsHitAt;
173 };
174 
175 //
176 // constants, enums and typedefs
177 //
178 
179 //
180 // static data member definitions
181 //
182 
183 // static parameters used in parametrization functions
184 vector<double> TkLasBeamFitter::gHitZprime;
187 float TkLasBeamFitter::gTIBparam = 0.097614; // = abs(r_offset/r_module) (nominal!)
188 float TkLasBeamFitter::gTOBparam = 0.034949; // = abs(r_offset/r_module) (nominal!)
189 double TkLasBeamFitter::gBeamR = 0.0;
190 double TkLasBeamFitter::gBeamZ0 = 0.0;
192 unsigned int TkLasBeamFitter::gHitsAtTecMinus = 0;
193 double TkLasBeamFitter::gBSparam = 0.0;
196 
197 // handles
201 
202 //
203 // constructors and destructor
204 //
206  : src_(iConfig.getParameter<edm::InputTag>("src")),
207  fitBeamSplitters_(iConfig.getParameter<bool>("fitBeamSplitters")),
208  nAtParameters_(iConfig.getParameter<unsigned int>("numberOfFittedAtParameters")),
209  h_bsAngle(nullptr),
210  h_hitX(nullptr),
211  h_hitXTecPlus(nullptr),
212  h_hitXTecMinus(nullptr),
213  h_hitXAt(nullptr),
214  h_chi2(nullptr),
215  h_chi2ndof(nullptr),
216  h_pull(nullptr),
217  h_res(nullptr),
218  h_resTecPlus(nullptr),
219  h_resTecMinus(nullptr),
220  h_resAt(nullptr),
221  h_bsAngleVsBeam(nullptr),
222  h_hitXvsZTecPlus(nullptr),
223  h_hitXvsZTecMinus(nullptr),
224  h_hitXvsZAt(nullptr),
225  h_resVsZTecPlus(nullptr),
226  h_resVsZTecMinus(nullptr),
227  h_resVsZAt(nullptr),
228  h_resVsHitTecPlus(nullptr),
229  h_resVsHitTecMinus(nullptr),
230  h_resVsHitAt(nullptr) {
231  // declare the products to produce
232  this->produces<TkFittedLasBeamCollection, edm::Transition::EndRun>();
233  this->produces<TsosVectorCollection, edm::Transition::EndRun>();
234 
235  //now do what ever other initialization is needed
236 }
237 
238 //---------------------------------------------------------------------------------------
240  // do anything here that needs to be done at desctruction time
241  // (e.g. close files, deallocate resources etc.)
242 }
243 
244 //
245 // member functions
246 //
247 
248 //---------------------------------------------------------------------------------------
249 // ------------ method called to produce the data ------------
251  // Nothing per event!
252 }
253 
254 //---------------------------------------------------------------------------------------
255 // ------------ method called at end of each run ---------------------------------------
257  // }
258  // // FIXME!
259  // // Indeed, that should be in endRun(..) - as soon as AlignmentProducer can call
260  // // the algorithm's endRun correctly!
261  //
262  //
263  // void TkLasBeamFitter::beginRun(edm::Run &run, const edm::EventSetup &setup)
264  // {
265 
266  // book histograms
267  h_hitX = fs->make<TH1F>("hitX", "local x of LAS hits;local x [cm];N", 100, -0.5, 0.5);
268  h_hitXTecPlus = fs->make<TH1F>("hitXTecPlus", "local x of LAS hits in TECplus;local x [cm];N", 100, -0.5, 0.5);
269  h_hitXTecMinus = fs->make<TH1F>("hitXTecMinus", "local x of LAS hits in TECminus;local x [cm];N", 100, -0.5, 0.5);
270  h_hitXAt = fs->make<TH1F>("hitXAt", "local x of LAS hits in ATs;local x [cm];N", 100, -2.5, 2.5);
272  fs->make<TH2F>("hitXvsZTecPlus", "local x vs z in TECplus;z [cm];local x [cm]", 80, 120, 280, 100, -0.5, 0.5);
274  fs->make<TH2F>("hitXvsZTecMinus", "local x vs z in TECMinus;z [cm];local x [cm]", 80, -280, -120, 100, -0.5, 0.5);
275  h_hitXvsZAt = fs->make<TH2F>("hitXvsZAt", "local x vs z in ATs;z [cm];local x [cm]", 200, -200, 200, 100, -0.5, 0.5);
276  h_chi2 = fs->make<TH1F>("chi2", "#chi^{2};#chi^{2};N", 100, 0, 2000);
277  h_chi2ndof = fs->make<TH1F>("chi2ndof", "#chi^{2} per degree of freedom;#chi^{2}/N_{dof};N", 100, 0, 300);
278  h_pull = fs->make<TH1F>("pull", "pulls of #phi residuals;pull;N", 50, -10, 10);
279  h_res = fs->make<TH1F>("res", "#phi residuals;#phi_{track} - #phi_{hit} [rad];N", 60, -0.0015, 0.0015);
280  h_resTecPlus =
281  fs->make<TH1F>("resTecPlus", "#phi residuals in TECplus;#phi_{track} - #phi_{hit} [rad];N", 30, -0.0015, 0.0015);
282  h_resTecMinus = fs->make<TH1F>(
283  "resTecMinus", "#phi residuals in TECminus;#phi_{track} - #phi_{hit} [rad];N", 60, -0.0015, 0.0015);
284  h_resAt = fs->make<TH1F>("resAt", "#phi residuals in ATs;#phi_{track} - #phi_{hit} [rad];N", 30, -0.0015, 0.0015);
285  h_resVsZTecPlus = fs->make<TH2F>("resVsZTecPlus",
286  "phi residuals vs. z in TECplus;z [cm];#phi_{track} - #phi_{hit} [rad]",
287  80,
288  120,
289  280,
290  100,
291  -0.0015,
292  0.0015);
293  h_resVsZTecMinus = fs->make<TH2F>("resVsZTecMinus",
294  "phi residuals vs. z in TECminus;z [cm];#phi_{track} - #phi_{hit} [rad]",
295  80,
296  -280,
297  -120,
298  100,
299  -0.0015,
300  0.0015);
301  h_resVsZAt = fs->make<TH2F>(
302  "resVsZAt", "#phi residuals vs. z in ATs;N;#phi_{track} - #phi_{hit} [rad]", 200, -200, 200, 100, -0.0015, 0.0015);
303  h_resVsHitTecPlus = fs->make<TH2F>("resVsHitTecPlus",
304  "#phi residuals vs. hits in TECplus;hit no.;#phi_{track} - #phi_{hit} [rad]",
305  144,
306  0,
307  144,
308  100,
309  -0.0015,
310  0.0015);
311  h_resVsHitTecMinus = fs->make<TH2F>("resVsHitTecMinus",
312  "#phi residuals vs. hits in TECminus;hit no.;#phi_{track} - #phi_{hit} [rad]",
313  144,
314  0,
315  144,
316  100,
317  -0.0015,
318  0.0015);
319  h_resVsHitAt = fs->make<TH2F>("resVsHitAt",
320  "#phi residuals vs. hits in ATs;hit no.;#phi_{track} - #phi_{hit} [rad]",
321  176,
322  0,
323  176,
324  100,
325  -0.0015,
326  0.0015);
327  h_bsAngle = fs->make<TH1F>("bsAngle", "fitted beam splitter angle;BS angle [rad];N", 40, -0.004, 0.004);
328  h_bsAngleVsBeam = fs->make<TH2F>(
329  "bsAngleVsBeam", "fitted beam splitter angle per beam;Beam no.;BS angle [rad]", 40, 0, 300, 100, -0.004, 0.004);
330 
331  // Create output collections - they are parallel.
332  // (edm::Ref etc. and thus edm::AssociationVector are not supported for edm::Run...)
333  auto fittedBeams = std::make_unique<TkFittedLasBeamCollection>();
334  // One std::vector<TSOS> for each TkFittedLasBeam:
335  auto tsosesVec = std::make_unique<TsosVectorCollection>();
336 
337  // get TkLasBeams, Tracker geometry, magnetic field
338  run.getByLabel("LaserAlignment", "tkLaserBeams", laserBeams);
341 
342  // hack for fixed BSparams (ugly!)
343  // double bsParams[34] = {-0.000266,-0.000956,-0.001205,-0.000018,-0.000759,0.002554,
344  // 0.000465,0.000975,0.001006,0.002027,-0.001263,-0.000763,
345  // -0.001702,0.000906,-0.002120,0.001594,0.000661,-0.000457,
346  // -0.000447,0.000347,-0.002266,-0.000446,0.000659,0.000018,
347  // -0.001630,-0.000324,
348  // // ATs
349  // -999.,-0.001709,-0.002091,-999.,
350  // -0.001640,-999.,-0.002444,-0.002345};
351 
352  double bsParams[40] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
353  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
354 
355  // beam counter
356  unsigned int beamNo(0);
357  // fit BS? If false, values from bsParams are taken
359  if (fitBeamSplitters_)
360  cout << "Fitting BS!" << endl;
361  else
362  cout << "BS fixed, not fitted!" << endl;
363 
364  // loop over LAS beams
365  for (TkLasBeamCollection::const_iterator iBeam = laserBeams->begin(), iEnd = laserBeams->end(); iBeam != iEnd;
366  ++iBeam) {
367  TkFittedLasBeam beam(*iBeam);
368  vector<TrajectoryStateOnSurface> tsosLas;
369 
370  // set BS param for fit
371  gBSparam = bsParams[beamNo];
372 
373  // call main function; all other functions are called inside getLasBeams(..)
374  this->getLasBeams(beam, tsosLas);
375 
376  // fill output products
377  fittedBeams->push_back(beam);
378  tsosesVec->push_back(tsosLas);
379 
380  // if(!this->fitBeam(fittedBeams->back(), tsosesVec->back())){
381  // edm::LogError("BadFit")
382  // << "Problems fitting TkLasBeam, id " << fittedBeams->back().getBeamId() << ".";
383  // fittedBeams->pop_back(); // remove last entry added just before
384  // tsosesVec->pop_back(); // dito
385  // }
386 
387  beamNo++;
388  }
389 
390  // finally, put fitted beams and TSOS vectors into run
391  run.put(std::move(fittedBeams));
392  run.put(std::move(tsosesVec));
393 }
394 
395 // methods for las data processing
396 
397 // -------------- loop over beams, call functions ----------------------------
398 void TkLasBeamFitter::getLasBeams(TkFittedLasBeam &beam, vector<TrajectoryStateOnSurface> &tsosLas) {
399  cout << "---------------------------------------" << endl;
400  cout << "beam id: " << beam.getBeamId() // << " isTec: " << (beam.isTecInternal() ? "Y" : "N")
401  << " isTec+: " << (beam.isTecInternal(1) ? "Y" : "N") << " isTec-: " << (beam.isTecInternal(-1) ? "Y" : "N")
402  << " isAt: " << (beam.isAlignmentTube() ? "Y" : "N") << " isR6: " << (beam.isRing6() ? "Y" : "N") << endl;
403 
404  // reset static variables
405  gHitsAtTecMinus = 0;
406  gHitZprime.clear();
407  gBarrelModuleRadius.clear();
408  gBarrelModuleOffset.clear();
409 
410  // set right beam radius
411  gBeamR = beam.isRing6() ? 84.0 : 56.4;
412 
413  vector<const GeomDetUnit *> gd;
414  vector<GlobalPoint> globHit;
415  unsigned int hitsAtTecPlus(0);
416  double sumZ(0.);
417 
418  // loop over hits
419  for (TkLasBeam::const_iterator iHit = beam.begin(); iHit < beam.end(); ++iHit) {
420  // iHit is a SiStripLaserRecHit2D
421 
422  const SiStripLaserRecHit2D hit(*iHit);
423 
424  this->getLasHits(beam, hit, gd, globHit, hitsAtTecPlus);
425  sumZ += globHit.back().z();
426 
427  // fill histos
428  h_hitX->Fill(hit.localPosition().x());
429  // TECplus
430  if (beam.isTecInternal(1)) {
431  h_hitXTecPlus->Fill(hit.localPosition().x());
432  h_hitXvsZTecPlus->Fill(globHit.back().z(), hit.localPosition().x());
433  }
434  // TECminus
435  else if (beam.isTecInternal(-1)) {
436  h_hitXTecMinus->Fill(hit.localPosition().x());
437  h_hitXvsZTecMinus->Fill(globHit.back().z(), hit.localPosition().x());
438  }
439  // ATs
440  else {
441  h_hitXAt->Fill(hit.localPosition().x());
442  h_hitXvsZAt->Fill(globHit.back().z(), hit.localPosition().x());
443  }
444  }
445 
446  gBeamZ0 = sumZ / globHit.size();
447  double zMin(0.), zMax(0.);
448  // TECplus
449  if (beam.isTecInternal(1)) {
450  gBeamSplitterZprime = 205.75 - gBeamZ0;
451  zMin = 120.0 - gBeamZ0;
452  zMax = 280.0 - gBeamZ0;
453  }
454  // TECminus
455  else if (beam.isTecInternal(-1)) {
456  gBeamSplitterZprime = -205.75 - gBeamZ0;
457  zMin = -280.0 - gBeamZ0;
458  zMax = -120.0 - gBeamZ0;
459  }
460  // AT
461  else {
462  gBeamSplitterZprime = 112.3 - gBeamZ0;
463  zMin = -200.0 - gBeamZ0;
464  zMax = 200.0 - gBeamZ0;
465  }
466 
467  // fill vectors for fitted quantities
468  vector<double> hitPhi, hitPhiError, hitZprimeError;
469 
470  for (unsigned int hit = 0; hit < globHit.size(); ++hit) {
471  hitPhi.push_back(static_cast<double>(globHit[hit].phi()));
472  // localPositionError[hit] or assume 0.003, 0.006
473  hitPhiError.push_back(0.003 / globHit[hit].perp());
474  // no errors on z, fill with zeros
475  hitZprimeError.push_back(0.0);
476  // barrel-specific values
477  if (beam.isAlignmentTube() && abs(globHit[hit].z()) < 112.3) {
478  gBarrelModuleRadius.push_back(globHit[hit].perp());
479  gBarrelModuleOffset.push_back(gBarrelModuleRadius.back() - gBeamR);
480  // TIB/TOB flag
481  if (gBarrelModuleOffset.back() < 0.0) {
482  gIsInnerBarrel = true;
483  } else {
484  gIsInnerBarrel = false;
485  }
486  gHitZprime.push_back(globHit[hit].z() - gBeamZ0 - abs(gBarrelModuleOffset.back()));
487  }
488  // non-barrel z'
489  else {
490  gHitZprime.push_back(globHit[hit].z() - gBeamZ0);
491  }
492  }
493 
494  // number of fit parameters, 3 for TECs (always!); 3, 5, or 6 for ATs
495  unsigned int tecParams(3), atParams(0);
496  if (nAtParameters_ == 3)
497  atParams = 3;
498  else if (nAtParameters_ == 5)
499  atParams = 5;
500  else
501  atParams = 6; // <-- default value, recommended
502  unsigned int nFitParams(0);
503  if (!fitBeamSplitters_ || (hitsAtTecPlus == 0 && beam.isAlignmentTube())) {
504  tecParams = tecParams - 1;
505  atParams = atParams - 1;
506  }
507  if (beam.isTecInternal()) {
508  nFitParams = tecParams;
509  } else {
510  nFitParams = atParams;
511  }
512 
513  // fit parameter definitions
514  double offset(0.), offsetError(0.), slope(0.), slopeError(0.), bsAngleParam(0.), phiAtMinusParam(0.),
515  phiAtPlusParam(0.), atThetaSplitParam(0.);
516  AlgebraicSymMatrix covMatrix;
517  if (!fitBeamSplitters_ || (beam.isAlignmentTube() && hitsAtTecPlus == 0)) {
518  covMatrix = AlgebraicSymMatrix(nFitParams, 1);
519  } else {
520  covMatrix = AlgebraicSymMatrix(nFitParams - 1, 1);
521  }
522 
523  this->fitter(beam,
524  covMatrix,
525  hitsAtTecPlus,
526  nFitParams,
527  hitPhi,
528  hitPhiError,
529  hitZprimeError,
530  zMin,
531  zMax,
532  bsAngleParam,
533  offset,
534  offsetError,
535  slope,
536  slopeError,
537  phiAtMinusParam,
538  phiAtPlusParam,
539  atThetaSplitParam);
540 
541  vector<GlobalPoint> globPtrack;
542  GlobalPoint globPref;
543  double chi2(0.);
544 
545  for (unsigned int hit = 0; hit < gHitZprime.size(); ++hit) {
546  // additional phi value (trackPhiRef) for trajectory calculation
547  double trackPhi(0.), trackPhiRef(0.);
548 
549  this->trackPhi(beam,
550  hit,
551  trackPhi,
552  trackPhiRef,
553  offset,
554  slope,
555  bsAngleParam,
556  phiAtMinusParam,
557  phiAtPlusParam,
558  atThetaSplitParam,
559  globHit);
560 
561  cout << "track phi = " << trackPhi << ", hit phi = " << hitPhi[hit] << ", zPrime = " << gHitZprime[hit]
562  << " r = " << globHit[hit].perp() << endl;
563 
564  this->globalTrackPoint(beam, hit, hitsAtTecPlus, trackPhi, trackPhiRef, globHit, globPtrack, globPref, hitPhiError);
565 
566  // calculate residuals = pred - hit (in global phi)
567  const double phiResidual = globPtrack[hit].phi() - globHit[hit].phi();
568  // pull calculation (FIX!!!)
569  const double phiResidualPull = phiResidual / hitPhiError[hit];
570  // sqrt(hitPhiError[hit]*hitPhiError[hit] +
571  // (offsetError*offsetError + globPtrack[hit].z()*globPtrack[hit].z() * slopeError*slopeError));
572 
573  // calculate chi2
574  chi2 += phiResidual * phiResidual / (hitPhiError[hit] * hitPhiError[hit]);
575 
576  // fill histos
577  h_res->Fill(phiResidual);
578  // TECplus
579  if (beam.isTecInternal(1)) {
580  h_pull->Fill(phiResidualPull);
581  h_resTecPlus->Fill(phiResidual);
582  h_resVsZTecPlus->Fill(globPtrack[hit].z(), phiResidual);
583  // Ring 6
584  if (beam.isRing6()) {
585  h_resVsHitTecPlus->Fill(hit + (beam.getBeamId() - 1) / 10 * 9 + 72, phiResidual);
586  }
587  // Ring 4
588  else {
589  h_resVsHitTecPlus->Fill(hit + beam.getBeamId() / 10 * 9, phiResidual);
590  }
591  }
592  // TECminus
593  else if (beam.isTecInternal(-1)) {
594  h_pull->Fill(phiResidualPull);
595  h_resTecMinus->Fill(phiResidual);
596  h_resVsZTecMinus->Fill(globPtrack[hit].z(), phiResidual);
597  // Ring 6
598  if (beam.isRing6()) {
599  h_resVsHitTecMinus->Fill(hit + (beam.getBeamId() - 101) / 10 * 9 + 72, phiResidual);
600  }
601  // Ring 4
602  else {
603  h_resVsHitTecMinus->Fill(hit + (beam.getBeamId() - 100) / 10 * 9, phiResidual);
604  }
605  }
606  // ATs
607  else {
608  h_pull->Fill(phiResidualPull);
609  h_resAt->Fill(phiResidual);
610  h_resVsZAt->Fill(globPtrack[hit].z(), phiResidual);
611  h_resVsHitAt->Fill(hit + (beam.getBeamId() - 200) / 10 * 22, phiResidual);
612  }
613 
614  this->buildTrajectory(beam, hit, gd, globPtrack, tsosLas, globPref);
615  }
616 
617  cout << "chi^2 = " << chi2 << ", chi^2/ndof = " << chi2 / (gHitZprime.size() - nFitParams) << endl;
618  this->fitBeam(beam, covMatrix, hitsAtTecPlus, nFitParams, offset, slope, globPtrack, bsAngleParam, chi2);
619 
620  cout << "bsAngleParam = " << bsAngleParam << endl;
621 
622  // fill histos
623  // include slope, offset, covariance plots here
624  h_chi2->Fill(chi2);
625  h_chi2ndof->Fill(chi2 / (gHitZprime.size() - nFitParams));
626  if (bsAngleParam != 0.0) {
627  h_bsAngle->Fill(2.0 * atan(0.5 * bsAngleParam));
628  h_bsAngleVsBeam->Fill(beam.getBeamId(), 2.0 * atan(0.5 * bsAngleParam));
629  }
630 }
631 
632 // --------- get hits, convert to global coordinates ---------------------------
634  const SiStripLaserRecHit2D &hit,
635  vector<const GeomDetUnit *> &gd,
636  vector<GlobalPoint> &globHit,
637  unsigned int &hitsAtTecPlus) {
638  // get global position of LAS hits
639  gd.push_back(geometry->idToDetUnit(hit.getDetId()));
640  GlobalPoint globPtemp(gd.back()->toGlobal(hit.localPosition()));
641 
642  // testing: globPtemp should be right
643  globHit.push_back(globPtemp);
644 
645  if (beam.isAlignmentTube()) {
646  if (abs(globPtemp.z()) > 112.3) {
647  if (globPtemp.z() < 112.3)
648  gHitsAtTecMinus++;
649  else
650  hitsAtTecPlus++;
651  }
652  }
653 }
654 
655 // ------------ parametrization functions for las beam fits ------------
656 double TkLasBeamFitter::tecPlusFunction(double *x, double *par) {
657  double z = x[0]; // 'primed'? -> yes!!!
658 
659  if (z < gBeamSplitterZprime) {
660  return par[0] + par[1] * z;
661  } else {
662  if (gFitBeamSplitters) {
663  // par[2] = 2*tan(BeamSplitterAngle/2.0)
664  return par[0] + par[1] * z - par[2] * (z - gBeamSplitterZprime) / gBeamR;
665  } else {
666  return par[0] + par[1] * z - gBSparam * (z - gBeamSplitterZprime) / gBeamR;
667  }
668  }
669 }
670 
671 double TkLasBeamFitter::tecMinusFunction(double *x, double *par) {
672  double z = x[0]; // 'primed'? -> yes!!!
673 
674  if (z > gBeamSplitterZprime) {
675  return par[0] + par[1] * z;
676  } else {
677  if (gFitBeamSplitters) {
678  // par[2] = 2*tan(BeamSplitterAngle/2.0)
679  return par[0] + par[1] * z + par[2] * (z - gBeamSplitterZprime) / gBeamR;
680  } else {
681  return par[0] + par[1] * z + gBSparam * (z - gBeamSplitterZprime) / gBeamR;
682  }
683  }
684 }
685 
686 double TkLasBeamFitter::atFunction(double *x, double *par) {
687  double z = x[0]; // 'primed'? -> yes!!!
688  // TECminus
689  if (z < -gBeamSplitterZprime - 2.0 * gBeamZ0) {
690  return par[0] + par[1] * z;
691  }
692  // BarrelMinus
693  else if (-gBeamSplitterZprime - 2.0 * gBeamZ0 < z && z < -gBeamZ0) {
694  // z value includes module offset from main beam axis
695  // TOB
696  if (!gIsInnerBarrel) {
697  return par[0] + par[1] * z + gTOBparam * (par[2] + par[4]);
698  }
699  // TIB
700  else {
701  return par[0] + par[1] * z - gTIBparam * (par[2] - par[4]);
702  }
703  }
704  // BarrelPlus
705  else if (-gBeamZ0 < z && z < gBeamSplitterZprime) {
706  // z value includes module offset from main beam axis
707  // TOB
708  if (!gIsInnerBarrel) {
709  return par[0] + par[1] * z + gTOBparam * (par[3] - par[4]);
710  }
711  // TIB
712  else {
713  return par[0] + par[1] * z - gTIBparam * (par[3] + par[4]);
714  }
715  }
716  // TECplus
717  else {
718  if (gFitBeamSplitters) {
719  // par[2] = 2*tan(BeamSplitterAngle/2.0)
720  return par[0] + par[1] * z - par[5] * (z - gBeamSplitterZprime) / gBeamR; // BS par: 5, 4, or 2
721  } else {
722  return par[0] + par[1] * z - gBSparam * (z - gBeamSplitterZprime) / gBeamR;
723  }
724  }
725 }
726 
727 // ------------ perform fit of beams ------------------------------------
729  AlgebraicSymMatrix &covMatrix,
730  unsigned int &hitsAtTecPlus,
731  unsigned int &nFitParams,
732  vector<double> &hitPhi,
733  vector<double> &hitPhiError,
734  vector<double> &hitZprimeError,
735  double &zMin,
736  double &zMax,
737  double &bsAngleParam,
738  double &offset,
739  double &offsetError,
740  double &slope,
741  double &slopeError,
742  double &phiAtMinusParam,
743  double &phiAtPlusParam,
744  double &atThetaSplitParam) {
745  TGraphErrors *lasData =
746  new TGraphErrors(gHitZprime.size(), &(gHitZprime[0]), &(hitPhi[0]), &(hitZprimeError[0]), &(hitPhiError[0]));
747 
748  // do fit (R = entire range)
749  if (beam.isTecInternal(1)) {
750  TF1 tecPlus("tecPlus", tecPlusFunction, zMin, zMax, nFitParams);
751  tecPlus.SetParameter(1, 0); // slope
752  tecPlus.SetParameter(nFitParams - 1, 0); // BS
753  lasData->Fit(&tecPlus, "R"); // "R", "RV" or "RQ"
754  } else if (beam.isTecInternal(-1)) {
755  TF1 tecMinus("tecMinus", tecMinusFunction, zMin, zMax, nFitParams);
756  tecMinus.SetParameter(1, 0); // slope
757  tecMinus.SetParameter(nFitParams - 1, 0); // BS
758  lasData->Fit(&tecMinus, "R");
759  } else {
760  TF1 at("at", atFunction, zMin, zMax, nFitParams);
761  at.SetParameter(1, 0); // slope
762  at.SetParameter(nFitParams - 1, 0); // BS
763  lasData->Fit(&at, "R");
764  }
765 
766  // get values and errors for offset and slope
767  gMinuit->GetParameter(0, offset, offsetError);
768  gMinuit->GetParameter(1, slope, slopeError);
769 
770  // additional AT parameters
771  // define param errors that are not used later
772  double bsAngleParamError(0.), phiAtMinusParamError(0.), phiAtPlusParamError(0.), atThetaSplitParamError(0.);
773 
774  if (beam.isAlignmentTube()) {
775  gMinuit->GetParameter(2, phiAtMinusParam, phiAtMinusParamError);
776  gMinuit->GetParameter(3, phiAtPlusParam, phiAtPlusParamError);
777  gMinuit->GetParameter(4, atThetaSplitParam, atThetaSplitParamError);
778  }
779  // get Beam Splitter parameters
780  if (fitBeamSplitters_) {
781  if (beam.isAlignmentTube() && hitsAtTecPlus == 0) {
782  bsAngleParam = gBSparam;
783  } else {
784  gMinuit->GetParameter(nFitParams - 1, bsAngleParam, bsAngleParamError);
785  }
786  } else {
787  bsAngleParam = gBSparam;
788  }
789 
790  // fill covariance matrix
791  vector<double> vec(covMatrix.num_col() * covMatrix.num_col());
792  gMinuit->mnemat(&vec[0], covMatrix.num_col());
793  for (int col = 0; col < covMatrix.num_col(); col++) {
794  for (int row = 0; row < covMatrix.num_col(); row++) {
795  covMatrix[col][row] = vec[row + covMatrix.num_col() * col];
796  }
797  }
798  // compute correlation between parameters
799  // double corr01 = covMatrix[1][0]/(offsetError*slopeError);
800 
801  delete lasData;
802 }
803 
804 // -------------- calculate track phi value ----------------------------------
806  unsigned int &hit,
807  double &trackPhi,
808  double &trackPhiRef,
809  double &offset,
810  double &slope,
811  double &bsAngleParam,
812  double &phiAtMinusParam,
813  double &phiAtPlusParam,
814  double &atThetaSplitParam,
815  vector<GlobalPoint> &globHit) {
816  // TECplus
817  if (beam.isTecInternal(1)) {
820  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0);
821  } else {
822  trackPhi = offset + slope * gHitZprime[hit] - bsAngleParam * (gHitZprime[hit] - gBeamSplitterZprime) / gBeamR;
823  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0) -
824  bsAngleParam * ((gHitZprime[hit] + 1.0) - gBeamSplitterZprime) / gBeamR;
825  }
826  }
827  // TECminus
828  else if (beam.isTecInternal(-1)) {
831  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0);
832  } else {
833  trackPhi = offset + slope * gHitZprime[hit] + bsAngleParam * (gHitZprime[hit] - gBeamSplitterZprime) / gBeamR;
834  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0) +
835  bsAngleParam * ((gHitZprime[hit] + 1.0) - gBeamSplitterZprime) / gBeamR;
836  }
837  }
838  // ATs
839  else {
840  // TECminus
841  if (gHitZprime[hit] < -gBeamSplitterZprime - 2.0 * gBeamZ0) {
843  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0);
844  }
845  // BarrelMinus
846  else if (-gBeamSplitterZprime - 2.0 * gBeamZ0 < gHitZprime[hit] && gHitZprime[hit] < -gBeamZ0) {
847  if (!gIsInnerBarrel) {
848  trackPhi = offset + slope * gHitZprime[hit] + gTOBparam * (phiAtMinusParam + atThetaSplitParam);
849  } else {
850  trackPhi = offset + slope * gHitZprime[hit] - gTIBparam * (phiAtMinusParam - atThetaSplitParam);
851  }
853  }
854  // BarrelPlus
856  if (!gIsInnerBarrel) {
857  trackPhi = offset + slope * gHitZprime[hit] + gTOBparam * (phiAtPlusParam - atThetaSplitParam);
858  } else {
859  trackPhi = offset + slope * gHitZprime[hit] - gTIBparam * (phiAtPlusParam + atThetaSplitParam);
860  }
862  }
863  // TECplus
864  else {
865  trackPhi = offset + slope * gHitZprime[hit] - bsAngleParam * (gHitZprime[hit] - gBeamSplitterZprime) / gBeamR;
866  trackPhiRef = offset + slope * (gHitZprime[hit] + 1.0) -
867  bsAngleParam * ((gHitZprime[hit] + 1.0) - gBeamSplitterZprime) / gBeamR;
868  }
869  }
870 }
871 
872 // -------------- calculate global track points, hit residuals, chi2 ----------------------------------
874  unsigned int &hit,
875  unsigned int &hitsAtTecPlus,
876  double &trackPhi,
877  double &trackPhiRef,
878  vector<GlobalPoint> &globHit,
879  vector<GlobalPoint> &globPtrack,
880  GlobalPoint &globPref,
881  vector<double> &hitPhiError) {
882  // TECs
883  if (beam.isTecInternal(0)) {
884  globPtrack.push_back(GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhi, globHit[hit].z())));
885  globPref = GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhiRef, globHit[hit].z() + 1.0));
886  }
887  // ATs
888  else {
889  // TECminus
890  if (hit < gHitsAtTecMinus) { // gHitZprime[hit] < -gBeamSplitterZprime - 2.0*gBeamZ0
891  globPtrack.push_back(GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhi, globHit[hit].z())));
892  globPref = GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhiRef, globHit[hit].z() + 1.0));
893  }
894  // TECplus
895  else if (hit > gHitZprime.size() - hitsAtTecPlus - 1) { // gHitZprime[hit] > gBeamSplitterZprime
896  globPtrack.push_back(GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhi, globHit[hit].z())));
897  globPref = GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhiRef, globHit[hit].z() + 1.0));
898  }
899  // Barrel
900  else {
901  globPtrack.push_back(GlobalPoint(GlobalPoint::Cylindrical(globHit[hit].perp(), trackPhi, globHit[hit].z())));
902  globPref = GlobalPoint(GlobalPoint::Cylindrical(gBeamR, trackPhiRef, globHit[hit].z()));
903  }
904  }
905 }
906 
907 // ----------- create TrajectoryStateOnSurface for each track hit ----------------------------------------------
909  unsigned int &hit,
910  vector<const GeomDetUnit *> &gd,
911  vector<GlobalPoint> &globPtrack,
912  vector<TrajectoryStateOnSurface> &tsosLas,
913  GlobalPoint &globPref) {
915  GlobalVector trajectoryState;
916 
917  // TECplus
918  if (beam.isTecInternal(1)) {
919  trajectoryState = GlobalVector(globPref - globPtrack[hit]);
920  }
921  // TECminus
922  else if (beam.isTecInternal(-1)) {
923  trajectoryState = GlobalVector(globPtrack[hit] - globPref);
924  }
925  // ATs
926  else {
927  // TECminus
928  if (gHitZprime[hit] < -gBeamSplitterZprime - 2.0 * gBeamZ0) {
929  trajectoryState = GlobalVector(globPtrack[hit] - globPref);
930  }
931  // TECplus
932  else if (gHitZprime[hit] > gBeamSplitterZprime) {
933  trajectoryState = GlobalVector(globPref - globPtrack[hit]);
934  }
935  // Barrel
936  else {
937  trajectoryState = GlobalVector(globPtrack[hit] - globPref);
938  }
939  }
940  // cout << "trajectory: " << trajectoryState << endl;
941  const FreeTrajectoryState ftsLas = FreeTrajectoryState(globPtrack[hit], trajectoryState, 0, magneticField);
942  tsosLas.push_back(TrajectoryStateOnSurface(ftsLas, gd[hit]->surface(), SurfaceSideDefinition::beforeSurface));
943 }
944 
945 //---------------------- set beam parameters for fittedBeams ---------------------------------
947  AlgebraicSymMatrix &covMatrix,
948  unsigned int &hitsAtTecPlus,
949  unsigned int &nFitParams,
950  double &offset,
951  double &slope,
952  vector<GlobalPoint> &globPtrack,
953  double &bsAngleParam,
954  double &chi2) {
955  // set beam parameters for beam output
956  unsigned int paramType(0);
957  if (!fitBeamSplitters_)
958  paramType = 1;
959  if (beam.isAlignmentTube() && hitsAtTecPlus == 0)
960  paramType = 0;
961  // const unsigned int nPedeParams = nFitParams + paramType;
962 
963  // test without BS params
964  const unsigned int nPedeParams(nFitParams);
965  // cout << "number of Pede parameters: " << nPedeParams << endl;
966 
967  std::vector<TkFittedLasBeam::Scalar> params(nPedeParams);
968  params[0] = offset;
969  params[1] = slope;
970  // no BS parameter for AT beams without TECplus hits
971  // if(beam.isTecInternal() || hitsAtTecPlus > 0) params[2] = bsAngleParam;
972 
973  AlgebraicMatrix derivatives(gHitZprime.size(), nPedeParams);
974  // fill derivatives matrix with local track derivatives
975  for (unsigned int hit = 0; hit < gHitZprime.size(); ++hit) {
976  // d(delta phi)/d(offset) is identical for every hit
977  derivatives[hit][0] = 1.0;
978 
979  // d(delta phi)/d(slope) and d(delta phi)/d(bsAngleParam) depend on parametrizations
980  // TECplus
981  if (beam.isTecInternal(1)) {
982  derivatives[hit][1] = globPtrack[hit].z();
983  // if(gHitZprime[hit] < gBeamSplitterZprime){
984  // derivatives[hit][2] = 0.0;
985  // }
986  // else{
987  // derivatives[hit][2] = - (globPtrack[hit].z() - gBeamSplitterZprime) / gBeamR;
988  // }
989  }
990  // TECminus
991  else if (beam.isTecInternal(-1)) {
992  derivatives[hit][1] = globPtrack[hit].z();
993  // if(gHitZprime[hit] > gBeamSplitterZprime){
994  // derivatives[hit][2] = 0.0;
995  // }
996  // else{
997  // derivatives[hit][2] = (globPtrack[hit].z() - gBeamSplitterZprime) / gBeamR;
998  // }
999  }
1000  // ATs
1001  else {
1002  // TECminus
1003  if (gHitZprime[hit] < -gBeamSplitterZprime - 2.0 * gBeamZ0) {
1004  derivatives[hit][1] = globPtrack[hit].z();
1005  // if(hitsAtTecPlus > 0){
1006  // derivatives[hit][2] = 0.0;
1007  // }
1008  }
1009  // TECplus
1010  else if (gHitZprime[hit] > gBeamSplitterZprime) {
1011  derivatives[hit][1] = globPtrack[hit].z();
1012  // if(hitsAtTecPlus > 0){
1013  // derivatives[hit][2] = - (globPtrack[hit].z() - gBeamSplitterZprime) / gBeamR;
1014  // }
1015  }
1016  // Barrel
1017  else {
1018  derivatives[hit][1] = globPtrack[hit].z() - gBarrelModuleOffset[hit - gHitsAtTecMinus];
1019  // if(hitsAtTecPlus > 0){
1020  // derivatives[hit][2] = 0.0;
1021  // }
1022  }
1023  }
1024  }
1025 
1026  unsigned int firstFixedParam(covMatrix.num_col()); // FIXME! --> no, is fine!!!
1027  // unsigned int firstFixedParam = nPedeParams - 1;
1028  // if(beam.isAlignmentTube() && hitsAtTecPlus == 0) firstFixedParam = nPedeParams;
1029  // cout << "first fixed parameter: " << firstFixedParam << endl;
1030  // set fit results
1031  beam.setParameters(paramType, params, covMatrix, derivatives, firstFixedParam, chi2);
1032 
1033  return true; // return false in case of problems
1034 }
1035 
1036 //---------------------------------------------------------------------------------------
1037 //define this as a plug-in
Vector3DBase
Definition: Vector3DBase.h:8
TkFittedLasBeam.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TkLasBeamFitter::fitBeam
bool fitBeam(TkFittedLasBeam &beam, AlgebraicSymMatrix &covMatrix, unsigned int &hitsAtTecPlus, unsigned int &nFitParams, double &offset, double &slope, vector< GlobalPoint > &globPtrack, double &bsAngleParam, double &chi2)
Definition: TkLasBeamFitter.cc:946
SiStripLaserRecHit2D
Definition: SiStripLaserRecHit2D.h:12
TrajectoryStateOnSurface.h
TkLasBeamFitter::produce
void produce(edm::Event &event, const edm::EventSetup &setup) override
Definition: TkLasBeamFitter.cc:250
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
electrons_cff.bool
bool
Definition: electrons_cff.py:372
EDProducer.h
FreeTrajectoryState.h
photonAnalyzer_cfi.zMax
zMax
Definition: photonAnalyzer_cfi.py:95
TrackerGeometry.h
ESHandle.h
TkLasBeamFitter::h_resTecPlus
TH1F * h_resTecPlus
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::trackPhi
void trackPhi(TkFittedLasBeam &beam, unsigned int &hit, double &trackPhi, double &trackPhiRef, double &offset, double &slope, double &bsAngleParam, double &phiAtMinusParam, double &phiAtPlusParam, double &atThetaSplitParam, std::vector< GlobalPoint > &globHit)
Definition: TkLasBeamFitter.cc:805
laserBeams
Handle< TkLasBeamCollection > laserBeams
Definition: TkLasBeamFitter.cc:198
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
TkLasBeamFitter::atFunction
static double atFunction(double *x, double *par)
Definition: TkLasBeamFitter.cc:686
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::Run
Definition: Run.h:45
TkLasBeamFitter::h_resVsZTecMinus
TH2F * h_resVsZTecMinus
Definition: TkLasBeamFitter.cc:171
TkLasBeamFitter::h_hitXvsZTecPlus
TH2F * h_hitXvsZTecPlus
Definition: TkLasBeamFitter.cc:171
edm
HLT enums.
Definition: AlignableModifier.h:19
fieldHandle
ESHandle< MagneticField > fieldHandle
Definition: TkLasBeamFitter.cc:199
cuy.col
col
Definition: cuy.py:1010
gather_cfg.cout
cout
Definition: gather_cfg.py:144
geometry
Definition: geometry.py:1
TkLasBeamFitter::h_hitXAt
TH1F * h_hitXAt
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::h_hitXvsZTecMinus
TH2F * h_hitXvsZTecMinus
Definition: TkLasBeamFitter.cc:171
TkLasBeamFitter::h_resVsZAt
TH2F * h_resVsZAt
Definition: TkLasBeamFitter.cc:171
TkLasBeamFitter::h_resVsHitTecMinus
TH2F * h_resVsHitTecMinus
Definition: TkLasBeamFitter.cc:171
TkLasBeamFitter::h_hitXvsZAt
TH2F * h_hitXvsZAt
Definition: TkLasBeamFitter.cc:171
edm::one::EDProducer
Definition: EDProducer.h:30
DDAxes::x
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
TkLasBeamFitter::gBeamZ0
static double gBeamZ0
Definition: TkLasBeamFitter.cc:161
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
tools.TF1
TF1
Definition: tools.py:23
edm::Handle
Definition: AssociativeIterator.h:50
TkLasBeamFitter::gHitZprime
static vector< double > gHitZprime
Definition: TkLasBeamFitter.cc:155
TkLasBeamFitter::h_pull
TH1F * h_pull
Definition: TkLasBeamFitter.cc:169
fitWZ.gMinuit
gMinuit
Definition: fitWZ.py:36
TkLasBeamFitter::h_resTecMinus
TH1F * h_resTecMinus
Definition: TkLasBeamFitter.cc:169
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TkLasBeam.h
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
config
Definition: config.py:1
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MakerMacros.h
TsosVectorCollection.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TkLasBeamFitter::src_
const edm::InputTag src_
Definition: TkLasBeamFitter.cc:148
TkLasBeamFitter::tecMinusFunction
static double tecMinusFunction(double *x, double *par)
Definition: TkLasBeamFitter.cc:671
Service.h
TkLasBeamFitter::tecPlusFunction
static double tecPlusFunction(double *x, double *par)
Definition: TkLasBeamFitter.cc:656
TkLasBeamFitter::getLasHits
void getLasHits(TkFittedLasBeam &beam, const SiStripLaserRecHit2D &hit, vector< const GeomDetUnit * > &gd, vector< GlobalPoint > &globHit, unsigned int &hitsAtTecPlus)
Definition: TkLasBeamFitter.cc:633
SurfaceSideDefinition::beforeSurface
Definition: SurfaceSideDefinition.h:8
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
Geom::Cylindrical2Cartesian
Definition: CoordinateSets.h:34
vertices_cff.x
x
Definition: vertices_cff.py:29
DDAxes::z
Run.h
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
TkLasBeamFitter::buildTrajectory
void buildTrajectory(TkFittedLasBeam &beam, unsigned int &hit, vector< const GeomDetUnit * > &gd, std::vector< GlobalPoint > &globPtrack, vector< TrajectoryStateOnSurface > &tsosLas, GlobalPoint &globPref)
Definition: TkLasBeamFitter.cc:908
TkLasBeamFitter::TkLasBeamFitter
TkLasBeamFitter(const edm::ParameterSet &config)
Definition: TkLasBeamFitter.cc:205
TkLasBeamFitter::gBSparam
static double gBSparam
Definition: TkLasBeamFitter.cc:164
TkLasBeam::const_iterator
std::vector< SiStripLaserRecHit2D >::const_iterator const_iterator
Definition: TkLasBeam.h:14
EcalCondDBWriter_cfi.beam
beam
Definition: EcalCondDBWriter_cfi.py:45
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
TFileService.h
TrackerDigiGeometryRecord.h
TkLasBeamFitter::gHitsAtTecMinus
static unsigned int gHitsAtTecMinus
Definition: TkLasBeamFitter.cc:163
edm::ParameterSet
Definition: ParameterSet.h:36
TkLasBeamFitter::gFitBeamSplitters
static bool gFitBeamSplitters
Definition: TkLasBeamFitter.cc:165
Event.h
TkLasBeamFitter::gBeamSplitterZprime
static double gBeamSplitterZprime
Definition: TkLasBeamFitter.cc:162
reco::btau::trackPhi
Definition: TaggingVariable.h:43
photonAnalyzer_cfi.zMin
zMin
Definition: photonAnalyzer_cfi.py:94
TkLasBeamFitter
Definition: TkLasBeamFitter.cc:62
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
BranchType.h
TkLasBeamFitter::h_resVsZTecPlus
TH2F * h_resVsZTecPlus
Definition: TkLasBeamFitter.cc:171
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:57
TkLasBeamFitter::h_resAt
TH1F * h_resAt
Definition: TkLasBeamFitter.cc:169
TkFittedLasBeam
Definition: TkFittedLasBeam.h:18
TkLasBeamFitter::fs
edm::Service< TFileService > fs
Definition: TkLasBeamFitter.cc:152
get
#define get
TkLasBeamFitter::h_resVsHitAt
TH2F * h_resVsHitAt
Definition: TkLasBeamFitter.cc:171
InputTag.h
TkLasBeamFitter::h_chi2ndof
TH1F * h_chi2ndof
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::gIsInnerBarrel
static bool gIsInnerBarrel
Definition: TkLasBeamFitter.cc:166
DDAxes::phi
TkLasBeamFitter::h_chi2
TH1F * h_chi2
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::gBarrelModuleRadius
static vector< double > gBarrelModuleRadius
Definition: TkLasBeamFitter.cc:156
GeomDet.h
TkLasBeamFitter::gTOBparam
static float gTOBparam
Definition: TkLasBeamFitter.cc:159
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
writedatasetfile.run
run
Definition: writedatasetfile.py:27
TkLasBeamFitter::globalTrackPoint
void globalTrackPoint(TkFittedLasBeam &beam, unsigned int &hit, unsigned int &hitsAtTecPlus, double &trackPhi, double &trackPhiRef, std::vector< GlobalPoint > &globHit, std::vector< GlobalPoint > &globPtrack, GlobalPoint &globPref, std::vector< double > &hitPhiError)
Definition: TkLasBeamFitter.cc:873
TkLasBeamFitter_cfi.TkLasBeamFitter
TkLasBeamFitter
Definition: TkLasBeamFitter_cfi.py:3
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
Frameworkfwd.h
TkLasBeamFitter::fitBeamSplitters_
bool fitBeamSplitters_
Definition: TkLasBeamFitter.cc:149
TkLasBeamFitter::h_hitX
TH1F * h_hitX
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::getLasBeams
void getLasBeams(TkFittedLasBeam &beam, vector< TrajectoryStateOnSurface > &tsosLas)
Definition: TkLasBeamFitter.cc:398
TkLasBeamFitter::h_bsAngle
TH1F * h_bsAngle
Definition: TkLasBeamFitter.cc:169
EventSetup.h
TkLasBeamFitter::h_resVsHitTecPlus
TH2F * h_resVsHitTecPlus
Definition: TkLasBeamFitter.cc:171
TkLasBeamFitter::h_hitXTecMinus
TH1F * h_hitXTecMinus
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::h_hitXTecPlus
TH1F * h_hitXTecPlus
Definition: TkLasBeamFitter.cc:169
TkLasBeamFitter::gBarrelModuleOffset
static vector< double > gBarrelModuleOffset
Definition: TkLasBeamFitter.cc:157
TkLasBeamFitter::h_bsAngleVsBeam
TH2F * h_bsAngleVsBeam
Definition: TkLasBeamFitter.cc:171
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
TkLasBeamFitter::fitter
void fitter(TkFittedLasBeam &beam, AlgebraicSymMatrix &covMatrix, unsigned int &hitsAtTecPlus, unsigned int &nFitParams, std::vector< double > &hitPhi, std::vector< double > &hitPhiError, std::vector< double > &hitZprimeError, double &zMin, double &zMax, double &bsAngleParam, double &offset, double &offsetError, double &slope, double &slopeError, double &phiAtMinusParam, double &phiAtPlusParam, double &atThetaSplitParam)
Definition: TkLasBeamFitter.cc:728
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
event
Definition: event.py:1
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::Event
Definition: Event.h:73
TkLasBeamFitter::gTIBparam
static float gTIBparam
Definition: TkLasBeamFitter.cc:158
MagneticField
Definition: MagneticField.h:19
TkLasBeamFitter::endRunProduce
void endRunProduce(edm::Run &run, const edm::EventSetup &setup) override
Definition: TkLasBeamFitter.cc:256
TkLasBeamFitter::nAtParameters_
unsigned int nAtParameters_
Definition: TkLasBeamFitter.cc:150
TkLasBeamFitter::~TkLasBeamFitter
~TkLasBeamFitter() override
Definition: TkLasBeamFitter.cc:239
GlobalPoint.h
edm::InputTag
Definition: InputTag.h:15
TkLasBeamFitter::h_res
TH1F * h_res
Definition: TkLasBeamFitter.cc:169
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
TkLasBeamFitter::gBeamR
static double gBeamR
Definition: TkLasBeamFitter.cc:160