14 #define TRG_SHORT_NAMES
15 #define TRGGRL_SHORT_NAMES
18 #include "framework/datastore/StoreArray.h"
19 #include "trg/trg/Utilities.h"
20 #include "trg/grl/TRGGRL.h"
21 #include "trg/cdc/TRGCDC.h"
22 #include "trg/cdc/Track.h"
23 #include "trg/ecl/dataobjects/TRGECLCluster.h"
24 #include "trg/ecl/TrgEclCluster.h"
28 #include <framework/logging/Logger.h>
30 # define M_PI 3.14159265358979323846
44 TRGGRL::name(
void)
const
50 TRGGRL::version(
void)
const
52 return string(
"TRGGRL 0.01");
56 TRGGRL::getTRGGRL(
const string& configFile,
57 unsigned simulationMode,
58 unsigned fastSimulationMode,
59 unsigned firmwareSimulationMode)
66 if (configFile !=
"good-bye") {
67 _grl =
new TRGGRL(configFile,
70 firmwareSimulationMode);
72 B2DEBUG(100,
"TRGGRL::getTRGGRL ... good-bye");
80 TRGGRL::getTRGGRL(
void)
83 B2WARNING(
"TRGGRL::getTRGGRL !!! TRGGRL is not created yet");
87 TRGGRL::TRGGRL(
const string& configFile,
88 unsigned simulationMode,
89 unsigned fastSimulationMode,
90 unsigned firmwareSimulationMode)
92 _configFilename(configFile),
93 _simulationMode(simulationMode),
94 _fastSimulationMode(fastSimulationMode),
95 _firmwareSimulationMode(firmwareSimulationMode),
96 _clock(Belle2_GDL::GDLSystemClock)
111 m_file =
new TFile(
"trggrl.root",
"RECREATE");
112 h1 =
new TTree(
"h1",
"h1");
114 h1->Branch(
"3d", &
x0,
"3d");
115 h1->Branch(
"dr", &
x1,
"dr");
116 h1->Branch(
"dz", &
x2,
"dz");
117 h1->Branch(
"poe", &
x3,
"poe");
118 h1->Branch(
"z0", &
x4,
"z0");
119 h1->Branch(
"pt", &
x5,
"pt");
120 h1->Branch(
"pz", &
x6,
"pz");
121 h1->Branch(
"e", &
x7,
"e");
135 if (msg !=
"") B2DEBUG(100,
"dump nothing...");
156 B2DEBUG(100,
"do nothing...");
177 unsigned n_track = trackList.size();
178 unsigned n_track3D = trackList3D.size();
179 unsigned n_cluster = ClusterArray.
getEntries();
183 for (
unsigned i = 0; i < n_track; i++) {
185 if (n_cluster == 0)
break;
186 else if (n_cluster == 1) {
189 }
else if (n_cluster > 1) {
190 int best_j = 0;
double old_dr = 99999;
191 for (
unsigned j = 0; j < n_cluster; j++) {
193 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
200 for (
unsigned i = 0; i < n_track3D; i++) {
202 if (n_cluster == 0)
break;
203 else if (n_cluster == 1) {
206 }
else if (n_cluster > 1) {
207 int best_j = 0;
double old_dr = 99999;
208 for (
unsigned j = 0; j < n_cluster; j++) {
210 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
218 for (
unsigned i = 0; i <
matchList.size(); i++) {
221 x0 = match.getMatch3D();
225 x4 = match.getCenter_z0();
226 x5 = match.getCenter_pt();
227 x6 = match.getCenter_pz();
228 x7 = match.getCluster_e();
232 for (
unsigned i = 0; i <
matchList3D.size(); i++) {
235 x0 = match.getMatch3D();
239 x4 = match.getCenter_z0();
240 x5 = match.getCenter_pt();
241 x6 = match.getCenter_pz();
242 x7 = match.getCluster_e();