9#include "cdc/modules/cdcCalibrationCollector/CDCFudgeFactorCalibrationCollector.h"
10#include "analysis/utility/PCmsLabTransform.h"
11#include <framework/dataobjects/Helix.h>
12#include <mdst/dataobjects/HitPatternVXD.h>
13#include <mdst/dataobjects/ECLCluster.h>
14#include <mdst/dataobjects/EventLevelTrackingInfo.h>
15#include <analysis/dataobjects/Particle.h>
16#include <analysis/dataobjects/ParticleList.h>
17#include <analysis/variables/PIDVariables.h>
18#include <Math/ProbFuncMathCore.h>
53 auto m_tree =
new TTree(
m_treeName.c_str(),
"tree for cdc calibration");
54 m_tree->Branch<Int_t>(
"exp_run", &
expRun);
55 m_tree->Branch<Float_t>(
"pt_pos", &
ptPos);
56 m_tree->Branch<Float_t>(
"pt_neg", &
ptNeg);
57 m_tree->Branch<Float_t>(
"pz_pos", &
pzPos);
58 m_tree->Branch<Float_t>(
"pz_neg", &
pzNeg);
60 m_tree->Branch<Float_t>(
"pt_pos_cm", &
ptPosCm);
61 m_tree->Branch<Float_t>(
"pt_neg_cm", &
ptNegCm);
62 m_tree->Branch<Float_t>(
"pz_pos_cm", &
pzPosCm);
63 m_tree->Branch<Float_t>(
"pz_neg_cm", &
pzNegCm);
65 m_tree->Branch<Float_t>(
"theta_pos_cm", &
thetaPosCm);
66 m_tree->Branch<Float_t>(
"theta_neg_cm", &
thetaNegCm);
68 m_tree->Branch<Float_t>(
"phi0_pos_cm", &
phi0PosCm);
69 m_tree->Branch<Float_t>(
"theta_neg_cm", &
phi0NegCm);
71 m_tree->Branch<Float_t>(
"Pval_pos", &
pvalPos);
72 m_tree->Branch<Float_t>(
"Pval_neg", &
pvalNeg);
74 m_tree->Branch<Float_t>(
"ndf_pos", &
ndfPos);
75 m_tree->Branch<Float_t>(
"ndf_neg", &
ndfNeg);
77 m_tree->Branch<Float_t>(
"ncdc_pos", &
ncdcPos);
78 m_tree->Branch<Float_t>(
"ncdc_neg", &
ncdcNeg);
79 m_tree->Branch<Float_t>(
"npxd_pos", &
npxdPos);
80 m_tree->Branch<Float_t>(
"npxd_neg", &
npxdNeg);
81 m_tree->Branch<Float_t>(
"nsvd_pos", &
nsvdPos);
82 m_tree->Branch<Float_t>(
"nsvd_neg", &
nsvdNeg);
85 m_tree->Branch<Float_t>(
"ecl_track", &
eclTrack);
86 m_tree->Branch<Float_t>(
"ecl_neutral", &
eclNeutral);
88 m_tree->Branch<Float_t>(
"d0_pos", &
d0Pos);
89 m_tree->Branch<Float_t>(
"d0_neg", &
d0Neg);
90 m_tree->Branch<Float_t>(
"z0_pos", &
z0Pos);
91 m_tree->Branch<Float_t>(
"z0_neg", &
z0Neg);
92 m_tree->Branch<Float_t>(
"d0ip_pos", &
d0ipPos);
93 m_tree->Branch<Float_t>(
"d0ip_neg", &
d0ipNeg);
94 m_tree->Branch<Float_t>(
"z0ip_pos", &
z0ipPos);
95 m_tree->Branch<Float_t>(
"z0ip_neg", &
z0ipNeg);
96 m_tree->Branch<Float_t>(
"muid_pos", &
muidPos);
97 m_tree->Branch<Float_t>(
"muid_neg", &
muidNeg);
98 m_tree->Branch<Float_t>(
"eid_pos", &
eidPos);
99 m_tree->Branch<Float_t>(
"eid_neg", &
eidNeg);
101 registerObject<TTree>(
m_treeName.c_str(), m_tree);
103 auto m_hEventT0 =
new TH1F(
"hEventT0",
"Event T0", 200, -100, 100);
104 auto m_hExtraCDCHit =
new TH1F(
"hExtraCDCHit",
"Extra cdc hits", 500, 0, 5000);
105 auto m_hNDF_pos =
new TH1F(
"hNDF_pos",
"NDF of positive track;NDF;Tracks", 71, -1, 70);
106 auto m_hNDF_neg =
new TH1F(
"hNDF_neg",
"NDF of negative track;NDF;Tracks", 71, -1, 70);
107 auto m_hPval_pos =
new TH1F(
"hPval_pos",
"p-values of pos tracks;pVal;Tracks", 1000, 0, 1);
108 auto m_hPval_neg =
new TH1F(
"hPval_neg",
"p-values of neg tra cks;pVal;Tracks", 1000, 0, 1);
109 auto m_hnCDC_pos =
new TH1F(
"hnCDC_pos",
"nCDC hit of positive track ; nCDC ; Tracks", 71, -1, 70);
110 auto m_hnCDC_neg =
new TH1F(
"hnCDC_neg",
"nCDC hit of negative track ; nCDC ; Tracks", 71, -1, 70);
112 auto m_hdPt =
new TH1F(
"hdPt",
"#DeltaP_{t} ; #DeltaP_{t} ; Events ", 200, -0.5, 0.5);
113 auto m_hdD0 =
new TH1F(
"hdD0",
"#DeltaD_{0} ; #DeltaD_{0} ; Events ", 200, -0.1, 0.1);
114 auto m_hdZ0 =
new TH1F(
"hdZ0",
"#DeltaZ_{0} ; #DeltaD_{0} ; Events ", 200, -1.5, 1.5);
116 auto m_hdPt_cm =
new TH1F(
"hdPt_cm",
"#DeltaP_{t} in c.m frame ; #DeltaP_{t} (c.m) ; Events ", 200, -0.5, 0.5);
117 auto m_hdPtPt_cm =
new TH2F(
"hdPtPt_cm",
"#DeltaP_{t}:P_{t} in c.m frame ;P_{t} GeV/c ; #DeltaP_{t} (c.m) ", 50, 2., 7., 200, -0.5,
120 auto m_hdPhi0_cm =
new TH1F(
"hdPhi0_cm",
"#DeltaPhi_{0} in c.m frame ; #Delta#Phi_{0} in c.m ; Events ", 200, -0.7, 0.7);
121 auto m_hdTheta_cm =
new TH1F(
"hdTheta_cm",
"#Delta#theta in c.m frame ; #Delta#theta in c.m ; Events ", 200, -3.0, 3.0);
123 registerObject<TH1F>(
"hEventT0", m_hEventT0);
124 registerObject<TH1F>(
"hExtraCDCHit", m_hExtraCDCHit);
125 registerObject<TH1F>(
"hNDF_pos", m_hNDF_pos);
126 registerObject<TH1F>(
"hNDF_neg", m_hNDF_neg);
127 registerObject<TH1F>(
"hnCDC_pos", m_hnCDC_pos);
128 registerObject<TH1F>(
"hnCDC_neg", m_hnCDC_neg);
130 registerObject<TH1F>(
"hPval_pos", m_hPval_pos);
131 registerObject<TH1F>(
"hPval_neg", m_hPval_neg);
134 registerObject<TH1F>(
"hdPt", m_hdPt);
135 registerObject<TH1F>(
"hdD0", m_hdD0);
136 registerObject<TH1F>(
"hdZ0", m_hdZ0);
138 registerObject<TH1F>(
"hdPt_cm", m_hdPt_cm);
139 registerObject<TH2F>(
"hdPtPt_cm", m_hdPtPt_cm);
140 registerObject<TH1F>(
"hdPhi0_cm", m_hdPhi0_cm);
141 registerObject<TH1F>(
"hdTheta_cm", m_hdTheta_cm);
147 B2DEBUG(29,
"Number of muon canndiate:" << nCandidates);
148 if (nCandidates < 1)
return;
158 int run = m_EventMetaData->getRun();
159 int exp = m_EventMetaData->getExperiment();
160 expRun = exp * 1000000 + run;
165 int nG = gamma_list->getListSize();
166 B2DEBUG(29,
"Number of gamma: " << nG);
167 for (
int i = 0; i < nG; ++i) {
168 Particle* gamma = gamma_list->getParticle(i);
171 B2DEBUG(29,
"Sum of neutral ECL " <<
eclNeutral);
175 double thetaPos(0), thetaNeg(0);
178 for (
int i = 0; i < nCandidates; ++i) {
181 ROOT::Math::XYZVector v0Vertex = part->
getVertex();
184 for (
int j = 0; j < 2; ++j) {
187 short chg = d0->getCharge();
191 B2WARNING(
"No track fit result found.");
195 eclTrack += d0->getECLClusterEnergy();
196 double muid = Variable::muonID(d0);
197 double eid = Variable::muonID(d0);
206 thetaPos = fitresult->
getMomentum().Theta() * 180 / M_PI;
219 }
else if (chg < 0) {
226 thetaNeg = fitresult->
getMomentum().Theta() * 180 / M_PI;
253 if (charge_sum != 0) {
continue;}
256 || thetaPos < 45 || thetaPos > 125
257 || thetaNeg < 45 || thetaNeg > 125) {
return;}
263 if (eclTot > 2 ||
eclTrack > 2)
return;
277 getObjectPtr<TH1F>(
"hPval_pos")->Fill(
pvalPos);
278 getObjectPtr<TH1F>(
"hPval_neg")->Fill(
pvalNeg);
279 getObjectPtr<TH1F>(
"hNDF_pos")->Fill(
ndfPos);
280 getObjectPtr<TH1F>(
"hNDF_neg")->Fill(
ndfNeg);
281 getObjectPtr<TH1F>(
"hnCDC_pos")->Fill(
ncdcPos);
282 getObjectPtr<TH1F>(
"hnCDC_neg")->Fill(
ncdcNeg);
284 getObjectPtr<TH1F>(
"hdPt")->Fill(dPt);
285 getObjectPtr<TH1F>(
"hdD0")->Fill(dD0);
286 getObjectPtr<TH1F>(
"hdZ0")->Fill(dZ0);
288 getObjectPtr<TH1F>(
"hdPt_cm")->Fill(dPt_cm);
289 getObjectPtr<TH2F>(
"hdPtPt_cm")->Fill(Pt_cm, dPt_cm);
290 getObjectPtr<TH1F>(
"hdPhi0_cm")->Fill(dPhi0_cm);
291 getObjectPtr<TH1F>(
"hdTheta_cm")->Fill(dTheta_cm);
294 getObjectPtr<TTree>(
m_treeName.c_str())->Fill();
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event t0 object.
Float_t muidPos
Muon ID for positive charged track.
Double_t m_minCollinearityTheta
Minimum requirement for accolinear theta in c.m frame.
Double_t m_minCollinearityPhi0
Minimum requirement for accolinear phi0 in c.m frame.
Float_t ndfNeg
NDF of the negative track.
Float_t pzPos
Longitudinal momentum of the positive track
Int_t expRun
Exp and run numbers, encoded by exp*10^6+run.
Float_t eclTrack
sum of ECL associated to track
Float_t z0Pos
z0 of the positive track
Float_t phi0NegCm
phi0 of the negative track in c.m frame.
Float_t eidNeg
Electron ID for negative charged track.
CDCFudgeFactorCalibrationCollectorModule()
Constructor.
Float_t phi0PosCm
phi0 of the positive track in c.m frame.
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
Float_t nExtraCDCHits
Number of CDC hits not assigned to any tracks.
Float_t z0Neg
z0 of the negative track
Float_t ptNeg
Transeverse momentum of the negative track
Float_t ncdcPos
Number of CDC hit of the positive track.
Float_t npxdPos
Number of PXD hit of the positive track.
Float_t muidNeg
Muon ID for negative charged track.
Float_t pvalNeg
P-value of the negative track.
Float_t d0ipNeg
d0 w.r.t IP of the negative track
Float_t thetaNegCm
theta of the negative track in c.m frame.
std::string m_DiMuonListName
List name for the reconstruted dimuon.
Float_t pvalPos
P-value of the positive track.
void collect() override
Event action, collect information for calibration.
Float_t z0ipNeg
z0 w.r.t IP of the negative track
Float_t z0ipPos
z0 w.r.t IP of the positive track
Float_t ndfPos
NDF of the positive track.
Float_t ptPos
Transeverse momentum of the positive track
bool m_StoreNtuple
Option to store ntuple, =true: tree with these variables will be stored.
Float_t eclNeutral
Sum of neutral ECL clusgter.
StoreObjPtr< ParticleList > m_DiMuonList
List of the reconstructed dimion.
Float_t nsvdNeg
Number of SVD hit of the negative track.
std::string m_trackArrayName
Belle2::Track StoreArray name.
Float_t eidPos
Electron ID for positive charged track.
void prepare() override
Initializes the Module.
Float_t thetaPosCm
theta of the positive track in c.m frame.
Float_t d0ipPos
d0 w.r.t IP of the positive track
Float_t pzPosCm
Longitudinal momentum of the positive track in c.m frame.
void finish() override
Termination action.
Float_t d0Neg
d0 of the negative track
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
Float_t ncdcNeg
Number of CDC hit of the negative track.
Float_t ptPosCm
Transeverse momentum of the positive track in c.m frame.
Float_t nsvdPos
Number of SVD hit of the positive track.
virtual ~CDCFudgeFactorCalibrationCollectorModule()
Destructor.
Float_t npxdNeg
Number of PXD hit of the negative track.
Float_t ptNegCm
Transeverse momentum of the negative track in c.m frame.
std::string m_treeName
Name of tree for the output file.
StoreArray< Track > m_Tracks
Tracks.
Float_t d0Pos
d0 of the positive track
Float_t pzNegCm
Longitudinal momentum of the negative track in c.m frame.
std::string m_GammaListName
List name for the reconstruted dimuon.
Float_t pzNeg
Longitudinal momentum of the negative track
Calibration collector module base class.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
unsigned short getNPXDHits() const
Get total number of hits in the PXD.
unsigned short getNSVDHits() const
Get total number of hits in the SVD.
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...
Class to store reconstructed particles.
double getEnergy() const
Returns total energy.
ROOT::Math::XYZVector getVertex() const
Returns vertex position (POCA for charged, IP for neutral FS particles)
const Particle * getDaughter(unsigned i) const
Returns a pointer to the i-th daughter particle.
Type-safe access to single objects in the data store.
Values of the result of a track fit with a given particle hypothesis.
float getNDF() const
Getter for number of degrees of freedom of the track fit.
double getPValue() const
Getter for Chi2 Probability of the track fit.
ROOT::Math::PxPyPzEVector get4Momentum() const
Getter for the 4Momentum at the closest approach of the track in the r/phi projection.
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
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.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
UncertainHelix getUncertainHelix() const
Conversion to framework Uncertain Helix (i.e., with covariance).
HitPatternVXD getHitPatternVXD() const
Getter for the hit pattern in the VXD;.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
double passiveMoveBy(const ROOT::Math::XYZVector &by)
Moves origin of the coordinate system (passive transformation) by the given vector.
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.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.