//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// //// plot_event.cxx //// plot deep station event //// //// Apr 2018, clark.2668@osu.edu //////////////////////////////////////////////////////////////////////////////// //Includes #include //AraRoot Includes #include "RawAtriStationEvent.h" #include "UsefulAtriStationEvent.h" #include "AraEventCalibrator.h" //ROOT Includes #include "TTree.h" #include "TFile.h" #include "TGraph.h" #include "TCanvas.h" using namespace std; int main(int argc, char **argv) { //check to make sure they've given me a run and a pedestal if(argc<2) { std::cout << "Usage\n" << argv[0] << " \n"; std::cout << "e.g.\n" << argv[0] << " event1841.root\n"; return 0; } char pedFileName[200]; sprintf(pedFileName, "%s", argv[1]); printf("------------------------------------------------------------------------\n"); printf("%s\n", argv[0]); printf("runFileName %s\n", argv[1]); printf("------------------------------------------------------------------------\n"); TFile *fp = TFile::Open(argv[2]); if(!fp) { std::cerr << "Can't open file\n"; return -1; } TTree *eventTree = (TTree*) fp->Get("eventTree"); if(!eventTree) { std::cerr << "Can't find eventTree\n"; return -1; } RawAtriStationEvent *rawAtriEvPtr = 0; //empty pointer eventTree->SetBranchAddress("event",&rawAtriEvPtr); //set the branch address Int_t run_num; //run number of event eventTree->SetBranchAddress("run", &run_num); //set the branch address int numEntries=eventTree->GetEntries(); //get the number of events int stationId=0; eventTree->GetEntry(0); stationId = rawAtriEvPtr->stationId; //assign the statio id number AraEventCalibrator *calib = AraEventCalibrator::Instance(); //make a calibrator for(int event=0;eventGetEntry(event); //get the event int evt_num = rawAtriEvPtr->eventNumber; //check the event umber if(rawAtriEvPtr->isCalpulserEvent()==0) continue; //bounce out if it's not a cal pulser UsefulAtriStationEvent *realAtriEvPtr_fullcalib = new UsefulAtriStationEvent(rawAtriEvPtr, AraCalType::kLatestCalib); //make the event TGraph *waveforms[16]={0}; for(int i=0; i<16; i++){ waveforms[i]=realAtriEvPtr_fullcalib->getGraphFromRFChan(i); } TCanvas *canvas = new TCanvas("","",1000,1000); canvas->Divide(4,4); for(int i=0; i<16; i++){ canvas->cd(i+1); waveforms[i]->Draw("alp"); } char title[200]; sprintf(title,"waveforms_run%d_event%d.pdf",stationId,run_num,evt_num); canvas->SaveAs(title); delete canvas; } }