Changeset 8927 for trunk/MagicSoft/Mars
- Timestamp:
- 06/06/08 18:02:07 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/datacenter/macros
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/datacenter/macros/fillcalib.C
r7528 r8927 19 19 ! Author(s): Daniela Dorner, 08/2004 <mailto:dorner@astro.uni-wuerzburg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 621 ! Copyright: MAGIC Software Development, 2000-2008 22 22 ! 23 23 ! … … 70 70 #include <TSQLRow.h> 71 71 72 #include "MSQL Server.h"72 #include "MSQLMagic.h" 73 73 74 74 #include "MStatusArray.h" … … 79 79 using namespace std; 80 80 81 // -------------------------------------------------------------------------- 82 // 83 // Checks whether an entry is already existing 84 // 85 Bool_t ExistStr(MSQLServer &serv, const char *column, const char *table, Int_t test) 86 { 87 TString query(Form("SELECT %s FROM %s WHERE %s='%d'", column, table, column, test)); 88 TSQLResult *res = serv.Query(query); 89 if (!res) 90 return kFALSE; 91 92 TSQLRow *row; 93 94 Bool_t rc = kFALSE; 95 while ((row=res->Next())) 96 { 97 if ((*row)[0]) 98 { 99 rc = kTRUE; 100 break; 101 } 102 } 103 104 delete res; 105 106 return rc; 107 } 108 109 int Process(MSQLServer &serv, TString fname, Bool_t dummy) 81 int Process(MSQLMagic &serv, TString fname) 110 82 { 111 83 //getting number of unsuitable, unreliable and isolated pixel … … 222 194 TString meanconvouter=Form("%6.3f", meanconvo); 223 195 224 225 196 //Getting sequ# from filename 226 197 TString sequence = fname(TRegexp("calib[0-9]+[.]root$")); … … 233 204 Int_t seq = atoi(sequence.Data()+5); 234 205 206 //getting the ratio of calibration events used 207 h = (TH1*)arr.FindObjectInCanvas("ArrTm;avg", "MHCamera", "ArrTm"); 208 if (!h) 209 { 210 cout << "WARNING - Could not find histogram ArrTime;avg." << endl; 211 return 2; 212 } 213 214 UInt_t nevts = h->GetEntries(); 215 216 TString query; 217 query = Form("SELECT SUM(fNumEvents) FROM RunData " 218 "LEFT JOIN RunType ON RunType.fRunTypeKEY=RunData.fRunTypeKEY " 219 "WHERE fSequenceFirst=%d AND RunType.fRunTypeName='Calibration'", 220 seq); 221 222 TSQLResult *res = serv.Query(query); 223 if (!res) 224 { 225 cout << "ERROR - Query failed: " << query << endl; 226 return 2; 227 } 228 229 TSQLRow *row = res->Next(); 230 if (!row) 231 { 232 cout << "ERROR - Query failed: " << query << endl; 233 return 2; 234 } 235 236 Float_t ratiocalib = 100.*nevts/atof((*row)[0]); 237 238 TString ratiocal = Form("%.1f", ratiocalib); 239 240 delete res; 235 241 236 242 cout << "Sequence #" << seq << endl; … … 243 249 cout << " Mean Conv inner: " << meanconvinner << endl; 244 250 cout << " Mean Conv outer: " << meanconvouter << endl; 251 cout << " Ratio Calib Evts: " << ratiocal << endl; 245 252 246 253 //inserting or updating the information in the database 247 TString query; 248 if (!ExistStr(serv, "fSequenceFirst", "Calibration", seq)) 249 { 250 query = Form("INSERT Calibration SET" 251 " fSequenceFirst=%d," 252 " fUnsuitableInner=%d, " 253 " fUnsuitableOuter=%d, " 254 " fUnreliableInner=%d, " 255 " fUnreliableOuter=%d, " 256 " fIsolatedInner=%d, " 257 " fIsolatedOuter=%d, " 258 " fIsolatedMaxCluster=%d, " 259 " fArrTimeMeanInner=%s, " 260 " fArrTimeRmsInner=%s, " 261 " fArrTimeMeanOuter=%s, " 262 " fArrTimeRmsOuter=%s, " 263 " fConvFactorInner=%s, " 264 " fConvFactorOuter=%s ", 265 seq, (int)unsin, (int)unsout, (int)unrin, 266 (int)unrout, (int)isoin, (int)isoout, 267 (int)clumax, 268 meaninner.Data(), rmsinner.Data(), 269 meanouter.Data(), rmsouter.Data(), 270 meanconvinner.Data(), meanconvouter.Data()); 271 } 272 else 273 { 274 query = Form("UPDATE Calibration SET" 275 " fUnsuitableInner=%d, " 276 " fUnsuitableOuter=%d, " 277 " fUnreliableInner=%d, " 278 " fUnreliableOuter=%d, " 279 " fIsolatedInner=%d, " 280 " fIsolatedOuter=%d, " 281 " fIsolatedMaxCluster=%d, " 282 " fArrTimeMeanInner=%s, " 283 " fArrTimeRmsInner=%s, " 284 " fArrTimeMeanOuter=%s, " 285 " fArrTimeRmsOuter=%s, " 286 " fConvFactorInner=%s, " 287 " fConvFactorOuter=%s " 288 " WHERE fSequenceFirst=%d ", 289 (int)unsin, (int)unsout, (int)unrin,(int)unrout, 290 (int)isoin, (int)isoout, (int)clumax, 291 meaninner.Data(), rmsinner.Data(), 292 meanouter.Data(), rmsouter.Data(), 293 meanconvinner.Data(), meanconvouter.Data(), 294 seq); 295 } 296 297 if (dummy) 298 return 1; 299 300 TSQLResult *res = serv.Query(query); 301 if (!res) 302 { 303 cout << "ERROR - Query failed: " << query << endl; 304 return 2; 305 } 306 delete res; 307 308 return 1; 254 TString vars = 255 Form(" fSequenceFirst=%d," 256 " fUnsuitableInner=%d, " 257 " fUnsuitableOuter=%d, " 258 " fUnreliableInner=%d, " 259 " fUnreliableOuter=%d, " 260 " fIsolatedInner=%d, " 261 " fIsolatedOuter=%d, " 262 " fIsolatedMaxCluster=%d, " 263 " fArrTimeMeanInner=%s, " 264 " fArrTimeRmsInner=%s, " 265 " fArrTimeMeanOuter=%s, " 266 " fArrTimeRmsOuter=%s, " 267 " fConvFactorInner=%s, " 268 " fConvFactorOuter=%s, " 269 " fRatioCalEvents=%s ", 270 seq, (int)unsin, (int)unsout, (int)unrin, 271 (int)unrout, (int)isoin, (int)isoout, (int)clumax, 272 meaninner.Data(), rmsinner.Data(), 273 meanouter.Data(), rmsouter.Data(), 274 meanconvinner.Data(), meanconvouter.Data(), 275 ratiocal.Data()); 276 277 return serv.InsertUpdate("Calibration", "fSequenceFirst", 278 Form("%d", seq), vars.Data()) ? 1 : 2; 309 279 } 310 280 … … 313 283 TEnv env("sql.rc"); 314 284 315 MSQL Serverserv(env);285 MSQLMagic serv(env); 316 286 if (!serv.IsConnected()) 317 287 { … … 327 297 cout << endl; 328 298 329 return Process(serv, fname, dummy); 299 serv.SetIsDummy(dummy); 300 301 return Process(serv, fname); 330 302 } -
trunk/MagicSoft/Mars/datacenter/macros/fillsignal.C
r8489 r8927 19 19 ! Author(s): Daniela Dorner, 04/2005 <mailto:dorner@astro.uni-wuerzburg.de> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 621 ! Copyright: MAGIC Software Development, 2000-2008 22 22 ! 23 23 ! … … 66 66 #include <TSQLResult.h> 67 67 68 #include "MSQL Server.h"68 #include "MSQLMagic.h" 69 69 70 70 #include "MStatusArray.h" … … 77 77 using namespace std; 78 78 79 int Process(MSQL Server &serv, TString fname, Bool_t dummy)79 int Process(MSQLMagic &serv, TString fname) 80 80 { 81 81 TFile file(fname, "READ"); … … 331 331 // the macro fillcalib.C in the script fillcallisto 332 332 // and so the table Calibration is always updated 333 TString query = Form("UPDATE Calibration SET " 334 " fMeanPedRmsInner=%s, fMeanPedRmsOuter=%s, " 335 " fMeanSignalInner=%s, fMeanSignalOuter=%s, " 336 " fPulsePosMean=%s, fPulsePosRms=%s, " 337 " fPulsePosCheckMean=%s, fPulsePosCheckRms=%s, " 338 //" fPulsePosHiMean=%s, fPulsePosHiRms=%s, " 339 //" fPulsePosLoMean=%s, fPulsePosLoRms=%s, " 340 " fPulsePosOffMed=%s, fPulsePosOffDev=%s, " 341 " fHiLoGainRatioMed=%s, fHiLoGainRatioDev=%s, " 342 " fUnsuitable50=%d, fUnsuitable01=%d, " 343 " fUnsuitableMax=%s, fDeadMax=%s " 344 " WHERE fSequenceFirst='%d' ", 333 TString vars = Form(" fMeanPedRmsInner=%s, fMeanPedRmsOuter=%s, " 334 " fMeanSignalInner=%s, fMeanSignalOuter=%s, " 335 " fPulsePosMean=%s, fPulsePosRms=%s, " 336 " fPulsePosCheckMean=%s, fPulsePosCheckRms=%s, " 337 //" fPulsePosHiMean=%s, fPulsePosHiRms=%s, " 338 //" fPulsePosLoMean=%s, fPulsePosLoRms=%s, " 339 " fPulsePosOffMed=%s, fPulsePosOffDev=%s, " 340 " fHiLoGainRatioMed=%s, fHiLoGainRatioDev=%s, " 341 " fUnsuitable50=%d, fUnsuitable01=%d, " 342 " fUnsuitableMax=%s, fDeadMax=%s " 345 343 meanrmsinner.Data(), meanrmsouter.Data(), 346 344 meansiginner.Data(), meansigouter.Data(), … … 349 347 //meanpulhi.Data(), rmspulhi.Data(), 350 348 //meanpullo.Data(), rmspullo.Data(), 351 medpuloff.Data(), devpuloff.Data(), 352 medhilocal.Data(), devhilocal.Data(), 353 unsuitable50, unsuitable01, 354 unsuitablemax.Data(), deadmax.Data(), 355 seq); 356 357 if (dummy) 358 return 1; 359 360 TSQLResult *res = serv.Query(query); 361 if (!res) 362 { 363 cout << "ERROR - Query failed: " << query << endl; 364 return 2; 365 } 366 delete res; 367 return 1; 349 medpuloff.Data(), devpuloff.Data(), 350 medhilocal.Data(), devhilocal.Data(), 351 unsuitable50, unsuitable01, 352 unsuitablemax.Data(), deadmax.Data()); 353 354 return serv.Update("Calibration", vars, Form("fSequenceFirst=%d", seq), vars); 368 355 } 369 356 … … 372 359 TEnv env("sql.rc"); 373 360 374 MSQL Serverserv(env);361 MSQLMagic serv(env); 375 362 if (!serv.IsConnected()) 376 363 { … … 386 373 cout << endl; 387 374 375 serv.SetIsDummy(dummy); 376 388 377 //process file 389 return Process(serv, fname , dummy);378 return Process(serv, fname); 390 379 } -
trunk/MagicSoft/Mars/datacenter/macros/fillstar.C
r8925 r8927 70 70 #include <TSQLRow.h> 71 71 72 #include "MSQL Server.h"72 #include "MSQLMagic.h" 73 73 74 74 #include "MHCamera.h" … … 80 80 using namespace std; 81 81 82 // -------------------------------------------------------------------------- 83 // 84 // Checks whether an entry is already existing 85 // 86 Bool_t ExistStr(MSQLServer &serv, const char *column, const char *table, Int_t test) 87 { 88 TString query(Form("SELECT %s FROM %s WHERE %s='%d'", column, table, column, test)); 89 TSQLResult *res = serv.Query(query); 90 if (!res) 91 return kFALSE; 92 93 TSQLRow *row; 94 95 Bool_t rc = kFALSE; 96 while ((row=res->Next())) 97 { 98 if ((*row)[0]) 99 { 100 rc = kTRUE; 101 break; 102 } 103 } 104 105 delete res; 106 107 return rc; 108 } 109 110 111 int Process(MSQLServer &serv, TString fname, Bool_t dummy) 82 int Process(MSQLMagic &serv, TString fname) 112 83 { 113 84 TFile file(fname, "READ"); … … 310 281 cout << " Skybrightness " << skybrightnessmed << " +/- " << skybrightnessrms << endl; 311 282 312 TString query; 313 if (!ExistStr(serv, "fSequenceFirst", "Star", seq)) 314 { 315 query = Form("INSERT Star SET" 316 " fSequenceFirst=%d," 317 " fMeanNumberIslands=%s, " 318 " fRatio=%s, " 319 " fMuonNumber=%d, " 320 " fEffOnTime=%d, " 321 " fMuonRate=%s, " 322 " fPSF=%s, " 323 " fDataRate=%d, " 324 " fSparkRate=%s, " 325 " fMaxHumidity=%s ," 326 " fAvgTemperature=%s ," 327 " fAvgWindSpeed=%s ," 328 " fNumStarsMed=%s ," 329 " fNumStarsRMS=%s ," 330 " fNumStarsCorMed=%s ," 331 " fNumStarsCorRMS=%s ," 332 " fBrightnessMed=%s ," 333 " fBrightnessRMS=%s ," 334 " fInhomogeneity=%s ", 335 seq, islands.Data(), ratio.Data(), 336 num, effontime, 337 muonrate.Data(), PSF.Data(), 338 datarate, sparkrate.Data(), maxhum.Data(), 339 avgtemp.Data(), avgwind.Data(), 340 numstarsmed.Data(), numstarsrms.Data(), 341 numcorsmed.Data(), numcorsrms.Data(), 342 skybrightnessmed.Data(), skybrightnessrms.Data(), 343 inhomogen.Data()); 344 } 345 else 346 { 347 query = Form("UPDATE Star SET" 348 " fMeanNumberIslands=%s, " 349 " fRatio=%s, " 350 " fMuonNumber=%d, " 351 " fEffOnTime=%d, " 352 " fMuonRate=%s, " 353 " fPSF=%s, " 354 " fDataRate=%d, " 355 " fSparkRate=%s, " 356 " fMaxHumidity=%s, " 357 " fNumStarsMed=%s ," 358 " fNumStarsRMS=%s ," 359 " fNumStarsCorMed=%s ," 360 " fNumStarsCorRMS=%s ," 361 " fBrightnessMed=%s ," 362 " fBrightnessRMS=%s ," 363 " fInhomogeneity=%s " 364 " WHERE fSequenceFirst=%d ", 365 islands.Data(), ratio.Data(), 366 num, effontime, 367 muonrate.Data(), PSF.Data(), 368 datarate, sparkrate.Data(), maxhum.Data(), 369 numstarsmed.Data(), numstarsrms.Data(), 370 numcorsmed.Data(), numcorsrms.Data(), 371 skybrightnessmed.Data(), skybrightnessrms.Data(), 372 inhomogen.Data(), seq); 373 } 374 375 // cout << "Q: " << query << endl; 376 377 if (dummy) 378 return 1; 379 380 TSQLResult *res = serv.Query(query); 381 if (!res) 382 { 383 cout << "ERROR - Query failed: " << query << endl; 384 return 2; 385 } 386 delete res; 387 388 return 1; 283 TString vars = Form(" fMeanNumberIslands=%s," 284 " fRatio=%s," 285 " fMuonNumber=%d," 286 " fEffOnTime=%d," 287 " fMuonRate=%s," 288 " fPSF=%s," 289 " fDataRate=%d," 290 " fSparkRate=%s," 291 " fMaxHumidity=%s," 292 " fAvgTemperature=%s," 293 " fAvgWindSpeed=%s," 294 " fNumStarsMed=%s," 295 " fNumStarsRMS=%s," 296 " fNumStarsCorMed=%s," 297 " fNumStarsCorRMS=%s," 298 " fBrightnessMed=%s," 299 " fBrightnessRMS=%s," 300 " fInhomogeneity=%s ", 301 islands.Data(), ratio.Data(), 302 num, effontime, 303 muonrate.Data(), PSF.Data(), 304 datarate, sparkrate.Data(), maxhum.Data(), 305 avgtemp.Data(), avgwind.Data(), 306 numstarsmed.Data(), numstarsrms.Data(), 307 numcorsmed.Data(), numcorsrms.Data(), 308 skybrightnessmed.Data(), skybrightnessrms.Data(), 309 inhomogen.Data()); 310 311 return serv.InsertUpdate("Star", "fSequenceFirst", Form("%d", seq), vars); 389 312 } 390 313 … … 393 316 TEnv env("sql.rc"); 394 317 395 MSQL Serverserv(env);318 MSQLMagic serv(env); 396 319 if (!serv.IsConnected()) 397 320 { … … 401 324 402 325 cout << "fillstar" << endl; 403 cout << "-------- -" << endl;326 cout << "--------" << endl; 404 327 cout << endl; 405 328 cout << "Connected to " << serv.GetName() << endl; … … 407 330 cout << endl; 408 331 409 return Process(serv, fname, dummy); 332 serv.SetIsDummy(dummy); 333 334 return Process(serv, fname); 410 335 } -
trunk/MagicSoft/Mars/datacenter/macros/plotstat.C
r8207 r8927 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1. 4 2006-11-02 17:44:08tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: plotstat.C,v 1.5 2008-06-06 17:02:07 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 21 21 ! Author(s): Daniela Dorner, 02/2006 <mailto:dorner@astro.uni-wuerzburg.de> 22 22 ! 23 ! Copyright: MAGIC Software Development, 2000-200 623 ! Copyright: MAGIC Software Development, 2000-2008 24 24 ! 25 25 ! … … 47 47 #include <iomanip> 48 48 49 #include <TH 1.h>49 #include <TH2.h> 50 50 #include <TEnv.h> 51 51 #include <TPad.h> … … 67 67 using namespace std; 68 68 69 TString GetFullQuery(TString query, TString from="", TString to="") 70 { 71 if (from.IsNull()) 72 return query; 73 74 if (!query.Contains("where", TString::kIgnoreCase)) 75 query += " where "; 76 else 77 query += " and "; 78 79 query += " fRunStart>'"; 80 query += from; 81 query += "' and fRunStart<'"; 82 query += to; 83 query += "'"; 84 85 return query; 86 } 87 69 88 Double_t GetTime(MSQLServer &serv, TString query, TString from="", TString to="") 70 89 { 71 if (!from.IsNull()) 72 { 73 if (!query.Contains("where", TString::kIgnoreCase)) 74 query += " where "; 75 else 76 query += " and "; 77 78 query += " fRunStart>'"; 79 query += from; 80 query += "' and fRunStart<'"; 81 query += to; 82 query += "'"; 83 } 90 query = GetFullQuery(query, from, to); 84 91 85 92 TSQLResult *res = serv.Query(query); … … 100 107 const char *time = (*row)[0]; 101 108 109 const Double_t rc = time ? atof(time) : 0; 110 102 111 delete res; 103 return time ? atof(time) : 0; 112 return rc<0 || rc>200 ? 0 : rc; 113 } 114 115 TArrayD GetObsDist(MSQLServer &serv, TString from="", TString to="") 116 { 117 // 8: Sequenced RunTime per source and night 118 //query[8] = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600, "; 119 //query[8] += "DATE_FORMAT(ADDDATE(fRunStart,Interval 12 hour), '%Y-%m-%d') as Start,"; 120 //query[8] += "from RunData where fRunTypeKEY=2 and fExcludedFDAKEY=1 group by Start, fSourceKEY"; 121 122 TString query; 123 124 query = "SELECT SUM(fRunTime)/3600, "; 125 query += "DATE_FORMAT(ADDDATE(fRunStart, INTERVAL 12 hour), '%Y-%m-%d') AS Start "; 126 query += "FROM Sequences "; 127 128 query = GetFullQuery(query, from, to); 129 query += " GROUP BY Start, fSourceKEY"; 130 131 132 TSQLResult *res = serv.Query(query); 133 if (!res) 134 { 135 cout << "ERROR - Query failed: " << query << endl; 136 return -1; 137 } 138 139 TSQLRow *row = 0; 140 141 TArrayD arr; 142 143 while ((row=res->Next())) 144 { 145 const char *time = (*row)[0]; 146 147 const Double_t rc = time ? atof(time) : 0; 148 149 if (rc>0 && rc<200) 150 { 151 arr.Set(arr.GetSize()+1); 152 arr[arr.GetSize()-1] = rc; 153 } 154 } 155 156 delete res; 157 158 return arr; 104 159 } 105 160 … … 265 320 266 321 // 0: All data for which are files available 267 query[0] = "select "; 268 query[0] += "SUM(if(TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)<0, "; 269 query[0] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)+24*60*60, "; 270 query[0] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)))/3600 "; 322 query[0] = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop, fRunStart)))/3600 "; 271 323 query[0] += "from RunData left join RunProcessStatus on RunData.fRunNumber=RunProcessStatus.fRunNumber "; 272 324 query[0] += "where fRunTypeKey=2 and "; … … 274 326 275 327 // 1: All data 276 query[1] = "select "; 277 query[1] += "SUM(if(TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)<0, "; 278 query[1] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)+24*60*60, "; 279 query[1] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)))/3600 "; 328 query[1] = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 "; 280 329 query[1] += "from RunData where fRunTypeKEY=2"; 281 330 282 331 // 2: All data which is not excluded 283 query[2] = "select "; 284 query[2] += "SUM(if(TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)<0, "; 285 query[2] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)+24*60*60, "; 286 query[2] += "TIME_TO_SEC(fRunStop)-TIME_TO_SEC(fRunStart)))/3600 "; 332 query[2] = "select SUM(TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart)))/3600 "; 287 333 query[2] += "from RunData where fRunTypeKEY=2 and fExcludedFDAKEY=1"; 288 334 … … 327 373 328 374 TH1F h[8]; 329 330 MBinning bins(last-first+1, first-0.5, last+0.5); 375 TH2F h8; 376 377 MBinning binsp(last-first+1, first-0.5, last+0.5); 378 MBinning binst(4*7, 0, 7); 331 379 for (int i=0; i<8; i++) 332 380 { 333 bins .Apply(h[i]);381 binsp.Apply(h[i]); 334 382 h[i].SetName(Form("H%d", i)); 335 383 h[i].SetDirectory(0); 336 384 } 385 386 MH::SetBinning(&h8, &binsp, &binst); 387 h8.SetNameTitle("ObsTime", "Distribution of observation time per exposure"); 388 h8.SetXTitle("Obs. time per exposure [h]"); 389 h8.SetYTitle("Counts"); 390 h8.SetDirectory(0); 337 391 338 392 Int_t period = 0; … … 352 406 for (int i=0; i<8; i++) 353 407 h[i].Fill(period-1, GetTime(serv, query[i], a, b)); 408 409 TArrayD arr(GetObsDist(serv, a, b)); 410 411 for (int i=0; i<arr.GetSize(); i++) 412 h8.Fill(period-1, arr[i]); 354 413 } 355 414 … … 369 428 h[4].Add(&h[5]); 370 429 h[6].Add(&h[7]); 430 431 // -------------------------------------------- 432 433 TCanvas &c0 = d.AddTab("ObsDist"); 434 c0.SetFillColor(kWhite); 435 436 gPad->SetBorderMode(0); 437 gPad->SetFrameBorderMode(0); 438 gPad->SetFillColor(kWhite); 439 gPad->SetRightMargin(0.01); 440 //gPad->SetTopMargin(0.02); 441 //gPad->SetLeftMargin(0.09); 442 //gPad->SetBottomMargin(0.12); 443 gPad->SetGridx(); 444 gPad->SetGridy(); 445 gPad->SetLogy(); 446 447 TH1 * p = h8.ProjectionY(); 448 449 p->SetDirectory(0); 450 p->SetBit(kCanDelete); 451 p->Draw(); 452 453 // -------------------------------------------- 371 454 372 455 TCanvas &c1 = d.AddTab("Hist"); … … 441 524 DrawCake(h); 442 525 526 // -------------------------------------------- 527 443 528 TCanvas &cx = d.AddTab("All"); 444 529 cx.SetBorderMode(0); … … 451 536 for (int i=0; i<h[0].GetNbinsX(); i++) 452 537 { 453 TCanvas &c = d.AddTab(Form("P%d", TMath::Nint(h[0].GetBinCenter(i+1)))); 454 538 const Int_t num = TMath::Nint(h[0].GetBinCenter(i+1)); 539 540 TCanvas &c = d.AddTab(Form("P%d", num)); 455 541 c.SetBorderMode(0); 456 542 c.SetFrameBorderMode(0); 457 c.SetPad(0.25, 0, 0.75, 1.0);458 543 c.SetFillColor(kWhite); 544 545 c.cd(); 546 547 TPad *pad1 = new TPad(Form("Pad%da", num), "", 0.05, 0, 0.55, 1); 548 pad1->SetBorderMode(0); 549 pad1->SetFrameBorderMode(0); 550 pad1->SetFillColor(kWhite); 551 pad1->SetBit(kCanDelete); 552 pad1->Draw(); 553 pad1->cd(); 459 554 460 555 DrawCake(h, i+1, i+1); … … 465 560 DrawCake(h, i+1, i+1); 466 561 } 562 563 c.cd(); 564 565 TPad *pad2 = new TPad(Form("Pad%db", num), "", 0.6, 0.02, 1, 0.48); 566 pad2->SetBorderMode(0); 567 pad2->SetFrameBorderMode(0); 568 pad2->SetFillColor(kWhite); 569 pad2->SetBit(kCanDelete); 570 pad2->SetGridx(); 571 pad2->SetGridy(); 572 pad2->SetRightMargin(0.01); 573 pad2->Draw(); 574 pad2->cd(); 575 576 TH1 * p = h8.ProjectionY(Form("Obs%d", num), i+1, i+1); 577 578 p->Rebin(2); 579 p->SetBit(TH1::kNoStats); 580 p->SetTitle(""); 581 p->SetXTitle("Obs. time per exposure [h]"); 582 p->SetYTitle("Counts"); 583 p->SetDirectory(0); 584 p->SetBit(kCanDelete); 585 p->Draw(); 586 587 /* 588 c.cd(); 589 590 TPaveText *pave = new TPaveText(0.6, 0.52, 0.98, 0.98); 591 pave->SetBorderSize(1); 592 pave->AddText(Form("Period: %d", num))->SetTextAlign(22); 593 pave->AddSeperator(); 594 pave->AddText(Form("Start: %s", num)); 595 pave->AddText(Form("End: %s", num)); 596 pave->SetBit(kCanDelete); 597 pave->Draw(); 598 */ 467 599 } 468 600
Note:
See TracChangeset
for help on using the changeset viewer.