CMS 3D CMS Logo

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)
 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 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 ()
 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 &pSet, const std::vector< Alignable * > &alignables)
 Decode movements defined in given parameter set for given set of alignables. More...
 
void decodeMovements_ (const edm::ParameterSet &pSet, const std::vector< Alignable * > &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 21 of file MuonScenarioBuilder.h.

Constructor & Destructor Documentation

MuonScenarioBuilder::MuonScenarioBuilder ( Alignable alignable)
explicit

Constructor.

Definition at line 25 of file MuonScenarioBuilder.cc.

References Exception, and theAlignableMuon.

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

Member Function Documentation

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

Apply misalignment scenario to the Muon.

Implements MisalignmentScenarioBuilder.

Definition at line 39 of file MuonScenarioBuilder.cc.

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

Referenced by MuonGeometryDBConverter::analyze(), AlignmentProducerBase::applyMisalignment(), MisalignedMuonESProducer::produce(), and ~MuonScenarioBuilder().

40 {
41  // Apply the scenario to all main components of Muon.
44 
45  // Seed is set at top-level, and is mandatory
46  if ( this->hasParameter_( "seed", theScenario ) )
47  theModifier.setSeed( static_cast<long>(theScenario.getParameter<int>("seed")) );
48  else
49  throw cms::Exception("BadConfig") << "No generator seed defined!";
50 
51 
52 
53  // DT Barrel
54  std::vector<Alignable*> dtBarrel = theAlignableMuon->DTBarrel();
55  this->decodeMovements_( theScenario, dtBarrel, "DTBarrel" );
56  // CSC Endcap
57  std::vector<Alignable*> cscEndcaps = theAlignableMuon->CSCEndcaps();
58  this->decodeMovements_( theScenario, cscEndcaps, "CSCEndcap" );
59 
62  this->moveMuon(theScenario);
63 
64  edm::LogInfo("TrackerScenarioBuilder")
65  << "Applied modifications to " << theModifierCounter << " alignables";
66 }
T getParameter(std::string const &) const
edm::ParameterSet theScenario
Misalignment scenario to apply (from config file)
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()
void moveMuon(const edm::ParameterSet &scenario)
this special method allows to move the complete muon system by a same amount
align::Alignables CSCEndcaps()
void decodeMovements_(const edm::ParameterSet &pSet, const std::vector< Alignable * > &alignables)
Decode movements defined in given parameter set for given set of alignables.
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.
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 70 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(), moveMuon(), and ~MuonScenarioBuilder().

71 {
72  double scale_ = 0, scaleError_ = 0, phiX_ = 0, phiY_ = 0, phiZ_ = 0;
73  double dX_ = 0, dY_ = 0, dZ_ = 0;
74  std::string distribution_;
75  std::ostringstream error;
77  std::vector<std::string> parameterNames = Parameters.getParameterNames();
78  for ( std::vector<std::string>::iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); iParam++ ) {
79  if ( (*iParam) == "scale" ) scale_ = Parameters.getParameter<double>( *iParam );
80  else if ( (*iParam) == "distribution" ) distribution_ = Parameters.getParameter<std::string>( *iParam );
81  else if ( (*iParam) == "scaleError" ) scaleError_ = Parameters.getParameter<double>( *iParam );
82  else if ( (*iParam) == "phiX" ) phiX_ = Parameters.getParameter<double>( *iParam );
83  else if ( (*iParam) == "phiY" ) phiY_ = Parameters.getParameter<double>( *iParam );
84  else if ( (*iParam) == "phiZ" ) phiZ_ = Parameters.getParameter<double>( *iParam );
85  else if ( (*iParam) == "dX" ) dX_ = Parameters.getParameter<double>( *iParam );
86  else if ( (*iParam) == "dY" ) dY_ = Parameters.getParameter<double>( *iParam );
87  else if ( (*iParam) == "dZ" ) dZ_ = Parameters.getParameter<double>( *iParam );
88  else if ( Parameters.retrieve( *iParam ).typeCode() != 'P' )
89  { // Add unknown parameter to list
90  if ( !error.str().length() ) error << "Unknown parameter name(s): ";
91  error << " " << *iParam;
92  }
93  }
94  align::Scalars param;
95  param.push_back(scale_); param.push_back(scaleError_);
96  param.push_back(phiX_); param.push_back(phiY_);
97  param.push_back(phiZ_); param.push_back(dX_);
98  param.push_back(dY_); param.push_back(dZ_);
99  if( distribution_ == "gaussian" )
100  param.push_back(0);
101  else if ( distribution_ == "flat" )
102  param.push_back(1);
103  else if ( distribution_ == "fix" )
104  param.push_back(2);
105 
106  return param;
107 }
T getParameter(std::string const &) const
Entry const & retrieve(char const *) const
vector< ParameterSet > Parameters
std::vector< Scalar > Scalars
Definition: Utilities.h:26
std::vector< std::string > getParameterNames() const
char typeCode() const
Definition: Entry.h:175
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 303 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 ~MuonScenarioBuilder().

304 {
305  align::Scalars disp = _disp;
306  align::RotationType rotx( Basic3DVector<double>(1.0, 0.0, 0.0), rotation[0] );
307  align::RotationType roty( Basic3DVector<double>(0.0, 1.0, 0.0), rotation[1] );
308  align::RotationType rotz( Basic3DVector<double>(0.0, 0.0, 1.0), rotation[2] );
309  align::RotationType rot = rotz * roty * rotx;
311  align::GlobalPoint dispRot(pos.basicVector()-rot*pos.basicVector());
312  disp[0] += dispRot.x(); disp[1] += dispRot.y(); disp[2] += dispRot.z();
313  theMuonModifier.moveAlignable( chamber, false, true, disp[0], disp[1], disp[2] );
314  theMuonModifier.rotateAlignable( chamber, false, true, rotation[0], rotation[1], rotation[2] );
315  theMuonModifier.addAlignmentPositionError( chamber, dispError[0], dispError[1], dispError[2] );
316  theMuonModifier.addAlignmentPositionErrorFromRotation( chamber, rotationError[0], rotationError[1], rotationError[2] );
317 }
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:138
T x() const
Definition: PV3DBase.h:62
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
void MuonScenarioBuilder::moveCSCSectors ( const edm::ParameterSet scenario)

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

Definition at line 172 of file MuonScenarioBuilder.cc.

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

Referenced by applyScenario(), and ~MuonScenarioBuilder().

173 {
174  std::vector<Alignable *> CSCchambers = theAlignableMuon->CSCChambers();
175  //Take Parameters
176  align::Scalars param = this->extractParameters(pSet, "CSCSectors");
177  double scale_ = param[0]; double scaleError_ = param[1];
178  double phiX_ = param[2]; double phiY_ = param[3]; double phiZ_ = param[4];
179  double dX_ = param[5]; double dY_ = param[6]; double dZ_ = param[7];
180  double dist_ = param[8];
181 
182  double dx = scale_*dX_; double dy = scale_*dY_; double dz = scale_*dZ_;
183  double phix = scale_*phiX_; double phiy = scale_*phiY_; double phiz = scale_*phiZ_;
184  double errorx = scaleError_*dX_; double errory = scaleError_*dY_; double errorz = scaleError_*dZ_;
185  double errorphix = scaleError_*phiX_; double errorphiy = scaleError_*phiY_; double errorphiz = scaleError_*phiZ_;
186  align::Scalars errorDisp;
187  errorDisp.push_back(errorx); errorDisp.push_back(errory); errorDisp.push_back(errorz);
188  align::Scalars errorRotation;
189  errorRotation.push_back(errorphix); errorRotation.push_back(errorphiy); errorRotation.push_back(errorphiz);
190 
191  int index[2][4][4][36];
192  int sector_index[2][4][4][36];
193  int counter = 0;
194  //Create an index for the chambers in the alignable vector
195  for(std::vector<Alignable *>::iterator iter = CSCchambers.begin(); iter != CSCchambers.end(); ++iter) {
196  CSCDetId myId((*iter)->geomDetId().rawId());
197  index[myId.endcap()-1][myId.station()-1][myId.ring()-1][myId.chamber()-1] = counter;
198  sector_index[myId.endcap()-1][myId.station()-1][myId.ring()-1][myId.chamber()-1] = CSCTriggerNumbering::sectorFromTriggerLabels(CSCTriggerNumbering::triggerSectorFromLabels(myId),CSCTriggerNumbering::triggerSubSectorFromLabels(myId) , myId.station());
199  counter++;
200  }
201  for(int endcap = 0; endcap < 2; endcap++) {
202  for(int ring = 0; ring < 2; ring++) {
203  for(int sector = 1; sector < 7; sector++) {
204  align::Scalars disp;
206  if( dist_ == 0 ) {
207  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
208  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
209  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
210  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
211  } else if (dist_ == 1) {
212  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
213  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
214  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
215  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
216  } else {
217  disp.push_back(dx); disp.push_back(dy); disp.push_back(dz);
218  rotation.push_back(phix); rotation.push_back(phiy); rotation.push_back(phiz);
219  }
220  //Different cases are considered in order to fit endcap geometry
221  for(int station = 0; station < 4; station++) {
222  if(station == 0) {
223  int r_ring[2];
224  if(ring == 0) {
225  r_ring[0] = 0; r_ring[1] = 3;
226  } else {
227  r_ring[0] = 1; r_ring[1] = 2;
228  }
229  for(int r_counter = 0; r_counter < 2; r_counter++) {
230  for(int chamber = 0; chamber < 36; chamber++) {
231  if(sector == (sector_index[endcap][station][r_ring[r_counter]][chamber]+1)/2) {
232  Alignable *myAlign = CSCchambers.at(index[endcap][station][r_ring[r_counter]][chamber]);
233  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
234  }
235  }
236  }
237  } else if(station == 3 && ring == 1) {
238  continue;
239  } else {
240  for(int chamber = 0; chamber < 36; chamber++) {
241  if(ring == 0 && chamber > 17) continue;
242  if(sector == sector_index[endcap][station][ring][chamber]) {
243  Alignable *myAlign = CSCchambers.at(index[endcap][station][ring][chamber]);
244  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
245  }
246  }
247  }
248  }
249  }
250  }
251  }
252 }
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 110 of file MuonScenarioBuilder.cc.

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

Referenced by applyScenario(), and ~MuonScenarioBuilder().

111 {
112  std::vector<Alignable *> DTchambers = theAlignableMuon->DTChambers();
113  //Take parameters
114  align::Scalars param = this->extractParameters(pSet, "DTSectors");
115  double scale_ = param[0]; double scaleError_ = param[1];
116  double phiX_ = param[2]; double phiY_ = param[3]; double phiZ_ = param[4];
117  double dX_ = param[5]; double dY_ = param[6]; double dZ_ = param[7];
118  double dist_ = param[8];
119 
120  double dx = scale_*dX_; double dy = scale_*dY_; double dz = scale_*dZ_;
121  double phix = scale_*phiX_; double phiy = scale_*phiY_; double phiz = scale_*phiZ_;
122  double errorx = scaleError_*dX_; double errory = scaleError_*dY_; double errorz = scaleError_*dZ_;
123  double errorphix = scaleError_*phiX_; double errorphiy = scaleError_*phiY_; double errorphiz = scaleError_*phiZ_;
124  align::Scalars errorDisp;
125  errorDisp.push_back(errorx); errorDisp.push_back(errory); errorDisp.push_back(errorz);
126  align::Scalars errorRotation;
127  errorRotation.push_back(errorphix); errorRotation.push_back(errorphiy); errorRotation.push_back(errorphiz);
128 
129  int index[5][4][14];
130  int counter = 0;
131  //Create and index for the chambers in the Alignable vector
132  for(std::vector<Alignable *>::iterator iter = DTchambers.begin(); iter != DTchambers.end(); ++iter) {
133  DTChamberId myId((*iter)->geomDetId().rawId());
134  index[myId.wheel()+2][myId.station()-1][myId.sector()-1] = counter;
135  counter++;
136  }
137  for(int wheel = 0; wheel < 5; wheel++) {
138  for(int sector = 0; sector < 12; sector++) {
139  align::Scalars disp;
141  if( dist_ == 0 ) {
142  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
143  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
144  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
145  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
146  } else if (dist_ == 1) {
147  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
148  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
149  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
150  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
151  } else {
152  disp.push_back(dx); disp.push_back(dy); disp.push_back(dz);
153  rotation.push_back(phix); rotation.push_back(phiy); rotation.push_back(phiz);
154  }
155  for(int station = 0; station < 4; station++) {
156  Alignable *myAlign = DTchambers.at(index[wheel][station][sector]);
157  this->moveChamberInSector(myAlign, disp, rotation, errorDisp, errorRotation);
158  if(sector == 3 && station == 3) {
159  Alignable *myAlignD = DTchambers.at(index[wheel][station][12]);
160  this->moveChamberInSector(myAlignD, disp, rotation, errorDisp, errorRotation);
161  } else if(sector == 9 && station == 3) {
162  Alignable *myAlignD = DTchambers.at(index[wheel][station][13]);
163  this->moveChamberInSector(myAlignD, disp, rotation, errorDisp, errorRotation);
164  }
165  }
166  }
167  }
168 }
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::moveMuon ( const edm::ParameterSet scenario)

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

Definition at line 256 of file MuonScenarioBuilder.cc.

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

Referenced by applyScenario(), and ~MuonScenarioBuilder().

257 {
258  std::vector<Alignable *> DTbarrel = theAlignableMuon->DTBarrel();
259  std::vector<Alignable *> CSCendcaps = theAlignableMuon->CSCEndcaps();
260  //Take Parameters
261  align::Scalars param = this->extractParameters(pSet, "Muon");
262  double scale_ = param[0]; double scaleError_ = param[1];
263  double phiX_ = param[2]; double phiY_ = param[3]; double phiZ_ = param[4];
264  double dX_ = param[5]; double dY_ = param[6]; double dZ_ = param[7];
265  double dist_ = param[8];
266  double dx = scale_*dX_; double dy = scale_*dY_; double dz = scale_*dZ_;
267  double phix = scale_*phiX_; double phiy = scale_*phiY_; double phiz = scale_*phiZ_;
268  double errorx = scaleError_*dX_; double errory = scaleError_*dY_; double errorz = scaleError_*dZ_;
269  double errorphix = scaleError_*phiX_; double errorphiy = scaleError_*phiY_; double errorphiz = scaleError_*phiZ_;
270  //Create an index for the chambers in the alignable vector
271  align::Scalars disp;
273  if( dist_ == 0 ) {
274  const std::vector<float> disp_ = theMuonModifier.gaussianRandomVector(dx, dy, dz);
275  const std::vector<float> rotation_ = theMuonModifier.gaussianRandomVector(phix, phiy, phiz);
276  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
277  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
278  } else if (dist_ == 1) {
279  const std::vector<float> disp_ = theMuonModifier.flatRandomVector(dx, dy, dz);
280  const std::vector<float> rotation_ = theMuonModifier.flatRandomVector(phix, phiy, phiz);
281  disp.push_back(disp_[0]); disp.push_back(disp_[1]); disp.push_back(disp_[2]);
282  rotation.push_back(rotation_[0]); rotation.push_back(rotation_[1]); rotation.push_back(rotation_[2]);
283  } else {
284  disp.push_back(dx); disp.push_back(dy); disp.push_back(dz);
285  rotation.push_back(phix); rotation.push_back(phiy); rotation.push_back(phiz);
286  }
287  for(std::vector<Alignable *>::iterator iter = DTbarrel.begin(); iter != DTbarrel.end(); ++iter) {
288  theMuonModifier.moveAlignable( *iter, false, true, disp[0], disp[1], disp[2] );
289  theMuonModifier.rotateAlignable( *iter, false, true, rotation[0], rotation[1], rotation[2] );
290  theMuonModifier.addAlignmentPositionError( *iter, errorx, errory, errorz );
291  theMuonModifier.addAlignmentPositionErrorFromRotation( *iter, errorphix, errorphiy, errorphiz );
292  }
293  for(std::vector<Alignable *>::iterator iter = CSCendcaps.begin(); iter != CSCendcaps.end(); ++iter) {
294  theMuonModifier.moveAlignable( *iter, false, true, disp[0], disp[1], disp[2] );
295  theMuonModifier.rotateAlignable( *iter, false, true, rotation[0], rotation[1], rotation[2] );
296  theMuonModifier.addAlignmentPositionError( *iter, errorx, errory, errorz );
297  theMuonModifier.addAlignmentPositionErrorFromRotation( *iter, errorphix, errorphiy, errorphiz );
298  }
299 }
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.

Member Data Documentation

AlignableMuon* MuonScenarioBuilder::theAlignableMuon
private

Pointer to alignable Muon object.

Definition at line 49 of file MuonScenarioBuilder.h.

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

AlignableModifier MuonScenarioBuilder::theMuonModifier
private

Definition at line 51 of file MuonScenarioBuilder.h.

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