9 #include "cdc/modules/cdcCalibrationCollector/CDCFudgeFactorCalibrationCollector.h"
10 #include "analysis/utility/PCmsLabTransform.h"
11 #include <framework/dataobjects/Helix.h>
12 #include <mdst/dataobjects/ECLCluster.h>
13 #include <analysis/dataobjects/Particle.h>
14 #include <analysis/dataobjects/ParticleList.h>
15 #include <Math/ProbFuncMathCore.h>
25 REG_MODULE(CDCFudgeFactorCalibrationCollector);
50 auto m_tree =
new TTree(
m_treeName.c_str(),
"tree for cdc calibration");
51 m_tree->Branch<Float_t>(
"pt_pos", &
Pt_pos);
52 m_tree->Branch<Int_t>(
"exp_run", &
exp_run);
53 m_tree->Branch<Float_t>(
"pt_neg", &
Pt_neg);
54 m_tree->Branch<Float_t>(
"pt_pos_cm", &
Pt_pos_cm);
55 m_tree->Branch<Float_t>(
"pt_neg_cm", &
Pt_neg_cm);
58 m_tree->Branch<Float_t>(
"phi0_pos_cm", &
Phi0_pos_cm);
59 m_tree->Branch<Float_t>(
"theta_neg_cm", &
Phi0_neg_cm);
61 m_tree->Branch<Float_t>(
"Pval_pos", &
Pval_pos);
62 m_tree->Branch<Float_t>(
"Pval_neg", &
Pval_neg);
63 m_tree->Branch<Float_t>(
"ndf_pos", &
ndf_pos);
64 m_tree->Branch<Float_t>(
"ndf_neg", &
ndf_neg);
65 m_tree->Branch<Float_t>(
"ncdc_pos", &
nCDC_pos);
66 m_tree->Branch<Float_t>(
"ncdc_neg", &
nCDC_neg);
67 m_tree->Branch<Float_t>(
"d0_pos", &
D0_pos);
68 m_tree->Branch<Float_t>(
"d0_neg", &
D0_neg);
69 m_tree->Branch<Float_t>(
"z0_pos", &
Z0_pos);
70 m_tree->Branch<Float_t>(
"z0_neg", &
Z0_neg);
71 m_tree->Branch<Float_t>(
"d0ip_pos", &
D0ip_pos);
72 m_tree->Branch<Float_t>(
"d0ip_neg", &
D0ip_neg);
73 m_tree->Branch<Float_t>(
"z0ip_pos", &
Z0ip_pos);
74 m_tree->Branch<Float_t>(
"z0ip_neg", &
Z0ip_neg);
77 registerObject<TTree>(
m_treeName.c_str(), m_tree);
79 auto m_hEventT0 =
new TH1F(
"hEventT0",
"Event T0", 1000, -100, 100);
80 auto m_hNDF_pos =
new TH1F(
"hNDF_pos",
"NDF of positive track;NDF;Tracks", 71, -1, 70);
81 auto m_hNDF_neg =
new TH1F(
"hNDF_neg",
"NDF of negative track;NDF;Tracks", 71, -1, 70);
82 auto m_hPval_pos =
new TH1F(
"hPval_pos",
"p-values of pos tracks;pVal;Tracks", 1000, 0, 1);
83 auto m_hPval_neg =
new TH1F(
"hPval_neg",
"p-values of neg tra cks;pVal;Tracks", 1000, 0, 1);
84 auto m_hnCDC_pos =
new TH1F(
"hnCDC_pos",
"nCDC hit of positive track ; nCDC ; Tracks", 71, -1, 70);
85 auto m_hnCDC_neg =
new TH1F(
"hnCDC_neg",
"nCDC hit of negative track ; nCDC ; Tracks", 71, -1, 70);
89 auto m_hdPt =
new TH1F(
"hdPt",
"#DeltaP_{t} ; #DeltaP_{t} ; Events ", 200, -0.5, 0.5);
90 auto m_hdD0 =
new TH1F(
"hdD0",
"#DeltaD_{0} ; #DeltaD_{0} ; Events ", 200, -0.1, 0.1);
91 auto m_hdZ0 =
new TH1F(
"hdZ0",
"#DeltaZ_{0} ; #DeltaD_{0} ; Events ", 200, -1.5, 1.5);
93 auto m_hdPt_cm =
new TH1F(
"hdPt_cm",
"#DeltaP_{t} in c.m frame ; #DeltaP_{t} (c.m) ; Events ", 200, -0.5, 0.5);
94 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,
97 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);
98 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);
100 registerObject<TH1F>(
"hEventT0", m_hEventT0);
101 registerObject<TH1F>(
"hNDF_pos", m_hNDF_pos);
102 registerObject<TH1F>(
"hNDF_neg", m_hNDF_neg);
103 registerObject<TH1F>(
"hnCDC_pos", m_hnCDC_pos);
104 registerObject<TH1F>(
"hnCDC_neg", m_hnCDC_neg);
106 registerObject<TH1F>(
"hPval_pos", m_hPval_pos);
107 registerObject<TH1F>(
"hPval_neg", m_hPval_neg);
110 registerObject<TH1F>(
"hdPt", m_hdPt);
111 registerObject<TH1F>(
"hdD0", m_hdD0);
112 registerObject<TH1F>(
"hdZ0", m_hdZ0);
114 registerObject<TH1F>(
"hdPt_cm", m_hdPt_cm);
115 registerObject<TH2F>(
"hdPtPt_cm", m_hdPtPt_cm);
116 registerObject<TH1F>(
"hdPhi0_cm", m_hdPhi0_cm);
117 registerObject<TH1F>(
"hdTheta_cm", m_hdTheta_cm);
123 B2DEBUG(199,
"Number of muon canndiate:" << nCandidates);
124 if (nCandidates < 1)
return;
134 int run = m_EventMetaData->getRun();
135 int exp = m_EventMetaData->getExperiment();
141 double Eecl_neutral = 0;
142 int nG = gamma_list->getListSize();
143 B2DEBUG(199,
"Number of gamma: " << nG);
144 for (
int i = 0; i < nG; ++i) {
145 Particle* gamma = gamma_list->getParticle(i);
146 Eecl_neutral += gamma->getEnergy();
148 B2DEBUG(199,
"Sum of neutral ECL " << Eecl_neutral);
154 double theta_pos(0), theta_neg(0);
158 for (
int i = 0; i < nCandidates; ++i) {
161 ROOT::Math::XYZVector v0Vertex = part->getVertex();
164 for (
int j = 0; j < 2; ++j) {
166 const Particle* d0 = part->getDaughter(j);
167 short chg = d0->getCharge();
171 B2WARNING(
"No track fit result found.");
175 Eecl_trk += d0->getECLClusterEnergy();
182 theta_pos = fitresult->
getMomentum().Theta() * 180 / M_PI;
192 }
else if (chg < 0) {
198 theta_neg = fitresult->
getMomentum().Theta() * 180 / M_PI;
215 if (charge_sum != 0) {
continue;}
218 || theta_pos < 45 || theta_pos > 125
219 || theta_neg < 45 || theta_neg > 125) {
return;}
222 double Eecl_tot = Eecl_neutral + Eecl_trk;
223 if (Eecl_tot > 2 || Eecl_trk > 2)
return;
234 B2DEBUG(199,
"ECL neutral - trk:" << Eecl_neutral <<
" - " << Eecl_trk);
237 B2DEBUG(199,
"DeltaPhi Theta :" << dPhi0_cm <<
" " << dTheta_cm);
242 getObjectPtr<TH1F>(
"hPval_pos")->Fill(
Pval_pos);
243 getObjectPtr<TH1F>(
"hPval_neg")->Fill(
Pval_neg);
244 getObjectPtr<TH1F>(
"hNDF_pos")->Fill(
ndf_pos);
245 getObjectPtr<TH1F>(
"hNDF_neg")->Fill(
ndf_neg);
246 getObjectPtr<TH1F>(
"hnCDC_pos")->Fill(
nCDC_pos);
247 getObjectPtr<TH1F>(
"hnCDC_neg")->Fill(
nCDC_neg);
249 getObjectPtr<TH1F>(
"hdPt")->Fill(dPt);
250 getObjectPtr<TH1F>(
"hdD0")->Fill(dD0);
251 getObjectPtr<TH1F>(
"hdZ0")->Fill(dZ0);
253 getObjectPtr<TH1F>(
"hdPt_cm")->Fill(dPt_cm);
254 getObjectPtr<TH2F>(
"hdPtPt_cm")->Fill(Pt_cm, dPt_cm);
255 getObjectPtr<TH1F>(
"hdPhi0_cm")->Fill(dPhi0_cm);
256 getObjectPtr<TH1F>(
"hdTheta_cm")->Fill(dTheta_cm);
259 getObjectPtr<TTree>(
m_treeName.c_str())->Fill();
Float_t D0_neg
d0 of the negative track
Float_t Phi0_neg_cm
phi0 of the negative track in c.m frame.
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event t0 object.
Double_t m_minCollinearityTheta
Minimum requirement for accolinear theta in c.m frame.
Float_t nCDC_pos
Number of CDC hit of the positive track.
Double_t m_minCollinearityPhi0
Minimum requirement for accolinear phi0 in c.m frame.
Int_t exp_run
Exp and run numbers, encoded by exp*10^6+run.
Float_t Pt_pos_cm
Transeverse momentum of the positive track in c.m frame.
Float_t ndf_pos
NDF of the positive track.
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
Float_t Z0ip_pos
z0 w.r.t IP of the positive track
Float_t Pval_neg
P-value of the negative track.
Float_t Phi0_pos_cm
phi0 of the positive track in c.m frame.
Float_t Pval_pos
P-value of the positive track.
std::string m_DiMuonListName
List name for the reconstruted dimuon.
Float_t D0ip_neg
d0 w.r.t IP of the negative track
void collect() override
Event action, collect information for calibration.
Float_t ndf_neg
NDF of the negative track.
Float_t Theta_neg_cm
theta of the negative track in c.m frame.
Float_t Z0_neg
z0 of the negative track
Float_t D0_pos
d0 of the positive track
bool m_StoreNtuple
Option to store ntuple, =true: tree with these variables will be stored.
Float_t Pt_neg_cm
Transeverse momentum of the negative track in c.m frame.
StoreObjPtr< ParticleList > m_DiMuonList
List of the reconstructed dimion.
std::string m_trackArrayName
Belle2::Track StoreArray name.
void prepare() override
Initializes the Module.
Float_t Pt_pos
Transeverse momentum of the positive track
Float_t nCDC_neg
Number of CDC hit of the negative track.
void finish() override
Termination action.
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
virtual ~CDCFudgeFactorCalibrationCollectorModule()
Destructor.
Float_t D0ip_pos
d0 w.r.t IP of the positive track
std::string m_treeName
Name of tree for the output file.
Float_t Z0ip_neg
z0 w.r.t IP of the negative track
StoreArray< Track > m_Tracks
Tracks.
Float_t Theta_pos_cm
theta of the positive track in c.m frame.
Float_t Z0_pos
z0 of the positive track
Float_t Pt_neg
Transeverse momentum of the negative track
std::string m_GammaListName
List name for the reconstruted dimuon.
Calibration collector module base class.
unsigned short getNHits() const
Get the total Number of CDC hits in the fit.
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.
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).
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.