Changeset 4906
- Timestamp:
- 09/09/04 17:51:57 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4905 r4906 116 116 * mfileio/MReadRflFile.[h,cc]: 117 117 - added missing abstract functions 118 119 * star.cc, callisto.cc, mjobs/MJStar.[h,cc], 120 mjobs/MJCalibrateSignal.[h,cc]: 121 - added option to process monte carlo files 118 122 119 123 -
trunk/MagicSoft/Mars/callisto.cc
r4887 r4906 50 50 gLog << " -c Calculate the calibration constants" << endl; 51 51 gLog << " -y Extract and calibrate signal" << endl << endl; 52 gLog << " Input File Options:" << endl; 53 gLog << " -mc You must use this for MC files (PRELIMINARY)" << endl << endl; 52 54 gLog << " Options:" << endl; 53 55 gLog.Usage(); … … 121 123 const Bool_t kOverwrite = arg.HasOnlyAndRemove("-f"); 122 124 const Bool_t kForceExec = arg.HasOnlyAndRemove("-ff"); 125 const Bool_t kIsMC = arg.HasOnlyAndRemove("-mc"); 123 126 124 127 const TString kInpathD = arg.GetStringAndRemove("--ind=", ""); … … 374 377 375 378 // Where to search for calibration files 376 if (!job2.ProcessFile(job1.GetPedestalCam() ))379 if (!job2.ProcessFile(job1.GetPedestalCam(), kIsMC)) 377 380 return -1; 378 381 -
trunk/MagicSoft/Mars/mhist/MHEffectiveOnTime.cc
r4889 r4906 63 63 // 64 64 MHEffectiveOnTime::MHEffectiveOnTime(const char *name, const char *title) 65 : fPointPos(0), fTime(0), fParam(0), fIsFinalized(kFALSE), fInterval(60) 65 : fPointPos(0), fTime(0), fParam(0), fIsFinalized(kFALSE), fInterval(60), 66 fNameProjDeltaT(Form("DeltaT_%p", this)), fNameProjTheta(Form("Theta_%p", this)) 66 67 { 67 68 // … … 72 73 73 74 // Main histogram 74 fHTimeDiff.SetXTitle("\\Delta t [s]"); 75 fHTimeDiff.SetYTitle("\\Theta [\\circ]"); 76 fHTimeDiff.UseCurrentStyle(); 77 fHTimeDiff.SetDirectory(NULL); 75 fHDeltaT.SetName("DeltaT"); 76 fHDeltaT.SetXTitle("\\Delta t [s]"); 77 fHDeltaT.SetYTitle("\\Theta [\\circ]"); 78 fHDeltaT.UseCurrentStyle(); 79 fHDeltaT.SetDirectory(NULL); 78 80 79 81 // effective on time versus theta 80 fHEffOn .SetName("EffOnTime");81 fHEffOn .SetTitle("Effective On Time T_{eff}");82 fHEffOn .SetXTitle("\\Theta [\\circ]");83 fHEffOn .SetYTitle("T_{eff} [s]");84 fHEffOn .UseCurrentStyle();85 fHEffOn .SetDirectory(NULL);86 fHEffOn .GetYaxis()->SetTitleOffset(1.2);82 fHEffOnTheta.SetName("EffOnTime"); 83 fHEffOnTheta.SetTitle("Effective On Time T_{eff}"); 84 fHEffOnTheta.SetXTitle("\\Theta [\\circ]"); 85 fHEffOnTheta.SetYTitle("T_{eff} [s]"); 86 fHEffOnTheta.UseCurrentStyle(); 87 fHEffOnTheta.SetDirectory(NULL); 88 fHEffOnTheta.GetYaxis()->SetTitleOffset(1.2); 87 89 //fHEffOn.Sumw2(); 90 91 // effective on time versus time 92 fHEffOnTime.SetName("EffOnTime"); 93 fHEffOnTime.SetTitle("Effective On Time T_{eff}"); 94 fHEffOnTime.SetXTitle("Time"); 95 fHEffOnTime.SetYTitle("T_{eff} [s]"); 96 fHEffOnTime.UseCurrentStyle(); 97 fHEffOnTime.SetDirectory(NULL); 98 fHEffOnTime.GetYaxis()->SetTitleOffset(1.2); 99 fHEffOnTime.GetXaxis()->SetLabelSize(0.033); 100 fHEffOnTime.GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00 GMT"); 101 fHEffOnTime.GetXaxis()->SetTimeDisplay(1); 102 fHEffOnTime.Sumw2(); 88 103 89 104 // chi2/NDF versus theta … … 128 143 // setup binning 129 144 MBinning btheta("BinningTheta"); 130 btheta.SetEdgesCos( 51, 0, 60);131 132 MBinning btime("Binning TimeDiff");145 btheta.SetEdgesCos(101, 0, 60); 146 147 MBinning btime("BinningDeltaT"); 133 148 btime.SetEdges(50, 0, 0.1); 134 149 135 MH::SetBinning(&fH TimeDiff, &btime, &btheta);136 137 btheta.Apply(fHEffOn );150 MH::SetBinning(&fHDeltaT, &btime, &btheta); 151 152 btheta.Apply(fHEffOnTheta); 138 153 btheta.Apply(fHChi2); 139 154 btheta.Apply(fHLambda); … … 141 156 btheta.Apply(fHProb); 142 157 } 143 144 // FIXME: Just for a preliminary check145 static Double_t testval = 0;146 static Double_t testerr = 0;147 158 148 159 // -------------------------------------------------------------------------- … … 167 178 return kFALSE; 168 179 169 const MBinning* binsdtime = (MBinning*)plist->FindObject("Binning TimeDiff");180 const MBinning* binsdtime = (MBinning*)plist->FindObject("BinningDeltaT"); 170 181 const MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta"); 171 182 if (!binstheta || !binsdtime) … … 173 184 else 174 185 { 175 SetBinning(&fH TimeDiff, binsdtime, binstheta);176 177 binstheta->Apply(fHEffOn );186 SetBinning(&fHDeltaT, binsdtime, binstheta); 187 188 binstheta->Apply(fHEffOnTheta); 178 189 binstheta->Apply(fHChi2); 179 190 binstheta->Apply(fHLambda); … … 200 211 201 212 // nbins = number of Theta bins 202 const Int_t nbins = fH TimeDiff.GetNbinsY();213 const Int_t nbins = fHDeltaT.GetNbinsY(); 203 214 204 215 TH1D *h=0; … … 206 217 { 207 218 // TH1D &h = *hist->ProjectionX("Calc-theta", i, i); 208 h = fH TimeDiff.ProjectionX(name, i, i, "E");219 h = fHDeltaT.ProjectionX(name, i, i, "E"); 209 220 210 221 Double_t res[7]; … … 213 224 214 225 // the effective on time is Nm/lambda 215 fHEffOn .SetBinContent(i, res[0]);216 fHEffOn .SetBinError (i, res[1]);226 fHEffOnTheta.SetBinContent(i, res[0]); 227 fHEffOnTheta.SetBinError (i, res[1]); 217 228 218 229 // plot chi2-probability of fit … … 346 357 TH1D *h0=0; 347 358 348 padsave-> cd(1);349 if ((h0 = (TH1D*)gPad->FindObject( "TimeDiff")))359 padsave->GetPad(1)->cd(1); 360 if ((h0 = (TH1D*)gPad->FindObject(fNameProjDeltaT))) 350 361 { 351 h0 = fH TimeDiff.ProjectionX("TimeDiff", -1, 9999, "E");362 h0 = fHDeltaT.ProjectionX(fNameProjDeltaT, -1, 9999, "E"); 352 363 if (h0->GetEntries()>0) 353 364 gPad->SetLogy(); 354 365 } 355 366 356 padsave-> cd(2);357 if ((h0 = (TH1D*)gPad->FindObject( "Theta")))358 fH TimeDiff.ProjectionY("Theta", -1, 9999, "E");367 padsave->GetPad(2)->cd(1); 368 if ((h0 = (TH1D*)gPad->FindObject(fNameProjTheta))) 369 fHDeltaT.ProjectionY(fNameProjTheta, -1, 9999, "E"); 359 370 360 371 if (!fIsFinalized) 361 372 FitThetaBins(); 362 373 } 363 if (o==(TString)"paint") 374 375 TH1D *h=0; 376 if (o==(TString)"theta") 377 h = &fHEffOnTheta; 378 if (o==(TString)"time") 379 h = &fHEffOnTime; 380 381 if (h) 364 382 { 365 383 Double_t error = 0; 366 for (int i=0; i< fHEffOn.GetXaxis()->GetNbins(); i++)367 error += fHEffOn.GetBinError(i);368 369 TLatex text(0.45, 0.94, Form("T_{eff} = %.1fs \\pm %.1fs", fHEffOn.Integral(), error));384 for (int i=0; i<h->GetXaxis()->GetNbins(); i++) 385 error += h->GetBinError(i); 386 387 TLatex text(0.45, 0.94, Form("T_{eff} = %.1fs \\pm %.1fs", h->Integral(), error)); 370 388 text.SetBit(TLatex::kTextNDC); 371 389 text.SetTextSize(0.04); … … 386 404 AppendPad("fit"); 387 405 388 pad->Divide(2, 2);406 pad->Divide(2, 1, 0, 0); 389 407 390 408 TH1 *h; … … 392 410 pad->cd(1); 393 411 gPad->SetBorderMode(0); 394 h = fHTimeDiff.ProjectionX("TimeDiff", -1, 9999, "E"); 412 gPad->Divide(1, 2, 0, 0); 413 pad->GetPad(1)->cd(1); 414 gPad->SetBorderMode(0); 415 h = fHDeltaT.ProjectionX(fNameProjDeltaT, -1, 9999, "E"); 395 416 h->SetTitle("Distribution of \\Delta t [s]"); 396 417 h->SetXTitle("\\Delta t [s]"); … … 401 422 h->Draw(); 402 423 424 pad->GetPad(1)->cd(2); 425 gPad->SetBorderMode(0); 426 fHEffOnTime.Draw(); 427 AppendPad("time"); 428 403 429 pad->cd(2); 404 430 gPad->SetBorderMode(0); 405 h = fHTimeDiff.ProjectionY("Theta", -1, 9999, "E"); 431 gPad->Divide(1, 3, 0, 0); 432 433 pad->GetPad(2)->cd(1); 434 gPad->SetBorderMode(0); 435 h = fHDeltaT.ProjectionY(fNameProjTheta, -1, 9999, "E"); 406 436 h->SetTitle("Distribution of \\Theta [\\circ]"); 407 437 h->SetXTitle("\\Theta [\\circ]"); … … 413 443 h->Draw(); 414 444 415 pad->cd(3); 416 gPad->SetBorderMode(0); 417 fHEffOn.Draw(); 418 AppendPad("paint"); 419 420 pad->cd(4); 445 pad->GetPad(2)->cd(2); 421 446 gPad->SetBorderMode(0); 422 447 fHProb.Draw(); 448 449 pad->GetPad(2)->cd(3); 450 gPad->SetBorderMode(0); 451 fHEffOnTheta.Draw(); 452 AppendPad("theta"); 453 } 454 455 void MHEffectiveOnTime::FillTimeBin(Double_t val, Double_t err) 456 { 457 // Get x-axis 458 TAxis &x = *fHEffOnTime.GetXaxis(); 459 460 // Get number of bins 461 const Int_t n = x.GetNbins(); 462 463 // Fill last bin with new values 464 fHEffOnTime.SetBinContent(n, fParam->GetVal()); 465 fHEffOnTime.SetBinError(n, fParam->GetErr()); 466 467 // Get time range of histogram, get bin width 468 const Double_t lo = fHEffOnTime.GetXaxis()->GetXmin(); 469 const Double_t up = fHEffOnTime.GetXaxis()->GetXmax(); 470 const Double_t w = fHEffOnTime.GetXaxis()->GetBinWidth(1); 471 472 // Enhance histogram by one bin 473 MBinning bins; 474 bins.SetEdges(n+2, lo, up+w); 475 bins.Apply(fHEffOnTime); 476 477 // Transform overflow bin 478 // fHEffOnTime.SetBinContent(n+2, fHEffOnTime.GetBinContent(n+1)); 479 // fHEffOnTime.SetBinError(n+2, fHEffOnTime.GetBinError(n+1)); 423 480 } 424 481 425 482 void MHEffectiveOnTime::Calc() 426 483 { 427 TH1D *h = fH TimeDiff.ProjectionX("", -1, 99999, "E");484 TH1D *h = fHDeltaT.ProjectionX("", -1, 99999, "E"); 428 485 h->SetDirectory(0); 429 486 … … 438 495 const Double_t error = res[1]; 439 496 440 fParam->SetVal(val -fEffOnTime0, error-fEffOnErr0);497 fParam->SetVal(val>fEffOnTime0?val-fEffOnTime0:0, error-fEffOnErr0); 441 498 fParam->SetReadyToSave(); 442 499 443 testval += fParam->GetVal(); 444 testerr += fParam->GetErr(); 500 FillTimeBin(fParam->GetVal(), fParam->GetErr()); 445 501 446 502 fEffOnTime0 = val; … … 453 509 *fLog << Form("T_{eff} = %.1fs \\pm %.1fs", 454 510 fParam->GetVal(), fParam->GetErr()); 455 *fLog << Form(" %.1f %.1f %.1f%.1f",456 val, testval, error, testerr) << endl;511 *fLog << Form(" %.1f %.1f", 512 val, error) << endl; 457 513 458 514 fTime->AddMilliSeconds(fInterval*1000); … … 468 524 if (!time) 469 525 { 470 *fLog << err << "ERROR - MHEffectiveOnTime Time::Fill without argument or container doesn't inherit from MTime... abort." << endl;526 *fLog << err << "ERROR - MHEffectiveOnTime::Fill without argument or container doesn't inherit from MTime... abort." << endl; 471 527 return kFALSE; 472 528 } … … 483 539 *fTime = *time; 484 540 541 MBinning bins; 542 bins.SetEdges(2, fTime->GetAxisTime(), fTime->GetAxisTime()+fInterval); 543 bins.Apply(fHEffOnTime); 544 485 545 // Make this just a ns before the first event 486 546 fTime->Minus1ns(); … … 493 553 } 494 554 495 fH TimeDiff.Fill(*time-fLastTime, fPointPos->GetZd(), w);555 fHDeltaT.Fill(*time-fLastTime, fPointPos->GetZd(), w); 496 556 fLastTime = *time; 497 557 -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r4875 r4906 59 59 60 60 #include "MReadReports.h" 61 #include "MReadMarsFile.h" 61 62 #include "MGeomApply.h" 62 63 #include "MPointingPosCalc.h" … … 180 181 } 181 182 182 Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcam )183 Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcam, Bool_t ismc) 183 184 { 184 185 if (!fSequence.IsValid()) … … 270 271 plist.AddToList(&tlist); 271 272 272 //MReadMarsFile read("Events"); 273 //read.DisableAutoScheme(); 274 MReadReports read; 275 read.AddTree("Events", "MTime.", kTRUE); 276 read.AddTree("Trigger"); 277 read.AddTree("Camera"); 278 read.AddTree("Drive"); 279 read.AddTree("CC"); 280 read.AddTree("Currents"); 281 read.AddFiles(iter); 282 //read.AddFiles(fnamein); 273 MReadReports readreal; 274 readreal.AddTree("Events", "MTime.", kTRUE); 275 readreal.AddTree("Trigger"); 276 readreal.AddTree("Camera"); 277 readreal.AddTree("Drive"); 278 readreal.AddTree("CC"); 279 readreal.AddTree("Currents"); 280 readreal.AddFiles(iter); 281 282 MReadMarsFile readmc("Events"); 283 readmc.DisableAutoScheme(); 284 readmc.AddFiles(iter); 283 285 284 286 MGeomApply apply; // Only necessary to create geometry … … 332 334 write.AddContainer("MCerPhotEvt", "Events"); 333 335 write.AddContainer("MPedPhotCam", "Events"); 334 write.AddContainer("MTime", "Events" );336 write.AddContainer("MTime", "Events", kFALSE); 335 337 write.AddContainer("MRawEvtHeader", "Events"); 336 338 write.AddContainer("MArrivalTime", "Events"); … … 383 385 384 386 // Now setup main tasklist 385 tlist.AddToList( &read);387 tlist.AddToList(ismc ? (MTask*)&readmc : (MTask*)&readreal); 386 388 tlist.AddToList(&tlist2, "Events"); 387 389 tlist.AddToList(&pcalc, "Drive"); -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.h
r4870 r4906 31 31 MJCalibrateSignal(const char *name=NULL, const char *title=NULL); 32 32 33 Bool_t ProcessFile(MPedestalCam &cam );33 Bool_t ProcessFile(MPedestalCam &cam, Bool_t ismc=kFALSE); 34 34 35 35 ClassDef(MJCalibrateSignal, 0) // Tool to create a pedestal file (MPedestalCam) -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r4894 r4906 49 49 50 50 #include "MReadReports.h" 51 #include "MReadMarsFile.h" 51 52 #include "MGeomApply.h" 52 53 #include "MEventRateCalc.h" … … 100 101 } 101 102 102 Bool_t MJStar::ProcessFile( )103 Bool_t MJStar::ProcessFile(Bool_t ismc) 103 104 { 104 105 if (!fSequence.IsValid()) … … 145 146 plist.AddToList(&tlist); 146 147 147 MReadReports read ;148 read .AddTree("Events", "MTime.", kTRUE);149 read .AddTree("Drive");148 MReadReports readreal; 149 readreal.AddTree("Events", "MTime.", kTRUE); 150 readreal.AddTree("Drive"); 150 151 //read.AddTree("Trigger"); 151 152 //read.AddTree("Camera"); 152 153 //read.AddTree("CC"); 153 154 //read.AddTree("Currents"); 154 read.AddFiles(iter); 155 readreal.AddFiles(iter); 156 157 MReadMarsFile readmc("Events"); 158 readmc.DisableAutoScheme(); 159 readmc.AddFiles(iter); 155 160 156 161 // ------------------ Setup general tasks ---------------- … … 215 220 write.AddContainer("MNewImagePar2", "Events"); 216 221 write.AddContainer("MImageParTime", "Events"); 217 write.AddContainer("MTime", "Events");218 222 write.AddContainer("MRawEvtHeader", "Events"); 219 // Monte Carlo 220 write.AddContainer("MMcEvt", "Events", kFALSE); 221 write.AddContainer("MMcTrig", "Events", kFALSE); 222 // Run Header 223 write.AddContainer("MRawRunHeader", "RunHeaders"); 224 write.AddContainer("MBadPixelsCam", "RunHeaders"); 225 write.AddContainer("MGeomCam", "RunHeaders"); 226 //write.AddContainer("MObservatory", "RunHeaders"); 227 // Monte Carlo Headers 228 write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE); 229 write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE); 230 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE); 231 // Drive 232 //write.AddContainer("MSrcPosCam", "Drive"); 233 write.AddContainer("MPointingPos", "Drive"); 234 write.AddContainer("MReportDrive", "Drive"); 235 write.AddContainer("MTimeDrive", "Drive"); 236 // Effective On Time 237 write.AddContainer("MEffectiveOnTime", "EffectiveOnTime"); 238 write.AddContainer("MTimeEffectiveOnTime", "EffectiveOnTime"); 223 if (ismc) 224 { 225 write.AddContainer("MPointingPos", "Events"); 226 // Monte Carlo 227 write.AddContainer("MMcEvt", "Events"); 228 write.AddContainer("MMcTrig", "Events"); 229 // Monte Carlo Headers 230 write.AddContainer("MMcTrigHeader", "RunHeaders"); 231 write.AddContainer("MMcConfigRunHeader", "RunHeaders"); 232 write.AddContainer("MMcCorsikaRunHeader", "RunHeaders"); 233 } 234 else 235 { 236 write.AddContainer("MTime", "Events"); 237 // Run Header 238 write.AddContainer("MRawRunHeader", "RunHeaders"); 239 write.AddContainer("MBadPixelsCam", "RunHeaders"); 240 write.AddContainer("MGeomCam", "RunHeaders"); 241 //write.AddContainer("MObservatory", "RunHeaders"); 242 // Drive 243 //write.AddContainer("MSrcPosCam", "Drive"); 244 write.AddContainer("MPointingPos", "Drive"); 245 write.AddContainer("MReportDrive", "Drive"); 246 write.AddContainer("MTimeDrive", "Drive"); 247 // Effective On Time 248 write.AddContainer("MEffectiveOnTime", "EffectiveOnTime"); 249 write.AddContainer("MTimeEffectiveOnTime", "EffectiveOnTime"); 250 } 239 251 240 252 MTaskList tlist2; 241 253 tlist2.AddToList(&apply); 242 tlist2.AddToList(&rate); 243 //tlist2.AddToList(&rate10000); 244 tlist2.AddToList(&fill8); 245 tlist2.AddToList(&fill9); 246 tlist2.AddToList(&filla); 254 if (!ismc) 255 { 256 tlist2.AddToList(&rate); 257 //tlist2.AddToList(&rate10000); 258 tlist2.AddToList(&fill8); 259 tlist2.AddToList(&fill9); 260 tlist2.AddToList(&filla); 261 } 247 262 //tlist2.AddToList(&fillb); 248 263 tlist2.AddToList(&clean); … … 265 280 //tlist3.AddToList(&srcpos); 266 281 267 tlist.AddToList( &read);282 tlist.AddToList(ismc ? (MTask*)&readmc : (MTask*)&readreal); 268 283 tlist.AddToList(&tlist3, "Drive"); 269 284 tlist.AddToList(&tlist2, "Events"); -
trunk/MagicSoft/Mars/mjobs/MJStar.h
r4756 r4906 14 14 MJStar(const char *name=NULL, const char *title=NULL); 15 15 16 Bool_t ProcessFile( );16 Bool_t ProcessFile(Bool_t ismc=kFALSE); 17 17 18 18 ClassDef(MJStar, 0) // Tool to create a pedestal file (MPedestalCam) -
trunk/MagicSoft/Mars/star.cc
r4887 r4906 49 49 gLog << " --debug-env Debug setting resources from file" << endl << endl; 50 50 gLog << endl; 51 gLog << " Input Options:" << endl; 52 gLog << " -mc You must use this for MC files (PRELIMINARY)" << endl << endl; 51 53 gLog << " Output options:" << endl; 52 54 gLog << " -q Quit when job is finished" << endl; … … 93 95 const Bool_t kOverwrite = arg.HasOnlyAndRemove("-f"); 94 96 const Bool_t kForceExec = arg.HasOnlyAndRemove("-ff"); 97 const Bool_t kIsMC = arg.HasOnlyAndRemove("-mc"); 95 98 96 99 const TString kInpath = arg.GetStringAndRemove("--ind=", ""); … … 210 213 // job.SetPathIn(kInpath); // not yet needed 211 214 212 if (!job.ProcessFile( ))215 if (!job.ProcessFile(kIsMC)) 213 216 { 214 217 gLog << err << "Calculation of image parameters failed." << endl << endl;
Note:
See TracChangeset
for help on using the changeset viewer.