Changeset 7492 for trunk/MagicSoft
- Timestamp:
- 02/10/06 11:56:40 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/plotdb.C
r7485 r7492 68 68 #include "MTime.h" 69 69 #include "MAstro.h" 70 #include "MDataSet.h" 70 71 #include "MSQLServer.h" 71 72 #include "MStatusDisplay.h" 73 74 // Replace this line 75 MDataSet ds; 76 // by 77 // MDataSet ds("/magic/datasets/00000/dataset00000003.txt"); 78 // to mark the sequences of your favourite dataset. 72 79 73 80 class MPlot : public MParContainer … … 95 102 TSQLRow *row; 96 103 97 TGraph g; 98 g.SetNameTitle(name, Form("%s vs Time", name.Data())); 99 g.SetMarkerStyle(kFullDotMedium); 100 101 TGraph g2; 102 g2.SetNameTitle(name, Form("%s vs <Zd>", name.Data())); 103 g2.SetMarkerStyle(kFullDotMedium); 104 TGraph gt; 105 gt.SetNameTitle(name, Form("%s vs Time", name.Data())); 106 gt.SetMarkerStyle(kFullDotMedium); 107 108 TGraph gz; 109 gz.SetNameTitle(name, Form("%s vs <Zd>", name.Data())); 110 gz.SetMarkerStyle(kFullDotMedium); 111 112 TGraph gt0, gt1; 113 gt0.SetMarkerColor(kRed); 114 gt1.SetMarkerColor(kBlue); 115 gt0.SetMarkerStyle(kFullDotLarge); 116 gt1.SetMarkerStyle(kFullDotLarge); 117 118 TGraph gz0, gz1; 119 gz0.SetMarkerColor(kRed); 120 gz1.SetMarkerColor(kBlue); 121 gz0.SetMarkerStyle(kFullDotLarge); 122 gz1.SetMarkerStyle(kFullDotLarge); 104 123 105 124 if (fmax>fmin) 106 125 { 107 g .SetMinimum(fmin);108 g .SetMaximum(fmax);109 g 2.SetMinimum(fmin);110 g 2.SetMaximum(fmax);126 gt.SetMinimum(fmin); 127 gt.SetMaximum(fmax); 128 gz.SetMinimum(fmin); 129 gz.SetMaximum(fmax); 111 130 } 112 131 … … 119 138 const char *zd = (*row)[1]; 120 139 const char *val = (*row)[2]; 121 if (!date || !val || !zd) 140 const char *snum = (*row)[3]; 141 if (!date || !val || !zd || !snum) 122 142 continue; 123 143 … … 133 153 last = TMath::Nint(TMath::Ceil(t.GetMjd())); 134 154 155 UInt_t seq = atoi(snum); 156 135 157 Float_t value = atof(val); 136 158 Float_t zenith = atof(zd); 137 g.SetPoint(g.GetN(), t.GetAxisTime(), value); 138 g2.SetPoint(g2.GetN(), zenith, value); 159 160 if (ds.HasOnSequence(seq)) 161 { 162 gt1.SetPoint(gt1.GetN(), t.GetAxisTime(), value); 163 gz1.SetPoint(gz1.GetN(), zenith, value); 164 } 165 166 if (ds.HasOffSequence(seq)) 167 { 168 gt0.SetPoint(gt0.GetN(), t.GetAxisTime(), value); 169 gz0.SetPoint(gz0.GetN(), zenith, value); 170 } 171 172 gt.SetPoint(gt.GetN(), t.GetAxisTime(), value); 173 gz.SetPoint(gz.GetN(), zenith, value); 139 174 } 140 175 … … 147 182 c.Divide(1,2); 148 183 184 if (gt0.GetN()>0 && gt1.GetN()>0) 185 { 186 cerr << setw(10) << title << ": "; 187 cerr << setw(9) << gt0.GetMean(2) << "+-" << setw(9) << gt0.GetRMS(2) << " "; 188 cerr << setw(9) << gt1.GetMean(2) << "+-" << setw(9) << gt1.GetRMS(2) << endl; 189 } 190 149 191 TVirtualPad *pad = gPad; 150 192 pad->cd(2); … … 157 199 gPad->SetBottomMargin(0.08); 158 200 159 TH1 *h = g .GetHistogram();201 TH1 *h = gt.GetHistogram(); 160 202 161 203 h->SetXTitle("Time"); … … 166 208 h->GetXaxis()->SetLabelOffset(0.01); 167 209 168 g.DrawClone("AP"); 210 gt.DrawClone("AP"); 211 if (gt0.GetN()>0) 212 gt0.DrawClone("P"); 213 if (gt1.GetN()>0) 214 gt1.DrawClone("P"); 169 215 170 216 TLine l; … … 195 241 const Double_t max = fHistMin>fHistMax ? h->GetMaximum()+resolution/2 : fHistMax; 196 242 243 // Use this to save the pad with the time development to a file 244 //gPad->SaveAs(Form("plotdb-%s.eps", title.Data())); 245 197 246 pad->cd(1); 198 247 gPad->SetBorderMode(0); … … 212 261 hist.SetDirectory(0); 213 262 214 for (int i=0; i<g .GetN(); i++)215 hist.Fill(g .GetY()[i]);263 for (int i=0; i<gt.GetN(); i++) 264 hist.Fill(gt.GetY()[i]); 216 265 217 266 if (fDescription.IsNull()) … … 226 275 gPad->SetGridy(); 227 276 228 TH1 *h2 = g 2.GetHistogram();277 TH1 *h2 = gz.GetHistogram(); 229 278 230 279 h2->SetXTitle("Zd"); 231 280 h2->SetYTitle(name); 232 281 233 g2.DrawClone("AP"); 282 gz.DrawClone("AP"); 283 if (gz0.GetN()>0) 284 gz0.DrawClone("P"); 285 if (gz1.GetN()>0) 286 gz1.DrawClone("P"); 234 287 } 235 288 … … 263 316 264 317 TString query; 265 query = Form("select %s, %s, %s ", valued.Data(), named2.Data(), valuev.Data());318 query = Form("select %s, %s, %s, Sequences.fSequenceFirst ", valued.Data(), named2.Data(), valuev.Data()); 266 319 query += Form("from %s left join %s ", tabled.Data(), tablev.Data()); 267 320 query += Form("on %s.%s=%s.%s ", tabled.Data(), join.Data(), tablev.Data(), join.Data()); -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r7413 r7492 53 53 } 54 54 55 Bool_t HasSequence(UInt_t num, const TArrayI &seq) const 56 { 57 for (int i=0; i<seq.GetSize(); i++) 58 if ((UInt_t)seq[i]==num) 59 return kTRUE; 60 return kFALSE; 61 } 62 55 63 public: 56 64 MDataSet(Int_t num=(UInt_t)-1) : fNumAnalysis(num) { } … … 89 97 90 98 Bool_t HasOffSequences() const { return GetNumSequencesOff()>0; } 99 100 Bool_t HasOffSequence(UInt_t num) const { return HasSequence(num, fNumSequencesOff); } 101 Bool_t HasOnSequence(UInt_t num) const { return HasSequence(num, fNumSequencesOn); } 102 Bool_t HasSequence(UInt_t num) const { return HasOnSequence(num) || HasOffSequence(num); } 91 103 92 104 UInt_t GetNumAnalysis() const { return fNumAnalysis; }
Note:
See TracChangeset
for help on using the changeset viewer.