CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Alignment/MillePedeAlignmentAlgorithm/src/PedeSteerer.h

Go to the documentation of this file.
00001 #ifndef PEDESTEERER_H
00002 #define PEDESTEERER_H
00003 
00016 #include <vector>
00017 #include <map> 
00018 #include <set> 
00019 #include <string>
00020 // forward ofstream:
00021 #include <iosfwd> 
00022 
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 
00025 class Alignable;
00026 class AlignableTracker;
00027 class AlignableMuon;
00028 class AlignableExtras;
00029 class AlignmentParameterStore;
00030 class PedeLabelerBase;
00031 
00032 /***************************************
00033 ****************************************/
00034 class PedeSteerer
00035 {
00036  public:
00039   PedeSteerer(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *aliExtras,
00040               AlignmentParameterStore *store,
00041               const PedeLabelerBase *labels, const edm::ParameterSet &config,
00042               const std::string &defaultDir, bool noSteerFiles);
00044   ~PedeSteerer();
00045     
00047   bool isNoHiera(const Alignable* ali) const;
00048 
00050   void buildSubSteer(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *aliExtras);
00052   std::string buildMasterSteer(const std::vector<std::string> &binaryFiles);
00054   int runPede(const std::string &masterSteer) const;
00057   void correctToReferenceSystem();
00058   bool isCorrectToRefSystem(const std::vector<Alignable*> &coordDefiners) const;
00059 
00060 
00061   double cmsToPedeFactor(unsigned int parNum) const;
00063   int parameterSign() const { return myParameterSign; }
00065   const std::string& directory() const { return myDirectory;}
00066 
00067  private:
00068   typedef std::map<const Alignable*,std::vector<float> > AlignablePresigmasMap;
00069 
00072   bool checkParameterChoices(const std::vector<Alignable*> &alis) const;
00075   unsigned int buildNoHierarchyCollection(const std::vector<Alignable*> &alis);
00080   std::pair<unsigned int, unsigned int> fixParameters(const std::vector<Alignable*> &alignables,
00081                                                       const std::string &file);
00085   int fixParameter(Alignable *ali, unsigned int iRunRange,
00086                    unsigned int iParam, char selector, std::ofstream* &filePtr,
00087                    const std::string &fileName);
00091   std::vector<Alignable*> selectCoordinateAlis(const std::vector<Alignable*> &alignables) const;
00094   void defineCoordinates(const std::vector<Alignable*> &alis, Alignable *aliMaster,
00095                          const std::string &fileName);
00096 
00097   unsigned int hierarchyConstraints(const std::vector<Alignable*> &alis, const std::string &file);
00098   void hierarchyConstraint(const Alignable *ali, const std::vector<Alignable*> &components,
00099                            std::ofstream &file) const;
00100 
00102   unsigned int presigmas(const std::vector<edm::ParameterSet> &cffPresi,
00103                          const std::string &fileName, const std::vector<Alignable*> &alis,
00104                          AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *aliExtras);
00106   unsigned int presigmasFile(const std::string &fileName, const std::vector<Alignable*> &alis,
00107                              const AlignablePresigmasMap &aliPresisMap); 
00109   std::string fileName(const std::string &addendum) const;
00111   std::ofstream* createSteerFile(const std::string &name, bool addToList);
00112 
00113   // data members
00114   const AlignmentParameterStore *myParameterStore; 
00115   const PedeLabelerBase         *myLabels; 
00116 
00117   edm::ParameterSet myConfig;
00118   std::string myDirectory; 
00119   bool myNoSteerFiles; 
00120   bool myIsSteerFileDebug; 
00121   int myParameterSign; 
00122   double theMinHieraConstrCoeff; 
00123   unsigned int theMinHieraParPerConstr; 
00124 
00125   std::vector<std::string> mySteeringFiles; 
00126 
00127   std::set<const Alignable*> myNoHieraCollection; 
00128   Alignable *theCoordMaster;                      
00129   std::vector<Alignable*> theCoordDefiners;      
00130 };
00131 
00132 #endif