Commit 6d87bc16 authored by Dominik Smith's avatar Dominik Smith Committed by Sergey Gorbunov
Browse files

Much reconstruction QA

parent 98a15643
......@@ -153,6 +153,7 @@ void mcbm_qa(Int_t nEvents = 0,
if (CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch)) {
run->AddTask(new CbmMuchTransportQa());
run->AddTask(new CbmMuchDigitizerQa());
run->AddTask(new CbmMuchHitFinderQa());
}
// ------------------------------------------------------------------------
......
......@@ -25,6 +25,8 @@
#include "CbmDefs.h"
#include "CbmMCDataManager.h"
#include "CbmMuchDigitizerQa.h"
#include "CbmMuchHitFinderQa.h"
#include "CbmMuchTransportQa.h"
#include "CbmSetup.h"
......@@ -153,6 +155,7 @@ void run_qa(Int_t nEvents = 0,
if (CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch)) {
run->AddTask(new CbmMuchTransportQa());
run->AddTask(new CbmMuchDigitizerQa());
run->AddTask(new CbmMuchHitFinderQa());
}
// ------------------------------------------------------------------------
......
......@@ -4,7 +4,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}
${CBMDETECTORBASE_DIR}/much
${CBMROOT_SOURCE_DIR}/reco/base
${CBMROOT_SOURCE_DIR}/sim/detectors/much/qa
${CBMROOT_SOURCE_DIR}/core/qa
${CBMBASE_DIR}
......@@ -32,12 +32,13 @@ link_directories( ${LINK_DIRECTORIES})
set(SRCS
CbmMuchFindHitsGem.cxx
CbmMuchHitFinderQa.cxx
CbmMuchHitProducerIdeal.cxx
CbmMuchFindTracks.cxx
CbmMuchMatchTracks.cxx
CbmMuchTrackFinderIdeal.cxx
qa/CbmMuchHitFinderQa.cxx
)
set(LINKDEF CbmMuchRecoLinkDef.h)
......
This diff is collapsed.
This diff is collapsed.
// -------------------------------------------------------------------------
// ----- CbmMuchHitFinderQa header file -----
// ----- Modified 01/18 by Vikas Singhal -----
// ----- Modified 01/18 by Vikas Singhal -----
// ----- Created 16/11/07 by E. Kryshen -----
// -------------------------------------------------------------------------
......@@ -9,19 +9,21 @@
#include "FairTask.h"
#include "CbmMuchDigi.h"
#include "TClonesArray.h"
#include "TH1.h"
#include "TH2.h"
#include "TParameter.h"
#include "TString.h"
#include <Rtypes.h>
#include <RtypesCore.h>
#include <TFolder.h>
class CbmDigiManager;
class CbmMuchGeoScheme;
class TObjArray;
class TVector2;
Double_t LandauMPV(Double_t* x, Double_t* par);
Double_t MPV_n_e(Double_t Tkin, Double_t mass);
class CbmQaCanvas;
class TBuffer;
class TClass;
class TClonesArray;
class TH1D;
class TH1I;
class TMemberInspector;
class CbmMuchHitFinderQa : public FairTask {
......@@ -36,31 +38,12 @@ public:
void SetPerformanceFileName(TString fileName) { fFileName = fileName; }
void SetGeometryID(Int_t flag) { fFlag = flag; }
void SetPullsQa(Bool_t on) { fPullsQaOn = on; }
void SetOccupancyQa(Bool_t on) { fOccupancyQaOn = on; }
void SetDigitizerQa(Bool_t on) { fDigitizerQaOn = on; }
void SetStatisticsQa(Bool_t on) { fStatisticsQaOn = on; }
void SetClusterDeconvQa(Bool_t on) { fClusterDeconvQaOn = on; }
void SetPrintToFile(Bool_t on) { fPrintToFileOn = on; }
protected:
/* Analysis of hit uncertainty (pull) distributions
* as function of pad size and cluster shape
*/
void PullsQa();
/* Occupance analysis - all pads,fired pads,
* and fired/all distributions as functions of radius
*/
void OccupancyQa();
/* DigitizerQa - analysis of digitizer performance - charge distributions
* for tracks. Track length distrivutions. Statistics on particle types
*/
void DigitizerQa();
/* Information on clusters - number of pads in a cluster, number of points, contributed to
* a cluster, number of hits, created from a cluster
*/
......@@ -70,105 +53,56 @@ protected:
void ClusterDeconvQa();
private:
void DeInit();
void DrawCanvases();
CbmMuchGeoScheme* fGeoScheme;
TString fGeoFileName;
TString fFileName;
Int_t fSignalPoints; // Number of signal MC points
Int_t fSignalHits; // Number of signal hits
Int_t fVerbose;
Int_t fEvent;
Int_t fFlag;
TClonesArray* fPoints;
TClonesArray* fDigis;
CbmDigiManager* fDigiManager;
TClonesArray* fDigiMatches;
TClonesArray* fClusters;
TClonesArray* fHits;
TClonesArray* fMCTracks;
TClonesArray* fPointInfos;
Int_t fNstations;
TObjArray* fChargeHistos;
TH2D* fhChargeEnergyLog;
TH2D* fhChargeEnergyLogPi;
TH2D* fhChargeEnergyLogPr;
TH2D* fhChargeEnergyLogEl;
TH2D* fhChargeTrackLength;
TH2D* fhChargeTrackLengthPi;
TH2D* fhChargeTrackLengthPr;
TH2D* fhChargeTrackLengthEl;
// TH1D* fhCharge;
TH1D* fhChargeLog;
TH1D* fhChargePr_1GeV_3mm;
TH2D* fhNpadsVsS;
TH1D** fhCharge;
TH1D** fhOccupancyR;
TH1D** fhPadsTotalR;
TH1D** fhPadsFiredR;
TH1D** fhPullXpads1;
TH1D** fhPullYpads1;
TH1D** fhPullXpads2;
TH1D** fhPullYpads2;
TH1D** fhPullXpads3;
TH1D** fhPullYpads3;
Int_t fnPadSizesX;
Int_t fnPadSizesY;
//TH1D** fhPullT;
Int_t fNTimingPulls;
Int_t fVerbose = 0;
Int_t fFlag = 0;
TClonesArray* fPoints = nullptr;
CbmDigiManager* fDigiManager = nullptr;
TFolder fOutFolder; /// output folder with histos and canvases
TFolder* histFolder; /// subfolder for histograms
TClonesArray* fClusters = nullptr;
TClonesArray* fHits = nullptr;
TClonesArray* fMCTracks = nullptr;
Int_t fNstations = 0;
//1D Histogram for PULL Distribution
TH1D* fhPullX;
TH1D* fhPullY;
TH1D* fhPullT;
TH1D* fhPullX = nullptr;
TH1D* fhPullY = nullptr;
TH1D* fhPullT = nullptr;
//1D Histogram for Residual Distribution
TH1D* fhResidualX;
TH1D* fhResidualY;
TH1D* fhResidualT;
TH1I** fhPointsInCluster;
TH1I** fhDigisInCluster;
TH1I** fhHitsInCluster;
Int_t* fNall; // number of all tracks at the first station
Int_t* fNpr; // number of protons at the first station
Int_t* fNpi; // number of pions at the first station
Int_t* fNel; // number of electrons at the first station
Int_t* fNmu; // number of muons at the first station
Int_t* fNka; // number of kaons at the first station
Int_t* fNprimary; // number of primary tracks at the first station
Int_t* fNsecondary; // number of secondary tracks at the first station
Int_t fPointsTotal;
Int_t fPointsUnderCounted;
Int_t fPointsOverCounted;
Bool_t fOccupancyQaOn;
Bool_t fPullsQaOn;
Bool_t fDigitizerQaOn;
Bool_t fStatisticsQaOn;
Bool_t fClusterDeconvQaOn;
Bool_t fPrintToFileOn;
Double_t fPadMinLx;
Double_t fPadMinLy;
Double_t fPadMaxLx;
Double_t fPadMaxLy;
FILE* pointsFile;
FILE* padsFile;
TH1D* fhResidualX = nullptr;
TH1D* fhResidualY = nullptr;
TH1D* fhResidualT = nullptr;
std::vector<TH1I*> fhPointsInCluster;
std::vector<TH1I*> fhDigisInCluster;
std::vector<TH1I*> fhHitsPerCluster;
CbmQaCanvas* fCanvPointsInCluster = nullptr;
CbmQaCanvas* fCanvDigisInCluster = nullptr;
CbmQaCanvas* fCanvHitsPerCluster = nullptr;
CbmQaCanvas* fCanvPull = nullptr;
CbmQaCanvas* fCanvResidual = nullptr;
TParameter<int> fNevents; /// number of processed events
TParameter<int> fSignalPoints; // Number of signal MC points
TParameter<int> fSignalHits; // Number of signal hits
TParameter<int> fPointsTotal;
TParameter<int> fPointsUnderCounted;
TParameter<int> fPointsOverCounted;
/** Defines whether the point with the given index is signal point. **/
Bool_t IsSignalPoint(Int_t iPoint);
Int_t GetNChannels(Int_t iStation);
Int_t GetNSectors(Int_t iStation);
TVector2 GetMinPadSize(Int_t iStation);
TVector2 GetMaxPadSize(Int_t iStation);
CbmMuchHitFinderQa(const CbmMuchHitFinderQa&);
CbmMuchHitFinderQa& operator=(const CbmMuchHitFinderQa&);
......
......@@ -29,6 +29,7 @@
#include "TGraph.h"
#include "TH1.h"
#include "TH2.h"
#include "TParameter.h"
#include "TString.h"
#include "TStyle.h"
#include <FairRootManager.h>
......@@ -46,7 +47,6 @@
#include <math.h>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
......@@ -61,10 +61,8 @@ ClassImp(CbmMuchDigitizerQa);
// -------------------------------------------------------------------------
CbmMuchDigitizerQa::CbmMuchDigitizerQa(const char* name, Int_t verbose)
: FairTask(name, verbose)
, fGeoScheme(nullptr)
, fDigiManager(nullptr)
, fPointInfos(new TClonesArray("CbmMuchPointInfo", 10))
, fOutFolder("MuchDigiQA", "MuchDigitizerQA")
, fNevents("nEvents", 0)
, fvUsPadsFiredR()
, fvUsPadsFiredXY()
, fvTrackCharge()
......@@ -77,13 +75,35 @@ CbmMuchDigitizerQa::~CbmMuchDigitizerQa() { DeInit(); }
// -------------------------------------------------------------------------
void CbmMuchDigitizerQa::DeInit() {
for (int i = 0; i < fNstations; i++) {
delete fvUsPadsFiredR[i];
delete fvUsPadsFiredXY[i];
delete fvTrackCharge[i];
delete fvPadsTotalR[i];
delete fvPadsFiredR[i];
delete fvPadOccupancyR[i];
histFolder = nullptr;
fGeoScheme = nullptr;
fDigiManager = nullptr;
fPoints = nullptr;
fDigis = nullptr;
fDigiMatches = nullptr;
fMCTracks = nullptr;
fOutFolder.Clear();
SafeDelete(fPointInfos);
for (uint i = 0; i < fvUsPadsFiredR.size(); i++) {
SafeDelete(fvUsPadsFiredR[i]);
}
for (uint i = 0; i < fvUsPadsFiredXY.size(); i++) {
SafeDelete(fvUsPadsFiredXY[i]);
}
for (uint i = 0; i < fvTrackCharge.size(); i++) {
SafeDelete(fvTrackCharge[i]);
}
for (uint i = 0; i < fvPadsTotalR.size(); i++) {
SafeDelete(fvPadsTotalR[i]);
}
for (uint i = 0; i < fvPadsFiredR.size(); i++) {
SafeDelete(fvPadsFiredR[i]);
}
for (uint i = 0; i < fvPadOccupancyR.size(); i++) {
SafeDelete(fvPadOccupancyR[i]);
}
fvUsPadsFiredR.clear();
fvUsPadsFiredXY.clear();
......@@ -92,13 +112,46 @@ void CbmMuchDigitizerQa::DeInit() {
fvPadsFiredR.clear();
fvPadOccupancyR.clear();
fNstations = 0;
fOutFolder.Clear();
SafeDelete(fhTrackLength);
SafeDelete(fhTrackLengthPi);
SafeDelete(fhTrackLengthPr);
SafeDelete(fhTrackLengthEl);
SafeDelete(fhTrackChargeVsTrackEnergyLog);
SafeDelete(fhTrackChargeVsTrackEnergyLogPi);
SafeDelete(fhTrackChargeVsTrackEnergyLogPr);
SafeDelete(fhTrackChargeVsTrackEnergyLogEl);
SafeDelete(fhTrackChargeVsTrackLength);
SafeDelete(fhTrackChargeVsTrackLengthPi);
SafeDelete(fhTrackChargeVsTrackLengthPr);
SafeDelete(fhTrackChargeVsTrackLengthEl);
SafeDelete(fhNpadsVsS);
SafeDelete(fCanvCharge);
SafeDelete(fCanvStationCharge);
SafeDelete(fCanvChargeVsEnergy);
SafeDelete(fCanvChargeVsLength);
SafeDelete(fCanvTrackLength);
SafeDelete(fCanvNpadsVsArea);
SafeDelete(fCanvUsPadsFiredXY);
SafeDelete(fCanvPadOccupancyR);
SafeDelete(fCanvPadsTotalR);
SafeDelete(fFitEl);
SafeDelete(fFitPi);
SafeDelete(fFitPr);
fNevents.SetVal(0);
fNstations = 0;
fnPadSizesX = 0;
fnPadSizesY = 0;
fPadMinLx = 0.;
fPadMinLy = 0.;
fPadMaxLx = 0.;
fPadMaxLy = 0.;
}
// -------------------------------------------------------------------------
InitStatus CbmMuchDigitizerQa::Init() {
DeInit();
fPointInfos = new TClonesArray("CbmMuchPointInfo", 10);
TDirectory* oldDirectory = gDirectory;
FairRootManager* fManager = FairRootManager::Instance();
......@@ -134,8 +187,9 @@ InitStatus CbmMuchDigitizerQa::Init() {
fMCTracks = nullptr;
fPoints = nullptr;
}
histFolder = fOutFolder.AddFolder("hist", "Histogramms");
fNevents.SetVal(0);
histFolder->Add(&fNevents);
//fVerbose = 3;
InitCanvases();
......@@ -570,9 +624,8 @@ void CbmMuchDigitizerQa::SetParContainers() {
// -------------------------------------------------------------------------x
void CbmMuchDigitizerQa::Exec(Option_t*) {
fNevents++;
LOG(info) << "Event: " << fNevents;
fNevents.SetVal(fNevents.GetVal() + 1);
LOG(debug) << "Event: " << fNevents.GetVal();
if (CheckConsistency() != 0) { return; }
......@@ -910,7 +963,7 @@ void CbmMuchDigitizerQa::DrawPadCanvases() {
for (Int_t i = 0; i < fNstations; i++) {
*fvPadsFiredR[i] = *fvUsPadsFiredR[i];
//fvPadsFiredR[i]->Sumw2();
fvPadsFiredR[i]->Scale(1. / fNevents);
fvPadsFiredR[i]->Scale(1. / fNevents.GetVal());
fvPadOccupancyR[i]->Divide(fvPadsFiredR[i], fvPadsTotalR[i]);
fvPadOccupancyR[i]->Scale(100.);
......@@ -1075,4 +1128,4 @@ Double_t CbmMuchDigitizerQa::MPV_n_e(Double_t Tkin, Double_t mass) {
if (logT < min_logT_p) logT = min_logT_p;
return fPol6.EvalPar(&logT, mpv_p);
}
}
\ No newline at end of file
}
......@@ -10,6 +10,7 @@
#define CbmMuchDigitizerQa_H
#include "FairTask.h"
#include "TParameter.h"
#include <Rtypes.h>
#include <RtypesCore.h>
#include <TFolder.h>
......@@ -96,8 +97,8 @@ private:
TClonesArray* fMCTracks = nullptr;
TClonesArray* fPointInfos = nullptr; /// temporary additional information
TFolder fOutFolder; /// output folder with histos and canvases
Int_t fNevents = 0; /// number of processed events
TFolder fOutFolder; /// output folder with histos and canvases
TParameter<int> fNevents; /// number of processed events
// internal unscaled histograms, need to be scaled at the output
std::vector<TH1F*> fvUsPadsFiredR; // fired pads vs R, per station
......@@ -144,9 +145,8 @@ private:
TF1* fFitPi = nullptr;
TF1* fFitPr = nullptr;
Int_t fSignalPoints = 0; // Number of signal MC points
Int_t fnPadSizesX = 0;
Int_t fnPadSizesY = 0;
Int_t fnPadSizesX = 0;
Int_t fnPadSizesY = 0;
Double_t fPadMinLx = 0.;
Double_t fPadMinLy = 0.;
......
......@@ -41,7 +41,7 @@ ClassImp(CbmMuchTransportQa);
CbmMuchTransportQa::CbmMuchTransportQa(const char* name, Int_t verbose)
: FairTask(name, verbose)
, fOutFolder("MuchTransportQA", "Much Transport QA")
, fhNevents("nEvents", 0)
, fNevents("nEvents", 0)
, fvUsNtra()
, fvMcPointXY()
, fvMcPointPhiZ()
......@@ -59,7 +59,8 @@ void CbmMuchTransportQa::DeInit() {
fPoints = nullptr;
fMcTracks = nullptr;
fOutFolder.Clear();
fhNevents.SetVal(0);
histFolder = nullptr;
fNevents.SetVal(0);
SafeDelete(fhUsNtraAll);
SafeDelete(fhUsNtraPrim);
......@@ -69,6 +70,7 @@ void CbmMuchTransportQa::DeInit() {
SafeDelete(fhUsNtraEl);
SafeDelete(fhUsNtraMu);
SafeDelete(fhUsNtraKa);
fvUsNtra.clear();
for (uint i = 0; i < fvMcPointXY.size(); i++) {
SafeDelete(fvMcPointXY[i]);
......@@ -83,12 +85,6 @@ void CbmMuchTransportQa::DeInit() {
fvMcPointPhiZ.clear();
fvMcPointRZ.clear();
for (uint i = 0; i < fvMcPointPRatio.size(); i++) {
SafeDelete(fvMcPointPRatio[i]);
}
for (uint i = 0; i < fvMcPointPrimRatio.size(); i++) {
SafeDelete(fvMcPointPrimRatio[i]);
}
SafeDelete(fhNtracks);
SafeDelete(fhFractionPrim);
SafeDelete(fhFractionSec);
......@@ -97,9 +93,14 @@ void CbmMuchTransportQa::DeInit() {
SafeDelete(fhFractionEl);
SafeDelete(fhFractionMu);
SafeDelete(fhFractionKa);
fvUsNtra.clear();
fvFraction.clear();
for (uint i = 0; i < fvMcPointPRatio.size(); i++) {
SafeDelete(fvMcPointPRatio[i]);
}
for (uint i = 0; i < fvMcPointPrimRatio.size(); i++) {
SafeDelete(fvMcPointPrimRatio[i]);
}
fvMcPointPRatio.clear();
fvMcPointPrimRatio.clear();
......@@ -109,13 +110,12 @@ void CbmMuchTransportQa::DeInit() {
SafeDelete(fCanvNtra);
SafeDelete(fCanvStationPRatio);
SafeDelete(fCanvStationPrimRatio);
fNstations = 0;
fOutFolder.Clear();
}
// -------------------------------------------------------------------------
InitStatus CbmMuchTransportQa::Init() {
DeInit();
TDirectory* oldDirectory = gDirectory;
FairRootManager* manager = FairRootManager::Instance();
......@@ -151,8 +151,8 @@ InitStatus CbmMuchTransportQa::Init() {
return kFATAL;
}
}
fhNevents.SetVal(0);
histFolder->Add(&fhNevents);
fNevents.SetVal(0);
histFolder->Add(&fNevents);
InitCountingHistos();
InitFractionHistos();
......@@ -355,8 +355,8 @@ void CbmMuchTransportQa::SetParContainers() {
// -------------------------------------------------------------------------
void CbmMuchTransportQa::Exec(Option_t*) {
LOG(info) << "Event: " << fhNevents.GetVal();
fhNevents.SetVal(fhNevents.GetVal() + 1);
fNevents.SetVal(fNevents.GetVal() + 1);
LOG(debug) << "Event: " << fNevents.GetVal();
// bitmask tells which stations were crossed by mc track
std::vector<UInt_t> trackStaCross(fMcTracks->GetEntriesFast(), 0);
......@@ -450,7 +450,7 @@ TFolder& CbmMuchTransportQa::GetQa() {
TDirectory* oldDirectory = gDirectory;
fhNtracks->Reset();
fhNtracks->Add(fhUsNtraAll, 1. / fhNevents.GetVal());
fhNtracks->Add(fhUsNtraAll, 1. / fNevents.GetVal());
std::vector<Double_t> errors(fNstations, 0.);
fhUsNtraAll->SetError(errors.data());
......@@ -497,7 +497,7 @@ void CbmMuchTransportQa::DrawCanvases() {
PrimRatioPieLeg->SetX2(.90);
}
double scale = (fhNevents.GetVal() > 0) ? 1. / fhNevents.GetVal() : 0;
double scale = (fNevents.GetVal() > 0) ? 1. / fNevents.GetVal() : 0;
int i = 1;
fCanvNtra->cd(i++);
......@@ -589,4 +589,4 @@ void CbmMuchTransportQa::Finish() {
}
FairSink* sink = FairRootManager::Instance()->GetSink();
sink->WriteObject(&GetQa(), nullptr);
}
\ No newline at end of file
}
......@@ -78,9 +78,9 @@ private:
TClonesArray* fMcTracks = nullptr;
///
TFolder* histFolder; /// subfolder for histograms
TFolder fOutFolder; /// output folder with histos and canvases
TParameter<int> fhNevents; /// number of processed events
TFolder* histFolder; /// subfolder for histograms
TFolder fOutFolder; /// output folder with histos and canvases
TParameter<int> fNevents; /// number of processed events
/// internal unscaled histogramms
TH1F* fhUsNtraAll = nullptr; /// number of all tracks
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment