19 #include "TEveBrowser.h"
20 #include "TEveScene.h"
21 #include "TEveTrans.h"
25 #include "application/gui/MainWindow.h"
26 #include "application/Application.h"
29 void MainWindow::SetDetectorHits(TString det,
GGSTHitsReader* reader){
30 static const std::string routineName(
"MainWindow::SetDetectorHits");
32 COUT(DEBUG) <<
"We are in SetDetectorHits for hit " << det <<
ENDL;
39 COUT(DEBUG) << nHits <<
" " << det <<
" hits " <<
ENDL;
40 if( nHits == 0 )
return;
42 std::string volName, volPath;
46 for (
int iHit = 0; iHit < nHits; iHit++) {
47 thisHit = reader->
GetHit(det, iHit);
48 if( thisHit->
eDep > eMax ) eMax = thisHit->
eDep;
51 COUT(DEBUG) <<
"_DetectorHitMap has " << _DetectorHitMap.size() <<
" entries"<<
ENDL;
52 auto _dhitIter = _DetectorHitMap.find(det.Data());
53 if( _dhitIter == _DetectorHitMap.end() ){
54 COUT(ERROR) <<
"container for detector " << det <<
" not found!!!" <<
ENDL;
59 auto thisTEveGeoShapeMap = *(_dhit->GetTEveGeoShapeMap());
60 COUT(DEBUG) <<
"map for detector " << det <<
" has " << thisTEveGeoShapeMap.size() <<
" entries" <<
ENDL;
61 COUT(DEBUG) <<
"Threshold set at " << _dhit->GetThreshold() <<
" GeV" <<
ENDL;
63 for (
int iHit = 0; iHit < nHits; iHit++) {
64 thisHit = reader->
GetHit(det, iHit);
65 if( thisHit->
eDep < _dhit->GetThreshold() || thisHit->
eDep == 0 )
continue;
67 TGeoNode* tempnode = thisApp->GetGeoManager()->FindNode(volPos[0], volPos[1], volPos[2]);
68 volName = tempnode->GetName();
69 volPath = thisApp->GetGeoManager()->GetNodePath(tempnode);
71 COUT(DEBUG) << volPos[0] <<
" " << volPos[1] <<
" " << volPos[2] <<
ENDL;
72 COUT(DEBUG) << volPath <<
" " << thisHit->
eDep <<
" " <<
ENDL;
74 TEveGeoShape* tempshape = thisTEveGeoShapeMap[volPath];
76 switch( _dhit->GetType() ){
78 case DetectorHit::kColorCodedScaleHit: {
79 _dhit->GetPalette()->Rebin(0, eMax);
81 double scale = 0.25 + 0.75*sqrt(2*thisHit->
eDep/eMax);
82 if( scale > 1 ) scale = 1;
83 tempshape->RefMainTrans().SetScale( scale , scale, scale );
85 double tscale = 0.5 + 0.5*sqrt(2*thisHit->
eDep/eMax);
86 if( tscale > 1 ) tscale = 1;
87 tempshape->SetMainTransparency( 100*(1-tscale) +1);
89 tempshape->SetMainColor( _dhit->GetPalette()->GetValueColor2(thisHit->
eDep) );
94 case DetectorHit::kColorCodedHit: {
95 _dhit->GetPalette()->Rebin(0, eMax);
97 double tscale = 0.5 + 0.5*sqrt(2*thisHit->
eDep/eMax);
98 if( tscale > 1 ) tscale = 1;
99 tempshape->SetMainTransparency( 100*(1-tscale) +1);
101 tempshape->RefMainTrans().SetScale( 1, 1, 1 );
103 tempshape->SetMainColor( _dhit->GetPalette()->GetValueColor2(thisHit->
eDep) );
108 case DetectorHit::kOpacityHit: {
109 tempshape->SetMainColor( _dhit->GetColor() );
110 tempshape->SetMainTransparency( 85*(1-thisHit->
eDep/eMax) );
111 tempshape->RefMainTrans().SetScale( 1, 1, 1 );
116 case DetectorHit::kClusterHit: {
117 tempshape->SetMainColor( _dhit->GetColor() );
122 tempshape->SetMainColor( _dhit->GetColor() );
123 tempshape->SetMainTransparency( 0 );
124 tempshape->RefMainTrans().SetScale( 1, 1, 1 );
129 tempshape->IncDenyDestroy();
130 _dhit->GetTEveElementList()->AddElement(tempshape);
Class for reading output of GGSHitsAction.
const Float_t * GetVolumePosition()
Retrieves the position of the volume associated to the hit.
Float_t eDep
Deposited energy (transient).
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
GGSTIntHit * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
Int_t GetNHits(const char *detector)
Gets the number of hits for the specified detector.
Class to store G4 position hits.