9#include <svd/modules/svdChargeSharing/SVDChargeSharingAnalysisModule.h>
11#include <TDirectory.h>
12#include <TCollection.h>
13#include <reconstruction/dataobjects/VXDDedxTrack.h>
14#include <vxd/geometry/GeoCache.h>
15#include <mdst/dataobjects/HitPatternVXD.h>
48 setDescription(
"Module for monitoring DSSD cluster charge deposition");
53 addParam(
"useTrackInfo",
m_useTrackInfo,
"True if using clusters related to tracks in the analysis",
bool(
true));
96 TString nameSensorType =
"";
100 TString nameSide =
"";
101 nameSide = (j > 0 ?
"U" :
"V");
104 NameOfHisto =
"DSSDClusterSize_" + nameSensorType +
"Side_" + nameSide;
105 TitleOfHisto =
"DSSD Cluster Size: " + nameSensorType +
", Side " + nameSide;
108 NameOfHisto =
"DSSDClusterSizeVsMomentum_" + nameSensorType +
"Side_" + nameSide;
109 TitleOfHisto =
"DSSD Cluster Size vs. Track Momentum: " + nameSensorType +
", Side " + nameSide;
113 NameOfHisto =
"DSSDClusterSizeVsIncidentAngle_" + nameSensorType +
"Side_" + nameSide;
114 TitleOfHisto =
"DSSD Cluster Size vs. Incident Angle: " + nameSensorType +
", Side " + nameSide;
118 NameOfHisto =
"DSSDClusterSizeVsSNR_" + nameSensorType +
"Side_" + nameSide;
119 TitleOfHisto =
"DSSD Cluster Size vs. SNR: " + nameSensorType +
", Side " + nameSide;
124 TString nameclSize =
"";
125 if (k < 2) nameclSize += k + 1;
126 else nameclSize +=
">= 3";
129 NameOfHisto =
"DSSDClusterCharge_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
130 TitleOfHisto =
"DSSD Cluster Charge: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
134 NameOfHisto =
"DSSDClusterChargeVsMomentum_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
135 TitleOfHisto =
"DSSD Cluster Charge vs. Track Momentum: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
140 NameOfHisto =
"DSSDClusterChargeVsIncidentAngle_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
141 TitleOfHisto =
"DSSD Cluster Charge vs. Incident Angle: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
146 NameOfHisto =
"DSSDClusterChargeVsSNR_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
147 TitleOfHisto =
"DSSD Cluster Charge vs. SNR: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
152 NameOfHisto =
"DSSDClusterSNR_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
153 TitleOfHisto =
"DSSD Cluster SNR: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
157 NameOfHisto =
"DSSDClusterSNRVsMomentum_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
158 TitleOfHisto =
"DSSD Cluster SNR vs. Track Momentum: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
162 NameOfHisto =
"DSSDClusterSNRVsIncAngle_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
163 TitleOfHisto =
"DSSD Cluster SNR vs. Incident Angle: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
174 B2ERROR(
" you must use track information! change the module parameter to TRUE");
183 tfr = track.getTrackFitResultWithClosestMass(
Const::pion);
198 for (
int cl = 0; cl < static_cast<int>(svdClustersTrack.
size()); cl++) {
199 VxdID cl_VxdID = svdClustersTrack[cl]->getSensorID();
203 int side =
static_cast<int>(svdClustersTrack[cl]->isUCluster());
204 float clCharge = svdClustersTrack[cl]->getCharge();
205 float clSNR = svdClustersTrack[cl]->getSNR();
206 unsigned short clSize = svdClustersTrack[cl]->getSize();
207 unsigned short clSizeIndex;
208 unsigned short sensTypeIndex;
215 clSizeIndex = clSize >= 3 ? 2 : clSize - 1;
228 h_clCharge[sensTypeIndex][side][clSizeIndex]->Fill(clCharge);
231 h_clChargeVsSNR[sensTypeIndex][side][clSizeIndex]->Fill(clSNR, clCharge);
234 h_clSize[sensTypeIndex][side]->Fill(clSize);
240 h_clSNR[sensTypeIndex][side][clSizeIndex]->Fill(clSNR);
256 for (
int j = 0; j <
m_nSides; j++) {
257 std::string nameSensorType =
"";
259 std::string nameSide =
"";
260 nameSide = (j > 0 ?
"U" :
"V");
263 c->SaveAs((
m_outputDirName +
"/clChargeComparison_" + nameSensorType + nameSide +
".png").c_str());
265 gSystem->ProcessEvents();
268 c->SaveAs((
m_outputDirName +
"/clSNRComparison_" + nameSensorType + nameSide +
".png").c_str());
270 gSystem->ProcessEvents();
276 TDirectory* oldDir = gDirectory;
278 TDirectory* dir_clCharge = oldDir->mkdir(
"clCharge");
279 TDirectory* dir_clChargeVsSNR = oldDir->mkdir(
"clChargeVsSNR");
280 TDirectory* dir_clSize = oldDir->mkdir(
"clSize");
281 TDirectory* dir_clSNR = oldDir->mkdir(
"clSNR");
287 dir_clChargeSt->cd();
291 while ((obj =
dynamic_cast<TH1F*
>(nextH_clCharge()))) {
296 dir_clChargeVsSNR->cd();
297 TDirectory* dir_clChargeVsSNRSt = dir_clChargeVsSNR->mkdir(
m_nameSensorTypes[i].c_str());
298 dir_clChargeVsSNRSt->cd();
300 while ((obj =
dynamic_cast<TH2F*
>(nextH_clChargeVsSNR()))) {
309 while ((obj =
dynamic_cast<TH1F*
>(nextH_clSize()))) {
318 while ((obj =
dynamic_cast<TH1F*
>(nextH_clSNR()))) {
330 Int_t nbins, Double_t min, Double_t max,
331 const char* xtitle,
const char* ytitle, TList* histoList)
333 TH1F* h =
new TH1F(name, title, nbins, min, max);
334 h->GetXaxis()->SetTitle(xtitle);
335 h->GetYaxis()->SetTitle(ytitle);
343 Int_t nbinsX, Double_t minX, Double_t maxX,
345 Int_t nbinsY, Double_t minY, Double_t maxY,
346 const char* titleY, TList* histoList)
349 TH2F* h =
new TH2F(name, title, nbinsX, minX, maxX, nbinsY, minY, maxY);
351 h->GetXaxis()->SetTitle(titleX);
352 h->GetYaxis()->SetTitle(titleY);
362 TCanvas* c =
new TCanvas(
"c",
"c");
365 gStyle->SetOptStat(0);
366 gStyle->SetOptTitle(0);
367 gStyle->SetCanvasPreferGL(1);
369 h1->SetLineColor(kRed);
370 h1->SetFillColorAlpha(kRed, 0.35);
372 h2->SetLineColor(kBlue);
373 h2->SetFillColorAlpha(kBlue, 0.35);
375 h3->SetLineColor(kGreen);
376 h3->SetFillColorAlpha(kGreen, 0.35);
378 h2->GetYaxis()->SetTitleOffset(1.4);
383 auto legend =
new TLegend(0.7, 0.7, 0.9, 0.9);
384 legend->SetTextAlign(22);
385 legend->AddEntry(h1,
"clSize 1",
"f");
386 legend->AddEntry(h2,
"clSize 2",
"f");
387 legend->AddEntry(h3,
"clSize >= 3",
"f");
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.
TList * m_histoList_clSize[m_nSensorTypes]
SVDCluster size histogram list.
TH2F * h_clSNRVsIncidentAngle[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster SNR vs.
SVDChargeSharingAnalysisModule()
Constructor: Sets the description, the properties and the parameters of the module.
const Double_t m_maxCharge
1ADU bin width.
const Int_t m_nBins
Number of bins.
TH2F * h_clChargeVsIncidentAngle[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster charge vs.
TH1F * h_TracksMomentum
Tracks momentum.
TList * m_histoList_clSizeVsIncidentAngle[m_nSensorTypes]
SVDCluster size vs.
TList * m_histoList_clSNRVsMomentum[m_nSensorTypes]
SVDCluster SNR vs.
TH2F * h_clSizeVsIncidentAngle[m_nSensorTypes][m_nSides]
SVDCluster size vs.
TList * m_histoList_clSNR[m_nSensorTypes]
SVDCluster SNR histogram list.
TH1F * h_clSNR[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster SNR.
virtual void initialize() override
Initialize the SVDChargeSharingAnalysi module.
TH1F * h_TracksnSVDhits
Number of SVDhits for a track.
std::string m_outputRootFileName
root output file name.
StoreArray< SVDCluster > m_svdClusters
SVD clusters store array.
virtual void event() override
Core method, called for each processed event.
TH2F * createHistogram2D(const char *name, const char *title, Int_t nbinsX, Double_t minX, Double_t maxX, const char *titleX, Int_t nbinsY, Double_t minY, Double_t maxY, const char *titleY, TList *histoList)
2D histogram creator.
TList * m_histoList_clSNRVsIncidentAngle[m_nSensorTypes]
SVDCluster SNR vs.
TList * m_histoList_clChargeVsMomentum[m_nSensorTypes]
SVDCluster charge vs.
TH2F * h_clSizeVsMomentum[m_nSensorTypes][m_nSides]
SVDCluster size vs.
bool m_useTrackInfo
True if using clusters related to tracks.
TFile * m_outputRootFile
root output file pointer.
TH2F * h_clSizeVsSNR[m_nSensorTypes][m_nSides]
SVDCluster size vs.
virtual void terminate() override
Summary method, called after processing of all events.
int m_nSensorsOnLayer[m_nLayers]
Total number of DSSDs on L3,4,5,6.
static const int m_nSides
DSSD sides.
TH2F * h_clChargeVsSNR[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster charge vs.
TList * m_histoList_clSizeVsSNR[m_nSensorTypes]
SVDCluster size vs.
TH1F * h_clCharge[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster charge.
virtual ~SVDChargeSharingAnalysisModule() override
Default destructor.
const Double_t m_minCharge
Minimum charge in histogram.
TList * m_histoList_clCharge[m_nSensorTypes]
SVDCluster charge histogram list.
TList * m_histoList_clChargeVsIncidentAngle[m_nSensorTypes]
SVDCluster charge vs.
std::string m_nameSensorTypes[m_nSensorTypes]
Sensor type names.
std::string m_outputDirName
output directory.
static const int m_nClSizes
Distinction between clSize=1, clSize=2 & clSize>=3.
TH1F * h_nTracks
Number of tracks.
TH1F * h_clSize[m_nSensorTypes][m_nSides]
SVDCluster size.
TCanvas * comparisonPlot(TH1F *h1, TH1F *h2, TH1F *h3)
Used to compare charge histograms for different cluster sizes.
TList * m_histoList_clChargeVsSNR[m_nSensorTypes]
SVDCluster charge vs.
TH2F * h_clSNRVsMomentum[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster SNR vs.
TH1F * createHistogram1D(const char *name, const char *title, Int_t nbins, Double_t min, Double_t max, const char *xtitle, const char *ytitle, TList *histoList=nullptr)
1D histogram creator.
static const int m_nSensorTypes
L3 small rect,.
StoreArray< Track > m_Tracks
SVD Tracks store array.
TList * m_histoList_clSizeVsMomentum[m_nSensorTypes]
SVDCluster size vs.
TH2F * h_clChargeVsMomentum[m_nSensorTypes][m_nSides][m_nClSizes]
SVDCluster charge vs.
TList * m_histoList_Tracks
List of all histograms concerning track information: nTracks, Track P Value, momentum and SVD hits.
TH1F * h_TracksPvalue
Tracks P value.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
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.
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.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getSensorNumber() const
Get the sensor id.
baseType getLayerNumber() const
Get the layer id.
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.