MillePedeVariablesIORoot

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
#ifndef MILLEPEDEVARIABLESIOROOT_H
#define MILLEPEDEVARIABLESIOROOT_H

/// \class MillePedeVariablesIORoot
///
/// ROOT based IO of MillePedeVariables
///
///  \author    : Gero Flucke
///  date       : November 2006
///  $Revision: 1.3 $
///  $Date: 2007/03/16 17:03:02 $
///  (last update by $Author: flucke $)

#include "Alignment/CommonAlignment/interface/Utilities.h"
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentIORootBase.h"
#include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentUserVariablesIO.h"

#include <string>
#include <vector>

// ROOT types:
#include "Rtypes.h"

class Alignable;
class AlignmentUserVariables;

//__________________________________________________________________________________________________

class MillePedeVariablesIORoot : public AlignmentIORootBase, public AlignmentUserVariablesIO {
public:
  MillePedeVariablesIORoot();
  ~MillePedeVariablesIORoot() override {}

  /** write user variables */
  void writeMillePedeVariables(
      const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr);

  /** read user variables (not that their memory is owned by this class!) */
  std::vector<AlignmentUserVariables *> readMillePedeVariables(const align::Alignables &alivec,
                                                               const char *filename,
                                                               int iter,
                                                               int &ierr);

protected:
  /** write MillePedeVariables attached to AlignmentParameters of one Alignable */
  int writeOne(Alignable *ali) override;  // inherited from AlignmentUserVariablesIO

  /** read MillePedeVariables belonging to one Alignable */
  AlignmentUserVariables *readOne(Alignable *ali, int &ierr) override;
  // previous inherited from AlignmentUserVariablesIO

  /** open IO */  // inherited from AlignmentUserVariablesIO
  int open(const char *filename, int iteration, bool writemode) override {
    return this->openRoot(filename, iteration, writemode);
  }

  /** close IO */
  int close() override { return this->closeRoot(); }  // inherited from AlignmentUserVariablesIO

  /// create root branches
  void createBranches() override;  // inherited from AlignmentIORootBase
  /// set root branche addresses
  void setBranchAddresses() override;  // inherited from AlignmentIORootBase

private:
  // variables for ROOT tree
  enum { kMaxNumPar = 20 };  // slighly above 'two bowed surfaces' limit

  unsigned int myId;
  int myObjId;

  unsigned int myNumPar;
  Byte_t myIsValid[kMaxNumPar];
  Float_t myDiffBefore[kMaxNumPar];
  Float_t myGlobalCor[kMaxNumPar];
  Float_t myPreSigma[kMaxNumPar];
  Float_t myParameter[kMaxNumPar];
  Float_t mySigma[kMaxNumPar];
  UInt_t myHitsX;
  UInt_t myHitsY;
  UInt_t myLabel;
  std::string myName;
  std::string *myNamePtr;  // needed for ROOT IO
};

#endif