CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PedeSteererWeakModeConstraints.h
Go to the documentation of this file.
1 #ifndef PEDESTEERERWEAKMODECONSTRAINTS_H
2 #define PEDESTEERERWEAKMODECONSTRAINTS_H
3 
13 #include <list>
14 #include <vector>
15 #include <map>
16 #include <set>
17 #include <string>
18 // forward ofstream:
19 #include <iosfwd>
20 
24 
27 
28 class Alignable;
29 class PedeLabelerBase;
30 
31 /***************************************
32 ****************************************/
33 
34 //FIXME: move GeometryConstraintConfigData to PedeSteererWeakModeConstraints?
36 public:
37  GeometryConstraintConfigData(const std::vector<double> &co,
38  const std::string &c,
39  const std::vector<std::pair<Alignable *, std::string> > &alisFile,
40  const int sd,
41  const align::Alignables &ex,
42  const int instance,
43  const bool downToLowestLevel);
44  const std::vector<double> coefficients_;
46  const std::vector<std::pair<Alignable *, std::string> > levelsFilenames_;
48  std::map<std::string, std::ofstream *> mapFileName_;
49  std::list<std::pair<Alignable *, std::list<Alignable *> > >
50  HLSsubdets_; //first pointer to HLS object, second list is the list of pointers to the lowest components
51  const int sysdeformation_;
52  const int instance_;
53  const bool downToLowestLevel_;
54 };
55 
57 public:
60  const PedeLabelerBase *labels,
61  const std::vector<edm::ParameterSet> &config,
62  std::string sf);
63 
64  //FIXME: split the code of the method into smaller pieces/submethods
65  // Main method that configures everything and calculates also the constraints
66  unsigned int constructConstraints(const align::Alignables &);
67 
68  // Returns a references to the container in which the configuration is stored
69  std::list<GeometryConstraintConfigData> &getConfigData() { return ConstraintsConfigContainer_; }
70 
71 private:
72  // Method creates the data structures with the full configuration
73  unsigned int createAlignablesDataStructure();
74 
75  // Write the calculated constraints to the output files
76  void writeOutput(const std::list<std::pair<unsigned int, double> > &output,
78  const Alignable *iHLS,
79  double sum_xi_x0);
80 
81  // find the out file stream for a given constraint and high-level structure
82  std::ofstream *getFile(const GeometryConstraintConfigData &it, const Alignable *iHLS) const;
83 
84  // Close the output files
85  void closeOutputfiles();
86 
87  // Checks whether lowleveldet is a daugther of HLS
88  bool checkMother(const Alignable *const lowleveldet, const Alignable *const HLS) const;
89 
90  std::pair<align::GlobalPoint, align::GlobalPoint> getDoubleSensorPosition(const Alignable *ali) const;
91 
92  double getPhase(const std::vector<double> &coefficients) const;
93 
94  // The function for the geometry deformation is defined as f(x).
95  // The methods returns x depending on the type of deformation
96  double getX(const int sysdeformation, const align::GlobalPoint &pos, const double phase) const;
97 
98  double getX0(const std::pair<Alignable *, std::list<Alignable *> > &iHLS,
99  const GeometryConstraintConfigData &it) const;
100 
101  // Calculates and returns the coefficient for alignment parameter iParameter
102  // for an alignable at position pos.
103  double getCoefficient(const int sysdeformation,
104  const align::GlobalPoint &pos,
105  const GlobalPoint gUDirection,
106  const GlobalPoint gVDirection,
107  const GlobalPoint gWDirection,
108  const int iParameter,
109  const double &x0,
110  const std::vector<double> &constraintparameters) const;
111 
112  //returns true if iParameter of Alignable is selected in configuration file
113  bool checkSelectionShiftParameter(const Alignable *ali, unsigned int iParameter) const;
114 
115  // Method used to test the provided configuration for unknown parameters
116  void verifyParameterNames(const edm::ParameterSet &pset, unsigned int psetnr) const;
117 
118  // Method which creates the associative map between levels and coefficient file names
119  const std::vector<std::pair<Alignable *, std::string> > makeLevelsFilenames(
120  std::set<std::string> &steerFilePrefixContainer,
121  const align::Alignables &alis,
122  const std::string &steerFilePrefix) const;
123 
124  // Verify that the name of the configured deformation is known and that the number of coefficients has been correctly configured
125  int verifyDeformationName(const std::string &name, const std::vector<double> &coefficients) const;
126 
127  //list of dead modules which are not used in any constraint
128  std::list<align::ID> deadmodules_;
129 
130  //the data structure that holds all needed informations for the constraint configuration
131  std::list<GeometryConstraintConfigData> ConstraintsConfigContainer_;
132 
133  const PedeLabelerBase *myLabels_; //PedeLabeler needed to get for the alignables the corresponding Pede label
134 
135  const std::vector<edm::ParameterSet> myConfig_; //the VPSet with the configurations for all constraints
136 
137  const std::string steerFile_; // the name of the PedeSteerer steering file
138 
140 
142  kUnknown = 0,
152  };
153 };
154 
155 #endif
bool checkSelectionShiftParameter(const Alignable *ali, unsigned int iParameter) const
unsigned int constructConstraints(const align::Alignables &)
const edm::EventSetup & c
const std::vector< std::pair< Alignable *, std::string > > levelsFilenames_
void verifyParameterNames(const edm::ParameterSet &pset, unsigned int psetnr) const
const std::vector< std::pair< Alignable *, std::string > > makeLevelsFilenames(std::set< std::string > &steerFilePrefixContainer, const align::Alignables &alis, const std::string &steerFilePrefix) const
static PFTauRenderPlugin instance
std::pair< align::GlobalPoint, align::GlobalPoint > getDoubleSensorPosition(const Alignable *ali) const
std::list< GeometryConstraintConfigData > & getConfigData()
double getX(const int sysdeformation, const align::GlobalPoint &pos, const double phase) const
void writeOutput(const std::list< std::pair< unsigned int, double > > &output, const GeometryConstraintConfigData &it, const Alignable *iHLS, double sum_xi_x0)
__host__ __device__ VT * co
Definition: prefixScan.h:47
std::list< std::pair< Alignable *, std::list< Alignable * > > > HLSsubdets_
GeometryConstraintConfigData(const std::vector< double > &co, const std::string &c, const std::vector< std::pair< Alignable *, std::string > > &alisFile, const int sd, const align::Alignables &ex, const int instance, const bool downToLowestLevel)
std::map< std::string, std::ofstream * > mapFileName_
std::ofstream * getFile(const GeometryConstraintConfigData &it, const Alignable *iHLS) const
int verifyDeformationName(const std::string &name, const std::vector< double > &coefficients) const
double getX0(const std::pair< Alignable *, std::list< Alignable * > > &iHLS, const GeometryConstraintConfigData &it) const
Allows conversion between type and name, and vice-versa.
const std::vector< double > coefficients_
PedeSteererWeakModeConstraints(AlignableTracker *aliTracker, const PedeLabelerBase *labels, const std::vector< edm::ParameterSet > &config, std::string sf)
const std::vector< edm::ParameterSet > myConfig_
double sd
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
tuple config
parse the configuration file
double getPhase(const std::vector< double > &coefficients) const
double getCoefficient(const int sysdeformation, const align::GlobalPoint &pos, const GlobalPoint gUDirection, const GlobalPoint gVDirection, const GlobalPoint gWDirection, const int iParameter, const double &x0, const std::vector< double > &constraintparameters) const
bool checkMother(const Alignable *const lowleveldet, const Alignable *const HLS) const
std::list< GeometryConstraintConfigData > ConstraintsConfigContainer_