9 #define TRG_SHORT_NAMES
10 #define TRGGRL_SHORT_NAMES
13 #include "framework/datastore/StoreArray.h"
14 #include "trg/trg/Utilities.h"
15 #include "trg/grl/TRGGRL.h"
16 #include "trg/cdc/TRGCDC.h"
17 #include "trg/cdc/TRGCDCTrack.h"
18 #include "trg/ecl/dataobjects/TRGECLCluster.h"
19 #include "trg/ecl/TrgEclCluster.h"
23 #include <framework/logging/Logger.h>
25 # define M_PI 3.14159265358979323846
39 TRGGRL::name(
void)
const
45 TRGGRL::version(
void)
const
47 return string(
"TRGGRL 0.01");
51 TRGGRL::getTRGGRL(
const string& configFile,
52 unsigned simulationMode,
53 unsigned fastSimulationMode,
54 unsigned firmwareSimulationMode)
61 if (configFile !=
"good-bye") {
62 _grl =
new TRGGRL(configFile,
65 firmwareSimulationMode);
67 B2DEBUG(100,
"TRGGRL::getTRGGRL ... good-bye");
75 TRGGRL::getTRGGRL(
void)
78 B2WARNING(
"TRGGRL::getTRGGRL !!! TRGGRL is not created yet");
82 TRGGRL::TRGGRL(
const string& configFile,
83 unsigned simulationMode,
84 unsigned fastSimulationMode,
85 unsigned firmwareSimulationMode)
87 _configFilename(configFile),
88 _simulationMode(simulationMode),
89 _fastSimulationMode(fastSimulationMode),
90 _firmwareSimulationMode(firmwareSimulationMode),
91 _clock(Belle2_GDL::GDLSystemClock)
106 m_file =
new TFile(
"trggrl.root",
"RECREATE");
107 h1 =
new TTree(
"h1",
"h1");
109 h1->Branch(
"3d", &
x0,
"3d");
110 h1->Branch(
"dr", &
x1,
"dr");
111 h1->Branch(
"dz", &
x2,
"dz");
112 h1->Branch(
"poe", &
x3,
"poe");
113 h1->Branch(
"z0", &
x4,
"z0");
114 h1->Branch(
"pt", &
x5,
"pt");
115 h1->Branch(
"pz", &
x6,
"pz");
116 h1->Branch(
"e", &
x7,
"e");
130 if (msg !=
"") B2DEBUG(100,
"dump nothing...");
151 B2DEBUG(100,
"do nothing...");
172 unsigned n_track = trackList.size();
173 unsigned n_track3D = trackList3D.size();
174 unsigned n_cluster = ClusterArray.
getEntries();
178 for (
unsigned i = 0; i < n_track; i++) {
180 if (n_cluster == 0)
break;
181 else if (n_cluster == 1) {
184 }
else if (n_cluster > 1) {
185 int best_j = 0;
double old_dr = 99999;
186 for (
unsigned j = 0; j < n_cluster; j++) {
188 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
195 for (
unsigned i = 0; i < n_track3D; i++) {
197 if (n_cluster == 0)
break;
198 else if (n_cluster == 1) {
201 }
else if (n_cluster > 1) {
202 int best_j = 0;
double old_dr = 99999;
203 for (
unsigned j = 0; j < n_cluster; j++) {
205 if (match->getDr() < old_dr) {best_j = j; old_dr = match->getDr();}
213 for (
unsigned i = 0; i <
matchList.size(); i++) {
216 x0 = match.getMatch3D();
220 x4 = match.getCenter_z0();
221 x5 = match.getCenter_pt();
222 x6 = match.getCenter_pz();
223 x7 = match.getCluster_e();
227 for (
unsigned i = 0; i <
matchList3D.size(); i++) {
230 x0 = match.getMatch3D();
234 x4 = match.getCenter_z0();
235 x5 = match.getCenter_pt();
236 x6 = match.getCenter_pz();
237 x7 = match.getCluster_e();
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
The instance of TRGCDC is a singleton.
A class to represent a matching candidate in TRGGRL A matching candidate consists of a TRGCDCTrack an...
unsigned _simulationMode
Simulation mode.
std::string _configFilename
root file name.
std::vector< TRGGRLMatch * > matchList
Vector which stores list of TRGGRLMatch without 3D information.
double x5
Temporary variables to make tree in root files.
std::vector< TRGGRLMatch * > matchList3D
Vector which stores list of TRGGRLMatch with 3D information.
double x3
Temporary variables to make tree in root files.
double x7
Temporary variables to make tree in root files.
double x1
Temporary variables to make tree in root files.
double x2
Temporary variables to make tree in root files.
double x6
Temporary variables to make tree in root files.
double x0
Temporary variables to make tree in root files.
double x4
Temporary variables to make tree in root files.
void configure(void)
configures trigger modules for firmware simulation.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
void fastClear(void)
clears TRGGRL information.
void terminate(void)
terminates when run is finished
std::vector< TRGCDCTrack * > getTrackList3D(void)
returns 3D track list (fitted).
void initialize(void)
initializes GRL.
void dump(const std::string &message) const
dumps debug information.
std::vector< TRGCDCTrack * > getTrackList2D(void)
returns 2D track list (no fit).
void update(bool mcAnalysis=true)
updates TRGGRL information.
void fastSimulation(void)
Fast simulation.
void simulate(void)
fast trigger simulation.
void clear(void)
clears all TRGGRL information.
void firmwareSimulation(void)
Firmware simulation.
virtual ~TRGGRL()
Destructor.
Abstract base class for different kinds of events.