Changeset 4722 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 08/24/04 14:51:17 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJCalibration.cc
r4695 r4722 186 186 : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fTimeExtractor(NULL), 187 187 fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay), 188 fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE) 188 fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE), fOverwrite(kFALSE) 189 189 { 190 190 … … 1247 1247 } 1248 1248 1249 // -------------------------------------------------------------------------- 1250 // 1251 // MJCalibration allows to setup several option by a resource file: 1252 // MJCalibration.OutputPath: path 1253 // MJCalibration.InputPath: path 1254 // MJCalibration.Display: full, datacheck, normal 1255 // MJCalibration.RelTimeCalibration: yes,no 1256 // MJCalibration.Datacheck: yes,no 1257 // MJCalibration.Debug: yes,no 1258 // MJCalibration.UseBlindPixel: yes,no 1259 // MJCalibration.UsePINDiode: yes,no 1260 // 1261 // For more details see the class description and the corresponding Getters 1262 // 1249 1263 void MJCalibration::CheckEnv() 1250 1264 { … … 1277 1291 SetUseBlindPixel(fEnv->GetValue("MJCalibration.UseBlindPixel", IsUseBlindPixel())); 1278 1292 SetUsePINDiode(fEnv->GetValue("MJCalibration.UsePINDiode", IsUsePINDiode())); 1293 1294 SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite)); 1295 SetInputPath(fEnv->GetValue("MJPedestal.InputPath", fInputPath)); 1279 1296 } 1280 1297 … … 1415 1432 MDirIter iter; 1416 1433 if (fSequence) 1417 fSequence->SetupCalRuns(iter); 1434 { 1435 if (fSequence->SetupCalRuns(iter, fInputPath)==0) 1436 { 1437 *fLog << err << "ERROR - No input files of sequence found!" << endl; 1438 return kFALSE; 1439 } 1440 } 1418 1441 1419 1442 if (fDataCheck) … … 1666 1689 // -------------------------------------------------------------------------- 1667 1690 // 1691 // Set the path from which the sequence files are read 1692 // 1693 void MJCalibration::SetInputPath(const char *path) 1694 { 1695 fInputPath = path; 1696 if (fInputPath.EndsWith("/")) 1697 fInputPath = fInputPath(0, fInputPath.Length()-1); 1698 } 1699 1700 // -------------------------------------------------------------------------- 1701 // 1668 1702 // Set the useage of the Blind Pixel device 1669 1703 // … … 1702 1736 *fLog << inf << "Writing to file: " << oname << endl; 1703 1737 1704 TFile file(oname, "RECREATE"); 1738 TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9); 1739 if (!file.IsOpen()) 1740 { 1741 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 1742 return kFALSE; 1743 } 1705 1744 1706 1745 *fLog << inf << " - MStatusDisplay..." << flush; -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r4695 r4722 91 91 MJPedestal::MJPedestal(const char *name, const char *title) 92 92 : fEnv(0), fRuns(0), fSequence(0), fExtractor(NULL), fDisplayType(kNormalDisplay), 93 fDataCheck(kFALSE), fUseData(kFALSE), f MaxEvents(0)93 fDataCheck(kFALSE), fUseData(kFALSE), fOverwrite(kFALSE), fMaxEvents(0) 94 94 { 95 95 fName = name ? name : "MJPedestal"; … … 451 451 *fLog << inf << "Writing to file: " << oname << endl; 452 452 453 TFile file(oname, "RECREATE"); 453 TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJPedestal", 9); 454 if (!file.IsOpen()) 455 { 456 *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl; 457 return kFALSE; 458 } 454 459 455 460 if (fDisplay && fDisplay->Write()<=0) … … 481 486 } 482 487 488 // -------------------------------------------------------------------------- 489 // 490 // Set the path from which the sequence files are read 491 // 492 void MJPedestal::SetInputPath(const char *path) 493 { 494 fInputPath = path; 495 if (fInputPath.EndsWith("/")) 496 fInputPath = fInputPath(0, fInputPath.Length()-1); 497 } 498 483 499 void MJPedestal::SetEnv(const char *env) 484 500 { … … 496 512 } 497 513 514 // -------------------------------------------------------------------------- 515 // 516 // MJPedestsl allows to setup several option by a resource file: 517 // MJPedestal.OutputPath: path 518 // MJPedestal.MaxEvents: 1000 519 // MJPedestal.AllowOverwrite: yes, no 520 // MJPedestal.UseData: yes, no (use DatRuns from sequence instead of PedRuns) 521 // 522 // For more details see the class description and the corresponding Getters 523 // 498 524 void MJPedestal::CheckEnv() 499 525 { … … 508 534 } 509 535 510 fMaxEvents = fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents); 511 fUseData = fEnv->GetValue("MJPedestal.UseData", fUseData); 536 SetMaxEvents(fEnv->GetValue("MJPedestal.MaxEvents", fMaxEvents)); 537 SetOverwrite(fEnv->GetValue("MJPedestal.AllowOverwrite", fOverwrite)); 538 539 fUseData = fEnv->GetValue("MJPedestal.UseData", fUseData); 512 540 } 513 541 … … 548 576 MDirIter iter; 549 577 if (fSequence) 550 fUseData ? fSequence->SetupDatRuns(iter) : fSequence->SetupPedRuns(iter); 578 { 579 const Int_t n = fUseData ? fSequence->SetupDatRuns(iter, fInputPath) : fSequence->SetupPedRuns(iter, fInputPath); 580 if (n==0) 581 { 582 *fLog << err << "ERROR - No input files of sequence found!" << endl; 583 return kFALSE; 584 } 585 } 551 586 552 587 if (fDataCheck) -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r4695 r4722 27 27 // MSequence 28 28 // 29 // This class describes a sequence. For sequences see: 30 // http://magic.astro.uni-wuerzburg.de/mars/db/queryseq.html 31 // 32 // A sequence is a collection of runs which should be used together. 33 // 29 34 ///////////////////////////////////////////////////////////////////////////// 30 35 #include "MSequence.h" … … 34 39 #include <TEnv.h> 35 40 #include <TRegexp.h> 41 #include <TSystem.h> // TSystem::ExpandPath 36 42 37 43 #include "MLog.h" … … 44 50 using namespace std; 45 51 52 // -------------------------------------------------------------------------- 53 // 54 // Copy the run numbers from the TString runs into the TArrayI data 55 // 46 56 void MSequence::Split(TString &runs, TArrayI &data) const 47 57 { … … 63 73 } 64 74 65 voidMSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const75 Int_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const 66 76 { 67 77 TString d(path); 68 78 69 79 // Setup path 70 if ( !path)80 if (d.IsNull()) 71 81 { 72 82 d = Form("/data/MAGIC/Period%03d/rootdata/", fPeriod); 73 83 d += fNight.GetStringFmt("%Y_%m_%d"); 74 84 } 85 86 Int_t num = 0; 75 87 76 88 for (int i=0; i<arr.GetSize(); i++) … … 83 95 84 96 // Add Path/File to TIter 85 iter.AddDirectory(d, n, 0); 86 } 87 } 88 97 num += iter.AddDirectory(d, n, 0); 98 } 99 return num; 100 } 101 102 // -------------------------------------------------------------------------- 103 // 104 // Read the file fname as setup file for the sequence. 105 // 89 106 MSequence::MSequence(const char *fname) 90 107 { … … 96 113 TString str; 97 114 98 fSequence = env.GetValue("Sequence", -1);99 fLastRun = env.GetValue("LastRun", -1);115 fSequence = env.GetValue("Sequence", -1); 116 fLastRun = env.GetValue("LastRun", -1); 100 117 fNumEvents = env.GetValue("NumEvents", -1); 101 fPeriod = env.GetValue("Period", -1);118 fPeriod = env.GetValue("Period", -1); 102 119 103 120 str = env.GetValue("Start", ""); … … 122 139 } 123 140 141 // -------------------------------------------------------------------------- 142 // 143 // Print the contents of the sequence 144 // 124 145 void MSequence::Print(Option_t *o) const 125 146 { 126 147 gLog << all; 148 if (!IsValid()) 149 { 150 gLog << "Sequence: " << fName << " <invalid>" << endl; 151 return; 152 } 127 153 gLog << "Sequence: " << fSequence << endl; 128 154 gLog << "Period: " << fPeriod << endl; … … 153 179 } 154 180 155 void MSequence::SetupPedRuns(MDirIter &iter, const char *path) const 156 { 157 SetupRuns(iter, fPedRuns, path); 158 } 159 160 void MSequence::SetupDatRuns(MDirIter &iter, const char *path) const 161 { 162 SetupRuns(iter, fDatRuns, path); 163 } 164 165 void MSequence::SetupAllRuns(MDirIter &iter, const char *path) const 166 { 167 SetupRuns(iter, fRuns, path); 168 } 169 170 void MSequence::SetupCalRuns(MDirIter &iter, const char *path) const 171 { 172 SetupRuns(iter, fCalRuns, path); 173 } 181 // -------------------------------------------------------------------------- 182 // 183 // Add all ped runs from the sequence to MDirIter. 184 // If path==0 the standard path of the data-center is assumed. 185 // If you have the runs locally use path="." 186 // Return the number of files added. 187 // 188 Int_t MSequence::SetupPedRuns(MDirIter &iter, const char *path) const 189 { 190 return SetupRuns(iter, fPedRuns, path); 191 } 192 193 // -------------------------------------------------------------------------- 194 // 195 // Add all data runs from the sequence to MDirIter. 196 // If path==0 the standard path of the data-center is assumed. 197 // If you have the runs locally use path="." 198 // Return the number of files added. 199 // 200 Int_t MSequence::SetupDatRuns(MDirIter &iter, const char *path) const 201 { 202 return SetupRuns(iter, fDatRuns, path); 203 } 204 205 // -------------------------------------------------------------------------- 206 // 207 // Add all runs from the sequence to MDirIter. 208 // If path==0 the standard path of the data-center is assumed. 209 // If you have the runs locally use path="." 210 // Return the number of files added. 211 // 212 Int_t MSequence::SetupAllRuns(MDirIter &iter, const char *path) const 213 { 214 return SetupRuns(iter, fRuns, path); 215 } 216 217 // -------------------------------------------------------------------------- 218 // 219 // Add all calibration runs from the sequence to MDirIter. 220 // If path==0 the standard path of the data-center is assumed. 221 // If you have the runs locally use path="." 222 // Return the number of files added. 223 // 224 Int_t MSequence::SetupCalRuns(MDirIter &iter, const char *path) const 225 { 226 return SetupRuns(iter, fCalRuns, path); 227 } -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r4716 r4722 36 36 37 37 void Split(TString &runs, TArrayI &data) const; 38 voidSetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const;38 Int_t SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path) const; 39 39 40 40 public: … … 45 45 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; } 46 46 47 voidSetupPedRuns(MDirIter &iter, const char *path=0) const;48 voidSetupDatRuns(MDirIter &iter, const char *path=0) const;49 voidSetupAllRuns(MDirIter &iter, const char *path=0) const;50 voidSetupCalRuns(MDirIter &iter, const char *path=0) const;47 Int_t SetupPedRuns(MDirIter &iter, const char *path=0) const; 48 Int_t SetupDatRuns(MDirIter &iter, const char *path=0) const; 49 Int_t SetupAllRuns(MDirIter &iter, const char *path=0) const; 50 Int_t SetupCalRuns(MDirIter &iter, const char *path=0) const; 51 51 52 52 // Getter
Note:
See TracChangeset
for help on using the changeset viewer.