 |
Belle II Software
release-05-01-25
|
11 #include <svd/modules/svdPerformance/SVDClusterEvaluationTrueInfoModule.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <mdst/dataobjects/MCParticle.h>
14 #include <svd/dataobjects/SVDShaperDigit.h>
15 #include <svd/dataobjects/SVDRecoDigit.h>
16 #include <svd/dataobjects/SVDCluster.h>
17 #include <svd/dataobjects/SVDTrueHit.h>
21 #include <TGraphErrors.h>
33 SVDClusterEvaluationTrueInfoModule::SVDClusterEvaluationTrueInfoModule() :
Module()
35 setDescription(
"This modules generates performance plots on SVD clustering.");
37 addParam(
"outputFileName", m_outputFileName,
"output rootfile name", std::string(
"SVDClusterEvaluationTrueInfo.root"));
38 addParam(
"SVDEventInfo", m_svdEventInfoName,
"Defines the name of the EventInfo", std::string(
""));
42 SVDClusterEvaluationTrueInfoModule::~SVDClusterEvaluationTrueInfoModule()
56 SVDShaperDigits.isRequired();
57 SVDRecoDigits.isRequired();
58 SVDClusters.isRequired();
59 SVDTrueHits.isRequired();
83 for (
int i = 0; i <
m_Nsets; i ++) {
89 "U_reco - U_true (cm)",
95 "(U_reco - U_true)/U_sigma",
155 "number of TM recoDigits / cluster size",
169 "number of TM recoDigits / cluster size",
235 if (relatVectorShaperToReco.
size() > 0)
248 if (relatVectorRecoToTH.
size() > 0)
273 for (
int j = 0; j < (int) relatVectorTHToClus.
size(); j ++) {
275 relatVectorTHToClus[j]->getSensorID().getSensorNumber() , relatVectorTHToClus[j]->isUCluster());
277 if (relatVectorTHToClus[j]->isUCluster() && ! hasU) {
280 }
else if (!relatVectorTHToClus[j]->isUCluster() && ! hasV) {
298 if (relatVectorClusToTH.
size() > 0)
305 for (
int q = 0; q < (int)relatVectorClusToTH.
size(); q ++) {
315 else if (triggerBin == 1)
317 else if (triggerBin == 2)
319 else if (triggerBin == 3)
323 (clus.getClsTimeSigma()));
326 if (clus.isUCluster()) {
328 (relatVectorClusToTH[q])->getU());
330 (relatVectorClusToTH[q])->getU()) / (clus.getPositionSigma()));
332 (relatVectorClusToTH[q])->getU()) , (clus.getClsTime() - (relatVectorClusToTH[q])->getGlobalTime()));
336 (clus.getPositionSigma()));
338 (clus.getClsTime() - (relatVectorClusToTH[q])->getGlobalTime()));
344 if (relatVectorClusToTH.
size() > 0) {
348 int numberOfGoodTHInACluster = 0;
349 int numberOfGoodTHInAClusterGood = 0;
350 for (
int k = 0; k < (int)(relatVectorClusToTH.
size()); k ++) {
352 numberOfGoodTHInACluster ++;
353 numberOfGoodTHInAClusterGood ++;
357 if (numberOfGoodTHInAClusterGood > 0)
362 for (
int k = 0; k < (int)relatVectorClusToReco.
size(); k++) {
363 RelationVector<SVDTrueHit> relatVectorRecoFromClusToTH = DataStore::getRelationsWithObj<SVDTrueHit>(relatVectorClusToReco[k]);
365 if (relatVectorRecoFromClusToTH.
size() > 0)
377 for (
int k = 0; k < (int)relatVectorClusToReco.
size(); k++) {
378 RelationVector<SVDTrueHit> relatVectorRecoFromClusToTH = DataStore::getRelationsWithObj<SVDTrueHit>(relatVectorClusToReco[k]);
380 if (relatVectorRecoFromClusToTH.
size() > 0)
396 for (
int k = 0; k <
m_Nsets; k ++) {
475 TDirectory* oldDir = gDirectory;
478 TDirectory* dir_strtime = oldDir->mkdir(
"strip_time");
481 while ((obj = nextH_strtime()))
484 TDirectory* dir_cltime = oldDir->mkdir(
"cluster_time");
487 while ((obj = nextH_cltime()))
490 TDirectory* dir_cltimepull = oldDir->mkdir(
"cluster_time_pull");
491 dir_cltimepull->cd();
493 while ((obj = nextH_cltimepull()))
496 TDirectory* dir_clpos = oldDir->mkdir(
"cluster_position");
499 while ((obj = nextH_clpos()))
502 TDirectory* dir_clpospull = oldDir->mkdir(
"cluster_position_pull");
505 while ((obj = nextH_clpospull()))
508 TDirectory* dir_clpostime = oldDir->mkdir(
"cluster_timeVSposition");
511 while ((obj = nextH_clpostime()))
514 TDirectory* dir_clinpurTM = oldDir->mkdir(
"intra_cluster_purity_TM");
517 while ((obj = nextH_clinpurTM()))
520 TDirectory* dir_clinpurTM2D = oldDir->mkdir(
"intra_cluster_purity_TM2D");
521 dir_clinpurTM2D->cd();
523 while ((obj = nextH_clinpurTM2D()))
526 TDirectory* dir_clinpurNOTM = oldDir->mkdir(
"intra_cluster_purity_NOTM");
527 dir_clinpurNOTM->cd();
529 while ((obj = nextH_clinpurNOTM()))
532 TDirectory* dir_puddle = oldDir->mkdir(
"trueHits_in_cluster");
535 while ((obj = nextH_puddle()))
538 TDirectory* dir_puddleTM = oldDir->mkdir(
"trueHits_in_TMcluster");
541 while ((obj = nextH_puddleTM()))
544 TDirectory* dir_goodPuddleTM = oldDir->mkdir(
"goodTrueHits_in_TMcluster");
545 dir_goodPuddleTM->cd();
547 while ((obj = nextH_GoodPuddleTM()))
550 TDirectory* dir_goodPuddleTMGood = oldDir->mkdir(
"goodTrueHits_in_GoodTMcluster");
551 dir_goodPuddleTMGood->cd();
553 while ((obj = nextH_GoodPuddleTMGood()))
556 TDirectory* dir_graph = oldDir->mkdir(
"graphs");
559 while ((obj = nextH_graph()))
562 TDirectory* dir_controlsMC = oldDir->mkdir(
"controlMC");
563 dir_controlsMC->cd();
565 while ((obj = nextH_controlsMC()))
583 Int_t nbins, Double_t min, Double_t max,
584 const char* xtitle, TList* histoList)
586 TH1F* h =
new TH1F(name, title, nbins, min, max);
588 h->GetXaxis()->SetTitle(xtitle);
597 Int_t nbinsX, Double_t minX, Double_t maxX,
599 Int_t nbinsY, Double_t minY, Double_t maxY,
600 const char* titleY, TList* histoList)
603 TH2F* h =
new TH2F(name, title, nbinsX, minX, maxX, nbinsY, minY, maxY);
605 h->GetXaxis()->SetTitle(titleX);
606 h->GetYaxis()->SetTitle(titleY);
618 if (LayerNumber == 3) {
624 if (SensorNumber == 1) {
656 if (idx == 2 || idx == 3)
678 TString xTitle, TString yTitle, TList* list)
686 for (
int set = 0; set <
m_Nsets; set++) {
692 ratio[set] = (float)vNum[set] / (
float)vDen[set];
693 ratioErr[set] = sqrt(ratio[set] * (1 - ratio[set]) / (
float)vDen[set]);
698 TCanvas* c =
new TCanvas(name, title);
699 TGraphErrors* g =
new TGraphErrors(
m_Nsets, x, ratio, xErr, ratioErr);
702 g->GetXaxis()->SetTitle(xTitle.Data());
703 g->GetYaxis()->SetTitle(yTitle.Data());
704 g->GetYaxis()->SetRangeUser(0.00001, 1.10);
706 g->SetMarkerStyle(20);
707 g->SetMarkerSize(0.8);
708 TAxis* xAxis = g->GetXaxis();
710 TText* t =
new TText();
712 t->SetTextSize(0.035);
714 TString labels[
m_Nsets] = {
"3U",
"3V",
"456FU",
"456FV",
"456BU",
"456BV"};
715 for (Int_t i = 0; i <
m_Nsets; i++) {
716 xAxis->SetBinLabel(xAxis->FindBin(i + 1) , labels[i].Data());
725 float xErr[m_Nsets],
float y[m_Nsets],
float yErr[m_Nsets], TString xTitle, TString yTitle, TList* list,
int len)
732 B2INFO(
"ERROR, WRONG LENGTH FOR MEANS TGRAPH CREATION!!!");
736 float xErr[m_Nsets],
float y[m_Nsets],
float yErr[m_Nsets], TString xTitle, TString yTitle, TList* list)
739 TCanvas* c =
new TCanvas(name, title);
740 TGraphErrors* g =
new TGraphErrors(
m_Nsets, x, y, xErr, yErr);
743 g->GetXaxis()->SetTitle(xTitle.Data());
744 g->GetYaxis()->SetTitle(yTitle.Data());
746 g->SetMarkerStyle(20);
747 g->SetMarkerSize(0.8);
748 TAxis* xAxis = g->GetXaxis();
750 TText* t =
new TText();
752 t->SetTextSize(0.035);
754 TString labels[
m_Nsets] = {
"3U",
"3V",
"456FU",
"456FV",
"456BU",
"456BV"};
755 for (Int_t i = 0; i <
m_Nsets; i++) {
756 xAxis->SetBinLabel(xAxis->FindBin(i + 1) , labels[i].Data());
765 float xErr[m_NsetsRed],
float y[m_NsetsRed],
float yErr[m_NsetsRed], TString xTitle, TString yTitle, TList* list)
768 TCanvas* c =
new TCanvas(name, title);
769 TGraphErrors* g =
new TGraphErrors(
m_NsetsRed, x, y, xErr, yErr);
772 g->GetXaxis()->SetTitle(xTitle.Data());
773 g->GetYaxis()->SetTitle(yTitle.Data());
775 g->SetMarkerStyle(20);
776 g->SetMarkerSize(0.8);
777 TAxis* xAxis = g->GetXaxis();
779 TText* t =
new TText();
781 t->SetTextSize(0.035);
783 TString labels[
m_NsetsRed] = {
"3",
"456F",
"456B"};
785 xAxis->SetBinLabel(xAxis->FindBin(i + 1) , labels[i].Data());
801 if (relatVectorTHToMC.
size() > 0) {
805 float charge = relatVectorTHToMC[0]->getCharge();
806 bool primary = relatVectorTHToMC[0]->isPrimaryParticle();
811 if (charge != 0 && primary)
size_t size() const
Get number of relations.
static const int m_NsetsRed
numbner of reduced sets
float m_OrderingVec[m_Nsets]
Vectors used to Draw the TGraphs (defined in the cc) depicting the averages and the means of the hist...
float m_mean_GoodTHinClusterTM[m_Nsets]
good true hits in cluster truth matched average
TH1F * m_histo_GoodTHinClusterTM[m_Nsets]
Vector of histograms depicting Number of Good TH inside a TM Cluster.
TString TitleOfHisto
Strings to pass titles of the histos in the vectors of hitos.
baseType getTriggerBin() const
Get the triggerBin id.
StoreObjPtr< SVDEventInfo > m_storeSVDEvtInfo
Storage for SVDEventInfo object.
void setDescription(const std::string &description)
Sets the description of the module.
TString UVFromIndex(int idx)
Function returning "U" or "V" depending on the index.
virtual void beginRun() override
Called when entering a new run.
TH2F * m_histo2D_PurityInsideTMCluster[m_Nsets]
Vector of 2D histograms depicting TM Reco Vs Total Reco inside a TM Cluster.
TH1F * m_histo_ClusterTimeResolution[m_Nsets]
Vector of histograms depicting Cluster Time Residuals.
TH1F * m_histo_THinCluster[m_Nsets]
Vector of histograms depicting Number of TH inside a Cluster.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
TString NameOfHisto
Strings to pass names of the histos in the vectors of hitos.
TH1F * m_histo_ClusterUPositionResolution[m_NsetsRed]
Vector of histograms depicting Cluster U Position Residual (Reduced length!)
int m_NumberOfRecoDigit[m_Nsets]
number of reco digits
TList * m_histoList_PurityInsideNOTMCluster
histo list not truth matched cluster purity
float m_RMS_GoodTHinClusterTM[m_Nsets]
good true hits in cluster truth matched rms
Class SVDTrueHit - Records of tracks that either enter or leave the sensitive volume.
int m_NumberOfShaperDigit[m_Nsets]
Vectors used to compute the quantities depicted in Histos and Graphs.
float m_RMS_THinClusterTM[m_Nsets]
true hits in truth matched cluster rms
float m_mean_ClusterVPositionResolution[m_Nsets]
average cl V position reosl
std::string m_svdEventInfoName
Name of the SVDEventInfo object.
TList * m_graphList
histo list, TGraphs
Class to store SVD mode information.
int indexFromLayerSensorSide(int LayerNumber, int SensorNumber, int UVNumber)
Function returning the index used for Histos.
void createEfficiencyGraph(const char *name, const char *title, int vNum[m_Nsets], int vDen[m_Nsets], TString xTitle, TString yTitle, TList *list)
Function returning a TGraph with Y axis limited to 1 given numerator and denumerator vectors and plot...
TH1F * m_histo_ClusterTimeResolution_bin4[m_Nsets]
TB4.
float m_RMS_ClusterTimeResolution[m_Nsets]
rms cluster time resid
TString IntExtFromIndex(int idx)
Function returning "Internal" or "External" depending on the index.
TH1F * m_histo_ClusterTimeResolution_bin2[m_Nsets]
TB2.
TH1F * m_histo_ClusterUPositionPull[m_NsetsRed]
Vector of histograms depicting Cluster U Position Pull (Reduced length!)
The SVD ShaperDigit class.
float m_mean_ClusterTimeResolution[m_Nsets]
average cl time resid
TH1F * m_histo_ClusterTimeResolution_bin3[m_Nsets]
TB3.
TList * m_histoList_THinClusterTM
histo list true hits in clsuter truth match
TH1F * m_histo_GoodTHinClusterTMGood[m_Nsets]
Vector of histograms depicting Number of Good TH inside a Good TM Cluster.
float m_RMS_ClusterUPositionResolution[m_Nsets]
rms cl U position resol
float m_mean_ClusterUPositionResolution[m_Nsets]
average cl U position resol
int indexForHistosAndGraphs
Index used for the lists and for the vectors of histograms: it indicates the set of sensors we are lo...
float m_mean_PurityInsideTMCluster[m_Nsets]
cluster purity average
float m_RMS_ClusterVPositionResolution[m_Nsets]
rms cl V position resol
Class for type safe access to objects that are referred to in relations.
TList * m_histoList_Control
control histo
Abstract base class for different kinds of events.
TString FWFromIndex(int idx)
Function returning "Forward" or "Backword" depending on the index.
TList * m_histoList_PurityInsideTMCluster
histo list truth matched cluster purity (2D)
TList * m_histoList_ClusterPositionResolution
histo list cluster position resolution
void createArbitraryGraphErrorChooser(const char *name, const char *title, float x[m_Nsets], float xErr[m_Nsets], float y[m_Nsets], float yErr[m_Nsets], TString xTitle, TString yTitle, TList *list, int len)
Function choosing between the two following functions depending on the length of the provided arrays.
TH1F * m_histoControl_MCisPrimary
control histo: MC is primary
float m_RMS_StripTimeResolution[m_Nsets]
rms of strip time residual
TH1F * m_histo_PurityInsideNOTMCluster[m_Nsets]
Vector of histograms depicting TM Cluster Internal Purity (TM Recos over Reco inside a Cluster)
RelationVector< FROM > getRelationsFrom(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from another store array to this object.
TH1F * m_histo_ClusterTimeResolution_bin1[m_Nsets]
Vector of histograms depicting Cluster Time Residuals, divided by TriggerBin.
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)
Function returning TH2F.
int m_NumberOfTMClusters[m_Nsets]
number of truth matched clusters
TList * m_histoList_StripTimeResolution
Lists used to easily Draw the corresponding histos; last one is used to draw the TGraphs.
TFile * m_outputFile
output file
TList * m_histo2DList_PurityInsideTMCluster
histo list truth matched cluster purity (2D)
virtual void endRun() override
This method is called if the current run ends.
TList * m_histoList_ClusterTimeResolution
histo list cluster time resolution
virtual void event() override
This method is the core of the SVDClusterEvaluationTrueInfo.
float m_RMS_PurityInsideTMCluster[m_Nsets]
cluster purity rms
TList * m_histo2DList_TresVsPosres
histo list ime tresol VS position resol
float m_mean_THinCluster[m_Nsets]
true hits in cluster average
float m_RMS_GoodTHinClusterTMGood[m_Nsets]
good true hits in cluster truth match good rms
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
void createArbitraryGraphError_Red(const char *name, const char *title, float x[m_NsetsRed], float xErr[m_NsetsRed], float y[m_NsetsRed], float yErr[m_NsetsRed], TString xTitle, TString yTitle, TList *list)
Function returning an arbitrarly defined TGraph with arrays length equal to m_NsetsRed.
TH1F * m_histo_PurityInsideTMCluster[m_Nsets]
Vector of histograms depicting Cluster Internal Purity (TM Recos over Reco inside a Cluster)
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
TList * m_histoList_ClusterPositionPull
histo list cluster position pull
int m_NumberOfTMRecoInTMCluster
numnber of true match reco digit in truth match cluster
TH1F * m_histo_StripTimeResolution[m_Nsets]
Vector of histograms depicting Strip Time Residuals.
TH1F * m_histo_THinClusterTM[m_Nsets]
Vector of histograms depicting Number of TH inside a TM Cluster.
std::string m_outputFileName
output file name
static const int m_Nsets
number of sets: L3-barrel-U, L3-barrel-V, L456-barrel-U, L456-barrel-V, L456-slanted-U,...
int m_NumberOfClustersRelatedToTH[m_Nsets]
number of clusters related to true hits
float m_mean_THinClusterTM[m_Nsets]
true hits in truth matched cluster average
float m_NullVec[m_Nsets]
null vector
TList * m_histoList_GoodTHinClusterTMGood
histo list goo true hits in cluster truth match good
TH1F * m_histo_ClusterVPositionPull[m_NsetsRed]
Vector of histograms depicting Cluster U Position Pull (Reduced length!)
TH1F * m_histoControl_MCcharge
Control Histos and List to check if the function used to define a TH as "good" is working fine.
virtual void terminate() override
This method is called at the end of the event processing.
virtual void initialize() override
Initialize the SVDClusterEvaluationTrueInfo.
TH1F * m_histo_ClusterVPositionResolution[m_NsetsRed]
Vector of histograms depicting Cluster V Position Residual (Reduced length!)
A Class to store the Monte Carlo particle information.
Accessor to arrays stored in the data store.
int m_NumberOfClusters[m_Nsets]
number of clusters
float m_mean_StripTimeResolution[m_Nsets]
Vectors of floats containing the mean and the RMS from the corresponding histo.
TH1F * createHistogram1D(const char *name, const char *title, Int_t nbins, Double_t min, Double_t max, const char *xtitle, TList *histoList)
Function returning a TH1F.
float m_mean_GoodTHinClusterTMGood[m_Nsets]
good true hits in cluster truth match good average
TH1F * m_histo_ClusterTimePull[m_Nsets]
Vector of histograms depicting Cluster Time Pull.
int m_NumberOfTMRecoInNOTMCluster
number of truth matched reco digits in not truth matched clusters
float m_RMS_THinCluster[m_Nsets]
true hits in cluster rms
TList * m_histoList_ClusterTimePull
histo list cluster time pull
bool goodTrueHit(const SVDTrueHit *thino)
Function defining if a TH is good (based on charge and primaryness)
TH2F * m_histo2D_TresVsPosres[m_Nsets]
Vector of 2D histograms depicting Time Residuals Vs Position (U/V) Residuals for Histos.
void createArbitraryGraphError_Std(const char *name, const char *title, float x[m_Nsets], float xErr[m_Nsets], float y[m_Nsets], float yErr[m_Nsets], TString xTitle, TString yTitle, TList *list)
Function returning an arbitrarly defined TGraph with arrays length equal to m_Nsets.
TList * m_histoList_GoodTHinClusterTM
histo list good true hits in cluster truth matched
TH1F * m_histoControl_THToMCsize
control histo: true hit to mc size
int m_NumberOfTH[m_Nsets]
numner of true hits
TList * m_histoList_THinCluster
histo list true hits in cluster