Changeset 9441 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 05/10/09 11:52:17 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJSimulation.cc
r9428 r9441 62 62 63 63 #include "MArgs.h" 64 //#include "MDirIter.h"64 #include "MDirIter.h" 65 65 #include "MParList.h" 66 66 #include "MTaskList.h" … … 126 126 // 127 127 MJSimulation::MJSimulation(const char *name, const char *title) 128 : fForceMode(kFALSE), fCamera(kTRUE) ,fForceTrigger(kFALSE) 128 : fForceMode(kFALSE), fCamera(kTRUE), fForceTrigger(kFALSE), 129 fOperationMode(kModeData) 129 130 { 130 131 fName = name ? name : "MJSimulation"; … … 140 141 return kTRUE; 141 142 } 142 143 Bool_t MJSimulation::WriteResult(const MParList &plist) 143 /* 144 TString MJSimulation::GetOutFile(const MSequence &seq) const 145 { 146 return seq.IsValid() ? Form("ceres%08d.root", seq.GetSequence()) : "ceres.root"; 147 } 148 */ 149 150 Bool_t MJSimulation::WriteResult(const MParList &plist, const MSequence &seq) 144 151 { 145 152 if (fPathOut.IsNull()) … … 151 158 TObjArray cont; 152 159 cont.Add(const_cast<TEnv*>(GetEnv())); 153 //cont.Add(const_cast<MSequence*>(&fSequence)); 160 if (seq.IsValid()) 161 cont.Add(const_cast<MSequence*>(&seq)); 154 162 155 163 cont.Add(plist.FindObject("PulseShape")); … … 160 168 if (fDisplay) 161 169 { 162 // TString title = "-- Reflector: "; 163 // title += fSequence.GetSequence(); 164 // title += " --"; 165 // fDisplay->SetTitle(title, kFALSE); 170 TString title = "-- Ceres"; 171 if (seq.IsValid()) 172 { 173 title += ": "; 174 title += seq.GetSequence(); 175 } 176 title += " --"; 166 177 fDisplay->SetTitle("Ceres", kFALSE); 167 178 … … 169 180 } 170 181 171 // const TString oname = Form("reflector%08d.root", fSequence.GetSequence()); 172 const TString oname = "ceres.root"; 173 return WriteContainer(cont, oname, "RECREATE"); 182 const TString name = seq.IsValid() ? Form("ceres%08d.root", seq.GetSequence()) : "ceres.root"; 183 return WriteContainer(cont, name, "RECREATE"); 174 184 } 175 185 … … 235 245 } 236 246 237 Bool_t MJSimulation::Process(const MArgs &args )247 Bool_t MJSimulation::Process(const MArgs &args, const MSequence &seq) 238 248 { 239 249 /* … … 245 255 */ 246 256 247 //if (!HasWritePermission(GetPathOut()))248 //return kFALSE;257 // if (!HasWritePermission(CombinePath(fPathOut, GetOutFile(seq)))) 258 // return kFALSE; 249 259 250 260 *fLog << inf; … … 254 264 return kFALSE; 255 265 256 *fLog << warn << "FIXME: Monte Carlo simulation: Sequences not supported yet."; 257 //*fLog << fSequence.GetFileName() << endl; 266 if (seq.IsValid()) 267 *fLog << fSequence.GetFileName() << endl; 268 else 269 *fLog << args.GetNumArguments() << "-files" << endl; 258 270 *fLog << endl; 259 271 272 MDirIter iter; 273 if (seq.IsValid() && seq.GetRuns(iter, MSequence::kCorsika)<=0) 274 { 275 *fLog << err << "ERROR - Sequence valid but without files." << endl; 276 return kFALSE; 277 } 278 260 279 // -------------------------------------------------------------------------------- 261 262 //MDirIter iter;263 //if (fSequence.GetRuns(iter, MSequence::kCalibrated)<=0)264 // return kFALSE;265 280 266 281 // Setup Parlist … … 297 312 //header.InitFadcType(3); 298 313 299 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData); 300 if (args.GetNumArguments()==1) 301 { 302 if (!args.GetArgumentStr(0).CompareTo("pedestal", TString::kIgnoreCase)) 303 { 304 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal); 305 header.SetSourceInfo("Pedestal"); 306 } 307 if (!args.GetArgumentStr(0).CompareTo("calibration", TString::kIgnoreCase)) 308 { 309 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration); 310 header.SetSourceInfo("Calibration"); 311 } 312 if (!args.GetArgumentStr(0).CompareTo("pointrun", TString::kIgnoreCase)) 313 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun); 314 switch (fOperationMode) 315 { 316 case kModeData: 317 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTData); 318 break; 319 320 case kModePed: 321 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPedestal); 322 header.SetSourceInfo("Pedestal"); 323 break; 324 325 case kModeCal: 326 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTCalibration); 327 header.SetSourceInfo("Calibration"); 328 break; 329 330 case kModePointRun: 331 header.SetRunType(MRawRunHeader::kRTMonteCarlo|MRawRunHeader::kRTPointRun); 332 break; 314 333 } 315 334 … … 333 352 read.SetForceMode(fForceMode); 334 353 335 for (int i=0; i<args.GetNumArguments(); i++) 336 read.AddFile(args.GetArgumentStr(i)); 354 if (!seq.IsValid()) 355 { 356 for (int i=0; i<args.GetNumArguments(); i++) 357 read.AddFile(args.GetArgumentStr(i)); 358 } 359 else 360 read.AddFiles(iter); 337 361 338 362 MSimMMCS simmmcs; … … 366 390 // ------------------------------------------------------------------- 367 391 368 MBinning binse( 1 00, 1, 100000, "BinningEnergy", "log");369 MBinning binsth( 70, 0.9, 900000, "BinningThreshold", "log");370 MBinning binsee( 3 5, 0.9, 900000, "BinningEnergyEst", "log");392 MBinning binse( 120, 1, 1000000, "BinningEnergy", "log"); 393 MBinning binsth( 60, 0.9, 900000, "BinningThreshold", "log"); 394 MBinning binsee( 36, 0.9, 900000, "BinningEnergyEst", "log"); 371 395 MBinning binss( 100, 1, 10000000, "BinningSize", "log"); 372 396 // MBinning binsi( 100, -500, 500, "BinningImpact"); 373 MBinning binsi( 55, 0, 1100, "BinningImpact");397 MBinning binsi( 32, 0, 800, "BinningImpact"); 374 398 MBinning binsh( 150, 0, 50, "BinningHeight"); 375 399 MBinning binsaz(720, -360, 360, "BinningAz"); 376 400 MBinning binszd( 70, 0, 70, "BinningZd"); 377 MBinning binsvc( 45, 0, 9, "BinningViewCone");401 MBinning binsvc( 35, 0, 7, "BinningViewCone"); 378 402 MBinning binsel(150, 0, 50, "BinningTotLength"); 379 403 MBinning binsew(150, 0, 15, "BinningMedLength"); … … 845 869 //------------------------------------------- 846 870 847 if (!WriteResult(plist ))871 if (!WriteResult(plist, seq)) 848 872 return kFALSE; 849 873 -
trunk/MagicSoft/Mars/mjobs/MJSimulation.h
r9343 r9441 9 9 class MArgs; 10 10 class MParList; 11 class MSequence; 11 12 class MWriteRootFile; 12 13 13 14 class MJSimulation : public MJob 14 15 { 16 public: 17 enum Mode_t { kModeData, kModePed, kModeCal, kModePointRun }; 18 15 19 private: 16 20 Bool_t fForceMode; // Force execution even if RUNE-section was not foundm … … 19 23 Bool_t fForceTrigger; // Force the use of the trigger "electronics" 20 24 21 Bool_t WriteResult(const MParList &plist); 25 Int_t fOperationMode; // Operation mode (data, ped, cal, pointrun) 26 27 Bool_t WriteResult(const MParList &plist, const MSequence &seq); 22 28 Bool_t CheckEnvLocal(); 23 29 … … 30 36 void SetForceMode(Bool_t force=kTRUE) { fForceMode = force; } 31 37 38 void SetMode(Int_t mode) { fOperationMode = mode; } 39 32 40 // Process 33 Bool_t Process(const MArgs &args );41 Bool_t Process(const MArgs &args, const MSequence &seq); 34 42 35 43 ClassDef(MJSimulation, 0) // Job to run the simulation (ceres) -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r9333 r9441 447 447 TString MSequence::InflateFileName(const MTime &night, UShort_t tel, Int_t run, Int_t file, Int_t type) 448 448 { 449 if (!night && type==kCorsika) 450 return MString::Format("cer%06d", -run); 451 449 452 const char *id="_"; 450 453 switch ((RunType_t)(type&kRunType)) … … 711 714 const TArrayI *r=0, *f=0; 712 715 GetArrays(r, f, type); 713 return GetRuns(iter, *r, *f, type, path);716 return r==0 ? 0 : GetRuns(iter, *r, *f, type, path); 714 717 } 715 718 … … 859 862 const Bool_t rc = !fDataPath.IsNull() && gSystem->AccessPathName(fDataPath, kFileExists); 860 863 if (rc) 861 gLog << err << "ERROR - Directory '" << path << "' doesn't exist." << endl;864 gLog << err << "ERROR - Directory '" << fDataPath << "' doesn't exist." << endl; 862 865 863 866 return !rc; … … 942 945 // 943 946 MSequence::MSequence(const char *fname, const char *path, UInt_t seq) 944 { 947 : fTelescope(1), fSequence((UInt_t)-1), fLastRun((UInt_t)-1), 948 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fLightCondition(kNA), 949 fMonteCarlo(kFALSE) 950 { 951 fName = "MSequence"; 952 fTitle = "Sequence file"; 953 954 if (TString(fname).IsNull() && TString(path).IsNull() && seq==(UInt_t)-1) 955 return; 956 945 957 // regular expression to distinguish beween a mysql-path and 946 958 // a filename from where the sequence should be retrieved … … 951 963 const Bool_t rc1 = db.IsNull() ? ReadFile(fname, seq) : ReadDatabase(fname, seq); 952 964 const Bool_t rc2 = SetDataPath(path); 953 954 fName = "MSequence";955 fTitle = "Sequence file";956 965 957 966 if (!rc1 || !rc2) … … 1353 1362 out << pre << "Night: " << fNight.GetStringFmt("%Y-%m-%d") << endl; 1354 1363 out << endl; 1355 out << pre << "LightCondition: "; 1356 switch (fLightCondition) 1357 { 1358 case kNA: out << "n/a" << endl; break; 1359 case kNoMoon: out << "NoMoon" << endl; break; 1360 case kTwilight: out << "Twilight" << endl; break; 1361 case kMoon: out << "Moon" << endl; break; 1362 case kDay: out << "Day" << endl; break; 1364 if (fLightCondition!=kNA) 1365 { 1366 out << pre << "LightCondition: "; 1367 switch (fLightCondition) 1368 { 1369 case kNA: out << "n/a" << endl; break; 1370 case kNoMoon: out << "NoMoon" << endl; break; 1371 case kTwilight: out << "Twilight" << endl; break; 1372 case kMoon: out << "Moon" << endl; break; 1373 case kDay: out << "Day" << endl; break; 1374 } 1363 1375 } 1364 1376 1365 1377 if (fStart!=MTime()) 1366 1378 out << pre << "Start: " << fStart.GetSqlDateTime() << endl; 1367 if (fLastRun >=0)1379 if (fLastRun!=(UInt_t)-1) 1368 1380 out << pre << "LastRun: " << fLastRun << endl; 1369 if (fNumEvents >=0)1381 if (fNumEvents!=(UInt_t)-1) 1370 1382 out << pre << "NumEvents: " << fNumEvents << endl; 1371 1383 if (!fProject.IsNull()) -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r9039 r9441 23 23 kRoot =BIT(1), 24 24 kReport=BIT(2), 25 kCer =BIT(3), // Corsika files 25 26 }; 26 27 enum RunType_t { 27 kPed =BIT( 3),28 kCal =BIT( 4),29 kDat =BIT( 5),30 kExcl =BIT( 6),28 kPed =BIT(4), // Don't use overlapping bits! 29 kCal =BIT(5), 30 kDat =BIT(6), 31 kExcl =BIT(7), 31 32 kAll =kPed|kDat|kCal, 32 kImage =BIT( 7),33 kCalib =BIT( 8)33 kImage =BIT(8), 34 kCalib =BIT(9) 34 35 }; 35 36 36 37 enum { kRunType = kPed|kCal|kDat|kImage|kCalib }; 37 enum { kFileType = kRaw|kRoot|kReport };38 enum { kFileType = kRaw|kRoot|kReport|kCer }; 38 39 enum { kFilePaths = kFileType|kImage|kCalib }; 39 40 … … 53 54 kCalibrated = kRoot |kCalib, 54 55 kImages = kRoot |kImage, 56 kCorsika = kCer |kDat, 55 57 }; 56 58 … … 131 133 132 134 public: 135 /* 133 136 MSequence() : fTelescope(1), fSequence((UInt_t)-1), fLastRun((UInt_t)-1), 134 137 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fLightCondition(kNA), fMonteCarlo(kFALSE) … … 137 140 fTitle = "Sequence file"; 138 141 } 139 MSequence(const char *fname, const char *path="", UInt_t id=(UInt_t)-1); 142 */ 143 MSequence(const char *fname=0, const char *path=0, UInt_t id=(UInt_t)-1); 140 144 MSequence(const char *fname, UInt_t seq, UShort_t tel=0); 141 145 MSequence(const MSequence &s) : MParContainer(s),
Note:
See TracChangeset
for help on using the changeset viewer.