SND@LHC Software
Loading...
Searching...
No Matches
ecalDrawer.h
Go to the documentation of this file.
1
7#ifndef ECALDRAWER_H
8#define ECALDRAWER_H
9
10#include "FairTask.h"
11
12#include "TString.h"
13
14#include <math.h>
15#include <list>
16
17class TTree;
18class TClonesArray;
19class TASImage;
20class TText;
21
22class ecalStructure;
23class ecalInf;
24class ecalCell;
25class ecalDrawerItem;
26class ecalPoint;
27
28class ecalDrawer: public FairTask
29{
30public:
32 ecalDrawer();
33
35 ecalDrawer(const char *name, const Int_t iVerbose=1);
36
38 virtual ~ecalDrawer();
39
42 inline void SetNamePrefix(const char* prefix) {fNamePrefix=prefix;}
43 inline void SetCellSize(Int_t size) {fCellSize=size;}
44
45 Int_t InitPython(TClonesArray* mctracks, TClonesArray* ecalPoints, ecalStructure* structure, TClonesArray* clusters);
47 virtual InitStatus Init();
48 virtual void Exec(Option_t* option);
49 virtual void Finish();
50private:
51 TString fNamePrefix;
53 TASImage* fC;
54 Int_t fCellSize;
55 Int_t fCX;
56 Int_t fCY;
57
59 Double_t fMaxEnergyDep;
63 TString fEdging;
64 void PutPixel(Int_t x, Int_t y, Float_t r, Float_t g, Float_t b);
65 void PutPixel(Int_t x, Int_t y, const char* color);
67 void DrawMark(Double_t x, Double_t y, const char* color, Int_t type);
69 void DrawCell(ecalCell* cell, Float_t r, Float_t g, Float_t b);
70 void DrawCell(ecalCell* cell, const char* color);
71
72 void DrawLine(Double_t x, Double_t y, const char* color, Int_t track);
73 void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2,const char* color);
75 void DrawEnergy(ecalPoint* p, const char* color);
76 void DrawPDG(ecalPoint* p, const char* color);
77 void DrawEnergy(Float_t x, Float_t y, Float_t p, const char* color);
78 Double_t GetP(ecalPoint* p);
79
81 void DrawChi2(Float_t x, Float_t y, Float_t chi2, const char* color);
82
83 TText* fTxt;
84 void DrawMC();
85// void DrawPhotons();
86// void DrawTracks();
87 void DrawCells();
88
89 std::list<ecalDrawerItem*> fCells;
90 void DrawImage();
91
92 TClonesArray* fMCTracks;
93 TClonesArray* fPoints;
94 TClonesArray* fClusters;
95 TString fInName;
97 Int_t fEventN;
98
99 Double_t fX;
100 Double_t fY;
101 Double_t fZ;
102 Double_t fMCX;
103 Double_t fMCY;
104 Double_t fMCZ;
106
107 Double_t fE;
108 Double_t fMCE;
109 Double_t fPX;
110 Double_t fPY;
111 Double_t fPZ;
112 Double_t fMCPX;
113 Double_t fMCPY;
114 Double_t fMCPZ;
115 Double_t fChi2;
117 Int_t fPdgCode;
119 Double_t fR;
120
123
124 ClassDef(ecalDrawer, 1)
125};
126
129inline void LabToRGB(Float_t L, Float_t a, Float_t b, Float_t& R, Float_t& G, Float_t& B)
130{
131 Float_t vY=(L+0.16)/1.16;
132 Float_t vX=a/5.00+vY;
133 Float_t vZ=vY-b/2.0;
134 if (vY*vY*vY>0.008856) vY=vY*vY*vY; else vY=(vY-16.0/116.0)/7.787;
135 if (vX*vX*vX>0.008856) vX=vX*vX*vX; else vX=(vX-16.0/116.0)/7.787;
136 if (vZ*vZ*vZ>0.008856) vZ=vZ*vZ*vZ; else vZ=(vZ-16.0/116.0)/7.787;
137 vX*=0.95047; vZ*=1.08883;
138 R= vX*3.2406-vY*1.5372-vZ*0.4986;
139 G=-vX*0.9689+vY*1.8758+vZ*0.0415;
140 B= vX*0.0557-vY*0.2040+vZ*1.0570;
141 if (R>0.0031308) R=1.055*powf(R, 1.0/2.4)-0.055; else R*=12.92;
142 if (G>0.0031308) G=1.055*powf(G, 1.0/2.4)-0.055; else G*=12.92;
143 if (B>0.0031308) B=1.055*powf(B, 1.0/2.4)-0.055; else B*=12.92;
144 if (R<0.0) R=0.0;
145 if (G<0.0) G=0.0;
146 if (B<0.0) B=0.0;
147 Float_t Ln=R*0.3+G*0.6+0.1*B;
148 if (Ln>L) { R*=L/Ln; G*=L/Ln; B*=L/Ln; }
149 if (R>1.0) { G/=R; B/=R; R=1.0; }
150 if (G>1.0) { R/=G; B/=G; G=1.0; }
151 if (B>1.0) { R/=B; G/=B; B=1.0; }
152}
153
154inline Float_t Hue_2_RGB(Float_t v1, Float_t v2, Float_t h)
155{
156 Float_t vh=h;
157 if (vh<0) vh+=1;
158 if (vh>1) vh-=1;
159 if (6*vh<1) return v1+(v2-v1)*6*vh;
160 if (2*vh<1) return v2;
161 if (3*vh<2) return (v1+(v2-v1)*(2.0/3.0-vh)*6);
162 return v1;
163}
164
165inline void HSLToRGB(Float_t h, Float_t s, Float_t l, Float_t& R, Float_t& G, Float_t& B)
166{
167 if (s==0)
168 {
169 R=G=B=l;
170 return;
171 }
172 Float_t v2;
173 Float_t v1;
174 if (l<0.5) v2=l*(1+s); else v2=(l+s)-(s*l);
175 v1=2*l-v2;
176 R=Hue_2_RGB(v1, v2, h+(1.0/3));
177 G=Hue_2_RGB(v1, v2, h);
178 B=Hue_2_RGB(v1, v2, h-(1.0/3));
179}
180#endif
181
182
void SetNamePrefix(const char *prefix)
Definition ecalDrawer.h:42
void PutPixel(Int_t x, Int_t y, Float_t r, Float_t g, Float_t b)
Double_t fMCZ
Definition ecalDrawer.h:104
Double_t fMaxEnergyDep
Definition ecalDrawer.h:59
Double_t fMCX
Definition ecalDrawer.h:102
TClonesArray * fMCTracks
Definition ecalDrawer.h:92
Double_t fE
Definition ecalDrawer.h:107
Double_t fX
Definition ecalDrawer.h:99
TClonesArray * fClusters
Definition ecalDrawer.h:94
TString fEdging
Definition ecalDrawer.h:63
Double_t fR
Definition ecalDrawer.h:119
void SetCellSize(Int_t size)
Definition ecalDrawer.h:43
Int_t InitPython(TClonesArray *mctracks, TClonesArray *ecalPoints, ecalStructure *structure, TClonesArray *clusters)
void DrawEnergy(ecalPoint *p, const char *color)
ecalInf * fInf
Definition ecalDrawer.h:62
void DrawMark(Double_t x, Double_t y, const char *color, Int_t type)
TString fNamePrefix
Definition ecalDrawer.h:51
Double_t fChi2
Definition ecalDrawer.h:115
virtual void Finish()
ecalDrawer & operator=(const ecalDrawer &)
Double_t fY
Definition ecalDrawer.h:100
Int_t fCX
Definition ecalDrawer.h:55
Int_t fCellSize
Definition ecalDrawer.h:54
void DrawChi2(Float_t x, Float_t y, Float_t chi2, const char *color)
TText * fTxt
Definition ecalDrawer.h:83
void DrawLine(Double_t x, Double_t y, const char *color, Int_t track)
Double_t fPY
Definition ecalDrawer.h:110
Double_t fPX
Definition ecalDrawer.h:109
virtual void Exec(Option_t *option)
Int_t fEventN
Definition ecalDrawer.h:97
Double_t fMCE
Definition ecalDrawer.h:108
ecalStructure * fStr
Definition ecalDrawer.h:61
virtual ~ecalDrawer()
Double_t fZ
Definition ecalDrawer.h:101
TClonesArray * fPoints
Definition ecalDrawer.h:93
void DrawImage()
Double_t fMCPY
Definition ecalDrawer.h:113
std::list< ecalDrawerItem * > fCells
Definition ecalDrawer.h:89
Int_t fCY
Definition ecalDrawer.h:56
Double_t fMCPX
Definition ecalDrawer.h:112
TString fInName
Definition ecalDrawer.h:95
void DrawMC()
Double_t GetP(ecalPoint *p)
void DrawCells()
void DrawCell(ecalCell *cell, Float_t r, Float_t g, Float_t b)
Int_t fMCMotherTrN
Definition ecalDrawer.h:105
Double_t fMCY
Definition ecalDrawer.h:103
TASImage * fC
Definition ecalDrawer.h:53
Double_t fPZ
Definition ecalDrawer.h:111
Int_t fPdgCode
Definition ecalDrawer.h:117
Double_t fMCPZ
Definition ecalDrawer.h:114
virtual InitStatus Init()
void DrawPDG(ecalPoint *p, const char *color)
ecalDrawer(const ecalDrawer &)
void LabToRGB(Float_t L, Float_t a, Float_t b, Float_t &R, Float_t &G, Float_t &B)
Definition ecalDrawer.h:129
Float_t Hue_2_RGB(Float_t v1, Float_t v2, Float_t h)
Definition ecalDrawer.h:154
void HSLToRGB(Float_t h, Float_t s, Float_t l, Float_t &R, Float_t &G, Float_t &B)
Definition ecalDrawer.h:165