Belle II Software light-2406-ragdoll
B2BIIFixMdstModule_brecon.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8//
9// $Id: B2BIIFixMdst_brecon.cc 9932 2006-11-12 14:26:53Z katayama $
10//
11// $Log$
12//
13// Revision 2.0 2015/03/11 tkeck
14// Conversion to Belle II
15//
16// Revision 1.1 2002/03/31 06:54:40 katayama
17// fix_pi0
18//
19//
20
21#include <b2bii/modules/B2BIIMdstInput/B2BIIFixMdstModule.h>
22#include "belle_legacy/panther/panther.h"
23#include "belle_legacy/tables/brecon.h"
24#include "belle_legacy/tables/mdst.h"
25#include "belle_legacy/tables/belletdf.h"
26
27namespace Belle2 {
34// fix relation gamma<->pi0 in brecon table
35// momenta will NOT be modified
37 {
38 Belle::Brecon_Manager& breconmgr = Belle::Brecon_Manager::get_manager();
39 if (!breconmgr.count()) return;
40 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
41
42 for (std::vector<Belle::Brecon>::iterator it = breconmgr.begin();
43 it != breconmgr.end(); ++it) {
44
45 // select the table of pi0->gamma gamma
46 if (std::abs((*it).pcode()) != 111) continue;
47 const int da_first((*it).daFirst());
48 const int da_last((*it).daLast());
49 if (da_first < 1 || da_last < 1) continue;
50 if (da_last - da_first != 1) continue;
51 const Belle::Brecon& gamma1(breconmgr[da_first - 1]);
52 const Belle::Brecon& gamma2(breconmgr[da_last - 1]);
53 if (gamma1.stable() != 2 || gamma2.stable() != 2) continue;
54
55 // find corresponding Mdst_pi0
56 int pi0_ID(-1);
57 const Belle::Panther_ID g1(gamma1.idmdst());
58 const Belle::Panther_ID g2(gamma2.idmdst());
59 for (std::vector<Belle::Mdst_pi0>::const_iterator it2 = pi0mgr.begin();
60 it2 != pi0mgr.end(); ++it2) {
61 const Belle::Panther_ID da1((*it2).gamma_ID(0));
62 const Belle::Panther_ID da2((*it2).gamma_ID(1));
63 if ((g1 == da1 && g2 == da2) || (g1 == da2 && g2 == da1)) {
64 pi0_ID = (int)(*it2).get_ID();
65 break;
66 }
67 }
68
69 // modify brecon table
70 switch (pi0_ID) {
71 case -1: // corresponding Mdst_pi0 is not found after make_pi0
72 (*it).stable(0);
73 (*it).idmdst(0);
74 break;
75 default:
76 (*it).stable(4);
77 (*it).idmdst(pi0_ID);
78 break;
79 }
80 }
81 }
83} // namespace Belle
void fix_pi0_brecon(void)
Fix relation gamma<->pi0 in brecon table.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24