//  fuerStudenten --> vor Toronto benutzte Version //

#include <vector.h>
#include <iostream.h>
#include <fstream.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <TFile.h>
#include <TH1.h>

class fp13Analysis {

public:
    
    // -- Functions to perform the analysis
    void openDataFile(const char *fileName); 
    void bookHistograms(); 
    int  readEvent(); 
    void analyze(); 
    void dumpHistograms();
    void dumpAllHistograms(const char *filename);
    void printHist(TH1 *h, ofstream &OUT);

    
    int dto;                      // Verzoegerungszeit bei Zerfall nach oben
    int dtu;                      // Verzoegerungszeit bei Zerfall nach unten
    int dt;                       // Verzoegerungszeit der Nachpulse
    int dt2;                      // Verzoegerungszeit der Nachpulse2
    int durchgang;
    int komplett;
    
    int   zerfallNachOben(int);
    int   zerfallNachUnten(int);
    int   nachpulse(int);
    int   nachpulse2(int);
    void  schieben();
    int startpattern();
    
    // -- constructor (set up and initialize variables)
    fp13Analysis(); 
    // -- destructor
    ~fp13Analysis(); 
    
private:
    
    int         fEvent;   // Event counter
    int         fSlices;  // Number of time slices with hits
    
    // -- Store bits and times as integer numbers in a vector
    vector<int> fBits; 
    vector<int> fTimes; 
    
    ifstream    *fDataFile; 
    TFile       *fHistFile; 
};

