CbmRoot
Loading...
Searching...
No Matches
Histograms.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer] */
4#include "Histograms.h"
5
6#include <TH1.h>
7
8#include <log.hpp>
9#include <unordered_map>
10
11#include "StorableRecoResults.h"
12
13using namespace cbm::explore;
14
16{
17 CreateFolder("/sts", "STS");
18 CreateFolder("/sts/digis", "Digis");
19 CreateHisto(fHStsDigisTime, "/sts/digis", "hStsDigisTime", "Sts Digis Time", 1000, 0, 128000000);
20
21 CreateFolder("/sts/clusters", "Clusters");
22 CreateHisto(fHStsClustersTime, "/sts/clusters", "hStsClustersTime", "Sts Clusters Time", 1000, 0, 128000000);
23
24 CreateFolder("/sts/hits", "Hits");
25 CreateHisto(fHStsHitsX, "/sts/hits", "hStsHitsX", "Sts Hits X", 100, -10, 10);
26 CreateHisto(fHStsHitsY, "/sts/hits", "hStsHitsY", "Sts Hits Y", 100, -10, 10);
27 CreateHisto(fHStsHitsZ, "/sts/hits", "hStsHitsZ", "Sts Hits Z", 100, 0, 50);
28 CreateHisto(fHStsHitsTime, "/sts/hits", "hStsHitsTime", "Sts Hits Time", 1000, 0, 128000000);
29 CreateHisto(fHStsHitsDx, "/sts/hits", "hStsHitsDx", "Sts Hits Dx", 100, 0, 0.1);
30 CreateHisto(fHStsHitsDy, "/sts/hits", "hStsHitsDy", "Sts Hits Dy", 100, 0, 0.1);
31 CreateHisto(fHStsHitsDxy, "/sts/hits", "hStsHitsDxy", "Sts Hits Dxy", 100, 0, 0.1);
32 CreateHisto(fHStsHitsTimeError, "/sts/hits", "hStsHitsTimeError", "Sts Hits Time Error", 100, 0, 0.1);
33 CreateHisto(fHStsHitsDu, "/sts/hits", "hStsHitsDu", "Sts Hits Du", 100, 0, 0.1);
34 CreateHisto(fHStsHitsDv, "/sts/hits", "hStsHitsDv", "Sts Hits Dv", 100, 0, 0.1);
35
36 CreateHisto(fHNHitsFromCluster, "/sts/hits", "hNHitsFromCluster", "Number of hits from cluster", 100, 0, 100);
37}
38
40{
41 auto& stsDigis = fill.data->StsDigis();
42 L_(info) << "Filling histos with " << stsDigis.size() << " STS digis";
43 for (auto& digi : stsDigis) {
44 if (fill.Skip(digi.GetAddress())) continue;
45 fHStsDigisTime->Fill(digi.GetTimeU32());
46 }
47
48 auto& stsClusters = fill.data->StsClusters();
49 for (size_t p = 0; p < stsClusters.NPartitions(); p++) {
50 auto [sensor, address] = stsClusters.Partition(p);
51 if (fill.Skip(address)) continue;
52 L_(info) << "Filling STS sensor " << address << " with " << sensor.size() << " clusters";
53 for (auto& cluster : sensor) {
54 fHStsClustersTime->Fill(cluster.fTime);
55 }
56 }
57
58 auto& stsHits = fill.data->StsHits();
59 for (size_t p = 0; p < stsHits.NPartitions(); p++) {
60 auto [sensor, address] = stsHits.Partition(p);
61 if (fill.Skip(address)) continue;
62 L_(info) << "Filling STS sensor " << address << " with " << sensor.size() << " hits";
63
64 std::unordered_map<int, int> nHitsFromClusterF, nHitsFromClusterB;
65
66 for (auto& hit : sensor) {
67 fHStsHitsX->Fill(hit.X());
68 fHStsHitsY->Fill(hit.Y());
69 fHStsHitsZ->Fill(hit.Z());
70 fHStsHitsTime->Fill(hit.Time());
71 fHStsHitsDx->Fill(hit.Dx());
72 fHStsHitsDy->Fill(hit.Dy());
73 fHStsHitsDxy->Fill(hit.fDxy);
74 fHStsHitsTimeError->Fill(hit.TimeError());
75 fHStsHitsDu->Fill(hit.fDu);
76 fHStsHitsDv->Fill(hit.fDv);
77
78 nHitsFromClusterF[hit.fFrontClusterId]++;
79 nHitsFromClusterB[hit.fBackClusterId]++;
80 }
81
82 for (auto& [clusterId, nHits] : nHitsFromClusterF)
83 fHNHitsFromCluster->Fill(nHits);
84
85 for (auto& [clusterId, nHits] : nHitsFromClusterB)
86 fHNHitsFromCluster->Fill(nHits);
87 }
88}
#define L_(level)
std::vector< CbmStsDigi > & StsDigis()
PartitionedVector< sts::Cluster > & StsClusters()
PartitionedVector< sts::Hit > & StsHits()
void CreateHisto(Histo_t *&histo, const char *folder, const char *name, const char *title, int nbins, double xlow, double xmax)
void CreateFolder(const char *path, const char *name)
void FillHistos(HistoData fill) override
bool Skip(uint32_t address) const
algo::StorableRecoResults * data