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_ellipticalEpsilon
 
bool m_fromDBGeom
 
double m_layerRotEpsilon
 
double m_radialEpsilon
 
double m_saggitaEpsilon
 
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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Class to misaligned tracker from DB.

Date:
2009/12/17 20:46:50
Revision:
1.3
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_ellipticalEpsilon, m_fromDBGeom, m_layerRotEpsilon, m_radialEpsilon, m_saggitaEpsilon, m_skewEpsilon, m_telescopeEpsilon, m_twistEpsilon, m_zExpEpsilon, oldMinusZconvention, and suppressBlindMvmts.

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

105  {
106 
107 
109  setup.get<IdealGeometryRecord>().get(geom);
111 
112  //take geometry from DB or randomly generate geometry
113  if (m_fromDBGeom){
114  //build the tracker
115  edm::ESHandle<Alignments> alignments;
116  edm::ESHandle<AlignmentErrors> alignmentErrors;
117 
118  setup.get<TrackerAlignmentRcd>().get(alignments);
119  setup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
120 
121  //apply the latest alignments
122  GeometryAligner aligner;
123  aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors), AlignTransform() );
124 
125  }
126 
127  theAlignableTracker = new AlignableTracker(&(*tracker));
128 
130 
131  // -------------- writing out to alignment record --------------
132  Alignments* myAlignments = theAlignableTracker->alignments() ;
133  AlignmentErrors* myAlignmentErrors = theAlignableTracker->alignmentErrors() ;
134 
135  // Store alignment[Error]s to DB
137  std::string theAlignRecordName = "TrackerAlignmentRcd";
138  std::string theErrorRecordName = "TrackerAlignmentErrorRcd";
139 
140  // Call service
141  if( !poolDbService.isAvailable() ) // Die if not available
142  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
143 
144  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
145  poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), theErrorRecordName);
146 }
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 148 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().

149 {
150 
151  const align::Alignables& comp = ali->components();
152  unsigned int nComp = comp.size();
153  //move then do for lower level object
154  //for issue of det vs detunit
155  bool usecomps = true;
156  if ((ali->alignableObjectId()==2)&&(nComp>=1)) usecomps = false;
157  for (unsigned int i = 0; i < nComp; ++i){
158  if (usecomps) applySystematicMisalignment(comp[i]);
159  }
160 
161  // if suppression of blind mvmts: check if subdet is blind to a certain mode
162  bool blindToZ(false), blindToR(false);
163  if (suppressBlindMvmts)
164  {
165  const int subdetid = ali->geomDetId().subdetId();
166  switch(subdetid)
167  {
168  // TIB/TON blind to z
169  case SiStripDetId::TIB:
170  case SiStripDetId::TOB:
171  blindToZ = true;
172  break;
173  // TID/TEC blind to R
174  case SiStripDetId::TID:
175  case SiStripDetId::TEC:
176  blindToR = true;
177  break;
178  default:
179  break;
180  }
181  }
182 
183  const int level = ali->alignableObjectId();
184  if ((level == 1)||(level == 2)){
185  const align::PositionType gP = ali->globalPosition();
186  const align::GlobalVector gVec = findSystematicMis( gP, blindToZ, blindToR);
187  ali->move( gVec );
188  }
189 }
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 99 of file TrackerSystematicMisalignments.cc.

100 {
101 
102 }
align::GlobalVector TrackerSystematicMisalignments::findSystematicMis ( align::PositionType  globalPos,
const bool  blindToZ,
const bool  blindToR 
)
private

Definition at line 191 of file TrackerSystematicMisalignments.cc.

References funct::cos(), m_bowingEpsilon, m_ellipticalEpsilon, m_layerRotEpsilon, m_radialEpsilon, m_saggitaEpsilon, 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().

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

Member Data Documentation

double TrackerSystematicMisalignments::m_bowingEpsilon
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_saggitaEpsilon
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().