Changeset 2190 for trunk/MagicSoft/Mars/macros/sumcurrents.C
- Timestamp:
- 06/18/03 09:29:45 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/sumcurrents.C
r2178 r2190 23 23 \* ======================================================================== */ 24 24 25 // ------------------------------------------------------------------------- 26 // 27 // plot.C 28 // 29 // This macro shows how to fill and display a histogram using Mars 30 // 31 void sumcurrents(const char *fname="../currents/spica_center.txt") 25 void ProcessFile(TString fname) 32 26 { 33 27 // … … 51 45 // (created with the star.C macro) 52 46 MReadCurrents read(fname); 53 /*54 read.AddFile("../currents/dcs_arcturus2.dat");55 read.AddFile("../currents/dcs_arcturus3.dat");56 read.AddFile("../currents/dcs_arcturus4.dat");57 read.AddFile("../currents/dcs_arcturus5.dat");58 read.AddFile("../currents/dcs_arcturus6.dat");59 read.AddFile("../currents/dcs_arcturus7.dat");60 read.AddFile("../currents/dcs_arcturus8.dat");61 read.AddFile("../currents/dcs_arcturus9.dat");62 read.AddFile("../currents/dcs_arcturus10.dat");63 */64 47 tlist.AddToList(&read); 65 48 … … 97 80 TArrayF &r = h.GetRms(); 98 81 TArrayF &v = h.GetSum(); 99 arr[i] = (r[i]==0 ? 0 : v[i]/r[i]);82 arr[i] = (r[i]==0 ? 0 : r[i]/v[i]); 100 83 } 101 84 disp3->Fill(arr); … … 124 107 c->cd(4); 125 108 gPad->SetBorderMode(0); 126 h.GetHist().DrawClone(); 109 h.GetHist().SetStats(kFALSE); 110 h.GetHist().DrawCopy(); 127 111 c->cd(5); 128 112 gPad->SetBorderMode(0); 113 gPad->SetLogy(); 129 114 TH1F h1("currents;rms", "Currents Rms", 577, -0.5, 576.5); 115 h1.SetXTitle("Pixel Index"); 116 h1.SetStats(kFALSE); 130 117 for (int i=1;i<=577; i++) 131 118 h1.SetBinContent(i, h.GetHist().GetBinError(i)); … … 133 120 c->cd(6); 134 121 gPad->SetBorderMode(0); 122 gPad->SetLogy(); 135 123 TH1F h2("currents;relerr", "Currents rel. Error [%]", 577, -0.5, 576.5); 124 h2.SetXTitle("Pixel Index"); 125 h2.SetStats(kFALSE); 136 126 for (int i=1;i<=577; i++) 137 { 138 Float_t val = h.GetHist().GetBinContent(i); 139 Float_t rms = h.GetHist().GetBinError(i); 140 h2.SetBinContent(i, rms==0?0:val/rms); 141 } 127 h2.SetBinContent(i, arr[i]*100); 142 128 h2.DrawCopy(); 143 129 144 c->SaveAs("spica_center-avg.ps"); 130 c->SaveAs(fname(0, fname.Last('.')+1) + "ps"); 131 c->SaveAs(fname(0, fname.Last('.')+1) + "root"); 145 132 } 133 134 // ------------------------------------------------------------------------- 135 // 136 // plot.C 137 // 138 // This macro shows how to fill and display a histogram using Mars 139 // 140 void sumcurrents(const char *dirname="/home/MAGIC/online_data/ccdata/") 141 { 142 MDirIter Next; 143 Next.AddDirectory(dirname, "dc_*.txt", -1); 144 145 TString fname; 146 while (1) 147 { 148 fname = Next(); 149 if (fname.IsNull()) 150 break; 151 152 ProcessFile(fname); 153 } 154 }
Note:
See TracChangeset
for help on using the changeset viewer.