Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

main.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/reconstruction/src/test/main.cxx,v 1.2 2000/12/08 23:01:09 igable Exp $
00002 
00003 // Test program for the reconstruction classes
00004 
00005 #include "instrument/Instrument.h"
00006 
00007 #include "reconstruction/data/RecoGlastData.h"
00008 #include "reconstruction/GlastRecon.h"
00009 #include "reconstruction/ReconData.h"
00010 #include "reconstruction/GlastTuple.h"
00011 #include "reconstruction/PrintReconData.h"
00012 
00013 #include <iostream>
00014 
00015 extern void  FATAL ( const char* msg )
00016 { 
00017     std::cerr << "FATAL " <<  msg << std::endl;
00018 }
00019 
00020 extern void WARNING ( const char* msg )
00021 {
00022     std::cerr << "WARNING " << msg << std::endl;
00023 }
00024 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00025 
00026 int main(int argc, char* argv[]) {
00027     
00028     Instrument g;
00029     
00030     // initialize, by reading default ini and xml files
00031     int rc = g.initialize();
00032     
00033     if( rc) {
00034         return rc;
00035     }
00036     else std::cout << "Loaded " << g.detector_count() << " elements from detector definition file " 
00037         << g.xmlFileName() << std::endl;
00038     
00039     if( argc <2 ) { 
00040         // get the path to the instrument from its root environment variable: if not there,
00041         // assume that we are in the root
00042         const char * local_path = ::getenv("INSTRUMENTROOT");
00043         
00044         std::string input_file = std::string(local_path? local_path: "");
00045         
00046         input_file +=  std::string("/src/test/muontest.irf");
00047         
00048         rc = g.openIRF(input_file);
00049         std::cout << "Opening test irf file "<< input_file << std::endl; 
00050     }else   {
00051         // open file in args
00052         rc = g.openIRF(argv[1]);
00053     }
00054     if (rc==0 ) { 
00055         std::cout << "Opened " << g.irfFileName() << " for reading" << std::endl;
00056     } else {
00057         std::cout << "Failed to open " << g.irfFileName() << " for reading" << std::endl;
00058         return rc;
00059     }
00060         // create the GlastData and GlastRecon objects
00061     RecoGlastData data;
00062     GlastRecon recon;
00063     
00064     
00065     int irec=0;
00066     while( rc==0 ) {
00067         rc = g.readIRF();
00068         if(rc==0) std::cout << "Record " << (++irec) 
00069             <<": found " << g.detectors_with_data() << " detectors with hits" << std::endl;
00070         
00071         data.clear();
00072         recon.clear();
00073 
00074         // fill  data from the IRF
00075         g.accept(data);
00076         
00077         // see what is there
00078         data.printOn(std::cout);
00079         
00080         //  pass data to the GlastRecon object.
00081         recon.accept(ReconData(&data));
00082         
00083         // print out the full tuple
00084         recon.accept(PrintReconData(std::cout));
00085         
00086         
00087     }
00088     
00089     
00090     return 0;
00091 }

Generated at Wed Nov 21 12:20:44 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000