//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Plot total amplitude of pas on IROC // still to do: make gain map of IROC // load macro with .L .C+ to compile it and then enter ExecuteAmpperPad and press to see the arguments // runnumber: which run? datanumber: which reconstruction of this run? nevents: process how many events? dirname: output directory name // // 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 #include //--------------------------------------------- //Helper functions //--------------------------------------------- string inttostring(Int_t input) { string s; stringstream out; out << input; s = out.str(); return s; } //--------------------------------------------- void ExecuteAmpperPad(bool verbose, int runnumber, int datanumber, int nevents, string dirname = "plots/"){ TString indirname = "/nfs/mds/data/tpc/alice/ps_test_beam/RecoOut/"; TString infilename = "merge_" + inttostring(runnumber) + "_" + inttostring(datanumber) + "_corrected_hough_smoothed.reco.root"; TString inpathname = indirname + infilename; // open file TFile *reco = new TFile(inpathname); // create canvas TCanvas *c1 = new TCanvas("c1","Simple Amplitude map",1000,700); c1->SetFillColor(00); c1->SetGrid(); // create histogram TH2F *histgainmap = new TH2F ("histgainmap","Simple Amplitude Map", 63,85.225,131.725,108,-22,22); // 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, clusters, digis and samples //events if (nevents == 0){ nevents = tpcTree->GetEntries(); } for( Int_t ev = 0; ev < nevents; ev++){ if(ev%1000==0){ cout<<"#################### Event done: "<GetEvent(ev); unsigned int ndigis = digis->GetEntriesFast(); for (unsigned int idigi = 0; idigi < ndigis; idigi++){ TpcDigi* digi = (TpcDigi*) digis->At(idigi); double padx = 0.; double pady = 0.; padplane->GetPadXY(digi->padId(),padx, pady); histgainmap->Fill(padx,pady, digi->amp()); } } //define output filename string filename = "merge_" + inttostring(runnumber) + "_gainmapwith_"+ inttostring(nevents) + "_events"; string pathname1 = dirname + filename +".pdf"; string pathname2 = dirname + filename+ ".root"; // Draw the histograms and save plot histgainmap->GetXaxis()->SetTitle("x (cm)"); histgainmap->GetYaxis()->SetTitle("y (cm)"); histgainmap->Draw("colz"); c1->SaveAs(pathname1.data()); c1->SaveAs(pathname2.data()); }