- Timestamp:
- 12/10/07 17:45:36 (17 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8779 r8780 19 19 -*-*- END OF LINE -*-*- 20 20 21 2007/12/03 Stefan Ruegamer 21 2007/12/10 Thomas Bretz 22 23 * mfileio/MReadReports.cc: 24 - due to a tiny misconception the last event in trees was skipped 25 simply because no time-stamp for a next event followed... 26 fixed. 27 28 * mhflux/MAlphaFitter.[h,cc]: 29 - added a new member function FixScale() to fix the scale 30 31 * mhflux/MHAlpha.cc: 32 - replaced the check whether the significance is >1 by a check 33 whether it is >0. 0 means calculation failed. So all 34 valid data points are shown. If no significance could 35 be calculated (negative flux) the data point is omitted. 36 - fixed a few drawing problems, which sometimes suppressed the 37 time-histogram even if it contained valid data (this only 38 affected very very short sequences - with a single time bin) 39 40 * mjobs/MDataSet.[h,cc]: 41 - implemented a possibility to use put the sequence inside the 42 dataset file 43 - improved comments 44 - allow to exclude runs from within the dataset file 45 46 * mjobs/MSequence.[h,cc]: 47 - added a new data member to store excluded runs. This is 48 needed to be able to store everything correctly later. 49 - improved comments 50 - added possibility to exclude previously set runs 51 - added a few member functions to check which runs are contained 52 - comment out some currently obsolete member function 53 - allow to read the resources of a sequence file prefixed 54 this is used in the new option of MDataSet 55 - increased class version number accordingly 56 57 58 59 2007/12/10 Stefan Ruegamer 22 60 23 61 * steps.rc … … 28 66 29 67 68 69 2007/12/03 Stefan Ruegamer 30 70 31 71 * datacenter/script/sourcefile -
trunk/MagicSoft/Mars/NEWS
r8736 r8780 1 1 -*-*- END -*-*- 2 2 3 *** <cvs> 4 3 == <cvs> == 4 5 ;general 6 * fixed GroupBy options in plot*.C macros 7 * only display KVA points (not the Tuorla points) in plotoptical.C 8 * all programs now allow to add resources to the ones from the resource 9 file or overwrite them from the command line. This can be done like this 10 ::ganymed --config=ganymed.rc --rc=Cut1.Param1:0.25 --rc=Cut1.Param3:5.5 11 :if something seems to be wrong you can debug what the program is doing 12 using the option --debug-env=3 13 * increased the diversity of debug levels. That also means that with -v3 14 you get now less output, i.e. only the output which is important for 15 an analysis. To get more output which helps for debugging try 4, 5 and 6. 16 * fixed a problem in the task synchronizing the reading of the reports 17 and the data stream. The effect was that in some circumstances the last 18 events of some trees could have been skipped. Since this is only a 19 very tiny part of the data no severe effect to your analysis results 20 is expected. 21 * Dataset file now allow to include the sequence file directly within 22 the dataset file and also allow to exclude single runs from the dataset. 23 (for more details see Class reference of MDataSet) 24 * Sequence files now allow for excluding runs from the analysis 25 (for more details see Class reference of MSequence) 26 ;ganymed/sponde 27 * Now data points are even shown correctly if they have error bars larger 28 than one sigma. Points with null or negative significances are omitted. 29 ;sponde 30 *fixed resource files ('''Spectrum''' instead of '''MJSpectrum''') 5 31 6 32 … … 48 74 energy) 49 75 50 - general: The Random Forest training of energy (trainenergy.c) and76 - general: The Random Forest training of energy (trainenergy.c) and 51 77 disp (traindisp.C) has been improved by more graphical output to 52 78 judge the result. … … 125 151 as old files read in. 126 152 127 - callisto: The cal libration constants of earlier updates got lost153 - callisto: The calibration constants of earlier updates got lost 128 154 somehow. All constants have been updated. 129 155 -
trunk/MagicSoft/Mars/mfileio/MReadReports.cc
r7838 r8780 317 317 318 318 fPosEntry.Set(i); 319 fPosEntry.Reset(); 319 320 320 321 // Force that with the next call to Process the required events are read … … 415 416 while (fChains->GetSize()) 416 417 { 418 // Find the next tree to read from checking the time-stamps 419 // of the next events which would be read 417 420 const Int_t nmin=FindNext(); 418 421 if (nmin<0) … … 422 425 } 423 426 424 TChain *chain = (TChain*)fChains->At(nmin); 425 426 MTask *task = (MTask*)fTrees->GetList()->At(nmin); 427 428 //Int_t before = chain->GetTreeNumber(); 429 if (chain->GetEntry(++fPosEntry[nmin])>0) 430 { 431 const Int_t rc = task->CallProcess(); 432 if (rc) 433 return rc; 434 } 435 436 *fLog << dbg << "Removing chain " << chain->GetName() << " from list" << flush; 437 438 delete *GetTime(chain); // Delete MTime* 439 *fLog << "." << flush; 440 delete fChains->Remove(chain); // Remove chain from TList 441 *fLog << "." << flush; 442 443 // FIXME: Maybe MTaskList should have a member function to 444 // reorder the tasks? 445 446 // Move this task to the end of the list so that nmin still 447 // corresponds to the correct task in the list. 448 const_cast<TList*>(fTrees->GetList())->Remove(task); 449 *fLog << "." << flush; 450 const_cast<TList*>(fTrees->GetList())->AddLast(task); 451 *fLog << "done." << endl; 452 } 453 454 return kFALSE; 427 // Read the event from this tree 428 MTask *task = static_cast<MTask*>(fTrees->GetList()->At(nmin)); 429 const Int_t rc = task->CallProcess(); 430 431 // Read the time-stamp of the next event 432 TChain *chain = static_cast<TChain*>(fChains->At(nmin)); 433 const Int_t cnt = chain->GetEntry(++fPosEntry[nmin]); 434 435 // In case there is no further time-stamp of an error reading the 436 // event we remove this time-stamp from the list of time-stamps to 437 // be checked for reading the next events, because there is none. 438 if (cnt<=0 || rc==kFALSE) 439 { 440 *fLog << dbg << "Removing chain " << chain->GetName() << " from list" << flush; 441 442 delete *GetTime(chain); // Delete MTime* 443 *fLog << "." << flush; 444 delete fChains->Remove(chain); // Remove chain from TList 445 *fLog << "." << flush; 446 447 // FIXME: Maybe MTaskList should have a member function to 448 // reorder the tasks? 449 450 // Move this task to the end of the list so that nmin still 451 // corresponds to the correct task in the list. 452 const_cast<TList*>(fTrees->GetList())->Remove(task); 453 *fLog << "." << flush; 454 const_cast<TList*>(fTrees->GetList())->AddLast(task); 455 *fLog << "done." << endl; 456 } 457 458 // If something else than kFALSE (means: stop reading from this 459 // tree) has happened we return the return code of the processing 460 if (rc!=kFALSE) 461 return rc; 462 } 463 464 return kFALSE; 455 465 } 456 466 -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r8775 r8780 853 853 fScaleMode = kUserScale; 854 854 if (txt==(TString)"fixed") 855 { 856 fScaleMode = kUserScale; 857 fScaleUser = fScaleFactor; 858 } 855 FixScale(); 859 856 rc = kTRUE; 860 857 } -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r8775 r8780 165 165 void EnableBackgroundFit(Bool_t b=kTRUE) { fFitBackground=b; } 166 166 167 void FixScale() 168 { 169 fScaleMode = kUserScale; 170 fScaleUser = fScaleFactor; 171 } 172 167 173 // Getter 168 174 Double_t GetSignalIntegralMax() const { return fSigInt; } -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r8775 r8780 159 159 for (int i=1; i<=n; i++) 160 160 { 161 if (fit.FitEnergy(fHist, fOffData, i)) 162 { 163 fHEnergy.SetBinContent(i, fit.GetEventsExcess()); 164 if (fit.GetSignificanceExc()>1) 165 fHEnergy.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc()); 166 else 167 fHEnergy.SetBinError(i, fit.GetEventsExcess()); 168 169 if (fit.GetSignificanceExc()>1) 170 { 171 mean += fit.GetSignificanceExc()*fit.GetSignificanceExc(); 172 num++; 173 } 174 } 161 if (!fit.FitEnergy(fHist, fOffData, i)) 162 continue; 163 164 if (fit.GetSignificanceExc()<=0) 165 continue; 166 167 fHEnergy.SetBinContent(i, fit.GetEventsExcess()); 168 fHEnergy.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc()); 169 170 mean += fit.GetSignificanceExc()*fit.GetSignificanceExc(); 171 num++; 175 172 } 176 173 return TMath::Sqrt(mean)/num; … … 188 185 for (int i=1; i<=n; i++) 189 186 { 190 if ( fit.FitTheta(fHist, fOffData, i))191 {192 fHTheta.SetBinContent(i, fit.GetEventsExcess()); 193 if (fit.GetSignificanceExc()>1)194 fHTheta.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc());195 else 196 fHTheta.SetBinError(i, fit.GetEventsExcess());197 }187 if (!fit.FitTheta(fHist, fOffData, i)) 188 continue; 189 190 if (fit.GetSignificanceExc()<=0) 191 continue; 192 193 fHTheta.SetBinContent(i, fit.GetEventsExcess()); 194 fHTheta.SetBinError(i, fit.GetEventsExcess()/fit.GetSignificanceExc()); 198 195 } 199 196 } … … 431 428 // Fill histogram 432 429 // 433 fHTime.SetBinContent(n+1, fit.GetEventsExcess()); 434 if (fit.GetSignificanceExc()>1) 430 if (fit.GetSignificanceExc()>0) 431 { 432 fHTime.SetBinContent(n+1, fit.GetEventsExcess()); 435 433 fHTime.SetBinError(n+1, fit.GetEventsExcess()/fit.GetSignificanceExc()); 436 else 437 fHTime.SetBinError(n+1, fit.GetEventsExcess()); 434 } 438 435 439 436 *fLog << all << *fTimeEffOn << ": " << fit.GetEventsExcess() << endl; … … 735 732 AppendPad("variable"); 736 733 737 if (fHEnergy.GetNbinsX()>1 )734 if (fHEnergy.GetNbinsX()>1 || fHEnergy.GetBinContent(1)>0) 738 735 { 739 736 pad->cd(2); … … 759 756 delete pad->GetPad(2); 760 757 761 if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 )758 if (fTimeEffOn && fTime || fHTime.GetNbinsX()>1 || fHTime.GetBinContent(1)>0) 762 759 { 763 760 pad->cd(3); … … 771 768 delete pad->GetPad(3); 772 769 773 if (fHTheta.GetNbinsX()>1 )770 if (fHTheta.GetNbinsX()>1 || fHTheta.GetBinContent(1)>0) 774 771 { 775 772 pad->cd(4); -
trunk/MagicSoft/Mars/mjobs/MDataSet.cc
r8744 r8780 31 31 // Such an input file looks like: 32 32 // 33 // crab. seq:33 // crab.txt: 34 34 // --------- 35 35 // AnalysisNumber: 1 … … 37 37 // Name: SecondCrab 38 38 // 39 // SequencesOn: 35222 3522939 // SequencesOn: 35222 35229 40 40 // SequencesOff: 36817 41 41 // … … 49 49 // Sequence00036817.Dir: /data2/wuerzburg/Crab-Analyse/images/036817 50 50 // 51 // Sequence00036817.Exclude: 36818 36819 52 // 51 53 // WobbleMode: No 52 54 // MonteCarlo: No … … 55 57 // Catalog: /magic/datacenter/setup/magic_favorites_dc.edb 56 58 // 59 // 60 // Reading the file is based on TEnv. For more details see also 61 // the class reference of TEnv. 62 // 63 // 57 64 // AnalysisNumber: The analysis number is an artifical number used to name 58 // the output files automatically if the names are not overwritten in the59 // corresponding programs.65 // the output files automatically if the names are not overwritten in the 66 // corresponding programs. 60 67 // 61 68 // SequencePath: In case it is not specified the datacenter default path is 62 // used. If it is given it is the place at which the sequence files63 // are searched, if not overwritten by either a program command line64 // option (aka. a argument to the constructor) or a resource for65 // an individual sequence file. Note, that the four digits high-level66 // directories to sort the sequences are added to the given path.69 // used. If it is given it is the place at which the sequence files 70 // are searched, if not overwritten by either a program command line 71 // option (aka. a argument to the constructor) or a resource for 72 // an individual sequence file. Note, that the four digits high-level 73 // directories to sort the sequences are added to the given path. 67 74 // 68 75 // DataPath: In case it is not specified the datacenter default path is 69 // used. If it is given it is the place at which the data files70 // are searched, if not overwritten by either a program command line71 // option (aka. a argument to the constructor) or a resource for72 // an individual data path. Note, that the four digits high-level73 // directories to sort the sequences are added to the given path.76 // used. If it is given it is the place at which the data files 77 // are searched, if not overwritten by either a program command line 78 // option (aka. a argument to the constructor) or a resource for 79 // an individual data path. Note, that the four digits high-level 80 // directories to sort the sequences are added to the given path. 74 81 // 75 82 // SequencesOn/Off: The sequence number are used to concatenate the filenames 76 // of the sequences using the file structure used in the datacenter. Each 77 // sequence can be added to the on and off data at the same time but only 78 // once. 79 // 80 // If you have different file names you can overwrite the default file names 81 // using Sequence%08d.File (make sure you have 8 digits!) 82 // 83 // In standard coditions (datacenter file system) paths are concatenated 84 // by using the information in the sequence files (date, etc). You can 85 // overwrite the directories in which the sequence-files (eg I-files) are 86 // stored using Sequence%08d.Dir (make sure you have 8 digits!) 83 // of the sequences using the file structure used in the datacenter. Each 84 // sequence can be added to the on and off data at the same time but only 85 // once. 86 // 87 // If you have different file names you can overwrite the default file names 88 // using Sequence%08d.File (make sure you have 8 digits!) 89 // 90 // If the file name is given as "-", e.g. 91 // Sequence00035222.File: - 92 // the current dataset file is read as sequence file. In this case all 93 // resources defined for a sequence file should be prefixed by 94 // "Sequence%08d."; if not prefixed the default without the prefix 95 // is looked up. Be aware that the "Sequence" resource for sequence-files 96 // (for more details see MSequence) is ignored and the already defined 97 // number is used instead and thus should be identical to the sequence 98 // number - which normally is not necessary. 99 // 100 // In standard coditions (datacenter file system) paths are concatenated 101 // by using the information in the sequence files (date, etc). You can 102 // overwrite the directories in which the sequence-files (eg I-files) are 103 // stored using Sequence%08d.Dir (make sure you have 8 digits!) 104 // 105 // Using the resource Sequence%08d.Exclude you can exclude a list of 106 // runs from a sequence. 87 107 // 88 108 // WobbleMode: This is just a flag which is passed to the program 89 // end eveluated (or not) by the individual program, which takes this90 // dataset as an input. For example this is necessary in ganymed to do91 // some wobble mode special setup. If no resource is given (or it is92 // set to "auto") wobble mode if set if the datset contains no off-93 // sequences.109 // end eveluated (or not) by the individual program, which takes this 110 // dataset as an input. For example this is necessary in ganymed to do 111 // some wobble mode special setup. If no resource is given (or it is 112 // set to "auto") wobble mode if set if the datset contains no off- 113 // sequences. 94 114 // 95 115 // MonetCarlo: This is just a flag which is passed to the program 96 // end eveluated (or not) by the individual program, which takes this97 // dataset as an input. For example this tells ganymed to skip some98 // parts accessing time stamps which are not available in the MCs.116 // end eveluated (or not) by the individual program, which takes this 117 // dataset as an input. For example this tells ganymed to skip some 118 // parts accessing time stamps which are not available in the MCs. 99 119 // 100 120 // SequencePath/DataPath: This determined were the sequences and data-files 101 // are stored. The priorities are as follows:102 // 0) Build in default path: /magic/sequences /magic/data/star103 // 1) Def.path from dataset file: SequencePath DataPath104 // 2) Indiv.path from dataset file: 12345.SequencePath 12345.DataPath105 // 3) Path from command line: Argument in the constructors106 // 4) Path for an indiv. dataset: Sequences00022555.File/Dir121 // are stored. The priorities are as follows: 122 // 0) Build in default path: /magic/sequences /magic/data/star 123 // 1) Def.path from dataset file: SequencePath DataPath 124 // 2) Indiv.path from dataset file: 12345.SequencePath 12345.DataPath 125 // 3) Path from command line: Argument in the constructors 126 // 4) Path for an indiv. dataset: Sequences00022555.File/Dir 107 127 // 108 128 // Catalog: This is the xephem-style file from the central control 109 // containing the observed sky positions.129 // containing the observed sky positions. 110 130 // 111 131 // SourceName: The source name, as defined in the catalog, of the object 112 // the data corresponds to.132 // the data corresponds to. 113 133 // 114 134 // Name: A name is stored for your convinience … … 261 281 for (int i=0; i<num.GetSize(); i++) 262 282 { 263 TString name = GetEnvValue2(env, prefix, Form("Sequence%08d.File", num[i]), ""); 264 TString dir = GetEnvValue2(env, prefix, Form("Sequence%08d.Dir", num[i]), ""); 283 const TString seqid = Form("Sequence%08d", num[i]); 284 285 TString name = GetEnvValue2(env, prefix, Form("%s.File", seqid.Data()), ""); 286 TString dir = GetEnvValue2(env, prefix, Form("%s.Dir", seqid.Data()), ""); 287 TString excl = GetEnvValue2(env, prefix, Form("%s.Exclude", seqid.Data()), ""); 265 288 266 289 // Set default sequence file and dir name … … 270 293 dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]); 271 294 295 // Check if sequence information is contained in Dataset file 296 const Bool_t useds = name=="-"; 297 272 298 // FIXME: The sequence number from the sequence file is assigned!!! 273 MSequence *seq = new MSequence(name, dir); 299 MSequence *seq = new MSequence(useds?fName:name, dir, num[i]); 300 seq->ExcludeRuns(excl); 274 301 275 302 if (seq->IsValid() && seq->GetSequence()!=(UInt_t)num[i]) … … 436 463 437 464 gLog << "# " << access << " " << seq.GetFileName() << " <" << seq.GetDataPath() << ">" << endl; 465 } 466 467 // -------------------------------------------------------------------------- 468 // 469 // Helper to print a seqeunce in Print() 470 // 471 void MDataSet::PrintSeq(const MSequence &seq) const 472 { 473 const Bool_t useds = seq.GetFileName()==fName; 474 475 gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".File: " << (useds?"-":seq.GetFileName()) << endl; 476 gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".Dir: " << seq.GetDataPath() << endl; 477 if (!useds && seq.GetNumExclRuns()>0) 478 gLog << "Sequence" << Form("%08d", seq.GetSequence()) << ".Exclude: " << seq.GetExcludedRuns() << endl; 479 480 if (useds) 481 { 482 gLog << endl; 483 seq.Print("prefixed"); 484 gLog << endl << "# ---" << endl; 485 } 438 486 } 439 487 … … 478 526 gLog << endl; 479 527 528 // FIXME: If file==fName --> print Sequence0000.content 529 480 530 TIter NextOn(&fSequencesOn); 481 531 TIter NextOff(&fSequencesOff); 482 532 MSequence *seq=0; 483 533 while ((seq=(MSequence*)NextOn())) 484 { 485 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl; 486 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir: " << seq->GetDataPath() << endl; 487 } 534 PrintSeq(*seq); 488 535 if (fSequencesOff.GetEntries()>0) 489 536 gLog << endl; 490 537 while ((seq=(MSequence*)NextOff())) 491 { 492 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".File: " << seq->GetFileName() << endl; 493 gLog << "Sequence" << Form("%08d", seq->GetSequence()) << ".Dir: " << seq->GetDataPath() << endl; 494 } 538 PrintSeq(*seq); 495 539 496 540 if (TString(o).Contains("files", TString::kIgnoreCase)) -
trunk/MagicSoft/Mars/mjobs/MDataSet.h
r8724 r8780 46 46 Bool_t GetWobbleMode(const TEnv &env, const TString &prefix) const; 47 47 static void PrintFile(const MSequence &obj); 48 void PrintSeq(const MSequence &seq) const; 48 49 49 50 // Directory and file handling … … 138 139 const TList &GetSequencesOff() const { return fSequencesOff; } 139 140 141 const TArrayI &GetSequencesNumOn() const { return fNumSequencesOn; } 142 const TArrayI &GetSequencesNumOff() const { return fNumSequencesOff; } 143 140 144 Bool_t AddFiles(MRead &read) const; 141 145 Bool_t AddFilesOn(MRead &read) const; -
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r8744 r8780 18 18 ! Author(s): Thomas Bretz, 8/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2004 20 ! Copyright: MAGIC Software Development, 2004-2007 21 21 ! 22 22 ! … … 28 28 // 29 29 // This class describes a sequence. For sequences see: 30 // http:// magic.astro.uni-wuerzburg.de/mars/db/queryseq.html30 // http://db.astro.uni-wuerzburg.de 31 31 // 32 32 // A sequence is a collection of runs which should be used together. 33 33 // Any run can be contained only once. 34 34 // 35 // Here is an example how a file describing a sequence could look like: 35 // Here is an example how a file describing a sequence could look like. 36 // 37 // Reading the file is based on TEnv. For more details see also 38 // the class reference of TEnv. 36 39 // 37 40 // =========================================================================== … … 40 43 // ------------ 41 44 // 42 // # Sequence number (identifier) 45 // # Sequence number (identifier) - necessary if the path 46 // # contains the sequence number, e.g. image files 43 47 // Sequence: 31015 44 // # Observation Period (used to get the path-names) 48 // 49 // # Observation Period (not needed) 45 50 // Period: 18 46 // # Date of sunrise of the observation night 51 // 52 // # Date of sunrise of the observation night - necessary if the path 53 // # contains the date, e.g. raw data 47 54 // Night: 2004-06-24 48 55 // 49 // # Start time of the sequence (first data run )56 // # Start time of the sequence (first data run, not needed) 50 57 // Start: 2004-06-24 03:12:42 51 // # Run number of last data run in sequence 58 // 59 // # Run number of last data run in sequence (not needed) 52 60 // LastRun: 31032 53 // # Project name of data-runs of sequence 61 // 62 // # Project name of data-runs of sequence (not needed) 54 63 // Project: 3EG2033+41 55 // # Source name of all runs of sequence 64 // 65 // # Source name of all runs of sequence (not needed) 56 66 // Source: 3EG2033+41 57 // # Trigger table of data-runs of sequence 67 // 68 // # Trigger table of data-runs of sequence (not needed) 58 69 // TriggerTable: L1_4NN:L2_DEFAULT 59 // # HV Setting table of data-runs of sequence 70 // 71 // # HV Setting table of data-runs of sequence (not needed) 60 72 // HvSettings: HVSettings_FF36q 61 // # Total number of data-events in sequence 73 // 74 // # Total number of data-events in sequence (not needed) 62 75 // NumEvents: 250914 63 76 // 64 // # List of all runs of this sequence 77 // # Whether this is MC data or not (necessary in case of MCs if 78 // # default paths should be used) 79 // MonteCarlo: Yes 80 // 81 // # List of all runs of this sequence (not needed) 65 82 // Runs: 31015 31016 31017 31018 31019 31020 31021 31022 31023 31024 31025 31026 31027 31028 31029 31030 31031 31032 66 83 // 67 // # List of all calibration runs of this sequence 84 // # List of all calibration runs of this sequence (necessary if accessed) 68 85 // CalRuns: 31015 31016 31017 69 // # List of pedestal runs belonging to the calibration runs of this sequence 86 // # List of pedestal runs belonging to the calibration runs of this sequence (necessary if accessed) 70 87 // PedRuns: 31018 71 // # List of all data runs belonging to this sequence 88 // # List of all data runs belonging to this sequence (necessary) 72 89 // DatRuns: 31019 31020 31022 31023 31024 31025 31027 31028 31030 31032 73 90 // 74 // # List of run types of all runs 75 // 31015: C 76 // 31016: C 77 // 31017: C 78 // 31018: P 79 // 31019: D 80 // 31020: D 81 // 31021: P 82 // 31022: D 83 // 31023: D 84 // 31024: D 85 // 31025: D 86 // 31026: P 87 // 31027: D 88 // 31028: D 89 // 31029: P 90 // 31030: D 91 // 31031: P 92 // 31032: D 91 // # Just for fun ;-) (not needed, but helpful) 92 // Comment: This is a template for a sequence file 93 93 // 94 94 // =========================================================================== … … 125 125 // Class Version 3: 126 126 // + fComment 127 // 128 // Class Version 4: 129 // + fExclRuns 127 130 // 128 131 ///////////////////////////////////////////////////////////////////////////// … … 253 256 d += '/'; 254 257 258 Int_t excluded = 0; 255 259 for (int i=0; i<arr.GetSize(); i++) 256 260 { 261 if (IsExcluded(arr[i])) 262 { 263 excluded++; 264 continue; 265 } 266 257 267 // R. DeLosReyes and T. Bretz 258 268 // Changes to read the DAQ numbering format. Changes takes place … … 325 335 } 326 336 337 // n0: The previous contents of the iter 338 // n1: The number of files which have been added to the iter 339 // n2: The number of files which should have been added from the array 327 340 const Int_t n1 = iter.GetNumEntries()-n0; 328 const Int_t n2 = arr.GetSize() ;341 const Int_t n2 = arr.GetSize()-excluded; 329 342 if (n1==0) 330 343 { … … 386 399 //} 387 400 388 MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env ) const389 { 390 TString str = env.GetValue("LightConditions", "n/a");401 MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env, const char *prefix) const 402 { 403 TString str = GetEnvValue2(env, prefix, "LightConditions", "n/a"); 391 404 if (!str.CompareTo("n/a", TString::kIgnoreCase)) 392 405 return kNA; … … 410 423 // Read the file fname as setup file for the sequence. 411 424 // 412 MSequence::MSequence(const char *fname, const char *path )425 MSequence::MSequence(const char *fname, const char *path, UInt_t seq) 413 426 { 414 427 fName = fname; … … 431 444 MEnv env(fName); 432 445 433 fSequence = env.GetValue("Sequence", -1);446 fSequence = (UInt_t)env.GetValue("Sequence", (Int_t)seq); 434 447 if (rc1 || rc2) 435 448 fSequence = (UInt_t)-1; 436 449 437 fLastRun = env.GetValue("LastRun", -1); 438 fNumEvents = env.GetValue("NumEvents", -1); 439 fPeriod = env.GetValue("Period", -1); 440 441 fLightCondition = ReadLightCondition(env); 450 const TString prefix = Form("Sequence%08d", fSequence); 451 452 fLastRun = GetEnvValue2(env, prefix, "LastRun", -1); 453 fNumEvents = GetEnvValue2(env, prefix, "NumEvents", -1); 454 fPeriod = GetEnvValue2(env, prefix, "Period", -1); 455 456 fLightCondition = ReadLightCondition(env, prefix); 442 457 443 458 TString str; 444 str = env.GetValue("Start", "");459 str = GetEnvValue2(env, prefix, "Start", ""); 445 460 fStart.SetSqlDateTime(str); 446 str = env.GetValue("Night", "");461 str = GetEnvValue2(env, prefix, "Night", ""); 447 462 str += " 00:00:00"; 448 463 fNight.SetSqlDateTime(str); 449 464 450 fProject = env.GetValue("Project", "");451 fSource = env.GetValue("Source", "");452 fTriggerTable = env.GetValue("TriggerTable", "");453 fHvSettings = env.GetValue("HvSettings", "");454 fMonteCarlo = env.GetValue("MonteCarlo", kFALSE);455 fComment = env.GetValue("Comment", "");456 457 str = env.GetValue("Runs", "");465 fProject = GetEnvValue2(env, prefix, "Project", ""); 466 fSource = GetEnvValue2(env, prefix, "Source", ""); 467 fTriggerTable = GetEnvValue2(env, prefix, "TriggerTable", ""); 468 fHvSettings = GetEnvValue2(env, prefix, "HvSettings", ""); 469 fMonteCarlo = GetEnvValue2(env, prefix, "MonteCarlo", kFALSE); 470 fComment = GetEnvValue2(env, prefix, "Comment", ""); 471 472 str = GetEnvValue2(env, prefix, "Runs", ""); 458 473 Split(str, fRuns); 459 str = env.GetValue("CalRuns", "");474 str = GetEnvValue2(env, prefix, "CalRuns", ""); 460 475 Split(str, fCalRuns); 461 str = env.GetValue("PedRuns", "");476 str = GetEnvValue2(env, prefix, "PedRuns", ""); 462 477 Split(str, fPedRuns); 463 str = env.GetValue("DatRuns", "");478 str = GetEnvValue2(env, prefix, "DatRuns", ""); 464 479 Split(str, fDatRuns); 480 str = GetEnvValue2(env, prefix, "Exclude", ""); 481 Split(str, fExclRuns); 465 482 466 483 // GetFileNames(env, fRuns); … … 470 487 471 488 // Dummies: 472 env. GetValue("ZdMin", 0);473 env. GetValue("ZdMax", 0);474 env. GetValue("L1TriggerTable", 0);475 env. GetValue("L2TriggerTable", 0);476 477 if ( env.GetNumUntouched()>0)478 { 479 gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl;489 env.Touch("ZdMin"); 490 env.Touch("ZdMax"); 491 env.Touch("L1TriggerTable"); 492 env.Touch("L2TriggerTable"); 493 494 if (seq<0 && env.GetNumUntouched()>0) 495 { 496 gLog << warn << "WARNING - At least one resource in the sequence-file has not been touched!" << endl; 480 497 env.PrintUntouched(); 481 498 } … … 492 509 } 493 510 494 495 511 // -------------------------------------------------------------------------- 496 512 // … … 499 515 void MSequence::Print(Option_t *o) const 500 516 { 517 const TString pre = TString(o).Contains("prefixed") ? Form("Sequence%08d.", fSequence) : ""; 518 501 519 gLog << all; 502 520 if (!IsValid()) 503 521 { 504 gLog << "Sequence: " << fFileName << " <invalid>" << endl;522 gLog << pre << "Sequence: " << fFileName << " <invalid>" << endl; 505 523 return; 506 524 } … … 508 526 gLog << "# Name: " << GetName() << endl; 509 527 gLog << endl; 510 gLog << "Sequence: " << fSequence << endl; 528 if (pre.IsNull()) 529 gLog << "Sequence: " << fSequence << endl; 511 530 if (fMonteCarlo) 512 gLog << "MonteCarlo: Yes" << endl;513 gLog << "Period: " << fPeriod << endl;514 gLog << "Night: " << fNight << endl << endl;515 gLog << "LightCondition: ";531 gLog << pre << "MonteCarlo: Yes" << endl; 532 gLog << pre <<"Period: " << fPeriod << endl; 533 gLog << pre << "Night: " << fNight << endl << endl; 534 gLog << pre << "LightCondition: "; 516 535 switch (fLightCondition) 517 536 { … … 522 541 case kDay: gLog << "Day" << endl; break; 523 542 } 524 gLog << "Start: " << fStart << endl; 525 gLog << "LastRun: " << fLastRun << endl; 526 gLog << "NumEvents: " << fNumEvents << endl; 527 gLog << "Project: " << fProject << endl; 528 gLog << "Source: " << fSource << endl; 529 gLog << "TriggerTable: " << fTriggerTable << endl; 530 gLog << "HvSettings: " << fHvSettings << endl << endl; 531 gLog << "Runs:"; 532 for (int i=0; i<fRuns.GetSize(); i++) 533 gLog << " " << fRuns[i]; 534 gLog << endl; 535 gLog << "CalRuns:"; 536 for (int i=0; i<fCalRuns.GetSize(); i++) 537 gLog << " " << fCalRuns[i]; 538 gLog << endl; 539 gLog << "PedRuns:"; 540 for (int i=0; i<fPedRuns.GetSize(); i++) 541 gLog << " " << fPedRuns[i]; 542 gLog << endl; 543 gLog << "DatRuns:"; 544 for (int i=0; i<fDatRuns.GetSize(); i++) 545 gLog << " " << fDatRuns[i]; 546 gLog << endl; 547 543 gLog << pre << "Start: " << fStart << endl; 544 gLog << pre << "LastRun: " << fLastRun << endl; 545 gLog << pre << "NumEvents: " << fNumEvents << endl; 546 gLog << pre << "Project: " << fProject << endl; 547 gLog << pre << "Source: " << fSource << endl; 548 gLog << pre << "TriggerTable: " << fTriggerTable << endl; 549 gLog << pre << "HvSettings: " << fHvSettings << endl << endl; 550 if (fRuns.GetSize()>0) 551 { 552 gLog << pre << "Runs:"; 553 for (int i=0; i<fRuns.GetSize(); i++) 554 gLog << " " << fRuns[i]; 555 gLog << endl; 556 } 557 if (fCalRuns.GetSize()>0) 558 { 559 gLog << pre << "CalRuns:"; 560 for (int i=0; i<fCalRuns.GetSize(); i++) 561 gLog << " " << fCalRuns[i]; 562 gLog << endl; 563 } 564 if (fPedRuns.GetSize()>0) 565 { 566 gLog << pre << "PedRuns:"; 567 for (int i=0; i<fPedRuns.GetSize(); i++) 568 gLog << " " << fPedRuns[i]; 569 gLog << endl; 570 } 571 if (fDatRuns.GetSize()>0) 572 { 573 gLog << pre << "DatRuns:"; 574 for (int i=0; i<fDatRuns.GetSize(); i++) 575 gLog << " " << fDatRuns[i]; 576 gLog << endl; 577 } 578 if (fExclRuns.GetSize()>0) 579 { 580 gLog << pre << "Exclude:"; 581 for (int i=0; i<fExclRuns.GetSize(); i++) 582 gLog << " " << fExclRuns[i]; 583 gLog << endl; 584 } 548 585 if (!fDataPath.IsNull()) 549 gLog << endl << "DataPath: " << fDataPath << endl; 550 551 gLog << endl << "Comment: " << fComment << endl; 552 586 gLog << endl << pre << "DataPath: " << fDataPath << endl; 587 588 gLog << endl << pre << "Comment: " << fComment << endl; 553 589 } 554 590 … … 562 598 // Return the number of files added. 563 599 // 600 // Runs which are in fExlRuns are ignored. 601 // 564 602 UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const 565 603 { … … 576 614 // Return the number of files added. 577 615 // 616 // Runs which are in fExlRuns are ignored. 617 // 578 618 UInt_t MSequence::SetupDatRuns(MDirIter &iter, const char *path, Bool_t raw) const 579 619 { … … 590 630 // Return the number of files added. 591 631 // 632 // Runs which are in fExlRuns are ignored. 633 // 592 634 UInt_t MSequence::SetupAllRuns(MDirIter &iter, const char *path, Bool_t raw) const 593 635 { … … 604 646 // Return the number of files added. 605 647 // 648 // Runs which are in fExlRuns are ignored. 649 // 606 650 UInt_t MSequence::SetupCalRuns(MDirIter &iter, const char *path, Bool_t raw) const 607 651 { … … 618 662 // Return the number of files added. 619 663 // 664 // Runs which are in fExlRuns are ignored. 665 // 620 666 UInt_t MSequence::SetupDatRuns(MDirIter &iter, FileType_t type, const char *path) const 621 667 { … … 653 699 fRuns[nall+i] = first+i; 654 700 if (runs) 655 (*runs)[nrun+i] 701 (*runs)[nrun+i] = first+i; 656 702 } 657 703 return add; 704 } 705 706 Bool_t MSequence::IsContained(const TArrayI &arr, UInt_t run) const 707 { 708 for (int i=0; i<arr.GetSize(); i++) 709 if (run==(UInt_t)arr[i]) 710 return kTRUE; 711 return kFALSE; 712 } 713 714 /* 715 // -------------------------------------------------------------------------- 716 // 717 // Check if num is found in arr. If it is found remove it. Copy all 718 // following entries one back and decrease the array size by 1. 719 // 720 void MSequence::ExcludeRun(TArrayI &arr, UInt_t num) 721 { 722 UInt_t *ptr = (UInt_t*)arr.GetArray(); 723 724 Int_t i = 0; 725 for (i=0; i<arr.GetSize(); i++) 726 if (ptr[i]==num) 727 break; 728 729 if (i==arr.GetSize()) 730 return; 731 732 for (; i<arr.GetSize()-1; i++) 733 ptr[i] = ptr[i+1]; 734 735 arr.Set(arr.GetSize()-1); 736 } 737 */ 738 739 // -------------------------------------------------------------------------- 740 // 741 // Exclude this run (i.e. add it to fExclRuns) 742 // 743 void MSequence::ExcludeRun(UInt_t num) 744 { 745 /* 746 ExcludeRun(fRuns, num); 747 ExcludeRun(fCalRuns, num); 748 ExcludeRun(fPedRuns, num); 749 ExcludeRun(fDatRuns, num); 750 */ 751 752 if (IsExcluded(num)) 753 return; 754 755 // set new entry 756 const Int_t n = fExclRuns.GetSize(); 757 fExclRuns.Set(n+1); 758 fExclRuns[n] = num; 759 760 MJob::SortArray(fExclRuns); 761 } 762 763 // -------------------------------------------------------------------------- 764 // 765 // Exclude all runs which are found in the list, e.g. "100 102 105" 766 // 767 void MSequence::ExcludeRuns(TString runs) 768 { 769 TArrayI data; 770 Split(runs, data); 771 772 for (int i=0; i<data.GetSize(); i++) 773 ExcludeRun(data[i]); 774 } 775 776 const TString MSequence::GetExcludedRuns() const 777 { 778 TString rc; 779 for (int i=0; i<fExclRuns.GetSize(); i++) 780 { 781 rc += fExclRuns[i]; 782 rc += " "; 783 } 784 return rc(0, rc.Length()-1); 658 785 } 659 786 … … 698 825 return kFALSE; 699 826 } 827 -
trunk/MagicSoft/Mars/mjobs/MSequence.h
r8695 r8780 52 52 TArrayI fDatRuns; 53 53 54 TArrayI fExclRuns; 55 54 56 Bool_t fMonteCarlo; 55 57 … … 58 60 void Split(TString &runs, TArrayI &data) const; 59 61 //void GetFileNames(TEnv &env, const TArrayI &arr); 60 LightCondition_t ReadLightCondition(TEnv &env) const; 62 63 LightCondition_t ReadLightCondition(TEnv &env, const char *prefix) const; 61 64 62 65 const char *GetFileName(UInt_t num); … … 65 68 UInt_t SetupRuns(MDirIter &iter, const TArrayI &arr, FileType_t type, const char *path=0) const; 66 69 UInt_t AddRuns(UInt_t first, UInt_t last, TArrayI *runs); 70 void ExcludeRun(TArrayI &arr, UInt_t num); 71 Bool_t IsContained(const TArrayI &arr, UInt_t num) const; 67 72 68 73 public: 69 74 MSequence() : fSequence((UInt_t)-1), fLastRun((UInt_t)-1), 70 75 fNumEvents((UInt_t)-1), fPeriod((UInt_t)-1), fMonteCarlo(kFALSE) { } 71 MSequence(const char *fname, const char *path="" );76 MSequence(const char *fname, const char *path="", UInt_t id=(UInt_t)-1); 72 77 MSequence(const MSequence &s) : fSequence(s.fSequence), fStart(s.fStart), 73 78 fLastRun(s.fLastRun), fNumEvents(s.fNumEvents), fPeriod(s.fPeriod), … … 88 93 Bool_t IsValid() const { return fSequence!=(UInt_t)-1; } 89 94 Bool_t IsMonteCarlo() const { return fMonteCarlo; } 95 Bool_t IsExcluded(UInt_t run) const { return IsContained(fExclRuns, run); } 96 Bool_t IsContained(UInt_t run) const { return IsContained(fCalRuns, run) || IsContained(fPedRuns, run) || IsContained(fDatRuns, run); } 90 97 91 98 void SetMonteCarlo(Bool_t ismc=kTRUE) { fMonteCarlo=ismc; } … … 102 109 UInt_t SetupCalRuns(MDirIter &iter, FileType_t type, const char *path=0); 103 110 */ 111 104 112 // Getter 105 UInt_t GetNumAllRuns() const { return fRuns.GetSize(); } 106 UInt_t GetNumDatRuns() const { return fDatRuns.GetSize(); } 107 UInt_t GetNumPedRuns() const { return fPedRuns.GetSize(); } 108 UInt_t GetNumCalRuns() const { return fCalRuns.GetSize(); } 113 // UInt_t GetNumAllRuns() const { return fRuns.GetSize(); } 114 // UInt_t GetNumDatRuns() const { return fDatRuns.GetSize(); } 115 // UInt_t GetNumPedRuns() const { return fPedRuns.GetSize(); } 116 // UInt_t GetNumCalRuns() const { return fCalRuns.GetSize(); } 117 UInt_t GetNumExclRuns() const { return fExclRuns.GetSize(); } 109 118 110 119 UInt_t GetSequence() const { return fSequence; } … … 117 126 const UInt_t GetFirstCalRun() const { return fCalRuns[0]; } 118 127 const UInt_t GetLastCalRun() const { return fCalRuns[fCalRuns.GetSize()-1]; } 119 const TArrayI &GetPedRuns() const { return fPedRuns; } 120 const TArrayI &GetCalRuns() const { return fCalRuns; } 121 const TArrayI &GetDatRuns() const { return fDatRuns; } 128 // const TArrayI &GetDatRuns() const { return fDatRuns; } 129 // const TArrayI &GetPedRuns() const { return fPedRuns; } 130 // const TArrayI &GetCalRuns() const { return fCalRuns; } 131 const TArrayI &GetExclRuns() const { return fExclRuns; } 122 132 123 133 const MTime &GetStart() const { return fStart; } … … 129 139 const TString &GetFileName() const { return fFileName; } 130 140 const TString &GetDataPath() const { return fDataPath; } 141 142 const TString GetExcludedRuns() const; 131 143 132 144 // Setter … … 143 155 UInt_t AddDatRuns(UInt_t num) { return AddDatRuns(num, num); } 144 156 157 void ExcludeRun(UInt_t num); 158 void ExcludeRuns(TString runs); 159 145 160 static Bool_t InflatePath(TString &seq, Bool_t ismc=kFALSE); 146 161 147 ClassDef(MSequence, 3)162 ClassDef(MSequence, 4) 148 163 }; 149 164
Note:
See TracChangeset
for help on using the changeset viewer.