16#include "TClonesArray.h"
20#include "TGeoManager.h"
32#include <boost/assign/list_of.hpp>
39using boost::assign::list_of;
42 : FairTask(
"CbmRichMCbmToTShifter")
49 std::cout <<
"CbmRichMCbmToTShifter::Constructor.." << std::endl;
54 std::cout <<
"CbmRichMCbmToTShifter::Init" << std::endl;
56 FairRootManager* ioman = FairRootManager::Instance();
57 if (
nullptr == ioman) {
58 Fatal(
"CbmRichMCbmToTShifter::Init",
"RootManager not instantised!");
64 Fatal(
"CbmRichMCbmToTShifter::Init",
"No Rich Digis!");
76 for (
int i = 0; i < nofDigis; ++i) {
79 if (
h !=
nullptr)
h->Fill(digi->
GetToT());
87 std::cout <<
"Drawing Hists..." << std::endl;
92 for (
auto const& inner : outer.second) {
93 mean +=
static_cast<Double_t
>(inner.second->GetEntries());
98 if (mean_cnt != 0) mean /= mean_cnt;
100 if (
fShowTdcId) s <<
"TDC 0x" << std::hex << 0xc000 <<
" " << std::dec <<
" !";
102 if (
fShowTdcId) s <<
"TDC 0x" << std::hex << 0xc001 <<
" " << std::dec <<
" !";
107 for (
auto const& outer :
fhTotMap) {
108 int tdc = outer.first;
109 TCanvas* c =
new TCanvas(Form(
"fhToT_%x", outer.first), Form(
"fhToT_%x", outer.first), 2000, 2000);
112 <
static_cast<uint16_t
>(tdc)) {
115 if (std::next(it) !=
fhTotMap.end()) s <<
" \\" << std::endl;
118 if (
fShowTdcId) s <<
"TDC 0x" << std::hex << outer.first <<
" " << std::dec <<
" !";
120 for (
int i = 0; i < 32; ++i) {
125 if (
GetMaxH1(
h) < 20 ||
h->GetEntries() < mean * 0.1) {
138 s <<
" \\" << std::endl;
140 else if (std::next(it) ==
fhTotMap.end()) {
143 if (cnt == 71) s << std::endl;
147 s <<
" \\" << std::endl;
155 for (uint16_t i = cnt; i < 72; ++i) {
156 s <<
" \\" << std::endl;
162 std::cout << s.str() << std::endl;
170 TString name, title, subFolder;
171 name.Form(
"ToT_tdc_0x%x_ch%u", tdc, channel);
172 title.Form(
"%s;ToT [ns];Entries", name.Data());
173 h =
new TH1D(name, title, 500, -1., 49.);
183 for (
Int_t i = 1; i <
h->GetNbinsX(); ++i) {
184 Double_t val =
h->GetBinContent(i);
190 return h->GetBinCenter(b);
197 for (uint16_t i = 0; i < 33; ++i) {
ClassImp(CbmConverterManager)
@ kRich
Ring-Imaging Cherenkov Detector.
Helper functions for drawing 1D and 2D histograms and graphs.
Convert internal data classes to cbmroot common data classes.
friend fscal max(fscal x, fscal y)
Generates beam ions for transport simulation.
static CbmDigiManager * Instance()
Static instance.
int32_t GetAddress() const
TH1 * GetTotH1(Int_t tdc, Int_t channel)
Handler for TH1 Histograms.
std::string printEmpty()
Fill output lines with 0's if DiRICh Address is not in use in input file.
CbmDigiManager * fDigiMan
int getDirichAddress(const int dirich)
Extract the Tdc Address from the encoded DiRICH Address.
int getDirichChannel(const int dirich)
Extract the channel Address from the encoded DiRICH Address.
virtual void Exec(Option_t *option)
Inherited from FairTask.
Double_t GetMaxH1(TH1 *h)
Find the Maximum in a TH1 Histogram.
virtual InitStatus Init()
Inherited from FairTask.
std::map< Int_t, std::map< Int_t, TH1 * > > fhTotMap
uint16_t calcDirichAddr(uint32_t cnt)
virtual void Finish()
Inherited from FairTask.
CbmRichMCbmToTShifter()
Standard constructor.