12 #include <klm/modules/KLMClusterEfficiency/KLMClusterEfficiencyModule.h>
15 #include <klm/dataobjects/bklm/BKLMHit2d.h>
16 #include <klm/dataobjects/eklm/EKLMHit2d.h>
29 m_OutputFile(
nullptr), m_ClusterTree(
nullptr), m_ReconstructionTree(
nullptr),
30 m_DecayVertexX(0), m_DecayVertexY(0), m_DecayVertexZ(0),
31 m_MaxDecayVertexHitAngle(0), m_ClusterX(0), m_ClusterY(0), m_ClusterZ(0),
32 m_MaxClusterHitAngle(0), m_KL0Clusters(0), m_PartlyKL0Clusters(0),
33 m_OtherClusters(0), m_NonreconstructedKL0(0),
34 m_ReconstructedKL01Cluster{0, 0, 0}, m_ExactlyReconstructedKL0(0),
35 m_ReconstructedKL02Clusters{0, 0, 0, 0, 0, 0},
36 m_ReconstructedKL03Clusters(0)
38 setDescription(
"Module for KLM cluster reconstruction efficiency studies.");
39 addParam(
"SaveClusterData", m_SaveClusterData,
40 "Whether to save cluster data or not.",
false);
41 addParam(
"SaveReconstructionData", m_SaveReconstructionData,
42 "Whether to save reconstruction data or not.",
true);
43 addParam(
"OutputFile", m_OutputFileName,
"Output file.",
44 std::string(
"KLMClusterEfficiency.root"));
45 addParam(
"EventsClusterHistograms", m_EventsClusterHistograms,
46 "Draw cluster histograms for this number of events.", 0);
63 "MaxDecayVertexHitAngle/F");
68 "MaxClusterHitAngle/F");
75 "PartlyKL0Clusters/I");
79 "NonreconstructedKL0/I");
82 "ReconstructedKL01Cluster[3]/I");
85 "ReconstructedKL02Clusters[6]/I");
88 "ReconstructedKL03Clusters/I");
90 gStyle->SetOptStat(0);
99 static int nevent = 0;
102 int i1, i2, i3, n1, n2, n3;
103 int bs1, bs2, es1, es2;
104 TVector3 decayVertex, clusterPosition, hitPosition;
109 for (i1 = 0; i1 < n1; i1++) {
113 n2 = clusterMCParticles.
size();
114 for (i2 = 0; i2 < n2; i2++) {
115 if (clusterMCParticles[i2]->getPDG() == 130)
127 static TH2F* hzx =
new TH2F(
"hzx",
"", 100, -300, 420, 100, -320, 320);
128 static TH2F* hzy =
new TH2F(
"hzy",
"", 100, -300, 420, 100, -320, 320);
129 static TH2F* hxy =
new TH2F(
"hxy",
"", 100, -320, 320, 100, -320, 320);
130 static TCanvas* c1 =
new TCanvas();
131 static TMarker* clusterMarker =
new TMarker(0, 0, 20);
132 static TMarker* hitMarker =
new TMarker(0, 0, 21);
134 hzx->GetXaxis()->SetTitle(
"z, cm");
135 hzx->GetYaxis()->SetTitle(
"x, cm");
136 hzy->GetXaxis()->SetTitle(
"z, cm");
137 hzy->GetYaxis()->SetTitle(
"y, cm");
138 hxy->GetXaxis()->SetTitle(
"x, cm");
139 hxy->GetYaxis()->SetTitle(
"y, cm");
142 for (i1 = 0; i1 < n1; i1++) {
143 clusterMarker->SetMarkerColor(i1 + 1);
144 hitMarker->SetMarkerColor(i1 + 1);
146 clusterMarker->DrawMarker(clusterPosition.Z(), clusterPosition.X());
149 n2 = bklmHit2ds.
size();
150 for (i2 = 0; i2 < n2; i2++) {
151 hitPosition = bklmHit2ds[i2]->getGlobalPosition();
152 hitMarker->DrawMarker(hitPosition.Z(), hitPosition.X());
156 n2 = eklmHit2ds.
size();
157 for (i2 = 0; i2 < n2; i2++) {
158 hitPosition = eklmHit2ds[i2]->getPosition();
159 hitMarker->DrawMarker(hitPosition.Z(), hitPosition.X());
162 snprintf(str, 128,
"clusters%dzx.eps", nevent);
165 for (i1 = 0; i1 < n1; i1++) {
166 clusterMarker->SetMarkerColor(i1 + 1);
167 hitMarker->SetMarkerColor(i1 + 1);
169 clusterMarker->DrawMarker(clusterPosition.Z(), clusterPosition.Y());
172 n2 = bklmHit2ds.
size();
173 for (i2 = 0; i2 < n2; i2++) {
174 hitPosition = bklmHit2ds[i2]->getGlobalPosition();
175 hitMarker->DrawMarker(hitPosition.Z(), hitPosition.Y());
179 n2 = eklmHit2ds.
size();
180 for (i2 = 0; i2 < n2; i2++) {
181 hitPosition = eklmHit2ds[i2]->getPosition();
182 hitMarker->DrawMarker(hitPosition.Z(), hitPosition.Y());
185 snprintf(str, 128,
"clusters%dzy.eps", nevent);
188 for (i1 = 0; i1 < n1; i1++) {
189 clusterMarker->SetMarkerColor(i1 + 1);
190 hitMarker->SetMarkerColor(i1 + 1);
192 clusterMarker->DrawMarker(clusterPosition.X(), clusterPosition.Y());
195 n2 = bklmHit2ds.
size();
196 for (i2 = 0; i2 < n2; i2++) {
197 hitPosition = bklmHit2ds[i2]->getGlobalPosition();
198 hitMarker->DrawMarker(hitPosition.X(), hitPosition.Y());
202 n2 = eklmHit2ds.
size();
203 for (i2 = 0; i2 < n2; i2++) {
204 hitPosition = eklmHit2ds[i2]->getPosition();
205 hitMarker->DrawMarker(hitPosition.X(), hitPosition.Y());
208 snprintf(str, 128,
"clusters%dxy.eps", nevent);
213 for (i1 = 0; i1 < n1; i1++) {
223 n2 = mcBKLMHit2ds.
size();
224 for (i2 = 0; i2 < n2; i2++) {
225 hitPosition = mcBKLMHit2ds[i2]->getGlobalPosition();
226 angle = decayVertex.Angle(hitPosition);
232 n2 = mcEKLMHit2ds.
size();
233 for (i2 = 0; i2 < n2; i2++) {
234 hitPosition = mcEKLMHit2ds[i2]->getPosition();
235 angle = decayVertex.Angle(hitPosition);
241 n2 = kl0Clusters.
size();
246 kl0Clusters[0]->getRelationsTo<
BKLMHit2d>();
248 kl0Clusters[0]->getRelationsTo<
EKLMHit2d>();
249 bs1 = bklmHit2ds.
size();
250 es1 = eklmHit2ds.size();
260 if (m_MCParticles2.
size() == 1) {
261 if (m_MCParticles2.
weight(0) == 1)
264 }
else if (n2 == 2) {
266 kl0Clusters[0]->getRelationsTo<
BKLMHit2d>();
268 kl0Clusters[1]->getRelationsTo<
BKLMHit2d>();
270 kl0Clusters[0]->getRelationsTo<
EKLMHit2d>();
272 kl0Clusters[1]->getRelationsTo<
EKLMHit2d>();
273 bs1 = bklmHit2ds1.
size();
274 bs2 = bklmHit2ds2.size();
275 es1 = eklmHit2ds1.size();
276 es2 = eklmHit2ds2.size();
277 if (bs1 > 0 && bs2 > 0) {
278 if (es1 > 0 && es2 > 0) {
280 }
else if ((es1 > 0 && es2 == 0) || (es1 == 0 && es2 > 0)) {
282 }
else if (es1 == 0 && es2 == 0) {
285 }
else if (bs1 > 0 && bs2 == 0) {
286 if (es1 > 0 && es2 > 0) {
288 }
else if (es1 == 0 && es2 > 0) {
291 }
else if (bs1 == 0 && bs2 > 0) {
292 if (es1 > 0 && es2 > 0) {
294 }
else if (es1 > 0 && es2 == 0) {
297 }
else if (bs1 == 0 && bs2 == 0) {
298 if (es1 > 0 && es2 > 0) {
305 for (i2 = 0; i2 < n2; i2++) {
306 clusterPosition = kl0Clusters[i2]->getClusterPosition();
312 kl0Clusters[i2]->getRelationsTo<
BKLMHit2d>();
313 n3 = bklmHit2ds.
size();
314 for (i3 = 0; i3 < n3; i3++) {
315 hitPosition = bklmHit2ds[i3]->getGlobalPosition();
316 angle = clusterPosition.Angle(hitPosition);
321 kl0Clusters[i2]->getRelationsTo<
EKLMHit2d>();
322 n3 = eklmHit2ds.
size();
323 for (i3 = 0; i3 < n3; i3++) {
324 hitPosition = eklmHit2ds[i3]->getPosition();
325 angle = clusterPosition.Angle(hitPosition);
341 int i, rec1Cluster, rec2Clusters;
344 for (i = 0; i < 3; i++)
346 for (i = 0; i < 6; i++)
357 B2INFO(
"K_L0 reconstructed as 1 cluster (total): " << rec1Cluster);
358 B2INFO(
"K_L0 reconstructed as 1 cluster (BKLM): " <<
360 B2INFO(
"K_L0 reconstructed as 1 cluster (BKLM/EKLM): " <<
362 B2INFO(
"K_L0 reconstructed as 1 cluster (EKLM): " <<
364 B2INFO(
"K_L0 reconstructed as 1 cluster (exact reconstruction): " <<
366 B2INFO(
"K_L0 reconstructed as 2 clusters (total): " << rec2Clusters);
367 B2INFO(
"K_L0 reconstructed as 2 clusters (2 * BKLM): " <<
369 B2INFO(
"K_L0 reconstructed as 2 clusters (BKLM + BKLM/EKLM): " <<
371 B2INFO(
"K_L0 reconstructed as 2 clusters (BKLM + EKLM): " <<
373 B2INFO(
"K_L0 reconstructed as 2 clusters (2 * BKLM/EKLM): " <<
375 B2INFO(
"K_L0 reconstructed as 2 clusters (BKLM/EKLM + EKLM): " <<
377 B2INFO(
"K_L0 reconstructed as 2 clusters (2 * EKLM): " <<
379 B2INFO(
"K_L0 reconstructed as 3 or more clusters: " <<