//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Plot xy and xz projections of tracks to estimate parameter space of Hough transform // Has to be improved, better method for estimating parameters: Histograms in Hough Task // // Environment: // GEM ALICE IROC prototype data analysis in fopiroot // // Author List: // Philipp Gadow (philipp.gadow@mytum.de) // // //----------------------------------------------------------- #include #include "TCanvas.h" #include "TGraphErrors.h" #include "TAxis.h" #include "TFrame.h" #include "TF1.h" #include "TLegend.h" #include "TArrow.h" #include "TLatex.h" #include "TFile.h" #include "TTree.h" #include "TString.h" #include "TH2F.h" #include "TH2I.h" #include #include #include #include #include #include #include #include #include #include #include #include string inttostring(Int_t input) { string s; stringstream out; out << input; s = out.str(); return s; } void ExecuteFindParameterSpace(int runnumber){ TString indirname = "/nfs/mds/data/tpc/alice/ps_test_beam/RecoOut/"; TString infilename = "merge_681_hough.smoothed.reco.root"; TString inpathname = indirname + infilename; // open file TFile *reco = new TFile(inpathname); // create canvas TCanvas *c1 = new TCanvas("c1","Hough Parameter Space Limits",400,0,1600,1100); c1->Divide(3,2); c1->SetFillColor(00); c1->SetGrid(); // create histogram TH2F *histfirstrowyz = new TH2F ("histfirstrowyz"," yz: first 4 rows", 108,-22,22,100,0,100); TH2F *histlastrowyz = new TH2F ("histlastrowyz","yz: last 2 good rows", 108,-22,22,100,0,100); TH2F *histallyz = new TH2F ("histallyz","yz: all rows", 108,-22,22,100,0,100); TH2F *histxy = new TH2F ("histxy"," xy projection", 63,85.225,131.725,108,-22,22); TH2F *histxz = new TH2F ("histxz"," xz projection", 63,85.225,131.725,100,0,100); // create Tree TTree *tpcTree = (TTree*)reco->Get("cbmsim"); //save time and load only necessary branches tpcTree->SetBranchStatus("*",0); tpcTree->SetBranchStatus("TpcDigi.*",1); // create arrays TClonesArray *digis = new TClonesArray("TpcDigi"); // set branches tpcTree->SetBranchAddress("TpcDigi",&digis); // create padplane TString poolfile = "/nfs/hicran/project/panda/SIM/pgadow/fopiROOT_trunk/tpc/ALICE/par/padshape_iroc.dat"; TString padplanefilename = "/nfs/hicran/project/panda/SIM/pgadow/fopiROOT_trunk/tpc/ALICE/par/padplane_iroc.dat"; TpcPadShapePool *pool = new TpcPadShapePool(poolfile); TpcPadPlane* padplane = new TpcPadPlane(padplanefilename,pool); // loop over events unsigned int numevents = tpcTree->GetEntries(); for( Int_t ev = 0; ev < numevents; ev++){ if(ev%1000==0){ cout<<"Event done: "<GetEvent(ev); Int_t NumTpcDigis = digis->GetEntries(); if (NumTpcDigis == 0) continue; for (Int_t idigi = 0; idigi < NumTpcDigis; idigi++){ TpcDigi* tpcdigi = (TpcDigi*) digis->At(idigi); if (tpcdigi->amp()<15) continue; unsigned int digipadid = tpcdigi->padId(); double padx, pady; padplane->GetPadXY(digipadid,padx,pady); double padt = tpcdigi->t(); if (padx<93 && padx>90){ //4 rows histfirstrowyz->Fill(pady,padt); } if (padx>127.9 && padx < 129){ // last good 2 rows histlastrowyz->Fill(pady,padt); } histxz->Fill(padx,padt); histxy->Fill(padx,pady); histallyz->Fill(pady,padt); } } //define output filename string dirname = "plots/"; string filename = "merge_" + inttostring(runnumber) + "_parameterspace"; string pathname1 = dirname + filename+".png"; string pathname2 = dirname + filename+".C"; // Draw the histograms and save plot c1->cd(1); histfirstrowyz->GetXaxis()->SetTitle("y [cm]"); histfirstrowyz->GetYaxis()->SetTitle("t [samples]"); histfirstrowyz->Draw("colz"); c1->cd(2); histlastrowyz->GetXaxis()->SetTitle("y [cm]"); histlastrowyz->GetYaxis()->SetTitle("t [samples]"); histlastrowyz->Draw("colz"); c1->cd(3); histallyz->GetXaxis()->SetTitle("y [cm]"); histallyz->GetYaxis()->SetTitle("t [samples]"); histallyz->Draw("colz"); c1->cd(4); histxz->GetXaxis()->SetTitle("x [cm]"); histxz->GetYaxis()->SetTitle("t [samples]"); histxz->Draw("colz"); c1->cd(5); histxy->GetXaxis()->SetTitle("x [cm]"); histxy->GetYaxis()->SetTitle("y [cm]"); histxy->Draw("colz"); c1->SaveAs(pathname1.data()); c1->SaveAs(pathname2.data()); }