Changeset 5160 for trunk/MagicSoft/Mars
- Timestamp:
- 10/01/04 19:02:30 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5157 r5160 50 50 * mjobs/MJob.cc: 51 51 - fixed a typo in an output 52 53 * callisto.cc: 54 - removed "-mc" option (now autodetected) 55 --> to be done in the other jobs, too 56 57 * mfileio/MRead.[h,cc], mfileio/MReadMarsFile.[h,cc], 58 mfileio/MReadTree.[h,cc], mjobs/MJCalibrateSignal.[h,cc], 59 mraw/MRawFileRead.[h,cc]: 60 - implemented IsFileValid as a first step to file auto-detection 52 61 53 62 -
trunk/MagicSoft/Mars/callisto.cc
r4906 r5160 50 50 gLog << " -c Calculate the calibration constants" << endl; 51 51 gLog << " -y Extract and calibrate signal" << endl << endl; 52 gLog << " Input File Options:" << endl;53 gLog << " -mc You must use this for MC files (PRELIMINARY)" << endl << endl;54 52 gLog << " Options:" << endl; 55 53 gLog.Usage(); … … 123 121 const Bool_t kOverwrite = arg.HasOnlyAndRemove("-f"); 124 122 const Bool_t kForceExec = arg.HasOnlyAndRemove("-ff"); 125 const Bool_t kIsMC = arg.HasOnlyAndRemove("-mc");126 123 127 124 const TString kInpathD = arg.GetStringAndRemove("--ind=", ""); … … 377 374 378 375 // Where to search for calibration files 379 if (!job2.ProcessFile(job1.GetPedestalCam() , kIsMC))376 if (!job2.ProcessFile(job1.GetPedestalCam())) 380 377 return -1; 381 378 -
trunk/MagicSoft/Mars/mfileio/MRead.cc
r4601 r5160 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // //27 // MRead //28 // //29 // Base class for all reading tasks //30 // //31 // You can set a selector. Depending on the impelementation in the derived //32 // class it can be used to skip events, if the filter return kFALSE. //33 // Make sure that the selector (filter) doesn't need information which //34 // doesn't exist before reading an event! //35 // //26 // 27 // MRead 28 // 29 // Base class for all reading tasks 30 // 31 // You can set a selector. Depending on the impelementation in the derived 32 // class it can be used to skip events, if the filter return kFALSE. 33 // Make sure that the selector (filter) doesn't need information which 34 // doesn't exist before reading an event! 35 // 36 36 ///////////////////////////////////////////////////////////////////////////// 37 37 #include "MRead.h" 38 39 #include <TSystem.h> 38 40 39 41 #include "MLog.h" … … 119 121 return i!=0; 120 122 } 123 124 // -------------------------------------------------------------------------- 125 // 126 // Check if the file exists and has read permission. Derived classes 127 // should also check whether its file type is correct. 128 // 129 // Returning 0 means: file doesn't exist. 130 // A returned number corresponds to different file types (1 if only 131 // one exists) 132 // 133 Byte_t MRead::IsFileValid(const char *name) 134 { 135 return !gSystem->AccessPathName(name, kFileExists) ? 1 : 0; 136 } -
trunk/MagicSoft/Mars/mfileio/MRead.h
r4694 r5160 21 21 virtual Bool_t Rewind(); 22 22 23 static Byte_t IsFileValid(const char *name); 24 23 25 void SetSelector(MFilter *f) { fSelector = f; } 24 26 MFilter *GetSelector() { return fSelector; } -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r4694 r5160 18 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // //27 // MReadMarsFile //28 // //29 // This task works more or less like MReadTree, but in addition PreProcess //30 // reads all the information from the 'RunHeader' tree. //31 // //32 // Warning: Until now this works only for 'one run header per file' //33 // //26 // 27 // MReadMarsFile 28 // 29 // This task works more or less like MReadTree, but in addition PreProcess 30 // reads all the information from the 'RunHeader' tree. 31 // 32 // Warning: Until now this works only for 'one run header per file' 33 // 34 34 ///////////////////////////////////////////////////////////////////////////// 35 35 #include "MReadMarsFile.h" 36 37 #include <fstream> 38 39 #include <TFile.h> 40 #include <TTree.h> 36 41 37 42 #include "MLog.h" … … 92 97 { 93 98 delete fRun; 99 } 100 101 Byte_t MReadMarsFile::IsFileValid(const char *name) 102 { 103 ifstream fin(name); 104 if (!fin) 105 return 0; 106 107 Char_t c[4]; 108 fin.read(c, 4); 109 if (!fin) 110 return 0; 111 112 if (!(c[0]=='r'&& c[1]=='o' && c[2]=='o' && c[3]=='t')) 113 return 0; 114 115 TFile f(name, "READ"); 116 117 TTree *t = (TTree*)f.Get("Events"); 118 if (!t) 119 return 0; 120 121 // FIXME: Replace numbers by enum! Maybe use bits? 122 if (t->FindBranch("MRawEvtData.")) 123 return t->FindBranch("MMcEvt.") ? 2 : 1; 124 125 if (t->FindBranch("MCerPhotEvt.")) 126 return t->FindBranch("MMcEvt.") ? 4 : 3; 127 128 return 0; 94 129 } 95 130 -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h
r3682 r5160 24 24 ~MReadMarsFile(); 25 25 26 static Byte_t IsFileValid(const char *name); 27 26 28 void SortFiles(); 27 29 -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r5100 r5160 157 157 } 158 158 159 Byte_t MReadTree::IsFileValid(const char *name) 160 { 161 ifstream fin(name); 162 if (!fin) 163 return 0; 164 165 Char_t c[4]; 166 fin.read(c, 4); 167 if (!fin) 168 return 0; 169 170 return c[0]=='r'&& c[1]=='o' && c[2]=='o' && c[3]=='t' ? 1 : 0; 171 } 172 159 173 // -------------------------------------------------------------------------- 160 174 // -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r4895 r5160 51 51 ~MReadTree(); 52 52 53 static Byte_t IsFileValid(const char *name); 54 53 55 virtual void SortFiles(); 54 56
Note:
See TracChangeset
for help on using the changeset viewer.