14 #include "TEveBrowser.h"
15 #include "TEveScene.h"
16 #include "TEveTrans.h"
25 #include "application/Application.h"
26 #include "application/gui/MainWindow.h"
28 void MainWindow::SetDetectorHits(TString det,
GGSTHitsReader *reader) {
29 static const std::string routineName(
"MainWindow::SetDetectorHits");
31 COUT(DEBUG) <<
"We are in SetDetectorHits for hit " << det <<
ENDL;
38 COUT(DEBUG) << nHits <<
" " << det <<
" hits " <<
ENDL;
42 std::string volName, volPath;
46 for (
int iHit = 0; iHit < nHits; iHit++) {
47 thisHit = reader->
GetHit(det, iHit);
48 if (thisHit->
eDep > eMax)
52 COUT(DEBUG) <<
"_DetectorHitMap has " << _DetectorHitMap.size() <<
" entries" <<
ENDL;
53 auto _dhitIter = _DetectorHitMap.find(det.Data());
54 if (_dhitIter == _DetectorHitMap.end()) {
55 COUT(ERROR) <<
"container for detector " << det <<
" not found!!!" <<
ENDL;
60 auto thisTEveGeoShapeMap = *(_dhit->GetTEveGeoShapeMap());
61 COUT(DEBUG) <<
"map for detector " << det <<
" has " << thisTEveGeoShapeMap.size() <<
" entries" <<
ENDL;
62 COUT(DEBUG) <<
"Threshold set at " << _dhit->GetThreshold() <<
" GeV" <<
ENDL;
64 for (
int iHit = 0; iHit < nHits; iHit++) {
65 thisHit = reader->
GetHit(det, iHit);
66 if (thisHit->
eDep < _dhit->GetThreshold() || thisHit->
eDep == 0)
69 TGeoNode *tempnode = thisApp->GetGeoManager()->FindNode(volPos[0], volPos[1], volPos[2]);
70 volName = tempnode->GetName();
71 volPath = thisApp->GetGeoManager()->GetNodePath(tempnode);
73 COUT(DEBUG) << volPos[0] <<
" " << volPos[1] <<
" " << volPos[2] <<
ENDL;
74 COUT(DEBUG) << volPath <<
" " << thisHit->
eDep <<
" " <<
ENDL;
76 TEveGeoShape *tempshape = thisTEveGeoShapeMap[volPath];
78 switch (_dhit->GetType()) {
80 case DetectorHit::kColorCodedScaleHit: {
81 _dhit->GetPalette()->Rebin(0, eMax);
83 double scale = 0.25 + 0.75 * sqrt(2 * thisHit->
eDep / eMax);
86 tempshape->RefMainTrans().SetScale(scale, scale, scale);
88 double tscale = 0.5 + 0.5 * sqrt(2 * thisHit->
eDep / eMax);
91 tempshape->SetMainTransparency(100 * (1 - tscale) + 1);
93 tempshape->SetMainColor(_dhit->GetPalette()->GetValueColor2(thisHit->
eDep));
98 case DetectorHit::kColorCodedHit: {
99 _dhit->GetPalette()->Rebin(0, eMax);
101 double tscale = 0.5 + 0.5 * sqrt(2 * thisHit->
eDep / eMax);
104 tempshape->SetMainTransparency(100 * (1 - tscale) + 1);
106 tempshape->RefMainTrans().SetScale(1, 1, 1);
108 tempshape->SetMainColor(_dhit->GetPalette()->GetValueColor2(thisHit->
eDep));
113 case DetectorHit::kOpacityHit: {
114 tempshape->SetMainColor(_dhit->GetColor());
115 tempshape->SetMainTransparency(85 * (1 - thisHit->
eDep / eMax));
116 tempshape->RefMainTrans().SetScale(1, 1, 1);
121 case DetectorHit::kClusterHit: {
122 tempshape->SetMainColor(_dhit->GetColor());
127 tempshape->SetMainColor(_dhit->GetColor());
128 tempshape->SetMainTransparency(0);
129 tempshape->RefMainTrans().SetScale(1, 1, 1);
134 tempshape->IncDenyDestroy();
135 _dhit->GetTEveElementList()->AddElement(tempshape);
Class for reading output of GGSHitsAction.
GGSTIntHitBase * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
const Float_t * GetVolumePosition()
Retrieves the position of the volume associated to the hit.
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
Float_t eDep
Deposited energy (transient).
Int_t GetNHits(const char *detector)
Gets the number of hits for the specified detector.
Base class for storing G4 integrated hits.