ROOT logo
#ifndef SCANROOT_HH
#define SCANROOT_HH

#include "TNamed.h"
#include "TH1.h"
#include "TH2.h"
#include "TFile.h"
#include "TROOT.h"
#include "TSystem.h"
#include "PelIO.h"
#include "TFile.h"
#include "TDatime.h"
#include "TStopwatch.h"
#include "TSystemDirectory.h"
#include "TClassMenuItem.h"
#include "TClass.h"
#include "log.hh"

#define MAXPARAM 8192

typedef void (*fillHist)(short,float*);
typedef bool (*l2)(short,float*);

class ScanRoot : public TNamed
{
  private:
    PelIO*           mIo;    
    TDirectory*      mDir;
    TString          mHistLibrary;
    TString          mL2Library;    
    bool             mHistLoaded;
    bool             mL2Loaded;
    bool             mDebug;
    bool             mLog;    
    bool             mH1;
    bool             mH2;
    bool             mKeepLast;              
    short            mMaxNpar;
    short            mNpar;
    short            mNparLast;
    float            mPar[MAXPARAM];
    float            mParLast[MAXPARAM];
    
    int              getROOTString(char*,char*);
    void             setPath();		
    TObject*         findObject(TDirectory*, char*);		
    void             zeroDir(TDirectory*);		
    void             saveDir(TFile*, TDirectory*, TDirectory*, bool);
    void             prepareHistograms(TDirectory*);
      
  public:
                     ScanRoot(bool = false);
                     ScanRoot(TDirectory*);
    virtual          ~ScanRoot();    
    
    void             stat();
    void             init();
    void             finish();    
    
    void             cd()                   { mDir->cd();}   
    void             addHist(char*);
    void             saveHist(char*);        
    int              loadHist(char*);    
    void             unloadHist();        
    int              loadL2(char*);        
    void             unloadL2();        
    void             zero();    
    void             zero(char*);    
    int              go(int = 0);
    bool             process(short, float*);        
    
    void             debug(bool d = false)  { mDebug = d; mIo->setDebug(d);}
    void             setNPar(int n = 128)   { mMaxNpar = (n<MAXPARAM) ? n : MAXPARAM;}    
    void             setLog(bool a = true)  { mLog = a;}
    void             setKeepLastEvent(bool a = true)  { mKeepLast = a;}
    
    char*            getL2Lib()             { if(mL2Loaded) return (char*)mL2Library.Data(); else return NULL;}
    char*            getHistLib()           { if(mHistLoaded) return (char*)mHistLibrary.Data(); else return NULL;}
    TDirectory*      getDir()               { return mDir;}    
    PelIO*           getIO()                { return mIo;}     
    int              getNPar()              { return mMaxNpar;}
    bool             getDebug()             { return mDebug;}
    
    float*           getParCurrent()        { return mPar;}
    float*           getParLast()           { return mParLast;}
    short            getNParCurrent()       { return mNpar;}
    short            getNParLast()          { if(mKeepLast) return mNparLast; else return 0;}
    
    void             addPar(int p, float v) { if(mIo) mIo->addPar(p,v);}
          
    fillHist         fillHistograms;
    l2               l2trigger;

  ClassDef(ScanRoot,1)
};
#endif
 ScanRoot.h:1
 ScanRoot.h:2
 ScanRoot.h:3
 ScanRoot.h:4
 ScanRoot.h:5
 ScanRoot.h:6
 ScanRoot.h:7
 ScanRoot.h:8
 ScanRoot.h:9
 ScanRoot.h:10
 ScanRoot.h:11
 ScanRoot.h:12
 ScanRoot.h:13
 ScanRoot.h:14
 ScanRoot.h:15
 ScanRoot.h:16
 ScanRoot.h:17
 ScanRoot.h:18
 ScanRoot.h:19
 ScanRoot.h:20
 ScanRoot.h:21
 ScanRoot.h:22
 ScanRoot.h:23
 ScanRoot.h:24
 ScanRoot.h:25
 ScanRoot.h:26
 ScanRoot.h:27
 ScanRoot.h:28
 ScanRoot.h:29
 ScanRoot.h:30
 ScanRoot.h:31
 ScanRoot.h:32
 ScanRoot.h:33
 ScanRoot.h:34
 ScanRoot.h:35
 ScanRoot.h:36
 ScanRoot.h:37
 ScanRoot.h:38
 ScanRoot.h:39
 ScanRoot.h:40
 ScanRoot.h:41
 ScanRoot.h:42
 ScanRoot.h:43
 ScanRoot.h:44
 ScanRoot.h:45
 ScanRoot.h:46
 ScanRoot.h:47
 ScanRoot.h:48
 ScanRoot.h:49
 ScanRoot.h:50
 ScanRoot.h:51
 ScanRoot.h:52
 ScanRoot.h:53
 ScanRoot.h:54
 ScanRoot.h:55
 ScanRoot.h:56
 ScanRoot.h:57
 ScanRoot.h:58
 ScanRoot.h:59
 ScanRoot.h:60
 ScanRoot.h:61
 ScanRoot.h:62
 ScanRoot.h:63
 ScanRoot.h:64
 ScanRoot.h:65
 ScanRoot.h:66
 ScanRoot.h:67
 ScanRoot.h:68
 ScanRoot.h:69
 ScanRoot.h:70
 ScanRoot.h:71
 ScanRoot.h:72
 ScanRoot.h:73
 ScanRoot.h:74
 ScanRoot.h:75
 ScanRoot.h:76
 ScanRoot.h:77
 ScanRoot.h:78
 ScanRoot.h:79
 ScanRoot.h:80
 ScanRoot.h:81
 ScanRoot.h:82
 ScanRoot.h:83
 ScanRoot.h:84
 ScanRoot.h:85
 ScanRoot.h:86
 ScanRoot.h:87
 ScanRoot.h:88
 ScanRoot.h:89
 ScanRoot.h:90
 ScanRoot.h:91
 ScanRoot.h:92
 ScanRoot.h:93
 ScanRoot.h:94
 ScanRoot.h:95
 ScanRoot.h:96