Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:37

0001 #ifndef MILLEPEDEPEDEREADER_H
0002 #define MILLEPEDEPEDEREADER_H
0003 
0004 /**
0005  * \class PedeReader
0006  *
0007  * read in result from pede text file
0008  *
0009  *  \author    : Gero Flucke
0010  *  date       : November 2006
0011  *  $Revision: 1.4 $
0012  *  $Date: 2011/02/16 13:11:57 $
0013  *  (last update by $Author: mussgill $)
0014  */
0015 
0016 #include <fstream>
0017 #include <vector>
0018 
0019 #include <Alignment/MillePedeAlignmentAlgorithm/interface/PedeLabelerBase.h>
0020 #include "Alignment/CommonAlignment/interface/Utilities.h"
0021 
0022 class PedeSteerer;
0023 class PedeLabelerBase;
0024 class Alignable;
0025 class AlignmentParameters;
0026 class IntegratedCalibrationBase;
0027 
0028 namespace edm {
0029   class ParameterSet;
0030 }
0031 
0032 /***************************************
0033 ****************************************/
0034 class PedeReader {
0035 public:
0036   typedef PedeLabelerBase::RunNumber RunNumber;
0037   typedef PedeLabelerBase::RunRange RunRange;
0038 
0039   PedeReader(const edm::ParameterSet &config,
0040              const PedeSteerer &steerer,
0041              const PedeLabelerBase &labels,
0042              const RunRange &runrange);
0043   /// non virtual destructor: do not inherit from this class
0044   ~PedeReader() {}
0045   /// Read pede output into AlignmentParameters attached to 'alignables'
0046   /// (if they fit to the run range). If (setUserVars == true) also care about
0047   /// MillePedeVariables.
0048   /// Also treats parameters belonging to a IntegratedCalibrationBase.
0049   bool read(align::Alignables &alignables, bool setUserVars);
0050   /// true if 'outValue' could be read via operator >> from the current line (!) of aStream,
0051   /// false otherwise
0052   template <class T>
0053   bool readIfSameLine(std::ifstream &aStream, T &outValue) const;
0054   /// Set pede results stored in 'buf' to AlignmentParameters
0055   /// and (if setUserVars == true) to MillePedeVariables, return corresponding Alignable.
0056   Alignable *setParameter(unsigned int paramLabel, unsigned int bufLength, const float *buf, bool setUserVars) const;
0057   /// Set pede results stored in 'buf' to parameter 'paramNum' of IntegratedCalibrationBase.
0058   bool setCalibrationParameter(IntegratedCalibrationBase *calib,
0059                                unsigned int paramNum,
0060                                unsigned int bufLength,
0061                                const float *buf) const;
0062 
0063   /// returns parameters of alignable (creates if not yet existing, but MillePedeVariables
0064   /// are only created if createUserVars == true)
0065   AlignmentParameters *checkAliParams(Alignable *alignable, bool createUserVars) const;
0066 
0067 private:
0068   //  PedeReader() {} // no default ctr.
0069 
0070   std::ifstream myPedeResult;
0071   const PedeSteerer &mySteerer;
0072   const PedeLabelerBase &myLabels;
0073   const RunRange myRunRange;
0074 
0075   static const unsigned int myMaxNumValPerParam;
0076 };
0077 
0078 #endif