CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackerSystematicMisalignments Class Reference

#include <TrackerSystematicMisalignments.h>

Inheritance diagram for TrackerSystematicMisalignments:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 Read ideal tracker geometry from DB. More...
 
 TrackerSystematicMisalignments (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void applySystematicMisalignment (Alignable *)
 
align::GlobalVector findSystematicMis (align::PositionType, const bool blindToZ, const bool blindToR)
 

Private Attributes

double m_bowingEpsilon
 
double m_ellipticalDelta
 
double m_ellipticalEpsilon
 
bool m_fromDBGeom
 
double m_layerRotEpsilon
 
double m_radialEpsilon
 
double m_sagittaDelta
 
double m_sagittaEpsilon
 
double m_skewDelta
 
double m_skewEpsilon
 
double m_telescopeEpsilon
 
double m_twistEpsilon
 
double m_zExpEpsilon
 
bool oldMinusZconvention
 
bool suppressBlindMvmts
 
AlignableTrackertheAlignableTracker
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Class to misaligned tracker from DB.

Date:
2010/06/14 14:45:15
Revision:
1.4
Author
Chung Khim Lae

Definition at line 22 of file TrackerSystematicMisalignments.h.

Constructor & Destructor Documentation

TrackerSystematicMisalignments::TrackerSystematicMisalignments ( const edm::ParameterSet cfg)

Definition at line 35 of file TrackerSystematicMisalignments.cc.

References edm::ParameterSet::getUntrackedParameter(), m_bowingEpsilon, m_ellipticalDelta, m_ellipticalEpsilon, m_fromDBGeom, m_layerRotEpsilon, m_radialEpsilon, m_sagittaDelta, m_sagittaEpsilon, m_skewDelta, m_skewEpsilon, m_telescopeEpsilon, m_twistEpsilon, m_zExpEpsilon, oldMinusZconvention, and suppressBlindMvmts.

37 {
38  // use existing geometry
39  m_fromDBGeom = cfg.getUntrackedParameter< bool > ("fromDBGeom");
40 
41  // constants
42  m_radialEpsilon = cfg.getUntrackedParameter< double > ("radialEpsilon");
43  m_telescopeEpsilon = cfg.getUntrackedParameter< double > ("telescopeEpsilon");
44  m_layerRotEpsilon = cfg.getUntrackedParameter< double > ("layerRotEpsilon");
45  m_bowingEpsilon = cfg.getUntrackedParameter< double > ("bowingEpsilon");
46  m_zExpEpsilon = cfg.getUntrackedParameter< double > ("zExpEpsilon");
47  m_twistEpsilon = cfg.getUntrackedParameter< double > ("twistEpsilon");
48  m_ellipticalEpsilon = cfg.getUntrackedParameter< double > ("ellipticalEpsilon");
49  m_skewEpsilon = cfg.getUntrackedParameter< double > ("skewEpsilon");
50  m_sagittaEpsilon = cfg.getUntrackedParameter< double > ("sagittaEpsilon");
51 
52  m_ellipticalDelta = cfg.getUntrackedParameter< double > ("ellipticalDelta");
53  m_skewDelta = cfg.getUntrackedParameter< double > ("skewDelta");
54  m_sagittaDelta = cfg.getUntrackedParameter< double > ("sagittaDelta");
55 
56  if (m_radialEpsilon > -990.0){
57  edm::LogWarning("MisalignedTracker") << "Applying radial ...";
58  }
59  if (m_telescopeEpsilon > -990.0){
60  edm::LogWarning("MisalignedTracker") << "Applying telescope ...";
61  }
62  if (m_layerRotEpsilon > -990.0){
63  edm::LogWarning("MisalignedTracker") << "Applying layer rotation ...";
64  }
65  if (m_bowingEpsilon > -990.0){
66  edm::LogWarning("MisalignedTracker") << "Applying bowing ...";
67  }
68  if (m_zExpEpsilon > -990.0){
69  edm::LogWarning("MisalignedTracker") << "Applying z-expansion ...";
70  }
71  if (m_twistEpsilon > -990.0){
72  edm::LogWarning("MisalignedTracker") << "Applying twist ...";
73  }
74  if (m_ellipticalEpsilon > -990.0){
75  edm::LogWarning("MisalignedTracker") << "Applying elliptical ...";
76  }
77  if (m_skewEpsilon > -990.0){
78  edm::LogWarning("MisalignedTracker") << "Applying skew ...";
79  }
80  if (m_sagittaEpsilon > -990.0){
81  edm::LogWarning("MisalignedTracker") << "Applying sagitta ...";
82  }
83 
84  // get flag for suppression of blind movements
85  suppressBlindMvmts = cfg.getUntrackedParameter< bool > ("suppressBlindMvmts");
87  {
88  edm::LogWarning("MisalignedTracker") << "Blind movements suppressed (TIB/TOB in z, TID/TEC in r)";
89  }
90 
91  // compatibility with old (weird) z convention
92  oldMinusZconvention = cfg.getUntrackedParameter< bool > ("oldMinusZconvention");
94  {
95  edm::LogWarning("MisalignedTracker") << "Old z convention: dz --> -dz";
96  }
97  else
98  {
99  edm::LogWarning("MisalignedTracker") << "New z convention: dz --> dz";
100  }
101 
102 }
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

void TrackerSystematicMisalignments::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 110 of file TrackerSystematicMisalignments.cc.

References AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), GeometryAligner::applyAlignments(), applySystematicMisalignment(), cond::service::PoolDBOutputService::beginOfTime(), TrackerGeomBuilderFromGeometricDet::build(), relativeConstraints::geom, edm::EventSetup::get(), edm::Service< T >::isAvailable(), m_fromDBGeom, theAlignableTracker, patCandidatesForDimuonsSequences_cff::tracker, and cond::service::PoolDBOutputService::writeOne().

110  {
111 
112 
114  setup.get<IdealGeometryRecord>().get(geom);
116 
117  //take geometry from DB or randomly generate geometry
118  if (m_fromDBGeom){
119  //build the tracker
120  edm::ESHandle<Alignments> alignments;
121  edm::ESHandle<AlignmentErrors> alignmentErrors;
122 
123  setup.get<TrackerAlignmentRcd>().get(alignments);
124  setup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
125 
126  //apply the latest alignments
127  GeometryAligner aligner;
128  aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors), AlignTransform() );
129 
130  }
131 
132  theAlignableTracker = new AlignableTracker(&(*tracker));
133 
135 
136  // -------------- writing out to alignment record --------------
137  Alignments* myAlignments = theAlignableTracker->alignments() ;
138  AlignmentErrors* myAlignmentErrors = theAlignableTracker->alignmentErrors() ;
139 
140  // Store alignment[Error]s to DB
142  std::string theAlignRecordName = "TrackerAlignmentRcd";
143  std::string theErrorRecordName = "TrackerAlignmentErrorRcd";
144 
145  // Call service
146  if( !poolDbService.isAvailable() ) // Die if not available
147  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
148 
149  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
150  poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), theErrorRecordName);
151 }
Class to update a given geometry with a set of alignments.
bool isAvailable() const
Definition: Service.h:47
AlignmentErrors * alignmentErrors() const
Return alignment errors, sorted by DetId.
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrors *alignmentErrors, const AlignTransform &globalCoordinates)
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd)
Alignments * alignments() const
Return alignments, sorted by DetId.
void TrackerSystematicMisalignments::applySystematicMisalignment ( Alignable ali)
private

Definition at line 153 of file TrackerSystematicMisalignments.cc.

References Alignable::alignableObjectId(), Alignable::components(), findSystematicMis(), Alignable::geomDetId(), Alignable::globalPosition(), i, testEve_cfg::level, Alignable::move(), DetId::subdetId(), suppressBlindMvmts, SiStripDetId::TEC, SiStripDetId::TIB, SiStripDetId::TID, and SiStripDetId::TOB.

Referenced by analyze().

154 {
155 
156  const align::Alignables& comp = ali->components();
157  unsigned int nComp = comp.size();
158  //move then do for lower level object
159  //for issue of det vs detunit
160  bool usecomps = true;
161  if ((ali->alignableObjectId()==2)&&(nComp>=1)) usecomps = false;
162  for (unsigned int i = 0; i < nComp; ++i){
163  if (usecomps) applySystematicMisalignment(comp[i]);
164  }
165 
166  // if suppression of blind mvmts: check if subdet is blind to a certain mode
167  bool blindToZ(false), blindToR(false);
168  if (suppressBlindMvmts)
169  {
170  const int subdetid = ali->geomDetId().subdetId();
171  switch(subdetid)
172  {
173  // TIB/TON blind to z
174  case SiStripDetId::TIB:
175  case SiStripDetId::TOB:
176  blindToZ = true;
177  break;
178  // TID/TEC blind to R
179  case SiStripDetId::TID:
180  case SiStripDetId::TEC:
181  blindToR = true;
182  break;
183  default:
184  break;
185  }
186  }
187 
188  const int level = ali->alignableObjectId();
189  if ((level == 1)||(level == 2)){
190  const align::PositionType gP = ali->globalPosition();
191  const align::GlobalVector gVec = findSystematicMis( gP, blindToZ, blindToR);
192  ali->move( gVec );
193  }
194 }
int i
Definition: DBlmapReader.cc:9
align::GlobalVector findSystematicMis(align::PositionType, const bool blindToZ, const bool blindToR)
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual Alignables components() const =0
Return vector of all direct components.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:129
tuple level
Definition: testEve_cfg.py:34
const DetId & geomDetId() const
Definition: Alignable.h:177
void TrackerSystematicMisalignments::beginJob ( void  )
virtual

Read ideal tracker geometry from DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 104 of file TrackerSystematicMisalignments.cc.

105 {
106 
107 }
align::GlobalVector TrackerSystematicMisalignments::findSystematicMis ( align::PositionType  globalPos,
const bool  blindToZ,
const bool  blindToR 
)
private

Definition at line 196 of file TrackerSystematicMisalignments.cc.

References funct::cos(), m_bowingEpsilon, m_ellipticalDelta, m_ellipticalEpsilon, m_layerRotEpsilon, m_radialEpsilon, m_sagittaDelta, m_sagittaEpsilon, m_skewDelta, m_skewEpsilon, m_telescopeEpsilon, m_twistEpsilon, m_zExpEpsilon, oldMinusZconvention, PV3DBase< T, PVType, FrameType >::phi(), funct::sin(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by applySystematicMisalignment().

196  {
197 //align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( align::PositionType globalPos ){
198  // calculates shift for the current alignable
199  // all corrections are calculated w.r.t. the original geometry
200  double deltaX = 0.0;
201  double deltaY = 0.0;
202  double deltaZ = 0.0;
203  const double oldX = globalPos.x();
204  const double oldY = globalPos.y();
205  const double oldZ = globalPos.z();
206  const double oldPhi = globalPos.phi();
207  const double oldR = sqrt(globalPos.x()*globalPos.x() + globalPos.y()*globalPos.y());
208 
209  if (m_radialEpsilon > -990.0 && !blindToR){
210  deltaX += m_radialEpsilon*oldX;
211  deltaY += m_radialEpsilon*oldY;
212  }
213  if (m_telescopeEpsilon > -990.0 && !blindToZ){
214  deltaZ += m_telescopeEpsilon*oldR;
215  }
216  if (m_layerRotEpsilon > -990.0){
217  // The following number was chosen such that the Layer Rotation systematic
218  // misalignment would not cause an overall rotation of the tracker.
219  const double Roffset = 57.0;
220  const double xP = oldR*cos(oldPhi+m_layerRotEpsilon*(oldR-Roffset));
221  const double yP = oldR*sin(oldPhi+m_layerRotEpsilon*(oldR-Roffset));
222  deltaX += (xP - oldX);
223  deltaY += (yP - oldY);
224  }
225  if (m_bowingEpsilon > -990.0 && !blindToR){
226  const double trackeredgePlusZ=271.846;
227  const double bowfactor=m_bowingEpsilon*(trackeredgePlusZ*trackeredgePlusZ-oldZ*oldZ);
228  deltaX += oldX*bowfactor;
229  deltaY += oldY*bowfactor;
230  }
231  if (m_zExpEpsilon > -990.0 && !blindToZ){
232  deltaZ += oldZ*m_zExpEpsilon;
233  }
234  if (m_twistEpsilon > -990.0){
235  const double xP = oldR*cos(oldPhi+m_twistEpsilon*oldZ);
236  const double yP = oldR*sin(oldPhi+m_twistEpsilon*oldZ);
237  deltaX += (xP - oldX);
238  deltaY += (yP - oldY);
239  }
240  if (m_ellipticalEpsilon > -990.0 && !blindToR){
241  deltaX += oldX*m_ellipticalEpsilon*cos(2.0*oldPhi + m_ellipticalDelta);
242  deltaY += oldY*m_ellipticalEpsilon*cos(2.0*oldPhi + m_ellipticalDelta);
243  }
244  if (m_skewEpsilon > -990.0 && !blindToZ){
245  deltaZ += m_skewEpsilon*cos(oldPhi + m_skewDelta);
246  }
247  if (m_sagittaEpsilon > -990.0){
248  // deltaX += oldX/fabs(oldX)*m_sagittaEpsilon; // old one...
249  deltaX += oldR*m_sagittaEpsilon*sin(m_sagittaDelta);
250  deltaY += oldR*m_sagittaEpsilon*cos(m_sagittaDelta); //Delta y is cos so that delta=0 reflects the old behavior
251  }
252 
253  // Compatibility with old version <= 1.5
254  if (oldMinusZconvention) deltaZ = -deltaZ;
255 
256  align::GlobalVector gV( deltaX, deltaY, deltaZ );
257  return gV;
258 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T x() const
Definition: PV3DBase.h:61

Member Data Documentation

double TrackerSystematicMisalignments::m_bowingEpsilon
private
double TrackerSystematicMisalignments::m_ellipticalDelta
private
double TrackerSystematicMisalignments::m_ellipticalEpsilon
private
bool TrackerSystematicMisalignments::m_fromDBGeom
private

Definition at line 47 of file TrackerSystematicMisalignments.h.

Referenced by analyze(), and TrackerSystematicMisalignments().

double TrackerSystematicMisalignments::m_layerRotEpsilon
private
double TrackerSystematicMisalignments::m_radialEpsilon
private
double TrackerSystematicMisalignments::m_sagittaDelta
private
double TrackerSystematicMisalignments::m_sagittaEpsilon
private
double TrackerSystematicMisalignments::m_skewDelta
private
double TrackerSystematicMisalignments::m_skewEpsilon
private
double TrackerSystematicMisalignments::m_telescopeEpsilon
private
double TrackerSystematicMisalignments::m_twistEpsilon
private
double TrackerSystematicMisalignments::m_zExpEpsilon
private
bool TrackerSystematicMisalignments::oldMinusZconvention
private
bool TrackerSystematicMisalignments::suppressBlindMvmts
private
AlignableTracker* TrackerSystematicMisalignments::theAlignableTracker
private

Definition at line 42 of file TrackerSystematicMisalignments.h.

Referenced by analyze().