CMS 3D CMS Logo

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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 26 of file TrackerSystematicMisalignments.h.

Constructor & Destructor Documentation

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

Definition at line 41 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.

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

Member Function Documentation

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

Definition at line 116 of file TrackerSystematicMisalignments.cc.

References GeometryAligner::applyAlignments(), applySystematicMisalignment(), cond::service::PoolDBOutputService::beginOfTime(), TrackerGeomBuilderFromGeometricDet::build(), align::DetectorGlobalPosition(), relativeConstraints::geom, edm::EventSetup::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::Service< T >::isAvailable(), m_fromDBGeom, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignableTracker, trackingTruthProducer_cfi::tracker, DetId::Tracker, and cond::service::PoolDBOutputService::writeOne().

116  {
117 
118  //Retrieve tracker topology from geometry
119  edm::ESHandle<TrackerTopology> tTopoHandle;
120  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
121  const TrackerTopology* const tTopo = tTopoHandle.product();
122 
124  setup.get<IdealGeometryRecord>().get(geom);
126  setup.get<PTrackerParametersRcd>().get( ptp );
128 
129  //take geometry from DB or randomly generate geometry
130  if (m_fromDBGeom){
131  //build the tracker
132  edm::ESHandle<Alignments> alignments;
134 
135  setup.get<TrackerAlignmentRcd>().get(alignments);
136  setup.get<TrackerAlignmentErrorExtendedRcd>().get(alignmentErrors);
137 
138  edm::ESHandle<Alignments> globalPositionRcd;
139  setup.get<TrackerDigiGeometryRecord>().getRecord<GlobalPositionRcd>().get(globalPositionRcd);
140 
141  //apply the latest alignments
142  GeometryAligner aligner;
143  aligner.applyAlignments<TrackerGeometry>( &(*tracker), &(*alignments), &(*alignmentErrors),
144  align::DetectorGlobalPosition(*globalPositionRcd, DetId(DetId::Tracker)));
145 
146  }
147 
148  theAlignableTracker = new AlignableTracker(&(*tracker), tTopo);
149 
150  applySystematicMisalignment( &(*theAlignableTracker) );
151 
152  // -------------- writing out to alignment record --------------
153  Alignments* myAlignments = theAlignableTracker->alignments() ;
154  AlignmentErrorsExtended* myAlignmentErrorsExtended = theAlignableTracker->alignmentErrors() ;
155 
156  // Store alignment[Error]s to DB
158  std::string theAlignRecordName = "TrackerAlignmentRcd";
159  std::string theErrorRecordName = "TrackerAlignmentErrorExtendedRcd";
160 
161  // Call service
162  if( !poolDbService.isAvailable() ) // Die if not available
163  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
164 
165  poolDbService->writeOne<Alignments>(&(*myAlignments), poolDbService->beginOfTime(), theAlignRecordName);
166  poolDbService->writeOne<AlignmentErrorsExtended>(&(*myAlignmentErrorsExtended), poolDbService->beginOfTime(), theErrorRecordName);
167 }
Class to update a given geometry with a set of alignments.
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
bool isAvailable() const
Definition: Service.h:40
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
Definition: DetId.h:18
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
T get() const
Definition: EventSetup.h:71
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
T const * product() const
Definition: ESHandle.h:86
void TrackerSystematicMisalignments::applySystematicMisalignment ( Alignable ali)
private

Definition at line 169 of file TrackerSystematicMisalignments.cc.

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

Referenced by analyze().

170 {
171 
172  const align::Alignables& comp = ali->components();
173  unsigned int nComp = comp.size();
174  //move then do for lower level object
175  //for issue of det vs detunit
176  bool usecomps = true;
177  if ((ali->alignableObjectId()==2)&&(nComp>=1)) usecomps = false;
178  for (unsigned int i = 0; i < nComp; ++i){
179  if (usecomps) applySystematicMisalignment(comp[i]);
180  }
181 
182  // if suppression of blind mvmts: check if subdet is blind to a certain mode
183  bool blindToZ(false), blindToR(false);
184  if (suppressBlindMvmts)
185  {
186  const int subdetid = ali->geomDetId().subdetId();
187  switch(subdetid)
188  {
189  // TIB/TON blind to z
190  case SiStripDetId::TIB:
191  case SiStripDetId::TOB:
192  blindToZ = true;
193  break;
194  // TID/TEC blind to R
195  case SiStripDetId::TID:
196  case SiStripDetId::TEC:
197  blindToR = true;
198  break;
199  default:
200  break;
201  }
202  }
203 
204  const int level = ali->alignableObjectId();
205  if ((level == 1)||(level == 2)){
206  const align::PositionType gP = ali->globalPosition();
207  const align::GlobalVector gVec = findSystematicMis( gP, blindToZ, blindToR);
208  ali->move( gVec );
209  }
210 }
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual const Alignables & components() const =0
Return vector of all direct components.
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::GlobalVector findSystematicMis(const align::PositionType &, const bool blindToZ, const bool blindToR)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
const DetId & geomDetId() const
Definition: Alignable.h:186
void TrackerSystematicMisalignments::beginJob ( void  )
overridevirtual

Read ideal tracker geometry from DB.

Reimplemented from edm::EDAnalyzer.

Definition at line 110 of file TrackerSystematicMisalignments.cc.

111 {
112 
113 }
align::GlobalVector TrackerSystematicMisalignments::findSystematicMis ( const align::PositionType globalPos,
const bool  blindToZ,
const bool  blindToR 
)
private

Definition at line 212 of file TrackerSystematicMisalignments.cc.

References funct::cos(), DEFINE_FWK_MODULE, 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().

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

Referenced by analyze().