Changeset 4756
- Timestamp:
- 08/27/04 14:45:08 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4755 r4756 29 29 been set (e.g. by the macro). 30 30 31 32 31 33 32 … … 36 35 * Makefile: 37 36 - added comments how to link statically 37 - added star again 38 38 39 39 * callisto.cc: … … 69 69 instead of accesing the arrays many times inside the loops. 70 70 Somebody should do the same for logain. 71 72 * mraw/MRawEvtData.cc: 73 - fixed a bug in InitArrays 74 75 * showlog.cc: 76 - added some more functionality 77 78 * star.cc: 79 - changed to use new MJStar 80 81 * mfileio/MChain.cc: 82 - added namespace 83 84 * mfileio/MReadTree.cc: 85 - added a call to ResetTree as first call in PreProcess. Using 86 MReadReports with a tree missing in the file mysteriously 87 crashed because TChain::fTreeNumber was set already by 88 a root-miracle. 89 90 * mjobs/JobsLinkDef.h, mjobs/Makefile: 91 - added MJStar 92 93 * mjobs/MJCalibrateSignal.cc: 94 - replaced MReadMarsFile by MReadReports 95 96 * mmain/MEventDisplay.cc: 97 - fixed reading of resource file 71 98 72 99 -
trunk/MagicSoft/Mars/Makefile
r4752 r4756 21 21 22 22 #PROGRAMS = readraw merpp mars test mona status 23 PROGRAMS = readdaq readraw merpp mars mona showlog callisto showplot 23 PROGRAMS = readdaq readraw merpp mars mona showlog callisto showplot star 24 24 SOLIB = libmars.so 25 25 CINT = M -
trunk/MagicSoft/Mars/mfileio/MChain.cc
r2173 r4756 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 // MChain //28 // //29 // Helper class for MReadTree //30 // //26 // 27 // MChain 28 // 29 // Helper class for MReadTree 30 // 31 31 ///////////////////////////////////////////////////////////////////////////// 32 32 #include "MChain.h" 33 33 34 34 ClassImp(MChain); 35 36 using namespace std; 35 37 36 38 Int_t MChain::LoadTree(Int_t entry) -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r3682 r4756 609 609 610 610 // 611 // It seems, that TFile and TTree are not completely independant if 612 // many times the same file is openes (MReadReports) and some of 613 // the files in the chains don't have one tree. TChain::fTreeNumber 614 // is already set before LoadTree from GetFile is called and 615 // it crashes. ResetTree makes sure, that the tree number is -1 616 // 617 fChain->ResetTree(); 618 619 // 611 620 // check for files and for the tree! 612 621 // -
trunk/MagicSoft/Mars/mmain/MEventDisplay.cc
r4722 r4756 37 37 #include <TStyle.h> // gStyle->SetOptStat 38 38 #include <TCanvas.h> // TCanvas::cd 39 #include <TSystem.h> // TSystem::BaseName 39 40 40 41 // … … 245 246 plist->AddToList(ccam); 246 247 247 fEvtLoop = new MEvtLoop;248 fEvtLoop->SetOwner();249 fEvtLoop->SetParList(plist);250 fEvtLoop->ReadEnv("mars.rc");251 252 248 MHEvent *evt01 = new MHEvent(MHEvent::kEvtSignalRaw); 253 249 MHEvent *evt02 = new MHEvent(MHEvent::kEvtSignalRaw); … … 391 387 // Now distribute Display to all tasks 392 388 // 393 tlist->SetDisplay(this); 389 fEvtLoop = new MEvtLoop(Form("Mars %s", gSystem->BaseName(fname))); 390 fEvtLoop->SetOwner(); 391 fEvtLoop->SetParList(plist); 392 fEvtLoop->SetDisplay(this); 393 fEvtLoop->ReadEnv("mars.rc"); 394 394 395 } 395 396 -
trunk/MagicSoft/Mars/showlog.cc
r4732 r4756 2 2 #include <fstream> 3 3 4 #include "MArgs.h" 5 4 6 #include "MLog.h" 7 #include "MLogManip.h" 5 8 6 9 using namespace std; … … 10 13 gLog << endl; 11 14 gLog << "Sorry the usage is:" << endl; 12 gLog << " showlog filename" << endl;15 gLog << " showlog [options] filename" << endl; 13 16 gLog << " or" << endl; 14 gLog << " showlog < filename" << endl << endl; 15 gLog << " This program converts colored output made with ansi codes" << endl; 16 gLog << " (like it is done by MLog) and redirected into a file back" << endl; 17 gLog << " showlog [options] < filename" << endl << endl; 18 gLog << " -?, -h, --help This help" << endl << endl; 19 gLog << endl; 20 gLog << " This program converts colored output made with ansi codes" << endl; 21 gLog << " (like it is done by MLog) and redirected into a file back" << endl; 17 22 gLog << " into colored output." << endl << endl; 23 gLog << " It cannot be used to get rid of the Ansi codes. To display" << endl; 24 gLog << " colored output with less use the option -R, eg." << endl; 25 gLog << " less -R logfile.log" << endl << endl; 18 26 } 19 27 … … 22 30 int main(int argc, char **argv) 23 31 { 24 if (argc>2) 32 MArgs arg(argc, argv); 33 34 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) 35 { 36 Usage(); 37 return -1; 38 } 39 40 if (arg.GetNumOptions()>0) 41 { 42 gLog << warn << "WARNING - Unknown commandline options..." << endl; 43 arg.Print("options"); 44 gLog << endl; 45 } 46 47 // 48 // check for the right usage of the program 49 // 50 if (arg.GetNumArguments()>1) 25 51 { 26 52 Usage(); … … 29 55 30 56 // casts necessary for gcc 2.95.3 31 istream *in = arg c==2 ? (istream*)new ifstream(argv[1]) : (istream*)&cin;57 istream *in = arg.GetNumArguments()==1 ? (istream*)new ifstream(arg.GetArgumentStr(0)) : (istream*)&cin; 32 58 if (!*in) 33 59 { 34 gLog << "Cannot open file " << arg v[1]<< ": " << strerror(errno) << endl;60 gLog << "Cannot open file " << arg.GetArgumentStr(0) << ": " << strerror(errno) << endl; 35 61 return -1; 36 62 } -
trunk/MagicSoft/Mars/star.cc
r4459 r4756 1 #include <TROOT.h> 2 #include <TClass.h> 1 3 #include <TSystem.h> 2 3 #include "MParList.h" 4 #include "MTaskList.h" 5 #include "MEvtLoop.h" 6 /*' 4 #include <TGClient.h> 5 #include <TApplication.h> 6 7 7 #include "MLog.h" 8 */9 8 #include "MLogManip.h" 10 9 11 10 #include "MArgs.h" 12 13 11 #include "MArray.h" 14 #include "MReadMarsFile.h" 15 #include "MGeomApply.h" 16 #include "MMcPedestalCopy.h" 17 #include "MMcPedestalNSBAdd.h" 18 #include "MCerPhotCalc.h" 19 #include "MCerPhotAnal2.h" 20 #include "MSigmabarCalc.h" 21 #include "MImgCleanStd.h" 22 #include "MHillasCalc.h" 23 #include "MHillasSrcCalc.h" 24 #include "MWriteRootFile.h" 25 #include "MFDataMember.h" 26 #include "MFillH.h" 27 #include "MReportDrive.h" // PRELIMINARY: 28 //#include "MPointingPos.h" // PRELIMINARY: 29 //#include "MPointingPosCalc.h" 12 #include "MDirIter.h" 13 14 #include "MStatusDisplay.h" 15 16 #include "MSequence.h" 17 #include "MJStar.h" 30 18 31 19 using namespace std; 32 33 //////////////////////////////////////////////////////////////////////////////34 //35 // This is an easy implementation of the Star process36 // (as compilable prog)37 //38 //////////////////////////////////////////////////////////////////////////////39 20 40 21 static void StartUpMessage() … … 42 23 gLog << all << endl; 43 24 44 // 1 2 3 4 5 45 // 12345678901234567890123456789012345678901234567890 46 gLog << "================================================== " << endl;47 gLog << " STAR - MARS V" << MARSVER<< endl;48 gLog << " MARS - STandard Analysis and Reconstruction"<< endl;49 gLog << " Compiled on <" << __DATE__ << ">"<< endl;50 gLog << " Using ROOT v" << ROOTVER<< endl;51 gLog << "================================================== " << endl;25 // 1 2 3 4 5 6 26 // 123456789012345678901234567890123456789012345678901234567890 27 gLog << "========================================================" << endl; 28 gLog << " Star - MARS V" << MARSVER << endl; 29 gLog << " MARS -- STandard Analysis and Reconstruction" << endl; 30 gLog << " Compiled on <" << __DATE__ << ">" << endl; 31 gLog << " Using ROOT v" << ROOTVER << endl; 32 gLog << "========================================================" << endl; 52 33 gLog << endl; 53 34 } … … 55 36 static void Usage() 56 37 { 38 // 1 2 3 4 5 6 7 8 39 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 57 40 gLog << all << endl; 58 41 gLog << "Sorry the usage is:" << endl; 59 gLog << " star [-a0] [-vn] [-cn] inputfile[.root] outputfile[.root]" << endl << endl; 60 gLog << " input file: Merpped or MC root file." << endl; 61 gLog << " ouput file: Star-file (image parameter file)" << endl; 62 gLog << " -a0: Do not use Ansii codes." << endl; 63 gLog << " -cn: Compression level n=1..9 [default=2]" << endl; 64 gLog << " -vn: Verbosity level n [default=2]" << endl; 65 gLog << " -u1: Update File (instead of Recreate)" << endl; 66 gLog << " -tn: Telescope Serial Number n [default=0]" << endl << endl; 67 gLog << " -> Further setup is not possible at the moment, please use" << endl; 68 gLog << " the star.C root macro instead. Using an input card will" << endl; 69 gLog << " be implemented in the future." << endl << endl; 42 gLog << " star [options] sequence.txt" << endl << endl; 43 gLog << " Arguments:" << endl; 44 gLog << " sequence.txt: An ascii file defining a sequence of runs" << endl; 45 gLog << " Root Options:" << endl; 46 gLog << " -b Batch mode (no graphical output to screen)" << endl<<endl; 47 gLog << " Options:" << endl; 48 gLog.Usage(); 49 gLog << " --debug-env Debug setting resources from file" << endl << endl; 50 gLog << endl; 51 gLog << " -f Force overwrite of existing files" << endl; 52 gLog << " -ff Force execution if not all files found" << endl; 53 gLog << " --ind=path Path where to search for the calibrated data (Y)" << endl; 54 gLog << " [default=standard path in datacenter]" << endl; 55 gLog << " --out=path Path to write the all results to [def=local path]" << endl; 56 gLog << " (overwrites --outc and --outy)" << endl; 57 gLog << " --print-seq Print Sequence information" << endl; 58 gLog << " --print-files Print Files taken from Sequence" << endl; 59 gLog << " --print-only Do not excute anything except print" << endl; 60 gLog << " --config=star.rc Resource file [default=star.rc]" << endl; 61 gLog << endl; 62 gLog << " -?, -h, --help This help" << endl << endl; 70 63 } 71 64 72 class MJStar : public MParContainer 73 { 74 private: 75 TString fInputFile; 76 TString fOutputFile; 77 78 Bool_t fIsUpdate; 79 Byte_t fComprLevel; 80 81 Byte_t fSerialIdx; 82 83 Bool_t CheckFiles() 84 { 85 if (fOutputFile.IsNull()) 86 { 87 fOutputFile = fInputFile; 88 89 if (fOutputFile.EndsWith(".raw")) 90 fOutputFile = fOutputFile(0, fOutputFile.Length()-4); 91 92 if (fOutputFile.EndsWith(".rep")) 93 fOutputFile = fOutputFile(0, fOutputFile.Length()-4); 94 95 if (fOutputFile.EndsWith(".txt")) 96 fOutputFile = fOutputFile(0, fOutputFile.Length()-4); 97 } 98 99 if (fInputFile.IsNull()) 100 { 101 *fLog << err << "Sorry, no input file." << endl; 102 return kFALSE; 103 } 104 105 if (fOutputFile.IsNull()) 106 { 107 *fLog << err << "Sorry, no output file." << endl; 108 return kFALSE; 109 } 110 111 if (!fInputFile.EndsWith(".root")) 112 fInputFile += ".root"; 113 114 if (!fOutputFile.EndsWith(".root")) 115 fOutputFile += ".root"; 116 117 // 118 // check whether the given files are OK. 119 // 120 if (gSystem->AccessPathName(fInputFile, kFileExists)) 121 { 122 *fLog << err << "Sorry, the input file '" << fInputFile << "' doesn't exist." << endl; 123 return kFALSE; 124 } 125 126 if (!gSystem->AccessPathName(fOutputFile, kFileExists)) 127 { 128 if (fIsUpdate) 129 gLog << warn << "Warning: File doesn't '" << fOutputFile << "' exist... recreating." << endl; 130 } 131 132 if (fIsUpdate || gSystem->AccessPathName(fOutputFile, kFileExists)) 133 if (!gSystem->AccessPathName(fOutputFile, kWritePermission)) 134 { 135 gLog << err << "Sorry, you don't have write permission for '" << fOutputFile << "'." << endl; 136 return kFALSE; 137 } 138 return kTRUE; 139 } 140 141 public: 142 MJStar(const char *name=0, const char *title=0) 143 : fIsUpdate(kFALSE), fComprLevel(1), fSerialIdx(0) 144 { 145 fName = name; 146 fTitle = title; 147 } 148 149 void SetInputFile(const char *f) { fInputFile = f; } 150 void SetOutputFile(const char *f) { fOutputFile = f; } 151 void SetSerialIdx(Byte_t i) { fSerialIdx = i; } 152 void SetComprLevel(Byte_t l) { fComprLevel = l; } 153 void SetUpdate(Bool_t u=kTRUE) { fIsUpdate = u; } 154 155 Bool_t Process() 156 { 157 if (!CheckFiles()) 158 return kFALSE; 159 160 // 161 // Create a empty Parameter List and an empty Task List 162 // The tasklist is identified in the eventloop by its name 163 // 164 MParList plist; 165 166 MTaskList tlist; 167 plist.AddToList(&tlist); 168 169 // PRELIMINARY: 170 /* 171 MReportDrive rep; 172 plist.AddToList(&rep); 173 MPointingPos pos; 174 plist.AddToList(&pos); 175 */ 176 177 // 178 // Now setup the tasks and tasklist: 179 // --------------------------------- 180 // 181 MReadMarsFile read("Events", fInputFile); 182 read.DisableAutoScheme(); 183 184 MGeomApply apply; 185 MMcPedestalCopy pcopy; 186 MMcPedestalNSBAdd pnsb; 187 188 //MPointingPosCalc pcalc; 189 190 MCerPhotCalc ncalc; 191 MCerPhotAnal2 nanal; 192 193 MFDataMember f1("MRawRunHeader.fRunType", '>', 255.5); 194 MFDataMember f2("MRawRunHeader.fRunType", '<', 255.5); 195 196 ncalc.SetFilter(&f1); 197 nanal.SetFilter(&f2); 198 199 MSigmabarCalc sgcal; 200 //MFillH fills("MHSigmaTheta", "", "FillSigmaTheta"); 201 //MFillH fillb("MHBlindPixels", "", "FillBlindPixels"); 202 MImgCleanStd clean; 203 MHillasCalc hcalc; 204 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later! 205 MWriteRootFile write(fOutputFile, fIsUpdate?"UPDATE":"RECREATE", "Star output", fComprLevel); 206 207 tlist.AddToList(&read); 208 tlist.AddToList(&f1); 209 tlist.AddToList(&f2); 210 tlist.AddToList(&apply); 211 tlist.AddToList(&pcopy); 212 tlist.AddToList(&pnsb); 213 //tlist.AddToList(&pcalc); 214 tlist.AddToList(&ncalc); 215 tlist.AddToList(&nanal); 216 tlist.AddToList(&sgcal); 217 //tlist.AddToList(&fills); 218 //tlist.AddToList(&fillb); 219 tlist.AddToList(&clean); 220 tlist.AddToList(&hcalc); 221 tlist.AddToList(&scalc); 222 tlist.AddToList(&write); 223 224 // 225 // Set the serial number for all tasks in the current tasklist 226 // 227 tlist.SetSerialNumber(fSerialIdx); 228 229 // 230 // Setup tasks 231 // 232 write.AddContainer(write.AddSerialNumber("MMcEvt"), "Events", kFALSE); 233 write.AddContainer(write.AddSerialNumber("MSigmabar"), "Events"); 234 write.AddContainer(write.AddSerialNumber("MHillas"), "Events"); 235 write.AddContainer(write.AddSerialNumber("MHillasExt"), "Events"); 236 write.AddContainer(write.AddSerialNumber("MHillasSrc"), "Events"); 237 write.AddContainer(write.AddSerialNumber("MNewImagePar"), "Events"); 238 write.AddContainer(write.AddSerialNumber("MSrcPosCam"), "RunHeaders"); 239 //write.AddContainer(write.AddSerialNumber("MHSigmaTheta"), "RunHeaders"); 240 if (!fIsUpdate) 241 { 242 write.AddContainer("MRawRunHeader", "RunHeaders"); 243 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE); 244 } 245 246 // 247 // Create and set up the eventloop 248 // 249 MEvtLoop evtloop; 250 evtloop.SetParList(&plist); 251 252 // 253 // Execute your analysis 254 // 255 if (!evtloop.Eventloop()) 256 { 257 gLog << err << "ERROR: Star eventloop failed!" << endl; 258 return kFALSE; 259 } 260 261 tlist.PrintStatistics(); 262 263 //plist.FindObject("MHSigmaTheta")->Write(); 264 265 gLog << all << "Star finished successfull!" << endl; 266 267 return kTRUE; 268 } 269 // ClassDef(MJStar, 0) 270 }; 271 272 //ClassImp(MJStar); 273 274 275 int main(const int argc, char **argv) 65 int main(int argc, char **argv) 276 66 { 277 67 StartUpMessage(); … … 282 72 MArgs arg(argc, argv); 283 73 284 // 285 // Set verbosity to highest level. 286 // 287 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2); 288 289 if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0) 290 gLog.SetNoColors(); 291 292 const int kComprlvl = arg.HasOption("-c") ? arg.GetIntAndRemove("-c") : 1; 293 const int kTelIndex = arg.HasOption("-t") ? arg.GetIntAndRemove("-t") : 0; 294 const bool kUpdate = arg.HasOption("-u") && arg.GetIntAndRemove("-u")==1; 74 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) 75 { 76 Usage(); 77 return -1; 78 } 79 80 gLog.Setup(arg); 81 82 const TString kConfig = arg.GetStringAndRemove("--config=", "star.rc"); 83 84 const Bool_t kPrintSeq = arg.HasOnlyAndRemove("--print-seq"); 85 const Bool_t kPrintFiles = arg.HasOnlyAndRemove("--print-files"); 86 const Bool_t kPrintOnly = arg.HasOnlyAndRemove("--print-only"); 87 const Bool_t kDebugEnv = arg.HasOnlyAndRemove("--debug-env"); 88 89 const Bool_t kOverwrite = arg.HasOnlyAndRemove("-f"); 90 const Bool_t kForceExec = arg.HasOnlyAndRemove("-ff"); 91 92 const TString kInpath = arg.GetStringAndRemove("--in=", ""); 93 const TString kOutpath = arg.GetStringAndRemove("--out=", "."); 94 95 if (arg.GetNumOptions()>0) 96 { 97 gLog << warn << "WARNING - Unknown commandline options..." << endl; 98 arg.Print("options"); 99 gLog << endl; 100 } 295 101 296 102 // 297 103 // check for the right usage of the program 298 104 // 299 if (arg.GetNumArguments()!= 2)105 if (arg.GetNumArguments()!=1) 300 106 { 301 107 Usage(); … … 304 110 305 111 // 306 // Initialize Non-GUI (batch) mode 307 // 308 gROOT->SetBatch(); 309 112 // Setup sequence file and check for its existance 113 // 114 const TString kSequence = arg.GetArgumentStr(0); 115 116 if (gSystem->AccessPathName(kSequence, kFileExists)) 117 { 118 gLog << err << "Sorry, sequence file '" << kSequence << "' doesn't exist." << endl; 119 return -1; 120 } 121 122 // 123 // Setup sequence and check its validity 124 // 125 MSequence seq(kSequence); 126 if (kPrintSeq) 127 { 128 gLog << all; 129 gLog.Separator(kSequence); 130 seq.Print(); 131 gLog << endl; 132 } 133 if (!seq.IsValid()) 134 { 135 gLog << err << "Sequence read but not valid!" << endl << endl; 136 return -1; 137 } 138 139 // 140 // Process print options 141 // 142 MDirIter iter; 143 seq.SetupDatRuns(iter, kInpath); 144 145 const Int_t n0 = seq.SetupDatRuns(iter, kInpath); 146 const Int_t n1 = seq.GetNumDatRuns(); 147 148 if (kPrintFiles) 149 { 150 gLog << all; 151 gLog.Separator("Data Files"); 152 iter.Print("all"); 153 gLog << endl; 154 } 155 156 // 157 // Check for existance of all files 158 // 159 if (n0 != n1) 160 { 161 if (kForceExec) 162 gLog << warn << "WARNING"; 163 else 164 gLog << err << "ERROR"; 165 gLog << " - " << n1 << " files in sequence defined, but " << n0 << " found in "; 166 gLog << (kInpath.IsNull() ? "<defaultpath>" : kInpath.Data()) << endl; 167 if (!kForceExec) 168 return -1; 169 } 170 171 if (kPrintOnly) 172 return 0; 173 174 // 175 // Initialize root 176 // 310 177 MArray::Class()->IgnoreTObjectStreamer(); 311 178 MParContainer::Class()->IgnoreTObjectStreamer(); 312 179 313 MJStar star; 314 star.SetInputFile(arg.GetArgumentStr(0)); 315 star.SetOutputFile(arg.GetArgumentStr(1)); 316 star.SetComprLevel(kComprlvl); 317 star.SetSerialIdx(kTelIndex); 318 star.SetUpdate(kUpdate); 319 320 if (!star.Process()) 321 { 322 gLog << err << "Star failed!" << endl; 323 return -1; 324 } 325 326 gLog << inf << "Star finished successfull!" << endl; 327 180 TApplication app("Star", &argc, argv); 181 if (gROOT->IsBatch() || !gClient) 182 { 183 gLog << err << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl; 184 return 1; 185 } 186 187 // 188 // Update frequency by default = 1Hz 189 // 190 MStatusDisplay *d = new MStatusDisplay; 191 192 // From now on each 'Exit' means: Terminate the application 193 d->SetBit(MStatusDisplay::kExitLoopOnExit); 194 d->SetTitle(kSequence); 195 196 // 197 // Do calibration 198 // 199 MJStar job(Form("MJStar #%d", seq.GetSequence())); 200 job.SetSequence(seq); 201 job.SetEnv(kConfig); 202 job.SetEnvDebug(kDebugEnv); 203 job.SetDisplay(d);; 204 job.SetOverwrite(kOverwrite); 205 job.SetPathOut(kOutpath); 206 job.SetPathData(kInpath); 207 // job.SetPathIn(kInpath); // not yet needed 208 209 if (!job.ProcessFile()) 210 { 211 gLog << err << "Calculation of image parameters failed." << endl << endl; 212 return -1; 213 } 214 215 if (!job.GetDisplay()) 216 { 217 gLog << warn << "Display closed by user... execution aborted." << endl << endl; 218 return 1; 219 } 220 221 // From now on each 'Close' means: Terminate the application 222 d->SetBit(MStatusDisplay::kExitLoopOnClose); 223 224 // Wait until the user decides to exit the application 225 app.Run(kFALSE); 328 226 return 0; 329 /*330 //331 // This is to make argv[i] more readable inside the code332 //333 TString kNamein = arg.GetArgumentStr(0);334 TString kNameout = arg.GetArgumentStr(1);335 336 if (!kNamein.EndsWith(".root"))337 kNamein += ".root";338 339 if (!kNameout.EndsWith(".root"))340 kNameout += ".root";341 342 //343 // check whether the given files are OK.344 //345 if (gSystem->AccessPathName(kNamein, kFileExists))346 {347 gLog << err << "Sorry, the input file '" << kNamein << "' doesn't exist." << endl;348 return -1;349 }350 351 if (!gSystem->AccessPathName(kNameout, kFileExists))352 {353 if (kUpdate)354 gLog << warn << "Warning: File doesn't '" << kNameout << "' exist... recreating." << endl;355 }356 357 if (kUpdate || gSystem->AccessPathName(kNameout, kFileExists))358 if (!gSystem->AccessPathName(kNameout, kWritePermission))359 {360 gLog << err << "Sorry, you don't have write permission for '" << kNameout << "'." << endl;361 return -1;362 }363 364 //365 // Create a empty Parameter List and an empty Task List366 // The tasklist is identified in the eventloop by its name367 //368 MParList plist;369 370 MTaskList tlist;371 plist.AddToList(&tlist);372 373 // PRELIMINARY:374 // MReportDrive rep;375 // plist.AddToList(&rep);376 // MPointingPos pos;377 // plist.AddToList(&pos);378 379 //380 // Now setup the tasks and tasklist:381 // ---------------------------------382 //383 MReadMarsFile read("Events", kNamein);384 read.DisableAutoScheme();385 386 MGeomApply apply;387 MMcPedestalCopy pcopy;388 MMcPedestalNSBAdd pnsb;389 390 //MPointingPosCalc pcalc;391 392 MCerPhotCalc ncalc;393 MCerPhotAnal2 nanal;394 395 MFDataMember f1("MRawRunHeader.fRunType", '>', 255.5);396 MFDataMember f2("MRawRunHeader.fRunType", '<', 255.5);397 398 ncalc.SetFilter(&f1);399 nanal.SetFilter(&f2);400 401 MSigmabarCalc sgcal;402 //MFillH fills("MHSigmaTheta", "", "FillSigmaTheta");403 MImgCleanStd clean;404 MHillasCalc hcalc;405 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!406 MWriteRootFile write(kNameout, kUpdate?"UPDATE":"RECREATE", "Star output", kComprlvl);407 408 tlist.AddToList(&read);409 tlist.AddToList(&f1);410 tlist.AddToList(&f2);411 tlist.AddToList(&apply);412 tlist.AddToList(&pcopy);413 tlist.AddToList(&pnsb);414 //tlist.AddToList(&pcalc);415 tlist.AddToList(&ncalc);416 tlist.AddToList(&nanal);417 tlist.AddToList(&sgcal);418 //tlist.AddToList(&fills);419 //tlist.AddToList(&fillb);420 tlist.AddToList(&clean);421 tlist.AddToList(&hcalc);422 tlist.AddToList(&scalc);423 tlist.AddToList(&write);424 425 //426 // Set the serial number for all tasks in the current tasklist427 //428 tlist.SetSerialNumber(kTelIndex);429 430 //431 // Setup tasks432 //433 434 write.AddContainer(write.AddSerialNumber("MMcEvt"), "Events", kFALSE);435 write.AddContainer(write.AddSerialNumber("MSigmabar"), "Events");436 write.AddContainer(write.AddSerialNumber("MHillas"), "Events");437 write.AddContainer(write.AddSerialNumber("MHillasExt"), "Events");438 write.AddContainer(write.AddSerialNumber("MHillasSrc"), "Events");439 write.AddContainer(write.AddSerialNumber("MNewImagePar"), "Events");440 write.AddContainer(write.AddSerialNumber("MSrcPosCam"), "RunHeaders");441 //write.AddContainer(write.AddSerialNumber("MHSigmaTheta"), "RunHeaders");442 if (!kUpdate)443 {444 write.AddContainer("MRawRunHeader", "RunHeaders");445 write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);446 }447 448 //449 // Create and set up the eventloop450 //451 MEvtLoop evtloop;452 evtloop.SetParList(&plist);453 454 //455 // Execute your analysis456 //457 if (!evtloop.Eventloop())458 {459 gLog << err << "ERROR: Star eventloop failed!" << endl;460 return -1;461 }462 463 tlist.PrintStatistics();464 465 //plist.FindObject("MHSigmaTheta")->Write();466 467 gLog << all << "Star finished successfull!" << endl;468 return 0;469 */470 227 }
Note:
See TracChangeset
for help on using the changeset viewer.