CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
MuonScenarioBuilder Class Reference

Builds a scenario from configuration and applies it to the alignable Muon. More...

#include <MuonScenarioBuilder.h>

Inheritance diagram for MuonScenarioBuilder:
MisalignmentScenarioBuilder

Public Member Functions

void applyScenario (const edm::ParameterSet &scenario) override
 Apply misalignment scenario to the Muon. More...
 
align::Scalars extractParameters (const edm::ParameterSet &, const char *)
 
void moveChamberInSector (Alignable *, const align::Scalars &, const align::Scalars &, const align::Scalars &, const align::Scalars &)
 
void moveCSCSectors (const edm::ParameterSet &scenario)
 this special method allows to move a CSCsector by a same amount More...
 
void moveDTSectors (const edm::ParameterSet &scenario)
 This special method allows to move a DTsector by a same amount. More...
 
void moveGEMSectors (const edm::ParameterSet &scenario)
 
void moveMuon (const edm::ParameterSet &scenario)
 this special method allows to move the complete muon system by a same amount More...
 
 MuonScenarioBuilder (Alignable *alignable)
 Constructor. More...
 
 ~MuonScenarioBuilder () override
 Destructor. More...
 
- Public Member Functions inherited from MisalignmentScenarioBuilder
 MisalignmentScenarioBuilder (AlignableObjectId::Geometry)
 Constructor. More...
 
virtual ~MisalignmentScenarioBuilder ()=default
 Destructor. More...
 

Private Attributes

AlignableMuontheAlignableMuon
 Pointer to alignable Muon object. More...
 
AlignableModifier theMuonModifier
 

Additional Inherited Members

- Protected Member Functions inherited from MisalignmentScenarioBuilder
void applyMovements_ (Alignable *alignable, const edm::ParameterSet &pSet)
 Apply movements given by parameter set to given alignable. More...
 
void decodeMovements_ (const edm::ParameterSet &, const align::Alignables &)
 Decode movements defined in given parameter set for given set of alignables. More...
 
void decodeMovements_ (const edm::ParameterSet &, const align::Alignables &, const std::string &levelName)
 Decode movements defined in given parameter set for given set of alignables tagged by given name. More...
 
edm::ParameterSet getParameterSet_ (const std::string &name, const edm::ParameterSet &pSet) const
 
edm::ParameterSet getParameterSet_ (const std::string &levelName, int iComponent, const edm::ParameterSet &pSet) const
 
bool hasParameter_ (const std::string &name, const edm::ParameterSet &pSet) const
 Check if given parameter exists in parameter set. More...
 
virtual bool isTopLevel_ (const std::string &parameterSetName) const
 Check if given parameter is for a top-level structure. More...
 
void mergeParameters_ (edm::ParameterSet &localSet, const edm::ParameterSet &globalSet) const
 Merge two sets of parameters into one (the first argument) More...
 
virtual bool possiblyPartOf (const std::string &subStruct, const std::string &largeStruct) const
 
void printParameters_ (const edm::ParameterSet &pSet, const bool showPsets=false) const
 Print all parameters and values for given set. More...
 
void propagateParameters_ (const edm::ParameterSet &pSet, const std::string &globalName, edm::ParameterSet &subSet) const
 Propagate global parameters to sub-parameters. More...
 
const std::string rootName_ (const std::string &parameterSetName) const
 Get root name of a parameter set (e.g. 'Rod' in 'Rods' or 'Rod1') More...
 
- Protected Attributes inherited from MisalignmentScenarioBuilder
std::string indent_
 Depth in hierarchy. More...
 
AlignableModifier theModifier
 Helper class for random movements. More...
 
int theModifierCounter {0}
 Counter for applied modification. More...
 
edm::ParameterSet theScenario
 Misalignment scenario to apply (from config file) More...
 

Detailed Description

Builds a scenario from configuration and applies it to the alignable Muon.

The misalignment scenario builder.

Date:
2009/09/15 17:09:58
Revision:
1.5
Author
Andre Sznajder - UERJ(Brazil)

Definition at line 19 of file MuonScenarioBuilder.h.

Constructor & Destructor Documentation

MuonScenarioBuilder::MuonScenarioBuilder ( Alignable alignable)
explicit

Constructor.

Definition at line 27 of file MuonScenarioBuilder.cc.

References Exception, and theAlignableMuon.

28  : // muon alignable IDs are (currently) independent of the geometry
30  theAlignableMuon = dynamic_cast<AlignableMuon*>(alignable);
31 
32  if (!theAlignableMuon)
33  throw cms::Exception("TypeMismatch") << "Argument is not an AlignableMuon";
34 }
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
MisalignmentScenarioBuilder(AlignableObjectId::Geometry)
Constructor.
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
MuonScenarioBuilder::~MuonScenarioBuilder ( )
inlineoverride

Destructor.

Definition at line 25 of file MuonScenarioBuilder.h.

25 {};

Member Function Documentation

void MuonScenarioBuilder::applyScenario ( const edm::ParameterSet scenario)
overridevirtual

Apply misalignment scenario to the Muon.

Implements MisalignmentScenarioBuilder.

Definition at line 37 of file MuonScenarioBuilder.cc.

References AlignableMuon::CSCEndcaps(), MisalignmentScenarioBuilder::decodeMovements_(), AlignableMuon::DTBarrel(), Exception, AlignableMuon::GEMEndcaps(), edm::ParameterSet::getParameter(), MisalignmentScenarioBuilder::hasParameter_(), moveCSCSectors(), moveDTSectors(), moveGEMSectors(), moveMuon(), AlignableModifier::setSeed(), theAlignableMuon, MisalignmentScenarioBuilder::theModifier, MisalignmentScenarioBuilder::theModifierCounter, and MisalignmentScenarioBuilder::theScenario.

Referenced by MuonMisalignedProducer::analyze(), MuonGeometryDBConverter::analyze(), and AlignmentProducerBase::applyMisalignment().

37  {
38  // Apply the scenario to all main components of Muon.
41 
42  // Seed is set at top-level, and is mandatory
43  if (this->hasParameter_("seed", theScenario))
44  theModifier.setSeed(static_cast<long>(theScenario.getParameter<int>("seed")));
45  else
46  throw cms::Exception("BadConfig") << "No generator seed defined!";
47 
48  // DT Barrel
49  const auto& dtBarrel = theAlignableMuon->DTBarrel();
50  this->decodeMovements_(theScenario, dtBarrel, "DTBarrel");
51  // Endcap
52  const auto& cscEndcaps = theAlignableMuon->CSCEndcaps();
53  this->decodeMovements_(theScenario, cscEndcaps, "CSCEndcap");
54  const auto& gemEndcaps = theAlignableMuon->GEMEndcaps();
55  this->decodeMovements_(theScenario, gemEndcaps, "GEMEndcap");
56 
60  this->moveMuon(theScenario);
61 
62  edm::LogInfo("TrackerScenarioBuilder") << "Applied modifications to " << theModifierCounter << " alignables";
63 }
edm::ParameterSet theScenario
Misalignment scenario to apply (from config file)
void decodeMovements_(const edm::ParameterSet &, const align::Alignables &)
Decode movements defined in given parameter set for given set of alignables.
void moveGEMSectors(const edm::ParameterSet &scenario)
void setSeed(long seed)
Resets the generator seed according to the argument.
void moveCSCSectors(const edm::ParameterSet &scenario)
this special method allows to move a CSCsector by a same amount
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
align::Alignables DTBarrel()
scenario
Definition: constants.h:173
void moveMuon(const edm::ParameterSet &scenario)
this special method allows to move the complete muon system by a same amount
align::Alignables CSCEndcaps()
Log< level::Info, false > LogInfo
void moveDTSectors(const edm::ParameterSet &scenario)
This special method allows to move a DTsector by a same amount.
AlignableModifier theModifier
Helper class for random movements.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
align::Alignables GEMEndcaps()
int theModifierCounter
Counter for applied modification.
bool hasParameter_(const std::string &name, const edm::ParameterSet &pSet) const
Check if given parameter exists in parameter set.
align::Scalars MuonScenarioBuilder::extractParameters ( const edm::ParameterSet pSet,
const char *  blockId 
)

Definition at line 65 of file MuonScenarioBuilder.cc.

References relativeConstraints::error, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), MisalignmentScenarioBuilder::getParameterSet_(), edm::ParameterSet::retrieve(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::Entry::typeCode().

Referenced by moveCSCSectors(), moveDTSectors(), moveGEMSectors(), and moveMuon().

65  {
66  double scale_ = 0, scaleError_ = 0, phiX_ = 0, phiY_ = 0, phiZ_ = 0;
67  double dX_ = 0, dY_ = 0, dZ_ = 0;
68  std::string distribution_;
69  std::ostringstream error;
71  std::vector<std::string> parameterNames = Parameters.getParameterNames();
72  for (std::vector<std::string>::iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); iParam++) {
73  if ((*iParam) == "scale")
74  scale_ = Parameters.getParameter<double>(*iParam);
75  else if ((*iParam) == "distribution")
76  distribution_ = Parameters.getParameter<std::string>(*iParam);
77  else if ((*iParam) == "scaleError")
78  scaleError_ = Parameters.getParameter<double>(*iParam);
79  else if ((*iParam) == "phiX")
80  phiX_ = Parameters.getParameter<double>(*iParam);
81  else if ((*iParam) == "phiY")
82  phiY_ = Parameters.getParameter<double>(*iParam);
83  else if ((*iParam) == "phiZ")
84  phiZ_ = Parameters.getParameter<double>(*iParam);
85  else if ((*iParam) == "dX")
86  dX_ = Parameters.getParameter<double>(*iParam);
87  else if ((*iParam) == "dY")
88  dY_ = Parameters.getParameter<double>(*iParam);
89  else if ((*iParam) == "dZ")
90  dZ_ = Parameters.getParameter<double>(*iParam);
91  else if (Parameters.retrieve(*iParam).typeCode() != 'P') { // Add unknown parameter to list
92  if (!error.str().length())
93  error << "Unknown parameter name(s): ";
94  error << " " << *iParam;
95  }
96  }
97  align::Scalars param;
98  param.push_back(scale_);
99  param.push_back(scaleError_);
100  param.push_back(phiX_);
101  param.push_back(phiY_);
102  param.push_back(phiZ_);
103  param.push_back(dX_);
104  param.push_back(dY_);
105  param.push_back(dZ_);
106  if (distribution_ == "gaussian")
107  param.push_back(0);
108  else if (distribution_ == "flat")
109  param.push_back(1);
110  else if (distribution_ == "fix")
111  param.push_back(2);
112 
113  return param;
114 }
Entry const & retrieve(char const *) const
vector< ParameterSet > Parameters
std::vector< Scalar > Scalars
Definition: Utilities.h:26
std::vector< std::string > getParameterNames() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
char typeCode() const
Definition: Entry.h:176
edm::ParameterSet getParameterSet_(const std::string &name, const edm::ParameterSet &pSet) const
void MuonScenarioBuilder::moveChamberInSector ( Alignable chamber,
const align::Scalars _disp,
const align::Scalars rotation,
const align::Scalars dispError,
const align::Scalars rotationError 
)

Definition at line 453 of file MuonScenarioBuilder.cc.

References AlignableModifier::addAlignmentPositionError(), AlignableModifier::addAlignmentPositionErrorFromRotation(), PV3DBase< T, PVType, FrameType >::basicVector(), Alignable::globalPosition(), AlignableModifier::moveAlignable(), makeMuonMisalignmentScenario::rot, AlignableModifier::rotateAlignable(), theMuonModifier, and PV3DBase< T, PVType, FrameType >::x().

Referenced by moveCSCSectors(), moveDTSectors(), and moveGEMSectors().

457  {
458  align::Scalars disp = _disp;
459  align::RotationType rotx(Basic3DVector<double>(1.0, 0.0, 0.0), rotation[0]);
460  align::RotationType roty(Basic3DVector<double>(0.0, 1.0, 0.0), rotation[1]);
461  align::RotationType rotz(Basic3DVector<double>(0.0, 0.0, 1.0), rotation[2]);
462  align::RotationType rot = rotz * roty * rotx;
463  align::GlobalPoint pos = chamber->globalPosition();
464  align::GlobalPoint dispRot(pos.basicVector() - rot * pos.basicVector());
465  disp[0] += dispRot.x();
466  disp[1] += dispRot.y();
467  disp[2] += dispRot.z();
468  theMuonModifier.moveAlignable(chamber, false, true, disp[0], disp[1], disp[2]);
469  theMuonModifier.rotateAlignable(chamber, false, true, rotation[0], rotation[1], rotation[2]);
470  theMuonModifier.addAlignmentPositionError(chamber, dispError[0], dispError[1], dispError[2]);
471  theMuonModifier.addAlignmentPositionErrorFromRotation(chamber, rotationError[0], rotationError[1], rotationError[2]);
472 }
AlignableModifier theMuonModifier
void addAlignmentPositionError(Alignable *alignable, float dx, float dy, float dz)
Add the AlignmentPositionError (in global frame) to Alignable.
void moveAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ)
Move alignable in global space according to parameters.
std::vector< Scalar > Scalars
Definition: Utilities.h:26
void rotateAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ)
Rotate alignable in global space according to parameters.
void addAlignmentPositionErrorFromRotation(Alignable *alignable, float phiX, float phiY, float phiZ)
Add alignment position error resulting from rotation in global frame.
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
T x() const
Definition: PV3DBase.h:59
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
void MuonScenarioBuilder::moveCSCSectors ( const edm::ParameterSet scenario)

this special method allows to move a CSCsector by a same amount

Definition at line 207 of file MuonScenarioBuilder.cc.

References counter, AlignableMuon::CSCChambers(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, Reference_intrackfit_cff::endcap, extractParameters(), AlignableModifier::flatRandomVector(), AlignableModifier::gaussianRandomVector(), moveChamberInSector(), relativeConstraints::ring, idealTransformation::rotation, CSCTriggerNumbering::sectorFromTriggerLabels(), relativeConstraints::station, theAlignableMuon, theMuonModifier, CSCTriggerNumbering::triggerSectorFromLabels(), and CSCTriggerNumbering::triggerSubSectorFromLabels().

Referenced by applyScenario().

207  {
208  const auto& CSCchambers = theAlignableMuon->CSCChambers();
209  //Take Parameters
210  align::Scalars param = this->extractParameters(pSet, "CSCSectors");
211  double scale_ = param[0];
212  double scaleError_ = param[1];
213  double phiX_ = param[2];
214  double phiY_ = param[3];
215  double phiZ_ = param[4];
216  double dX_ = param[5];
217  double dY_ = param[6];
218  double dZ_ = param[7];
219  double dist_ = param[8];
220 
221  double dx = scale_ * dX_;
222  double dy = scale_ * dY_;
223  double dz = scale_ * dZ_;
224  double phix = scale_ * phiX_;
225  double phiy = scale_ * phiY_;
226  double phiz = scale_ * phiZ_;
227  double errorx = scaleError_ * dX_;
228  double errory = scaleError_ * dY_;
229  double errorz = scaleError_ * dZ_;
230  double errorphix = scaleError_ * phiX_;
231  double errorphiy = scaleError_ * phiY_;
232  double errorphiz = scaleError_ * phiZ_;
233  align::Scalars errorDisp;
234  errorDisp.push_back(errorx);
235  errorDisp.push_back(errory);
236  errorDisp.push_back(errorz);
237  align::Scalars errorRotation;
238  errorRotation.push_back(errorphix);
239  errorRotation.push_back(errorphiy);
240  errorRotation.push_back(errorphiz);
241 
242  int index[2][4][4][36];
243  int sector_index[2][4][4][36];
244  std::fill_n(index[0][0][0], 2 * 4 * 4 * 36, -1); // initialize to -1
245  std::fill_n(sector_index[0][0][0], 2 * 4 * 4 * 36, -1); // initialize to -1
246  int counter = 0;
247  //Create an index for the chambers in the alignable vector
248  for (const auto& iter : CSCchambers) {
249  CSCDetId myId(iter->geomDetId().rawId());
250  index[myId.endcap() - 1][myId.station() - 1][myId.ring() - 1][myId.chamber() - 1] = counter;
251  sector_index[myId.endcap() - 1][myId.station() - 1][myId.ring() - 1][myId.chamber() - 1] =
254  myId.station());
255  counter++;
256  }
257  for (int endcap = 0; endcap < 2; endcap++) {
258  for (int ring = 0; ring < 2; ring++) {
259  for (int sector = 1; sector < 7; sector++) {
260  align::Scalars disp;
262  if (dist_ == 0) {
263  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
264  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
265  disp.push_back(disp_[0]);
266  disp.push_back(disp_[1]);
267  disp.push_back(disp_[2]);
268  rotation.push_back(rotation_[0]);
269  rotation.push_back(rotation_[1]);
270  rotation.push_back(rotation_[2]);
271  } else if (dist_ == 1) {
272  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
273  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
274  disp.push_back(disp_[0]);
275  disp.push_back(disp_[1]);
276  disp.push_back(disp_[2]);
277  rotation.push_back(rotation_[0]);
278  rotation.push_back(rotation_[1]);
279  rotation.push_back(rotation_[2]);
280  } else {
281  disp.push_back(dx);
282  disp.push_back(dy);
283  disp.push_back(dz);
284  rotation.push_back(phix);
285  rotation.push_back(phiy);
286  rotation.push_back(phiz);
287  }
288  //Different cases are considered in order to fit endcap geometry
289  for (int station = 0; station < 4; station++) {
290  if (station == 0) {
291  int r_ring[2];
292  if (ring == 0) {
293  r_ring[0] = 0;
294  r_ring[1] = 3;
295  } else {
296  r_ring[0] = 1;
297  r_ring[1] = 2;
298  }
299  for (int r_counter = 0; r_counter < 2; r_counter++) {
300  for (int chamber = 0; chamber < 36; chamber++) {
301  if (sector == (sector_index[endcap][station][r_ring[r_counter]][chamber] + 1) / 2) {
302  Alignable* myAlign = CSCchambers.at(index[endcap][station][r_ring[r_counter]][chamber]);
303  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
304  }
305  }
306  }
307  } else if (station == 3 && ring == 1) {
308  continue;
309  } else {
310  for (int chamber = 0; chamber < 36; chamber++) {
311  if (ring == 0 && chamber > 17)
312  continue;
313  if (sector == sector_index[endcap][station][ring][chamber]) {
314  Alignable* myAlign = CSCchambers.at(index[endcap][station][ring][chamber]);
315  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
316  }
317  }
318  }
319  }
320  }
321  }
322  }
323 }
AlignableModifier theMuonModifier
align::Alignables CSCChambers()
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
const std::vector< float > gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (gaussian distribution)
void moveChamberInSector(Alignable *, const align::Scalars &, const align::Scalars &, const align::Scalars &, const align::Scalars &)
align::Scalars extractParameters(const edm::ParameterSet &, const char *)
static int sectorFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station)
std::vector< Scalar > Scalars
Definition: Utilities.h:26
const std::vector< float > flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (flat distribution)
static int triggerSectorFromLabels(int station, int ring, int chamber)
static int triggerSubSectorFromLabels(int station, int chamber)
static std::atomic< unsigned int > counter
void MuonScenarioBuilder::moveDTSectors ( const edm::ParameterSet scenario)

This special method allows to move a DTsector by a same amount.

Definition at line 117 of file MuonScenarioBuilder.cc.

References counter, AlignableMuon::DTChambers(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, extractParameters(), AlignableModifier::flatRandomVector(), AlignableModifier::gaussianRandomVector(), moveChamberInSector(), idealTransformation::rotation, relativeConstraints::station, theAlignableMuon, and theMuonModifier.

Referenced by applyScenario().

117  {
118  const auto& DTchambers = theAlignableMuon->DTChambers();
119  //Take parameters
120  align::Scalars param = this->extractParameters(pSet, "DTSectors");
121  double scale_ = param[0];
122  double scaleError_ = param[1];
123  double phiX_ = param[2];
124  double phiY_ = param[3];
125  double phiZ_ = param[4];
126  double dX_ = param[5];
127  double dY_ = param[6];
128  double dZ_ = param[7];
129  double dist_ = param[8];
130 
131  double dx = scale_ * dX_;
132  double dy = scale_ * dY_;
133  double dz = scale_ * dZ_;
134  double phix = scale_ * phiX_;
135  double phiy = scale_ * phiY_;
136  double phiz = scale_ * phiZ_;
137  double errorx = scaleError_ * dX_;
138  double errory = scaleError_ * dY_;
139  double errorz = scaleError_ * dZ_;
140  double errorphix = scaleError_ * phiX_;
141  double errorphiy = scaleError_ * phiY_;
142  double errorphiz = scaleError_ * phiZ_;
143  align::Scalars errorDisp;
144  errorDisp.push_back(errorx);
145  errorDisp.push_back(errory);
146  errorDisp.push_back(errorz);
147  align::Scalars errorRotation;
148  errorRotation.push_back(errorphix);
149  errorRotation.push_back(errorphiy);
150  errorRotation.push_back(errorphiz);
151 
152  int index[5][4][14];
153  std::fill_n(index[0][0], 5 * 4 * 14, -1); // initialize to -1
154  int counter = 0;
155  //Create and index for the chambers in the Alignable vector
156  for (const auto& iter : DTchambers) {
157  DTChamberId myId(iter->geomDetId().rawId());
158  index[myId.wheel() + 2][myId.station() - 1][myId.sector() - 1] = counter;
159  counter++;
160  }
161  for (int wheel = 0; wheel < 5; wheel++) {
162  for (int sector = 0; sector < 12; sector++) {
163  align::Scalars disp;
165  if (dist_ == 0) {
166  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
167  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
168  disp.push_back(disp_[0]);
169  disp.push_back(disp_[1]);
170  disp.push_back(disp_[2]);
171  rotation.push_back(rotation_[0]);
172  rotation.push_back(rotation_[1]);
173  rotation.push_back(rotation_[2]);
174  } else if (dist_ == 1) {
175  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
176  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
177  disp.push_back(disp_[0]);
178  disp.push_back(disp_[1]);
179  disp.push_back(disp_[2]);
180  rotation.push_back(rotation_[0]);
181  rotation.push_back(rotation_[1]);
182  rotation.push_back(rotation_[2]);
183  } else {
184  disp.push_back(dx);
185  disp.push_back(dy);
186  disp.push_back(dz);
187  rotation.push_back(phix);
188  rotation.push_back(phiy);
189  rotation.push_back(phiz);
190  }
191  for (int station = 0; station < 4; station++) {
192  Alignable* myAlign = DTchambers.at(index[wheel][station][sector]);
193  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
194  if (sector == 3 && station == 3) {
195  Alignable* myAlignD = DTchambers.at(index[wheel][station][12]);
196  this->moveChamberInSector(myAlignD, disp, rotation, errorDisp, errorRotation);
197  } else if (sector == 9 && station == 3) {
198  Alignable* myAlignD = DTchambers.at(index[wheel][station][13]);
199  this->moveChamberInSector(myAlignD, disp, rotation, errorDisp, errorRotation);
200  }
201  }
202  }
203  }
204 }
AlignableModifier theMuonModifier
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
const std::vector< float > gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (gaussian distribution)
void moveChamberInSector(Alignable *, const align::Scalars &, const align::Scalars &, const align::Scalars &, const align::Scalars &)
align::Scalars extractParameters(const edm::ParameterSet &, const char *)
align::Alignables DTChambers()
std::vector< Scalar > Scalars
Definition: Utilities.h:26
const std::vector< float > flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (flat distribution)
static std::atomic< unsigned int > counter
void MuonScenarioBuilder::moveGEMSectors ( const edm::ParameterSet scenario)

Definition at line 326 of file MuonScenarioBuilder.cc.

References PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, extractParameters(), AlignableModifier::flatRandomVector(), AlignableModifier::gaussianRandomVector(), AlignableMuon::GEMSuperChambers(), moveChamberInSector(), idealTransformation::rotation, theAlignableMuon, and theMuonModifier.

Referenced by applyScenario().

326  {
327  const auto& GEMSuperChambers = theAlignableMuon->GEMSuperChambers();
328  //Take Parameters
329  align::Scalars param = this->extractParameters(pSet, "GEMSectors");
330  double scale_ = param[0];
331  double scaleError_ = param[1];
332  double phiX_ = param[2];
333  double phiY_ = param[3];
334  double phiZ_ = param[4];
335  double dX_ = param[5];
336  double dY_ = param[6];
337  double dZ_ = param[7];
338 
339  double dx = scale_ * dX_;
340  double dy = scale_ * dY_;
341  double dz = scale_ * dZ_;
342  double phix = scale_ * phiX_;
343  double phiy = scale_ * phiY_;
344  double phiz = scale_ * phiZ_;
345  double errorx = scaleError_ * dX_;
346  double errory = scaleError_ * dY_;
347  double errorz = scaleError_ * dZ_;
348  double errorphix = scaleError_ * phiX_;
349  double errorphiy = scaleError_ * phiY_;
350  double errorphiz = scaleError_ * phiZ_;
351  align::Scalars errorDisp;
352  errorDisp.push_back(errorx);
353  errorDisp.push_back(errory);
354  errorDisp.push_back(errorz);
355  align::Scalars errorRotation;
356  errorRotation.push_back(errorphix);
357  errorRotation.push_back(errorphiy);
358  errorRotation.push_back(errorphiz);
359 
360  //Create an index for the chambers in the alignable vector
361  for (const auto& iter : GEMSuperChambers) {
362  align::Scalars disp;
364  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
365  disp.push_back(disp_[0]);
366  disp.push_back(disp_[1]);
367  disp.push_back(disp_[2]);
368  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
369  rotation.push_back(rotation_[0]);
370  rotation.push_back(rotation_[1]);
371  rotation.push_back(rotation_[2]);
372  this->moveChamberInSector(iter, disp, rotation, errorDisp, errorRotation);
373  }
374 }
AlignableModifier theMuonModifier
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
const std::vector< float > gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (gaussian distribution)
align::Alignables GEMSuperChambers()
void moveChamberInSector(Alignable *, const align::Scalars &, const align::Scalars &, const align::Scalars &, const align::Scalars &)
align::Scalars extractParameters(const edm::ParameterSet &, const char *)
std::vector< Scalar > Scalars
Definition: Utilities.h:26
const std::vector< float > flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (flat distribution)
void MuonScenarioBuilder::moveMuon ( const edm::ParameterSet scenario)

this special method allows to move the complete muon system by a same amount

Definition at line 376 of file MuonScenarioBuilder.cc.

References AlignableModifier::addAlignmentPositionError(), AlignableModifier::addAlignmentPositionErrorFromRotation(), AlignableMuon::CSCEndcaps(), AlignableMuon::DTBarrel(), PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, extractParameters(), AlignableModifier::flatRandomVector(), AlignableModifier::gaussianRandomVector(), AlignableMuon::GEMEndcaps(), AlignableModifier::moveAlignable(), AlignableModifier::rotateAlignable(), idealTransformation::rotation, theAlignableMuon, and theMuonModifier.

Referenced by applyScenario().

376  {
377  const auto& DTbarrel = theAlignableMuon->DTBarrel();
378  const auto& CSCendcaps = theAlignableMuon->CSCEndcaps();
379  const auto& GEMendcaps = theAlignableMuon->GEMEndcaps();
380  //Take Parameters
381  align::Scalars param = this->extractParameters(pSet, "Muon");
382  double scale_ = param[0];
383  double scaleError_ = param[1];
384  double phiX_ = param[2];
385  double phiY_ = param[3];
386  double phiZ_ = param[4];
387  double dX_ = param[5];
388  double dY_ = param[6];
389  double dZ_ = param[7];
390  double dist_ = param[8];
391  double dx = scale_ * dX_;
392  double dy = scale_ * dY_;
393  double dz = scale_ * dZ_;
394  double phix = scale_ * phiX_;
395  double phiy = scale_ * phiY_;
396  double phiz = scale_ * phiZ_;
397  double errorx = scaleError_ * dX_;
398  double errory = scaleError_ * dY_;
399  double errorz = scaleError_ * dZ_;
400  double errorphix = scaleError_ * phiX_;
401  double errorphiy = scaleError_ * phiY_;
402  double errorphiz = scaleError_ * phiZ_;
403  //Create an index for the chambers in the alignable vector
404  align::Scalars disp;
406  if (dist_ == 0) {
407  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
408  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
409  disp.push_back(disp_[0]);
410  disp.push_back(disp_[1]);
411  disp.push_back(disp_[2]);
412  rotation.push_back(rotation_[0]);
413  rotation.push_back(rotation_[1]);
414  rotation.push_back(rotation_[2]);
415  } else if (dist_ == 1) {
416  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
417  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
418  disp.push_back(disp_[0]);
419  disp.push_back(disp_[1]);
420  disp.push_back(disp_[2]);
421  rotation.push_back(rotation_[0]);
422  rotation.push_back(rotation_[1]);
423  rotation.push_back(rotation_[2]);
424  } else {
425  disp.push_back(dx);
426  disp.push_back(dy);
427  disp.push_back(dz);
428  rotation.push_back(phix);
429  rotation.push_back(phiy);
430  rotation.push_back(phiz);
431  }
432  for (const auto& iter : DTbarrel) {
433  theMuonModifier.moveAlignable(iter, false, true, disp[0], disp[1], disp[2]);
434  theMuonModifier.rotateAlignable(iter, false, true, rotation[0], rotation[1], rotation[2]);
435  theMuonModifier.addAlignmentPositionError(iter, errorx, errory, errorz);
436  theMuonModifier.addAlignmentPositionErrorFromRotation(iter, errorphix, errorphiy, errorphiz);
437  }
438  for (const auto& iter : CSCendcaps) {
439  theMuonModifier.moveAlignable(iter, false, true, disp[0], disp[1], disp[2]);
440  theMuonModifier.rotateAlignable(iter, false, true, rotation[0], rotation[1], rotation[2]);
441  theMuonModifier.addAlignmentPositionError(iter, errorx, errory, errorz);
442  theMuonModifier.addAlignmentPositionErrorFromRotation(iter, errorphix, errorphiy, errorphiz);
443  }
444  for (const auto& iter : GEMendcaps) {
445  theMuonModifier.moveAlignable(iter, false, true, disp[0], disp[1], disp[2]);
446  theMuonModifier.rotateAlignable(iter, false, true, rotation[0], rotation[1], rotation[2]);
447  theMuonModifier.addAlignmentPositionError(iter, errorx, errory, errorz);
448  theMuonModifier.addAlignmentPositionErrorFromRotation(iter, errorphix, errorphiy, errorphiz);
449  }
450 }
AlignableModifier theMuonModifier
void addAlignmentPositionError(Alignable *alignable, float dx, float dy, float dz)
Add the AlignmentPositionError (in global frame) to Alignable.
AlignableMuon * theAlignableMuon
Pointer to alignable Muon object.
align::Alignables DTBarrel()
const std::vector< float > gaussianRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (gaussian distribution)
void moveAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaX, float sigmaY, float sigmaZ)
Move alignable in global space according to parameters.
align::Scalars extractParameters(const edm::ParameterSet &, const char *)
align::Alignables CSCEndcaps()
std::vector< Scalar > Scalars
Definition: Utilities.h:26
const std::vector< float > flatRandomVector(float sigmaX, float sigmaY, float sigmaZ) const
Return a vector of random numbers (flat distribution)
void rotateAlignable(Alignable *alignable, bool random, bool gaussian, float sigmaPhiX, float sigmaPhiY, float sigmaPhiZ)
Rotate alignable in global space according to parameters.
void addAlignmentPositionErrorFromRotation(Alignable *alignable, float phiX, float phiY, float phiZ)
Add alignment position error resulting from rotation in global frame.
align::Alignables GEMEndcaps()

Member Data Documentation

AlignableMuon* MuonScenarioBuilder::theAlignableMuon
private

Pointer to alignable Muon object.

Definition at line 47 of file MuonScenarioBuilder.h.

Referenced by applyScenario(), moveCSCSectors(), moveDTSectors(), moveGEMSectors(), moveMuon(), and MuonScenarioBuilder().

AlignableModifier MuonScenarioBuilder::theMuonModifier
private