Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MILLEPEDEVARIABLESIOROOT_H
0002 #define MILLEPEDEVARIABLESIOROOT_H
0003 
0004 /// \class MillePedeVariablesIORoot
0005 ///
0006 /// ROOT based IO of MillePedeVariables
0007 ///
0008 ///  \author    : Gero Flucke
0009 ///  date       : November 2006
0010 ///  $Revision: 1.3 $
0011 ///  $Date: 2007/03/16 17:03:02 $
0012 ///  (last update by $Author: flucke $)
0013 
0014 #include "Alignment/CommonAlignment/interface/Utilities.h"
0015 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentIORootBase.h"
0016 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentUserVariablesIO.h"
0017 
0018 #include <string>
0019 #include <vector>
0020 
0021 // ROOT types:
0022 #include "Rtypes.h"
0023 
0024 class Alignable;
0025 class AlignmentUserVariables;
0026 
0027 //__________________________________________________________________________________________________
0028 
0029 class MillePedeVariablesIORoot : public AlignmentIORootBase, public AlignmentUserVariablesIO {
0030 public:
0031   MillePedeVariablesIORoot();
0032   ~MillePedeVariablesIORoot() override {}
0033 
0034   /** write user variables */
0035   void writeMillePedeVariables(
0036       const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr);
0037 
0038   /** read user variables (not that their memory is owned by this class!) */
0039   std::vector<AlignmentUserVariables *> readMillePedeVariables(const align::Alignables &alivec,
0040                                                                const char *filename,
0041                                                                int iter,
0042                                                                int &ierr);
0043 
0044 protected:
0045   /** write MillePedeVariables attached to AlignmentParameters of one Alignable */
0046   int writeOne(Alignable *ali) override;  // inherited from AlignmentUserVariablesIO
0047 
0048   /** read MillePedeVariables belonging to one Alignable */
0049   AlignmentUserVariables *readOne(Alignable *ali, int &ierr) override;
0050   // previous inherited from AlignmentUserVariablesIO
0051 
0052   /** open IO */  // inherited from AlignmentUserVariablesIO
0053   int open(const char *filename, int iteration, bool writemode) override {
0054     return this->openRoot(filename, iteration, writemode);
0055   }
0056 
0057   /** close IO */
0058   int close() override { return this->closeRoot(); }  // inherited from AlignmentUserVariablesIO
0059 
0060   /// create root branches
0061   void createBranches() override;  // inherited from AlignmentIORootBase
0062   /// set root branche addresses
0063   void setBranchAddresses() override;  // inherited from AlignmentIORootBase
0064 
0065 private:
0066   // variables for ROOT tree
0067   enum { kMaxNumPar = 20 };  // slighly above 'two bowed surfaces' limit
0068 
0069   unsigned int myId;
0070   int myObjId;
0071 
0072   unsigned int myNumPar;
0073   Byte_t myIsValid[kMaxNumPar];
0074   Float_t myDiffBefore[kMaxNumPar];
0075   Float_t myGlobalCor[kMaxNumPar];
0076   Float_t myPreSigma[kMaxNumPar];
0077   Float_t myParameter[kMaxNumPar];
0078   Float_t mySigma[kMaxNumPar];
0079   UInt_t myHitsX;
0080   UInt_t myHitsY;
0081   UInt_t myLabel;
0082   std::string myName;
0083   std::string *myNamePtr;  // needed for ROOT IO
0084 };
0085 
0086 #endif