////////////////////////////////////////////////////////// // This file has been automatically generated // (Mon Mar 19 22:01:33 2018 by ROOT version5.34/10) // from TTree save/save // found on file: dpalign.root // // For Dark Photon alignment study 03/20/2018 MXL // ////////////////////////////////////////////////////////// int ana_align(){ //Reset ROOT and connect tree file gROOT->Reset(); TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("dpalign.root"); if (!f) { f = new TFile("dpalign.root"); } // f->GetObject("save",tree); TTree * save = (TTree *) gDirectory->Get("save"); //Declaration of leaves types Int_t quad; Int_t fElementID; Int_t bElementID; Int_t fElementID_exp; Int_t bElementID_exp; Double_t fPos; Double_t fPos_exp; Double_t bPos; Double_t bPos_exp; Double_t tx; Double_t ty; Double_t x0; Double_t y0; // Set branch addresses. save->SetBranchAddress("quad",&quad); save->SetBranchAddress("fElementID",&fElementID); save->SetBranchAddress("bElementID",&bElementID); save->SetBranchAddress("fElementID_exp",&fElementID_exp); save->SetBranchAddress("bElementID_exp",&bElementID_exp); save->SetBranchAddress("fPos",&fPos); save->SetBranchAddress("fPos_exp",&fPos_exp); save->SetBranchAddress("bPos",&bPos); save->SetBranchAddress("bPos_exp",&bPos_exp); save->SetBranchAddress("tx",&tx); save->SetBranchAddress("ty",&ty); save->SetBranchAddress("x0",&x0); save->SetBranchAddress("y0",&y0); /* root [1] save->Show(0) ======> EVENT:0 quad = 0 //0, 1, 2, 3 stands for top-left, top-right, bottom-left, bottom-right fElementID = 9 //nearest station-1 hit elementID bElementID = 9 //nearest station-2 hit elementID fElementID_exp = 10 //expected station-1 hit elementID bElementID_exp = 10 //expected station-2 hit elementID fPos = -31.3569 // nearest station-1 hit position fPos_exp = -31.6229 // expected station-1 hit position bPos = -29.654 // nearest station-2 hit position bPos_exp = -30.25 // expected station-2 hit position tx = 0.0419373 //track slope in X-Z ty = 0.00957994 //track slope in Y-Z x0 = -20.3776 //track intersection in X-Z y0 = 9.55376 //track intersection in Y-Z */ // This is the loop skeleton // To read only selected branches, Insert statements like: // save->SetBranchStatus("*",0); // disable all branches // TTreePlayer->SetBranchStatus("branchname",1); // activate branchname // //--define canvas & histograms // TCanvas * c1 = new TCanvas("c1", "DP Alignment Data", 10, 20, 800, 800); TCanvas * c2 = new TCanvas("c2", "DP Alignment Data", 100, 200, 800, 800); TH1F * qID = new TH1F("qID", "QuadrantID", 10, 0, 5); Long64_t nentries = save->GetEntries(); cout << "nentries =" << nentries << endl; Long64_t nbytes = 0; for (Long64_t i=0; iGetEntry(i); // cout << "quad =" << quad << endl; qID->Fill(quad); } // end of loop //-- make plots c1->cd(); c1->Divide(2,2); c1->cd(1); qID->Draw(); return nentries; }