72 unsigned long from,
to;
73 float L_F_a, L_F_b, L_F_c;
74 float L_N_a, L_N_b, L_N_c;
75 float R_N_a, R_N_b, R_N_c;
76 float R_F_a, R_F_b, R_F_c;
78 int count = fscanf(inF,
"%lu,%lu,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E,%E", &from, &to,
79 &L_F_a, &L_F_b, &L_F_c, &L_N_a, &L_N_b, &L_N_c,
80 &R_N_a, &R_N_b, &R_N_c, &R_F_a, &R_F_b, &R_F_c);
82 if (count >=0 && count != 14)
83 throw cms::Exception(
"BuildElasticCorrectionsFile") <<
"Only " << count <<
" numbers in a row." << endl;
90 ProcessOneStation( 2, L_N_a*1E-3, L_N_b*1E-3, L_N_c*1E-3, L_F_a*1E-3, L_F_b*1E-3, L_F_c*1E-3, corr, *geom);
91 ProcessOneStation(12, R_N_a*1E-3, R_N_b*1E-3, R_N_c*1E-3, R_F_a*1E-3, R_F_b*1E-3, R_F_c*1E-3, corr, *geom);
93 sequence.
Insert(from, to, corr);
103 double z1 = ps.getUntrackedParameter<
double>(
"z1");
104 double z2 = ps.getUntrackedParameter<
double>(
"z2");
105 double de_x1 = ps.getUntrackedParameter<
double>(
"de_x1");
106 double de_x2 = ps.getUntrackedParameter<
double>(
"de_x2");
107 double de_y1 = ps.getUntrackedParameter<
double>(
"de_y1");
108 double de_y2 = ps.getUntrackedParameter<
double>(
"de_y2");
109 double de_rho1 = ps.getUntrackedParameter<
double>(
"de_rho1");
110 double de_rho2 = ps.getUntrackedParameter<
double>(
"de_rho2");
113 double a_x = (de_x2 - de_x1) / (z2 - z1), b_x = de_x1 - a_x * z1;
114 double a_y = (de_y2 - de_y1) / (z2 - z1), b_y = de_y1 - a_y * z1;
115 double a_rho = (de_rho2 - de_rho1) / (z2 - z1), b_rho = de_rho1 - a_rho * z1;
122 for (RPAlignmentCorrectionsData::mapType::const_iterator it =
input.GetSensorMap().begin();
123 it !=
input.GetSensorMap().end(); ++it) {
125 CLHEP::Hep3Vector
d = geom->LocalToGlobalDirection(rawId, CLHEP::Hep3Vector(0., 1., 0.));
128 ac.XYTranslationToReadout(d.x(), d.y());
133 printf(
"\tID shift in x shift in y rotation about z\n");
134 for (RPAlignmentCorrectionsData::mapType::const_iterator it = output.
GetSensorMap().begin();
137 CLHEP::Hep3Vector d = geom->LocalToGlobalDirection(rawId, CLHEP::Hep3Vector(0., 1., 0.));
138 double dx = d.x(), dy = d.y();
139 CLHEP::Hep3Vector
c = geom->GetDetTranslation(rawId);
140 double cx = c.x(), cy = c.y(),
z = c.z();
142 double de_x = a_x *
z + b_x;
143 double de_y = a_y *
z + b_y;
144 double de_rho = a_rho *
z + b_rho;
146 printf(
"\t%u %+10.1f um %+10.1f um %+10.1f mrad\n", it->first, de_x*1E3, de_y*1E3, de_rho*1E3);
149 double inc_s = +(dx*de_x + dy*de_y) - de_rho * (-dy*(cx + de_x) + dx*(cy + de_y));
150 double inc_rho = de_rho;
154 ac.SetTranslationR(ac.sh_r() + inc_s, ac.sh_r_e());
155 ac.SetRotationZ(ac.rot_z() + inc_rho, ac.rot_z_e());
156 ac.ReadoutTranslationToXY(dx, dy);
160 vector<unsigned int> rps;
161 unsigned int last_rp = 123456;
162 for (RPAlignmentCorrectionsData::mapType::const_iterator it =
input.GetSensorMap().begin();
163 it !=
input.GetSensorMap().end(); ++it) {
164 unsigned int rp = it->first/10;
170 AlignmentGeometry alGeom;
171 AlignmentTask::BuildGeometry(rps, geom.
product(), 0., alGeom);
173 output.FactorRPFromSensorCorrections(expanded, factored, alGeom);
178 double z0 = ps.getUntrackedParameter(
"z0", 0.);
197 double ax = (v_x2 - v_x1) / (z_x2 - z_x1);
198 double ay = (v_y2 - v_y1) / (z_y2 - z_y1);
199 double bx = v_x1 - ax*z_x1;
200 double by = v_y1 - ay*z_y1;
207 for (RPAlignmentCorrectionsData::mapType::const_iterator it = output.
GetSensorMap().begin();
211 CLHEP::Hep3Vector d = geom->LocalToGlobalDirection(rawId, CLHEP::Hep3Vector(0., 1., 0.));
213 double z = c.z() - z0;
216 double sh_r = ac.
sh_r();
T getUntrackedParameter(std::string const &, T const &) const
Time sequence of alignment corrections.
std::string inputFileName
void Insert(edm::TimeValue_t first, edm::TimeValue_t last, const RPAlignmentCorrectionsData &corr)
inserts a set of corrections with validity interval [first, last]
const mapType & GetSensorMap() const
returns the map of sensor alignment corrections
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
void ProcessOneStation(unsigned int id, double N_a, double N_b, double N_c, double F_a, double F_b, double F_c, RPAlignmentCorrectionsData &corr, const TotemRPGeometry &geom)
std::string outputFileName
Event setup record containing the real (actual) geometry information.
static std::string const input
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
void SetSensorCorrection(unsigned int id, const RPAlignmentCorrectionData &ac)
sets the alignment correction for the given sensor
Alignment correction or result of alignment procedure for a single RP sensor. Within the geometry des...
RPAlignmentCorrectionData & GetSensorCorrection(unsigned int id)
returns the correction value from the sensor map
void WriteXMLFile(const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_r=true, bool wrSh_xy=true, bool wrSh_z=true, bool wrRot_z=true) const
saves data to an alignment file
static void WriteXMLFile(const RPAlignmentCorrectionsData &, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_r=true, bool wrSh_xy=true, bool wrSh_z=true, bool wrRot_z=true)
writes corrections into a single XML file
ParameterSet const & getParameterSet(std::string const &) const
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
T const * product() const
Container for RP alignment corrections. The corrections are stored on two levels - RP and sensor...
tuple size
Write out results.
static unsigned int decToRawId(unsigned int dec)
fast conversion Decimal to Raw ID