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>
21 SVDB4CommissioningPlotsModule::SVDB4CommissioningPlotsModule() :
Module()
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"));
29 addParam(
"RecoDigitsName", m_RecoDigitName,
"Name of RecoDigit Store Array.", std::string(
"SVDRecoDigits"));
30 addParam(
"ClustersName", m_ClusterName,
"Name of Cluster Store Array.", std::string(
"SVDClusters"));
31 addParam(
"TrackListName", m_TrackName,
"Name of Track Store Array.", std::string(
"Tracks"));
32 addParam(
"TrackFitResultListName", m_TrackFitResultName,
"Name of TracksFitResult Store Array.", std::string(
"TrackFitResults"));
35 SVDB4CommissioningPlotsModule::~SVDB4CommissioningPlotsModule()
67 TH1F hRecoCharge(
"reco_charge_L@layerL@ladderS@sensor@view",
68 "Charge of RecoDigits in @layer.@ladder.@sensor @view/@side side",
70 hRecoCharge.GetXaxis()->SetTitle(
"charge (ke-)");
73 TH1F hRecoEnergy(
"reco_energy_L@layerL@ladderS@sensor@view",
74 "Energy of RecoDigits in @layer.@ladder.@sensor @view/@side side",
76 hRecoEnergy.GetXaxis()->SetTitle(
"energy (keV)");
79 TH1F hRecoTime(
"reco_time_L@layerL@ladderS@sensor@view",
80 "Time of RecoDigits in @layer.@ladder.@sensor @view/@side side",
82 hRecoTime.GetXaxis()->SetTitle(
"time (ns)");
85 TH1F hRecoNoise(
"reco_noise_L@layerL@ladderS@sensor@view",
86 "Noise of RecoDigits in @layer.@ladder.@sensor @view/@side side",
88 hRecoNoise.GetXaxis()->SetTitle(
"strip noise (e-)");
92 TH1F hClusterCharge(
"cluster_charge_L@layerL@ladderS@sensor@view",
93 "Charge of Clusters in @layer.@ladder.@sensor @view/@side side",
95 hClusterCharge.GetXaxis()->SetTitle(
"charge (ke-)");
98 TH1F hClusterSize(
"cluster_size_L@layerL@ladderS@sensor@view",
99 "Clusters Size for @layer.@ladder.@sensor @view/@side side",
101 hClusterSize.GetXaxis()->SetTitle(
"cluster size");
104 TH1F hClusterSNR(
"cluster_SNR_L@layerL@ladderS@sensor@view",
105 "SNR of Clusters in @layer.@ladder.@sensor @view/@side side",
107 hClusterSNR.GetXaxis()->SetTitle(
"SNR");
110 TH1F hClusterEnergy(
"cluster_energy_L@layerL@ladderS@sensor@view",
111 "Energy of Clusters in @layer.@ladder.@sensor @view/@side side",
113 hClusterEnergy.GetXaxis()->SetTitle(
"energy (keV)");
116 TH1F hClusterTime(
"cluster_time_L@layerL@ladderS@sensor@view",
117 "Time of Clusters in @layer.@ladder.@sensor @view/@side side",
119 hClusterTime.GetXaxis()->SetTitle(
"time (ns)");
123 TH1F hClusterTrkCharge(
"clusterTrk_charge_L@layerL@ladderS@sensor@view",
124 "Charge of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
126 hClusterTrkCharge.GetXaxis()->SetTitle(
"charge (ke-)");
129 TH1F hClusterTrkSize(
"clusterTrk_size_L@layerL@ladderS@sensor@view",
130 "Cluster Size for @layer.@ladder.@sensor @view/@side side",
132 hClusterTrkSize.GetXaxis()->SetTitle(
"cluster size");
135 TH1F hClusterTrkSNR(
"clusterTrk_SNR_L@layerL@ladderS@sensor@view",
136 "SNR of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
138 hClusterTrkSNR.GetXaxis()->SetTitle(
"SNR");
141 TH1F hClusterTrkEnergy(
"clusterTrk_energy_L@layerL@ladderS@sensor@view",
142 "Energy of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
144 hClusterTrkEnergy.GetXaxis()->SetTitle(
"energy (keV)");
147 TH1F hClusterTrkTime(
"clusterTrk_time_L@layerL@ladderS@sensor@view",
148 "Time of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
150 hClusterTrkTime.GetXaxis()->SetTitle(
"time (ns)");
153 TH1F hClusterTrkInterstripPos(
"clusterTrk_interstripPos_L@layerL@ladderS@sensor@view",
154 "Interstrip Position of Clusters Related to Tracks in @layer.@ladder.@sensor @view/@side side",
156 hClusterTrkInterstripPos.GetXaxis()->SetTitle(
"interstrip position");
160 m_nTracks =
new TH1F(
"h1nTracks",
"number of Tracks per event", 50, 0, 50);
161 m_nTracks->GetXaxis()->SetTitle(
"n Tracks");
162 m_Pvalue =
new TH1F(
"h1pValue",
"Tracks p value", 100, 0, 1);
163 m_Pvalue->GetXaxis()->SetTitle(
"p value");
164 m_mom =
new TH1F(
"h1momentum",
" Tracks Momentum", 200, 0, 10);
165 m_mom->GetXaxis()->SetTitle(
"p (GeV/c)");
166 m_nSVDhits =
new TH1F(
"h1nSVDhits",
"# SVD hits per track", 20, 0, 20);
167 m_nSVDhits->GetXaxis()->SetTitle(
"# SVD hits");
178 float c_eTOkeV = 3.6 / 1000;
197 for (
int cl = 0 ; cl < (int)svdClustersTrack.
size(); cl++) {
199 float clCharge = svdClustersTrack[cl]->getCharge();
200 float clEnergy = svdClustersTrack[cl]->getCharge() * c_eTOkeV;
201 int clSize = svdClustersTrack[cl]->getSize();
202 float clSN = svdClustersTrack[cl]->getSNR();
203 float clTime = svdClustersTrack[cl]->getClsTime();
204 float clPosition = svdClustersTrack[cl]->getPosition();
206 int side = svdClustersTrack[cl]->isUCluster();
212 float clInterstripPos = fmod(clPosition, pitch) / pitch;
228 B2DEBUG(1,
"%%%%%%%% NEW EVENT, number of Tracks = " <<
m_Tracks.getEntries());
233 for (
int digi = 0 ; digi <
m_svdRecos.getEntries(); digi++) {
259 bool isAssigned =
false;
261 if (theRC.
size() > 0) {
285 B2INFO(
"SVDB4CommissioningPlotsModule::endRun(), writing the histograms");
290 TDirectory* oldDir = gDirectory;
292 TDirectory* dir_track = oldDir->mkdir(
"tracks");
299 TDirectory* dir_reco = oldDir->mkdir(
"recoDigits");
300 TDirectory* dir_clusterAssigned = oldDir->mkdir(
"clusters_assigned");
301 TDirectory* dir_clusterNotAssigned = oldDir->mkdir(
"clusters_not_assigned");
306 TString layerName = Form(
"layer%d", layer.getLayerNumber());
307 TDirectory* dir_reco_layer = dir_reco->mkdir(layerName.Data());
308 TDirectory* dir_clusterAssigned_layer = dir_clusterAssigned->mkdir(layerName.Data());
309 TDirectory* dir_clusterNotAssigned_layer = dir_clusterNotAssigned->mkdir(layerName.Data());
310 for (
auto ladder : geoCache.getLadders(layer))
314 dir_reco_layer->cd();
319 dir_clusterAssigned_layer->cd();
326 dir_clusterNotAssigned_layer->cd();
static const ChargedStable pion
charged pion particle
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.
SVDHistograms< TH1F > * h_clusterTrkCharge
SVDClusters Charge.
virtual void initialize() override
Initialize the Module.
StoreArray< SVDCluster > m_svdClusters
SVDCluster StoreArray.
virtual void event() override
This method is the core of the module.
StoreArray< TrackFitResult > m_tfr
TrackFitResult StoreArray.
SVDNoiseCalibrations m_NoiseCal
SVDNoise Calibrations db object.
virtual void endRun() override
This method is called if the current run ends.
TH1F * m_Pvalue
track p value
SVDHistograms< TH1F > * h_recoEnergy
SVDRecoDigits Energy.
virtual void terminate() override
This method is called at the end of the event processing.
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
Called when entering a new run.
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
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.
TVector3 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.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.