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>
17#include <boost/foreach.hpp>
50 setDescription(
"Module for monitoring DSSD cluster charge deposition");
55 addParam(
"useTrackInfo",
m_useTrackInfo,
"True if using clusters related to tracks in the analysis",
bool(
true));
98 TString nameSensorType =
"";
101 for (
int j = 0; j <
m_nSides; j++) {
102 TString nameSide =
"";
103 nameSide = (j > 0 ?
"U" :
"V");
106 NameOfHisto =
"DSSDClusterSize_" + nameSensorType +
"Side_" + nameSide;
107 TitleOfHisto =
"DSSD Cluster Size: " + nameSensorType +
", Side " + nameSide;
110 NameOfHisto =
"DSSDClusterSizeVsMomentum_" + nameSensorType +
"Side_" + nameSide;
111 TitleOfHisto =
"DSSD Cluster Size vs. Track Momentum: " + nameSensorType +
", Side " + nameSide;
115 NameOfHisto =
"DSSDClusterSizeVsIncidentAngle_" + nameSensorType +
"Side_" + nameSide;
116 TitleOfHisto =
"DSSD Cluster Size vs. Incident Angle: " + nameSensorType +
", Side " + nameSide;
120 NameOfHisto =
"DSSDClusterSizeVsSNR_" + nameSensorType +
"Side_" + nameSide;
121 TitleOfHisto =
"DSSD Cluster Size vs. SNR: " + nameSensorType +
", Side " + nameSide;
126 TString nameclSize =
"";
127 if (k < 2) nameclSize += k + 1;
128 else nameclSize +=
">= 3";
131 NameOfHisto =
"DSSDClusterCharge_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
132 TitleOfHisto =
"DSSD Cluster Charge: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
136 NameOfHisto =
"DSSDClusterChargeVsMomentum_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
137 TitleOfHisto =
"DSSD Cluster Charge vs. Track Momentum: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
142 NameOfHisto =
"DSSDClusterChargeVsIncidentAngle_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
143 TitleOfHisto =
"DSSD Cluster Charge vs. Incident Angle: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
148 NameOfHisto =
"DSSDClusterChargeVsSNR_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
149 TitleOfHisto =
"DSSD Cluster Charge vs. SNR: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
154 NameOfHisto =
"DSSDClusterSNR_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
155 TitleOfHisto =
"DSSD Cluster SNR: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
159 NameOfHisto =
"DSSDClusterSNRVsMomentum_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
160 TitleOfHisto =
"DSSD Cluster SNR vs. Track Momentum: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
164 NameOfHisto =
"DSSDClusterSNRVsIncAngle_" + nameSensorType +
"Side_" + nameSide +
"clSize_" + nameclSize;
165 TitleOfHisto =
"DSSD Cluster SNR vs. Incident Angle: " + nameSensorType +
", Side " + nameSide +
", clSize " + nameclSize;
176 B2ERROR(
" you must use track information! change the module parameter to TRUE");
185 tfr = track.getTrackFitResultWithClosestMass(
Const::pion);
200 for (
int cl = 0; cl < static_cast<int>(svdClustersTrack.
size()); cl++) {
201 VxdID cl_VxdID = svdClustersTrack[cl]->getSensorID();
205 int side =
static_cast<int>(svdClustersTrack[cl]->isUCluster());
206 float clCharge = svdClustersTrack[cl]->getCharge();
207 float clSNR = svdClustersTrack[cl]->getSNR();
208 unsigned short clSize = svdClustersTrack[cl]->getSize();
209 unsigned short clSizeIndex;
210 unsigned short sensTypeIndex;
217 clSizeIndex = clSize >= 3 ? 2 : clSize - 1;
230 h_clCharge[sensTypeIndex][side][clSizeIndex]->Fill(clCharge);
233 h_clChargeVsSNR[sensTypeIndex][side][clSizeIndex]->Fill(clSNR, clCharge);
236 h_clSize[sensTypeIndex][side]->Fill(clSize);
242 h_clSNR[sensTypeIndex][side][clSizeIndex]->Fill(clSNR);
258 for (
int j = 0; j <
m_nSides; j++) {
259 std::string nameSensorType =
"";
261 std::string nameSide =
"";
262 nameSide = (j > 0 ?
"U" :
"V");
265 c->SaveAs((
m_outputDirName +
"/clChargeComparison_" + nameSensorType + nameSide +
".png").c_str());
267 gSystem->ProcessEvents();
270 c->SaveAs((
m_outputDirName +
"/clSNRComparison_" + nameSensorType + nameSide +
".png").c_str());
272 gSystem->ProcessEvents();
278 TDirectory* oldDir = gDirectory;
280 TDirectory* dir_clCharge = oldDir->mkdir(
"clCharge");
281 TDirectory* dir_clChargeVsSNR = oldDir->mkdir(
"clChargeVsSNR");
282 TDirectory* dir_clSize = oldDir->mkdir(
"clSize");
283 TDirectory* dir_clSNR = oldDir->mkdir(
"clSNR");
289 dir_clChargeSt->cd();
293 while ((obj =
dynamic_cast<TH1F*
>(nextH_clCharge()))) {
298 dir_clChargeVsSNR->cd();
299 TDirectory* dir_clChargeVsSNRSt = dir_clChargeVsSNR->mkdir(
m_nameSensorTypes[i].c_str());
300 dir_clChargeVsSNRSt->cd();
302 while ((obj =
dynamic_cast<TH2F*
>(nextH_clChargeVsSNR()))) {
311 while ((obj =
dynamic_cast<TH1F*
>(nextH_clSize()))) {
320 while ((obj =
dynamic_cast<TH1F*
>(nextH_clSNR()))) {
332 Int_t nbins, Double_t min, Double_t max,
333 const char* xtitle,
const char* ytitle, TList* histoList)
335 TH1F* h =
new TH1F(name, title, nbins, min, max);
336 h->GetXaxis()->SetTitle(xtitle);
337 h->GetYaxis()->SetTitle(ytitle);
345 Int_t nbinsX, Double_t minX, Double_t maxX,
347 Int_t nbinsY, Double_t minY, Double_t maxY,
348 const char* titleY, TList* histoList)
351 TH2F* h =
new TH2F(name, title, nbinsX, minX, maxX, nbinsY, minY, maxY);
353 h->GetXaxis()->SetTitle(titleX);
354 h->GetYaxis()->SetTitle(titleY);
364 TCanvas* c =
new TCanvas(
"c",
"c");
367 gStyle->SetOptStat(0);
368 gStyle->SetOptTitle(0);
369 gStyle->SetCanvasPreferGL(1);
371 h1->SetLineColor(kRed);
372 h1->SetFillColorAlpha(kRed, 0.35);
374 h2->SetLineColor(kBlue);
375 h2->SetFillColorAlpha(kBlue, 0.35);
377 h3->SetLineColor(kGreen);
378 h3->SetFillColorAlpha(kGreen, 0.35);
380 h2->GetYaxis()->SetTitleOffset(1.4);
385 auto legend =
new TLegend(0.7, 0.7, 0.9, 0.9);
386 legend->SetTextAlign(22);
387 legend->AddEntry(h1,
"clSize 1",
"f");
388 legend->AddEntry(h2,
"clSize 2",
"f");
389 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 ouput 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 strore 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 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.
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.