Changeset 19951 for trunk/Mars/hawc/plot_trace.C
- Timestamp:
- 04/29/20 21:48:05 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/plot_trace.C
r19846 r19951 1 #include <TStyle.h> 2 #include <TCanvas.h> 3 #include <TSystem.h> 4 #include <TF1.h> 5 #include <TProfile.h> 6 #include <TProfile2D.h> 7 #include <TMath.h> 8 #include <TGraph.h> 9 #include <TLine.h> 10 #include <TFitResultPtr.h> 11 #include <TFitResult.h> 12 #include <TFile.h> 13 #include <TLine.h> 14 15 #include <cstdio> 16 #include <stdio.h> 17 #include <stdint.h> 18 19 #include "Getline.h" 20 #include "MH.h" 21 #include "MArrayI.h" 22 #include "MDirIter.h" 23 #include "MFillH.h" 24 #include "MEvtLoop.h" 25 #include "MCamEvent.h" 26 #include "MGeomApply.h" 27 #include "MTaskList.h" 28 #include "MParList.h" 29 #include "MContinue.h" 30 #include "MBinning.h" 31 #include "MDrsCalibApply.h" 32 #include "MDrsCalibration.h" 33 #include "MRawFitsRead.h" 34 #include "MStatusDisplay.h" 35 #include "MTaskInteractive.h" 36 #include "MPedestalSubtractedEvt.h" 37 #include "MGeomCamFAMOUS.h" 38 #include "MRawRunHeader.h" 39 #include "MPedestalCam.h" 40 #include "MPedestalPix.h" 41 #include "MParameters.h" 42 1 43 // ========================================================================== 2 44 // ============ see plot_callisto function at the end of the file =========== … … 21 63 22 64 // Create a histogram for the trace 23 TH1D hist("Trace", "Waveform", 1024, -0.25, 511.75); 65 //TH1D hist("Trace", "Waveform", 1024, -0.25, 511.75); //range = [-0.25,511.75]ns 66 TH1D hist("Trace", "Waveform (Pixel 5, Event 1)", 1024, -0.5, 1024-0.5); 24 67 25 68 // All 'data members' that are required globally … … 34 77 { 35 78 fEvt = (MPedestalSubtractedEvt*)plist->FindObject("MPedestalSubtractedEvt"); 36 if (!fEvt) 37 { 38 gfLog << err << "MPedestalSubtractedEvt not found... aborting." << endl; 39 return kALSE; 40 } 79 80 //if (!fEvt) 81 //{ 82 // gfLog << err << "MPedestalSubtractedEvt not found... aborting." << endl; 83 // return kFALSE; 84 //} 41 85 42 86 // Create a canvas and plot the histogram into it 43 c = new TCanvas ;87 c = new TCanvas(); 44 88 hist.SetStats(kFALSE); 45 89 hist.Draw(); 46 47 TF1 constant("zero", "[0]", -0.25, 511.75); 90 hist.SetXTitle("Samples"); 91 hist.SetYTitle("Amplitude [a.u.]"); 92 93 //TF1 constant("zero", "[0]", -0.25, 511.75); 94 TF1 constant("zero", "[0]", -0.5, 1024); 48 95 constant.SetParameter(0, 0); 49 96 constant.SetLineColor(kBlack); … … 59 106 constant.DrawCopy("same"); 60 107 108 61 109 return kTRUE; 62 110 } … … 64 112 Int_t Process() 65 113 { 66 int pixel_index = 0; 114 int pixel_index = 6; //plot trace only of this pixel 115 int skipstart = 5; 116 int skipend = 10; 67 117 68 118 // Number of samples per pixel (usually 1024) … … 73 123 hist.Reset(); 74 124 for (int i=0; i<numsamples; i++) 75 hist.Fill(i *0.5, cal[i]); // Convert sample to nano-second125 hist.Fill(i, cal[i]); // 0.5ns = 1 sample 76 126 77 127 // Reset min/max range 78 hist.SetMinimum(); 79 hist.SetMaximum(); 80 81 // Set a reasonable range 82 if (hist.GetMinimum()>-50) 83 hist.SetMinimum(-50); 84 if (hist.GetMaximum()<250) 85 hist.SetMaximum(250); 128 hist.SetMinimum(-50); 129 hist.SetMaximum(50); 130 131 //// Set a reasonable range 132 //if (hist.GetMinimum()>-30) 133 // hist.SetMinimum(-20); 134 //if (hist.GetMaximum()<60) 135 // hist.SetMaximum(50); 136 137 138 139 TLine *line = new TLine(skipstart, 50, skipstart, -50); 140 line->SetLineStyle(kSolid); 141 line->SetLineColor(kRed); 142 line->Draw(); 143 144 TLine *line2 = new TLine(1024-skipend, 50, 1024-skipend, -50); 145 line2->SetLineStyle(kSolid); 146 line2->SetLineColor(kRed); 147 line2->Draw(); 86 148 87 149 // Signal root to update the canvas/pad 88 150 c->Modified(); 89 151 c->Update(); 152 //c->SaveAs("/home/giangdo/Documents/Master/MA/pulse/data_single_pe/traces/pixel3/event_0.png"); 153 90 154 91 155 bool rc = HandleInput(); … … 131 195 132 196 // mapping file (found in Mars/hawc) 133 const char *mmap = usemap ? " ../hawc/FAMOUSmap171218.txt" : NULL;197 const char *mmap = usemap ? "/home/giangdo/Documents/Master/MA/Software/Mars/hawc/HAWCsEyemap181214.txt" : NULL; 134 198 135 199 // ====================================================== … … 193 257 MEvtLoop loop(gSystem->BaseName(datafile)); 194 258 loop.SetParList(&plist); 195 196 if (!loop.Eventloop( ))259 260 if (!loop.Eventloop(100)) 197 261 return 4; 198 262
Note:
See TracChangeset
for help on using the changeset viewer.