//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Find padIDs of pads with signals outside time intervall corresponding to drift length // load macro with .L .C+ to compile it and then enter ExecuteFindBadPads 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 "TH1F.h" #include "TH2F.h" #include #include #include #include #include #include #include #include #include #include #include std::string inttostring(Int_t input) { std::string s; std::stringstream out; out << input; s = out.str(); return s; } void ExecuteFindBadPads(bool verbose, int runnumber, int datanumber, int nevents, std::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","Pads with pad hits outside drift time interval",1000,700); c1->SetFillColor(00); c1->SetGrid(); // create histogram TH1F *histBadPads = new TH1F ("histBadPads", "Pads with pad hits outside drift time interval", 5504,0,5504); TH2F *histBadPadsamp = new TH2F ("histBadPadsamp", "Pads with pad hits outside drift time interval + amplitude", 5504,0,5504,500,0,500); // create Tree TTree *tpcTree = (TTree*)reco->Get("cbmsim"); //save time and load only necessary branches tpcTree->SetBranchStatus("*",0); tpcTree->SetBranchStatus("TpcDigi.*",1); tpcTree->SetBranchStatus("TpcCluster.*",1); // 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){ std::cout<<"#################### Event done: "<GetEvent(ev); //loop over clusters for(Int_t cluster=0;clusterGetEntriesFast();++cluster){ TpcCluster *clus =(TpcCluster*) clusters->At(cluster); if (clus->pos().z()>10.6){ std::vector digiids = clus->getDigiIDs(); for (unsigned int i = 0; i < digiids.size(); i++){ TpcDigi *tpcdigi = (TpcDigi*) digis->At(digiids[i]); histBadPads->Fill(tpcdigi->padId()); histBadPadsamp->Fill(tpcdigi->padId(),tpcdigi->amp()); } } } } //define output filename std::string filename = "merge_" + inttostring(runnumber) + "_" + inttostring(datanumber) + "padsoutsidedrifttime.root"; std::string pathname = dirname + filename; // Draw the histogram histBadPads->Draw(); c1->SaveAs(pathname.data()); }