9#include "cdc/modules/cdcCalibrationCollector/CDCFudgeFactorCalibrationCollector.h"
10#include "analysis/utility/PCmsLabTransform.h"
11#include <mdst/dataobjects/HitPatternVXD.h>
12#include <mdst/dataobjects/EventLevelTrackingInfo.h>
13#include <analysis/dataobjects/Particle.h>
14#include <analysis/dataobjects/ParticleList.h>
15#include <analysis/variables/PIDVariables.h>
49 auto m_tree =
new TTree(
m_treeName.c_str(),
"tree for cdc calibration");
50 m_tree->Branch<Int_t>(
"exp_run", &
expRun);
51 m_tree->Branch<Float_t>(
"pt_pos", &
ptPos);
52 m_tree->Branch<Float_t>(
"pt_neg", &
ptNeg);
53 m_tree->Branch<Float_t>(
"pz_pos", &
pzPos);
54 m_tree->Branch<Float_t>(
"pz_neg", &
pzNeg);
56 m_tree->Branch<Float_t>(
"pt_pos_cm", &
ptPosCm);
57 m_tree->Branch<Float_t>(
"pt_neg_cm", &
ptNegCm);
58 m_tree->Branch<Float_t>(
"pz_pos_cm", &
pzPosCm);
59 m_tree->Branch<Float_t>(
"pz_neg_cm", &
pzNegCm);
61 m_tree->Branch<Float_t>(
"theta_pos_cm", &
thetaPosCm);
62 m_tree->Branch<Float_t>(
"theta_neg_cm", &
thetaNegCm);
64 m_tree->Branch<Float_t>(
"phi0_pos_cm", &
phi0PosCm);
65 m_tree->Branch<Float_t>(
"theta_neg_cm", &
phi0NegCm);
67 m_tree->Branch<Float_t>(
"Pval_pos", &
pvalPos);
68 m_tree->Branch<Float_t>(
"Pval_neg", &
pvalNeg);
70 m_tree->Branch<Float_t>(
"ndf_pos", &
ndfPos);
71 m_tree->Branch<Float_t>(
"ndf_neg", &
ndfNeg);
73 m_tree->Branch<Float_t>(
"ncdc_pos", &
ncdcPos);
74 m_tree->Branch<Float_t>(
"ncdc_neg", &
ncdcNeg);
75 m_tree->Branch<Float_t>(
"npxd_pos", &
npxdPos);
76 m_tree->Branch<Float_t>(
"npxd_neg", &
npxdNeg);
77 m_tree->Branch<Float_t>(
"nsvd_pos", &
nsvdPos);
78 m_tree->Branch<Float_t>(
"nsvd_neg", &
nsvdNeg);
81 m_tree->Branch<Float_t>(
"ecl_track", &
eclTrack);
82 m_tree->Branch<Float_t>(
"ecl_neutral", &
eclNeutral);
84 m_tree->Branch<Float_t>(
"d0_pos", &
d0Pos);
85 m_tree->Branch<Float_t>(
"d0_neg", &
d0Neg);
86 m_tree->Branch<Float_t>(
"z0_pos", &
z0Pos);
87 m_tree->Branch<Float_t>(
"z0_neg", &
z0Neg);
88 m_tree->Branch<Float_t>(
"d0ip_pos", &
d0ipPos);
89 m_tree->Branch<Float_t>(
"d0ip_neg", &
d0ipNeg);
90 m_tree->Branch<Float_t>(
"z0ip_pos", &
z0ipPos);
91 m_tree->Branch<Float_t>(
"z0ip_neg", &
z0ipNeg);
92 m_tree->Branch<Float_t>(
"muid_pos", &
muidPos);
93 m_tree->Branch<Float_t>(
"muid_neg", &
muidNeg);
94 m_tree->Branch<Float_t>(
"eid_pos", &
eidPos);
95 m_tree->Branch<Float_t>(
"eid_neg", &
eidNeg);
99 auto m_hEventT0 =
new TH1F(
"hEventT0",
"Event T0", 200, -100, 100);
100 auto m_hExtraCDCHit =
new TH1F(
"hExtraCDCHit",
"Extra cdc hits", 500, 0, 5000);
101 auto m_hNDF_pos =
new TH1F(
"hNDF_pos",
"NDF of positive track;NDF;Tracks", 71, -1, 70);
102 auto m_hNDF_neg =
new TH1F(
"hNDF_neg",
"NDF of negative track;NDF;Tracks", 71, -1, 70);
103 auto m_hPval_pos =
new TH1F(
"hPval_pos",
"p-values of pos tracks;pVal;Tracks", 1000, 0, 1);
104 auto m_hPval_neg =
new TH1F(
"hPval_neg",
"p-values of neg tra cks;pVal;Tracks", 1000, 0, 1);
105 auto m_hnCDC_pos =
new TH1F(
"hnCDC_pos",
"nCDC hit of positive track ; nCDC ; Tracks", 71, -1, 70);
106 auto m_hnCDC_neg =
new TH1F(
"hnCDC_neg",
"nCDC hit of negative track ; nCDC ; Tracks", 71, -1, 70);
108 auto m_hdPt =
new TH1F(
"hdPt",
"#DeltaP_{t} ; #DeltaP_{t} ; Events ", 200, -0.5, 0.5);
109 auto m_hdD0 =
new TH1F(
"hdD0",
"#DeltaD_{0} ; #DeltaD_{0} ; Events ", 200, -0.1, 0.1);
110 auto m_hdZ0 =
new TH1F(
"hdZ0",
"#DeltaZ_{0} ; #DeltaD_{0} ; Events ", 200, -1.5, 1.5);
112 auto m_hdPt_cm =
new TH1F(
"hdPt_cm",
"#DeltaP_{t} in c.m frame ; #DeltaP_{t} (c.m) ; Events ", 200, -0.5, 0.5);
113 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,
116 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);
117 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);
143 B2DEBUG(29,
"Number of muon canndiate:" << nCandidates);
144 if (nCandidates < 1)
return;
154 int run = m_EventMetaData->getRun();
155 int exp = m_EventMetaData->getExperiment();
156 expRun = exp * 1000000 + run;
161 int nG = gamma_list->getListSize();
162 B2DEBUG(29,
"Number of gamma: " << nG);
165 for (
int i = 0; i < nG; ++i) {
166 Particle* gamma = gamma_list->getParticle(i);
169 B2DEBUG(29,
"Sum of neutral ECL " <<
eclNeutral);
173 double thetaPos(0), thetaNeg(0);
176 for (
int i = 0; i < nCandidates; ++i) {
179 ROOT::Math::XYZVector v0Vertex = part->
getVertex();
182 for (
int j = 0; j < 2; ++j) {
185 short chg = d0->getCharge();
189 B2WARNING(
"No track fit result found.");
193 eclTrack += d0->getECLClusterEnergy();
194 double muid = Variable::muonID(d0);
195 double eid = Variable::electronID(d0);
204 thetaPos = fitresult->
getMomentum().Theta() * 180 / M_PI;
208 ROOT::Math::PxPyPzEVector P4_pos = T.rotateLabToCms() * fitresult->
get4Momentum();
217 }
else if (chg < 0) {
224 thetaNeg = fitresult->
getMomentum().Theta() * 180 / M_PI;
229 ROOT::Math::PxPyPzEVector P4_neg = T.rotateLabToCms() * fitresult->
get4Momentum();
251 if (charge_sum != 0) {
continue;}
254 || thetaPos < 45 || thetaPos > 125
255 || thetaNeg < 45 || thetaNeg > 125) {
return;}
261 if (eclTot > 2 ||
eclTrack > 2)
return;
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.
void registerObject(std::string name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
T * getObjectPtr(std::string name)
Calls the CalibObjManager to get the requested stored collector data.
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.