#define dataReader_cxx #include "dataReader.h" #include "TH2.h" #include "TStyle.h" #include "TCanvas.h" void dataReader::Loop() { // In a ROOT session, you can do: // Root > .L dataReader.C // Root > dataReader t // Root > t.GetEntry(12); // Fill t data members with entry number 12 // Root > t.Show(); // Show values of entry 12 // Root > t.Show(16); // Read and show values of entry 16 // Root > t.Loop(); // Loop on all entries // // This is the loop skeleton where: // jentry is the global entry number in the chain // ientry is the entry number in the current Tree // Note that the argument to GetEntry must be: // jentry for TChain::GetEntry // ientry for TTree::GetEntry and TBranch::GetEntry // // To read only selected branches, Insert statements like: // METHOD1: // fChain->SetBranchStatus("*",0); // disable all branches // fChain->SetBranchStatus("branchname",1); // activate branchname // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch if (fChain == 0) return; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; // if (Cut(ientry) < 0) continue; } } data_t* dataReader::readEvent() { Long64_t nentries = fChain->GetEntriesFast(); data_t* returnData; if(lastEventGetEntry(lastEvent); lastEvent++; returnData->trigger = trigger; returnData->runtime = runtime; returnData->nchan = nchan; returnData->mc_intercept_x = mc_intercept_x; returnData->mc_slope_x = mc_slope_x; returnData->mc_intercept_z = mc_intercept_z; returnData->mc_slope_z = mc_slope_z; for(int i=0; i< 128; i++) { returnData->nslice[i] = nslice[i]; returnData->chan[i] = chan[i]; for(int j=0; j< 128; j++) { returnData->charge[i][j] = charge[i][j]; returnData->time[i][j] = time[i][j]; } } return returnData; } else { return NULL; } }