- Timestamp:
- 03/23/05 09:42:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6873 r6874 21 21 22 22 -*-*- END OF LINE -*-*- 23 2005/03/23 Thomas Bretz 24 25 * ganymed.cc: 26 - implemented wobble-mode option 27 28 * mhflux/MAlphaFitter.[h,cc]: 29 - fixed a problem in wobble mode (number of on- minus number 30 of off-entries where calculated as 0) 31 - added some additional resource options for scaling 32 - added some missing const-qualifiers 33 34 * mhflux/MHAlpha.cc: 35 - some cosmetic change to output 36 37 * mjobs/MDataSet.[h,cc]: 38 - added the possibility to add a source name for wobble mode 39 (preliminary) 40 - added reading from *.edb catalog 41 42 * mjobs/MJCalibTest.cc, mjobs/MJCalibrateSignal.cc, 43 mjobs/MJCalibration.cc, mjobs/MJPedestal.cc: 44 - replaced iter.Print("all") by iter.Print() 45 46 * mjobs/MJCut.[h,cc]: 47 - implemented wobble mode 48 - implemented getting source position 49 50 * mpointing/MSrcPosCalc.[h,cc]: 51 - always writa the anti-source position into the parameter list, too 52 - implemented wobble mode (exchange source and anti-source position) 53 54 55 23 56 2005/03/22 Thomas Bretz 24 57 -
trunk/MagicSoft/Mars/NEWS
r6869 r6874 97 97 the shower image (MNewImagePar2) 98 98 99 - implemented wobble-mode in ganymed 100 99 101 100 102 -
trunk/MagicSoft/Mars/ganymed.cc
r6604 r6874 48 48 gLog << " Root Options:" << endl; 49 49 gLog << " -b Batch mode (no graphical output to screen)" << endl<<endl; 50 gLog << " Operation Mode:" << endl; 51 gLog << " --wobble Wobble Mode" << endl << endl; 50 52 gLog << " Options:" << endl; 51 53 gLog.Usage(); … … 64 66 gLog << " --res[=filename] Enable writing of result file (surviving events)" << endl; 65 67 gLog << " --write-only Only write output files. No histograms filled." << endl; 66 gLog << " --print- seq Print Sequencesinformation" << endl;68 gLog << " --print-ds Print Dataset information" << endl; 67 69 gLog << " --print-files Print Files taken from Sequences ('+' found, '-' missing)" << endl; 68 70 gLog << " --config=ganymed.rc Resource file [default=ganymed.rc]" << endl; … … 103 105 const TString kConfig = arg.GetStringAndRemove("--config=", "ganymed.rc"); 104 106 105 const Bool_t kPrintSeq = arg.HasOnlyAndRemove("--print- seq");107 const Bool_t kPrintSeq = arg.HasOnlyAndRemove("--print-ds"); 106 108 const Bool_t kPrintFiles = arg.HasOnlyAndRemove("--print-files"); 107 109 const Bool_t kDebugMem = arg.HasOnlyAndRemove("--debug-mem"); … … 114 116 const Bool_t kOverwrite = arg.HasOnlyAndRemove("-f"); 115 117 //const Bool_t kForceExec = arg.HasOnlyAndRemove("-ff"); 118 119 const Bool_t kModeWobble = arg.HasOnlyAndRemove("--wobble"); 116 120 117 121 const Int_t kNumAnalysis = arg.GetIntAndRemove("--n=", -1); … … 215 219 job.SetNameResultFile(kNameResult); 216 220 job.EnableWriteOnly(kWriteOnly); 221 job.EnableWobbleMode(kModeWobble); 217 222 if (kWriteSummary) // Don't change flag set in SetNameSummaryFile 218 223 job.EnableStorageOfSummary(); -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r6282 r6874 213 213 } 214 214 215 Bool_t MAlphaFitter::Fit(TH1D &hon, TH1D &hof, Double_t alpha, Bool_t paint) 216 { 217 /* 218 Clear(); 219 if (hon.GetEntries()==0) 220 return kFALSE; 221 */ 222 215 Bool_t MAlphaFitter::Fit(const TH1D &hon, const TH1D &hof, Double_t alpha, Bool_t paint) 216 { 223 217 TH1D h(hon); 224 h.Add(&hof, -1); 218 h.Add(&hof, -1); // substracts also number of entries! 219 h.SetEntries(hon.GetEntries()); 225 220 226 221 MAlphaFitter fit(*this); … … 558 553 txt = txt.Strip(TString::kBoth); 559 554 txt.ToLower(); 560 if (txt==(TString)" Significance")555 if (txt==(TString)"significance") 561 556 fStrategy = kSignificance; 562 if (txt==(TString)" SignificanceChi2")557 if (txt==(TString)"significancechi2") 563 558 fStrategy = kSignificanceChi2; 564 559 rc = kTRUE; 565 560 } 566 561 567 return rc; 568 } 562 if (IsEnvDefined(env, prefix, "ScaleMode", print)) 563 { 564 TString txt = GetEnvValue(env, prefix, "ScaleMode", ""); 565 txt = txt.Strip(TString::kBoth); 566 txt.ToLower(); 567 if (txt==(TString)"none") 568 fScaleMode = kNone; 569 if (txt==(TString)"entries") 570 fScaleMode = kEntries; 571 if (txt==(TString)"integral") 572 fScaleMode = kIntegral; 573 if (txt==(TString)"offregion") 574 fScaleMode = kOffRegion; 575 if (txt==(TString)"leastsquare") 576 fScaleMode = kLeastSquare; 577 if (txt==(TString)"userscale") 578 fScaleMode = kUserScale; 579 rc = kTRUE; 580 } 581 if (IsEnvDefined(env, prefix, "Scale", print)) 582 { 583 fScaleUser = GetEnvValue(env, prefix, "Scale", fScaleUser); 584 rc = kTRUE; 585 } 586 587 return rc; 588 } -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r6283 r6874 125 125 126 126 Bool_t Fit(TH1D &h, Bool_t paint=kFALSE); 127 Bool_t Fit( TH1D &on,TH1D &off, Double_t alpha, Bool_t paint=kFALSE);127 Bool_t Fit(const TH1D &on, const TH1D &off, Double_t alpha, Bool_t paint=kFALSE); 128 128 Bool_t Fit(TH1D &on, TH1D *off, Double_t alpha, Bool_t paint=kFALSE) 129 129 { -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r6283 r6874 827 827 //Bool_t rc = fFit.Fit(*h); 828 828 //delete h; 829 829 830 if (!fFit.FitAlpha(fHAlpha, fOffData)) 830 831 { 831 *fLog << warn << " Histogram empty." << endl;832 *fLog << warn << "MAlphaFitter - Fit failed..." << endl; 832 833 return kTRUE; 833 834 } -
trunk/MagicSoft/Mars/mjobs/MDataSet.cc
r6453 r6874 68 68 69 69 #include <stdlib.h> 70 #include <fstream> 70 71 71 72 #include <TEnv.h> … … 77 78 78 79 #include "MRead.h" 80 #include "MAstro.h" 79 81 #include "MDirIter.h" 80 82 #include "MSequence.h" 83 #include "MPointingPos.h" 81 84 82 85 ClassImp(MDataSet); … … 113 116 TString name = env.GetValue(Form("Sequence%08d.File", num[i]), ""); 114 117 TString dir = env.GetValue(Form("Sequence%08d.Dir", num[i]), ""); 118 119 gSystem->ExpandPathName(name); 120 gSystem->ExpandPathName(dir); 115 121 116 122 if (name.IsNull()) … … 160 166 Split(str, fNumSequencesOff); 161 167 162 163 168 ResolveSequences(env, fNumSequencesOn, fSequencesOn); 164 169 ResolveSequences(env, fNumSequencesOff, fSequencesOff); 165 170 166 171 172 fNameSource = env.GetValue("SourceName", ""); 173 fCatalog = env.GetValue("Catalog", "~/Software/data/magic_favorites.edb"); 167 174 168 175 //Print(); … … 205 212 gLog << endl; 206 213 214 gLog << "SourceName: " << fNameSource << endl; 215 gLog << "Catalog: " << fCatalog << endl; 216 207 217 if (!TString(o).Contains("files", TString::kIgnoreCase)) 208 218 return; … … 242 252 } 243 253 254 if (gLog.GetDebugLevel()>4) 255 { 256 gLog << dbg << "Files which are searched:" << endl; 257 files.Print(); 258 } 259 244 260 return read.AddFiles(files)>0; 245 261 } … … 261 277 return AddSequencesToList(fSequencesOff, read, id, raw); 262 278 } 279 280 Bool_t MDataSet::GetSourcePos(MPointingPos &pos) const 281 { 282 if (!HasSource()) 283 return kFALSE; 284 285 TString catalog(fCatalog); 286 gSystem->ExpandPathName(catalog); 287 288 ifstream fin(catalog); 289 if (!fin) 290 { 291 gLog << err << "Cannot open file " << catalog << ": "; 292 gLog << strerror(errno) << endl; 293 return kFALSE; 294 } 295 296 TString ra,dec,epoch; 297 298 Int_t n = 0; 299 while (1) 300 { 301 TString line; 302 line.ReadLine(fin); 303 if (!fin) 304 break; 305 306 n++; 307 line = line.Strip(TString::kBoth); 308 309 if (!line.BeginsWith(fNameSource)) 310 continue; 311 312 // CrabNebula,f|L|K0,5:34:32.0,22:0:52,-1.0,2000 313 314 for (int i=0; i<6; i++) 315 { 316 const Ssiz_t p = line.First(','); 317 if (p<0 && i<5) 318 { 319 gLog << err << "Not enough arguments in line #" << n << endl; 320 return kFALSE; 321 } 322 323 switch (i) 324 { 325 case 0: 326 case 1: 327 case 4: 328 break; 329 case 2: 330 ra = line(0, p); 331 break; 332 case 3: 333 dec = line(0, p); 334 break; 335 case 5: 336 epoch = line; 337 break; 338 } 339 line.Remove(0, p+1); 340 } 341 342 if (line.First(',')>=0) 343 { 344 gLog << err << "Too much arguments in line #" << n << endl; 345 return kFALSE; 346 } 347 break; 348 } 349 350 if (epoch!=(TString)"2000") 351 { 352 gLog << err << "Epoch not 2000... not supported." << endl; 353 return kFALSE; 354 } 355 356 Double_t r,d; 357 if (!MAstro::Coordinate2Angle(ra, r)) 358 { 359 gLog << err << "ERROR - Interpreting right ascension: " << ra << endl; 360 return kFALSE; 361 } 362 if (!MAstro::Coordinate2Angle(dec, d)) 363 { 364 gLog << err << "ERROR - Interpreting declination: " << dec << endl; 365 return kFALSE; 366 } 367 368 pos.SetSkyPosition(r, d); 369 pos.SetTitle(fNameSource); 370 371 return kTRUE; 372 } -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r6453 r6874 11 11 12 12 class MRead; 13 class MPointingPos; 13 14 14 15 class MDataSet : public MParContainer … … 23 24 TList fSequencesOff; // list of names and paths of off-sequences 24 25 26 27 TString fNameSource; // Name of source from catalog 28 TString fCatalog; // edb catalog (magic_favourites.edb) 29 30 25 31 void Split(TString &runs, TArrayI &data) const; 26 32 void ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const; … … 31 37 MDataSet(const char *fname); 32 38 33 void Print(Option_t *o="") const; 34 39 // Getter 35 40 Bool_t IsValid() const { return fNumAnalysis!=(UInt_t)-1; } 36 41 42 UInt_t GetNumSequencesOn() const { return fNumSequencesOn.GetSize(); } 43 UInt_t GetNumSequencesOff() const { return fNumSequencesOff.GetSize(); } 44 45 Bool_t HasOffSequences() const { return GetNumSequencesOff()>0; } 46 47 UInt_t GetNumAnalysis() const { return fNumAnalysis; } 48 void SetNumAnalysis(UInt_t num) { fNumAnalysis=num; } 49 50 Bool_t HasSource() const { return !fNameSource.IsNull(); } 51 Bool_t GetSourcePos(MPointingPos &pos) const; 52 53 // Setter 37 54 static Bool_t AddSequencesToList(const TList &list, MRead &read, char *id="I", Bool_t raw=kFALSE); 38 55 … … 41 58 Bool_t AddFilesOff(MRead &read, char *id="I", Bool_t raw=kFALSE) const; 42 59 43 UInt_t GetNumSequencesOn() const { return fNumSequencesOn.GetSize(); } 44 UInt_t GetNumSequencesOff() const { return fNumSequencesOff.GetSize(); } 45 46 Bool_t HasOffSequences() const { return GetNumSequencesOff()>0; } 47 48 // Getter 49 UInt_t GetNumAnalysis() const { return fNumAnalysis; } 50 void SetNumAnalysis(UInt_t num) { fNumAnalysis=num; } 60 // TObject 61 void Print(Option_t *o="") const; 51 62 52 63 ClassDef(MDataSet, 0) -
trunk/MagicSoft/Mars/mjobs/MJCalibTest.cc
r6872 r6874 330 330 { 331 331 *fLog << dbg << "Files which are searched:" << endl; 332 iter.Print( "all");332 iter.Print(); 333 333 } 334 334 return kFALSE; -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc
r6872 r6874 330 330 { 331 331 *fLog << dbg << "Files which are searched:" << endl; 332 iter.Print( "all");332 iter.Print(); 333 333 } 334 334 return kFALSE; -
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r6872 r6874 1766 1766 { 1767 1767 *fLog << dbg << "Files which are searched:" << endl; 1768 iter.Print( "all");1768 iter.Print(); 1769 1769 } 1770 1770 return kFALSE; -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r6820 r6874 58 58 #include "MDataSet.h" 59 59 #include "MParameters.h" 60 #include "MPointingPos.h" 60 61 #include "MObservatory.h" 61 62 … … 70 71 MJCut::MJCut(const char *name, const char *title) 71 72 : fStoreSummary(kFALSE), fStoreResult(kFALSE), fWriteOnly(kFALSE), 72 f EstimateEnergy(0), fCalcHadronness(0)73 fIsWobble(kFALSE), fEstimateEnergy(0), fCalcHadronness(0) 73 74 { 74 75 fName = name ? name : "MJCut"; … … 243 244 EnableStorageOfSummary(GetEnv("SummaryFile", fStoreSummary)); 244 245 EnableStorageOfResult(GetEnv("ResultFile", fStoreResult)); 246 EnableWobbleMode(GetEnv("WobbleMode", fIsWobble)); 245 247 246 248 return kTRUE; … … 307 309 MObservatory obs; 308 310 plist.AddToList(&obs); 311 312 // Possible source position (eg. Wobble Mode) 313 MPointingPos source("MSourcePos"); 314 if (set.GetSourcePos(source)) 315 { 316 plist.AddToList(&source); 317 *fLog << inf << "Using Source Position: " << source.GetTitle() << endl; 318 } 319 else 320 *fLog << inf << "No source position applied..." << endl; 309 321 310 322 // Initialize default binnings … … 323 335 MAlphaFitter fit; 324 336 plist.AddToList(&fit); 337 if (fIsWobble) 338 fit.SetScaleMode(MAlphaFitter::kNone); 325 339 326 340 MFillH falpha("MHAlphaOff [MHAlpha]", "MHillasSrc", "FillAlpha"); … … 342 356 readoff.AddTree("Drive"); 343 357 readoff.AddTree("EffectiveOnTime"); 344 set.AddFilesOff(readoff); 358 if (fIsWobble) 359 set.AddFilesOn(readoff); 360 else 361 set.AddFilesOff(readoff); 345 362 346 363 const TString path(Form("%s/", fPathOut.Data())); … … 375 392 // How to get source position from off- and on-data? 376 393 MSrcPosCalc scalc; 394 if (fIsWobble) 395 scalc.SetWobbleMode(); /********************/ 377 396 MHillasCalc hcalc; 397 MHillasCalc hcalc2("MHillasCalcAnti"); 378 398 hcalc.SetFlags(MHillasCalc::kCalcHillasSrc); 399 hcalc2.SetFlags(MHillasCalc::kCalcHillasSrc); 400 hcalc2.SetNameHillasSrc("MHillasSrcAnti"); 401 hcalc2.SetNameSrcPosCam("MSrcPosAnti"); 379 402 380 403 MTaskList tlist2; 381 404 tlist2.AddToList(&scalc); 382 405 tlist2.AddToList(&hcalc); 406 if (fIsWobble) 407 tlist2.AddToList(&hcalc2); 383 408 tlist2.AddToList(&taskenv1); 384 409 tlist2.AddToList(&taskenv2); … … 414 439 return kFALSE; 415 440 416 if (set.HasOffSequences() )441 if (set.HasOffSequences() || fIsWobble) 417 442 { 418 443 // Execute first analysis … … 427 452 if (!evtloop.GetDisplay()) 428 453 { 429 *fLog << err << GetDescriptor() << ": Execution stopped by use d." << endl;454 *fLog << err << GetDescriptor() << ": Execution stopped by user." << endl; 430 455 return kFALSE; 431 456 } … … 439 464 set.AddFilesOn(readon); 440 465 466 if (fIsWobble) 467 scalc.SetWobbleMode(kFALSE); /********************/ 468 441 469 MFillH fill1b("MHHillasOnPre [MHHillas]", "MHillas", "FillHillasPre"); 442 470 MFillH fill2b("MHHillasOnPost [MHHillas]", "MHillas", "FillHillasPost"); 443 471 fill1b.SetNameTab("PreCut"); 444 472 fill2b.SetNameTab("PostCut"); 445 fill1b.SetDrawOption(set.HasOffSequences() ?"same":"");446 fill2b.SetDrawOption(set.HasOffSequences() ?"same":"");473 fill1b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); 474 fill2b.SetDrawOption(set.HasOffSequences()||fIsWobble?"same":""); 447 475 448 476 MFillH falpha2("MHAlpha", "MHillasSrc", "FillAlpha"); -
trunk/MagicSoft/Mars/mjobs/MJCut.h
r6464 r6874 16 16 Bool_t fStoreResult; 17 17 Bool_t fWriteOnly; 18 Bool_t fIsWobble; 18 19 19 20 TString fNameSummary; … … 42 43 void EnableStorageOfResult(Bool_t b=kTRUE) { fStoreResult = b; } // See SetNameResult 43 44 void EnableWriteOnly(Bool_t b=kTRUE) { fWriteOnly = b; } 45 void EnableWobbleMode(Bool_t b=kTRUE) { fIsWobble = b; } 44 46 45 47 void SetNameSummaryFile(const char *name=""); -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r6872 r6874 979 979 { 980 980 *fLog << dbg << "Files which are searched:" << endl; 981 iter.Print( "all");981 iter.Print(); 982 982 } 983 983 return kFALSE; -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
r6346 r6874 17 17 ! 18 18 ! Author(s): Thomas Bretz 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 19 ! Author(s): Abelardo Moralejo 1/2005 <mailto:moralejo@pd.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 90 90 MSrcPosCalc::MSrcPosCalc(const char *name, const char *title) 91 91 : fObservatory(NULL), fPointPos(NULL), fSourcePos(NULL), fSrcPosCam(NULL), 92 f Geom(NULL), fTime(NULL)92 fSrcPosAnti(NULL), fGeom(NULL), fTime(NULL), fIsWobbleMode(kFALSE) 93 93 { 94 94 fName = name ? name : "MSrcPosCalc"; … … 149 149 fSrcPosCam = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam"); 150 150 if (!fSrcPosCam) 151 return kFALSE; 152 153 fSrcPosAnti = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", "MSrcPosAnti"); 154 if (!fSrcPosAnti) 151 155 return kFALSE; 152 156 … … 260 264 // coordinates, since this transformation ignores precession and nutation effects. 261 265 const MAstroSky2Local conv(*fTime, *fObservatory); 262 263 266 pos *= conv; 264 267 … … 284 287 // Calculate source position in camera, and convert to mm: 285 288 TVector2 v = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000; 286 287 fSrcPosCam->SetXY(v); 289 if (fIsWobbleMode) 290 { 291 fSrcPosAnti->SetXY(v); 292 v *= -1; 293 fSrcPosCam->SetXY(v); 294 } 295 else 296 { 297 fSrcPosCam->SetXY(v); 298 v *= -1; 299 fSrcPosAnti->SetXY(v); 300 } 288 301 289 302 // v *= fGeom->GetConvMm2Deg(); -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h
r6346 r6874 28 28 MPointingPos *fSourcePos; 29 29 MSrcPosCam *fSrcPosCam; 30 MSrcPosCam *fSrcPosAnti; 30 31 MGeomCam *fGeom; 31 32 MTime *fTime; 33 34 Bool_t fIsWobbleMode; 32 35 33 36 // MSrcPosCalc … … 52 55 void SetSourcePos(Double_t ra, Double_t dec); 53 56 void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } // Make MSrcPosCalc owner of fSourcePos 57 void SetWobbleMode(Bool_t b=kTRUE) { fIsWobbleMode = b; } 54 58 55 59 ClassDef(MSrcPosCalc, 0) // Calculates the source position in the camera
Note:
See TracChangeset
for help on using the changeset viewer.