#ifndef timew_calib_h #define timew_calib_h #include #include #include #include #include "final_fitting.h" class timew_calib { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain //Declaration of leaves types Int_t timewalk_SiHits; Int_t timewalk_SiPhiHits; Int_t timewalk_SiStHits; Int_t timewalk_SiZHits; Float_t timewalk_bar1; Float_t timewalk_bar2; Float_t timewalk_beta; Int_t timewalk_chi2; Int_t timewalk_chi2Si; Int_t timewalk_cotAxHits; Int_t timewalk_cotHits; Int_t timewalk_cotStHits; Float_t timewalk_curv; Float_t timewalk_d0; Float_t timewalk_d0wrt; Int_t timewalk_event; Int_t timewalk_id; Int_t timewalk_inBar; Float_t timewalk_path1; Float_t timewalk_path2; Float_t timewalk_phi0; //Float_t timewalk_phi_entry1; //Float_t timewalk_phi_entry2; //Float_t timewalk_phi_exit1; //Float_t timewalk_phi_exit2; Float_t timewalk_pt; Float_t timewalk_qe1; Float_t timewalk_qe2; Float_t timewalk_qw1; Float_t timewalk_qw2; //Float_t timewalk_r_entry1; //Float_t timewalk_r_entry2; //Float_t timewalk_r_exit1; //Float_t timewalk_r_exit2; Int_t timewalk_run; Int_t timewalk_sl8Hits; Float_t timewalk_te1; Float_t timewalk_te2; Int_t timewalk_track_type; Float_t timewalk_tw1; Float_t timewalk_tw2; Float_t timewalk_z1; Float_t timewalk_z2; //Float_t timewalk_z_exit1; //Float_t timewalk_z_exit2; final_fitting ajuste; //List of branches TBranch *b_timewalk; //! timew_calib(char *infile[100], int ntp_indx, TTree *tree=0); ~timew_calib(); Int_t Cut(Int_t entry); Int_t GetEntry(Int_t entry); Int_t LoadTree(Int_t entry); void Init(TTree *tree); void Loop(); Bool_t Notify(); void Show(Int_t entry = -1); //-------------------------------------------------------------------------- void EventCounter(); //-------------------------------------------------------------------------- void LoopTW(int evts, int flag, double cut, char *file_name, char *directory); //-------------------------------------------------------------------------- }; #endif #ifdef timew_calib_cxx timew_calib::timew_calib(char *infile[100], int ntp_indx, TTree *tree) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { #ifdef TIMEWALK_SINGLE_TREE TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("/cdf/scratch/piedra/r2offline/tof/timewalk/twalk-153620.root"); if (!f) { f = new TFile("/cdf/scratch/piedra/r2offline/tof/timewalk/twalk-153620.root"); f->cd("/cdf/scratch/piedra/r2offline/tof/timewalk/twalk-153620.root:/TofCalibMenuModule"); } tree = (TTree*)gDirectory->Get("tof_calib"); #else // TIMEWALK_SINGLE_TREE TChain *chain = new TChain("TofCalibMenuModule/tof_calib",""); for (int files = 0; filesAdd(infile[files]); tree = chain; #endif // TIMEWALK_SINGLE_TREE } Init(tree); } timew_calib::~timew_calib() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t timew_calib::GetEntry(Int_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Int_t timew_calib::LoadTree(Int_t entry) { // Set the environment to read one entry if (!fChain) return -5; Int_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->IsA() != TChain::Class()) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void timew_calib::Init(TTree *tree) { // Set branch addresses if (tree == 0) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("timewalk",&timewalk_SiHits); Notify(); } Bool_t timew_calib::Notify() { // Called when loading a new file. // Get branch pointers. b_timewalk = fChain->GetBranch("timewalk"); return kTRUE; } void timew_calib::Show(Int_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t timew_calib::Cut(Int_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef timew_calib_cxx