Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:28

0001 #include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
0002 
0003 // Original Author:  ?
0004 //     Last Update:  Max Stark
0005 //            Date:  Mon, 15 Feb 2016 09:32:12 CET
0006 
0007 // alignment
0008 #include "Alignment/TrackerAlignment/interface/AlignableTrackerBuilder.h"
0009 
0010 #include "CondFormats/Alignment/interface/Alignments.h"
0011 #include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
0012 
0013 //_____________________________________________________________________________
0014 AlignableTracker ::AlignableTracker(const TrackerGeometry* trackerGeometry, const TrackerTopology* trackerTopology)
0015     :  // id not yet known, will be set by builder
0016       AlignableComposite(0, align::Tracker, RotationType()),
0017       tTopo_(trackerTopology),
0018       trackerNameSpace_(trackerTopology),
0019       alignableObjectId_(trackerGeometry, nullptr, nullptr, nullptr) {
0020   AlignableTrackerBuilder builder(trackerGeometry, trackerTopology);
0021   builder.buildAlignables(this);
0022   trackerNameSpace_ = builder.trackerNameSpace();
0023   alignableObjectId_ = builder.objectIdProvider();
0024 }
0025 
0026 //_____________________________________________________________________________
0027 void AlignableTracker::update(const TrackerGeometry* trackerGeometry, const TrackerTopology* trackerTopology) {
0028   AlignableTrackerBuilder builder(trackerGeometry, trackerTopology);
0029   builder.buildAlignables(this, /* update = */ true);
0030 }
0031 
0032 //_____________________________________________________________________________
0033 align::Alignables AlignableTracker::merge(const Alignables& list1, const Alignables& list2) const {
0034   Alignables all = list1;
0035 
0036   all.insert(all.end(), list2.begin(), list2.end());
0037 
0038   return all;
0039 }
0040 
0041 //_____________________________________________________________________________
0042 Alignments* AlignableTracker::alignments(void) const {
0043   align::Alignables comp = this->components();
0044   Alignments* m_alignments = new Alignments();
0045   // Add components recursively
0046   for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
0047     Alignments* tmpAlignments = (*i)->alignments();
0048     std::copy(tmpAlignments->m_align.begin(), tmpAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
0049     delete tmpAlignments;
0050   }
0051 
0052   // sort by rawId
0053   std::sort(m_alignments->m_align.begin(), m_alignments->m_align.end());
0054 
0055   return m_alignments;
0056 }
0057 
0058 //_____________________________________________________________________________
0059 AlignmentErrorsExtended* AlignableTracker::alignmentErrors(void) const {
0060   align::Alignables comp = this->components();
0061   AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
0062 
0063   // Add components recursively
0064   for (align::Alignables::iterator i = comp.begin(); i != comp.end(); i++) {
0065     AlignmentErrorsExtended* tmpAlignmentErrorsExtended = (*i)->alignmentErrors();
0066     std::copy(tmpAlignmentErrorsExtended->m_alignError.begin(),
0067               tmpAlignmentErrorsExtended->m_alignError.end(),
0068               std::back_inserter(m_alignmentErrors->m_alignError));
0069     delete tmpAlignmentErrorsExtended;
0070   }
0071 
0072   // sort by rawId
0073   std::sort(m_alignmentErrors->m_alignError.begin(), m_alignmentErrors->m_alignError.end());
0074 
0075   return m_alignmentErrors;
0076 }