//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() { gStyle->SetOptStat(0); TFile *f1 = new TFile("Gallery_output.root"); // TFile *f2 = new TFile("/uboone/app/users/abhat/new_nospacecharge_gallery_output.root"); TTree *t1 = (TTree*)f1->Get("MCTracktree"); TTree *t2 = (TTree*)f1->Get("RecoTracktree"); //Variables to hold the muon track starts and ends within the detector Double_t muontrack_startX; Double_t muontrack_startZ; Double_t muontrack_startY; Double_t muontrack_endX; Double_t muontrack_endY; Double_t muontrack_endZ; Double_t muontracklength; //Variables to hold the reco track start and ends (ofcourse within the detector) Double_t recotrack_startX; Double_t recotrack_startZ; Double_t recotrack_startY; Double_t recotrack_endX; Double_t recotrack_endY; Double_t recotrack_endZ; Double_t recotracklength; //Branch declaration (pointers) //MC Branches TBranch *b_muontrack_startX = t1->GetBranch("muonStartX_det"); TBranch *b_muontrack_startY = t1->GetBranch("muonStartY_det"); TBranch *b_muontrack_startZ = t1->GetBranch("muonStartZ_det"); TBranch *b_muontrack_endX = t1->GetBranch("muonEndX_det"); TBranch *b_muontrack_endY = t1->GetBranch("muonEndY_det"); TBranch *b_muontrack_endZ = t1->GetBranch("muonEndZ_det"); TBranch *b_muontracklength = t1->GetBranch("muontracklength_det"); //Reco Branches TBranch *b_recotrack_startX = t2->GetBranch("StartX_reco"); TBranch *b_recotrack_startY = t2->GetBranch("StartY_reco"); TBranch *b_recotrack_startZ = t2->GetBranch("StartZ_reco"); TBranch *b_recotrack_endX = t2->GetBranch("EndX_reco"); TBranch *b_recotrack_endY = t2->GetBranch("EndY_reco"); TBranch *b_recotrack_endZ = t2->GetBranch("EndZ_reco"); TBranch *b_recotracklength = t2->GetBranch("tracklength_reco"); //Set Address for all branch pointers //MC b_muontrack_startX->SetAddress(&muontrack_startX); b_muontrack_startY->SetAddress(&muontrack_startY); b_muontrack_startZ->SetAddress(&muontrack_startZ); b_muontrack_endX->SetAddress(&muontrack_endX); b_muontrack_endY->SetAddress(&muontrack_endY); b_muontrack_endZ->SetAddress(&muontrack_endZ); b_muontracklength->SetAddress(&muontracklength); //Reco b_recotrack_startX->SetAddress(&recotrack_startX); b_recotrack_startY->SetAddress(&recotrack_startY); b_recotrack_startZ->SetAddress(&recotrack_startZ); b_recotrack_endX->SetAddress(&recotrack_endX); b_recotrack_endY->SetAddress(&recotrack_endY); b_recotrack_endZ->SetAddress(&recotrack_endZ); b_recotracklength->SetAddress(&recotracklength); /* //create one histogram TH1D* h_track_lengths = new TH1D("h_track_lengths","Distribution of all MCTrack lengths;Track Length (cm);Number of Tracks",10000,0,10000); TH1D* h_muontrack_lengths = new TH1D("h_muontrack_lengths","Distribution of Muon MCTrack lengths;Track Length (cm);Number of Tracks",10000,0,10000); // h_track_start1->SetMarkerSize(0.5); // h_track_start1->SetMarkerColor(2); // TH2D* h_track_start2 = new TH2D("h_track_start2","starting Point of Tracks;Z-Coordinate (cm);Y-Coordinate (cm)",10000,-10,270,10000,-130,130); // h_track_start2->SetMarkerStyle(20); // h_track_start2->SetMarkerSize(0.5); //read only the destep branch for all entries */ Int_t nentries = (Int_t)t1->GetEntries(); Int_t mentries = (Int_t)t2->GetEntries(); Double_t xprod[nentries][mentries],yprod[nentries][mentries],zprod[nentries][mentries]; int counter1=0; int counter2=0; for (Int_t i=0;i<=nentries;i++) { b_muontrack_startX->GetEntry(i); b_muontrack_endX->GetEntry(i); // t1->GetEntry(i); counter1++; cout<<"Counter1: "<GetEntry(j); b_recotrack_endX->GetEntry(j); // t2->GetEntry(j); xprod[i][j]=(muontrack_endX-muontrack_startX)*(recotrack_endX-recotrack_startX); cout <<"xprod is: "<GetEntries(); // for (Int_t i=0;iGetEntry(i); // b_track_startY2->GetEntry(i); // fill the histogram with the destep entry // h_track_start2->Fill(track_startZ2,track_startY2); // } t1->Print(); t2->Print(); /* // 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_lengths->SetLineColor(kBlue); h_track_lengths->SetLineWidth(2); h_track_lengths->Draw(); h_muontrack_lengths->SetLineColor(kRed); h_muontrack_lengths->Draw("SAME"); // TLine *l1 = new TLine(-10,-116.5,270,-116.5); // TLine *l2 = new TLine(-10,116.5,270,116.5); // l1->Draw(); // l2->Draw(); auto legend = new TLegend(0.1,0.7,0.48,0.9); legend->AddEntry(h_track_lengths,"All MCTracks","l"); legend->AddEntry(h_muontrack_lengths,"Muon MCTracks","l"); legend->Draw(); */ }