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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void applySystematicMisalignment (Alignable *)
 
align::GlobalVector findSystematicMis (const 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
 
const edm::ParameterSet theParameterSet
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Class to misaligned tracker from DB.

Date:
2012/06/13 09:24:50
Revision:
1.5
Author
Chung Khim Lae

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

111  {
112 
113  //Retrieve tracker topology from geometry
114  edm::ESHandle<TrackerTopology> tTopoHandle;
115  setup.get<IdealGeometryRecord>().get(tTopoHandle);
116  const TrackerTopology* const tTopo = tTopoHandle.product();
117 
119  setup.get<IdealGeometryRecord>().get(geom);
121 
122  //take geometry from DB or randomly generate geometry
123  if (m_fromDBGeom){
124  //build the tracker
125  edm::ESHandle<Alignments> alignments;
126  edm::ESHandle<AlignmentErrors> alignmentErrors;
127 
128  setup.get<TrackerAlignmentRcd>().get(alignments);
129  setup.get<TrackerAlignmentErrorRcd>().get(alignmentErrors);
130 
131  //apply the latest alignments
132  GeometryAligner aligner;
133  aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors), AlignTransform() );
134 
135  }
136 
137  theAlignableTracker = new AlignableTracker(&(*tracker), tTopo);
138 
140 
141  // -------------- writing out to alignment record --------------
142  Alignments* myAlignments = theAlignableTracker->alignments() ;
143  AlignmentErrors* myAlignmentErrors = theAlignableTracker->alignmentErrors() ;
144 
145  // Store alignment[Error]s to DB
147  std::string theAlignRecordName = "TrackerAlignmentRcd";
148  std::string theErrorRecordName = "TrackerAlignmentErrorRcd";
149 
150  // Call service
151  if( !poolDbService.isAvailable() ) // Die if not available
152  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
153 
154  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
155  poolDbService->writeOne<AlignmentErrors>(&(*myAlignmentErrors), poolDbService->beginOfTime(), theErrorRecordName);
156 }
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
bool isAvailable() const
Definition: Service.h:46
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
T const * product() const
Definition: ESHandle.h:62
Alignments * alignments() const
Return alignments, sorted by DetId.
void TrackerSystematicMisalignments::applySystematicMisalignment ( Alignable ali)
private

Definition at line 158 of file TrackerSystematicMisalignments.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, 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().

159 {
160 
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)) usecomps = false;
167  for (unsigned int i = 0; i < nComp; ++i){
168  if (usecomps) applySystematicMisalignment(comp[i]);
169  }
170 
171  // if suppression of blind mvmts: check if subdet is blind to a certain mode
172  bool blindToZ(false), blindToR(false);
173  if (suppressBlindMvmts)
174  {
175  const int subdetid = ali->geomDetId().subdetId();
176  switch(subdetid)
177  {
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 }
int i
Definition: DBlmapReader.cc:9
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.
align::GlobalVector findSystematicMis(const align::PositionType &, const bool blindToZ, const bool blindToR)
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:37
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 105 of file TrackerSystematicMisalignments.cc.

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

Definition at line 201 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().

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

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 50 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 45 of file TrackerSystematicMisalignments.h.

Referenced by analyze().

const edm::ParameterSet TrackerSystematicMisalignments::theParameterSet
private

Definition at line 73 of file TrackerSystematicMisalignments.h.

Referenced by analyze().