Skip to content

Instantly share code, notes, and snippets.

@mgmarino
Created May 27, 2011 18:21
Show Gist options
  • Save mgmarino/995831 to your computer and use it in GitHub Desktop.
Save mgmarino/995831 to your computer and use it in GitHub Desktop.
calibclass header
#include <TSystem.h>
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <string>
#include <TRef.h>
#include <TRefArray.h>
#include <TTree.h>
#include "EXOUtilities/EXOEventData.hh"
#include <fstream>
#include <stdio.h>
using namespace std;
class calibclass{
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
// Declaration of leaf types
EXOEventData *ed;
int runningtime[8];
calibclass();
virtual ~calibclass();
virtual Int_t GetEntry(Long64_t entry);
// virtual Long64_t LoadTree(Long64_t entry);
// virtual void Init(TTree *tree);
virtual void Loop();
// virtual Bool_t Notify();
// virtual void Show(Long64_t entry = -1);
//virtual void Rotation(float apdx[],float apdy[]);
// virtual void ReadAPDMap(float apdx[],float apdy[]);
};
calibclass::calibclass()
{
ifstream inputfile;
TString Th232List="Th232.dat";
inputfile.open(Th232List.Data());
TChain *tree = new TChain("tree");
int n=0;
TString filename;
while(!inputfile.eof()){
filename="";
inputfile >> filename;
if(filename!=""){
tree->Add(filename.Data());
cout << "filename = " << filename.Data() << endl;
}
n++;
}
n=0;
inputfile.close();
if (!tree) { cout << "error, no tree";exit(-1);}
ed = 0;
tree->SetBranchAddress("EventBranch", &ed);
}
calibclass::~calibclass()
{
if (!fChain) return;
delete fChain->GetCurrentFile();
}
Int_t calibclass::GetEntry(Long64_t entry)
{
// Read contents of entry.
if (!fChain) return 0;
return fChain->GetEntry(entry);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment