CbmRoot
CbmPointSetArray.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmPointSetArray source file -----
3 // ----- Created 18/07/05 by J. Brandt -----
4 // ----- Following class TEvePointSetArray -----
5 // -------------------------------------------------------------------------
6 #include "CbmPointSetArray.h"
7 
8 #include <FairLogger.h> // for LOG, Logger
9 
10 #include <Rtypes.h> // for ClassImp
11 #include <TColor.h> // for TColor
12 #include <TEvePointSet.h> // for TEvePointSet, TEvePointSetArray
13 #include <TGenericClassInfo.h> // for TGenericClassInfo
14 #include <TString.h> // for Form
15 
18 
19 CbmPointSetArray::CbmPointSetArray(const char* name, const char* title)
20  : TEvePointSetArray(name, title)
21  , fColorMode(1)
22  , fMarkerMode(1)
23  , fTime(nullptr)
24  , fCluSize(nullptr)
25  , fToT(nullptr)
26  , fIndex(nullptr)
27  , fNPoints(0) {}
28 
31 
33  delete[] fTime;
34  fTime = 0;
35  delete[] fToT;
36  fToT = 0;
37  delete[] fCluSize;
38  fCluSize = 0;
39  delete[] fIndex;
40  fIndex = 0;
41 }
42 
45 
46 void CbmPointSetArray::InitValues(Int_t npoints) {
47  fNPoints = npoints;
48  fTime = new Double_t[npoints];
49  fToT = new Double_t[npoints];
50  fCluSize = new Int_t[npoints];
51  fIndex = new Int_t[npoints];
52 }
53 
56 
58  Double_t time,
59  Double_t tot,
60  Int_t cluSize,
61  Int_t index) {
62  fTime[id] = time;
63  fToT[id] = tot;
64  fCluSize[id] = cluSize;
65  fIndex[id] = index;
66 }
67 
70 
72  //parameters needed for color-calculation
73  Double_t binTime =
74  3.5; // ns max. length of one particle passing through detector
75  Double_t binCol =
76  35; // green ->allows for visual distinction of a track-time
77  Double_t eveTime = 50; // 50ns Event Length
78  Double_t binToT =
79  20; // a.u. max. ToT of hit in arbitray units (aka calibrated to mean of 5)
81  1, 0); //rainbow color palette with 50 colors from purple to red
82  Int_t nCol = TColor::GetNumberOfColors();
83 
84  for (Int_t id = 0; id < fNPoints; id++) {
85  switch (fColorMode) {
86  case 1: //according to hit-time
87  // time until 3.5ns (=binTime) gets colors of spectrum from purple (=0) to green (=binCol) -> visual color gradient
88  if (fTime[id] < binTime) {
89  this->GetBin(fIndex[id])
90  ->SetMainColor(
91  TColor::GetColorPalette(fTime[id] * binCol / binTime));
92  }
93  // time until end of event (=eveTime) gets color-spectrum from green to red (=49)
94  else {
95  this->GetBin(fIndex[id])
96  ->SetMainColor(TColor::GetColorPalette(binCol
97  + (fTime[id] - binTime)
98  * (nCol - binCol - 1)
99  / (eveTime - binTime)));
100  }
101  break;
102  case 2: //according to Tot of hit
103  // color calculated to represent ToT. high ToT -> yellow and red . low ToT -> purple and blue. max.ToT = binToT
104  this->GetBin(fIndex[id])
105  ->SetMainColor(
106  TColor::GetColorPalette(fToT[id] * (nCol - 1) / binToT));
107  break;
108  case 3: //according to index of bin
109  this->GetBin(fIndex[id])
110  ->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])
117  ->SetMainColor(TColor::GetColorPalette(fIndex[id] - 1));
118  return;
119  }
120  }
121 }
122 
125 
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])
131  ->SetMarkerSize(1.25 + (fCluSize[id] - 1) * 0.5);
132  break;
133  case 2: //according to CluSize with real dimesion on detector
134  this->GetBin(fIndex[id])->SetMarkerSize(4 * fCluSize[id]);
135  break;
136  case 3: //const. for all bins
137  this->GetBin(fIndex[id])->SetMarkerSize(1.5);
138  break;
139  default: this->GetBin(fIndex[id])->SetMarkerSize(1.5); return;
140  }
141  }
142 }
143 
146 
148  for (Int_t id = 0; id < fNPoints; id++) {
149  this->GetBin(fIndex[id])
150  ->SetTitle(Form(
151  "PointId = %d\nTime = %2.2fns\nClusterSize = %d\nToT = %2.2f[a.u.]",
152  id,
153  fTime[id],
154  fCluSize[id],
155  fToT[id]));
156  this->GetBin(fIndex[id])->ComputeBBox();
157  }
158 }
159 
CbmPointSetArray::fTime
Double_t * fTime
Definition: CbmPointSetArray.h:54
CbmPointSetArray::ApplyColorMode
void ApplyColorMode()
Apply ColorMode to bins.
Definition: CbmPointSetArray.cxx:71
CbmPointSetArray::fMarkerMode
Int_t fMarkerMode
Definition: CbmPointSetArray.h:53
CbmPointSetArray::fIndex
Int_t * fIndex
Definition: CbmPointSetArray.h:58
CbmPointSetArray
Definition: CbmPointSetArray.h:23
CbmPointSetArray::ApplyMarkerMode
void ApplyMarkerMode()
Apply MarkerMode to bins.
Definition: CbmPointSetArray.cxx:126
CbmPointSetArray::CbmPointSetArray
CbmPointSetArray(const CbmPointSetArray &)
PairAnalysisStyler::SetPalette
void SetPalette(Epalette colors=kDefault, Bool_t reverse=kFALSE)
Definition: PairAnalysisStyler.cxx:568
CbmPointSetArray::FillValues
void FillValues(Int_t id, Double_t time, Double_t tot, Int_t cluSize, Int_t index)
FillQuantities.
Definition: CbmPointSetArray.cxx:57
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmPointSetArray.h
CbmPointSetArray::fNPoints
Int_t fNPoints
Definition: CbmPointSetArray.h:59
CbmPointSetArray::fCluSize
Int_t * fCluSize
Definition: CbmPointSetArray.h:55
CbmPointSetArray::ApplyTitles
void ApplyTitles()
Apply BBox-Titles to all bins.
Definition: CbmPointSetArray.cxx:147
CbmPointSetArray::InitValues
void InitValues(Int_t npoints)
Init Arrays for physical Quantities.
Definition: CbmPointSetArray.cxx:46
CbmPointSetArray::fColorMode
Int_t fColorMode
Definition: CbmPointSetArray.h:52
CbmPointSetArray::fToT
Double_t * fToT
Definition: CbmPointSetArray.h:56
CbmPointSetArray::~CbmPointSetArray
virtual ~CbmPointSetArray()
Destructor.
Definition: CbmPointSetArray.cxx:32