9#include "cdc/modules/cdcCosmicAnalysis/CDCCosmicAnalysisModule.h"
10#include <framework/geometry/BFieldManager.h>
11#include <framework/geometry/B2Vector3.h>
12#include <framework/gearbox/Const.h>
13#include <framework/datastore/RelationArray.h>
15#include <Math/ProbFuncMathCore.h>
35 setDescription(
"Module for harvesting parameters of the two half (up/down) of a cosmic track for performance study");
43 "Store Track Parameter errors (true) or not (false)",
false);
62 tree->Branch(
"run", &
run,
"run/I");
67 tree->Branch(
"ndf1", &
ndf1,
"ndf1/D");
68 tree->Branch(
"Pt1", &
Pt1,
"Pt1/D");
69 tree->Branch(
"D01", &
D01,
"D01/D");
72 tree->Branch(
"Z01", &
Z01,
"Z01/D");
76 tree->Branch(
"Mom1",
"TVector3", &
Mom1);
79 tree->Branch(
"ndf2", &
ndf2,
"ndf2/D");
80 tree->Branch(
"Pt2", &
Pt2,
"Pt2/D");
81 tree->Branch(
"D02", &
D02,
"D02/D");
84 tree->Branch(
"Z02", &
Z02,
"Z02/D");
88 tree->Branch(
"Mom2",
"TVector3", &
Mom2);
91 tree->Branch(
"eD01", &
eD01,
"eD01/D");
93 tree->Branch(
"eOm1", &
eOm1,
"eOm1/D");
94 tree->Branch(
"eZ01", &
eZ01,
"eZ01/D");
97 tree->Branch(
"eD02", &
eD02,
"eD02/D");
99 tree->Branch(
"eOm2", &
eOm2,
"eOm2/D");
100 tree->Branch(
"eZ02", &
eZ02,
"eZ02/D");
108 ROOT::Math::XYZVector pos(0, 0, 0);
110 if (bfield.Z() > 0.5) {
112 B2INFO(
"CDCCosmicAnalysis: Magnetic field is ON");
115 B2INFO(
"CDCCosmicAnalysis: Magnetic field is OFF");
117 B2INFO(
"CDCCosmicAnalysis: BField at (0,0,0) = " << bfield.R());
140 bool up(
false), down(
false);
141 for (
int i = 0; i < nTr; ++i) {
146 B2WARNING(
"There is no track fit result for muon hypothesis; try with the closest mass hypothesis...");
149 B2WARNING(
"There is also no track fit reslt for the other mass hypothesis");
155 B2WARNING(
"Can not access RecoTrack of this Belle2::Track");
162 double ndf = fs->getNdf();
166 double Chi2 = fs->getChi2();
167 double TrPval = std::max(0., ROOT::Math::chisquared_cdf_c(Chi2, ndf));
168 double Phi0 = fitresult->
getPhi0();
174 if ((posSeed.
Y() > 0 && !up) ||
199 if ((posSeed.
Y() < 0 && !down) ||
223 if (
m_bField && charge1 * charge2 == 0)
return;
224 if (charge1 * charge2 >= 0 && up && down) {
DataType Y() const
access variable Y (= .at(1) without boundary check)
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event t0.
std::string m_recoTrackArrayName
Belle2::RecoTrack StoreArray nam.e.
double D02
D0 of 2nd track.
double eZ01
error on Z0 of 1st track.
double Pt2
Pt of 2nd track.
double Pval2
P-value of 2nd track.
double Omega1
omega of 1st track.
void initialize() override
Initializes the Module.
double Omega2
omega of 2nd track.
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
void event() override
Event action (main routine).
CDCCosmicAnalysisModule()
Constructor.
TVector3 Mom2
Momentum of 2nd track.
double eD01
error on D0 of 1st track.
void endRun() override
End run action.
double ndf1
degree of freedom of 1st track.
void terminate() override
Termination action.
bool m_phi0InRad
Unit of phi0, true: radian, false: degree.
double ndf2
degree of freedom of 2nd track.
double eD02
error on D0 of 2nd track.
std::string m_relRecoTrackTrackName
Releation between RecoTrack and Belle2:Track.
TVector3 posSeed1
seed position of the first track.
double etanL1
error on TanLambda of 1st track.
bool m_eventT0Extraction
run with event t0 extraction
void beginRun() override
Begin run action.
double eOm1
error on Omega of 1st track.
double Pval1
P-value of 1st track.
bool m_bField
Data are taken with B-field or not, if true, NDF=5 in cal P-value.
double eOm2
error on Omega of 2nd track.
double etanL2
error on TanLambda of 2nd track.
std::string m_trackArrayName
Belle2::Track StoreArray name.
TVector3 posSeed2
seed position of the second track.
double eZ02
error on Z0 of 2nd track.
TFile * tfile
Output file.
double Phi01
Phi0 of 1st track.
TTree * tree
output tree, save info of each hit.
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
short charge
charge of track
double Z01
Z0 of 1st track.
TVector3 Mom1
Momentum of 1st track.
double tanLambda2
Tanlambda of 2nd track.
double ePhi02
error on Phi0 of 2nd track.
double Phi02
Phi0 of 2nd track.
std::string m_treeName
output tree name.
double D01
D0 of 1st track.
StoreArray< RecoTrack > m_RecoTracks
Tracks.
StoreArray< Track > m_Tracks
Tracks.
double Z02
Z0 of 2nd track.
double ePhi01
error on Phi0 of 1st track.
StoreObjPtr< EventMetaData > m_EventMetaData
Event metadata.
double Pt1
Pt of 1st track.
double tanLambda1
TanLambda of 1st track.
virtual ~CDCCosmicAnalysisModule()
Destructor.
std::string m_outputFileName
Output file name.
bool m_storeTrackParErrors
Store error of track parameters or not.
static const ChargedStable muon
muon particle
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
This is the Reconstruction Event-Data Model Track.
ROOT::Math::XYZVector getPositionSeed() const
Return the position seed stored in the reco track. ATTENTION: This is not the fitted position.
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
Low-level class to create/modify relations between StoreArrays.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Values of the result of a track fit with a given particle hypothesis.
TMatrixDSym getCovariance5() const
Getter for covariance matrix of perigee parameters in matrix form.
short getChargeSign() const
Return track charge (1 or -1).
double getOmega() const
Getter for omega.
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
double getTanLambda() const
Getter for tanLambda.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
double getPhi0() const
Getter for phi0.
Class that bundles various TrackFitResults.
const TrackFitResult * getTrackFitResult(const Const::ChargedStable &chargedStable) const
Default Access to TrackFitResults.
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
B2Vector3< double > B2Vector3D
typedef for common usage with double
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.