Go to the documentation of this file.
38 #include "FairRootManager.h"
41 #include "TClonesArray.h"
47 #include "TProfile2D.h"
51 #include <boost/assign/list_of.hpp>
58 using boost::assign::list_of;
59 using std::binary_search;
93 fHM->
H1(
"hen_EventNo_ClusteringQa")->Fill(0.5);
94 Int_t eventNum =
fHM->
H1(
"hen_EventNo_ClusteringQa")->GetEntries() - 1;
95 std::cout <<
"CbmLitClusteringQa::Exec: event=" << eventNum << std::endl;
103 ProcessDigis<CbmStsDigi>(
"Sts");
104 ProcessDigis<CbmTrdDigi>(
"Trd");
105 ProcessDigis<CbmMuchDigi>(
"Much");
140 TDirectory* oldir = gDirectory;
141 TFile* outFile = FairRootManager::Instance()->GetOutFile();
142 if (outFile != NULL) {
146 gDirectory->cd(oldir->GetPath());
155 TFile* oldfile = gFile;
156 TFile* file =
new TFile(digiFileName.c_str());
157 TObjArray* stations = (TObjArray*) file->Get(
"stations");
166 FairRootManager* ioman = FairRootManager::Instance();
167 assert(ioman != NULL);
174 <<
"CbmMatchRecoToMC::ReadAndCreateDataBranches() NULL MCDataManager.";
179 fMvdHits = (TClonesArray*) ioman->GetObject(
"MvdHit");
182 fStsClusters = (TClonesArray*) ioman->GetObject(
"StsCluster");
183 fStsHits = (TClonesArray*) ioman->GetObject(
"StsHit");
187 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
191 fMuchClusters = (TClonesArray*) ioman->GetObject(
"MuchCluster");
192 fMuchPixelHits = (TClonesArray*) ioman->GetObject(
"MuchPixelHit");
197 fTrdClusters = (TClonesArray*) ioman->GetObject(
"TrdCluster");
198 fTrdHits = (TClonesArray*) ioman->GetObject(
"TrdHit");
203 fTofHits = (TClonesArray*) ioman->GetObject(
"TofHit");
223 const string& detName,
225 string histName =
"hno_NofObjects_" + detName +
"Points_Station";
227 Int_t evSize =
points->Size(0, iEvent);
229 for (Int_t iP = 0; iP < evSize; iP++) {
230 const FairMCPoint* point =
231 static_cast<const FairMCPoint*
>(
points->Get(0, iEvent, iP));
240 if (!
fHM->
Exists(
"hno_NofObjects_" + detName +
"Digis_Station"))
return;
244 Int_t stationId =
GetStationId(digi->GetAddress(), detId);
245 fHM->
H1(
"hno_NofObjects_" + detName +
"Digis_Station")->Fill(stationId);
246 fHM->
H1(
"hpa_" + detName +
"Digi_NofPointsInDigi_H1")
247 ->Fill(digiMatch->GetNofLinks());
248 fHM->
H1(
"hpa_" + detName +
"Digi_NofPointsInDigi_H2")
249 ->Fill(stationId, digiMatch->GetNofLinks());
254 const TClonesArray* clusterMatches,
255 const string& detName,
258 &&
fHM->
Exists(
"hno_NofObjects_" + detName +
"Clusters_Station")) {
259 for (Int_t
i = 0;
i < clusters->GetEntriesFast();
i++) {
263 static_cast<const CbmMatch*
>(clusterMatches->At(
i));
265 fHM->
H1(
"hno_NofObjects_" + detName +
"Clusters_Station")
267 fHM->
H1(
"hpa_" + detName +
"Cluster_NofDigisInCluster_H1")
269 fHM->
H1(
"hpa_" + detName +
"Cluster_NofDigisInCluster_H2")
271 fHM->
H1(
"hpa_" + detName +
"Cluster_NofPointsInCluster_H1")
273 fHM->
H1(
"hpa_" + detName +
"Cluster_NofPointsInCluster_H2")
280 const TClonesArray* hitMatches,
281 const string& detName,
284 &&
fHM->
Exists(
"hno_NofObjects_" + detName +
"Hits_Station")) {
285 for (Int_t
i = 0;
i <
hits->GetEntriesFast();
i++) {
288 static_cast<const CbmMatch*
>(hitMatches->At(
i));
290 fHM->
H1(
"hno_NofObjects_" + detName +
"Hits_Station")->Fill(stationId);
291 fHM->
H1(
"hpa_" + detName +
"Hit_SigmaX_H1")->Fill(hit->
GetDx());
292 fHM->
H1(
"hpa_" + detName +
"Hit_SigmaX_H2")
293 ->Fill(stationId, hit->
GetDx());
294 fHM->
H1(
"hpa_" + detName +
"Hit_SigmaY_H1")->Fill(hit->
GetDy());
295 fHM->
H1(
"hpa_" + detName +
"Hit_SigmaY_H2")
296 ->Fill(stationId, hit->
GetDy());
297 fHM->
H1(
"hpa_" + detName +
"Hit_NofPointsInHit_H1")
299 fHM->
H1(
"hpa_" + detName +
"Hit_NofPointsInHit_H2")
308 fHM->
H1(
"hno_NofObjects_MvdPoints_Event")
311 fHM->
H1(
"hno_NofObjects_StsPoints_Event")
314 fHM->
H1(
"hno_NofObjects_RichPoints_Event")
317 fHM->
H1(
"hno_NofObjects_TrdPoints_Event")
320 fHM->
H1(
"hno_NofObjects_MuchPoints_Event")
323 fHM->
H1(
"hno_NofObjects_TofPoints_Event")
327 &&
fHM->
Exists(
"hno_NofObjects_MvdDigis_Event"))
328 fHM->
H1(
"hno_NofObjects_MvdDigis_Event")
331 fHM->
H1(
"hno_NofObjects_MvdClusters_Event")
334 fHM->
H1(
"hno_NofObjects_MvdHits_Event")->Fill(
fMvdHits->GetEntriesFast());
337 &&
fHM->
Exists(
"hno_NofObjects_StsDigis_Event"))
338 fHM->
H1(
"hno_NofObjects_StsDigis_Event")
341 fHM->
H1(
"hno_NofObjects_StsClusters_Event")
344 fHM->
H1(
"hno_NofObjects_StsHits_Event")->Fill(
fStsHits->GetEntriesFast());
347 fHM->
H1(
"hno_NofObjects_RichHits_Event")->Fill(
fRichHits->GetEntriesFast());
350 &&
fHM->
Exists(
"hno_NofObjects_TrdDigis_Event"))
351 fHM->
H1(
"hno_NofObjects_TrdDigis_Event")
354 fHM->
H1(
"hno_NofObjects_TrdClusters_Event")
357 fHM->
H1(
"hno_NofObjects_TrdHits_Event")->Fill(
fTrdHits->GetEntriesFast());
360 &&
fHM->
Exists(
"hno_NofObjects_MuchDigis_Event"))
361 fHM->
H1(
"hno_NofObjects_MuchDigis_Event")
364 fHM->
H1(
"hno_NofObjects_MuchClusters_Event")
367 &&
fHM->
Exists(
"hno_NofObjects_MuchPixelHits_Event"))
368 fHM->
H1(
"hno_NofObjects_MuchPixelHits_Event")
372 fHM->
H1(
"hno_NofObjects_TofHits_Event")->Fill(
fTofHits->GetEntriesFast());
377 const TClonesArray*
hits,
378 const TClonesArray* hitMatches,
379 const string& detName,
381 if (NULL ==
points || NULL ==
hits || NULL == hitMatches)
return;
382 string nameResidualX =
"hrp_" + detName +
"_ResidualX_H2";
383 string nameResidualY =
"hrp_" + detName +
"_ResidualY_H2";
384 string nameResidualT =
"hrp_" + detName +
"_ResidualT_H2";
385 string namePullX =
"hrp_" + detName +
"_PullX_H2";
386 string namePullY =
"hrp_" + detName +
"_PullY_H2";
387 string namePullT =
"hrp_" + detName +
"_PullT_H2";
393 Int_t nofHits =
hits->GetEntriesFast();
394 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
397 if (isnan(
static_cast<Float_t
>(hit->
GetX()))
398 || (isnan(
static_cast<Float_t
>(hit->
GetY()))))
400 const FairMCPoint* point =
static_cast<const FairMCPoint*
>(
404 if (point == NULL)
continue;
407 Float_t residualX = point->GetX() - hit->
GetX();
408 Float_t residualY = point->GetY() - hit->
GetY();
412 residualT = point->GetTime() - hit->
GetTime();
416 + point->GetTime() - hit->
GetTime();
419 fHM->
H2(nameResidualX)->Fill(stationId, residualX);
420 fHM->
H2(nameResidualY)->Fill(stationId, residualY);
421 fHM->
H2(nameResidualT)->Fill(stationId, residualT);
422 fHM->
H2(namePullX)->Fill(stationId, residualX / hit->
GetDx());
423 fHM->
H2(namePullY)->Fill(stationId, residualY / hit->
GetDy());
431 const TClonesArray*
hits,
432 const TClonesArray* hitMatches,
433 const string& detName,
435 if (NULL ==
points || NULL ==
hits || NULL == hitMatches)
return;
436 string accName =
"hhe_" + detName +
"_All_Acc_Station";
439 Int_t evSize =
points->Size(0, iEvent);
440 for (Int_t iP = 0; iP < evSize; iP++) {
441 const FairMCPoint* point =
442 static_cast<const FairMCPoint*
>(
points->Get(0, iEvent, iP));
446 string recName =
"hhe_" + detName +
"_All_Rec_Station";
447 string cloneName =
"hhe_" + detName +
"_All_Clone_Station";
448 set<pair<Int_t, Int_t>> mcPointSet;
449 Int_t nofHits =
hits->GetEntriesFast();
450 for (Int_t iHit = 0; iHit < nofHits; iHit++) {
455 == mcPointSet.end()) {
495 "hen_EventNo_ClusteringQa",
"hen_EventNo_ClusteringQa", 1, 0, 1.);
499 const string& detName) {
504 Int_t nofBins = 100000;
505 Double_t minX = -0.5;
506 Double_t maxX = 99999.5;
507 string name =
"hno_NofObjects_" + detName;
509 name +
"Points_Event;Points per event;Counter",
514 name +
"Digis_Event;Digis per event;Counter",
519 name +
"Clusters_Event;Clusters per event;Counter",
525 name +
"PixelHits_Event;Hits per event;Counter",
531 name +
"Hits_Event;Hits per event;Counter",
539 const string& detName,
540 const string& parameter,
541 const string& xTitle) {
547 Double_t minX = -0.5;
548 Double_t maxX = 99.5;
549 string name =
"hno_NofObjects_" + detName;
550 fHM->
Create1<TH1F>(name +
"Points_" + parameter,
551 name +
"Points_" + parameter +
";" + xTitle
552 +
";Points per event",
556 fHM->
Create1<TH1F>(name +
"Digis_" + parameter,
557 name +
"Digis_" + parameter +
";" + xTitle
558 +
";Digis per event",
562 fHM->
Create1<TH1F>(name +
"Clusters_" + parameter,
563 name +
"Clusters_" + parameter +
";" + xTitle
564 +
";Clusters per event",
568 fHM->
Create1<TH1F>(name +
"Hits_" + parameter,
569 name +
"Hits_" + parameter +
";" + xTitle
578 const string& detName) {
583 Int_t nofBinsStation = 100;
584 Double_t minStation = -0.5;
585 Double_t maxStation = 99.5;
589 Int_t nofBinsSigma = 100;
590 Double_t minSigma = -0.5;
591 Double_t maxSigma = 9.5;
592 Int_t nofBinsResidual = 200;
593 Double_t minResidual = -10.0;
594 Double_t maxResidual = 10.0;
595 Double_t minResidualT = -100.0;
596 Double_t maxResidualT = 100.0;
597 Int_t nofBinsPull = 100;
598 Double_t minPull = -5.0;
599 Double_t maxPull = 5.0;
601 string nameH1 =
"hpa_" + detName +
"Cluster_NofDigisInCluster_H1";
603 nameH1, nameH1 +
";Number of digis;Yield", nofBins,
min,
max);
604 string nameH2 =
"hpa_" + detName +
"Cluster_NofDigisInCluster_H2";
606 nameH2 +
";Station;Number of digis;Yield",
613 nameH1 =
"hpa_" + detName +
"Cluster_NofPointsInCluster_H1";
615 nameH1, nameH1 +
";Number of points;Yield", nofBins,
min,
max);
616 nameH2 =
"hpa_" + detName +
"Cluster_NofPointsInCluster_H2";
618 nameH2 +
";Station;Number of points;Yield",
625 nameH1 =
"hpa_" + detName +
"Digi_NofPointsInDigi_H1";
627 nameH1, nameH1 +
";Number of points;Yield", nofBins,
min,
max);
628 nameH2 =
"hpa_" + detName +
"Digi_NofPointsInDigi_H2";
630 nameH2 +
";Station;Number of points;Yield",
637 nameH1 =
"hpa_" + detName +
"Hit_NofPointsInHit_H1";
639 nameH1, nameH1 +
";Number of points;Yield", nofBins,
min,
max);
640 nameH2 =
"hpa_" + detName +
"Hit_NofPointsInHit_H2";
642 nameH2 +
";Station;Number of points;Yield",
649 nameH1 =
"hpa_" + detName +
"Hit_SigmaX_H1";
651 nameH1 +
";#sigma_{X} [cm];Yield",
655 nameH2 =
"hpa_" + detName +
"Hit_SigmaX_H2";
657 nameH2 +
";Station;#sigma_{X} [cm];Yield",
664 nameH1 =
"hpa_" + detName +
"Hit_SigmaY_H1";
666 nameH1 +
";#sigma_{Y} [cm];Yield",
670 nameH2 =
"hpa_" + detName +
"Hit_SigmaY_H2";
672 nameH2 +
";Station;#sigma_{Y} [cm];Yield",
681 nameH2 =
"hrp_" + detName +
"_ResidualX_H2";
683 nameH2 +
";Station;Residual X [cm];Yield",
690 nameH2 =
"hrp_" + detName +
"_ResidualY_H2";
692 nameH2 +
";Station;Residual Y [cm];Yield",
699 nameH2 =
"hrp_" + detName +
"_ResidualT_H2";
701 nameH2 +
";Station;Residual T [ns];Yield",
708 nameH2 =
"hrp_" + detName +
"_PullX_H2";
710 nameH2 +
";Station;Pull X;Yield",
717 nameH2 =
"hrp_" + detName +
"_PullY_H2";
719 nameH2 +
";Station;Pull Y;Yield",
726 nameH2 =
"hrp_" + detName +
"_PullT_H2";
728 nameH2 +
";Station;Pull T;Yield",
738 const string& detName,
739 const string& parameter,
740 const string& xTitle,
745 vector<string> types = list_of(
"Acc")(
"Rec")(
"Eff")(
"Clone")(
"CloneProb");
746 vector<string> cat = list_of(
"All");
747 for (Int_t iCat = 0; iCat < cat.size(); iCat++) {
748 for (Int_t iType = 0; iType < types.size(); iType++) {
750 (types[iType] ==
"Eff")
752 : (types[iType] ==
"CloneProb") ?
"Probability [%]" :
"Counter";
753 string histName =
"hhe_" + detName +
"_" + cat[iCat] +
"_" + types[iType]
755 string histTitle = histName +
";" + xTitle +
";" + yTitle;
758 new TH1F(histName.c_str(), histTitle.c_str(), nofBins, minBin, maxBin));
const CbmLink & GetMatchedLink() const
Bool_t Exists(const std::string &name) const
Check existence of histogram in manager.
CbmMCDataObject * GetObject(const char *name)
TClonesArray * fTrdClusters
CbmTrdPoint.
TClonesArray * fMuchPixelHits
CbmMuchCluster.
void ProcessDigis(const string &detName)
void WriteToFile()
Write all histograms to current opened file.
Helper class to convert unique channel ID back and forth.
Int_t GetNofLinks() const
CbmLitClusteringQa()
Constructor.
void CreateNofObjectsHistograms(ECbmModuleId detId, const string &detName)
Int_t Size(Int_t fileNumber, Int_t eventNumber)
TClonesArray * fTrdHitMatches
CbmMatch (cluster)
TClonesArray * fStsHits
CbmStsCluster.
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
Simulation report for clustering QA.
void CreateClusterParametersHistograms(ECbmModuleId detId, const string &detName)
TClonesArray * fTrdClusterMatches
CbmTrdHit.
virtual ~CbmLitClusteringQa()
Destructor.
void ProcessPoints(Int_t iEvent, CbmMCDataArray *points, const string &detName, ECbmModuleId detId)
CbmMCDataArray * InitBranch(const char *name)
TClonesArray * fMuchClusters
CbmMuchPoint.
static CbmStsSetup * Instance()
Int_t GetStationId(Int_t address, ECbmModuleId detId)
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
@ kMvd
Micro-Vertex Detector.
void ReadDataBranches()
Read data branches.
static UInt_t GetLayerId(UInt_t address)
Return layer ID from address.
Access to a MC data branch for time-based analysis.
static Int_t GetNofDigis(ECbmModuleId systemId)
void Init(TObjArray *stations, Int_t flag)
CbmMCEventList * fEventList
@ kTof
Time-of-flight Detector.
void FillEventCounterHistograms(Int_t iEvent)
static Bool_t IsPresent(ECbmModuleId systemId)
Presence of a digi branch.
Double_t GetTimeError() const
TClonesArray * fMvdClusters
CbmMvdPoint.
Int_t GetNofDigis() const
Number of digis in cluster.
static Bool_t IsMatchPresent(ECbmModuleId systemId)
Presence of a digi match branch.
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Data container for MUCH clusters.
FairTask for clustering performance calculation.
TClonesArray * fStsHitMatches
CbmMatch (cluster)
TClonesArray * fTrdHits
CbmTrdCluster.
CbmMCDataArray * fStsPoints
CbmMvdHit.
TClonesArray * fStsClusters
CbmStsPoint.
TClonesArray * fMvdHits
CbmMvdCluster.
ClassImp(CbmLitClusteringQa)
const Digi * Get(Int_t index) const
Get a digi object.
CbmMCDataArray * fTrdPoints
CbmMatch (hit)
Int_t GetStationNumber(Int_t address)
static CbmMuchGeoScheme * Instance()
virtual InitStatus Init()
Derived from FairTask.
Double_t GetEventTime(UInt_t event, UInt_t file)
Event start time.
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.
void Create(CbmHistManager *histManager, const std::string &outputDir)
Main function which creates report data.
const CbmMatch * GetMatch(ECbmModuleId systemId, UInt_t index) const
Get a match object.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
@ kRich
Ring-Imaging Cherenkov Detector.
Container class for MC events with number, file and start time.
void InitMuchGeoScheme(const string &digiFileName)
CbmMCDataArray * fMvdPoints
CbmMCTrack.
Bool_t Init(const char *geometryFile=nullptr)
Initialise the setup.
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
Class representing the top level of the STS setup.
void ProcessHits(const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
void CreateHitEfficiencyHistograms(ECbmModuleId detId, const string &detName, const string ¶meter, const string &xTitle, Int_t nofBins, Double_t minBin, Double_t maxBin)
Task class creating and managing CbmMCDataArray objects.
@ kTrd
Transition Radiation Detector.
Bookkeeping of time-slice content.
Base class for cluster objects.
Simulation report for clustering QA.
CbmTimeSlice * fTimeSlice
Class for pixel hits in MUCH detector.
TClonesArray * fMuchClusterMatches
CbmMuchPixelHit.
static vector< vector< QAHit > > hits
Base class for simulation reports.
@ kMuch
Muon detection system.
TClonesArray * fRichHits
CbmRichPoint.
Base class for cluster objects.
virtual void Exec(Option_t *opt)
Derived from FairTask.
TClonesArray * fStsClusterMatches
CbmStsHit array.
CbmMCDataArray * fMuchPoints
CbmRichHit.
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
TClonesArray * fMuchPixelHitMatches
CbmMatch array.
void FillResidualAndPullHistograms(CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
@ kSts
Silicon Tracking System.
CbmMCDataArray * fRichPoints
CbmMatch (hit)
TClonesArray * fTofHits
CbmTofPoint.
virtual void Finish()
Derived from FairTask.
void ProcessClusters(const TClonesArray *clusters, const TClonesArray *clusterMatches, const string &detName, ECbmModuleId detId)
CbmMCDataArray * fMCTracks
Interface to digi data.
void FillHitEfficiencyHistograms(Int_t iEvent, CbmMCDataArray *points, const TClonesArray *hits, const TClonesArray *hitMatches, const string &detName, ECbmModuleId detId)
string fMuchDigiFileName
CbmTofHit.
Bool_t IsInit() const
Initialisation status for sensor parameters.
CbmMCDataArray * fTofPoints
CbmMatch (hit)
CbmDigiManager * fDigiMan
void DetermineSetup()
Determines detector presence using TGeoManager.
void Add(const std::string &name, TNamed *object)
Add new named object to manager.