15 #include <FairLogger.h>
27 constexpr
auto cRED =
"\033[1;31m";
30 constexpr
auto cGREEN =
"\033[1;32m";
31 constexpr
auto cBLUE =
"\033[1;34m";
38 throw "AtViewerManager must be initialized before creating tabs!";
50 std::cout <<
" ===== AtEventTabPad::Init =====" << std::endl;
59 std::cout <<
" AtEventTabPad::Init : Initialization complete! "
70 auto fRawEvent = GetFairRootInfo<AtRawEvent>();
71 if (fRawEvent ==
nullptr) {
72 LOG(debug) <<
"fRawEvent is nullptr for tab " <<
fTabId <<
"! Please set the raw event branch.";
77 for (
auto &[pos, toDraw] :
fDrawMap) {
79 auto hist = toDraw.second;
83 auto auxPad = fRawEvent->GetAuxPad(
fAugNames[pos]);
84 if (auxPad !=
nullptr)
85 DrawAdc(hist, *auxPad);
98 void AtTabPad::DrawPad()
101 auto fRawEvent = GetFairRootInfo<AtRawEvent>();
103 if (fRawEvent ==
nullptr) {
104 LOG(debug) <<
"fRawEvent is nullptr for tab " <<
fTabId <<
"! Please set the raw event branch.";
108 auto fPad = fRawEvent->GetPad(
fPadNum->
Get());
110 for (
auto &[pos, toDraw] :
fDrawMap) {
115 auto hist = toDraw.second;
117 if (fPad ==
nullptr) {
123 switch (toDraw.first) {
129 auto auxPad = fRawEvent->GetAuxPad(
fAugNames[pos]);
130 if (auxPad !=
nullptr)
131 DrawAdc(hist, *auxPad);
142 void AtTabPad::DrawAdc(TH1D *hist,
const AtPad &pad)
144 for (
int i = 0; i < 512; i++) {
145 hist->SetBinContent(i + 1, pad.
GetADC()[i]);
153 auto fRawEvent = GetFairRootInfo<AtRawEvent>();
154 if (fRawEvent ==
nullptr) {
155 LOG(error) <<
"fRawEvent is nullptr for tab " <<
fTabId <<
"! Please set the raw event branch.";
159 auto fpnPad = fRawEvent->GetFpn(map->GetNearestFPN(pad.
GetPadNum()));
161 for (
int i = 0; i < 512; i++) {
162 hist->SetBinContent(i + 1, fpnPad->GetRawADC()[i]);
167 void AtTabPad::DrawRawAdc(TH1D *hist,
const AtPad &pad)
169 for (
int i = 0; i < 512; i++) {
170 hist->SetBinContent(i + 1, pad.
GetRawADC()[i]);
181 for (
int i = 0; i < 512; i++) {
182 hist->SetBinContent(i + 1, aug->GetArray()[i]);
187 void AtTabPad::DrawHit(
const AtPad &pad, TF1Vec &vec)
192 auto event = GetFairRootInfo<AtEvent>();
193 for (
auto &hit : event->GetHits()) {
197 LOG(debug) <<
"Drawing hit with charge " << hit->GetCharge();
198 LOG(debug) << hit->GetPosition().Z() <<
" " << hit->GetPositionSigma().Z();
201 vec.push_back(std::move(func));
204 for (
auto &func : vec) {
205 LOG(debug) <<
"Drawing hit function";
209 std::string AtTabPad::GetName(
int pos, PadDrawType type)
220 void AtTabPad::SetDraw(Int_t pos, PadDrawType type)
222 auto name = TString::Format(
"padHist_Tab%i_%i",
fTabId, pos);
223 TH1D *padHist =
new TH1D(name, GetName(pos, type).c_str(), 512, 0, 512);
224 fDrawMap.emplace(pos, std::make_pair(type, padHist));
258 void AtTabPad::UpdateCvsPad()