Changeset 6874 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 03/23/05 09:42:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.