//some standard C++ includes #include #include #include #include #include #include #include #include #include #include //some ROOT includes #include "TInterpreter.h" #include "TROOT.h" #include "TH1F.h" #include "TH2D.h" #include "TFile.h" #include "TMath.h" #include "TTree.h" #include "TBranch.h" #include "TVector3.h" //"art" includes (canvas, and gallery) #include "canvas/Utilities/InputTag.h" #include "gallery/Event.h" #include "gallery/ValidHandle.h" #include "canvas/Persistency/Common/FindMany.h" #include "canvas/Persistency/Common/FindOne.h" #include "gallery/Handle.h" //"larsoft" object includes #include "lardataobj/RecoBase/OpFlash.h" #include "lardataobj/RecoBase/OpHit.h" #include "lardataobj/RawData/RawDigit.h" #include "lardataobj/RecoBase/Hit.h" #include "lardataobj/RecoBase/Track.h" #include "lardataobj/RecoBase/SpacePoint.h" #include "lardataobj/AnalysisBase/T0.h" #include "lardataobj/MCBase/MCTrack.h" #include "lardataobj/MCBase/MCStep.h" //(timing information for the beam) #include "lardataobj/RawData/TriggerData.h" #include "larcoreobj/SimpleTypesAndConstants/geo_types.h" #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" //"larreco" reconstruction for MCS. #include "larreco/RecoAlg/TrajectoryMCSFitter.h" using namespace art; using namespace std; using namespace std::chrono; void readTTree() { // read the Tree generated by tree2w and fill one histogram // we are only interested by the destep branch // note that we use "new" to create the TFile and TTree objects because we // want to keep these objects alive when we leave this function TFile *f = new TFile("/pnfs/uboone/scratch/users/abhat/gallery_output.root"); TTree *t1 = (TTree*)f->Get("SCEtree"); static Float_t mctrack_startX; static Float_t mctrack_startY; TBranch *b_mctrack_startX = t1->GetBranch("mctrack_startX"); TBranch *b_mctrack_startY = t1->GetBranch("mctrack_startY"); b_mctrack_startX->SetAddress(&mctrack_startX); b_mctrack_startY->SetAddress(&mctrack_startY); //create one histogram TH2D* h_track_start1 = new TH2D("h_track_start1","End Point of Tracks;X-Coordinate (cm);Y-Coordinate (cm)",100,-10,270,100,-130,130); h_track_start1->SetMarkerStyle(20); h_track_start1->SetMarkerColor(2); //read only the destep branch for all entries Int_t nentries = (Int_t)t1->GetEntries(); for (Int_t i=0;iGetEntry(i); b_mctrack_startY->GetEntry(i); // fill the histogram with the destep entry h_track_start1->Fill(b_mctrack_startX,b_mctrack_startY); } // we do not close the file; we want to keep the generated histograms; // we fill a 3-d scatter plot with the particle step coordinates TCanvas* canvas = new TCanvas("canvas","Hit Info!",1500,500); h_track_start1->Draw("P"); TLine *l1 = new TLine(-10,-116.5,270,-116.5); TLine *l2 = new TLine(-10,116.5,270,116.5); l1->Draw(); l2->Draw("SAME"); }