8#include <svd/modules/svdPerformance/SVDB4CommissioningPlotsModule.h>
9#include <framework/datastore/RelationVector.h>
11#include <mdst/dataobjects/HitPatternVXD.h>
12#include <vxd/geometry/GeoCache.h>
20 , m_nTracks(0), m_Pvalue(), m_mom(0), m_nSVDhits(0)
23 setDescription(
"This module check performances of SVD reconstruction on Commissioning data");
25 addParam(
"outputFileName",
m_rootFileName,
"Name of output root file.", std::string(
"SVDB4CommissioningPlots_output.root"));
29 addParam(
"TrackListName",
m_TrackName,
"Name of Track Store Array.", std::string(
"Tracks"));
32 "Set true to produce the plots for RecoDigits (false by default)",
m_plotRecoDigits);
61 TH1F hRecoCharge(
"reco_charge_L@layerL@ladderS@sensor@view",
62 "Charge of RecoDigits in @layer.@ladder.@sensor @view/@side side",
64 hRecoCharge.GetXaxis()->SetTitle(
"charge (ke-)");
67 TH1F hRecoEnergy(
"reco_energy_L@layerL@ladderS@sensor@view",
68 "Energy of RecoDigits in @layer.@ladder.@sensor @view/@side side",
70 hRecoEnergy.GetXaxis()->SetTitle(
"energy (keV)");
73 TH1F hRecoTime(
"reco_time_L@layerL@ladderS@sensor@view",
74 "Time of RecoDigits in @layer.@ladder.@sensor @view/@side side",
76 hRecoTime.GetXaxis()->SetTitle(
"time (ns)");
79 TH1F hRecoNoise(
"reco_noise_L@layerL@ladderS@sensor@view",
80 "Noise of RecoDigits in @layer.@ladder.@sensor @view/@side side",
82 hRecoNoise.GetXaxis()->SetTitle(
"strip noise (e-)");
86 TH1F hClusterCharge(
"cluster_charge_L@layerL@ladderS@sensor@view",
87 "Charge of Clusters in @layer.@ladder.@sensor @view/@side side",
89 hClusterCharge.GetXaxis()->SetTitle(
"charge (ke-)");
92 TH1F hClusterSize(
"cluster_size_L@layerL@ladderS@sensor@view",
93 "Clusters Size for @layer.@ladder.@sensor @view/@side side",
95 hClusterSize.GetXaxis()->SetTitle(
"cluster size");
98 TH1F hClusterSNR(
"cluster_SNR_L@layerL@ladderS@sensor@view",
99 "SNR of Clusters in @layer.@ladder.@sensor @view/@side side",
101 hClusterSNR.GetXaxis()->SetTitle(
"SNR");
104 TH1F hClusterEnergy(
"cluster_energy_L@layerL@ladderS@sensor@view",
105 "Energy of Clusters in @layer.@ladder.@sensor @view/@side side",
107 hClusterEnergy.GetXaxis()->SetTitle(
"energy (keV)");
110 TH1F hClusterTime(
"cluster_time_L@layerL@ladderS@sensor@view",
111 "Time of Clusters in @layer.@ladder.@sensor @view/@side side",
113 hClusterTime.GetXaxis()->SetTitle(
"time (ns)");
117 TH1F hClusterTrkCharge(
"clusterTrk_charge_L@layerL@ladderS@sensor@view",
118 "Charge of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
120 hClusterTrkCharge.GetXaxis()->SetTitle(
"charge (ke-)");
123 TH1F hClusterTrkSize(
"clusterTrk_size_L@layerL@ladderS@sensor@view",
124 "Cluster Size for @layer.@ladder.@sensor @view/@side side",
126 hClusterTrkSize.GetXaxis()->SetTitle(
"cluster size");
129 TH1F hClusterTrkSNR(
"clusterTrk_SNR_L@layerL@ladderS@sensor@view",
130 "SNR of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
132 hClusterTrkSNR.GetXaxis()->SetTitle(
"SNR");
135 TH1F hClusterTrkEnergy(
"clusterTrk_energy_L@layerL@ladderS@sensor@view",
136 "Energy of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
138 hClusterTrkEnergy.GetXaxis()->SetTitle(
"energy (keV)");
141 TH1F hClusterTrkTime(
"clusterTrk_time_L@layerL@ladderS@sensor@view",
142 "Time of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
144 hClusterTrkTime.GetXaxis()->SetTitle(
"time (ns)");
147 TH1F hClusterTrkInterstripPos(
"clusterTrk_interstripPos_L@layerL@ladderS@sensor@view",
148 "Interstrip Position of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
150 hClusterTrkInterstripPos.GetXaxis()->SetTitle(
"interstrip position");
154 m_nTracks =
new TH1F(
"h1nTracks",
"number of Tracks per event", 50, 0, 50);
155 m_nTracks->GetXaxis()->SetTitle(
"n Tracks");
156 m_Pvalue =
new TH1F(
"h1pValue",
"Tracks p value", 100, 0, 1);
157 m_Pvalue->GetXaxis()->SetTitle(
"p value");
158 m_mom =
new TH1F(
"h1momentum",
" Tracks Momentum", 200, 0, 10);
159 m_mom->GetXaxis()->SetTitle(
"p (GeV/c)");
160 m_nSVDhits =
new TH1F(
"h1nSVDhits",
"# SVD hits per track", 20, 0, 20);
161 m_nSVDhits->GetXaxis()->SetTitle(
"# SVD hits");
172 float c_eTOkeV = 3.6 / 1000;
191 for (
int cl = 0 ; cl < (int)svdClustersTrack.
size(); cl++) {
193 float clCharge = svdClustersTrack[cl]->getCharge();
194 float clEnergy = svdClustersTrack[cl]->getCharge() * c_eTOkeV;
195 int clSize = svdClustersTrack[cl]->getSize();
196 float clSN = svdClustersTrack[cl]->getSNR();
197 float clTime = svdClustersTrack[cl]->getClsTime();
198 float clPosition = svdClustersTrack[cl]->getPosition();
200 int side = svdClustersTrack[cl]->isUCluster();
206 float clInterstripPos = fmod(clPosition, pitch) / pitch;
222 B2DEBUG(29,
"%%%%%%%% NEW EVENT, number of Tracks = " <<
m_Tracks.getEntries());
227 for (
int digi = 0 ; digi <
m_svdRecos.getEntries(); digi++) {
255 bool isAssigned =
false;
257 if (theRC.
size() > 0) {
281 B2INFO(
"SVDB4CommissioningPlotsModule::endRun(), writing the histograms");
286 TDirectory* oldDir = gDirectory;
288 TDirectory* dir_track = oldDir->mkdir(
"tracks");
295 TDirectory* dir_reco = oldDir->mkdir(
"recoDigits");
296 TDirectory* dir_clusterAssigned = oldDir->mkdir(
"clusters_assigned");
297 TDirectory* dir_clusterNotAssigned = oldDir->mkdir(
"clusters_not_assigned");
302 TString layerName = Form(
"layer%d", layer.getLayerNumber());
303 TDirectory* dir_reco_layer = dir_reco->mkdir(layerName.Data());
304 TDirectory* dir_clusterAssigned_layer = dir_clusterAssigned->mkdir(layerName.Data());
305 TDirectory* dir_clusterNotAssigned_layer = dir_clusterNotAssigned->mkdir(layerName.Data());
306 for (
auto ladder : geoCache.getLadders(layer))
311 dir_reco_layer->cd();
317 dir_clusterAssigned_layer->cd();
324 dir_clusterNotAssigned_layer->cd();
static const ChargedStable pion
charged pion particle
void setDescription(const std::string &description)
Sets the description of the module.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
std::string m_rootFileName
root file name
TH1F * m_nSVDhits
track momentum
SVDHistograms< TH1F > * h_clusterTrkSNR
SVDClusters SNR.
bool m_plotRecoDigits
Produce plots for SVDRecoDigits when True.
SVDHistograms< TH1F > * h_clusterTrkCharge
SVDClusters Charge.
virtual void initialize() override
check StoreArrays & create rootfile
StoreArray< SVDCluster > m_svdClusters
SVDCluster StoreArray.
SVDB4CommissioningPlotsModule()
constructor
virtual void event() override
fill histograms
StoreArray< TrackFitResult > m_tfr
TrackFitResult StoreArray.
SVDNoiseCalibrations m_NoiseCal
SVDNoise Calibrations db object.
virtual void endRun() override
write histogrmas
TH1F * m_Pvalue
track p value
SVDHistograms< TH1F > * h_recoEnergy
SVDRecoDigits Energy.
int m_ntracks
number of tracks
TH1F * m_mom
track momentum
SVDHistograms< TH1F > * h_clusterTrkEnergy
SVDClusters Energy.
SVDHistograms< TH1F > * h_clusterEnergy
SVDClusters Energy.
SVDHistograms< TH1F > * h_clusterSNR
SVDClusters SNR.
std::string m_TrackName
Track StoreArray name.
std::string m_RecoDigitName
SVDRecoDigit StoreArray name.
SVDHistograms< TH1F > * h_recoNoise
SVDRecoDigits Noise.
virtual void beginRun() override
create histograms
std::string m_TrackFitResultName
TrackFitResult name.
SVDHistograms< TH1F > * h_clusterSize
SVDClusters Size.
SVDHistograms< TH1F > * h_recoCharge
SVDRecoDigits Charge.
SVDHistograms< TH1F > * h_clusterTime
SVDClusters Time.
TH1F * m_nTracks
number of tracks
SVDHistograms< TH1F > * h_recoTime
SVDRecoDigits Time.
StoreArray< RecoTrack > m_recoTracks
RecoTrack StoreArray.
std::string m_ClusterName
SVDCluster StoreArray name.
StoreArray< SVDRecoDigit > m_svdRecos
SVDRecoDigit StoreArray.
SVDHistograms< TH1F > * h_clusterTrkTime
SVDClusters Time.
SVDHistograms< TH1F > * h_clusterCharge
SVDClusters Charge.
StoreArray< Track > m_Tracks
Track StoreArray.
TFile * m_rootFilePtr
pointer at root file used for storing histograms
SVDHistograms< TH1F > * h_clusterTrkSize
SVDClusters Size.
SVDHistograms< TH1F > * h_clusterTrkInterstripPos
SVDClusters InterstripPosition.
int m_nEvents
number of events
template class for SVd histograms
void fill(const VxdID &vxdID, int view, Types ... args)
fill the histogram for
H * getHistogram(const VxdID &vxdID, int view)
get a reference to the histogram for
float getNoiseInElectrons(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This method provides the correct noise conversion into electrons, taking into account that the noise ...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
Values of the result of a track fit with a given particle hypothesis.
double getPValue() const
Getter for Chi2 Probability of the track fit.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
HitPatternVXD getHitPatternVXD() const
Getter for the hit pattern in the VXD;.
Class that bundles various TrackFitResults.
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
double getUPitch(double v=0) const
Return the pitch of the sensor.
double getVPitch(double v=0) const
Return the pitch of the sensor.
Class to uniquely identify a any structure of the PXD and SVD.
unsigned short baseType
The base integer type for VxdID.
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.
Abstract base class for different kinds of events.