CMS 3D CMS Logo

TrackerSystematicMisalignments.cc
Go to the documentation of this file.
7 
10 
17 
21 
26 #include "CLHEP/Random/RandGauss.h"
27 
29 
30 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h" // for enums TID/TIB/etc.
31 
32 // Database
35 
36 // -----------------------------------------------------------------
37 // 2010-05-20 Frank Meier
38 // Changed sign of z-correction, i.e. z-expansion is now an expansion
39 // made some variables constant, removed obviously dead code and comments
40 
42  : theAlignableTracker(nullptr) {
43  // use existing geometry
44  m_fromDBGeom = cfg.getUntrackedParameter<bool>("fromDBGeom");
45 
46  // constants
47  m_radialEpsilon = cfg.getUntrackedParameter<double>("radialEpsilon");
48  m_telescopeEpsilon = cfg.getUntrackedParameter<double>("telescopeEpsilon");
49  m_layerRotEpsilon = cfg.getUntrackedParameter<double>("layerRotEpsilon");
50  m_bowingEpsilon = cfg.getUntrackedParameter<double>("bowingEpsilon");
51  m_zExpEpsilon = cfg.getUntrackedParameter<double>("zExpEpsilon");
52  m_twistEpsilon = cfg.getUntrackedParameter<double>("twistEpsilon");
53  m_ellipticalEpsilon = cfg.getUntrackedParameter<double>("ellipticalEpsilon");
54  m_skewEpsilon = cfg.getUntrackedParameter<double>("skewEpsilon");
55  m_sagittaEpsilon = cfg.getUntrackedParameter<double>("sagittaEpsilon");
56 
57  m_ellipticalDelta = cfg.getUntrackedParameter<double>("ellipticalDelta");
58  m_skewDelta = cfg.getUntrackedParameter<double>("skewDelta");
59  m_sagittaDelta = cfg.getUntrackedParameter<double>("sagittaDelta");
60 
61  if (m_radialEpsilon > -990.0) {
62  edm::LogWarning("MisalignedTracker") << "Applying radial ...";
63  }
64  if (m_telescopeEpsilon > -990.0) {
65  edm::LogWarning("MisalignedTracker") << "Applying telescope ...";
66  }
67  if (m_layerRotEpsilon > -990.0) {
68  edm::LogWarning("MisalignedTracker") << "Applying layer rotation ...";
69  }
70  if (m_bowingEpsilon > -990.0) {
71  edm::LogWarning("MisalignedTracker") << "Applying bowing ...";
72  }
73  if (m_zExpEpsilon > -990.0) {
74  edm::LogWarning("MisalignedTracker") << "Applying z-expansion ...";
75  }
76  if (m_twistEpsilon > -990.0) {
77  edm::LogWarning("MisalignedTracker") << "Applying twist ...";
78  }
79  if (m_ellipticalEpsilon > -990.0) {
80  edm::LogWarning("MisalignedTracker") << "Applying elliptical ...";
81  }
82  if (m_skewEpsilon > -990.0) {
83  edm::LogWarning("MisalignedTracker") << "Applying skew ...";
84  }
85  if (m_sagittaEpsilon > -990.0) {
86  edm::LogWarning("MisalignedTracker") << "Applying sagitta ...";
87  }
88 
89  // get flag for suppression of blind movements
90  suppressBlindMvmts = cfg.getUntrackedParameter<bool>("suppressBlindMvmts");
91  if (suppressBlindMvmts) {
92  edm::LogWarning("MisalignedTracker") << "Blind movements suppressed (TIB/TOB in z, TID/TEC in r)";
93  }
94 
95  // compatibility with old (weird) z convention
96  oldMinusZconvention = cfg.getUntrackedParameter<bool>("oldMinusZconvention");
97  if (oldMinusZconvention) {
98  edm::LogWarning("MisalignedTracker") << "Old z convention: dz --> -dz";
99  } else {
100  edm::LogWarning("MisalignedTracker") << "New z convention: dz --> dz";
101  }
102 }
103 
105 
107  //Retrieve tracker topology from geometry
108  edm::ESHandle<TrackerTopology> tTopoHandle;
109  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
110  const TrackerTopology* const tTopo = tTopoHandle.product();
111 
115  setup.get<PTrackerParametersRcd>().get(ptp);
117 
118  //take geometry from DB or randomly generate geometry
119  if (m_fromDBGeom) {
120  //build the tracker
121  edm::ESHandle<Alignments> alignments;
123 
124  setup.get<TrackerAlignmentRcd>().get(alignments);
125  setup.get<TrackerAlignmentErrorExtendedRcd>().get(alignmentErrors);
126 
127  edm::ESHandle<Alignments> globalPositionRcd;
128  setup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
129 
130  //apply the latest alignments
131  GeometryAligner aligner;
132  aligner.applyAlignments<TrackerGeometry>(&(*tracker),
133  &(*alignments),
134  &(*alignmentErrors),
135  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
136  }
137 
138  theAlignableTracker = new AlignableTracker(&(*tracker), tTopo);
139 
141 
142  // -------------- writing out to alignment record --------------
143  Alignments* myAlignments = theAlignableTracker->alignments();
144  AlignmentErrorsExtended* myAlignmentErrorsExtended = theAlignableTracker->alignmentErrors();
145 
146  // Store alignment[Error]s to DB
148  std::string theAlignRecordName = "TrackerAlignmentRcd";
149  std::string theErrorRecordName = "TrackerAlignmentErrorExtendedRcd";
150 
151  // Call service
152  if (!poolDbService.isAvailable()) // Die if not available
153  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
154 
155  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
156  poolDbService->writeOne<AlignmentErrorsExtended>(
157  &(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), theErrorRecordName);
158 }
159 
161  const align::Alignables& comp = ali->components();
162  unsigned int nComp = comp.size();
163  //move then do for lower level object
164  //for issue of det vs detunit
165  bool usecomps = true;
166  if ((ali->alignableObjectId() == 2) && (nComp >= 1))
167  usecomps = false;
168  for (unsigned int i = 0; i < nComp; ++i) {
169  if (usecomps)
171  }
172 
173  // if suppression of blind mvmts: check if subdet is blind to a certain mode
174  bool blindToZ(false), blindToR(false);
175  if (suppressBlindMvmts) {
176  const int subdetid = ali->geomDetId().subdetId();
177  switch (subdetid) {
178  // TIB/TON blind to z
179  case SiStripDetId::TIB:
180  case SiStripDetId::TOB:
181  blindToZ = true;
182  break;
183  // TID/TEC blind to R
184  case SiStripDetId::TID:
185  case SiStripDetId::TEC:
186  blindToR = true;
187  break;
188  default:
189  break;
190  }
191  }
192 
193  const int level = ali->alignableObjectId();
194  if ((level == 1) || (level == 2)) {
195  const align::PositionType gP = ali->globalPosition();
196  const align::GlobalVector gVec = findSystematicMis(gP, blindToZ, blindToR);
197  ali->move(gVec);
198  }
199 }
200 
202  const bool blindToZ,
203  const bool blindToR) {
204  //align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( align::PositionType globalPos ){
205  // calculates shift for the current alignable
206  // all corrections are calculated w.r.t. the original geometry
207  double deltaX = 0.0;
208  double deltaY = 0.0;
209  double deltaZ = 0.0;
210  const double oldX = globalPos.x();
211  const double oldY = globalPos.y();
212  const double oldZ = globalPos.z();
213  const double oldPhi = globalPos.phi();
214  const double oldR = sqrt(globalPos.x() * globalPos.x() + globalPos.y() * globalPos.y());
215 
216  if (m_radialEpsilon > -990.0 && !blindToR) {
217  deltaX += m_radialEpsilon * oldX;
218  deltaY += m_radialEpsilon * oldY;
219  }
220  if (m_telescopeEpsilon > -990.0 && !blindToZ) {
221  deltaZ += m_telescopeEpsilon * oldR;
222  }
223  if (m_layerRotEpsilon > -990.0) {
224  // The following number was chosen such that the Layer Rotation systematic
225  // misalignment would not cause an overall rotation of the tracker.
226  const double Roffset = 57.0;
227  const double xP = oldR * cos(oldPhi + m_layerRotEpsilon * (oldR - Roffset));
228  const double yP = oldR * sin(oldPhi + m_layerRotEpsilon * (oldR - Roffset));
229  deltaX += (xP - oldX);
230  deltaY += (yP - oldY);
231  }
232  if (m_bowingEpsilon > -990.0 && !blindToR) {
233  const double trackeredgePlusZ = 271.846;
234  const double bowfactor = m_bowingEpsilon * (trackeredgePlusZ * trackeredgePlusZ - oldZ * oldZ);
235  deltaX += oldX * bowfactor;
236  deltaY += oldY * bowfactor;
237  }
238  if (m_zExpEpsilon > -990.0 && !blindToZ) {
239  deltaZ += oldZ * m_zExpEpsilon;
240  }
241  if (m_twistEpsilon > -990.0) {
242  const double xP = oldR * cos(oldPhi + m_twistEpsilon * oldZ);
243  const double yP = oldR * sin(oldPhi + m_twistEpsilon * oldZ);
244  deltaX += (xP - oldX);
245  deltaY += (yP - oldY);
246  }
247  if (m_ellipticalEpsilon > -990.0 && !blindToR) {
248  deltaX += oldX * m_ellipticalEpsilon * cos(2.0 * oldPhi + m_ellipticalDelta);
249  deltaY += oldY * m_ellipticalEpsilon * cos(2.0 * oldPhi + m_ellipticalDelta);
250  }
251  if (m_skewEpsilon > -990.0 && !blindToZ) {
252  deltaZ += m_skewEpsilon * cos(oldPhi + m_skewDelta);
253  }
254  if (m_sagittaEpsilon > -990.0) {
255  // deltaX += oldX/fabs(oldX)*m_sagittaEpsilon; // old one...
256  deltaX += oldR * m_sagittaEpsilon * sin(m_sagittaDelta);
257  deltaY += oldR * m_sagittaEpsilon * cos(m_sagittaDelta); //Delta y is cos so that delta=0 reflects the old behavior
258  }
259 
260  // Compatibility with old version <= 1.5
262  deltaZ = -deltaZ;
263 
264  align::GlobalVector gV(deltaX, deltaY, deltaZ);
265  return gV;
266 }
267 
268 // Plug in to framework
269 
271 
Vector3DBase< Scalar, GlobalTag >
personalPlayback.level
level
Definition: personalPlayback.py:22
AlignmentErrorsExtended.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrackerSystematicMisalignments::findSystematicMis
align::GlobalVector findSystematicMis(const align::PositionType &, const bool blindToZ, const bool blindToR)
Definition: TrackerSystematicMisalignments.cc:201
GlobalPositionRcd.h
mps_fire.i
i
Definition: mps_fire.py:428
TrackerSystematicMisalignments::m_telescopeEpsilon
double m_telescopeEpsilon
Definition: TrackerSystematicMisalignments.h:46
MessageLogger.h
TrackerGeometry.h
TrackerSystematicMisalignments.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
ESHandle.h
TrackerSystematicMisalignments::m_ellipticalEpsilon
double m_ellipticalEpsilon
Definition: TrackerSystematicMisalignments.h:51
TrackerSystematicMisalignments::m_zExpEpsilon
double m_zExpEpsilon
Definition: TrackerSystematicMisalignments.h:49
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TrackerSystematicMisalignments::oldMinusZconvention
bool oldMinusZconvention
Definition: TrackerSystematicMisalignments.h:64
TrackerTopology
Definition: TrackerTopology.h:16
Alignable
Definition: Alignable.h:27
TrackerSystematicMisalignments::m_skewDelta
double m_skewDelta
Definition: TrackerSystematicMisalignments.h:57
TrackerSystematicMisalignments::m_sagittaDelta
double m_sagittaDelta
Definition: TrackerSystematicMisalignments.h:58
Alignments.h
TrackerSystematicMisalignments::m_fromDBGeom
bool m_fromDBGeom
Definition: TrackerSystematicMisalignments.h:43
DetectorGlobalPosition.h
TrackerGeomBuilderFromGeometricDet::build
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
Definition: TrackerGeomBuilderFromGeometricDet.cc:43
SiStripDetId.h
TrackerAlignmentRcd
Definition: TrackerAlignmentRcd.h:6
PTrackerParameters.h
TrackerSystematicMisalignments::beginJob
void beginJob() override
Read ideal tracker geometry from DB.
Definition: TrackerSystematicMisalignments.cc:104
TrackerSystematicMisalignments::m_radialEpsilon
double m_radialEpsilon
Definition: TrackerSystematicMisalignments.h:45
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
GeometryAligner::applyAlignments
void applyAlignments(const C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Definition: GeometryAligner.h:52
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
PTrackerParametersRcd
Definition: PTrackerParametersRcd.h:9
TrackerAlignmentErrorExtendedRcd.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
TrackerSystematicMisalignments::suppressBlindMvmts
bool suppressBlindMvmts
Definition: TrackerSystematicMisalignments.h:61
MakerMacros.h
PoolDBOutputService.h
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
AlignableTracker::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
Definition: AlignableTracker.cc:59
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Service.h
TrackerSystematicMisalignments::m_skewEpsilon
double m_skewEpsilon
Definition: TrackerSystematicMisalignments.h:52
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< TrackerTopology >
AlignableTracker
Definition: AlignableTracker.h:17
TrackerSystematicMisalignments::m_sagittaEpsilon
double m_sagittaEpsilon
Definition: TrackerSystematicMisalignments.h:53
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< Scalar, GlobalTag >
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
TrackerSystematicMisalignments::m_bowingEpsilon
double m_bowingEpsilon
Definition: TrackerSystematicMisalignments.h:48
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
DetId::Tracker
Definition: DetId.h:25
align::DetectorGlobalPosition
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Definition: DetectorGlobalPosition.cc:10
PTrackerParametersRcd.h
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
edm::Service< cond::service::PoolDBOutputService >
TrackerSystematicMisalignments::applySystematicMisalignment
void applySystematicMisalignment(Alignable *)
Definition: TrackerSystematicMisalignments.cc:160
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
IdealGeometryRecord.h
TrackerAlignmentRcd.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
looper.cfg
cfg
Definition: looper.py:297
TrackerSystematicMisalignments
Definition: TrackerSystematicMisalignments.h:26
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
TrackerSystematicMisalignments::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: TrackerSystematicMisalignments.cc:106
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
TrackerSystematicMisalignments::m_ellipticalDelta
double m_ellipticalDelta
Definition: TrackerSystematicMisalignments.h:56
TrackerSystematicMisalignments::theAlignableTracker
AlignableTracker * theAlignableTracker
Definition: TrackerSystematicMisalignments.h:40
AlignableTracker::alignments
Alignments * alignments() const override
Return alignments, sorted by DetId.
Definition: AlignableTracker.cc:42
GeometryAligner.h
DetId.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
EventSetup.h
TrackerGeomBuilderFromGeometricDet.h
TrackerGeomBuilderFromGeometricDet
Definition: TrackerGeomBuilderFromGeometricDet.h:17
AlignableTracker.h
cms::Exception
Definition: Exception.h:70
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
ParameterSet.h
SurveyDet.h
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
TrackerSystematicMisalignments::m_twistEpsilon
double m_twistEpsilon
Definition: TrackerSystematicMisalignments.h:50
TrackerSystematicMisalignments::m_layerRotEpsilon
double m_layerRotEpsilon
Definition: TrackerSystematicMisalignments.h:47
Alignments
Definition: Alignments.h:10
TrackerAlignmentErrorExtendedRcd
Definition: TrackerAlignmentErrorExtendedRcd.h:6
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
GeometryAligner
Class to update a given geometry with a set of alignments.
Definition: GeometryAligner.h:33
TrackerSystematicMisalignments::TrackerSystematicMisalignments
TrackerSystematicMisalignments(const edm::ParameterSet &)
Definition: TrackerSystematicMisalignments.cc:41
TrackerGeometry
Definition: TrackerGeometry.h:14