00001 #include "MapsTrackManager.hh"
00002 #include "MapsTrack.hh"
00003 #include "MapsSensor.hh"
00004 #include "MapsException.hh"
00005 #include <cmath>
00006 #include <algorithm>
00007 #include <iostream>
00008 #include "TRandom2.h"
00009 #include "TFile.h"
00010 #include "TH1F.h"
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 int main(int argc, const char **argv) {
00028
00029 if (argc != 3) {
00030 std::cout << "Usage: Realignment <input file> <outputfile>\n";
00031 return 0;
00032 }
00033
00034
00035 MapsTrackManager mtm2;
00036 std::cout << "Recreating from root file...\n";
00037 std::cout << "NOTE: that this tool uses hardcoded parameters! Adjust and recompile for your own purposes...\n";
00038 char input[100];
00039 strcpy(input, argv[1]);
00040 mtm2.recreateFromRootFile(input);
00041
00042 std::vector<MapsSensor*>& sensors = mtm2.getSensors();
00043
00044 for (std::vector<MapsSensor*>::iterator it = sensors.begin(); it
00045 != sensors.end(); it++) {
00046 MapsSensor* s = *it;
00047 MapsSensor::physXY align;
00048
00049 switch (s->id()) {
00050
00051 case 8: {
00052 mtm2.setRequiredLeftSensor(s);
00053 break;
00054 }
00055 case 6: {
00056 s->setPhi(0.0);
00057 mtm2.setRequiredRightSensor(s);
00058 break;
00059 }
00060 case 2: {
00061 s->setPhi(3.14159265358979323846);
00062 align.first = 0.09233;
00063 align.second = 0.1428;
00064 break;
00065 }
00066 case 7: {
00067 align.first = 0.1513;
00068 align.second = -0.1024;
00069 break;
00070 }
00071 }
00072 s->setAlignment(align);
00073
00074 }
00075
00076 std::vector<MapsTrack*>& tracks = mtm2.getTracks();
00077 for (std::vector<MapsTrack*>::iterator it = tracks.begin(); it
00078 != tracks.end(); it++) {
00079 MapsTrack* t = *it;
00080 std::pair<double, double> error(0.018, 0.018);
00081 t->setTrackError(error);
00082
00083 }
00084
00085 std::cout << "Rewriting to new root file...\n";
00086 char output[100];
00087 strcpy(output, argv[2]);
00088 mtm2.exportToRootFile(output);
00089
00090 std::cout << "Done.\n";
00091 return 0;
00092 }
00093