00001 #ifndef PEDESTEERER_H
00002 #define PEDESTEERER_H
00003
00016 #include <vector>
00017 #include <map>
00018 #include <set>
00019 #include <string>
00020
00021 #include <iosfwd>
00022
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024
00025 class Alignable;
00026 class AlignableTracker;
00027 class AlignableMuon;
00028 class AlignmentParameterStore;
00029 class PedeLabeler;
00030
00031
00032
00033 class PedeSteerer
00034 {
00035 public:
00038 PedeSteerer(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignmentParameterStore *store,
00039 const PedeLabeler *labels, const edm::ParameterSet &config,
00040 const std::string &defaultDir, bool noSteerFiles);
00042 ~PedeSteerer();
00043
00045 bool isNoHiera(const Alignable* ali) const;
00046
00048 void buildSubSteer(AlignableTracker *aliTracker, AlignableMuon *aliMuon);
00050 std::string buildMasterSteer(const std::vector<std::string> &binaryFiles);
00052 bool runPede(const std::string &masterSteer) const;
00055 void correctToReferenceSystem();
00056
00057 double cmsToPedeFactor(unsigned int parNum) const;
00059 int parameterSign() const { return myParameterSign; }
00061 const std::string& directory() const { return myDirectory;}
00062
00063 private:
00064 typedef std::map<const Alignable*,std::vector<float> > AlignablePresigmasMap;
00065
00068 bool checkParameterChoices(const std::vector<Alignable*> &alis) const;
00071 unsigned int buildNoHierarchyCollection(const std::vector<Alignable*> &alis);
00076 std::pair<unsigned int, unsigned int> fixParameters(const std::vector<Alignable*> &alignables,
00077 const std::string &file);
00081 int fixParameter(Alignable *ali, unsigned int iParam, char selector, std::ofstream* &filePtr,
00082 const std::string &fileName);
00086 std::vector<Alignable*> selectCoordinateAlis(const std::vector<Alignable*> &alignables) const;
00089 void defineCoordinates(const std::vector<Alignable*> &alis, Alignable *aliMaster,
00090 const std::string &fileName);
00091
00092 unsigned int hierarchyConstraints(const std::vector<Alignable*> &alis, const std::string &file);
00093 void hierarchyConstraint(const Alignable *ali, const std::vector<Alignable*> &components,
00094 std::ofstream &file) const;
00095
00097 unsigned int presigmas(const std::vector<edm::ParameterSet> &cffPresi,
00098 const std::string &fileName, const std::vector<Alignable*> &alis,
00099 AlignableTracker *aliTracker, AlignableMuon *aliMuon);
00101 unsigned int presigmasFile(const std::string &fileName, const std::vector<Alignable*> &alis,
00102 const AlignablePresigmasMap &aliPresisMap);
00104 std::string fileName(const std::string &addendum) const;
00106 std::ofstream* createSteerFile(const std::string &name, bool addToList);
00107
00108
00109 const AlignmentParameterStore *myParameterStore;
00110 const PedeLabeler *myLabels;
00111
00112 edm::ParameterSet myConfig;
00113 std::string myDirectory;
00114 bool myNoSteerFiles;
00115 int myParameterSign;
00116
00117 std::vector<std::string> mySteeringFiles;
00118
00119 std::set<const Alignable*> myNoHieraCollection;
00120 Alignable *theCoordMaster;
00121 std::vector<Alignable*> theCoordDefiners;
00122 };
00123
00124 #endif