CbmRoot
Loading...
Searching...
No Matches
CbmPointSetArray.cxx
Go to the documentation of this file.
1/* Copyright (C) 2005-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: J. Brandt, Florian Uhlig [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmPointSetArray source file -----
7// ----- Created 18/07/05 by J. Brandt -----
8// ----- Following class TEvePointSetArray -----
9// -------------------------------------------------------------------------
10#include "CbmPointSetArray.h"
11
12#include <Logger.h> // for LOG, Logger
13
14#include <Rtypes.h> // for ClassImp
15#include <TColor.h> // for TColor
16#include <TEvePointSet.h> // for TEvePointSet, TEvePointSetArray
17#include <TGenericClassInfo.h> // for TGenericClassInfo
18#include <TString.h> // for Form
19
22
23CbmPointSetArray::CbmPointSetArray(const char* name, const char* title)
24 : TEvePointSetArray(name, title)
25 , fColorMode(1)
26 , fMarkerMode(1)
27 , fTime(nullptr)
28 , fCluSize(nullptr)
29 , fToT(nullptr)
30 , fIndex(nullptr)
31 , fNPoints(0)
32{
33}
34
37
39{
40 delete[] fTime;
41 fTime = 0;
42 delete[] fToT;
43 fToT = 0;
44 delete[] fCluSize;
45 fCluSize = 0;
46 delete[] fIndex;
47 fIndex = 0;
48}
49
52
54{
55 fNPoints = npoints;
56 fTime = new Double_t[npoints];
57 fToT = new Double_t[npoints];
58 fCluSize = new Int_t[npoints];
59 fIndex = new Int_t[npoints];
60}
61
64
65void CbmPointSetArray::FillValues(Int_t id, Double_t time, Double_t tot, Int_t cluSize, Int_t index)
66{
67 fTime[id] = time;
68 fToT[id] = tot;
69 fCluSize[id] = cluSize;
70 fIndex[id] = index;
71}
72
75
77{
78 //parameters needed for color-calculation
79 Double_t binTime = 12.; // ns max. length of one particle passing through detector
80 Double_t binCol = 35.; // green ->allows for visual distinction of a track-time
81 Double_t eveTime = 50; // 50ns Event Length
82 Double_t binToT = 20; // a.u. max. ToT of hit in arbitray units (aka calibrated to mean of 5)
83 TColor::SetPalette(1, 0); //rainbow color palette with 50 colors from purple to red
84 Int_t nCol = TColor::GetNumberOfColors();
85
86 LOG(info) << "ApplyColorMode " << fColorMode << " with " << nCol << " colors";
87
88 for (Int_t id = 0; id < fNPoints; id++) {
89 switch (fColorMode) {
90 case 1: //according to hit-time
91 // time until 3.5ns (=binTime) gets colors of spectrum from purple (=0) to green (=binCol) -> visual color gradient
92 if (fTime[id] < binTime) {
93 this->GetBin(fIndex[id])->SetMainColor(TColor::GetColorPalette(fTime[id] * binCol / binTime));
94 }
95 // time until end of event (=eveTime) gets color-spectrum from green to red (=49)
96 else {
97 this->GetBin(fIndex[id])
98 ->SetMainColor(
99 TColor::GetColorPalette(binCol + (fTime[id] - binTime) * (nCol - binCol - 1) / (eveTime - binTime)));
100 }
101 LOG(info) << "Color for id " << id << ", ind " << fIndex[id] << ", t " << fTime[id] << ": "
102 << this->GetBin(fIndex[id])->GetMainColor();
103
104 break;
105 case 2: //according to Tot of hit
106 // color calculated to represent ToT. high ToT -> yellow and red . low ToT -> purple and blue. max.ToT = binToT
107 this->GetBin(fIndex[id])->SetMainColor(TColor::GetColorPalette(fToT[id] * (nCol - 1) / binToT));
108 break;
109 case 3: //according to index of bin
110 this->GetBin(fIndex[id])->SetMainColor(TColor::GetColorPalette(fIndex[id] - 1));
111 break;
112 case 4: //all points with color red
113 this->GetBin(fIndex[id])->SetMainColor(TColor::GetColorPalette(49));
114 break;
115 default: //default with index coloring
116 this->GetBin(fIndex[id])->SetMainColor(TColor::GetColorPalette(fIndex[id] - 1));
117 return;
118 }
119 }
120}
121
124
126{
127 for (Int_t id = 0; id < fNPoints; id++) {
128 switch (fMarkerMode) {
129 case 1: //according to cluSize in visually appealing manner
130 this->GetBin(fIndex[id])->SetMarkerSize(1.25 + (fCluSize[id] - 1) * 0.5);
131 break;
132 case 2: //according to CluSize with real dimesion on detector
133 this->GetBin(fIndex[id])->SetMarkerSize(4 * fCluSize[id]);
134 break;
135 case 3: //const. for all bins
136 this->GetBin(fIndex[id])->SetMarkerSize(1.5);
137 break;
138 default: this->GetBin(fIndex[id])->SetMarkerSize(1.5); return;
139 }
140 }
141}
142
145
147{
148 for (Int_t id = 0; id < fNPoints; id++) {
149 this->GetBin(fIndex[id])
150 ->SetTitle(Form("PointId = %d\nTime = %2.2fns\nClusterSize = %d\nToT = %2.2f[a.u.]", id, fTime[id], fCluSize[id],
151 fToT[id]));
152 this->GetBin(fIndex[id])->ComputeBBox();
153 }
154}
155
ClassImp(CbmConverterManager)
void ApplyTitles()
Apply BBox-Titles to all bins.
void FillValues(Int_t id, Double_t time, Double_t tot, Int_t cluSize, Int_t index)
FillQuantities.
void ApplyColorMode()
Apply ColorMode to bins.
void InitValues(Int_t npoints)
Init Arrays for physical Quantities.
CbmPointSetArray(const CbmPointSetArray &)
virtual ~CbmPointSetArray()
Destructor.
void ApplyMarkerMode()
Apply MarkerMode to bins.