~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/common_cpp/Recon/Global/ImportTOFRecon.cc

merging in changes in merge branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
namespace global {
27
27
 
28
28
  void ImportTOFRecon::process(const MAUS::TOFEvent &tof_event,
29
 
             MAUS::GlobalEvent* global_event,
30
 
             std::string mapper_name) {
 
29
                               MAUS::GlobalEvent* global_event,
 
30
                               std::string mapper_name) {
31
31
 
32
32
    MAUS::TOFEventSpacePoint tofEventSpacepoint =
33
33
      tof_event.GetTOFEventSpacePoint();
36
36
  }
37
37
 
38
38
  void ImportTOFRecon::ImportTOFSpacePoints(
39
 
      const MAUS::TOFEventSpacePoint tofEventSpacepoint,
40
 
      MAUS::GlobalEvent* global_event,
41
 
      std::string mapper_name) {
 
39
                                            const MAUS::TOFEventSpacePoint tofEventSpacepoint,
 
40
                                            MAUS::GlobalEvent* global_event,
 
41
                                            std::string mapper_name) {
42
42
 
43
 
    size_t max_i;
44
 
    std::vector<TOFSpacePoint> tofarray;
45
 
    double z;
46
 
    double x;
47
 
    double x_err;
48
 
    double y;
49
 
    double y_err;
50
 
    MAUS::DataStructure::Global::DetectorPoint detector;
51
43
 
52
44
    for (int n = 0; n < 3; n++) {
53
45
      switch (n) {
54
46
      case 0:
55
 
        max_i = tofEventSpacepoint.GetTOF0SpacePointArraySize();
56
 
        tofarray = tofEventSpacepoint.GetTOF0SpacePointArray();
57
 
        z = 2773.0;
58
 
        x_err = 20.0;
59
 
        y_err = 20.0;
60
 
        detector = MAUS::DataStructure::Global::kTOF0;
61
 
        break;
 
47
        ImportTOF0SpacePoints(tofEventSpacepoint, global_event, mapper_name);
 
48
        break;
62
49
 
63
50
      case 1:
64
 
        max_i = tofEventSpacepoint.GetTOF1SpacePointArraySize();
65
 
        tofarray = tofEventSpacepoint.GetTOF1SpacePointArray();
66
 
        z = 10572.0;
67
 
        x_err = 30.0;
68
 
        y_err = 30.0;
69
 
        detector = MAUS::DataStructure::Global::kTOF1;
70
 
        break;
 
51
        ImportTOF1SpacePoints(tofEventSpacepoint, global_event, mapper_name);
 
52
        break;
71
53
 
72
54
      case 2:
73
 
        max_i = tofEventSpacepoint.GetTOF2SpacePointArraySize();
74
 
        tofarray = tofEventSpacepoint.GetTOF2SpacePointArray();
75
 
        z = 17905.74;
76
 
        x_err = 30.0;
77
 
        y_err = 30.0;
78
 
        detector = MAUS::DataStructure::Global::kTOF2;
79
 
        break;
80
 
      }
81
 
 
82
 
      for (unsigned int i = 0; i < max_i; ++i) {
83
 
        if (z == 2773.0) {
84
 
          x = tofarray[i].GetSlaby()*40.0 - 180.0;
85
 
          y = tofarray[i].GetSlabx()*40.0 - 180.0;
86
 
        } else if (z == 10572.0) {
87
 
          x = tofarray[i].GetSlaby()*60.0 - 180.0;
88
 
          y = tofarray[i].GetSlabx()*60.0 - 180.0;
89
 
        } else if (z == 17905.74) {
90
 
          x = tofarray[i].GetSlaby()*60 - 270;
91
 
          y = tofarray[i].GetSlabx()*60 - 270;
92
 
        }
93
 
 
94
 
 
95
 
  MAUS::DataStructure::Global::SpacePoint* spoint =
96
 
    new MAUS::DataStructure::Global::SpacePoint();
97
 
 
98
 
  // TODO(Pidcott) need to change slab # to a global position
99
 
  // double x = tofarray[i].GetSlaby();
100
 
  // double y = tofarray[i].GetSlabx();
101
 
  double t = tofarray[i].GetTime();
102
 
  TLorentzVector pos(x, y, z, t);
103
 
 
104
 
  // TODO(Pidcott) Not sure what z error should actually be, set as 1 for now
105
 
  double z_err = 1.0;
106
 
  double t_err = tofarray[i].GetDt();
107
 
  TLorentzVector pos_err(x_err, y_err, z_err, t_err);
108
 
 
109
 
  spoint->set_detector(detector);
110
 
  spoint->set_position(pos);
111
 
  spoint->set_position_error(pos_err);
112
 
 
113
 
  global_event->add_space_point(spoint);
114
 
      }
 
55
        ImportTOF2SpacePoints(tofEventSpacepoint, global_event, mapper_name);
 
56
        break;
 
57
      }
 
58
    }
 
59
  }
 
60
 
 
61
  void ImportTOFRecon::ImportTOF0SpacePoints(
 
62
                                             const MAUS::TOFEventSpacePoint tofEventSpacepoint,
 
63
                                             MAUS::GlobalEvent* global_event,
 
64
                                             std::string mapper_name) {
 
65
 
 
66
    size_t max_i = tofEventSpacepoint.GetTOF0SpacePointArraySize();
 
67
    std::vector<TOFSpacePoint> tofarray = tofEventSpacepoint.GetTOF0SpacePointArray();
 
68
    MAUS::DataStructure::Global::DetectorPoint detector = MAUS::DataStructure::Global::kTOF0;
 
69
    for (unsigned int i = 0; i < max_i; ++i) {
 
70
      double x = tofarray[i].GetGlobalPosX();
 
71
      double y = tofarray[i].GetGlobalPosY();
 
72
      double z = tofarray[i].GetGlobalPosZ();
 
73
      double x_err = tofarray[i].GetGlobalPosXErr();
 
74
      double y_err = tofarray[i].GetGlobalPosYErr();
 
75
      double z_err = tofarray[i].GetGlobalPosZErr();
 
76
      double t = tofarray[i].GetTime();
 
77
      double t_err = tofarray[i].GetDt();
 
78
      MAUS::DataStructure::Global::SpacePoint* spoint =
 
79
        new MAUS::DataStructure::Global::SpacePoint();
 
80
      TLorentzVector pos(x, y, z, t);
 
81
      TLorentzVector pos_err(x_err, y_err, z_err, t_err);
 
82
      spoint->set_detector(detector);
 
83
      spoint->set_position(pos);
 
84
      spoint->set_position_error(pos_err);
 
85
 
 
86
      global_event->add_space_point(spoint);
 
87
    }
 
88
  }
 
89
 
 
90
  void ImportTOFRecon::ImportTOF1SpacePoints(
 
91
                                             const MAUS::TOFEventSpacePoint tofEventSpacepoint,
 
92
                                             MAUS::GlobalEvent* global_event,
 
93
                                             std::string mapper_name) {
 
94
 
 
95
    size_t max_i = tofEventSpacepoint.GetTOF1SpacePointArraySize();
 
96
    std::vector<TOFSpacePoint> tofarray = tofEventSpacepoint.GetTOF1SpacePointArray();
 
97
    MAUS::DataStructure::Global::DetectorPoint detector = MAUS::DataStructure::Global::kTOF1;
 
98
    for (unsigned int i = 0; i < max_i; ++i) {
 
99
      double x = tofarray[i].GetGlobalPosX();
 
100
      double y = tofarray[i].GetGlobalPosY();
 
101
      double z = tofarray[i].GetGlobalPosZ();
 
102
      double x_err = tofarray[i].GetGlobalPosXErr();
 
103
      double y_err = tofarray[i].GetGlobalPosYErr();
 
104
      double z_err = tofarray[i].GetGlobalPosZErr();
 
105
      double t = tofarray[i].GetTime();
 
106
      double t_err = tofarray[i].GetDt();
 
107
      MAUS::DataStructure::Global::SpacePoint* spoint =
 
108
        new MAUS::DataStructure::Global::SpacePoint();
 
109
      TLorentzVector pos(x, y, z, t);
 
110
      TLorentzVector pos_err(x_err, y_err, z_err, t_err);
 
111
      spoint->set_detector(detector);
 
112
      spoint->set_position(pos);
 
113
      spoint->set_position_error(pos_err);
 
114
 
 
115
      global_event->add_space_point(spoint);
 
116
    }
 
117
  }
 
118
 
 
119
  void ImportTOFRecon::ImportTOF2SpacePoints(
 
120
                                             const MAUS::TOFEventSpacePoint tofEventSpacepoint,
 
121
                                             MAUS::GlobalEvent* global_event,
 
122
                                             std::string mapper_name) {
 
123
 
 
124
    size_t max_i = tofEventSpacepoint.GetTOF2SpacePointArraySize();
 
125
    std::vector<TOFSpacePoint> tofarray = tofEventSpacepoint.GetTOF2SpacePointArray();
 
126
    MAUS::DataStructure::Global::DetectorPoint detector = MAUS::DataStructure::Global::kTOF2;
 
127
    for (unsigned int i = 0; i < max_i; ++i) {
 
128
      double x = tofarray[i].GetGlobalPosX();
 
129
      double y = tofarray[i].GetGlobalPosY();
 
130
      double z = tofarray[i].GetGlobalPosZ();
 
131
      double x_err = tofarray[i].GetGlobalPosXErr();
 
132
      double y_err = tofarray[i].GetGlobalPosYErr();
 
133
      double z_err = tofarray[i].GetGlobalPosZErr();
 
134
      double t = tofarray[i].GetTime();
 
135
      double t_err = tofarray[i].GetDt();
 
136
      MAUS::DataStructure::Global::SpacePoint* spoint =
 
137
        new MAUS::DataStructure::Global::SpacePoint();
 
138
      TLorentzVector pos(x, y, z, t);
 
139
      TLorentzVector pos_err(x_err, y_err, z_err, t_err);
 
140
      spoint->set_detector(detector);
 
141
      spoint->set_position(pos);
 
142
      spoint->set_position_error(pos_err);
 
143
 
 
144
      global_event->add_space_point(spoint);
115
145
    }
116
146
  }
117
147
} // ~namespace global