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>
14#include <boost/foreach.hpp>
22 , m_nTracks(0), m_Pvalue(), m_mom(0), m_nSVDhits(0)
25 setDescription(
"This module check performances of SVD reconstruction on Commissioning data");
27 addParam(
"outputFileName",
m_rootFileName,
"Name of output root file.", std::string(
"SVDB4CommissioningPlots_output.root"));
31 addParam(
"TrackListName",
m_TrackName,
"Name of Track Store Array.", std::string(
"Tracks"));
34 "Set true to produce the plots for RecoDigits (false by default)",
m_plotRecoDigits);
63 TH1F hRecoCharge(
"reco_charge_L@layerL@ladderS@sensor@view",
64 "Charge of RecoDigits in @layer.@ladder.@sensor @view/@side side",
66 hRecoCharge.GetXaxis()->SetTitle(
"charge (ke-)");
69 TH1F hRecoEnergy(
"reco_energy_L@layerL@ladderS@sensor@view",
70 "Energy of RecoDigits in @layer.@ladder.@sensor @view/@side side",
72 hRecoEnergy.GetXaxis()->SetTitle(
"energy (keV)");
75 TH1F hRecoTime(
"reco_time_L@layerL@ladderS@sensor@view",
76 "Time of RecoDigits in @layer.@ladder.@sensor @view/@side side",
78 hRecoTime.GetXaxis()->SetTitle(
"time (ns)");
81 TH1F hRecoNoise(
"reco_noise_L@layerL@ladderS@sensor@view",
82 "Noise of RecoDigits in @layer.@ladder.@sensor @view/@side side",
84 hRecoNoise.GetXaxis()->SetTitle(
"strip noise (e-)");
88 TH1F hClusterCharge(
"cluster_charge_L@layerL@ladderS@sensor@view",
89 "Charge of Clusters in @layer.@ladder.@sensor @view/@side side",
91 hClusterCharge.GetXaxis()->SetTitle(
"charge (ke-)");
94 TH1F hClusterSize(
"cluster_size_L@layerL@ladderS@sensor@view",
95 "Clusters Size for @layer.@ladder.@sensor @view/@side side",
97 hClusterSize.GetXaxis()->SetTitle(
"cluster size");
100 TH1F hClusterSNR(
"cluster_SNR_L@layerL@ladderS@sensor@view",
101 "SNR of Clusters in @layer.@ladder.@sensor @view/@side side",
103 hClusterSNR.GetXaxis()->SetTitle(
"SNR");
106 TH1F hClusterEnergy(
"cluster_energy_L@layerL@ladderS@sensor@view",
107 "Energy of Clusters in @layer.@ladder.@sensor @view/@side side",
109 hClusterEnergy.GetXaxis()->SetTitle(
"energy (keV)");
112 TH1F hClusterTime(
"cluster_time_L@layerL@ladderS@sensor@view",
113 "Time of Clusters in @layer.@ladder.@sensor @view/@side side",
115 hClusterTime.GetXaxis()->SetTitle(
"time (ns)");
119 TH1F hClusterTrkCharge(
"clusterTrk_charge_L@layerL@ladderS@sensor@view",
120 "Charge of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
122 hClusterTrkCharge.GetXaxis()->SetTitle(
"charge (ke-)");
125 TH1F hClusterTrkSize(
"clusterTrk_size_L@layerL@ladderS@sensor@view",
126 "Cluster Size for @layer.@ladder.@sensor @view/@side side",
128 hClusterTrkSize.GetXaxis()->SetTitle(
"cluster size");
131 TH1F hClusterTrkSNR(
"clusterTrk_SNR_L@layerL@ladderS@sensor@view",
132 "SNR of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
134 hClusterTrkSNR.GetXaxis()->SetTitle(
"SNR");
137 TH1F hClusterTrkEnergy(
"clusterTrk_energy_L@layerL@ladderS@sensor@view",
138 "Energy of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
140 hClusterTrkEnergy.GetXaxis()->SetTitle(
"energy (keV)");
143 TH1F hClusterTrkTime(
"clusterTrk_time_L@layerL@ladderS@sensor@view",
144 "Time of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
146 hClusterTrkTime.GetXaxis()->SetTitle(
"time (ns)");
149 TH1F hClusterTrkInterstripPos(
"clusterTrk_interstripPos_L@layerL@ladderS@sensor@view",
150 "Interstrip Position of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
152 hClusterTrkInterstripPos.GetXaxis()->SetTitle(
"interstrip position");
156 m_nTracks =
new TH1F(
"h1nTracks",
"number of Tracks per event", 50, 0, 50);
157 m_nTracks->GetXaxis()->SetTitle(
"n Tracks");
158 m_Pvalue =
new TH1F(
"h1pValue",
"Tracks p value", 100, 0, 1);
159 m_Pvalue->GetXaxis()->SetTitle(
"p value");
160 m_mom =
new TH1F(
"h1momentum",
" Tracks Momentum", 200, 0, 10);
161 m_mom->GetXaxis()->SetTitle(
"p (GeV/c)");
162 m_nSVDhits =
new TH1F(
"h1nSVDhits",
"# SVD hits per track", 20, 0, 20);
163 m_nSVDhits->GetXaxis()->SetTitle(
"# SVD hits");
174 float c_eTOkeV = 3.6 / 1000;
193 for (
int cl = 0 ; cl < (int)svdClustersTrack.
size(); cl++) {
195 float clCharge = svdClustersTrack[cl]->getCharge();
196 float clEnergy = svdClustersTrack[cl]->getCharge() * c_eTOkeV;
197 int clSize = svdClustersTrack[cl]->getSize();
198 float clSN = svdClustersTrack[cl]->getSNR();
199 float clTime = svdClustersTrack[cl]->getClsTime();
200 float clPosition = svdClustersTrack[cl]->getPosition();
202 int side = svdClustersTrack[cl]->isUCluster();
208 float clInterstripPos = fmod(clPosition, pitch) / pitch;
224 B2DEBUG(29,
"%%%%%%%% NEW EVENT, number of Tracks = " <<
m_Tracks.getEntries());
229 for (
int digi = 0 ; digi <
m_svdRecos.getEntries(); digi++) {
257 bool isAssigned =
false;
259 if (theRC.
size() > 0) {
283 B2INFO(
"SVDB4CommissioningPlotsModule::endRun(), writing the histograms");
288 TDirectory* oldDir = gDirectory;
290 TDirectory* dir_track = oldDir->mkdir(
"tracks");
297 TDirectory* dir_reco = oldDir->mkdir(
"recoDigits");
298 TDirectory* dir_clusterAssigned = oldDir->mkdir(
"clusters_assigned");
299 TDirectory* dir_clusterNotAssigned = oldDir->mkdir(
"clusters_not_assigned");
304 TString layerName = Form(
"layer%d", layer.getLayerNumber());
305 TDirectory* dir_reco_layer = dir_reco->mkdir(layerName.Data());
306 TDirectory* dir_clusterAssigned_layer = dir_clusterAssigned->mkdir(layerName.Data());
307 TDirectory* dir_clusterNotAssigned_layer = dir_clusterNotAssigned->mkdir(layerName.Data());
308 for (
auto ladder : geoCache.getLadders(layer))
313 dir_reco_layer->cd();
319 dir_clusterAssigned_layer->cd();
326 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.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
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 faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne 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.