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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
const edm::ParameterSet theParameterSet
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 16:23:32
Revision:
1.6
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_ellipticalEpsilon, m_fromDBGeom, m_layerRotEpsilon, m_radialEpsilon, m_saggitaEpsilon, 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_saggitaEpsilon = cfg.getUntrackedParameter< double > ("saggitaEpsilon");
52 
53  if (m_radialEpsilon > -990.0){
54  edm::LogWarning("MisalignedTracker") << "Applying radial ...";
55  }
56  if (m_telescopeEpsilon > -990.0){
57  edm::LogWarning("MisalignedTracker") << "Applying telescope ...";
58  }
59  if (m_layerRotEpsilon > -990.0){
60  edm::LogWarning("MisalignedTracker") << "Applying layer rotation ...";
61  }
62  if (m_bowingEpsilon > -990.0){
63  edm::LogWarning("MisalignedTracker") << "Applying bowing ...";
64  }
65  if (m_zExpEpsilon > -990.0){
66  edm::LogWarning("MisalignedTracker") << "Applying z-expansion ...";
67  }
68  if (m_twistEpsilon > -990.0){
69  edm::LogWarning("MisalignedTracker") << "Applying twist ...";
70  }
71  if (m_ellipticalEpsilon > -990.0){
72  edm::LogWarning("MisalignedTracker") << "Applying elliptical ...";
73  }
74  if (m_skewEpsilon > -990.0){
75  edm::LogWarning("MisalignedTracker") << "Applying skew ...";
76  }
77  if (m_saggitaEpsilon > -990.0){
78  edm::LogWarning("MisalignedTracker") << "Applying saggita ...";
79  }
80 
81  // get flag for suppression of blind movements
82  suppressBlindMvmts = cfg.getUntrackedParameter< bool > ("suppressBlindMvmts");
84  {
85  edm::LogWarning("MisalignedTracker") << "Blind movements suppressed (TIB/TOB in z, TID/TEC in r)";
86  }
87 
88  // compatibility with old (weird) z convention
89  oldMinusZconvention = cfg.getUntrackedParameter< bool > ("oldMinusZconvention");
91  {
92  edm::LogWarning("MisalignedTracker") << "Old z convention: dz --> -dz";
93  }
94  else
95  {
96  edm::LogWarning("MisalignedTracker") << "New z convention: dz --> dz";
97  }
98 
99 }
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 107 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().

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

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

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

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

197  {
198 //align::GlobalVector TrackerSystematicMisalignments::findSystematicMis( align::PositionType globalPos ){
199  // calculates shift for the current alignable
200  // all corrections are calculated w.r.t. the original geometry
201  double deltaX = 0.0;
202  double deltaY = 0.0;
203  double deltaZ = 0.0;
204  const double oldX = globalPos.x();
205  const double oldY = globalPos.y();
206  const double oldZ = globalPos.z();
207  const double oldPhi = globalPos.phi();
208  const double oldR = sqrt(globalPos.x()*globalPos.x() + globalPos.y()*globalPos.y());
209 
210  if (m_radialEpsilon > -990.0 && !blindToR){
211  deltaX += m_radialEpsilon*oldX;
212  deltaY += m_radialEpsilon*oldY;
213  }
214  if (m_telescopeEpsilon > -990.0 && !blindToZ){
215  deltaZ += m_telescopeEpsilon*oldR;
216  }
217  if (m_layerRotEpsilon > -990.0){
218  // The following number was chosen such that the Layer Rotation systematic
219  // misalignment would not cause an overall rotation of the tracker.
220  const double Roffset = 57.0;
221  const double xP = oldR*cos(oldPhi+m_layerRotEpsilon*(oldR-Roffset));
222  const double yP = oldR*sin(oldPhi+m_layerRotEpsilon*(oldR-Roffset));
223  deltaX += (xP - oldX);
224  deltaY += (yP - oldY);
225  }
226  if (m_bowingEpsilon > -990.0 && !blindToR){
227  const double trackeredgePlusZ=271.846;
228  const double bowfactor=m_bowingEpsilon*(trackeredgePlusZ*trackeredgePlusZ-oldZ*oldZ);
229  deltaX += oldX*bowfactor;
230  deltaY += oldY*bowfactor;
231  }
232  if (m_zExpEpsilon > -990.0 && !blindToZ){
233  deltaZ += oldZ*m_zExpEpsilon;
234  }
235  if (m_twistEpsilon > -990.0){
236  const double xP = oldR*cos(oldPhi+m_twistEpsilon*oldZ);
237  const double yP = oldR*sin(oldPhi+m_twistEpsilon*oldZ);
238  deltaX += (xP - oldX);
239  deltaY += (yP - oldY);
240  }
241  if (m_ellipticalEpsilon > -990.0 && !blindToR){
242  deltaX += oldX*m_ellipticalEpsilon*cos(2.0*oldPhi);
243  deltaY += oldY*m_ellipticalEpsilon*cos(2.0*oldPhi);
244  }
245  if (m_skewEpsilon > -990.0 && !blindToZ){
246  deltaZ += m_skewEpsilon*cos(oldPhi);
247  }
248  if (m_saggitaEpsilon > -990.0){
249  // deltaX += oldX/fabs(oldX)*m_saggitaEpsilon; // old one...
250  deltaY += oldR*m_saggitaEpsilon;
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: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_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_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 45 of file TrackerSystematicMisalignments.h.

Referenced by analyze().

const edm::ParameterSet TrackerSystematicMisalignments::theParameterSet
private

Definition at line 68 of file TrackerSystematicMisalignments.h.

Referenced by analyze().