Belle II Software  release-05-02-19
CDCCRTestModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Dong Van Thanh *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include "cdc/modules/cdcCRTest/CDCCRTestModule.h"
12 #include <TTree.h>
13 #include <framework/gearbox/Const.h>
14 #include <framework/core/HistoModule.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/datastore/RelationArray.h>
18 
19 #include <mdst/dataobjects/TrackFitResult.h>
20 #include <mdst/dataobjects/Track.h>
21 #include <tracking/dataobjects/RecoTrack.h>
22 #include <genfit/TrackPoint.h>
23 #include <genfit/KalmanFitterInfo.h>
24 #include <genfit/MeasurementOnPlane.h>
25 #include <genfit/MeasuredStateOnPlane.h>
26 #include <genfit/StateOnPlane.h>
27 #include <boost/foreach.hpp>
28 
29 #include <cdc/translators/RealisticCDCGeometryTranslator.h>
30 #include <cdc/translators/RealisticTDCCountTranslator.h>
31 #include <cdc/dataobjects/CDCRecoHit.h>
32 #include <cdc/dataobjects/CDCSimHit.h>
33 #include "TDirectory.h"
34 #include <Math/ProbFuncMathCore.h>
35 
36 using namespace std;
37 using namespace Belle2;
38 using namespace CDC;
39 using namespace genfit;
40 //-----------------------------------------------------------------
41 // Register the Module
42 //-----------------------------------------------------------------
43 REG_MODULE(CDCCRTest)
44 
45 // Implementation
47 {
48  setDescription("CDC Cosmic ray test module");
49  setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
50  addParam("CorrectToF", m_ToF, "if true, time of flight will take account in t", true);
51  addParam("CorrectToP", m_ToP, "if true, time of Propagation will take account in t", true);
52  addParam("RecoTracksColName", m_recoTrackArrayName, "Name of collection hold genfit::Track", std::string(""));
53  addParam("histogramDirectoryName", m_histogramDirectoryName,
54  "Track fit results histograms will be put into this directory", std::string("trackfit"));
55  addParam("NameOfTree", m_treeName, "name of tree in output file", string("tree"));
56  addParam("fillExpertHistograms", m_fillExpertHistos, "Fill additional histograms", true);
57  addParam("noBFit", m_noBFit, "If true -> #Params ==4, #params ==5 for calculate P-Val", false);
58  addParam("plotResidual", m_plotResidual, "plot biased residual, normalized res and xtplot for all layer", false);
59  addParam("calExpectedDriftTime", m_calExpectedDriftTime, "if true module will calculate expected drift time, it take a time",
60  true);
61  addParam("hitEfficiency", m_hitEfficiency, "calculate hit efficiency(Not work now) true:yes false:No", false);
62  addParam("TriggerPos", m_TriggerPos, "Trigger position use for cut and reconstruct Trigger image", std::vector<double> { -0.6, -13.25, 17.3});
63  addParam("NormTriggerPlaneDirection", m_TriggerPlaneDirection, "Normal trigger plane direction and reconstruct Trigger image",
64  std::vector<double> { 0, 1, 0});
65  addParam("TriggerSize", m_TriggerSize, "Trigger Size, (Width x length)", std::vector<double> {100, 50});
66  addParam("IwireLow", m_low, "Lower boundary of hit dist. Histogram", std::vector<int> {0, 0, 0, 0, 0, 0, 0, 0, 0});
67  addParam("IwireUpper", m_up, "Upper boundary of hit dist. Histogram", std::vector<int> {161, 161, 193, 225, 257, 289, 321, 355, 385});
68  addParam("StoreCDCSimHitInfo", m_StoreCDCSimHitInfo, "Store simulation info related to hit, driftLeng, flight time,z_onwire",
69  false);
70  addParam("EstimateResultForUnFittedLayer", m_EstimateResultForUnFittedLayer,
71  "Calculate residual for Layer that is set unUseInFit", true);
72  addParam("SmallerOutput", m_SmallerOutput, "If true, trigghit position, residual cov,absRes, will not be stored", false);
73  addParam("StoreTrackParams", m_StoreTrackParams, "Store Track Parameter or not, it will be multicount for each hit", true);
74  addParam("StoreHitDistribution", m_MakeHitDist, "Make hit distribution or not", true);
75  addParam("EventT0Extraction", m_EventT0Extraction, "use event t0 extract t0 or not", true);
76  addParam("MinimumPt", m_MinimumPt, "Tracks with tranverse momentum small than this will not recored", 0.);
77 }
78 
79 CDCCRTestModule::~CDCCRTestModule()
80 {
81  m_allHistos.clear();
82 }
83 //------------------------------------------------------------------
84 // Function to define histograms
85 //-----------------------------------------------------------------
86 void CDCCRTestModule::defineHisto()
87 {
88  m_tree = new TTree(m_treeName.c_str(), "tree");
89  m_tree->Branch("x_mea", &x_mea, "x_mea/D");
90  m_tree->Branch("x_u", &x_u, "x_u/D");
91  m_tree->Branch("x_b", &x_b, "x_b/D");
92  m_tree->Branch("z", &z, "z/D");
93  m_tree->Branch("alpha", &alpha, "alpha/D");
94  m_tree->Branch("theta", &theta, "theta/D");
95  m_tree->Branch("t", &t, "t/D");
96  m_tree->Branch("evtT0", &evtT0, "evtT0/D");
97  m_tree->Branch("adc", &adc, "adc/s");
98  m_tree->Branch("boardID", &boardID, "boardID/I");
99  m_tree->Branch("lay", &lay, "lay/I");
100  m_tree->Branch("weight", &weight, "weight/D");
101  m_tree->Branch("IWire", &IWire, "IWire/I");
102  m_tree->Branch("Pval", &Pval, "Pval/D");
103  m_tree->Branch("ndf", &ndf, "ndf/D");
104  // m_tree->Branch("trighit", &trighit, "trighit/I");
105  if (m_StoreTrackParams) {
106  m_tree->Branch("d0", &d0, "d0/D");
107  m_tree->Branch("z0", &z0, "z0/D");
108  m_tree->Branch("phi0", &phi0, "phi0/D");
109  m_tree->Branch("tanL", &tanL, "tanL/D");
110  m_tree->Branch("omega", &omega, "omega/D");
111  m_tree->Branch("Pt", &Pt, "Pt/D");
112  }
113  if (m_StoreCDCSimHitInfo) {
114  m_tree->Branch("z_sim", &z_sim, "z_sim/D");
115  m_tree->Branch("x_sim", &x_sim, "x_sim/D");
116  m_tree->Branch("dt_flight_sim", &dt_flight_sim, "dt_flight_sim/D");
117  }
118  if (m_calExpectedDriftTime) { // expected drift time, calculated form xfit
119  m_tree->Branch("t_fit", &t_fit, "t_fit/D");
120  }
121  if (!m_SmallerOutput) {
122  m_tree->Branch("tdc", &tdc, "tdc/I");
123  m_tree->Branch("z_prop", &z_prop, "z_prop/D");
124  m_tree->Branch("res_b", &res_b, "res_b/D");
125  m_tree->Branch("res_u", &res_u, "res_u/D");
126  m_tree->Branch("lr", &lr, "lr/I");
127  m_tree->Branch("trigHitPos_x", &trigHitPos_x, "trigHitPos_x/D");
128  m_tree->Branch("trigHitPos_z", &trigHitPos_z, "trigHitPos_z/D");
129  m_tree->Branch("numhits", &numhits, "numhits/I");
130  m_tree->Branch("res_b_err", &res_b_err, "res_b_err/D");
131  m_tree->Branch("res_u_err", &res_u_err, "res_u_err/D");
132  m_tree->Branch("absRes_u", &absRes_u, "absRes_u/D");
133  m_tree->Branch("absRes_b", &absRes_b, "absRes_b/D");
134  m_tree->Branch("dt_prop", &dt_prop, "dt_prop/D");
135  m_tree->Branch("dt_flight", &dt_flight, "dt_flight/D");
136  }
137 
138  // int N =m_Nchannel;//Number of Wire per Layer used;
139  TDirectory* oldDir = gDirectory;
140  TDirectory* histDir = oldDir->mkdir(m_histogramDirectoryName.c_str());
141  histDir->cd();
142  m_hNTracks = getHist("hNTracks", "number of tracks", 3, 0, 3);
143  m_hNTracks->GetXaxis()->SetBinLabel(1, "fitted, converged");
144  m_hNTracks->GetXaxis()->SetBinLabel(2, "fitted, not converged");
145  m_hNTracks->GetXaxis()->SetBinLabel(3, "TrackCand, but no Track");
146 
147  m_hNDF = getHist("hNDF", "NDF of fitted track;NDF;Tracks", 71, -1, 150);
148  m_hNHits = getHist("hNHits", "#hit of fitted track;#hit;Tracks", 61, -1, 150);
149  m_hNHits_trackcand = getHist("hNHits_trackcand", "#hit of track candidate;#hit;Tracks", 71, -1, 150);
150  m_hNTracksPerEvent = getHist("hNTracksPerEvent", "#tracks/Event;#Tracks;Event", 20, 0, 20);
151  m_hNTracksPerEventFitted = getHist("hNTracksPerEventFitted", "#tracks/Event After Fit;#Tracks;Event", 20, 0, 20);
152  m_hChi2 = getHist("hChi2", "#chi^{2} of tracks;#chi^{2};Tracks", 400, 0, 400);
153  m_hPhi0 = getHist("hPhi0", "#Phi_{0} of tracks;#phi_{0} (Degree);Tracks", 400, -190, 190);
154  m_hAlpha = getHist("hAlpha", "#alpha Dist.;#alpha (Degree);Hits", 360, -90, 90);
155  m_hTheta = getHist("hTheta", "#theta Dist.;#theta (Degree);Hits", 360, 0, 180);
156  m_hPval = getHist("hPval", "p-values of tracks;pVal;Tracks", 1000, 0, 1);
157  m_hEvtT0 = getHist("hEvtT0", "Event T0; EvtT0 (ns); #event", 200, -100, 100);
158 
159  m_hTriggerHitZX = getHist("TriggerHitZX", "Hit Position on trigger counter;z(cm);x(cm)", 300, -100, 100, 120, -15, 15);
160  if (m_MakeHitDist) {
161  m_h2DHitDistInCDCHit = getHist("2DHitDistInCDCHit", " CDCHit;WireID;LayerID",
162  m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
163  m_h2DHitDistInTrCand = getHist("2DHitDistInTrCand", "Track Cand ;WireID;LayerID",
164  m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
165  m_h2DHitDistInTrack = getHist("2DHitDistInTrack", "Fitted Track ;WireID;LayerID",
166  m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
167  }
168  if (m_fillExpertHistos) {
169  m_hNDFChi2 = getHist("hNDFChi2", "#chi^{2} of tracks;NDF;#chi^{2};Tracks", 8, 0, 8, 800, 0, 200);
170  m_hNDFPval = getHist("hNDFPval", "p-values of tracks;NDF;pVal;Tracks", 8, 0, 8, 100, 0, 1);
171  }
172  int sl;
173  for (int i = 0; i < 56; ++i) {
174  if (m_hitEfficiency) {
175  m_hHitEff_soft[i] = getHistProfile(Form("hHitEff_soft_L%d", i),
176  Form("hit efficiency(soft) of Layer %d ;Drift distance;Software Efficiency", i), 200, -1, 1);
177  }
178  if (m_MakeHitDist) {
179  if (i < 8) {sl = 0;} else { sl = floor((i - 8) / 6) + 1;}
180  m_hHitDistInCDCHit[i] = getHist(Form("hHitDistInCDCHit_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
181  m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
182  m_hHitDistInCDCHit[i]->SetLineColor(kGreen);
183  m_hHitDistInTrCand[i] = getHist(Form("hHitDistInTrCand_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
184  m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
185  m_hHitDistInTrCand[i]->SetLineColor(kRed);
186  m_hHitDistInTrack[i] = getHist(Form("hHitDistInTrack_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
187  m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
188  }
189  const double normResRange = 20;
190  const double residualRange = 0.3;
191  std::string title, name;
192  if (m_plotResidual) {
193  name = (boost::format("hist_ResidualsU%1%") % i).str();
194  title = (boost::format("unnormalized, unbiased residuals in layer %1%;cm;Tracks") % i).str();
195  m_hResidualU[i] = getHist(name, title, 500, -residualRange, residualRange);
196 
197  name = (boost::format("hNormalizedResidualsU%1%") % i).str();
198  title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
199  m_hNormalizedResidualU[i] = getHist(name, title, 500, -normResRange, normResRange);
200 
201  name = (boost::format("DxDt%1%") % i).str();
202  title = (boost::format("Drift Length vs Drift time at Layer_%1%;Drift Length (cm);Drift time (ns)") % i).str();
203  m_hDxDt[i] = getHist(name, title, 200, -1, 1, 450, -50, 400);
204  }
205  if (m_fillExpertHistos) {
206  name = (boost::format("hNDFResidualsU%1%") % i).str();
207  title = (boost::format("unnormalized, unbiased residuals along U in layer %1%;NDF;cm;Tracks") % i).str();
208  m_hNDFResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -residualRange, residualRange);
209 
210  name = (boost::format("hNDFNormalizedResidualsU%1%") % i).str();
211  title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
212  m_hNDFNormalizedResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -normResRange, normResRange);
213  }
214  }
215  oldDir->cd();
216 }
217 
218 void CDCCRTestModule::initialize()
219 {
220  REG_HISTOGRAM
221  StoreArray<Belle2::Track> storeTrack(m_trackArrayName);
222  StoreArray<RecoTrack> recoTracks(m_recoTrackArrayName);
223  StoreArray<Belle2::TrackFitResult> storeTrackFitResults(m_trackFitResultArrayName);
224  StoreArray<Belle2::CDCHit> cdcHits(m_cdcHitArrayName);
225  RelationArray relRecoTrackTrack(recoTracks, storeTrack, m_relRecoTrackTrackName);
226  //Store names to speed up creation later
227  m_recoTrackArrayName = recoTracks.getName();
228  m_trackFitResultArrayName = storeTrackFitResults.getName();
229  m_relRecoTrackTrackName = relRecoTrackTrack.getName();
230 
231  for (size_t i = 0; i < m_allHistos.size(); ++i) {
232  m_allHistos[i]->Reset();
233  }
234  B2ASSERT("Trigger Position (TriggerPos) must be 3 components.", m_TriggerPos.size() == 3);
235  B2ASSERT("Normal vector of Trigger Plane (NormTriggerPlaneDirection) must be 3 components.", m_TriggerPlaneDirection.size() == 3);
236  B2ASSERT("Trigger size (TriggerSize) must be 2 component width and length(z direction)", m_TriggerSize.size() == 2);
237  B2ASSERT("List of Lower boundary (IWireLow) ( for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
238  B2ASSERT("List of Upper boundary (IWireUp) for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
239  B2INFO("Trigger Position (" << m_TriggerPos.at(0) << " ," << m_TriggerPos.at(1) << " ," << m_TriggerPos.at(2) << ")");
240 }
241 
242 void CDCCRTestModule::beginRun()
243 {
244 }
245 
246 void CDCCRTestModule::event()
247 {
248  evtT0 = 0.;
249  const StoreArray<Belle2::Track> storeTrack(m_trackArrayName);
250  const StoreArray<Belle2::TrackFitResult> storeTrackFitResults(m_trackFitResultArrayName);
251  const StoreArray<Belle2::CDCHit> cdcHits(m_cdcHitArrayName);
252  const StoreArray<Belle2::RecoTrack> recoTracks(m_recoTrackArrayName);
253  const RelationArray relTrackTrack(recoTracks, storeTrack, m_relRecoTrackTrackName);
254 
255  /* CDCHit distribution */
256  if (m_MakeHitDist) {
257  for (int i = 0; i < cdcHits.getEntries(); ++i) {
258  Belle2::CDCHit* hit = cdcHits[i];
259  m_hHitDistInCDCHit[getICLayer(hit->getISuperLayer(), hit->getILayer())]->Fill(hit->getIWire());
260  m_h2DHitDistInCDCHit->Fill(hit->getIWire(), getICLayer(hit->getISuperLayer(), hit->getILayer()));
261  }
262  }
263  // Loop over Recotracks
264  int nTr = recoTracks.getEntries();
265  m_hNTracksPerEvent->Fill(nTr);
266 
267  int nfitted = 0;
268 
269  for (int i = 0; i < nTr; ++i) {
270  RecoTrack* track = recoTracks[i];
271  if (track->getDirtyFlag()) {B2INFO("Dirty flag was set for track: " << track->getPositionSeed().Y()); continue;}
272  m_hNHits_trackcand->Fill(track->getNumberOfCDCHits());
273  if (m_MakeHitDist) {
274  getHitDistInTrackCand(track);
275  }
276  if (!track->hasTrackFitStatus()) {
277  m_hNTracks->Fill("Track not fitted", 1.0);
278  continue;
279  }
280  if (!track->getTrackFitStatus()->isFitted()) {
281  m_hNTracks->Fill("Track not fitted", 1.0);
282  continue;
283  }
284  const genfit::FitStatus* fs = track->getTrackFitStatus();
285  if (!fs || !fs->isFitConverged()) {//not fully convergence
286  m_hNTracks->Fill("fitted, not converged", 1.0);
287  B2DEBUG(99, "------Fitted but not converged");
288  continue;
289  }
290 
291  m_hNTracks->Fill("fitted, converged", 1.0);
292  B2DEBUG(99, "-------Fittted and Conveged");
293 
294  nfitted = nfitted + 1;
296  const Belle2::Track* b2track = track->getRelatedFrom<Belle2::Track>();
297  if (!b2track) {B2DEBUG(99, "No relation found"); continue;}
298  fitresult = b2track->getTrackFitResult(Const::muon);
299 
300  if (!fitresult) {
301  B2WARNING("track was fitted but Relation not found");
302  continue;
303  }
304 
305  if (m_noBFit) {ndf = fs->getNdf() + 1;} // incase no Magnetic field, NDF=4;
306  else {ndf = fs->getNdf();}
307  double Chi2 = fs->getChi2();
308  TrPval = std::max(0., ROOT::Math::chisquared_cdf_c(Chi2, ndf));
309  m_hPval->Fill(TrPval);
310  m_hNDF->Fill(ndf);
311  if (ndf < 15) continue;
312  if (m_EventT0Extraction) {
313  // event with is fail to extract t0 will be exclude from analysis
314  if (m_eventTimeStoreObject.isValid() && m_eventTimeStoreObject->hasEventT0()) {
315  evtT0 = m_eventTimeStoreObject->getEventT0();
316  m_hEvtT0->Fill(evtT0);
317  } else { continue;}
318  }
319 
320  d0 = fitresult->getD0();
321  z0 = fitresult->getZ0();
322  tanL = fitresult->getTanLambda();
323  omega = fitresult->getOmega();
324  phi0 = fitresult->getPhi0() * 180 / M_PI;
325  Pt = fitresult->getMomentum().Perp();
326  m_hPhi0->Fill(phi0);
327  m_hChi2->Fill(Chi2);
328  if (Pt < m_MinimumPt) continue;
329  if (m_hitEfficiency && track->getNumberOfCDCHits() > 30 && TrPval > 0.001) {
330  HitEfficiency(track);
331  }
332  if (m_fillExpertHistos) {
333  m_hNDFChi2->Fill(ndf, fs->getChi2());
334  m_hNDFPval->Fill(ndf, TrPval);
335  }
336  try {
337  plotResults(track);
338  } catch (const genfit::Exception& e) {
339  // at least log that there was something going very wrong
340  B2ERROR("Exception when calling the plotResults method" << e.what());
341  }
342 
343  if (m_EstimateResultForUnFittedLayer) {
344  //try {
345  // DONT IGNORE THE EXCEPTION BEING THROWN HERE
346  getResidualOfUnFittedLayer(track);
347  // plotResults(track);
348  //} catch (...) {
349  //B2ERROR (" fatal 2! ");
350 
351  //}
352  }
353  }
354 
355  m_hNTracksPerEventFitted->Fill(nfitted);
356 }
357 
358 void CDCCRTestModule::endRun()
359 {
360 }
361 
362 void CDCCRTestModule::terminate()
363 {
364 }
365 
366 void CDCCRTestModule::plotResults(Belle2::RecoTrack* track)
367 {
368  m_trigHitPos = getTriggerHitPosition(track);
369  trigHitPos_x = m_trigHitPos.X();
370  trigHitPos_z = m_trigHitPos.Z();
371  m_hTriggerHitZX->Fill(m_trigHitPos.Z(), m_trigHitPos.X());
372  bool hittrig = (sqrt((m_trigHitPos.X() - m_TriggerPos[0]) * (m_trigHitPos.X() - m_TriggerPos[0]) +
373  (m_trigHitPos.Y() - m_TriggerPos[1]) * (m_trigHitPos.Y() - m_TriggerPos[1])) < m_TriggerSize[0] / 2
374  && fabs(m_trigHitPos.Z() - m_TriggerPos[2]) < m_TriggerSize[1] / 2) ? true : false;
375  if (hittrig) {trighit = 1;}
376  else {trighit = 0;}
377  static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
379  m_hNHits->Fill(track->getNumberOfCDCHits());
380 
381  std::vector<genfit::TrackPoint*> tps = track->getHitPointsWithMeasurement();
382  numhits = tps.size();
383  BOOST_FOREACH(genfit::TrackPoint * tp, tps) {
384  if (!tp->hasRawMeasurements())
385  continue;
386 
387  const genfit::AbsMeasurement* raw = tp->getRawMeasurement(0);
388  const CDCRecoHit* rawCDC = dynamic_cast<const CDCRecoHit*>(raw);
389  if (rawCDC) {
390  WireID wireid = rawCDC->getWireID();
392  if (!kfi) {B2DEBUG(199, "No Fitter Info: Layer " << wireid.getICLayer()); continue;}
393 
394  for (unsigned int iMeas = 0; iMeas < kfi->getNumMeasurements(); ++iMeas) {
395  if ((kfi->getWeights().at(iMeas)) > 0.5) {
396  const genfit::MeasurementOnPlane& residual_b = kfi->getResidual(iMeas, true);
397  const genfit::MeasurementOnPlane& residual_u = kfi->getResidual(iMeas, false);
398  lay = wireid.getICLayer();
399  IWire = wireid.getIWire();
400  if (m_MakeHitDist) {
401  m_hHitDistInTrack[lay]->Fill(IWire);
402  m_h2DHitDistInTrack->Fill(IWire, lay);
403  }
404  boardID = cdcgeo.getBoardID(wireid);
405  Pval = TrPval;
406  tdc = rawCDC->getCDCHit()->getTDCCount();
407  adc = rawCDC->getCDCHit()->getADCCount();
408 
409  const genfit::MeasuredStateOnPlane& mop = kfi->getFittedState();
410  const TVector3 pocaOnWire = mop.getPlane()->getO();//Local wire position
411  const TVector3 pocaOnTrack = mop.getPlane()->getU();//residual direction
412  const TVector3 pocaMom = mop.getMom();
413  alpha = cdcgeo.getAlpha(pocaOnWire, pocaMom) ;
414  theta = cdcgeo.getTheta(pocaMom);
415  //Convert to outgoing
416  x_mea = kfi->getMeasurementOnPlane(iMeas)->getState()(0);
417  x_b = kfi->getFittedState(true).getState()(3);// x fit biased
418  res_b = residual_b.getState()(0);
419  x_u = kfi->getFittedState(false).getState()(3);//x fit unbiased
420  res_u = residual_u.getState()(0);
421  if (x_u > 0) lr = 1;
422  else lr = 0;
423  if (fabs(alpha) > M_PI / 2) {
424  x_b *= -1;
425  res_b *= -1;
426  x_u *= -1;
427  res_u *= -1;
428  }
429  x_mea = copysign(x_mea, x_u);
430  lr = cdcgeo.getOutgoingLR(lr, alpha);
431  theta = cdcgeo.getOutgoingTheta(alpha, theta);
432  alpha = cdcgeo.getOutgoingAlpha(alpha);
433  B2DEBUG(199, "x_unbiased " << x_u << " |left_right " << lr);
434  if (m_calExpectedDriftTime) { t_fit = cdcgeo.getDriftTime(std::abs(x_u), lay, lr, alpha , theta);}
435  alpha *= 180 / M_PI;
436  theta *= 180 / M_PI;
437  m_hAlpha->Fill(alpha);
438  m_hTheta->Fill(theta);
439 
440  //B2INFO("resi V " <<residual.getState()(1));
441  // weight_res = residual.getWeight();
442  absRes_b = std::abs(x_b + res_b) - std::abs(x_b);
443  absRes_u = std::abs(x_u + res_u) - std::abs(x_u);
444  weight = residual_u.getWeight();
445  res_b_err = std::sqrt(residual_b.getCov()(0, 0));
446  res_u_err = std::sqrt(residual_u.getCov()(0, 0));
447 
448  t = tdcTrans->getDriftTime(tdc, wireid, mop.getTime(), pocaOnWire.Z(), adc);
449  z = pocaOnWire.Z();
450 
451  // t = getCorrectedDriftTime(wireid, tdc, adc, z, z0);
452  if (m_StoreCDCSimHitInfo) {
453  CDCSimHit* simhit = rawCDC->getCDCHit()->getRelated<Belle2::CDCSimHit>();
454  if (simhit) {
455  x_sim = simhit->getDriftLength();
456  z_sim = simhit->getPosWire().Z();
457  dt_flight_sim = simhit->getFlightTime();
458  }
459  }
460  m_tree->Fill();
461  if (m_plotResidual) {
462  m_hDxDt[lay]->Fill(x_u, t);
463  m_hResidualU[lay]->Fill(res_b, weight);
464  m_hNormalizedResidualU[lay]->Fill(res_b / sqrt(residual_b.getCov()(0, 0)), weight);
465  }
466  if (m_fillExpertHistos) {
467  m_hNDFResidualU[lay]->Fill(ndf, res_b, weight);
468  m_hNDFResidualU[lay]->Fill(ndf, res_b);
469  m_hNDFNormalizedResidualU[lay]->Fill(ndf, res_b / std::sqrt(residual_b.getCov()(0, 0)), weight);
470  }
471  } //NDF
472  // }//end of if isU
473  }//end of for
474  }//end of rawCDC
475  }//end of for tp
476 }//end of func
477 
478 void CDCCRTestModule::getHitDistInTrackCand(const RecoTrack* track)
479 {
480  BOOST_FOREACH(const RecoHitInformation::UsedCDCHit * cdchit, track->getCDCHitList()) {
481  int iclay = getICLayer(cdchit->getISuperLayer(), cdchit->getILayer());
482  B2DEBUG(99, "In TrackCand: ICLayer: " << iclay << "IWire: " << cdchit->getIWire());
483  m_hHitDistInTrCand[iclay]->Fill(cdchit->getIWire());
484  m_h2DHitDistInTrCand->Fill(cdchit->getIWire(), iclay);
485  }
486 }
487 
488 TVector3 CDCCRTestModule::getTriggerHitPosition(RecoTrack* track)
489 {
490  TVector3 trigpos(m_TriggerPos.at(0), m_TriggerPos.at(1), m_TriggerPos.at(2));
491  TVector3 trigDir(m_TriggerPlaneDirection.at(0), m_TriggerPlaneDirection.at(1), m_TriggerPlaneDirection.at(2));
492  const genfit::AbsTrackRep* trackRepresentation = track->getCardinalRepresentation();
493  genfit::MeasuredStateOnPlane mop = track->getMeasuredStateOnPlaneClosestTo(trigpos, trackRepresentation);
494  TVector3 pos(-200, 200, 200);
495  try {
496  double l = mop.extrapolateToPlane(genfit::SharedPlanePtr(new genfit::DetPlane(trigpos, trigDir)));
497  if (fabs(l) < 1000) pos = mop.getPos();
498  } catch (const genfit::Exception& er) {
499  B2WARNING("extrapolate to Trigger counter failure" << er.what());
500  }
501  return pos;
502 }
503 void CDCCRTestModule::HitEfficiency(const Belle2::RecoTrack* track)
504 {
505  /* static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
506  for (int i = 0; i < 56; ++i) {
507  double rcell = (rinnerlayer[i] + routerlayer[i]) / 2;
508  double arcL = h.getArcLength2DAtCylindricalR(rcell);
509  const TVector3 hitpos = h.getPositionAtArcLength2D(arcL);
510  int cellID = cdcgeo.cellId(i, hitpos);
511  B2INFO("Hit at LayerID - CellID: " << i << "-" << cellID);
512  }
513  */
515  BOOST_FOREACH(const RecoHitInformation::UsedCDCHit * cdchit, track->getCDCHitList()) {
516  WireID Wid = WireID(cdchit->getID());
517  const genfit::TrackPoint* tp = track->getCreatedTrackPoint(track->getRecoHitInformation(cdchit));
518  //some hit didn't take account in fitting, so I use left/right info frm track finding results.
519  int RLInfo = 0;
520  RecoHitInformation::RightLeftInformation rightLeftHitInformation = track->getRecoHitInformation(cdchit)->getRightLeftInformation();
521  if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_left) {
522  RLInfo = -1;
523  } else if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_right) {
524  RLInfo = 1;
525  } else continue;
526 
527  if (!tp->hasRawMeasurements())
528  continue;
530  if (!kfi) continue;
531 
532  // double max = std::max_element(kfi->getWeights(),kfi->getNumMeasurements());
533  double max = 0.;
534  unsigned short imea = 0;
535  for (unsigned int iMeas = 0; iMeas < kfi->getNumMeasurements(); ++iMeas) {
536  double ww = kfi->getWeights().at(iMeas);
537  if (ww > max) {max = ww; imea = iMeas;}
538  }
539  double xx = kfi->getMeasurementOnPlane(imea)->getState()(0);
540  m_hHitEff_soft[Wid.getICLayer()]->Fill(std::copysign(xx, RLInfo), max);
541  }
543 }
544 
545 void CDCCRTestModule::getResidualOfUnFittedLayer(Belle2::RecoTrack* track)
546 {
547  B2INFO("Start estimate residual for un-fitted layer");
548  B2INFO("position seed" << track->getPositionSeed().Y());
549  static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
551  const genfit::AbsTrackRep* trackRepresentation = track->getCardinalRepresentation();
552  x_b = 0; res_b = 0; res_b_err = 0;
553  x_u = 0; res_u = 0; res_u_err = 0;
554  z = 0; dt_flight_sim = 0; z_prop = 0; t = 0;
555  dt_prop = 0; dt_flight = 0; alpha = 0; theta = 0;
556  tdc = 0; adc = 0; lay = 0; IWire = 0;
557  // ndf =0; Pval=0; numhits=0; trigHitPos_x= 0; trigHitPos_z=0;
558  // trighit=1; lr=-1;
559  B2INFO("number of cdchit" << track->getCDCHitList().size());
560  B2INFO("number of point use int fit" << ndf + 4);
561 
562  typedef std::pair<double, const RecoHitInformation*> SortingRecoHitPair;
563 
564  for (const RecoHitInformation::UsedCDCHit* cdchit : track->getCDCHitList()) {
565  // RecoHitInformation* recoHitInfo = track->getRecoHitInformation(cdchit);
566  if (track->getRecoHitInformation(cdchit)->useInFit()) continue;
567  // yeah is true, but better to check for the above
568  //if ((recoHitInfo->getCreatedTrackPoint())) continue;
569  // This was wrong: the sorting parameter is not the hitID
570  int hitSortingParameter = track->getRecoHitInformation(cdchit)->getSortingParameter();
571 
572  SortingRecoHitPair frontSideHit = std::make_pair(0, nullptr);;
573  SortingRecoHitPair backsideSideHit = std::make_pair(0, nullptr);;
574  SortingRecoHitPair hit4extraction; // = std::make_pair(0, nullptr); avoid cppcheck warning.
575 
576  //find closest hit to hit which do not fit
577  // if (hitID < track->getNumberOfCDCHits() / 2) { //case for first part of track, searching forward, stop at first choice
578  for (const RecoHitInformation::UsedCDCHit* hit : track->getCDCHitList()) {
579  RecoHitInformation const* recoHitInfo_fw = track->getRecoHitInformation(hit);
580  if (recoHitInfo_fw->useInFit()) { //may be should check fit status of that hit, do it later.
581  frontSideHit = std::make_pair(recoHitInfo_fw->getSortingParameter(), recoHitInfo_fw);
582  break;
583  }
584  }
585  //}
586  // if (hitID > track->getNumberOfCDCHits() / 2) { //case for last part of track, searching backward, and stop at the first choice
587  auto hitListReverse = track->getCDCHitList();
588  std::reverse(hitListReverse.begin() , hitListReverse.end());
589  for (const RecoHitInformation::UsedCDCHit* hit : hitListReverse) {
590  RecoHitInformation const* recoHitInfo_bkw = track->getRecoHitInformation(hit);
591  if (recoHitInfo_bkw->useInFit()) {
592  // also get proper id here
593  backsideSideHit = std::make_pair(recoHitInfo_bkw->getSortingParameter(), recoHitInfo_bkw);
594  break;
595  }
596  }
597  B2DEBUG(99, "forward sorting parameter: " << frontSideHit.first << " |backward sorting parameter = " << backsideSideHit.first);
598  if (std::fabs(frontSideHit.first - hitSortingParameter) < std::fabs(backsideSideHit.first - hitSortingParameter)) {
599  hit4extraction = frontSideHit;
600  } else {
601  hit4extraction = backsideSideHit;
602  }
603 
604  // no proper neighbouring hit found
605  if (hit4extraction.second == nullptr)
606  continue;
607 
608  auto closestHitTrackPoint = track->getCreatedTrackPoint(hit4extraction.second);
609  // now we need to find the hit behind this sorting param !
610  // but easy: we have already the TrackPoint via the RecoHitInformation
611  genfit::MeasuredStateOnPlane meaOnPlane = closestHitTrackPoint->getFitterInfo(trackRepresentation)->getFittedState(
612  true /* biased version */);
613 
614  //start to extrapolation
615  WireID wireid = WireID(cdchit->getID());
616  // double flightTime1 = meaOnPlane.getTime();
617  //Now reconstruct plane for hit
618  genfit::SharedPlanePtr plane = nullptr;
619  try {
620  plane = constructPlane(meaOnPlane, wireid);
621  } catch (const genfit::Exception& e) {
622  B2WARNING("Error happen, can not reconstruct plan for extrapolating" << e.what());
623  continue;
624  }
625  double segmentLength;
626  try {
627  segmentLength = meaOnPlane.extrapolateToPlane(plane);
628  } catch (const genfit::Exception& e) {
629  B2WARNING("Could not extrapolate the fit" << e.what());
630  continue;
631  }
632  IWire = wireid.getIWire();
633  lay = wireid.getICLayer();
634  const TVector3 pocaOnWire = meaOnPlane.getPlane()->getO();//Local wire position
635  const TVector3 pocaMom = meaOnPlane.getMom();
636  x_u = meaOnPlane.getState()(3);
637  alpha = cdcgeo.getAlpha(pocaOnWire, pocaMom) ;
638  theta = cdcgeo.getTheta(pocaMom);
639  z = pocaOnWire.Z();
640  z_prop = z - cdcgeo.wireBackwardPosition(wireid, CDCGeometryPar::c_Aligned).Z();
641  dt_prop = z_prop / 27.25;
642  //Convert to outgoing
643  if (x_u > 0) lr = 1;
644  else lr = 0;
645  if (fabs(alpha) > M_PI / 2) {
646  x_u *= -1;
647  }
648  lr = cdcgeo.getOutgoingLR(lr, alpha);
649  theta = cdcgeo.getOutgoingTheta(alpha, theta);
650  alpha = cdcgeo.getOutgoingAlpha(alpha);
651  dt_flight = meaOnPlane.getTime();
652  x_mea = tdcTrans->getDriftLength(cdchit->getTDCCount(), wireid, dt_flight, lr, pocaOnWire.Z(), alpha, theta, cdchit->getADCCount());
653  x_mea = std::copysign(x_mea, x_u);
654  res_u = x_mea - x_u;
655  absRes_u = fabs(x_mea) - fabs(x_u);
656  alpha *= 180 / M_PI;
657  theta *= 180 / M_PI;
658  m_hAlpha->Fill(alpha);
659  m_hTheta->Fill(theta);
660  if (m_StoreCDCSimHitInfo) {
661  CDCSimHit* simhit = cdchit->getRelated<Belle2::CDCSimHit>();
662  if (simhit) {
663  x_sim = simhit->getDriftLength();
664  z_sim = simhit->getPosWire().Z();
665  dt_flight_sim = simhit->getFlightTime();
666  }
667  }
668  B2DEBUG(199, "we calculate residua for lay - IWire: " << lay << " - " << IWire);
669  B2DEBUG(199, "distance between two hit" << segmentLength);
670  B2DEBUG(199, "Flight Time (extra | sim)" << dt_flight << " - " << dt_flight_sim);
671  B2DEBUG(199, "DriftLength (cal | sim)" << x_mea << " - " << x_sim);
672  m_tree->Fill();
673  }
674 }
675 
676 const genfit::SharedPlanePtr CDCCRTestModule::constructPlane(const genfit::MeasuredStateOnPlane& state, WireID m_wireID)
677 {
678  // We reconstruct plane from measuedStateOnPlane from one fitted hit.
679  // because I don't want to change state of this plane so I create other state to extrapolate.
680  // first: extrapolate to wire (ideal geometry, nosag) to find z pos than get virtual wire pos due to sag,
681  // extrapolate again to found z pos and U.
683  const StateOnPlane stateOnPlane = StateOnPlane(state.getState(), state.getPlane(), state.getRep());
684  genfit::StateOnPlane st(stateOnPlane);
685 
686  const TVector3& Wire1PosIdeal(cdcgeoTrans->getWireBackwardPosition(m_wireID));
687  const TVector3& Wire2PosIdeal(cdcgeoTrans->getWireForwardPosition(m_wireID));
688 
689  // unit vector of wire direction
690  TVector3 WireDirectionIdeal = Wire2PosIdeal - Wire1PosIdeal;
691  WireDirectionIdeal.SetMag(1.);//normalized
692 
693  // extraplate to find z
694  const genfit::AbsTrackRep* rep = state.getRep();
695  rep->extrapolateToLine(st, Wire1PosIdeal, WireDirectionIdeal);
696  const TVector3& PocaIdeal = rep->getPos(st);
697 
698  double zPOCA = (Wire1PosIdeal.Z()
699  + WireDirectionIdeal.Dot(PocaIdeal - Wire1PosIdeal) * WireDirectionIdeal.Z());
700 
701  // Now re-extrapolate to new wire direction, wire sag was taking account.
702  const TVector3& wire1(cdcgeoTrans->getWireBackwardPosition(m_wireID, zPOCA));
703  const TVector3& wire2(cdcgeoTrans->getWireForwardPosition(m_wireID, zPOCA));
704 
705  // unit vector of wire direction (include sag)
706  TVector3 wireDirection = wire2 - wire1;
707  wireDirection.SetMag(1.);
708 
709  // extraplate to find poca
710  rep->extrapolateToLine(st, wire1, wireDirection);
711  const TVector3& poca = rep->getPos(st);
712  TVector3 dirInPoca = rep->getMom(st);
713  dirInPoca.SetMag(1.);
714  const TVector3& pocaOnWire = wire1 + wireDirection.Dot(poca - wire1) * wireDirection;
715  if (fabs(wireDirection.Angle(dirInPoca)) < 0.01) {
716  B2WARNING("cannot construct det plane, track parallel with wire");
717  }
718  // construct orthogonal (unit) vector for plane
719  const TVector3& U = wireDirection.Cross(dirInPoca);
720  genfit::SharedPlanePtr pl = genfit::SharedPlanePtr(new genfit::DetPlane(pocaOnWire, U, wireDirection));
721  return pl;
722 }
723 
Belle2::CDCSimHit::getFlightTime
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:201
genfit::Exception
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition: Exception.h:48
genfit::TrackPoint
Object containing AbsMeasurement and AbsFitterInfo objects.
Definition: TrackPoint.h:46
Belle2::CDCHit::getISuperLayer
unsigned short getISuperLayer() const
Getter for iSuperLayer.
Definition: CDCHit.h:195
Belle2::RelationArray
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:72
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
genfit::SharedPlanePtr
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Definition: SharedPlanePtr.h:40
genfit::FitStatus::getChi2
double getChi2() const
Get chi^2 of the fit.
Definition: FitStatus.h:120
Belle2::CDC::CDCGeometryPar::getOutgoingTheta
double getOutgoingTheta(const double alpha, const double theta) const
Converts incoming- to outgoing-theta.
Definition: CDCGeometryPar.cc:2700
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::Track::getTrackFitResult
const TrackFitResult * getTrackFitResult(const Const::ChargedStable &chargedStable) const
Access to TrackFitResults.
Definition: Track.cc:19
Belle2::CDC::RealisticTDCCountTranslator
Translator mirroring the realistic Digitization.
Definition: RealisticTDCCountTranslator.h:36
Belle2::CDCHit::getID
unsigned short getID() const
Getter for encoded wire number.
Definition: CDCHit.h:204
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::CDCHit::getTDCCount
short getTDCCount() const
Getter for TDC count.
Definition: CDCHit.h:230
genfit::StateOnPlane
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:47
genfit
Defines for I/O streams used for error and debug printing.
Definition: AlignablePXDRecoHit.h:19
genfit::TrackPoint::getKalmanFitterInfo
KalmanFitterInfo * getKalmanFitterInfo(const AbsTrackRep *rep=nullptr) const
Helper to avoid casting.
Definition: TrackPoint.cc:180
Belle2::StoreAccessorBase::getName
const std::string & getName() const
Return name under which the object is saved in the DataStore.
Definition: StoreAccessorBase.h:130
genfit::AbsTrackRep
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Belle2::RelationsInterface::getRelated
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Definition: RelationsObject.h:280
Belle2::CDCSimHit
Example Detector.
Definition: CDCSimHit.h:33
Belle2::CDCRecoHit
This class is used to transfer CDC information to the track fit.
Definition: CDCRecoHit.h:43
Belle2::CDCHit::getADCCount
unsigned short getADCCount() const
Getter for integrated charge.
Definition: CDCHit.h:241
Belle2::CDC::RealisticCDCGeometryTranslator
This class uses the realistic detector geometry (the one after alignment procedure) for the translati...
Definition: RealisticCDCGeometryTranslator.h:32
genfit::AbsMeasurement
Contains the measurement and covariance in raw detector coordinates.
Definition: AbsMeasurement.h:42
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::CDC::CDCGeometryPar
The Class for CDC Geometry Parameters.
Definition: CDCGeometryPar.h:75
Belle2::CDC::CDCGeometryPar::getOutgoingLR
unsigned short getOutgoingLR(const unsigned short lr, const double alpha) const
Converts incoming-lr to outgoing-lr.
Definition: CDCGeometryPar.cc:2680
Belle2::CDCRecoHit::getWireID
WireID getWireID() const
Getter for WireID object.
Definition: CDCRecoHit.h:60
genfit::AbsTrackRep::extrapolateToLine
virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a line, and returns the extrapolation length and,...
genfit::KalmanFitterInfo::getResidual
MeasurementOnPlane getResidual(unsigned int iMeasurement=0, bool biased=false, bool onlyMeasurementErrors=true) const override
Get unbiased (default) or biased residual from ith measurement.
Definition: KalmanFitterInfo.cc:314
genfit::KalmanFitterInfo
Collects information needed and produced by a AbsKalmanFitter implementations and is specific to one ...
Definition: KalmanFitterInfo.h:44
Belle2::CDC::CDCGeometryPar::wireBackwardPosition
const TVector3 wireBackwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
Definition: CDCGeometryPar.cc:1662
Belle2::CDC::CDCGeometryPar::getTheta
double getTheta(const TVector3 &momentum) const
Returns track incident angle (theta in rad.).
Definition: CDCGeometryPar.cc:2674
Belle2::CDCHit::getILayer
unsigned short getILayer() const
Getter for iLayer.
Definition: CDCHit.h:183
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
genfit::FitStatus::isFitConverged
bool isFitConverged(bool inAllPoints=true) const
Did the fit converge (in all Points or only partially)?
Definition: FitStatus.h:105
Belle2::CDC::CDCGeometryPar::getDriftTime
double getDriftTime(double dist, unsigned short layer, unsigned short lr, double alpha, double theta) const
Return the drift time to the sense wire.
Definition: CDCGeometryPar.cc:2457
Belle2::CDCHit::getIWire
unsigned short getIWire() const
Getter for iWire.
Definition: CDCHit.h:177
Belle2::CDC::CDCGeometryPar::getBoardID
unsigned short getBoardID(const WireID &wID) const
Returns frontend board id. corresponding to the wire id.
Definition: CDCGeometryPar.h:576
Belle2::CDC::RealisticTDCCountTranslator::getDriftLength
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
Definition: RealisticTDCCountTranslator.cc:106
genfit::AbsTrackRep::getPos
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
Belle2::RecoHitInformation
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
Definition: RecoHitInformation.h:48
Belle2::CDCSimHit::getDriftLength
double getDriftLength() const
The method to get drift length.
Definition: CDCSimHit.h:198
Belle2::RecoHitInformation::useInFit
bool useInFit() const
Get the flag, whether this his should be used in a fit or not.
Definition: RecoHitInformation.h:254
Belle2::CDCRecoHit::getCDCHit
const CDCHit * getCDCHit() const
get the pointer to the CDCHit object that was used to create this CDCRecoHit object.
Definition: CDCRecoHit.h:123
genfit::FitStatus::getNdf
double getNdf() const
Get the degrees of freedom of the fit.
Definition: FitStatus.h:122
Belle2::CDC::CDCGeometryPar::getOutgoingAlpha
double getOutgoingAlpha(const double alpha) const
Converts incoming- to outgoing-alpha.
Definition: CDCGeometryPar.cc:2687
Belle2::CDC::CDCCRTestModule
CDC Cosmic test calibration module.
Definition: CDCCRTestModule.h:50
Belle2::CDCSimHit::getPosWire
TVector3 getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:216
Belle2::CDC::RealisticTDCCountTranslator::getDriftTime
double getDriftTime(unsigned short tdcCount, const WireID &wireID, double timeOfFlightEstimator, double z, unsigned short adcCount) override
Get Drift time.
Definition: RealisticTDCCountTranslator.cc:53
Belle2::CDC::RealisticCDCGeometryTranslator::getWireForwardPosition
const TVector3 getWireForwardPosition(const WireID &wireID) override
Get wire position at forward end.
Definition: RealisticCDCGeometryTranslator.h:41
genfit::KalmanFitterInfo::getFittedState
const MeasuredStateOnPlane & getFittedState(bool biased=true) const override
Get unbiased or biased (default) smoothed state.
Definition: KalmanFitterInfo.cc:179
Belle2::RecoHitInformation::getSortingParameter
unsigned int getSortingParameter() const
Get the sorting parameter.
Definition: RecoHitInformation.h:224
genfit::DetPlane
Detector plane.
Definition: DetPlane.h:59
Belle2::Track
Class that bundles various TrackFitResults.
Definition: Track.h:35
genfit::KalmanFitterInfo::getWeights
std::vector< double > getWeights() const
Get weights of measurements.
Definition: KalmanFitterInfo.cc:168
Belle2::StoreArray< Belle2::Track >
Belle2::CDC::RealisticCDCGeometryTranslator::getWireBackwardPosition
const TVector3 getWireBackwardPosition(const WireID &wireID) override
Get wire position at backward end.
Definition: RealisticCDCGeometryTranslator.h:56
genfit::Exception::what
virtual const char * what() const noexcept
Standard error message handling for exceptions. use like "std::cerr << e.what();".
Definition: Exception.cc:52
genfit::AbsTrackRep::getMom
virtual TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
Belle2::RecoHitInformation::RightLeftInformation
RightLeftInformation
The RightLeft information of the hit which is only valid for CDC hits.
Definition: RecoHitInformation.h:72
genfit::FitStatus
Class where important numbers and properties of a fit can be stored.
Definition: FitStatus.h:80
Belle2::WireID::getICLayer
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:26
Belle2::CDC::CDCGeometryPar::getAlpha
double getAlpha(const TVector3 &posOnWire, const TVector3 &momentum) const
Returns track incident angle in rphi plane (alpha in rad.).
Definition: CDCGeometryPar.cc:2661
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
genfit::MeasurementOnPlane
Measured coordinates on a plane.
Definition: MeasurementOnPlane.h:46
Belle2::HistoModule
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29