CMS 3D CMS Logo

LaserAlignment.cc
Go to the documentation of this file.
1 
15 
20  : topoToken_(esConsumes()),
21  geomToken_(esConsumes()),
22  geomDetToken_(esConsumes()),
23  ptpToken_(esConsumes()),
24  gprToken_(esConsumes()),
25  stripPedestalsToken_(esConsumes()),
26  theEvents(0),
27  theDoPedestalSubtraction(theConf.getUntrackedParameter<bool>("SubtractPedestals", true)),
28  theUseMinuitAlgorithm(theConf.getUntrackedParameter<bool>("RunMinuitAlignmentTubeAlgorithm", false)),
29  theApplyBeamKinkCorrections(theConf.getUntrackedParameter<bool>("ApplyBeamKinkCorrections", true)),
30  peakFinderThreshold(theConf.getUntrackedParameter<double>("PeakFinderThreshold", 10.)),
31  enableJudgeZeroFilter(theConf.getUntrackedParameter<bool>("EnableJudgeZeroFilter", true)),
32  judgeOverdriveThreshold(theConf.getUntrackedParameter<unsigned int>("JudgeOverdriveThreshold", 220)),
33  updateFromInputGeometry(theConf.getUntrackedParameter<bool>("UpdateFromInputGeometry", false)),
34  misalignedByRefGeometry(theConf.getUntrackedParameter<bool>("MisalignedByRefGeometry", false)),
35  theStoreToDB(theConf.getUntrackedParameter<bool>("SaveToDbase", false)),
36  theDigiProducersList(theConf.getParameter<std::vector<edm::ParameterSet> >("DigiProducersList")),
37  theSaveHistograms(theConf.getUntrackedParameter<bool>("SaveHistograms", false)),
38  theCompression(theConf.getUntrackedParameter<int>("ROOTFileCompression", 1)),
39  theFileName(theConf.getUntrackedParameter<std::string>("ROOTFileName", "test.root")),
40  theMaskTecModules(theConf.getUntrackedParameter<std::vector<unsigned int> >("MaskTECModules")),
41  theMaskAtModules(theConf.getUntrackedParameter<std::vector<unsigned int> >("MaskATModules")),
42  theSetNominalStrips(theConf.getUntrackedParameter<bool>("ForceFitterToNominalStrips", false)),
43  theLasConstants(theConf.getUntrackedParameter<std::vector<edm::ParameterSet> >("LaserAlignmentConstants")),
44  theFile(),
45  theAlignableTracker(),
46  theAlignRecordName("TrackerAlignmentRcd"),
47  theErrorRecordName("TrackerAlignmentErrorExtendedRcd"),
48  firstEvent_(true) {
49  std::cout << std::endl;
50  std::cout << "=============================================================="
51  << "\n=== LaserAlignment module configuration ==="
52  << "\n"
53  << "\n Write histograms to file = " << (theSaveHistograms ? "true" : "false")
54  << "\n Histogram file name = " << theFileName
55  << "\n Histogram file compression = " << theCompression
56  << "\n Subtract pedestals = " << (theDoPedestalSubtraction ? "true" : "false")
57  << "\n Run Minuit AT algorithm = " << (theUseMinuitAlgorithm ? "true" : "false")
58  << "\n Apply beam kink corrections = " << (theApplyBeamKinkCorrections ? "true" : "false")
59  << "\n Peak Finder Threshold = " << peakFinderThreshold
60  << "\n EnableJudgeZeroFilter = " << (enableJudgeZeroFilter ? "true" : "false")
61  << "\n JudgeOverdriveThreshold = " << judgeOverdriveThreshold
62  << "\n Update from input geometry = " << (updateFromInputGeometry ? "true" : "false")
63  << "\n Misalignment from ref geometry = " << (misalignedByRefGeometry ? "true" : "false")
64  << "\n Number of TEC modules masked = " << theMaskTecModules.size() << " (s. below list if > 0)"
65  << "\n Number of AT modules masked = " << theMaskAtModules.size() << " (s. below list if > 0)"
66  << "\n Store to database = " << (theStoreToDB ? "true" : "false")
67  << "\n ----------------------------------------------- ----------"
68  << (theSetNominalStrips ? "\n Set strips to nominal = true" : "\n")
69  << "\n=============================================================" << std::endl;
70 
71  // tell about masked modules
72  if (!theMaskTecModules.empty()) {
73  std::cout << " ===============================================================================================\n"
74  << std::flush;
75  std::cout << " The following " << theMaskTecModules.size()
76  << " TEC modules have been masked out and will not be considered by the TEC algorithm:\n " << std::flush;
77  for (std::vector<unsigned int>::iterator moduleIt = theMaskTecModules.begin(); moduleIt != theMaskTecModules.end();
78  ++moduleIt) {
79  std::cout << *moduleIt << (moduleIt != --theMaskTecModules.end() ? ", " : "") << std::flush;
80  }
81  std::cout << std::endl << std::flush;
82  std::cout << " ===============================================================================================\n\n"
83  << std::flush;
84  }
85  if (!theMaskAtModules.empty()) {
86  std::cout << " ===============================================================================================\n"
87  << std::flush;
88  std::cout << " The following " << theMaskAtModules.size()
89  << " AT modules have been masked out and will not be considered by the AT algorithm:\n " << std::flush;
90  for (std::vector<unsigned int>::iterator moduleIt = theMaskAtModules.begin(); moduleIt != theMaskAtModules.end();
91  ++moduleIt) {
92  std::cout << *moduleIt << (moduleIt != --theMaskAtModules.end() ? ", " : "") << std::flush;
93  }
94  std::cout << std::endl << std::flush;
95  std::cout << " ===============================================================================================\n\n"
96  << std::flush;
97  }
98 
99  // alias for the Branches in the root files
100  std::string alias(theConf.getParameter<std::string>("@module_label"));
101 
102  // declare the product to produce
103  produces<TkLasBeamCollection, edm::Transition::EndRun>("tkLaserBeams").setBranchAlias(alias + "TkLasBeamCollection");
104 
105  // switch judge's zero filter depending on cfg
107 
108  // set the upper threshold for zero suppressed data
110 }
111 
116  if (theSaveHistograms)
117  theFile->Write();
118  if (theFile) {
119  delete theFile;
120  }
121  if (theAlignableTracker) {
122  delete theAlignableTracker;
123  }
124 }
125 
130  // write sumed histograms to file (if selected in cfg)
131  if (theSaveHistograms) {
132  // creating a new file
133  theFile = new TFile(theFileName.c_str(), "RECREATE", "CMS ROOT file");
134 
135  // initialize the histograms
136  if (theFile) {
137  theFile->SetCompressionLevel(theCompression);
138  singleModulesDir = theFile->mkdir("single modules");
139  } else
140  throw cms::Exception(" [LaserAlignment::beginJob]")
141  << " ** ERROR: could not open file:" << theFileName.c_str() << " for writing." << std::endl;
142  }
143 
144  // detector id maps (hard coded)
145  fillDetectorId();
146 
147  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148  // PROFILE, HISTOGRAM & FITFUNCTION INITIALIZATION
149  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150 
151  // object used to build various strings for names and labels
152  std::stringstream nameBuilder;
153 
154  // loop variables for use with LASGlobalLoop object
155  int det, ring, beam, disk, pos;
156 
157  // loop TEC modules
158  det = 0;
159  ring = 0;
160  beam = 0;
161  disk = 0;
162  do { // loop using LASGlobalLoop functionality
163  // init the profiles
167 
168  // init the hit maps
169  isAcceptedProfile.SetTECEntry(det, ring, beam, disk, 0);
171 
172  // create strings for histo names
173  nameBuilder.clear();
174  nameBuilder.str("");
175  nameBuilder << "TEC";
176  if (det == 0)
177  nameBuilder << "+";
178  else
179  nameBuilder << "-";
180  nameBuilder << "_Ring";
181  if (ring == 0)
182  nameBuilder << "4";
183  else
184  nameBuilder << "6";
185  nameBuilder << "_Beam" << beam;
186  nameBuilder << "_Disk" << disk;
187  theProfileNames.SetTECEntry(det, ring, beam, disk, nameBuilder.str());
188 
189  // init the histograms
190  if (theSaveHistograms) {
191  nameBuilder << "_Histo";
193  det, ring, beam, disk, new TH1D(nameBuilder.str().c_str(), nameBuilder.str().c_str(), 512, 0, 512));
194  summedHistograms.GetTECEntry(det, ring, beam, disk)->SetDirectory(singleModulesDir);
195  }
196 
197  } while (moduleLoop.TECLoop(det, ring, beam, disk));
198 
199  // TIB & TOB section
200  det = 2;
201  beam = 0;
202  pos = 0;
203  do { // loop using LASGlobalLoop functionality
204  // init the profiles
208 
209  // init the hit maps
212 
213  // create strings for histo names
214  nameBuilder.clear();
215  nameBuilder.str("");
216  if (det == 2)
217  nameBuilder << "TIB";
218  else
219  nameBuilder << "TOB";
220  nameBuilder << "_Beam" << beam;
221  nameBuilder << "_Zpos" << pos;
222 
223  theProfileNames.SetTIBTOBEntry(det, beam, pos, nameBuilder.str());
224 
225  // init the histograms
226  if (theSaveHistograms) {
227  nameBuilder << "_Histo";
229  det, beam, pos, new TH1D(nameBuilder.str().c_str(), nameBuilder.str().c_str(), 512, 0, 512));
231  }
232 
233  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
234 
235  // TEC2TEC AT section
236  det = 0;
237  beam = 0;
238  disk = 0;
239  do { // loop using LASGlobalLoop functionality
240  // init the profiles
244 
245  // init the hit maps
246  isAcceptedProfile.SetTEC2TECEntry(det, beam, disk, 0);
248 
249  // create strings for histo names
250  nameBuilder.clear();
251  nameBuilder.str("");
252  nameBuilder << "TEC(AT)";
253  if (det == 0)
254  nameBuilder << "+";
255  else
256  nameBuilder << "-";
257  nameBuilder << "_Beam" << beam;
258  nameBuilder << "_Disk" << disk;
259  theProfileNames.SetTEC2TECEntry(det, beam, disk, nameBuilder.str());
260 
261  // init the histograms
262  if (theSaveHistograms) {
263  nameBuilder << "_Histo";
265  det, beam, disk, new TH1D(nameBuilder.str().c_str(), nameBuilder.str().c_str(), 512, 0, 512));
266  summedHistograms.GetTEC2TECEntry(det, beam, disk)->SetDirectory(singleModulesDir);
267  }
268 
269  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
270 
271  firstEvent_ = true;
272 }
273 
277 void LaserAlignment::produce(edm::Event& theEvent, edm::EventSetup const& theSetup) {
278  if (firstEvent_) {
279  //Retrieve tracker topology from geometry
280  const TrackerTopology* const tTopo = &theSetup.getData(topoToken_);
281 
282  // access the tracker
283  gD = theSetup.getHandle(geomDetToken_);
285 
286  // access pedestals (from db..) if desired
287  edm::ESHandle<SiStripPedestals> pedestalsHandle;
289  pedestalsHandle = theSetup.getHandle(stripPedestalsToken_);
290  fillPedestalProfiles(pedestalsHandle);
291  }
292 
293  // global positions
295 
296  // select the reference geometry
298  // the AlignableTracker object is initialized with the ideal geometry
299  const GeometricDet* theGeometricDet = &theSetup.getData(geomDetToken_);
300  const PTrackerParameters* ptp = &theSetup.getData(ptpToken_);
301 
302  TrackerGeomBuilderFromGeometricDet trackerBuilder;
303  TrackerGeometry* theRefTracker = trackerBuilder.build(&*theGeometricDet, *ptp, tTopo);
304 
305  theAlignableTracker = new AlignableTracker(&(*theRefTracker), tTopo);
306  } else {
307  // the AlignableTracker object is initialized with the input geometry from DB
309  }
310 
311  firstEvent_ = false;
312  }
313 
314  LogDebug("LaserAlignment") << "==========================================================="
315  << "\n Private analysis of event #" << theEvent.id().event() << " in run #"
316  << theEvent.id().run();
317 
318  // do the Tracker Statistics to retrieve the current profiles
319  fillDataProfiles(theEvent, theSetup);
320 
321  // index variables for the LASGlobalLoop object
322  int det, ring, beam, disk, pos;
323 
324  //
325  // first pre-loop on selected entries to find out
326  // whether the TEC or the AT beams have fired
327  // (pedestal profiles are left empty if false in cfg)
328  //
329 
330  // TEC+- (only ring 6)
331  ring = 1;
332  for (det = 0; det < 2; ++det) {
333  for (beam = 0; beam < 8; ++beam) {
334  for (disk = 0; disk < 9; ++disk) {
336  pedestalProfiles.GetTECEntry(det, ring, beam, disk),
337  0)) {
338  isAcceptedProfile.SetTECEntry(det, ring, beam, disk, 1);
339  } else { // assume no initialization
340  isAcceptedProfile.SetTECEntry(det, ring, beam, disk, 0);
341  }
342  }
343  }
344  }
345 
346  // TIBTOB
347  det = 2;
348  beam = 0;
349  pos = 0;
350  do {
351  // add current event's data and subtract pedestals
352  if (judge.IsSignalIn(
356  } else { // dto.
358  }
359 
360  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
361 
362  // now come the beam finders
363  bool isTECMode = isTECBeam();
364  // LogDebug( " [LaserAlignment::produce]" ) << "LaserAlignment::isTECBeam declares this event " << ( isTECMode ? "" : "NOT " ) << "a TEC event." << std::endl;
365  std::cout << " [LaserAlignment::produce] -- LaserAlignment::isTECBeam declares this event "
366  << (isTECMode ? "" : "NOT ") << "a TEC event." << std::endl;
367 
368  bool isATMode = isATBeam();
369  // LogDebug( " [LaserAlignment::produce]" ) << "LaserAlignment::isATBeam declares this event " << ( isATMode ? "" : "NOT " ) << "an AT event." << std::endl;
370  std::cout << " [LaserAlignment::produce] -- LaserAlignment::isATBeam declares this event " << (isATMode ? "" : "NOT ")
371  << "an AT event." << std::endl;
372 
373  //
374  // now pass the pedestal subtracted profiles to the judge
375  // if they're accepted, add them on the collectedDataProfiles
376  // (pedestal profiles are left empty if false in cfg)
377  //
378 
379  // loop TEC+- modules
380  det = 0;
381  ring = 0;
382  beam = 0;
383  disk = 0;
384  do {
385  LogDebug("[LaserAlignment::produce]")
386  << "Profile is: " << theProfileNames.GetTECEntry(det, ring, beam, disk) << "." << std::endl;
387 
388  // this now depends on the AT/TEC mode, is this a doubly hit module? -> look for it in vector<int> tecDoubleHitDetId
389  // (ring == 0 not necessary but makes it a little faster)
390  if (ring == 0 &&
391  find(tecDoubleHitDetId.begin(), tecDoubleHitDetId.end(), detectorId.GetTECEntry(det, ring, beam, disk)) !=
392  tecDoubleHitDetId.end()) {
393  if (isTECMode) { // add profile to TEC collection
394  // add current event's data and subtract pedestals
396  pedestalProfiles.GetTECEntry(det, ring, beam, disk),
397  0)) {
400  pedestalProfiles.GetTECEntry(det, ring, beam, disk);
402  }
403  }
404  }
405 
406  else { // not a doubly hit module, don't care about the mode
407  // add current event's data and subtract pedestals
409  pedestalProfiles.GetTECEntry(det, ring, beam, disk),
410  0)) {
413  pedestalProfiles.GetTECEntry(det, ring, beam, disk);
415  }
416  }
417 
418  } while (moduleLoop.TECLoop(det, ring, beam, disk));
419 
420  // loop TIB/TOB modules
421  det = 2;
422  beam = 0;
423  pos = 0;
424  do {
425  LogDebug("[LaserAlignment::produce]")
426  << "Profile is: " << theProfileNames.GetTIBTOBEntry(det, beam, pos) << "." << std::endl;
427 
428  // add current event's data and subtract pedestals
429  if (judge.JudgeProfile(
435  }
436 
437  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
438 
439  // loop TEC2TEC modules
440  det = 0;
441  beam = 0;
442  disk = 0;
443  do {
444  LogDebug("[LaserAlignment::produce]")
445  << "Profile is: " << theProfileNames.GetTEC2TECEntry(det, beam, disk) << "." << std::endl;
446 
447  // this again depends on the AT/TEC mode, is this a doubly hit module?
448  // (ring == 0 not necessary but makes it a little faster)
449  if (ring == 0 &&
450  find(tecDoubleHitDetId.begin(), tecDoubleHitDetId.end(), detectorId.GetTECEntry(det, ring, beam, disk)) !=
451  tecDoubleHitDetId.end()) {
452  if (isATMode) { // add profile to TEC2TEC collection
453  // add current event's data and subtract pedestals
456  0)) {
460  }
461  }
462 
463  }
464 
465  else { // not a doubly hit module, don't care about the mode
466  // add current event's data and subtract pedestals
467  if (judge.JudgeProfile(
469  0)) {
473  }
474  }
475 
476  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
477 
478  // total event number counter
479  theEvents++;
480 }
481 
486  std::cout << " [LaserAlignment::endRun] -- Total number of events processed: " << theEvents << std::endl;
487 
488  // for debugging only..
490 
491  // index variables for the LASGlobalLoop objects
492  int det, ring, beam, disk, pos;
493 
494  // measured positions container for the algorithms
495  LASGlobalData<LASCoordinateSet> measuredCoordinates;
496 
497  // fitted peak positions in units of strips (pair for value,error)
498  LASGlobalData<std::pair<float, float> > measuredStripPositions;
499 
500  // the peak finder, a pair (pos/posErr in units of strips) for its results, and the success confirmation
501  LASPeakFinder peakFinder;
503  std::pair<double, double> peakFinderResults;
504  bool isGoodFit;
505 
506  // tracker geom. object for calculating the global beam positions
507  const TrackerGeometry& theTracker(*theTrackerGeometry);
508 
509  // fill LASGlobalData<LASCoordinateSet> nominalCoordinates
511 
512  // for determining the phi errors
513  // ErrorFrameTransformer errorTransformer; // later...
514 
515  // do the fits for TEC+- internal
516  det = 0;
517  ring = 0;
518  beam = 0;
519  disk = 0;
520  do {
521  // do the fit
522  isGoodFit = peakFinder.FindPeakIn(collectedDataProfiles.GetTECEntry(det, ring, beam, disk),
523  peakFinderResults,
524  summedHistograms.GetTECEntry(det, ring, beam, disk),
525  0); // offset is 0 for TEC
526 
527  // now we have the measured positions in units of strips.
528  if (!isGoodFit)
529  std::cout << " [LaserAlignment::endRun] ** WARNING: Fit failed for TEC det: " << det << ", ring: " << ring
530  << ", beam: " << beam << ", disk: " << disk << " (id: " << detectorId.GetTECEntry(det, ring, beam, disk)
531  << ")." << std::endl;
532 
533  // <- here we will later implement the kink corrections
534 
535  // access the tracker geometry for this module
536  const DetId theDetId(detectorId.GetTECEntry(det, ring, beam, disk));
537  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
538 
539  if (theStripDet) {
540  // first, set the measured coordinates to their nominal values
541  measuredCoordinates.SetTECEntry(det, ring, beam, disk, nominalCoordinates.GetTECEntry(det, ring, beam, disk));
542 
543  if (isGoodFit) { // convert strip position to global phi and replace the nominal phi value/error
544 
545  measuredStripPositions.GetTECEntry(det, ring, beam, disk) = peakFinderResults;
546  const float positionInStrips =
548  ? 256.
549  : peakFinderResults.first; // implementation of "ForceFitterToNominalStrips" config parameter
550  const GlobalPoint& globalPoint =
551  theStripDet->surface().toGlobal(theStripDet->specificTopology().localPosition(positionInStrips));
552  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhi(ConvertAngle(globalPoint.barePhi()));
553 
554  // const GlobalError& globalError = errorTransformer.transform( theStripDet->specificTopology().localError( peakFinderResults.first, pow( peakFinderResults.second, 2 ) ), theStripDet->surface() );
555  // measuredCoordinates.GetTECEntry( det, ring, beam, disk ).SetPhiError( globalError.phierr( globalPoint ) );
556  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhiError(0.00046); // PRELIMINARY ESTIMATE
557 
558  } else { // keep nominal position (middle-of-module) but set a giant phi error so that the module can be ignored by the alignment algorithm
559  measuredStripPositions.GetTECEntry(det, ring, beam, disk) = std::pair<float, float>(256., 1000.);
560  const GlobalPoint& globalPoint =
561  theStripDet->surface().toGlobal(theStripDet->specificTopology().localPosition(256.));
562  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhi(ConvertAngle(globalPoint.barePhi()));
563  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhiError(1000.);
564  }
565  }
566 
567  } while (moduleLoop.TECLoop(det, ring, beam, disk));
568 
569  // do the fits for TIB/TOB
570  det = 2;
571  beam = 0;
572  pos = 0;
573  do {
574  // do the fit
575  isGoodFit = peakFinder.FindPeakIn(collectedDataProfiles.GetTIBTOBEntry(det, beam, pos),
576  peakFinderResults,
579 
580  // now we have the measured positions in units of strips.
581  if (!isGoodFit)
582  std::cout << " [LaserAlignment::endJob] ** WARNING: Fit failed for TIB/TOB det: " << det << ", beam: " << beam
583  << ", pos: " << pos << " (id: " << detectorId.GetTIBTOBEntry(det, beam, pos) << ")." << std::endl;
584 
585  // <- here we will later implement the kink corrections
586 
587  // access the tracker geometry for this module
588  const DetId theDetId(detectorId.GetTIBTOBEntry(det, beam, pos));
589  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
590 
591  if (theStripDet) {
592  // first, set the measured coordinates to their nominal values
593  measuredCoordinates.SetTIBTOBEntry(det, beam, pos, nominalCoordinates.GetTIBTOBEntry(det, beam, pos));
594 
595  if (isGoodFit) { // convert strip position to global phi and replace the nominal phi value/error
596  measuredStripPositions.GetTIBTOBEntry(det, beam, pos) = peakFinderResults;
597  const float positionInStrips =
599  ? 256. + getTIBTOBNominalBeamOffset(det, beam, pos)
600  : peakFinderResults.first; // implementation of "ForceFitterToNominalStrips" config parameter
601  const GlobalPoint& globalPoint =
602  theStripDet->surface().toGlobal(theStripDet->specificTopology().localPosition(positionInStrips));
603  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhi(ConvertAngle(globalPoint.barePhi()));
604  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhiError(0.00028); // PRELIMINARY ESTIMATE
605  } else { // keep nominal position but set a giant phi error so that the module can be ignored by the alignment algorithm
606  measuredStripPositions.GetTIBTOBEntry(det, beam, pos) =
607  std::pair<float, float>(256. + getTIBTOBNominalBeamOffset(det, beam, pos), 1000.);
608  const GlobalPoint& globalPoint = theStripDet->surface().toGlobal(
609  theStripDet->specificTopology().localPosition(256. + getTIBTOBNominalBeamOffset(det, beam, pos)));
610  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhi(ConvertAngle(globalPoint.barePhi()));
611  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhiError(1000.);
612  }
613  }
614 
615  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
616 
617  // do the fits for TEC AT
618  det = 0;
619  beam = 0;
620  disk = 0;
621  do {
622  // do the fit
623  isGoodFit = peakFinder.FindPeakIn(collectedDataProfiles.GetTEC2TECEntry(det, beam, disk),
624  peakFinderResults,
626  getTEC2TECNominalBeamOffset(det, beam, disk));
627  // now we have the positions in units of strips.
628  if (!isGoodFit)
629  std::cout << " [LaserAlignment::endRun] ** WARNING: Fit failed for TEC2TEC det: " << det << ", beam: " << beam
630  << ", disk: " << disk << " (id: " << detectorId.GetTEC2TECEntry(det, beam, disk) << ")." << std::endl;
631 
632  // <- here we will later implement the kink corrections
633 
634  // access the tracker geometry for this module
635  const DetId theDetId(detectorId.GetTEC2TECEntry(det, beam, disk));
636  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
637 
638  if (theStripDet) {
639  // first, set the measured coordinates to their nominal values
640  measuredCoordinates.SetTEC2TECEntry(det, beam, disk, nominalCoordinates.GetTEC2TECEntry(det, beam, disk));
641 
642  if (isGoodFit) { // convert strip position to global phi and replace the nominal phi value/error
643  measuredStripPositions.GetTEC2TECEntry(det, beam, disk) = peakFinderResults;
644  const float positionInStrips =
646  ? 256. + getTEC2TECNominalBeamOffset(det, beam, disk)
647  : peakFinderResults.first; // implementation of "ForceFitterToNominalStrips" config parameter
648  const GlobalPoint& globalPoint =
649  theStripDet->surface().toGlobal(theStripDet->specificTopology().localPosition(positionInStrips));
650  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhi(ConvertAngle(globalPoint.barePhi()));
651  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhiError(0.00047); // PRELIMINARY ESTIMATE
652  } else { // keep nominal position but set a giant phi error so that the module can be ignored by the alignment algorithm
653  measuredStripPositions.GetTEC2TECEntry(det, beam, disk) =
654  std::pair<float, float>(256. + getTEC2TECNominalBeamOffset(det, beam, disk), 1000.);
655  const GlobalPoint& globalPoint = theStripDet->surface().toGlobal(
656  theStripDet->specificTopology().localPosition(256. + getTEC2TECNominalBeamOffset(det, beam, disk)));
657  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhi(ConvertAngle(globalPoint.barePhi()));
658  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhiError(1000.);
659  }
660  }
661 
662  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
663 
664  // see what we got (for debugging)
665  // DumpStripFileSet( measuredStripPositions );
666  // DumpPosFileSet( measuredCoordinates );
667 
668  // CALCULATE PARAMETERS AND UPDATE DB OBJECT
669  // for beam kink corrections, reconstructing the geometry and updating the db object
671 
672  // apply all beam corrections
674  geometryUpdater.ApplyBeamKinkCorrections(measuredCoordinates);
675 
676  // if we start with input geometry instead of IDEAL,
677  // reverse the adjustments in the AlignableTracker object
679  geometryUpdater.SetReverseDirection(true);
680 
681  // if we have "virtual" misalignment which is introduced via the reference geometry,
682  // tell the LASGeometryUpdater to reverse x & y adjustments
684  geometryUpdater.SetMisalignmentFromRefGeometry(true);
685 
686  // run the endcap algorithm
687  LASEndcapAlgorithm endcapAlgorithm;
688  LASEndcapAlignmentParameterSet endcapParameters;
689 
690  // this basically sets all the endcap modules to be masked
691  // to their nominal positions (since endcapParameters is overall zero)
692  if (!theMaskTecModules.empty()) {
693  ApplyEndcapMaskingCorrections(measuredCoordinates, nominalCoordinates, endcapParameters);
694  }
695 
696  // run the algorithm
697  endcapParameters = endcapAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
698 
699  //
700  // loop to mask out events
701  // DESCRIPTION:
702  //
703 
704  // do this only if there are modules to be masked..
705  if (!theMaskTecModules.empty()) {
706  const unsigned int nIterations = 30;
707  for (unsigned int iteration = 0; iteration < nIterations; ++iteration) {
708  // set the endcap modules to be masked to their positions
709  // according to the reconstructed parameters
710  ApplyEndcapMaskingCorrections(measuredCoordinates, nominalCoordinates, endcapParameters);
711 
712  // modifications applied, so re-run the algorithm
713  endcapParameters = endcapAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
714  }
715  }
716 
717  // these are now final, so:
718  endcapParameters.Print();
719 
720  // do a pre-alignment of the endcaps (TEC2TEC only)
721  // so that the alignment tube algorithms finds orderly disks
722  geometryUpdater.EndcapUpdate(endcapParameters, measuredCoordinates);
723 
724  // the alignment tube algorithms, choose from config
725  LASBarrelAlignmentParameterSet alignmentTubeParameters;
726  // the MINUIT-BASED alignment tube algorithm
727  LASBarrelAlgorithm barrelAlgorithm;
728  // the ANALYTICAL alignment tube algorithm
729  LASAlignmentTubeAlgorithm alignmentTubeAlgorithm;
730 
731  // this basically sets all the modules to be masked
732  // to their nominal positions (since alignmentTubeParameters is overall zero)
733  if (!theMaskAtModules.empty()) {
734  ApplyATMaskingCorrections(measuredCoordinates, nominalCoordinates, alignmentTubeParameters);
735  }
736 
737  if (theUseMinuitAlgorithm) {
738  // run the MINUIT-BASED alignment tube algorithm
739  alignmentTubeParameters = barrelAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
740  } else {
741  // the ANALYTICAL alignment tube algorithm
742  alignmentTubeParameters = alignmentTubeAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
743  }
744 
745  //
746  // loop to mask out events
747  // DESCRIPTION:
748  //
749 
750  // do this only if there are modules to be masked..
751  if (!theMaskAtModules.empty()) {
752  const unsigned int nIterations = 30;
753  for (unsigned int iteration = 0; iteration < nIterations; ++iteration) {
754  // set the AT modules to be masked to their positions
755  // according to the reconstructed parameters
756  ApplyATMaskingCorrections(measuredCoordinates, nominalCoordinates, alignmentTubeParameters);
757 
758  // modifications applied, so re-run the algorithm
759  if (theUseMinuitAlgorithm) {
760  alignmentTubeParameters = barrelAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
761  } else {
762  alignmentTubeParameters = alignmentTubeAlgorithm.CalculateParameters(measuredCoordinates, nominalCoordinates);
763  }
764  }
765  }
766 
767  // these are now final, so:
768  alignmentTubeParameters.Print();
769 
770  // combine the results and update the db object
771  geometryUpdater.TrackerUpdate(endcapParameters, alignmentTubeParameters, *theAlignableTracker);
772 
777 
778  // the collection container
779  auto laserBeams = std::make_unique<TkLasBeamCollection>();
780 
781  // first for the endcap internal beams
782  for (det = 0; det < 2; ++det) {
783  for (ring = 0; ring < 2; ++ring) {
784  for (beam = 0; beam < 8; ++beam) {
785  // the beam and its identifier (see TkLasTrackBasedInterface TWiki)
786  TkLasBeam currentBeam(100 * det + 10 * beam + ring);
787 
788  // order the hits in the beam by increasing z
789  const int firstDisk = det == 0 ? 0 : 8;
790  const int lastDisk = det == 0 ? 8 : 0;
791 
792  // count upwards or downwards
793  for (disk = firstDisk; det == 0 ? disk <= lastDisk : disk >= lastDisk; det == 0 ? ++disk : --disk) {
794  // detId for the SiStripLaserRecHit2D
795  const SiStripDetId theDetId(detectorId.GetTECEntry(det, ring, beam, disk));
796 
797  // need this to calculate the localPosition and its error
798  const StripGeomDetUnit* const theStripDet =
799  dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
800 
801  // the hit container
802  const SiStripLaserRecHit2D currentHit(theStripDet->specificTopology().localPosition(
803  measuredStripPositions.GetTECEntry(det, ring, beam, disk).first),
804  theStripDet->specificTopology().localError(
805  measuredStripPositions.GetTECEntry(det, ring, beam, disk).first,
806  measuredStripPositions.GetTECEntry(det, ring, beam, disk).second),
807  theDetId);
808 
809  currentBeam.push_back(currentHit);
810  }
811 
812  laserBeams->push_back(currentBeam);
813  }
814  }
815  }
816 
817  // then, following the convention in TkLasTrackBasedInterface TWiki, the alignment tube beams;
818  // they comprise hits in TIBTOB & TEC2TEC
819 
820  for (beam = 0; beam < 8; ++beam) {
821  // the beam and its identifier (see TkLasTrackBasedInterface TWiki)
822  TkLasBeam currentBeam(100 * 2 /*beamGroup=AT=2*/ + 10 * beam + 0 /*ring=0*/);
823 
824  // first: tec-
825  det = 1;
826  for (disk = 4; disk >= 0; --disk) {
827  // detId for the SiStripLaserRecHit2D
828  const SiStripDetId theDetId(detectorId.GetTEC2TECEntry(det, beam, disk));
829 
830  // need this to calculate the localPosition and its error
831  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
832 
833  // the hit container
834  const SiStripLaserRecHit2D currentHit(
835  theStripDet->specificTopology().localPosition(measuredStripPositions.GetTEC2TECEntry(det, beam, disk).first),
836  theStripDet->specificTopology().localError(measuredStripPositions.GetTEC2TECEntry(det, beam, disk).first,
837  measuredStripPositions.GetTEC2TECEntry(det, beam, disk).second),
838  theDetId);
839 
840  currentBeam.push_back(currentHit);
841  }
842 
843  // now TIB and TOB in one go
844  for (det = 2; det < 4; ++det) {
845  for (pos = 5; pos >= 0; --pos) { // stupidly, pos is defined from +z to -z in LASGlobalLoop
846 
847  // detId for the SiStripLaserRecHit2D
848  const SiStripDetId theDetId(detectorId.GetTIBTOBEntry(det, beam, pos));
849 
850  // need this to calculate the localPosition and its error
851  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
852 
853  // the hit container
854  const SiStripLaserRecHit2D currentHit(
855  theStripDet->specificTopology().localPosition(measuredStripPositions.GetTIBTOBEntry(det, beam, pos).first),
856  theStripDet->specificTopology().localError(measuredStripPositions.GetTIBTOBEntry(det, beam, pos).first,
857  measuredStripPositions.GetTIBTOBEntry(det, beam, pos).second),
858  theDetId);
859 
860  currentBeam.push_back(currentHit);
861  }
862  }
863 
864  // then: tec+
865  det = 0;
866  for (disk = 0; disk < 5; ++disk) {
867  // detId for the SiStripLaserRecHit2D
868  const SiStripDetId theDetId(detectorId.GetTEC2TECEntry(det, beam, disk));
869 
870  // need this to calculate the localPosition and its error
871  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
872 
873  // the hit container
874  const SiStripLaserRecHit2D currentHit(
875  theStripDet->specificTopology().localPosition(measuredStripPositions.GetTEC2TECEntry(det, beam, disk).first),
876  theStripDet->specificTopology().localError(measuredStripPositions.GetTEC2TECEntry(det, beam, disk).first,
877  measuredStripPositions.GetTEC2TECEntry(det, beam, disk).second),
878  theDetId);
879 
880  currentBeam.push_back(currentHit);
881  }
882 
883  // save this beam to the beamCollection
884  laserBeams->push_back(currentBeam);
885 
886  } // (close beam loop)
887 
888  // now attach the collection to the run
889  theRun.put(std::move(laserBeams), "tkLaserBeams");
890 
891  // store the estimated alignment parameters into the DB
892  // first get them
893  Alignments* alignments = theAlignableTracker->alignments();
895 
896  if (theStoreToDB) {
897  std::cout << " [LaserAlignment::endRun] -- Storing the calculated alignment parameters to the DataBase:"
898  << std::endl;
899 
900  // Call service
902  if (!poolDbService.isAvailable()) // Die if not available
903  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
904 
905  // Store
906 
907  // if ( poolDbService->isNewTagRequest(theAlignRecordName) ) {
908  // poolDbService->createNewIOV<Alignments>( alignments, poolDbService->currentTime(), poolDbService->endOfTime(), theAlignRecordName );
909  // }
910  // else {
911  // poolDbService->appendSinceTime<Alignments>( alignments, poolDbService->currentTime(), theAlignRecordName );
912  // }
913  poolDbService->writeOne<Alignments>(alignments, poolDbService->beginOfTime(), theAlignRecordName);
914 
915  // if ( poolDbService->isNewTagRequest(theErrorRecordName) ) {
916  // poolDbService->createNewIOV<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), poolDbService->endOfTime(), theErrorRecordName );
917  // }
918  // else {
919  // poolDbService->appendSinceTime<AlignmentErrorsExtended>( alignmentErrors, poolDbService->currentTime(), theErrorRecordName );
920  // }
921  poolDbService->writeOne<AlignmentErrorsExtended>(alignmentErrors, poolDbService->beginOfTime(), theErrorRecordName);
922 
923  std::cout << " [LaserAlignment::endRun] -- Storing done." << std::endl;
924  }
925 }
926 
931 
936 void LaserAlignment::fillDataProfiles(edm::Event const& theEvent, edm::EventSetup const& theSetup) {
937  // two handles for the two different kinds of digis
940 
941  bool isRawDigi = false;
942 
943  // indices for the LASGlobalLoop object
944  int det = 0, ring = 0, beam = 0, disk = 0, pos = 0;
945 
946  // query config set and loop over all PSets in the VPSet
947  for (std::vector<edm::ParameterSet>::iterator itDigiProducersList = theDigiProducersList.begin();
948  itDigiProducersList != theDigiProducersList.end();
949  ++itDigiProducersList) {
950  std::string digiProducer = itDigiProducersList->getParameter<std::string>("DigiProducer");
951  std::string digiLabel = itDigiProducersList->getParameter<std::string>("DigiLabel");
952  std::string digiType = itDigiProducersList->getParameter<std::string>("DigiType");
953 
954  // now branch according to digi type (raw or processed);
955  // first we go for raw digis => SiStripRawDigi
956  if (digiType == "Raw") {
957  theEvent.getByLabel(digiProducer, digiLabel, theStripRawDigis);
958  isRawDigi = true;
959  } else if (digiType == "Processed") {
960  theEvent.getByLabel(digiProducer, digiLabel, theStripDigis);
961  isRawDigi = false;
962  } else {
963  throw cms::Exception(" [LaserAlignment::fillDataProfiles]")
964  << " ** ERROR: Invalid digi type: \"" << digiType << "\" specified in configuration." << std::endl;
965  }
966 
967  // loop TEC internal modules
968  det = 0;
969  ring = 0;
970  beam = 0;
971  disk = 0;
972  do {
973  // first clear the profile
975 
976  // retrieve the raw id of that module
977  const int detRawId = detectorId.GetTECEntry(det, ring, beam, disk);
978 
979  if (isRawDigi) { // we have raw SiStripRawDigis
980 
981  // search the digis for the raw id
982  edm::DetSetVector<SiStripRawDigi>::const_iterator detSetIter = theStripRawDigis->find(detRawId);
983  if (detSetIter == theStripRawDigis->end()) {
984  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
985  << " ** ERROR: No raw DetSet found for det: " << detRawId << "." << std::endl;
986  }
987 
988  // fill the digis to the profiles
989  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
990  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeStart = digiRangeIterator; // save starting positions
991 
992  // loop all digis
993  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
994  const SiStripRawDigi& digi = *digiRangeIterator;
995  const int channel = distance(digiRangeStart, digiRangeIterator);
996  if (channel >= 0 && channel < 512)
997  currentDataProfiles.GetTECEntry(det, ring, beam, disk).SetValue(channel, digi.adc());
998  else
999  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1000  << " ** ERROR: raw digi channel: " << channel << " out of range for det: " << detRawId << "."
1001  << std::endl;
1002  }
1003 
1004  }
1005 
1006  else { // we have zero suppressed SiStripDigis
1007 
1008  // search the digis for the raw id
1009  edm::DetSetVector<SiStripDigi>::const_iterator detSetIter = theStripDigis->find(detRawId);
1010 
1011  // processed DetSets may be missing, just skip
1012  if (detSetIter == theStripDigis->end())
1013  continue;
1014 
1015  // fill the digis to the profiles
1016  edm::DetSet<SiStripDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
1017 
1018  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
1019  const SiStripDigi& digi = *digiRangeIterator;
1020  if (digi.strip() < 512)
1021  currentDataProfiles.GetTECEntry(det, ring, beam, disk).SetValue(digi.strip(), digi.adc());
1022  else
1023  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1024  << " ** ERROR: digi strip: " << digi.strip() << " out of range for det: " << detRawId << "."
1025  << std::endl;
1026  }
1027  }
1028 
1029  } while (moduleLoop.TECLoop(det, ring, beam, disk));
1030 
1031  // loop TIBTOB modules
1032  det = 2;
1033  beam = 0;
1034  pos = 0;
1035  do {
1036  // first clear the profile
1038 
1039  // retrieve the raw id of that module
1040  const int detRawId = detectorId.GetTIBTOBEntry(det, beam, pos);
1041 
1042  if (isRawDigi) { // we have raw SiStripRawDigis
1043 
1044  // search the digis for the raw id
1045  edm::DetSetVector<SiStripRawDigi>::const_iterator detSetIter = theStripRawDigis->find(detRawId);
1046  if (detSetIter == theStripRawDigis->end()) {
1047  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1048  << " ** ERROR: No raw DetSet found for det: " << detRawId << "." << std::endl;
1049  }
1050 
1051  // fill the digis to the profiles
1052  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
1053  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeStart = digiRangeIterator; // save starting positions
1054 
1055  // loop all digis
1056  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
1057  const SiStripRawDigi& digi = *digiRangeIterator;
1058  const int channel = distance(digiRangeStart, digiRangeIterator);
1059  if (channel >= 0 && channel < 512)
1060  currentDataProfiles.GetTIBTOBEntry(det, beam, pos).SetValue(channel, digi.adc());
1061  else
1062  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1063  << " ** ERROR: raw digi channel: " << channel << " out of range for det: " << detRawId << "."
1064  << std::endl;
1065  }
1066 
1067  }
1068 
1069  else { // we have zero suppressed SiStripDigis
1070 
1071  // search the digis for the raw id
1072  edm::DetSetVector<SiStripDigi>::const_iterator detSetIter = theStripDigis->find(detRawId);
1073 
1074  // processed DetSets may be missing, just skip
1075  if (detSetIter == theStripDigis->end())
1076  continue;
1077 
1078  // fill the digis to the profiles
1079  edm::DetSet<SiStripDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
1080 
1081  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
1082  const SiStripDigi& digi = *digiRangeIterator;
1083  if (digi.strip() < 512)
1084  currentDataProfiles.GetTIBTOBEntry(det, beam, pos).SetValue(digi.strip(), digi.adc());
1085  else
1086  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1087  << " ** ERROR: digi strip: " << digi.strip() << " out of range for det: " << detRawId << "."
1088  << std::endl;
1089  }
1090  }
1091 
1092  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1093 
1094  // loop TEC AT modules
1095  det = 0;
1096  beam = 0;
1097  disk = 0;
1098  do {
1099  // first clear the profile
1101 
1102  // retrieve the raw id of that module
1103  const int detRawId = detectorId.GetTEC2TECEntry(det, beam, disk);
1104 
1105  if (isRawDigi) { // we have raw SiStripRawDigis
1106 
1107  // search the digis for the raw id
1108  edm::DetSetVector<SiStripRawDigi>::const_iterator detSetIter = theStripRawDigis->find(detRawId);
1109  if (detSetIter == theStripRawDigis->end()) {
1110  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1111  << " ** ERROR: No raw DetSet found for det: " << detRawId << "." << std::endl;
1112  }
1113 
1114  // fill the digis to the profiles
1115  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
1116  edm::DetSet<SiStripRawDigi>::const_iterator digiRangeStart = digiRangeIterator; // save starting positions
1117 
1118  // loop all digis
1119  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
1120  const SiStripRawDigi& digi = *digiRangeIterator;
1121  const int channel = distance(digiRangeStart, digiRangeIterator);
1122  if (channel >= 0 && channel < 512)
1123  currentDataProfiles.GetTEC2TECEntry(det, beam, disk).SetValue(channel, digi.adc());
1124  else
1125  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1126  << " ** ERROR: raw digi channel: " << channel << " out of range for det: " << detRawId << "."
1127  << std::endl;
1128  }
1129 
1130  }
1131 
1132  else { // we have zero suppressed SiStripDigis
1133 
1134  // search the digis for the raw id
1135  edm::DetSetVector<SiStripDigi>::const_iterator detSetIter = theStripDigis->find(detRawId);
1136 
1137  // processed DetSets may be missing, just skip
1138  if (detSetIter == theStripDigis->end())
1139  continue;
1140 
1141  // fill the digis to the profiles
1142  edm::DetSet<SiStripDigi>::const_iterator digiRangeIterator = detSetIter->data.begin(); // for the loop
1143 
1144  for (; digiRangeIterator != detSetIter->data.end(); ++digiRangeIterator) {
1145  const SiStripDigi& digi = *digiRangeIterator;
1146  if (digi.strip() < 512)
1147  currentDataProfiles.GetTEC2TECEntry(det, beam, disk).SetValue(digi.strip(), digi.adc());
1148  else
1149  throw cms::Exception("[Laser Alignment::fillDataProfiles]")
1150  << " ** ERROR: digi strip: " << digi.strip() << " out of range for det: " << detRawId << "."
1151  << std::endl;
1152  }
1153  }
1154 
1155  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
1156 
1157  } // theDigiProducersList loop
1158 }
1159 
1169  int det, ring, beam, disk, pos;
1170 
1171  // loop TEC modules (yet without AT)
1172  det = 0;
1173  ring = 0;
1174  beam = 0;
1175  disk = 0;
1176  do { // loop using LASGlobalLoop functionality
1177  SiStripPedestals::Range pedRange = pedestalsHandle->getRange(detectorId.GetTECEntry(det, ring, beam, disk));
1178  for (int strip = 0; strip < 512; ++strip) {
1179  int thePedestal = int(pedestalsHandle->getPed(strip, pedRange));
1180  if (thePedestal > 895)
1181  thePedestal -= 1024;
1182  pedestalProfiles.GetTECEntry(det, ring, beam, disk).SetValue(strip, thePedestal);
1183  }
1184  } while (moduleLoop.TECLoop(det, ring, beam, disk));
1185 
1186  // TIB & TOB section
1187  det = 2;
1188  beam = 0;
1189  pos = 0;
1190  do { // loop using LASGlobalLoop functionality
1191  SiStripPedestals::Range pedRange = pedestalsHandle->getRange(detectorId.GetTIBTOBEntry(det, beam, pos));
1192  for (int strip = 0; strip < 512; ++strip) {
1193  int thePedestal = int(pedestalsHandle->getPed(strip, pedRange));
1194  if (thePedestal > 895)
1195  thePedestal -= 1024;
1196  pedestalProfiles.GetTIBTOBEntry(det, beam, pos).SetValue(strip, thePedestal);
1197  }
1198  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1199 
1200  // TEC2TEC AT section
1201  det = 0;
1202  beam = 0;
1203  disk = 0;
1204  do { // loop using LASGlobalLoop functionality
1205  SiStripPedestals::Range pedRange = pedestalsHandle->getRange(detectorId.GetTEC2TECEntry(det, beam, disk));
1206  for (int strip = 0; strip < 512; ++strip) {
1207  int thePedestal = int(pedestalsHandle->getPed(strip, pedRange));
1208  if (thePedestal > 895)
1209  thePedestal -= 1024;
1210  pedestalProfiles.GetTEC2TECEntry(det, beam, disk).SetValue(strip, thePedestal);
1211  }
1212  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
1213 }
1214 
1221  int numberOfProfiles = 0;
1222 
1223  int ring = 1; // search all ring6 modules for signals
1224  for (int det = 0; det < 2; ++det) {
1225  for (int beam = 0; beam < 8; ++beam) {
1226  for (int disk = 0; disk < 9; ++disk) {
1227  if (isAcceptedProfile.GetTECEntry(det, ring, beam, disk) == 1)
1228  numberOfProfiles++;
1229  }
1230  }
1231  }
1232 
1233  LogDebug("[LaserAlignment::isTECBeam]") << " Found: " << numberOfProfiles << "hits." << std::endl;
1234  std::cout << " [LaserAlignment::isTECBeam] -- Found: " << numberOfProfiles << " hits." << std::endl;
1235 
1236  if (numberOfProfiles > 10)
1237  return (true);
1238  return (false);
1239 }
1240 
1246 
1248  int numberOfProfiles = 0;
1249 
1250  int det = 2;
1251  int beam = 0;
1252  int pos = 0; // search all TIB/TOB for signals
1253  do {
1254  if (isAcceptedProfile.GetTIBTOBEntry(det, beam, pos) == 1)
1255  numberOfProfiles++;
1256  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1257 
1258  LogDebug("[LaserAlignment::isATBeam]") << " Found: " << numberOfProfiles << "hits." << std::endl;
1259  std::cout << " [LaserAlignment::isATBeam] -- Found: " << numberOfProfiles << " hits." << std::endl;
1260 
1261  if (numberOfProfiles > 10)
1262  return (true);
1263  return (false);
1264 }
1265 
1274 double LaserAlignment::getTIBTOBNominalBeamOffset(unsigned int det, unsigned int beam, unsigned int pos) {
1275  if (det < 2 || det > 3 || beam > 7 || pos > 5) {
1276  throw cms::Exception("[LaserAlignment::getTIBTOBNominalBeamOffset]")
1277  << " ERROR ** Called with nonexisting parameter set: det " << det << " beam " << beam << " pos " << pos << "."
1278  << std::endl;
1279  }
1280 
1281  const double nominalOffsetsTIB[8] = {
1282  0.00035, 2.10687, -2.10827, -0.00173446, 2.10072, -0.00135114, 2.10105, -2.10401};
1283 
1284  // in tob, modules have alternating orientations along the rods.
1285  // this is described by the following pattern.
1286  // (even more confusing, this pattern is inversed for beams 0, 5, 6, 7)
1287  const int orientationPattern[6] = {-1, 1, 1, -1, -1, 1};
1288  const double nominalOffsetsTOB[8] = {0.00217408, 1.58678, 117.733, 119.321, 120.906, 119.328, 117.743, 1.58947};
1289 
1290  if (det == 2)
1291  return (-1. * nominalOffsetsTIB[beam]);
1292 
1293  else {
1294  if (beam == 0 or beam > 4)
1295  return (nominalOffsetsTOB[beam] * orientationPattern[pos]);
1296  else
1297  return (-1. * nominalOffsetsTOB[beam] * orientationPattern[pos]);
1298  }
1299 }
1300 
1309 double LaserAlignment::getTEC2TECNominalBeamOffset(unsigned int det, unsigned int beam, unsigned int disk) {
1310  if (det > 1 || beam > 7 || disk > 5) {
1311  throw cms::Exception("[LaserAlignment::getTEC2TECNominalBeamOffset]")
1312  << " ERROR ** Called with nonexisting parameter set: det " << det << " beam " << beam << " disk " << disk << "."
1313  << std::endl;
1314  }
1315 
1316  const double nominalOffsets[8] = {0., 2.220, -2.221, 0., 2.214, 0., 2.214, -2.217};
1317 
1318  if (det == 0)
1319  return -1. * nominalOffsets[beam];
1320  else
1321  return nominalOffsets[beam];
1322 }
1323 
1328  //
1329  // hard coded data yet...
1330  //
1331 
1332  // nominal phi values of tec beam / alignment tube hits (parameter is beam 0-7)
1333  const double tecPhiPositions[8] = {
1334  0.392699, 1.178097, 1.963495, 2.748894, 3.534292, 4.319690, 5.105088, 5.890486}; // new values calculated by maple
1335  const double atPhiPositions[8] = {
1336  0.392699, 1.289799, 1.851794, 2.748894, 3.645995, 4.319690, 5.216791, 5.778784}; // new values calculated by maple
1337 
1338  // nominal r values (mm) of hits
1339  const double tobRPosition = 600.;
1340  const double tibRPosition = 514.;
1341  const double tecRPosition[2] = {564., 840.}; // ring 4,6
1342 
1343  // nominal z values (mm) of hits in barrel (parameter is pos 0-6)
1344  const double tobZPosition[6] = {1040., 580., 220., -140., -500., -860.};
1345  const double tibZPosition[6] = {620., 380., 180., -100., -340., -540.};
1346 
1347  // nominal z values (mm) of hits in tec (parameter is disk 0-8); FOR TEC-: (* -1.)
1348  const double tecZPosition[9] = {1322.5, 1462.5, 1602.5, 1742.5, 1882.5, 2057.5, 2247.5, 2452.5, 2667.5};
1349 
1350  //
1351  // now we fill these into the nominalCoordinates container;
1352  // errors are zero for nominal values..
1353  //
1354 
1355  // loop object and its variables
1357  int det, ring, beam, disk, pos;
1358 
1359  // TEC+- section
1360  det = 0;
1361  ring = 0, beam = 0;
1362  disk = 0;
1363  do {
1364  if (det == 0) { // this is TEC+
1366  det,
1367  ring,
1368  beam,
1369  disk,
1370  LASCoordinateSet(tecPhiPositions[beam], 0., tecRPosition[ring], 0., tecZPosition[disk], 0.));
1371  } else { // now TEC-
1373  det,
1374  ring,
1375  beam,
1376  disk,
1378  tecPhiPositions[beam], 0., tecRPosition[ring], 0., -1. * tecZPosition[disk], 0.)); // just * -1.
1379  }
1380 
1381  } while (moduleLoop.TECLoop(det, ring, beam, disk));
1382 
1383  // TIB & TOB section
1384  det = 2;
1385  beam = 0;
1386  pos = 0;
1387  do {
1388  if (det == 2) { // this is TIB
1390  det, beam, pos, LASCoordinateSet(atPhiPositions[beam], 0., tibRPosition, 0., tibZPosition[pos], 0.));
1391  } else { // now TOB
1393  det, beam, pos, LASCoordinateSet(atPhiPositions[beam], 0., tobRPosition, 0., tobZPosition[pos], 0.));
1394  }
1395 
1396  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1397 
1398  // TEC2TEC AT section
1399  det = 0;
1400  beam = 0;
1401  disk = 0;
1402  do {
1403  if (det == 0) { // this is TEC+, ring4 only
1405  det, beam, disk, LASCoordinateSet(atPhiPositions[beam], 0., tecRPosition[0], 0., tecZPosition[disk], 0.));
1406  } else { // now TEC-
1408  det,
1409  beam,
1410  disk,
1411  LASCoordinateSet(atPhiPositions[beam], 0., tecRPosition[0], 0., -1. * tecZPosition[disk], 0.)); // just * -1.
1412  }
1413 
1414  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
1415 }
1416 
1422  if (angle < -1. * M_PI || angle > M_PI) {
1423  throw cms::Exception(" [LaserAlignment::ConvertAngle] ")
1424  << "** ERROR: Called with illegal input angle: " << angle << "." << std::endl;
1425  }
1426 
1427  if (angle >= 0.)
1428  return angle;
1429  else
1430  return (angle + 2. * M_PI);
1431 }
1432 
1438  int det, ring, beam, disk, pos;
1439 
1440  std::cout << std::endl << " [LaserAlignment::DumpPosFileSet] -- Dump: " << std::endl;
1441 
1442  // TEC INTERNAL
1443  det = 0;
1444  ring = 0;
1445  beam = 0;
1446  disk = 0;
1447  do {
1448  std::cout << "POS " << det << "\t" << beam << "\t" << disk << "\t" << ring << "\t"
1449  << coordinates.GetTECEntry(det, ring, beam, disk).GetPhi() << "\t"
1450  << coordinates.GetTECEntry(det, ring, beam, disk).GetPhiError() << std::endl;
1451  } while (loop.TECLoop(det, ring, beam, disk));
1452 
1453  // TIBTOB
1454  det = 2;
1455  beam = 0;
1456  pos = 0;
1457  do {
1458  std::cout << "POS " << det << "\t" << beam << "\t" << pos << "\t"
1459  << "-1"
1460  << "\t" << coordinates.GetTIBTOBEntry(det, beam, pos).GetPhi() << "\t"
1461  << coordinates.GetTIBTOBEntry(det, beam, pos).GetPhiError() << std::endl;
1462  } while (loop.TIBTOBLoop(det, beam, pos));
1463 
1464  // TEC2TEC
1465  det = 0;
1466  beam = 0;
1467  disk = 0;
1468  do {
1469  std::cout << "POS " << det << "\t" << beam << "\t" << disk << "\t"
1470  << "-1"
1471  << "\t" << coordinates.GetTEC2TECEntry(det, beam, disk).GetPhi() << "\t"
1472  << coordinates.GetTEC2TECEntry(det, beam, disk).GetPhiError() << std::endl;
1473  } while (loop.TEC2TECLoop(det, beam, disk));
1474 
1475  std::cout << std::endl << " [LaserAlignment::DumpPosFileSet] -- End dump: " << std::endl;
1476 }
1477 
1481 void LaserAlignment::DumpStripFileSet(LASGlobalData<std::pair<float, float> >& measuredStripPositions) {
1483  int det, ring, beam, disk, pos;
1484 
1485  std::cout << std::endl << " [LaserAlignment::DumpStripFileSet] -- Dump: " << std::endl;
1486 
1487  // TEC INTERNAL
1488  det = 0;
1489  ring = 0;
1490  beam = 0;
1491  disk = 0;
1492  do {
1493  std::cout << "STRIP " << det << "\t" << beam << "\t" << disk << "\t" << ring << "\t"
1494  << measuredStripPositions.GetTECEntry(det, ring, beam, disk).first << "\t"
1495  << measuredStripPositions.GetTECEntry(det, ring, beam, disk).second << std::endl;
1496  } while (loop.TECLoop(det, ring, beam, disk));
1497 
1498  // TIBTOB
1499  det = 2;
1500  beam = 0;
1501  pos = 0;
1502  do {
1503  std::cout << "STRIP " << det << "\t" << beam << "\t" << pos << "\t"
1504  << "-1"
1505  << "\t" << measuredStripPositions.GetTIBTOBEntry(det, beam, pos).first << "\t"
1506  << measuredStripPositions.GetTIBTOBEntry(det, beam, pos).second << std::endl;
1507  } while (loop.TIBTOBLoop(det, beam, pos));
1508 
1509  // TEC2TEC
1510  det = 0;
1511  beam = 0;
1512  disk = 0;
1513  do {
1514  std::cout << "STRIP " << det << "\t" << beam << "\t" << disk << "\t"
1515  << "-1"
1516  << "\t" << measuredStripPositions.GetTEC2TECEntry(det, beam, disk).first << "\t"
1517  << measuredStripPositions.GetTEC2TECEntry(det, beam, disk).second << std::endl;
1518  } while (loop.TEC2TECLoop(det, beam, disk));
1519 
1520  std::cout << std::endl << " [LaserAlignment::DumpStripFileSet] -- End dump: " << std::endl;
1521 }
1522 
1526 void LaserAlignment::DumpHitmaps(LASGlobalData<int>& numberOfAcceptedProfiles) {
1527  std::cout << " [LaserAlignment::DumpHitmaps] -- Dumping hitmap for TEC+:" << std::endl;
1528  std::cout << " [LaserAlignment::DumpHitmaps] -- Ring4:" << std::endl;
1529  std::cout << " disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8" << std::endl;
1530 
1531  for (int beam = 0; beam < 8; ++beam) {
1532  std::cout << " beam" << beam << ":";
1533  for (int disk = 0; disk < 9; ++disk) {
1534  std::cout << "\t" << numberOfAcceptedProfiles.GetTECEntry(0, 0, beam, disk);
1535  }
1536  std::cout << std::endl;
1537  }
1538 
1539  std::cout << " [LaserAlignment::DumpHitmaps] -- Ring6:" << std::endl;
1540  std::cout << " disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8" << std::endl;
1541 
1542  for (int beam = 0; beam < 8; ++beam) {
1543  std::cout << " beam" << beam << ":";
1544  for (int disk = 0; disk < 9; ++disk) {
1545  std::cout << "\t" << numberOfAcceptedProfiles.GetTECEntry(0, 1, beam, disk);
1546  }
1547  std::cout << std::endl;
1548  }
1549 
1550  std::cout << " [LaserAlignment::DumpHitmaps] -- Dumping hitmap for TEC-:" << std::endl;
1551  std::cout << " [LaserAlignment::DumpHitmaps] -- Ring4:" << std::endl;
1552  std::cout << " disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8" << std::endl;
1553 
1554  for (int beam = 0; beam < 8; ++beam) {
1555  std::cout << " beam" << beam << ":";
1556  for (int disk = 0; disk < 9; ++disk) {
1557  std::cout << "\t" << numberOfAcceptedProfiles.GetTECEntry(1, 0, beam, disk);
1558  }
1559  std::cout << std::endl;
1560  }
1561 
1562  std::cout << " [LaserAlignment::DumpHitmaps] -- Ring6:" << std::endl;
1563  std::cout << " disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 disk8" << std::endl;
1564 
1565  for (int beam = 0; beam < 8; ++beam) {
1566  std::cout << " beam" << beam << ":";
1567  for (int disk = 0; disk < 9; ++disk) {
1568  std::cout << "\t" << numberOfAcceptedProfiles.GetTECEntry(1, 1, beam, disk);
1569  }
1570  std::cout << std::endl;
1571  }
1572 
1573  std::cout << " [LaserAlignment::DumpHitmaps] -- End of dump." << std::endl << std::endl;
1574 }
1575 
1581  LASGlobalData<LASCoordinateSet>& nominalCoordinates,
1582  LASEndcapAlignmentParameterSet& endcapParameters) {
1583  // loop the list of modules to be masked
1584  for (std::vector<unsigned int>::iterator moduleIt = theMaskTecModules.begin(); moduleIt != theMaskTecModules.end();
1585  ++moduleIt) {
1586  // loop variables
1588  int det, ring, beam, disk;
1589 
1590  // this will calculate the corrections from the alignment parameters
1591  LASEndcapAlgorithm endcapAlgorithm;
1592 
1593  // find the location of the respective module in the container with this loop
1594  det = 0;
1595  ring = 0;
1596  beam = 0;
1597  disk = 0;
1598  do {
1599  // here we got it
1600  if (detectorId.GetTECEntry(det, ring, beam, disk) == *moduleIt) {
1601  // the nominal phi value for this module
1602  const double nominalPhi = nominalCoordinates.GetTECEntry(det, ring, beam, disk).GetPhi();
1603 
1604  // the offset from the alignment parameters
1605  const double phiCorrection = endcapAlgorithm.GetAlignmentParameterCorrection(
1606  det, ring, beam, disk, nominalCoordinates, endcapParameters);
1607 
1608  // apply the corrections
1609  measuredCoordinates.GetTECEntry(det, ring, beam, disk).SetPhi(nominalPhi - phiCorrection);
1610  }
1611 
1612  } while (moduleLoop.TECLoop(det, ring, beam, disk));
1613  }
1614 }
1615 
1621  LASGlobalData<LASCoordinateSet>& nominalCoordinates,
1622  LASBarrelAlignmentParameterSet& atParameters) {
1623  // loop the list of modules to be masked
1624  for (std::vector<unsigned int>::iterator moduleIt = theMaskAtModules.begin(); moduleIt != theMaskAtModules.end();
1625  ++moduleIt) {
1626  // loop variables
1628  int det, beam, disk, pos;
1629 
1630  // this will calculate the corrections from the alignment parameters
1631  LASAlignmentTubeAlgorithm atAlgorithm;
1632 
1633  // find the location of the respective module in the container with these loops:
1634 
1635  // first TIB+TOB
1636  det = 2;
1637  beam = 0;
1638  pos = 0;
1639  do {
1640  // here we got it
1641  if (detectorId.GetTIBTOBEntry(det, beam, pos) == *moduleIt) {
1642  // the nominal phi value for this module
1643  const double nominalPhi = nominalCoordinates.GetTIBTOBEntry(det, beam, pos).GetPhi();
1644 
1645  // the offset from the alignment parameters
1646  const double phiCorrection =
1647  atAlgorithm.GetTIBTOBAlignmentParameterCorrection(det, beam, pos, nominalCoordinates, atParameters);
1648 
1649  // apply the corrections
1650  measuredCoordinates.GetTIBTOBEntry(det, beam, pos).SetPhi(nominalPhi - phiCorrection);
1651  }
1652 
1653  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1654 
1655  // then TEC(AT)
1656  det = 0;
1657  beam = 0;
1658  disk = 0;
1659  do {
1660  // here we got it
1661  if (detectorId.GetTEC2TECEntry(det, beam, disk) == *moduleIt) {
1662  // the nominal phi value for this module
1663  const double nominalPhi = nominalCoordinates.GetTEC2TECEntry(det, beam, disk).GetPhi();
1664 
1665  // the offset from the alignment parameters
1666  const double phiCorrection =
1667  atAlgorithm.GetTEC2TECAlignmentParameterCorrection(det, beam, disk, nominalCoordinates, atParameters);
1668 
1669  // apply the corrections
1670  measuredCoordinates.GetTEC2TECEntry(det, beam, disk).SetPhi(nominalPhi - phiCorrection);
1671  }
1672 
1673  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
1674  }
1675 }
1676 
1682  // tracker geom. object for calculating the global beam positions
1683  const TrackerGeometry& theTracker(*theTrackerGeometry);
1684 
1685  const double atPhiPositions[8] = {0.392699, 1.289799, 1.851794, 2.748894, 3.645995, 4.319690, 5.216791, 5.778784};
1686  const double tecPhiPositions[8] = {0.392699, 1.178097, 1.963495, 2.748894, 3.534292, 4.319690, 5.105088, 5.890486};
1687  const double zPositions[9] = {125.0, 139.0, 153.0, 167.0, 181.0, 198.5, 217.5, 238.0, 259.5};
1688  const double zPositionsTIB[6] = {62.0, 38.0, 18.0, -10.0, -34.0, -54.0};
1689  const double zPositionsTOB[6] = {104.0, 58.0, 22.0, -14.0, -50.0, -86.0};
1690 
1691  int det, beam, disk, pos, ring;
1692 
1693  // loop TEC+- internal
1694  det = 0;
1695  ring = 0;
1696  beam = 0;
1697  disk = 0;
1698  do {
1699  const double radius = ring ? 84.0 : 56.4;
1700 
1701  // access the tracker geometry for this module
1702  const DetId theDetId(detectorId.GetTECEntry(det, ring, beam, disk));
1703  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
1704 
1705  if (theStripDet) {
1706  const GlobalPoint gp(GlobalPoint::Cylindrical(radius, tecPhiPositions[beam], zPositions[disk]));
1707 
1708  const LocalPoint lp(theStripDet->surface().toLocal(gp));
1709  std::cout << "__TEC: " << 256. - theStripDet->specificTopology().strip(lp)
1710  << std::endl;
1711  }
1712 
1713  } while (moduleLoop.TECLoop(det, ring, beam, disk));
1714 
1715  // loop TIBTOB
1716  det = 2;
1717  beam = 0;
1718  pos = 0;
1719  do {
1720  const double radius =
1721  (det == 2 ? 51.4 : 58.4);
1722  const double theZ = (det == 2 ? zPositionsTIB[pos] : zPositionsTOB[pos]);
1723 
1724  // access the tracker geometry for this module
1725  const DetId theDetId(detectorId.GetTIBTOBEntry(det, beam, pos));
1726  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
1727 
1728  if (theStripDet) {
1729  const GlobalPoint gp(GlobalPoint::Cylindrical(radius, atPhiPositions[beam], theZ));
1730 
1731  const LocalPoint lp(theStripDet->surface().toLocal(gp));
1732  std::cout << "__TIBTOB det " << det << " beam " << beam << " pos " << pos << " "
1733  << 256. - theStripDet->specificTopology().strip(lp);
1734  std::cout << " " << theStripDet->position().perp() << std::endl;
1735  }
1736 
1737  } while (moduleLoop.TIBTOBLoop(det, beam, pos));
1738 
1739  // loop TEC2TEC
1740  det = 0;
1741  beam = 0;
1742  disk = 0;
1743  do {
1744  const double radius = 56.4;
1745 
1746  // access the tracker geometry for this module
1747  const DetId theDetId(detectorId.GetTEC2TECEntry(det, beam, disk));
1748  const StripGeomDetUnit* const theStripDet = dynamic_cast<const StripGeomDetUnit*>(theTracker.idToDet(theDetId));
1749 
1750  if (theStripDet) {
1751  const GlobalPoint gp(GlobalPoint::Cylindrical(radius, atPhiPositions[beam], zPositions[disk]));
1752 
1753  const LocalPoint lp(theStripDet->surface().toLocal(gp));
1754  std::cout << "__TEC2TEC det " << det << " beam " << beam << " disk " << disk << " "
1755  << 256. - theStripDet->specificTopology().strip(lp) << std::endl;
1756  }
1757 
1758  } while (moduleLoop.TEC2TECLoop(det, beam, disk));
1759 }
1760 
1761 // define the SEAL module
1763 
1765 
1766 // the ATTIC
LASGlobalData::SetTECEntry
void SetTECEntry(int subdetector, int tecRing, int beam, int tecDisk, T)
Definition: LASGlobalData.h:150
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
LaserAlignment
Definition: LaserAlignment.h:73
SiStripLaserRecHit2D
Definition: SiStripLaserRecHit2D.h:12
LaserAlignment::pedestalProfiles
LASGlobalData< LASModuleProfile > pedestalProfiles
Definition: LaserAlignment.h:201
LaserAlignment::CalculateNominalCoordinates
void CalculateNominalCoordinates(void)
fills a LASGlobalData<LASCoordinateSet> with nominal module positions
Definition: LaserAlignment.cc:1327
LaserAlignment::theUseMinuitAlgorithm
bool theUseMinuitAlgorithm
config switch
Definition: LaserAlignment.h:145
TkLasBeam::push_back
void push_back(const SiStripLaserRecHit2D &aHit)
insert a hit in the data vector
Definition: TkLasBeam.h:35
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
LaserAlignment::theSaveHistograms
bool theSaveHistograms
config switch
Definition: LaserAlignment.h:172
LASGlobalLoop::TIBTOBLoop
bool TIBTOBLoop(int &, int &, int &) const
Definition: LASGlobalLoop.cc:46
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
LaserAlignment.h
PTrackerParameters
Definition: PTrackerParameters.h:6
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
LASEndcapAlignmentParameterSet
Definition: LASEndcapAlignmentParameterSet.h:25
SiStripPedestals::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripPedestals.h:51
LASGeometryUpdater::EndcapUpdate
void EndcapUpdate(LASEndcapAlignmentParameterSet &, LASGlobalData< LASCoordinateSet > &)
Definition: LASGeometryUpdater.cc:52
edm::Run
Definition: Run.h:45
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.digiProducer
digiProducer
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:50
LASProfileJudge::SetOverdriveThreshold
void SetOverdriveThreshold(unsigned int)
Definition: LASProfileJudge.cc:90
LaserAlignment::ApplyATMaskingCorrections
void ApplyATMaskingCorrections(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &, LASBarrelAlignmentParameterSet &)
same for alignment tube modules
Definition: LaserAlignment.cc:1620
edm
HLT enums.
Definition: AlignableModifier.h:19
LaserAlignment::theFile
TFile * theFile
Tree stuff.
Definition: LaserAlignment.h:231
TrackerTopology
Definition: TrackerTopology.h:16
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
LASGeometryUpdater::ApplyBeamKinkCorrections
void ApplyBeamKinkCorrections(LASGlobalData< LASCoordinateSet > &) const
Definition: LASGeometryUpdater.cc:23
LASBarrelAlgorithm::CalculateParameters
LASBarrelAlignmentParameterSet CalculateParameters(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
Definition: LASBarrelAlgorithm.cc:20
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
LaserAlignment::isTECBeam
bool isTECBeam(void)
decide whether TEC or AT beams have fired
Definition: LaserAlignment.cc:1220
LASGlobalData< LASCoordinateSet >
LASProfileJudge::JudgeProfile
bool JudgeProfile(const LASModuleProfile &, double)
Definition: LASProfileJudge.cc:45
LaserAlignment::LaserAlignment
LaserAlignment(edm::ParameterSet const &theConf)
Definition: LaserAlignment.cc:19
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
TrackerGeomBuilderFromGeometricDet::build
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
Definition: TrackerGeomBuilderFromGeometricDet.cc:43
LaserAlignment::geomToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
Definition: LaserAlignment.h:132
LaserAlignment::gD
edm::ESHandle< GeometricDet > gD
tracker geometry;
Definition: LaserAlignment.h:235
PTrackerParameters.h
LASGlobalLoop
Definition: LASGlobalLoop.h:24
LaserAlignment::theFileName
std::string theFileName
config parameter (histograms file output name)
Definition: LaserAlignment.h:178
LaserAlignment::summedHistograms
LASGlobalData< TH1D * > summedHistograms
Definition: LaserAlignment.h:221
LASProfileJudge::EnableZeroFilter
void EnableZeroFilter(bool)
Definition: LASProfileJudge.cc:79
LaserAlignment::isAcceptedProfile
LASGlobalData< int > isAcceptedProfile
Definition: LaserAlignment.h:217
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
LASGeometryUpdater::TrackerUpdate
void TrackerUpdate(LASEndcapAlignmentParameterSet &, LASBarrelAlignmentParameterSet &, AlignableTracker &)
Definition: LASGeometryUpdater.cc:92
LaserAlignment::theMaskTecModules
std::vector< unsigned int > theMaskTecModules
config parameters
Definition: LaserAlignment.h:181
LaserAlignment::endRunProduce
void endRunProduce(edm::Run &, const edm::EventSetup &) override
Definition: LaserAlignment.cc:485
LASEndcapAlgorithm::GetAlignmentParameterCorrection
double GetAlignmentParameterCorrection(int, int, int, int, LASGlobalData< LASCoordinateSet > &, LASEndcapAlignmentParameterSet &)
Definition: LASEndcapAlgorithm.cc:312
LaserAlignment::theProfileNames
LASGlobalData< std::string > theProfileNames
Definition: LaserAlignment.h:210
theZ
T theZ
Definition: Basic3DVectorLD.h:243
LaserAlignment::theAlignableTracker
AlignableTracker * theAlignableTracker
Definition: LaserAlignment.h:239
LASCoordinateSet::SetPhiError
void SetPhiError(double aPhiError)
Definition: LASCoordinateSet.h:32
DetId
Definition: DetId.h:17
MakerMacros.h
LASGeometryUpdater::SetMisalignmentFromRefGeometry
void SetMisalignmentFromRefGeometry(bool)
Definition: LASGeometryUpdater.cc:301
TkLasBeam
Definition: TkLasBeam.h:12
SiStripRawDigi
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
Definition: SiStripRawDigi.h:15
LaserAlignment::~LaserAlignment
~LaserAlignment() override
Definition: LaserAlignment.cc:115
LASModuleProfile::SetValue
void SetValue(unsigned int theStripNumber, const double &theValue)
Definition: LASModuleProfile.h:20
TrackerTopologyRcd.h
LASGeometryUpdater::SetReverseDirection
void SetReverseDirection(bool)
Definition: LASGeometryUpdater.cc:296
LASGeometryUpdater
Definition: LASGeometryUpdater.h:16
interactiveExample.theFile
theFile
Definition: interactiveExample.py:17
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::Run::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
LaserAlignment::theApplyBeamKinkCorrections
bool theApplyBeamKinkCorrections
config switch
Definition: LaserAlignment.h:148
LaserAlignment::geomDetToken_
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
Definition: LaserAlignment.h:133
AlignableTracker::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
Definition: AlignableTracker.cc:59
SiStripRawDigi::adc
uint16_t adc() const
Definition: SiStripRawDigi.h:22
Geom::Cylindrical2Cartesian
Definition: CoordinateSets.h:34
LaserAlignment::numberOfAcceptedProfiles
LASGlobalData< int > numberOfAcceptedProfiles
Definition: LaserAlignment.h:213
LaserAlignment::singleModulesDir
TDirectory * singleModulesDir
Definition: LaserAlignment.h:232
LaserAlignment::theAlignRecordName
std::string theAlignRecordName
Definition: LaserAlignment.h:241
Run.h
LaserAlignment::enableJudgeZeroFilter
bool enableJudgeZeroFilter
config switch
Definition: LaserAlignment.h:154
edm::ESHandle
Definition: DTSurvey.h:22
AlignableTracker
Definition: AlignableTracker.h:17
SiStripDigi::adc
const uint16_t & adc() const
Definition: SiStripDigi.h:34
LASGlobalData::GetTECEntry
T & GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk)
Definition: LASGlobalData.h:84
GeometricDet
Definition: GeometricDet.h:31
LASPeakFinder::SetAmplitudeThreshold
void SetAmplitudeThreshold(double)
Definition: LASPeakFinder.cc:106
EcalCondDBWriter_cfi.beam
beam
Definition: EcalCondDBWriter_cfi.py:45
LASAlignmentTubeAlgorithm::GetTIBTOBAlignmentParameterCorrection
double GetTIBTOBAlignmentParameterCorrection(int, int, int, LASGlobalData< LASCoordinateSet > &, LASBarrelAlignmentParameterSet &)
Definition: LASAlignmentTubeAlgorithm.cc:490
LaserAlignment::DumpStripFileSet
void DumpStripFileSet(LASGlobalData< std::pair< float, float > > &)
for debugging only, will disappear
Definition: LaserAlignment.cc:1481
Point3DBase< float, GlobalTag >
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:496
LaserAlignment::fillDetectorId
void fillDetectorId(void)
fill hard coded detIds
Definition: LaserAlignmentFillDetId.cc:7
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripPedestals::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiStripPedestals.cc:28
LASModuleProfile::SetAllValuesTo
void SetAllValuesTo(const double &)
Definition: LASModuleProfile.cc:76
LASPeakFinder::FindPeakIn
bool FindPeakIn(const LASModuleProfile &, std::pair< double, double > &, TH1D *, const double)
Definition: LASPeakFinder.cc:16
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
funct::true
true
Definition: Factorize.h:173
LaserAlignment::produce
void produce(edm::Event &, edm::EventSetup const &) override
Definition: LaserAlignment.cc:277
SiStripDigi::strip
const uint16_t & strip() const
Definition: SiStripDigi.h:33
LaserAlignment::moduleLoop
LASGlobalLoop moduleLoop
Definition: LaserAlignment.h:228
LaserAlignment::gprToken_
const edm::ESGetToken< Alignments, GlobalPositionRcd > gprToken_
Definition: LaserAlignment.h:135
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
LaserAlignment::theSetNominalStrips
bool theSetNominalStrips
config switch
Definition: LaserAlignment.h:185
LaserAlignment::theCompression
int theCompression
config parameter (histograms file compression level)
Definition: LaserAlignment.h:175
LASAlignmentTubeAlgorithm::CalculateParameters
LASBarrelAlignmentParameterSet CalculateParameters(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
Definition: LASAlignmentTubeAlgorithm.cc:12
ParameterSet
Definition: Functions.h:16
LaserAlignment::misalignedByRefGeometry
bool misalignedByRefGeometry
config switch
Definition: LaserAlignment.h:163
LASCoordinateSet::GetPhiError
double GetPhiError(void) const
Definition: LASCoordinateSet.h:19
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
LaserAlignment::getTIBTOBNominalBeamOffset
double getTIBTOBNominalBeamOffset(unsigned int, unsigned int, unsigned int)
returns the nominal beam position (strips) in TOB for the profileJudge
Definition: LaserAlignment.cc:1274
LASCoordinateSet
Definition: LASCoordinateSet.h:12
LaserAlignment::theStoreToDB
bool theStoreToDB
config switch
Definition: LaserAlignment.h:166
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
heppy_loop.loop
loop
Definition: heppy_loop.py:28
LaserAlignment::testRoutine
void testRoutine(void)
for debugging & testing only, will disappear..
Definition: LaserAlignment.cc:1681
PTrackerParametersRcd.h
LaserAlignment::ApplyEndcapMaskingCorrections
void ApplyEndcapMaskingCorrections(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &, LASEndcapAlignmentParameterSet &)
apply endcap correction to masked modules in TEC
Definition: LaserAlignment.cc:1580
LaserAlignment::updateFromInputGeometry
bool updateFromInputGeometry
config switch
Definition: LaserAlignment.h:160
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
LASBarrelAlignmentParameterSet
Definition: LASBarrelAlignmentParameterSet.h:23
edm::Service< cond::service::PoolDBOutputService >
createfilelist.int
int
Definition: createfilelist.py:10
LASEndcapAlignmentParameterSet::Print
void Print(void)
Definition: LASEndcapAlignmentParameterSet.cc:158
LaserAlignment::firstEvent_
bool firstEvent_
Definition: LaserAlignment.h:243
LaserAlignment::peakFinderThreshold
double peakFinderThreshold
config parameter
Definition: LaserAlignment.h:151
LaserAlignment::judgeOverdriveThreshold
unsigned int judgeOverdriveThreshold
config parameters for the LASProfileJudge
Definition: LaserAlignment.h:157
LASGlobalData::GetTIBTOBEntry
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
Definition: LASGlobalData.h:107
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
LASGlobalLoop::TEC2TECLoop
bool TEC2TECLoop(int &, int &, int &) const
Definition: LASGlobalLoop.cc:74
LaserAlignment::isATBeam
bool isATBeam(void)
Definition: LaserAlignment.cc:1247
LASBarrelAlgorithm
Definition: LASBarrelAlgorithm.h:22
edm::EventSetup
Definition: EventSetup.h:58
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
LaserAlignment::detectorId
LASGlobalData< unsigned int > detectorId
Definition: LaserAlignment.h:195
LaserAlignment::currentDataProfiles
LASGlobalData< LASModuleProfile > currentDataProfiles
data profiles for the current event
Definition: LaserAlignment.h:204
LaserAlignment::DumpHitmaps
void DumpHitmaps(LASGlobalData< int > &)
for debugging only, will disappear
Definition: LaserAlignment.cc:1526
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
LaserAlignment::theDoPedestalSubtraction
bool theDoPedestalSubtraction
config switch
Definition: LaserAlignment.h:142
LASGlobalLoop::TECLoop
bool TECLoop(int &, int &, int &, int &) const
Definition: LASGlobalLoop.cc:13
LaserAlignment::theGlobalPositionRcd
edm::ESHandle< Alignments > theGlobalPositionRcd
Definition: LaserAlignment.h:237
LaserAlignment::DumpPosFileSet
void DumpPosFileSet(LASGlobalData< LASCoordinateSet > &)
for debugging only, will disappear
Definition: LaserAlignment.cc:1436
LaserAlignment::fillDataProfiles
void fillDataProfiles(edm::Event const &, edm::EventSetup const &)
fill profiles from SiStrip(Raw)Digi container
Definition: LaserAlignment.cc:936
DataMixerDataOnData_cff.digiLabel
digiLabel
Definition: DataMixerDataOnData_cff.py:46
LASGlobalData::SetTEC2TECEntry
void SetTEC2TECEntry(int subdetector, int beam, int tecDisk, T)
Definition: LASGlobalData.h:195
LaserAlignment::theEvents
int theEvents
counter for the total number of events processed
Definition: LaserAlignment.h:139
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
LASGlobalData::GetTEC2TECEntry
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
Definition: LASGlobalData.h:129
AlignableTracker::alignments
Alignments * alignments() const override
Return alignments, sorted by DetId.
Definition: AlignableTracker.cc:42
LASEndcapAlgorithm::CalculateParameters
LASEndcapAlignmentParameterSet CalculateParameters(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
Definition: LASEndcapAlgorithm.cc:15
LaserAlignment::getTEC2TECNominalBeamOffset
double getTEC2TECNominalBeamOffset(unsigned int, unsigned int, unsigned int)
returns the nominal beam position (strips) in TEC (AT) for the profileJudge
Definition: LaserAlignment.cc:1309
LASAlignmentTubeAlgorithm
Definition: LASAlignmentTubeAlgorithm.h:19
LaserAlignment::judge
LASProfileJudge judge
Definition: LaserAlignment.h:189
LaserAlignment::beginJob
void beginJob() override
Definition: LaserAlignment.cc:129
LaserAlignment::stripPedestalsToken_
const edm::ESGetToken< SiStripPedestals, SiStripPedestalsRcd > stripPedestalsToken_
Definition: LaserAlignment.h:136
LaserAlignment::theTrackerGeometry
edm::ESHandle< TrackerGeometry > theTrackerGeometry
Definition: LaserAlignment.h:236
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
Exception
Definition: hltDiff.cc:245
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
LaserAlignment::topoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Tokens for ESconsumes.
Definition: LaserAlignment.h:131
LaserAlignment::tecDoubleHitDetId
std::vector< unsigned int > tecDoubleHitDetId
Definition: LaserAlignment.h:198
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
LaserAlignment::nominalCoordinates
LASGlobalData< LASCoordinateSet > nominalCoordinates
Definition: LaserAlignment.h:224
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
LASProfileJudge::IsSignalIn
bool IsSignalIn(const LASModuleProfile &, double)
Definition: LASProfileJudge.cc:24
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
LASGlobalData::SetTIBTOBEntry
void SetTIBTOBEntry(int subdetector, int beam, int tibTobPosition, T)
Definition: LASGlobalData.h:173
LASEndcapAlgorithm
Definition: LASEndcapAlgorithm.h:25
TrackerGeomBuilderFromGeometricDet
Definition: TrackerGeomBuilderFromGeometricDet.h:17
LASCoordinateSet::GetPhi
double GetPhi(void) const
Definition: LASCoordinateSet.h:18
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
cms::Exception
Definition: Exception.h:70
LaserAlignment::theErrorRecordName
std::string theErrorRecordName
Definition: LaserAlignment.h:241
SiStripPedestals::getPed
float getPed(const uint16_t &strip, const Range &range) const
Definition: SiStripPedestals.cc:51
LaserAlignment::fillPedestalProfiles
void fillPedestalProfiles(edm::ESHandle< SiStripPedestals > &)
fill pedestals from dbase
Definition: LaserAlignment.cc:1168
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
LASAlignmentTubeAlgorithm::GetTEC2TECAlignmentParameterCorrection
double GetTEC2TECAlignmentParameterCorrection(int, int, int, LASGlobalData< LASCoordinateSet > &, LASBarrelAlignmentParameterSet &)
Definition: LASAlignmentTubeAlgorithm.cc:609
LaserAlignment::endJob
void endJob() override
Definition: LaserAlignment.cc:930
LaserAlignment::ConvertAngle
double ConvertAngle(double)
convert an angle in the [-pi,pi] range to the [0,2*pi] range
Definition: LaserAlignment.cc:1421
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
LaserAlignment::theMaskAtModules
std::vector< unsigned int > theMaskAtModules
Definition: LaserAlignment.h:182
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
align_cfg.iteration
iteration
Definition: align_cfg.py:5
LaserAlignment::theDigiProducersList
std::vector< edm::ParameterSet > theDigiProducersList
Definition: LaserAlignment.h:169
Alignments
Definition: Alignments.h:10
LASPeakFinder
Definition: LASPeakFinder.h:19
LaserAlignment::collectedDataProfiles
LASGlobalData< LASModuleProfile > collectedDataProfiles
Definition: LaserAlignment.h:207
LaserAlignment::ptpToken_
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
Definition: LaserAlignment.h:134
LaserAlignment::theLasConstants
LASConstants theLasConstants
Definition: LaserAlignment.h:192
LASCoordinateSet::SetPhi
void SetPhi(double aPhi)
Definition: LASCoordinateSet.h:27
StripGeomDetUnit
Definition: StripGeomDetUnit.h:15
TrackerGeometry
Definition: TrackerGeometry.h:14
LASBarrelAlignmentParameterSet::Print
void Print(void)
Definition: LASBarrelAlignmentParameterSet.cc:94
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31