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 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 16 of file WriteESAlignments.h.

Member Typedef Documentation

Definition at line 20 of file WriteESAlignments.h.

Definition at line 21 of file WriteESAlignments.h.

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

Definition at line 26 of file WriteESAlignments.h.

Definition at line 24 of file WriteESAlignments.h.

Definition at line 23 of file WriteESAlignments.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file WriteESAlignments.cc.

References alignmentToken_.

Member Function Documentation

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

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

Referenced by writeAlignments().

75 {
76  const auto& pG = eS.getData(geometryToken_);
77 
78  const CaloSubdetectorGeometry* geom(pG.getSubdetectorGeometry( DetId::Ecal, EcalPreshower) ) ;
79 
80  const auto& pA = eS.getData(alignmentToken_);
81  const AliVec& vaPrev ( pA.m_align ) ;
82 
83  va.reserve( k_nA ) ;
84  for( unsigned int i ( 0 ) ; i != k_nA ; ++i )
85  {
86  // ordering of i is: left, right, left, right,...
87  // starting at ES- rear, then ES- front,
88  // then ES+ front, then ES+ rear
89 
91 
92  double zPlanePrev ( geom->getGeometry( id )->getPosition().z() ) ;
93  const double zAlignPrev ( vaPrev[i].translation().z() ) ;
94  const Trl q_I ( 0, 0, zPlanePrev - zAlignPrev ) ;
95  const Trl& s_p ( vaPrev[i].translation() ) ;
96  const Trl t_n ( x[i], y[i], z[i] ) ;
97  const Rot G_p ( vaPrev[i].rotation() ) ;
98  const double gamma ( g[i] ) ;
99  const double alpha ( a[i] ) ;
100  const double beta ( b[i] ) ;
101 
102  const Rot L_n ( // New rotation in local frame!
103  Rot( Rot( Rot().rotateZ( -gamma ) ).rotateX( -alpha ) ).rotateY( -beta ) ) ;
104 
105  const Rot InvL_n ( L_n.inverse() ) ;
106 
107  const Rot G_n ( InvL_n * G_p ) ;
108 
109  const Trl s_n ( t_n + s_p + q_I - InvL_n*q_I ) ;
110 
111  std::cout<<"For i = "<<i<<", q_I="<<q_I<<std::endl ;
112  std::cout<<"For i = "<<i<<", s_p="<<s_p<<std::endl ;
113  std::cout<<"For i = "<<i<<", alpha = "<<1000.*alpha<<" mr"<<std::endl;
114  std::cout<<"For i = "<<i<<", beta = "<<1000.*beta <<" mr"<<std::endl;
115  std::cout<<"For i = "<<i<<", gamma = "<<1000.*gamma<<" mr"<<std::endl;
116  std::cout<<" For i = "<<i<<", L_n = "<< L_n
117  <<" Euler angles="<<InvL_n.eulerAngles()<<"\n"<<std::endl;
118  std::cout<<"For i = "<<i<<", t_n="<<t_n<<std::endl ;
119  std::cout<<"For i = "<<i<<", G_p="<<G_p
120  <<" Euler angles="<<G_p.eulerAngles()<<"\n"<<std::endl ;
121  std::cout<<" For i = "<<i<<", InvL_n = "<< InvL_n
122  <<" Euler angles="<<InvL_n.eulerAngles()<<"\n"<<std::endl;
123  std::cout<<" For i ="<<i<<", G_n = "<< G_n
124  <<" Euler angles="<<G_n.eulerAngles()<<"\n"<<std::endl;
125  std::cout<<" For i ="<<i<<", s_n = "<< s_n<<std::endl;
126  std::cout<<"++++++++++++++++++++++++++\n\n"<<std::endl;
127 
128  va.emplace_back( AlignTransform( s_n, G_n, id ) ) ;
129  }
130 }
AlignTransform::Rotation Rot
AlignTransform::Translation Trl
float alpha
Definition: AMPTWrapper.h:95
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
bool getData(T &iHolder) const
Definition: EventSetup.h:111
static DetId detIdFromLocalAlignmentIndex(unsigned int iLoc)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
double b
Definition: hdecay.h:120
static const unsigned int k_nA
double a
Definition: hdecay.h:121
edm::ESGetToken< Alignments, ESAlignmentRcd > alignmentToken_
void WEA::write ( WEA::AliPtr  aliPtr)
private

Definition at line 52 of file WriteESAlignments.cc.

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

Referenced by writeAlignments().

53 {
54  std::cout << "Uploading ES alignments to the database" << std::endl ;
55 
57 
58  if (!poolDbService.isAvailable()) throw cms::Exception("NotAvailable")
59  << "PoolDBOutputService not available";
60 
61  poolDbService->writeOne<Alignments>(&(*aliPtr),
62  poolDbService->currentTime(),
63  "ESAlignmentRcd" ) ;
64 }
bool isAvailable() const
Definition: Service.h:40
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
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 convert(), k_nA, and write().

28 {
29  assert( alphaVec.size() == k_nA ) ;
30  assert( betaVec.size() == k_nA ) ;
31  assert( gammaVec.size() == k_nA ) ;
32  assert( xtranslVec.size() == k_nA ) ;
33  assert( ytranslVec.size() == k_nA ) ;
34  assert( ztranslVec.size() == k_nA ) ;
35 
36  AliPtr aliPtr ( new Alignments ) ;// writeOne will take ownership!
37  AliVec& vali ( aliPtr->m_align ) ;
38 
39  convert( eventSetup ,
40  alphaVec ,
41  betaVec ,
42  gammaVec ,
43  xtranslVec ,
44  ytranslVec ,
45  ztranslVec ,
46  vali ) ;
47 
48  write( aliPtr ) ;
49 }
std::vector< AlignTransform > AliVec
void write(AliPtr aliPtr)
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

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

Definition at line 54 of file WriteESAlignments.h.

Referenced by convert(), and WriteESAlignments().

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

Definition at line 53 of file WriteESAlignments.h.

Referenced by convert().

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

Definition at line 28 of file WriteESAlignments.h.

Referenced by convert(), and writeAlignments().