Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Alignment_CommonAlignmentAlgorithm_AlignmentIORootBase_h
0002 #define Alignment_CommonAlignmentAlgorithm_AlignmentIORootBase_h
0003 
0004 #include "TString.h"
0005 
0006 class TFile;
0007 class TTree;
0008 
0009 /// Base class for ROOT-based I/O of Alignment parameters etc.
0010 
0011 class AlignmentIORootBase {
0012 protected:
0013   /// constructor
0014   AlignmentIORootBase() : tree(nullptr), myFile(nullptr) {}
0015   /// destructor
0016   virtual ~AlignmentIORootBase();
0017 
0018   /// open IO
0019   int openRoot(const char* filename, int iteration, bool writemode);
0020 
0021   /// close IO
0022   int closeRoot(void);
0023 
0024   /// create root branches
0025   virtual void createBranches(void) = 0;
0026 
0027   /// set root branches
0028   virtual void setBranchAddresses(void) = 0;
0029 
0030   /// test if file is existing and if so, what the highest iteration is
0031   int testFile(const char* filename, const TString& tname);
0032 
0033   /// compose tree name
0034   TString treeName(int iter, const TString& tname);
0035 
0036   // data members
0037 
0038   TTree* tree;       // root tree
0039   TString treename;  // tree identifier name
0040   TString treetxt;   // tree text
0041   bool bWrite;       // if true we are writing, else reading
0042 
0043   const static int nParMax = 20;    // maximal number of Parameters
0044   const static int itermax = 1000;  // max iteration to test for
0045 
0046 private:
0047   TFile* myFile;  // root file
0048 };
0049 
0050 #endif