Belle II Software  release-05-01-25
linkdef.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifdef __CINT__
12 
13 #pragma link off all globals;
14 #pragma link off all classes;
15 #pragma link off all functions;
16 #pragma link C++ nestedclasses;
17 
18 #pragma link C++ class Belle2::Cluster+;
19 #pragma link C++ class Belle2::MCParticle+;
20 #pragma link C++ class vector<Belle2::MCParticle*>+;
21 #pragma link C++ class Belle2::PIDLikelihood+;
22 #pragma link C++ class Belle2::ECLCluster+;
23 #pragma link C++ class Belle2::KLMCluster+;
24 #pragma link C++ class Belle2::KlId+;
25 #pragma link C++ class Belle2::EventLevelClusteringInfo+;
26 #pragma link C++ class Belle2::Track+;
27 #pragma link C++ class Belle2::HitPatternCDC+;
28 #pragma link C++ class Belle2::HitPatternVXD+;
29 #pragma link C++ class Belle2::TrackFitResult+;
30 #pragma link C++ class Belle2::V0+;
31 #pragma link C++ class pair<Belle2::TrackFitResult*, Belle2::TrackFitResult*>+;
32 #pragma link C++ class pair<Belle2::Track*, Belle2::Track*>+;
33 #pragma link C++ class pair<short, short>+;
34 #pragma link C++ class Belle2::EventLevelTrackingInfo+;
35 #pragma link C++ class Belle2::TRGSummary+;
36 #pragma link C++ class Belle2::SoftwareTriggerResult+;
37 
38 // ----------------------------------------------------------------------------
39 // SoftwareTriggerResult
40 // As of version 5, the result consists of a pair of prescaled - non prescaled result, not only a prescaled result.
41 // We pad the non-prescaled one with 0, which is equal to "no result".
42 #pragma read sourceClass="Belle2::SoftwareTriggerResult" version="[-4]" \
43  source="std::map<std::string, int> m_results" \
44  targetClass="Belle2::SoftwareTriggerResult" target="m_results" \
45  code="{ \
46  for(const auto& [key, prescaledResult] : onfile.m_results) { \
47  m_results[key] = std::make_pair(prescaledResult, 0); \
48  } \
49  }"
50 
51 // ----------------------------------------------------------------------------
52 // Allow reading PIDLikelihood version <=2 (less particle types, different order)
53 //
54 // schema evolution rule as described in "Support For Significant Evolutions of the User Data Model In ROOT Files"
55 // Ph Canal et al 2010 J. Phys.: Conf. Ser. 219
56 #pragma read sourceClass="Belle2::PIDLikelihood" version="[-2]" \
57  source="float m_logl[6][5]" \
58  targetClass="Belle2::PIDLikelihood" target="m_logl" \
59  code="{ \
60  const static int oldToNewIndex[] = {2, 3, 4, 0, 1}; \
61  for (int iDet = 0; iDet < 6; iDet++) { \
62  for (int iPDG = 0; iPDG < 5; iPDG++) { \
63  int newIndex = oldToNewIndex[iPDG]; \
64  m_logl[iDet][newIndex] = onfile.m_logl[iDet][iPDG]; \
65  } \
66  /* use proton likelihood for deuterons. */ \
67  m_logl[iDet][5] = onfile.m_logl[iDet][2]; \
68  }\
69  }"
70 
71 // ----------------------------------------------------------------------------
72 // TrackFitResult evolution
73 // As of version 5 the CDC hit pattern was merged into a single variable.
74 #pragma read sourceClass="Belle2::TrackFitResult" version="[4]" \
75  source="const uint32_t m_hitPatternCDCInitializer; const uint32_t m_hitPatternCDCInitializer_part2" \
76  targetClass="Belle2::TrackFitResult" target="m_hitPatternCDCInitializer" \
77  code="{ \
78  m_hitPatternCDCInitializer = ((long long int) onfile.m_hitPatternCDCInitializer_part2 << 32) | onfile.m_hitPatternCDCInitializer; \
79  }"
80 
81 // As of version 6 the data is no longer kept in vectors, but in fixed-size arrays.
82 #pragma read sourceClass="Belle2::TrackFitResult" version="[-5]" \
83  source="std::vector<float> m_tau" \
84  targetClass="Belle2::TrackFitResult" target="m_tau" \
85  code = "{ \
86  memset(m_tau, 0, 5*sizeof(Double32_t)); \
87  for (size_t i = 0; i < std::min(onfile.m_tau.size(), (size_t)5); ++i) \
88  m_tau[i] = onfile.m_tau[i]; \
89  }"
90 #pragma read sourceClass="Belle2::TrackFitResult" version="[-5]" \
91  source="std::vector<float> m_cov5" \
92  targetClass="Belle2::TrackFitResult" target="m_cov5" \
93  code = "{ \
94  memset(m_cov5, 0, 15*sizeof(Double32_t)); \
95  for (size_t i = 0; i < std::min(onfile.m_cov5.size(), (size_t)15); ++i) \
96  m_cov5[i] = onfile.m_cov5[i]; \
97  }"
98 
99 #pragma read sourceClass="Belle2::TrackFitResult" version="[6]" \
100  source="Double32_t m_cov5[15]; Double32_t m_tau[5];" \
101  targetClass="Belle2::TrackFitResult" \
102  target="m_cov5" \
103  code="{ \
104  /* Translate the false covariance matrix back to the 6x6 matrix */ \
105  TMatrixDSym oldCov5(5); \
106  { \
107  unsigned int counter = 0; \
108  for (unsigned int i = 0; i < 5; ++i) { \
109  for (unsigned int j = i; j < 5; ++j) { \
110  oldCov5(i, j) = oldCov5(j, i) = onfile.m_cov5[counter]; \
111  ++counter; \
112  } \
113  } \
114  } \
115  \
116  const double bZ = 1.5; \
117  const int iX = 0; \
118  const int iY = 1; \
119  const int iZ = 2; \
120  const int iPx = 3; \
121  const int iPy = 4; \
122  const int iPz = 5; \
123  \
124  const int iD0 = 0; \
125  const int iPhi0 = 1; \
126  const int iOmega = 2; \
127  const int iZ0 = 3; \
128  const int iTanLambda = 4; \
129  \
130  /* Transform covariance matrix */ \
131  TMatrixD jacobianInflate(6, 5); \
132  jacobianInflate.Zero(); \
133  \
134  const double d0 = onfile.m_tau[0]; \
135  const double omega = onfile.m_tau[2]; \
136  const double tanLambda = onfile.m_tau[4]; \
137  const Belle2::Helix helix(d0,0, omega, 0, tanLambda); \
138  const TVector3 position = helix.getPerigee(); \
139  /* Attention! Using a hardcoded 1.5 here. */ \
140  const TVector3 momentum = helix.getMomentum(bZ); \
141  const int charge = helix.getChargeSign(); \
142  \
143  const double alpha = 1.0 / (bZ * TMath::C()) * 1E11; \
144  const double absAlphaOmega = alpha * std::fabs(omega); \
145  const double signedAlphaOmega2 = absAlphaOmega * omega; \
146  \
147  const double invAbsAlphaOmega = 1.0 / absAlphaOmega; \
148  const double invSignedAlphaOmega2 = 1.0 / signedAlphaOmega2; \
149  \
150  /* Undo the false translation back to the position and momentum uncertainties*/ \
151  jacobianInflate(iX, iPhi0) = d0; \
152  jacobianInflate(iY, iD0) = charge; \
153  jacobianInflate(iZ, iZ0) = 1.0; \
154  jacobianInflate(iPx, iOmega) = invSignedAlphaOmega2; \
155  jacobianInflate(iPy, iPhi0) = invAbsAlphaOmega; \
156  jacobianInflate(iPz, iOmega) = tanLambda * invSignedAlphaOmega2; \
157  jacobianInflate(iPz, iTanLambda) = invAbsAlphaOmega; \
158  \
159  TMatrixDSym cov6 = oldCov5; /* copy */ \
160  cov6.Similarity(jacobianInflate); \
161  \
162  const Belle2::UncertainHelix uncertainHelix(position, momentum, charge, bZ, cov6, 0.0); \
163  \
164  /* Upper half of the covariance matrix goes into m_cov5. */ \
165  const TMatrixDSym& newCov5 = uncertainHelix.getCovariance(); \
166  memset(m_cov5, 0, 15*sizeof(Double32_t)); \
167  unsigned int counter = 0; \
168  for (unsigned int i = 0; i < 5; ++i) { \
169  for (unsigned int j = i; j < 5; ++j) { \
170  m_cov5[counter++] = newCov5(i, j); \
171  } \
172  } \
173  }"
174 
175 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
176  source="float m_Energy" \
177  targetClass="Belle2::ECLCluster" target="m_logEnergy" \
178  code="{if(onfile.m_Energy>0.0) m_logEnergy = log(onfile.m_Energy); \
179  else m_logEnergy = -5.;}"
180 
181 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
182  source="float m_HighestE" \
183  targetClass="Belle2::ECLCluster" target="m_logEnergyHighestCrystal" \
184  code="{if(onfile.m_HighestE>0.0) m_logEnergyHighestCrystal = log(onfile.m_HighestE); \
185  else m_logEnergyHighestCrystal = -5.;}"
186 
187 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
188  source="float m_EnedepSum" \
189  targetClass="Belle2::ECLCluster" target="m_logEnergyRaw" \
190  code="{if(onfile.m_EnedepSum>0.0) m_logEnergyRaw = log(onfile.m_EnedepSum); \
191  else m_logEnergyRaw = -5.;}"
192 
193 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
194  source="float m_Theta" \
195  targetClass="Belle2::ECLCluster" target="m_theta" \
196  code="{m_theta = onfile.m_Theta;}"
197 
198 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
199  source="float m_Phi" \
200  targetClass="Belle2::ECLCluster" target="m_phi" \
201  code="{m_phi = onfile.m_Phi;}"
202 
203 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
204  source="float m_R" \
205  targetClass="Belle2::ECLCluster" target="m_r" \
206  code="{m_r = onfile.m_R;}"
207 
208 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
209  source="float m_Timing" \
210  targetClass="Belle2::ECLCluster" target="m_time" \
211  code="{m_time = onfile.m_Timing;}"
212 
213 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
214  source="float m_ErrorTiming" \
215  targetClass="Belle2::ECLCluster" target="m_deltaTime99" \
216  code="{m_deltaTime99 = onfile.m_ErrorTiming;}"
217 
218 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
219  source="float m_E9oE25" \
220  targetClass="Belle2::ECLCluster" target="m_E9oE21" \
221  code="{m_E9oE21 = onfile.m_E9oE25;}"
222 
223 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
224  source="int m_NofCrystals" \
225  targetClass="Belle2::ECLCluster" target="m_numberOfCrystals" \
226  code="{m_numberOfCrystals = (double) onfile.m_NofCrystals;}"
227 
228 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
229  source="int m_CrystHealth" \
230  targetClass="Belle2::ECLCluster" target="m_status" \
231  code="{m_status = onfile.m_CrystHealth;}"
232 
233 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
234  source="float m_Error[6]" \
235  targetClass="Belle2::ECLCluster" target="m_sqrtcovmat_00" \
236  code="{m_sqrtcovmat_00 = onfile.m_Error[0];}"
237 
238 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
239  source="float m_Error[6]" \
240  targetClass="Belle2::ECLCluster" target="m_sqrtcovmat_11" \
241  code="{m_sqrtcovmat_11 = onfile.m_Error[2];}"
242 
243 #pragma read sourceClass="Belle2::ECLCluster" version="[-3]" \
244  source="float m_Error[6]" \
245  targetClass="Belle2::ECLCluster" target="m_sqrtcovmat_22" \
246  code="{m_sqrtcovmat_22 = onfile.m_Error[5];}"
247 
248 #pragma read sourceClass="Belle2::ECLCluster" version="[-12]" \
249  source="int m_hypothesisId" \
250  targetClass="Belle2::ECLCluster" target="m_hypotheses" \
251  code="{ if(onfile.m_hypothesisId == 5) m_hypotheses = static_cast<unsigned short>(Belle2::ECLCluster::EHypothesisBit::c_nPhotons); \
252  else if(onfile.m_hypothesisId == 6) m_hypotheses = static_cast<unsigned short>(Belle2::ECLCluster::EHypothesisBit::c_neutralHadron); \
253  else m_hypotheses = 0;}"
254 
255 #endif