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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 38 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.

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

113  {
114 
115  //Retrieve tracker topology from geometry
116  edm::ESHandle<TrackerTopology> tTopoHandle;
117  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
118  const TrackerTopology* const tTopo = tTopoHandle.product();
119 
121  setup.get<IdealGeometryRecord>().get(geom);
123  setup.get<PTrackerParametersRcd>().get( ptp );
125 
126  //take geometry from DB or randomly generate geometry
127  if (m_fromDBGeom){
128  //build the tracker
129  edm::ESHandle<Alignments> alignments;
131 
132  setup.get<TrackerAlignmentRcd>().get(alignments);
133  setup.get<TrackerAlignmentErrorExtendedRcd>().get(alignmentErrors);
134 
135  //apply the latest alignments
136  GeometryAligner aligner;
137  aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors), AlignTransform() );
138 
139  }
140 
141  theAlignableTracker = new AlignableTracker(&(*tracker), tTopo);
142 
144 
145  // -------------- writing out to alignment record --------------
146  Alignments* myAlignments = theAlignableTracker->alignments() ;
147  AlignmentErrorsExtended* myAlignmentErrorsExtended = theAlignableTracker->alignmentErrors() ;
148 
149  // Store alignment[Error]s to DB
151  std::string theAlignRecordName = "TrackerAlignmentRcd";
152  std::string theErrorRecordName = "TrackerAlignmentErrorExtendedRcd";
153 
154  // Call service
155  if( !poolDbService.isAvailable() ) // Die if not available
156  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
157 
158  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
159  poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), theErrorRecordName);
160 }
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Class to update a given geometry with a set of alignments.
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp)
Alignments * alignments() const
Return alignments, sorted by DetId.
void TrackerSystematicMisalignments::applySystematicMisalignment ( Alignable ali)
private

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

163 {
164 
165  const align::Alignables& comp = ali->components();
166  unsigned int nComp = comp.size();
167  //move then do for lower level object
168  //for issue of det vs detunit
169  bool usecomps = true;
170  if ((ali->alignableObjectId()==2)&&(nComp>=1)) usecomps = false;
171  for (unsigned int i = 0; i < nComp; ++i){
172  if (usecomps) applySystematicMisalignment(comp[i]);
173  }
174 
175  // if suppression of blind mvmts: check if subdet is blind to a certain mode
176  bool blindToZ(false), blindToR(false);
177  if (suppressBlindMvmts)
178  {
179  const int subdetid = ali->geomDetId().subdetId();
180  switch(subdetid)
181  {
182  // TIB/TON blind to z
183  case SiStripDetId::TIB:
184  case SiStripDetId::TOB:
185  blindToZ = true;
186  break;
187  // TID/TEC blind to R
188  case SiStripDetId::TID:
189  case SiStripDetId::TEC:
190  blindToR = true;
191  break;
192  default:
193  break;
194  }
195  }
196 
197  const int level = ali->alignableObjectId();
198  if ((level == 1)||(level == 2)){
199  const align::PositionType gP = ali->globalPosition();
200  const align::GlobalVector gVec = findSystematicMis( gP, blindToZ, blindToR);
201  ali->move( gVec );
202  }
203 }
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 107 of file TrackerSystematicMisalignments.cc.

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

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

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