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