#ifndef speed_calib_h #define speed_calib_h #include #include #include #include #include "final_fitting.h" class speed_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 lightspeed_num_vtx; Int_t lightspeed_SiHits; Int_t lightspeed_SiPhiHits; Int_t lightspeed_SiStHits; Int_t lightspeed_SiZHits; Float_t lightspeed_bar; Float_t lightspeed_chi2; Int_t lightspeed_chi2Si; Int_t lightspeed_cotAxHits; Int_t lightspeed_cotHits; Int_t lightspeed_cotStHits; Float_t lightspeed_cte; Float_t lightspeed_ctw; Float_t lightspeed_curv; Float_t lightspeed_d0; Float_t lightspeed_d0wrt; Int_t lightspeed_event; Float_t lightspeed_flag[30]; //[num_vtx] Int_t lightspeed_id; Int_t lightspeed_inBar; Float_t lightspeed_p; Float_t lightspeed_pathinBar; Float_t lightspeed_phi0; //Float_t lightspeed_phi_entry; //Float_t lightspeed_phi_exit; Float_t lightspeed_pt; Float_t lightspeed_qe; Float_t lightspeed_qw; //Float_t lightspeed_r_entry; //Float_t lightspeed_r_exit; Int_t lightspeed_run; Int_t lightspeed_sl8Hits; Float_t lightspeed_te; Float_t lightspeed_tofLength; Float_t lightspeed_tof_k; Float_t lightspeed_tof_p; Float_t lightspeed_tof_pi; Int_t lightspeed_track_type; Float_t lightspeed_trkLength; Float_t lightspeed_tw; Float_t lightspeed_z; Float_t lightspeed_z0; Float_t lightspeed_z0corr; //Float_t lightspeed_z_entry; //Float_t lightspeed_z_exit; Float_t lightspeed_zvtx[30]; //[num_vtx] final_fitting ajuste; //List of branches TBranch *b_lightspeed; //! speed_calib(char *infile[100], int ntp_indx, TTree *tree=0); ~speed_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 LoopSpd(int evts, int flag, double cut, char *file_name, char *directory); //-------------------------------------------------------------------------- void LoopT0Abs(int evts, double cut, char *file_name, char *directory); //-------------------------------------------------------------------------- void LoopAtt(int evts, double cut, char *file_name, char *directory); //-------------------------------------------------------------------------- void LoopAttl(int NumEvt, double cut, char *file_name, char *directory, int Flag); //-------------------------------------------------------------------------- void LoopRes(int evts, int flag, int maxtrk, int ntrkt0, double pt_cut, double cut, char *file_name, char *directory); //-------------------------------------------------------------------------- void LoopVal(int evts, char *file_name, char *directory); //-------------------------------------------------------------------------- double CalculateT0(int nvtx, double *T0Error); //-------------------------------------------------------------------------- }; #endif #ifdef speed_calib_cxx speed_calib::speed_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 LIGHTSPEED_SINGLE_TREE TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("/cdf/scratch/piedra/r2offline/tof/lightspeed/speed-153620.root"); if (!f) { f = new TFile("/cdf/scratch/piedra/r2offline/tof/lightspeed/speed-153620.root"); f->cd("/cdf/scratch/piedra/r2offline/tof/lightspeed/speed-153620.root:/TofCalibMenuModule"); } tree = (TTree*)gDirectory->Get("tof_calib"); #else // LIGHTSPEED_SINGLE_TREE TChain *chain = new TChain("TofCalibMenuModule/tof_calib",""); for (int files = 0; filesAdd(infile[files]); tree = chain; #endif // LIGHTSPEED_SINGLE_TREE } Init(tree); } speed_calib::~speed_calib() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t speed_calib::GetEntry(Int_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Int_t speed_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 speed_calib::Init(TTree *tree) { // Set branch addresses if (tree == 0) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("lightspeed",&lightspeed_num_vtx); Notify(); } Bool_t speed_calib::Notify() { // Called when loading a new file. // Get branch pointers. b_lightspeed = fChain->GetBranch("lightspeed"); return kTRUE; } void speed_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 speed_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 speed_calib_cxx