void P0DTPC(char* inputFile) { gROOT->SetStyle("Plain"); gStyle->SetTitleFillColor(kWhite); gStyle->SetOptFit(11); //Create a Chain associated with Tree TChain* matchedTree = new TChain("TPCP0D_match"); //Add to Chain matchedTree->AddFile(inputFile); //Set Variable Names TLorentzVector *fP0DNodePos = new TLorentzVector(0,0,0,0); TVector3 *fP0DNodeDir = new TVector3(0,0,0); TLorentzVector *fTPCNodePos = new TLorentzVector(0,0,0,0); TVector3 *fTPCNodeDir = new TVector3(0,0,0); //Get Branches matchedTree->SetBranchAddress("fP0DNodePos", &fP0DNodePos); //matchedTree->SetBranchAddress("fP0DNodeDir", &fP0DNodeDir); matchedTree->SetBranchAddress("fTPCNodePos", &fTPCNodePos); matchedTree->SetBranchAddress("fTPCNodeDir", &fTPCNodeDir); //create Canvases TCanvas *c1 = new TCanvas("c1","Angular Differences",200,10,700,700); TCanvas *c2 = new TCanvas("c2","Time Difference",200,10,700,700); TCanvas *c3 = new TCanvas("c3","Z Difference",200,10,700,700); TCanvas *c4 = new TCanvas("c4","X Difference",200,10,700,700); TCanvas *c5 = new TCanvas("c5","Y Difference",200,10,700,700); c1->Divide(1,1); c2->Divide(1,1); c3->Divide(1,1); c4->Divide(1,1); c5->Divide(1,1); //Create histograms TH1F* timeDiff = new TH1F("timeDiff", "Time Difference", 30,-20,40); timeDiff->GetXaxis()->SetTitle("Time (ns)"); TH1F* zDiff = new TH1F("zDiff", "Z Distance between P0D and TPC Nodes", 35,160,500); zDiff->GetXaxis()->SetTitle("Z Difference (mm)"); TH1F* angleDiff = new TH1F("angleDiff", "Cosine(Theta) between Reconstructed Tracks", 50, 0,1); angleDiff->GetXaxis()->SetTitle("Angular difference (rad)"); TH1F* xDiff = new TH1F("xDiff", "P0D - TPC: X Position", 60,-30,30); xDiff->GetXaxis()->SetTitle("X Difference (mm)"); TH1F* yDiff = new TH1F("yDiff", "P0D - TPC: Y Position", 60,-30,30); yDiff->GetXaxis()->SetTitle("Y Difference (mm)"); //Fill histograms Int_t nentries = (Int_t)matchedTree->GetEntries(); for (int i = 0; i<nentries; i++) { matchedTree->GetEntry(i); timeDiff->Fill(fTPCNodePos->T()-fP0DNodePos->T()); zDiff->Fill(fTPCNodePos->Z()-fP0DNodePos->Z()); //Cut on z separation: Last Layer to First Plane if (fTPCNodePos->Z()-fP0DNodePos->Z()<200 && fTPCNodePos->Z()-fP0DNodePos->Z()>170) { double valcos = fTPCNodeDir->X()*fP0DNodeDir->X()+fTPCNodeDir->Y()*fP0DNodeDir->Y()+fTPCNodeDir->Z()*fP0DNodeDir->Z(); angleDiff->Fill(valcos); //Cut on angular difference //if (valcos > 0.95) { double tpcX = fTPCNodeDir->X()/fTPCNodeDir->Z()*(fP0DNodePos->Z()-fTPCNodePos->Z()) + fTPCNodePos->X(); double tpcY = fTPCNodeDir->Y()/fTPCNodeDir->Z()*(fP0DNodePos->Z()-fTPCNodePos->Z()) + fTPCNodePos->Y(); xDiff->Fill(fP0DNodePos->X()-tpcX); yDiff->Fill(fP0DNodePos->Y()-tpcY); //} } } //ksiourmen c1->cd(1); gPad->SetLogy(1); gStyle->SetOptStat("eu"); angleDiff->Draw(); c1->Modified(); c1->Update(); c2->cd(1); gPad->SetLogy(1); gStyle->SetOptStat("eou"); timeDiff->Draw(); c2->Modified(); c2->Update(); c3->cd(1); gPad->SetLogy(1); gStyle->SetOptStat("eou"); zDiff->Draw(); c3->Modified(); c3->Update(); c4->cd(1); gStyle->SetOptStat("e"); xDiff->SetLineWidth(3); xDiff->Fit("gaus"); xDiff->GetFunction("gaus")->SetLineColor(kAzure+3); xDiff->Draw(); c4->Modified(); c4->Update(); c5->cd(1); gStyle->SetOptStat("e"); yDiff->SetLineWidth(3); yDiff->Fit("gaus"); yDiff->GetFunction("gaus")->SetLineColor(kAzure+3); yDiff->Draw(); c5->Modified(); }