//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Plot digis per cluster // Macro was used to investigate the strange peaks in the z position distribution of tracks -> further research necessary! // load macro with .L .C+ to compile it and then enter ExecutePadHitsperCluster 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 "TAxis.h" #include "TFrame.h" #include "TF1.h" #include "TLegend.h" #include "TFile.h" #include "TTree.h" #include "TString.h" #include "TH1D.h" #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 ExecutePadHitsperCluster(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","Digis per Cluster",1000,700); c1->SetFillColor(00); TCanvas *c2 = new TCanvas("c2","Cluster amplitudes",1000,700); c2->Divide(2,1); // create histogram TH1F *hist1 = new TH1F ("hist1", "digis per cluster", 51,0,50); TH1F *hist2 = new TH1F ("hist2", "amps in window", 501,0,500); TH1F *hist3 = new TH1F ("hist3", "amps outside window", 501,0,500); // create Tree TTree *tpcTree = (TTree*)reco->Get("cbmsim"); // create arrays TClonesArray *clusters = new TClonesArray("TpcCluster"); TClonesArray *digis = new TClonesArray("TpcDigi"); // set branches tpcTree->SetBranchAddress("TpcDigi",&digis); tpcTree->SetBranchAddress("TpcCluster",&clusters); // loop over 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 numberofclusters = clusters->GetEntries(); for (unsigned int clu = 0; clu < numberofclusters; clu++ ){ TpcCluster* cluster = (TpcCluster*) clusters->At(clu); unsigned int ndigis = cluster->nDigi(); hist1->Fill(ndigis); if(cluster->pos().z()>2.73 && cluster->pos().z()<10.6){ //inside time window of 20 to 80 samples hist2->Fill(cluster->amp()); } else{ hist3->Fill(cluster->amp()); //outside time window (2 strange peaks...) } } } //define output filename string filename = "merge_" + inttostring(runnumber) + "numberofdigispercluster"; string pathname1 = dirname + filename + ".root"; string pathname2 = dirname + filename + ".pdf"; // Draw the histogram c1->cd(); hist1->Draw(); c2->cd(1); hist2->Draw(); c2->cd(2); hist3->Draw(); c1->SaveAs(pathname1.data()); c1->SaveAs(pathname2.data()); }