CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
WriteESAlignments Class Reference

#include <WriteESAlignments.h>

Public Types

typedef std::vector< AlignTransformAliVec
 
typedef std::vector< double > DVec
 
typedef AlignTransform::Rotation Rot
 
typedef AlignTransform::Translation Trl
 

Public Member Functions

void writeAlignments (const edm::EventSetup &eventSetup, const DVec &alphaVec, const DVec &betaVec, const DVec &gammaVec, const DVec &xtranslVec, const DVec &ytranslVec, const DVec &ztranslVec)
 
 WriteESAlignments (edm::ConsumesCollector &&cc)
 

Static Public Attributes

static const unsigned int k_nA = EcalPreshowerGeometry::numberOfAlignments()
 

Private Member Functions

void convert (const edm::EventSetup &eS, const DVec &a, const DVec &b, const DVec &g, const DVec &x, const DVec &y, const DVec &z, AliVec &va)
 
void write (const Alignments &ali)
 

Private Attributes

edm::ESGetToken< Alignments, ESAlignmentRcdalignmentToken_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometryToken_
 

Detailed Description

Definition at line 14 of file WriteESAlignments.h.

Member Typedef Documentation

◆ AliVec

Definition at line 16 of file WriteESAlignments.h.

◆ DVec

typedef std::vector<double> WriteESAlignments::DVec

Definition at line 21 of file WriteESAlignments.h.

◆ Rot

Definition at line 19 of file WriteESAlignments.h.

◆ Trl

Definition at line 18 of file WriteESAlignments.h.

Constructor & Destructor Documentation

◆ WriteESAlignments()

WEA::WriteESAlignments ( edm::ConsumesCollector &&  cc)

Definition at line 17 of file WriteESAlignments.cc.

References gpuPixelDoublets::cc.

uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
edm::ESGetToken< Alignments, ESAlignmentRcd > alignmentToken_

Member Function Documentation

◆ convert()

void WEA::convert ( const edm::EventSetup eS,
const DVec a,
const DVec b,
const DVec g,
const DVec x,
const DVec y,
const DVec z,
WEA::AliVec va 
)
private

Definition at line 54 of file WriteESAlignments.cc.

References a, alignmentToken_, alpha, b, HLT_2023v12_cff::beta, EcalPreshowerGeometry::detIdFromLocalAlignmentIndex(), DetId::Ecal, EcalPreshower, g, CustomPhysics_cfi::gamma, relativeConstraints::geom, geometryToken_, edm::EventSetup::getData(), mps_fire::i, l1ctLayer2EG_cff::id, k_nA, idealTransformation::rotation, x, y, and z.

Referenced by writeAlignments().

61  {
62  const auto& pG = eS.getData(geometryToken_);
63 
64  const CaloSubdetectorGeometry* geom(pG.getSubdetectorGeometry(DetId::Ecal, EcalPreshower));
65 
66  const auto& pA = eS.getData(alignmentToken_);
67  const AliVec& vaPrev(pA.m_align);
68 
69  va.reserve(k_nA);
70  for (unsigned int i(0); i != k_nA; ++i) {
71  // ordering of i is: left, right, left, right,...
72  // starting at ES- rear, then ES- front,
73  // then ES+ front, then ES+ rear
74 
76 
77  double zPlanePrev(geom->getGeometry(id)->getPosition().z());
78  const double zAlignPrev(vaPrev[i].translation().z());
79  const Trl q_I(0, 0, zPlanePrev - zAlignPrev);
80  const Trl& s_p(vaPrev[i].translation());
81  const Trl t_n(x[i], y[i], z[i]);
82  const Rot G_p(vaPrev[i].rotation());
83  const double gamma(g[i]);
84  const double alpha(a[i]);
85  const double beta(b[i]);
86 
87  const Rot L_n( // New rotation in local frame!
88  Rot(Rot(Rot().rotateZ(-gamma)).rotateX(-alpha)).rotateY(-beta));
89 
90  const Rot InvL_n(L_n.inverse());
91 
92  const Rot G_n(InvL_n * G_p);
93 
94  const Trl s_n(t_n + s_p + q_I - InvL_n * q_I);
95 
96  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", q_I=" << q_I;
97  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", s_p=" << s_p;
98  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", alpha = " << 1000. * alpha << " mr";
99  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", beta = " << 1000. * beta << " mr";
100  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", gamma = " << 1000. * gamma << " mr";
101  edm::LogVerbatim("WriteESAlignments")
102  << " For i = " << i << ", L_n = " << L_n << " Euler angles=" << InvL_n.eulerAngles() << "\n";
103  edm::LogVerbatim("WriteESAlignments") << "For i = " << i << ", t_n=" << t_n;
104  edm::LogVerbatim("WriteESAlignments")
105  << "For i = " << i << ", G_p=" << G_p << " Euler angles=" << G_p.eulerAngles() << "\n";
106  edm::LogVerbatim("WriteESAlignments")
107  << " For i = " << i << ", InvL_n = " << InvL_n << " Euler angles=" << InvL_n.eulerAngles() << "\n";
108  edm::LogVerbatim("WriteESAlignments")
109  << " For i =" << i << ", G_n = " << G_n << " Euler angles=" << G_n.eulerAngles() << "\n";
110  edm::LogVerbatim("WriteESAlignments") << " For i =" << i << ", s_n = " << s_n;
111  edm::LogVerbatim("WriteESAlignments") << "++++++++++++++++++++++++++\n\n";
112 
113  va.emplace_back(AlignTransform(s_n, G_n, id));
114  }
115 }
AlignTransform::Rotation Rot
Log< level::Info, true > LogVerbatim
AlignTransform::Translation Trl
float alpha
Definition: AMPTWrapper.h:105
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::vector< AlignTransform > AliVec
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
double b
Definition: hdecay.h:118
static const unsigned int k_nA
double a
Definition: hdecay.h:119
edm::ESGetToken< Alignments, ESAlignmentRcd > alignmentToken_

◆ write()

void WEA::write ( const Alignments ali)
private

Definition at line 43 of file WriteESAlignments.cc.

References cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by writeAlignments().

43  {
44  edm::LogVerbatim("WriteESAlignments") << "Uploading ES alignments to the database";
45 
47 
48  if (!poolDbService.isAvailable())
49  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
50 
51  poolDbService->writeOneIOV<Alignments>(ali, poolDbService->currentTime(), "ESAlignmentRcd");
52 }
Log< level::Info, true > LogVerbatim
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40

◆ writeAlignments()

void WEA::writeAlignments ( const edm::EventSetup eventSetup,
const DVec alphaVec,
const DVec betaVec,
const DVec gammaVec,
const DVec xtranslVec,
const DVec ytranslVec,
const DVec ztranslVec 
)

Definition at line 21 of file WriteESAlignments.cc.

References cms::cuda::assert(), convert(), options_cfi::eventSetup, k_nA, and write().

27  {
28  assert(alphaVec.size() == k_nA);
29  assert(betaVec.size() == k_nA);
30  assert(gammaVec.size() == k_nA);
31  assert(xtranslVec.size() == k_nA);
32  assert(ytranslVec.size() == k_nA);
33  assert(ztranslVec.size() == k_nA);
34 
35  Alignments ali;
36  AliVec& vali(ali.m_align);
37 
38  convert(eventSetup, alphaVec, betaVec, gammaVec, xtranslVec, ytranslVec, ztranslVec, vali);
39 
40  write(ali);
41 }
std::vector< AlignTransform > AliVec
assert(be >=bs)
void write(const Alignments &ali)
static const unsigned int k_nA
void convert(const edm::EventSetup &eS, const DVec &a, const DVec &b, const DVec &g, const DVec &x, const DVec &y, const DVec &z, AliVec &va)

Member Data Documentation

◆ alignmentToken_

edm::ESGetToken<Alignments, ESAlignmentRcd> WriteESAlignments::alignmentToken_
private

Definition at line 48 of file WriteESAlignments.h.

Referenced by convert().

◆ geometryToken_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> WriteESAlignments::geometryToken_
private

Definition at line 47 of file WriteESAlignments.h.

Referenced by convert().

◆ k_nA

const unsigned int WEA::k_nA = EcalPreshowerGeometry::numberOfAlignments()
static

Definition at line 23 of file WriteESAlignments.h.

Referenced by convert(), and writeAlignments().