tests/src/Rewriter.cpp

Go to the documentation of this file.
00001 #include "MapsTrackManager.hh"
00002 #include "MapsTrack.hh"
00003 #include "MapsSensor.hh"
00004 #include "MapsException.hh"
00005 #include <cmath>
00006 #include <vector>
00007 #include "TRandom2.h"
00008 #include "TFile.h"
00009 #include "TH1F.h"
00010 int main(int argc, const char **argv) {
00011 
00012         for(int d(0); d < argc; d++) {
00013                 std::cout << argv[d] << "\n";
00014         }
00015         if(argc != 3) {
00016                 std::cout << "Usage: Rewriter <input file> <outputfile>\n";
00017                 return 0;
00018         }
00019         
00020         MapsTrackManager mtm2;
00021         std::cout << "Recreating from root file...\n";
00022         char input[100];
00023         strcpy(input, argv[1]);
00024         
00025         mtm2.recreateFromRootFile(input);
00026         std::cout << "Rewriting to new root file...\n";
00027         std::vector<MapsSensor*> s(mtm2.getSensors());
00028         for(std::vector<MapsSensor*>::iterator it = s.begin(); it != s.end(); ++it) {
00029                 MapsSensor* sensor = *it;
00030                 if(sensor->id() == 2 || sensor->id() == 8) 
00031                         sensor->setPhi(3.14159265358979323846);
00032                 
00033         }
00034         
00035         
00036         
00037         std::vector<MapsTrack*> tracks(mtm2.getTracks());
00038         for(std::vector<MapsTrack*>::iterator it = tracks.begin(); it != tracks.end(); ++it)
00039                 (*it)->eraseGlobalHits();
00040         
00041         char output[100];
00042         strcpy(output, argv[2]);
00043         mtm2.exportToRootFile(output);
00044         
00045 
00046         std::cout << "Done.\n";
00047         return 0;
00048 }
00049 
00050 

Generated on Wed Mar 19 17:47:58 2008 for MapsTracks by  doxygen 1.5.2