Warning, file /include/root/TEveCalo.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TEveCalo
0013 #define ROOT_TEveCalo
0014
0015 #include "TEveElement.h"
0016 #include "TEveProjectionBases.h"
0017 #include "TEveProjectionManager.h"
0018
0019 #include "TAtt3D.h"
0020 #include "TAttBBox.h"
0021 #include "TEveCaloData.h"
0022 #include <vector>
0023
0024 class TClass;
0025 class TEveRGBAPalette;
0026
0027 class TEveCaloViz : public TEveElement,
0028 public TNamed,
0029 public TAtt3D,
0030 public TAttBBox,
0031 public TEveProjectable
0032 {
0033 friend class TEveCaloVizEditor;
0034
0035 private:
0036 TEveCaloViz(const TEveCaloViz&) = delete;
0037 TEveCaloViz& operator=(const TEveCaloViz&) = delete;
0038
0039 protected:
0040 TEveCaloData* fData;
0041 Bool_t fCellIdCacheOK;
0042
0043 Double_t fEtaMin;
0044 Double_t fEtaMax;
0045
0046 Double_t fPhi;
0047 Double_t fPhiOffset;
0048
0049 Bool_t fAutoRange;
0050
0051 Float_t fBarrelRadius;
0052 Float_t fEndCapPosF;
0053 Float_t fEndCapPosB;
0054
0055 Float_t fPlotEt;
0056
0057 Float_t fMaxTowerH;
0058 Bool_t fScaleAbs;
0059 Float_t fMaxValAbs;
0060
0061 Bool_t fValueIsColor;
0062 TEveRGBAPalette* fPalette;
0063
0064
0065 void AssignCaloVizParameters(TEveCaloViz* cv);
0066
0067 void SetupColorHeight(Float_t value, Int_t slice, Float_t& height) const;
0068
0069 virtual void BuildCellIdCache() = 0;
0070
0071 public:
0072 TEveCaloViz(TEveCaloData* data=nullptr, const char* n="TEveCaloViz", const char* t="");
0073
0074 ~TEveCaloViz() override;
0075
0076 TEveElement* ForwardSelection() override;
0077 TEveElement* ForwardEdit() override;
0078
0079 void Paint(Option_t* option="") override;
0080
0081 TClass* ProjectedClass(const TEveProjection* p) const override;
0082 virtual Float_t GetValToHeight() const;
0083 virtual void CellSelectionChanged() {}
0084
0085 virtual void SetScaleAbs(Bool_t x) { fScaleAbs = x; }
0086
0087 TEveCaloData* GetData() const { return fData; }
0088 void SetData(TEveCaloData* d);
0089 void DataChanged();
0090 Float_t GetMaxVal() const;
0091
0092 Bool_t AssertCellIdCache() const;
0093 void InvalidateCellIdCache() { fCellIdCacheOK=kFALSE; ResetBBox(); };
0094
0095 Float_t GetDataSliceThreshold(Int_t slice) const;
0096 void SetDataSliceThreshold(Int_t slice, Float_t val);
0097 Color_t GetDataSliceColor(Int_t slice) const;
0098 void SetDataSliceColor(Int_t slice, Color_t col);
0099
0100 Float_t GetBarrelRadius() const { return fBarrelRadius; }
0101 void SetBarrelRadius(Float_t r) { fBarrelRadius = r; ResetBBox(); }
0102 Float_t GetEndCapPos () const { return fEndCapPosF; }
0103 Float_t GetForwardEndCapPos () const { return fEndCapPosF; }
0104 Float_t GetBackwardEndCapPos () const { return fEndCapPosB; }
0105 void SetEndCapPos (Float_t z) { fEndCapPosF = z; fEndCapPosB = -z; ResetBBox(); }
0106 void SetForwardEndCapPos (Float_t z) { fEndCapPosF = z; ResetBBox(); }
0107 void SetBackwardEndCapPos(Float_t z) { fEndCapPosB = z; ResetBBox(); }
0108
0109 Bool_t GetPlotEt() const { return fPlotEt; }
0110 void SetPlotEt(Bool_t x);
0111
0112 void SetMaxTowerH(Float_t x) { fMaxTowerH = x; }
0113 Float_t GetMaxTowerH() const { return fMaxTowerH; }
0114 Bool_t GetScaleAbs() const { return fScaleAbs; }
0115 void SetMaxValAbs(Float_t x) { fMaxValAbs = x; }
0116 Float_t GetMaxValAbs() const { return fMaxValAbs; }
0117
0118 Float_t GetTransitionEta() const;
0119 Float_t GetTransitionEtaForward() const;
0120 Float_t GetTransitionEtaBackward() const;
0121 Float_t GetTransitionTheta() const;
0122 Float_t GetTransitionThetaForward() const;
0123 Float_t GetTransitionThetaBackward() const;
0124
0125 TEveRGBAPalette* GetPalette() const { return fPalette; }
0126 void SetPalette(TEveRGBAPalette* p);
0127
0128 TEveRGBAPalette* AssertPalette();
0129 Bool_t GetValueIsColor() const { return fValueIsColor;}
0130 void SetValueIsColor(Bool_t x) { fValueIsColor = x;}
0131
0132 Bool_t GetAutoRange() const { return fAutoRange; }
0133 void SetAutoRange(Bool_t x) { fAutoRange = x; }
0134
0135 void SetEta(Float_t l, Float_t u);
0136 Float_t GetEta() const { return 0.5f*(fEtaMin+fEtaMax); }
0137 Float_t GetEtaMin() const { return fEtaMin; }
0138 Float_t GetEtaMax() const { return fEtaMax; }
0139 Float_t GetEtaRng() const { return fEtaMax-fEtaMin; }
0140
0141 void SetPhi(Float_t phi) { SetPhiWithRng(phi, fPhiOffset); }
0142 void SetPhiRng(Float_t rng) { SetPhiWithRng(fPhi, rng); }
0143 void SetPhiWithRng(Float_t x, Float_t r);
0144 Float_t GetPhi() const { return fPhi; }
0145 Float_t GetPhiMin() const { return fPhi-fPhiOffset; }
0146 Float_t GetPhiMax() const { return fPhi+fPhiOffset; }
0147 Float_t GetPhiRng() const { return 2.0f*fPhiOffset; }
0148
0149 Bool_t CellInEtaPhiRng (TEveCaloData::CellData_t&) const;
0150
0151 ClassDefOverride(TEveCaloViz, 0);
0152 };
0153
0154
0155
0156
0157 class TEveCalo3D : public TEveCaloViz
0158 {
0159 friend class TEveCalo3DGL;
0160 private:
0161 TEveCalo3D(const TEveCalo3D&) = delete;
0162 TEveCalo3D& operator=(const TEveCalo3D&) = delete;
0163
0164 protected:
0165 TEveCaloData::vCellId_t fCellList;
0166
0167 Bool_t fRnrEndCapFrame;
0168 Bool_t fRnrBarrelFrame;
0169
0170 Float_t fFrameWidth;
0171 Color_t fFrameColor;
0172 Char_t fFrameTransparency;
0173
0174 void BuildCellIdCache() override;
0175
0176 public:
0177 TEveCalo3D(TEveCaloData* d=nullptr, const char* n="TEveCalo3D", const char* t="xx");
0178 ~TEveCalo3D() override {}
0179 void ComputeBBox() override;
0180
0181 void SetFrameWidth(Float_t w) { fFrameWidth = w; }
0182 Float_t GetFrameWidth() const { return fFrameWidth; }
0183
0184 void SetRnrFrame(Bool_t e, Bool_t b) { fRnrEndCapFrame = e; fRnrBarrelFrame = b; }
0185 void GetRnrFrame(Bool_t &e, Bool_t &b) const { e = fRnrEndCapFrame; b = fRnrBarrelFrame; }
0186 void SetRnrEndCapFrame(Bool_t r) { fRnrEndCapFrame = r; }
0187 void SetRnrBarrelFrame(Bool_t r) { fRnrBarrelFrame = r; }
0188 Bool_t GetRnrEndCapFrame() const { return fRnrEndCapFrame; }
0189 Bool_t GetRnrBarrelFrame() const { return fRnrBarrelFrame; }
0190
0191 void SetFrameTransparency(Char_t x) { fFrameTransparency = x; }
0192 Char_t GetFrameTransparency() const { return fFrameTransparency; }
0193
0194 ClassDefOverride(TEveCalo3D, 0);
0195 };
0196
0197
0198
0199
0200 class TEveCalo2D : public TEveCaloViz,
0201 public TEveProjected
0202 {
0203 friend class TEveCalo2DGL;
0204
0205 public:
0206 typedef std::vector<TEveCaloData::vCellId_t*> vBinCells_t;
0207 typedef std::vector<TEveCaloData::vCellId_t*>::iterator vBinCells_i;
0208
0209 private:
0210 TEveCalo2D(const TEveCalo2D&) = delete;
0211 TEveCalo2D& operator=(const TEveCalo2D&) = delete;
0212
0213 TEveProjection::EPType_e fOldProjectionType;
0214 void CellSelectionChangedInternal(TEveCaloData::vCellId_t& cells, std::vector<TEveCaloData::vCellId_t*>& cellLists);
0215
0216 protected:
0217 std::vector<TEveCaloData::vCellId_t*> fCellLists;
0218
0219 std::vector<TEveCaloData::vCellId_t*> fCellListsSelected;
0220 std::vector<TEveCaloData::vCellId_t*> fCellListsHighlighted;
0221
0222 Float_t fMaxESumBin;
0223 Float_t fMaxEtSumBin;
0224
0225 void BuildCellIdCache() override;
0226
0227 void SetDepthLocal(Float_t x) override { fDepth = x; }
0228
0229 public:
0230 TEveCalo2D(const char* n="TEveCalo2D", const char* t="");
0231 ~TEveCalo2D() override;
0232
0233 void SetProjection(TEveProjectionManager* proj, TEveProjectable* model) override;
0234 void UpdateProjection() override;
0235 void ComputeBBox() override;
0236
0237 void CellSelectionChanged() override;
0238
0239 void SetScaleAbs(Bool_t) override;
0240
0241 Float_t GetValToHeight() const override;
0242
0243 const TEveCalo2D::vBinCells_t& GetBinLists() const { return fCellLists; }
0244
0245 ClassDefOverride(TEveCalo2D, 0);
0246 };
0247
0248
0249
0250 class TEveCaloLego : public TEveCaloViz
0251 {
0252 friend class TEveCaloLegoGL;
0253 friend class TEveCaloLegoOverlay;
0254
0255 public:
0256 enum EProjection_e { kAuto, k3D, k2D };
0257 enum E2DMode_e { kValColor, kValSize, kValSizeOutline };
0258 enum EBoxMode_e { kNone, kFrontBack, kBack};
0259
0260 private:
0261 TEveCaloLego(const TEveCaloLego&) = delete;
0262 TEveCaloLego& operator=(const TEveCaloLego&) = delete;
0263
0264 protected:
0265 TEveCaloData::vCellId_t fCellList;
0266
0267 Color_t fFontColor;
0268 Color_t fGridColor;
0269 Color_t fPlaneColor;
0270 Char_t fPlaneTransparency;
0271
0272 Int_t fNZSteps;
0273 Float_t fZAxisStep;
0274
0275 Bool_t fAutoRebin;
0276 Int_t fPixelsPerBin;
0277 Bool_t fNormalizeRebin;
0278
0279 EProjection_e fProjection;
0280 E2DMode_e f2DMode;
0281 EBoxMode_e fBoxMode;
0282
0283 Bool_t fDrawHPlane;
0284 Float_t fHPlaneVal;
0285
0286 Bool_t fHasFixedHeightIn2DMode;
0287 Float_t fFixedHeightValIn2DMode;
0288
0289 Int_t fDrawNumberCellPixels;
0290 Int_t fCellPixelFontSize;
0291
0292 void BuildCellIdCache() override;
0293
0294 public:
0295 TEveCaloLego(TEveCaloData* data=nullptr, const char* n="TEveCaloLego", const char* t="");
0296 ~TEveCaloLego() override{}
0297
0298 void ComputeBBox() override;
0299 virtual void SetData(TEveCaloData* d);
0300
0301 Color_t GetFontColor() const { return fFontColor; }
0302 void SetFontColor(Color_t ci) { fFontColor=ci; }
0303
0304 Color_t GetGridColor() const { return fGridColor; }
0305 void SetGridColor(Color_t ci) { fGridColor=ci; }
0306
0307 Color_t GetPlaneColor() const { return fPlaneColor; }
0308 void SetPlaneColor(Color_t ci) { fPlaneColor=ci; }
0309
0310 Char_t GetPlaneTransparency() const { return fPlaneTransparency; }
0311 void SetPlaneTransparency(Char_t t) { fPlaneTransparency=t; }
0312
0313 Int_t GetNZSteps() const { return fNZSteps; }
0314 void SetNZSteps(Int_t s) { fNZSteps = s;}
0315
0316 Int_t GetPixelsPerBin() const { return fPixelsPerBin; }
0317 void SetPixelsPerBin(Int_t bw) { fPixelsPerBin = bw; }
0318
0319 Bool_t GetAutoRebin() const { return fAutoRebin; }
0320 void SetAutoRebin(Bool_t s) { fAutoRebin = s;}
0321
0322 Bool_t GetNormalizeRebin() const { return fNormalizeRebin; }
0323 void SetNormalizeRebin(Bool_t s) { fNormalizeRebin = s; fCellIdCacheOK=kFALSE;}
0324
0325 EProjection_e GetProjection() const { return fProjection; }
0326 void SetProjection(EProjection_e p) { fProjection = p; }
0327
0328 void Set2DMode(E2DMode_e p) { f2DMode = p; }
0329 E2DMode_e Get2DMode() { return f2DMode; }
0330
0331 bool GetHasFixedHeightIn2DMode() const { return fHasFixedHeightIn2DMode; }
0332 void SetHasFixedHeightIn2DMode(bool x) { fHasFixedHeightIn2DMode = x; }
0333
0334 float GetFixedHeightValIn2DMode() const { return fFixedHeightValIn2DMode; }
0335 void SetFixedHeightValIn2DMode(float x) { fFixedHeightValIn2DMode = x; }
0336
0337 void SetBoxMode(EBoxMode_e p) { fBoxMode = p; }
0338 EBoxMode_e GetBoxMode() { return fBoxMode; }
0339
0340 Bool_t GetDrawHPlane() const { return fDrawHPlane; }
0341 void SetDrawHPlane(Bool_t s) { fDrawHPlane = s;}
0342
0343 Float_t GetHPlaneVal() const { return fHPlaneVal; }
0344 void SetHPlaneVal(Float_t s) { fHPlaneVal = s;}
0345
0346 Int_t GetDrawNumberCellPixels() { return fDrawNumberCellPixels; }
0347 void SetDrawNumberCellPixels(Int_t x) { fDrawNumberCellPixels = x; }
0348 Int_t GetCellPixelFontSize() { return fCellPixelFontSize; }
0349 void SetCellPixelFontSize(Int_t x) { fCellPixelFontSize = x; }
0350
0351 ClassDefOverride(TEveCaloLego, 0);
0352 };
0353
0354 #endif