- Timestamp:
- 02/18/05 13:59:53 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6573 r6591 22 22 -*-*- END OF LINE -*-*- 23 23 24 2005/02/18 Thomas Bretz 25 26 * mbase/MStatusDisplay.cc: 27 - switch off TH1::AddDirectory during DrawClonePad 28 29 * mjobs/MSequence.[h,cc]: 30 - added some code (still commented) for later use, 31 allowing to setup a different filename for each runfile 32 - added SetNight member function 33 - added Add*Runs member function 34 - with this changes MSequence can replace MRunIter now 35 36 37 24 38 2005/02/17 Markus Gaug 25 39 … … 36 50 * msignal/MExtractTimeAndChargeDigitalFilter.cc 37 51 - calculate high-gain signal even if saturation occurs 52 53 38 54 39 55 2005/02/17 Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r6553 r6591 83 83 - enhanced possibility to debug reading of resource file 84 84 85 - MDataChain should handle priorities of operator more 86 accurate now 87 85 88 86 89 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r6159 r6591 63 63 #include <fstream> // fstream 64 64 65 #include <TH1.h> // TH1::AddDirectory 65 66 #include <TLine.h> // TLine 66 67 #include <TText.h> // TText … … 1614 1615 oldc.cd(); 1615 1616 1617 const Bool_t store = TH1::AddDirectoryStatus(); 1618 TH1::AddDirectory(kFALSE); 1619 1616 1620 //copy primitives 1617 1621 TObject *obj; … … 1644 1648 newc.Modified(); 1645 1649 newc.Update(); 1650 1651 TH1::AddDirectory(store); 1646 1652 1647 1653 padsav->cd(); -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r5692 r6591 93 93 // =========================================================================== 94 94 // 95 // For special cases you can also setup a sequence directly from a macro, 96 // for example: 97 // 98 // MDirIter pediter, datiter, caliter; 99 // 100 // MSequence seq; 101 // seq.SetNight("2004-07-06"); 102 // seq.AddPedRuns(31751); 103 // seq.AddCalRuns(31752); 104 // seq.AddDatRuns(31753, 31764); 105 // seq.SetupPedRuns(pediter); 106 // seq.SetupCalRuns(caliter); 107 // seq.SetupDatRuns(datiter); 108 // 109 // or 110 // 111 // MDirIter iter; 112 // 113 // MSequence seq; 114 // seq.SetNight("2004-07-06"); 115 // seq.AddRuns(31753, 31764); 116 // seq.SetupRuns(iter); 117 // seq.SetupPedRuns(iter, "/mypath", "[DPC]"); 118 // 95 119 ///////////////////////////////////////////////////////////////////////////// 96 120 #include "MSequence.h" … … 105 129 #include "MLogManip.h" 106 130 131 #include "MAstro.h" 107 132 #include "MDirIter.h" 108 133 … … 110 135 111 136 using namespace std; 137 138 MSequence::~MSequence() 139 { 140 /* 141 TExMapIter iter(&fFileNames); 142 143 Long_t key, val; 144 145 while (iter.Next(key, val)) 146 delete (TString*)val; 147 */ 148 } 149 112 150 113 151 // -------------------------------------------------------------------------- … … 134 172 } 135 173 136 Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw) const174 UInt_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw) const 137 175 { 138 176 TString d(path); … … 167 205 168 206 return iter.GetNumEntries(); 207 } 208 209 // -------------------------------------------------------------------------- 210 // 211 // Read the file fname as setup file for the sequence. 212 // 213 void MSequence::GetFileNames(TEnv &env, const TArrayI &arr) 214 { 215 /* 216 for (int i=0; i<arr.GetSize(); i++) 217 { 218 // Get run number 219 const Int_t num = arr[i]; 220 221 // Check if name already set 222 if (fFileNames.GetValue(num)) 223 continue; 224 225 TString *str = new TString(env.GetValue(Form("%d", num), "")); 226 fFileNames.Add(num, (Long_t)str); 227 } 228 */ 229 } 230 231 // -------------------------------------------------------------------------- 232 // 233 // Get a file name corresponding to the run-number num, returns 0 if n/a 234 // 235 const char *MSequence::GetFileName(UInt_t num) 236 { 237 return 0; 238 /* 239 TString *str = (TString*)fFileNames.GetValue(num); 240 return str ? str->Data() : 0;*/ 169 241 } 170 242 … … 210 282 str = env.GetValue("DatRuns", ""); 211 283 Split(str, fDatRuns); 284 285 GetFileNames(env, fRuns); 286 GetFileNames(env, fCalRuns); 287 GetFileNames(env, fPedRuns); 288 GetFileNames(env, fDatRuns); 212 289 } 213 290 … … 260 337 // Return the number of files added. 261 338 // 262 Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const339 UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const 263 340 { 264 341 return SetupRuns(iter, fPedRuns, path, id, raw); … … 273 350 // Return the number of files added. 274 351 // 275 Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const352 UInt_t MSequence::SetupDatRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const 276 353 { 277 354 return SetupRuns(iter, fDatRuns, path, id, raw); … … 286 363 // Return the number of files added. 287 364 // 288 Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const365 UInt_t MSequence::SetupAllRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const 289 366 { 290 367 return SetupRuns(iter, fRuns, path, id, raw); … … 299 376 // Return the number of files added. 300 377 // 301 Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const378 UInt_t MSequence::SetupCalRuns(MDirIter &iter, const char *path, char *id, Bool_t raw) const 302 379 { 303 380 return SetupRuns(iter, fCalRuns, path, id, raw); 304 381 } 382 383 // -------------------------------------------------------------------------- 384 // 385 // If you want to add runs manually, use this function. 386 // 387 UInt_t MSequence::AddRuns(UInt_t first, UInt_t last, TArrayI *runs) 388 { 389 if (last<first) 390 { 391 *fLog << warn << "MSequence::AddRuns - WARNING: Last runnumber " << last; 392 *fLog << " smaller than first " << first << "... ignored." << endl; 393 return 0; 394 } 395 if (!IsValid()) 396 { 397 *fLog << inf << "Setting Sequence number to #" << first << endl; 398 fSequence = first; 399 } 400 401 const UInt_t nall = fRuns.GetSize(); 402 const UInt_t nrun = runs ? runs->GetSize() : 0; 403 const UInt_t add = last-first+1; 404 405 fRuns.Set(nall+add); 406 if (runs) 407 runs->Set(nrun+add); 408 409 for (UInt_t i=0; i<add; i++) 410 { 411 fRuns[nall+i] = first+i; 412 if (runs) 413 (*runs)[nrun+i] = first+i; 414 } 415 return add; 416 } 417 418 // -------------------------------------------------------------------------- 419 // 420 // If you want to change or set the night manually. 421 // The Format is 422 // SetNight("yyyy-mm-dd"); 423 // 424 void MSequence::SetNight(const char *txt) 425 { 426 TString night(txt); 427 night += " 00:00:00"; 428 fNight.SetSqlDateTime(night); 429 430 fPeriod = MAstro::GetMagicPeriod(fNight.GetMjd()); 431 } -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r6189 r6591 4 4 #ifndef ROOT_TArrayI 5 5 #include <TArrayI.h> 6 #endif 7 8 #ifndef ROOT_TExMap 9 #include <TExMap.h> 6 10 #endif 7 11 … … 35 39 TArrayI fDatRuns; 36 40 41 //TExMap fFileNames; 42 37 43 void Split(TString &runs, TArrayI &data) const; 38 Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw=kFALSE) const; 44 void GetFileNames(TEnv &env, const TArrayI &arr); 45 46 const char *GetFileName(UInt_t num); 47 48 UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw=kFALSE) const; 49 UInt_t AddRuns(UInt_t first, UInt_t last, TArrayI *runs); 39 50 40 51 public: … … 48 59 fRuns(s.fRuns), fCalRuns(s.fCalRuns), fPedRuns(s.fPedRuns), 49 60 fDatRuns(s.fDatRuns) { } 61 ~MSequence(); 50 62 63 // TObject 51 64 void Print(Option_t *o="") const; 52 65 66 // Genaral interface 53 67 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; } 54 68 55 Int_t SetupPedRuns(MDirIter &iter, const char *path=0, char *id="P", Bool_t raw=kFALSE) const; 56 Int_t SetupDatRuns(MDirIter &iter, const char *path=0, char *id="D", Bool_t raw=kFALSE) const; 57 Int_t SetupAllRuns(MDirIter &iter, const char *path=0, char *id="?", Bool_t raw=kFALSE) const; 58 Int_t SetupCalRuns(MDirIter &iter, const char *path=0, char *id="C", Bool_t raw=kFALSE) const; 59 60 Int_t GetNumAllRuns() const { return fRuns.GetSize(); } 61 Int_t GetNumDatRuns() const { return fDatRuns.GetSize(); } 62 Int_t GetNumPedRuns() const { return fPedRuns.GetSize(); } 63 Int_t GetNumCalRuns() const { return fCalRuns.GetSize(); } 69 UInt_t SetupPedRuns(MDirIter &iter, const char *path=0, char *id="P", Bool_t raw=kFALSE) const; 70 UInt_t SetupDatRuns(MDirIter &iter, const char *path=0, char *id="D", Bool_t raw=kFALSE) const; 71 UInt_t SetupAllRuns(MDirIter &iter, const char *path=0, char *id="?", Bool_t raw=kFALSE) const; 72 UInt_t SetupCalRuns(MDirIter &iter, const char *path=0, char *id="C", Bool_t raw=kFALSE) const; 64 73 65 74 // Getter 75 UInt_t GetNumAllRuns() const { return fRuns.GetSize(); } 76 UInt_t GetNumDatRuns() const { return fDatRuns.GetSize(); } 77 UInt_t GetNumPedRuns() const { return fPedRuns.GetSize(); } 78 UInt_t GetNumCalRuns() const { return fCalRuns.GetSize(); } 79 66 80 UInt_t GetSequence() const { return fSequence; } 67 81 UInt_t GetLastRun() const { return fLastRun; } … … 79 93 const TString &GetSource() const { return fSource; } 80 94 95 // Setter 96 void SetNight(const char*night); 97 98 UInt_t AddRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, 0); } 99 UInt_t AddCalRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fCalRuns); } 100 UInt_t AddPedRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fPedRuns); } 101 UInt_t AddDatRuns(UInt_t first, UInt_t last) { return MSequence::AddRuns(first, last, &fDatRuns); } 102 103 UInt_t AddRuns(UInt_t num) { return AddRuns(num, num); } 104 UInt_t AddCalRuns(UInt_t num) { return AddCalRuns(num, num); } 105 UInt_t AddPedRuns(UInt_t num) { return AddPedRuns(num, num); } 106 UInt_t AddDatRuns(UInt_t num) { return AddDatRuns(num, num); } 107 81 108 ClassDef(MSequence, 0) 82 109 };
Note:
See TracChangeset
for help on using the changeset viewer.