CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 AlignmentsAliPtr
 
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 (AliPtr aliPtr)
 

Private Attributes

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

Detailed Description

Definition at line 14 of file WriteESAlignments.h.

Member Typedef Documentation

◆ AliPtr

Definition at line 16 of file WriteESAlignments.h.

◆ AliVec

Definition at line 17 of file WriteESAlignments.h.

◆ DVec

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

Definition at line 22 of file WriteESAlignments.h.

◆ Rot

Definition at line 20 of file WriteESAlignments.h.

◆ Trl

Definition at line 19 of file WriteESAlignments.h.

Constructor & Destructor Documentation

◆ WriteESAlignments()

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

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 53 of file WriteESAlignments.cc.

60  {
61  const auto& pG = eS.getData(geometryToken_);
62 
63  const CaloSubdetectorGeometry* geom(pG.getSubdetectorGeometry(DetId::Ecal, EcalPreshower));
64 
65  const auto& pA = eS.getData(alignmentToken_);
66  const AliVec& vaPrev(pA.m_align);
67 
68  va.reserve(k_nA);
69  for (unsigned int i(0); i != k_nA; ++i) {
70  // ordering of i is: left, right, left, right,...
71  // starting at ES- rear, then ES- front,
72  // then ES+ front, then ES+ rear
73 
75 
76  double zPlanePrev(geom->getGeometry(id)->getPosition().z());
77  const double zAlignPrev(vaPrev[i].translation().z());
78  const Trl q_I(0, 0, zPlanePrev - zAlignPrev);
79  const Trl& s_p(vaPrev[i].translation());
80  const Trl t_n(x[i], y[i], z[i]);
81  const Rot G_p(vaPrev[i].rotation());
82  const double gamma(g[i]);
83  const double alpha(a[i]);
84  const double beta(b[i]);
85 
86  const Rot L_n( // New rotation in local frame!
87  Rot(Rot(Rot().rotateZ(-gamma)).rotateX(-alpha)).rotateY(-beta));
88 
89  const Rot InvL_n(L_n.inverse());
90 
91  const Rot G_n(InvL_n * G_p);
92 
93  const Trl s_n(t_n + s_p + q_I - InvL_n * q_I);
94 
95  std::cout << "For i = " << i << ", q_I=" << q_I << std::endl;
96  std::cout << "For i = " << i << ", s_p=" << s_p << std::endl;
97  std::cout << "For i = " << i << ", alpha = " << 1000. * alpha << " mr" << std::endl;
98  std::cout << "For i = " << i << ", beta = " << 1000. * beta << " mr" << std::endl;
99  std::cout << "For i = " << i << ", gamma = " << 1000. * gamma << " mr" << std::endl;
100  std::cout << " For i = " << i << ", L_n = " << L_n << " Euler angles=" << InvL_n.eulerAngles() << "\n"
101  << std::endl;
102  std::cout << "For i = " << i << ", t_n=" << t_n << std::endl;
103  std::cout << "For i = " << i << ", G_p=" << G_p << " Euler angles=" << G_p.eulerAngles() << "\n" << std::endl;
104  std::cout << " For i = " << i << ", InvL_n = " << InvL_n << " Euler angles=" << InvL_n.eulerAngles() << "\n"
105  << std::endl;
106  std::cout << " For i =" << i << ", G_n = " << G_n << " Euler angles=" << G_n.eulerAngles() << "\n" << std::endl;
107  std::cout << " For i =" << i << ", s_n = " << s_n << std::endl;
108  std::cout << "++++++++++++++++++++++++++\n\n" << std::endl;
109 
110  va.emplace_back(AlignTransform(s_n, G_n, id));
111  }
112 }

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

Referenced by writeAlignments().

◆ write()

void WEA::write ( WEA::AliPtr  aliPtr)
private

Definition at line 42 of file WriteESAlignments.cc.

42  {
43  std::cout << "Uploading ES alignments to the database" << std::endl;
44 
46 
47  if (!poolDbService.isAvailable())
48  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
49 
50  poolDbService->writeOne<Alignments>(&(*aliPtr), poolDbService->currentTime(), "ESAlignmentRcd");
51 }

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

Referenced by writeAlignments().

◆ 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 20 of file WriteESAlignments.cc.

26  {
27  assert(alphaVec.size() == k_nA);
28  assert(betaVec.size() == k_nA);
29  assert(gammaVec.size() == k_nA);
30  assert(xtranslVec.size() == k_nA);
31  assert(ytranslVec.size() == k_nA);
32  assert(ztranslVec.size() == k_nA);
33 
34  AliPtr aliPtr(new Alignments); // writeOne will take ownership!
35  AliVec& vali(aliPtr->m_align);
36 
37  convert(eventSetup, alphaVec, betaVec, gammaVec, xtranslVec, ytranslVec, ztranslVec, vali);
38 
39  write(aliPtr);
40 }

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

Member Data Documentation

◆ alignmentToken_

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

Definition at line 49 of file WriteESAlignments.h.

Referenced by convert().

◆ geometryToken_

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

Definition at line 48 of file WriteESAlignments.h.

Referenced by convert().

◆ k_nA

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

Definition at line 24 of file WriteESAlignments.h.

Referenced by convert(), and writeAlignments().

WriteESAlignments::AliVec
std::vector< AlignTransform > AliVec
Definition: WriteESAlignments.h:17
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
edm::ESInputTag
Definition: ESInputTag.h:87
WriteESAlignments::alignmentToken_
edm::ESGetToken< Alignments, ESAlignmentRcd > alignmentToken_
Definition: WriteESAlignments.h:49
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
ESAlignmentRcd
Definition: ESAlignmentRcd.h:6
EcalPreshowerGeometry::detIdFromLocalAlignmentIndex
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
Definition: EcalPreshowerGeometry.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
WriteESAlignments::Trl
AlignTransform::Translation Trl
Definition: WriteESAlignments.h:19
cms::cuda::assert
assert(be >=bs)
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
ESDetId
Definition: ESDetId.h:15
DDAxes::x
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
WriteESAlignments::write
void write(AliPtr aliPtr)
Definition: WriteESAlignments.cc:42
CaloGeometry
Definition: CaloGeometry.h:21
DDAxes::z
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
b
double b
Definition: hdecay.h:118
AlignTransform
Definition: AlignTransform.h:15
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
a
double a
Definition: hdecay.h:119
WriteESAlignments::k_nA
static const unsigned int k_nA
Definition: WriteESAlignments.h:24
edm::Service< cond::service::PoolDBOutputService >
DetId::Ecal
Definition: DetId.h:27
cc
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
EcalPreshower
Definition: EcalSubdetector.h:10
WriteESAlignments::AliPtr
Alignments * AliPtr
Definition: WriteESAlignments.h:16
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:57
WriteESAlignments::geometryToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
Definition: WriteESAlignments.h:48
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
WriteESAlignments::Rot
AlignTransform::Rotation Rot
Definition: WriteESAlignments.h:20
cms::Exception
Definition: Exception.h:70
Alignments
Definition: Alignments.h:10
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189
g
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
WriteESAlignments::convert
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)
Definition: WriteESAlignments.cc:53