CMS 3D CMS Logo

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