3 #include "TEveManager.h"
4 #include "TEveBrowser.h"
7 #include "application/Application.h"
8 #include "application/event/GGSFileManager.h"
12 static const std::string routineName(
"GGSFileManager::GGSFileManager");
18 GGSFileManager::~GGSFileManager(){}
21 void GGSFileManager::Load(TString fileName){
23 static const std::string routineName(
"GGSFileManager::Load");
25 if(gEve) gEve->GetDefaultGLViewer()->GetClipSet()->SetClipType(TGLClip::EType(0));
27 COUT(DEBUG) <<
"Opening " << fileName <<
ENDL;
31 COUT(ERROR) <<
"There was an error opening file " << fileName <<
ENDL;
38 _Reader = GetReader<GGSTHitsReader>(hand);
40 for( TString _det : _detList ){
42 COUT(DEBUG) <<
"Adding " << _det <<
" to detlist" <<
ENDL;
45 _MCTruthReader = GetReader<GGSTMCTruthReader>(hand);
49 COUT(DEBUG) <<
"_Reader at " << _Reader <<
ENDL;
50 COUT(DEBUG) <<
"_pTree at " << _pTree <<
ENDL;
59 void GGSFileManager::PrevEvent(){
60 static const std::string routineName(
"GGSFileManager::PrevEvent");
64 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
67 ReadEvent( _currEvent - 1 );
73 void GGSFileManager::NextEvent(){
74 static const std::string routineName(
"GGSFileManager::NextEvent");
78 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
81 ReadEvent( _currEvent + 1 );
87 void GGSFileManager::ReadEvent(
int iev,
bool force){
88 static const std::string routineName(
"GGSFileManager::ReadEvent");
90 COUT(DEBUG) <<
"Click! " << iev <<
ENDL;
92 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
95 if( !force && (iev < 0 || _currEvent == iev) )
return;
98 BuildInteractionTree();
106 void GGSFileManager::BuildInteractionTree(){
107 static const std::string routineName(
"GGSFileManager::BuildInteractionTree");
111 COUT(DEBUG) << _pTree->hashMap.size() <<
ENDL;
113 for( TString _det : _detList ){
116 int nHits = _Reader->
GetNHits( _det );
120 for (
int iHit = 0; iHit < nHits; iHit++) {
121 thisHit = _Reader->
GetHit( _det, iHit );
123 for(
int iPHit = 0; iPHit < nPHits; iPHit++ ){
125 _pTree->AddHit( thisPHit->
trackID, thisPHit );
bool HasPartHits(const char *detector)
Check if particle hits data is available for the specified detector.
Class to manage ROOT output readers.
#define COUT(level)
Smart log macro. It writes on stdout only if the specified verbosity level is lesser than the maximum...
Float_t time
Time of the hit.
void GetEntry(Long64_t entry)
Reads an event.
Class to store G4 particle hits.
Int_t trackID
GEANT4 track ID.
Class to handle group of Root files.
GGSTIntHit * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
GGSTFilesHandler * Open(const std::string &fileName, GGSTFilesHandler *filesHandler=NULL, bool force=false)
Open ROOT files.
Int_t GetNHits(const char *detector)
Gets the number of hits for the specified detector.
Int_t GetNPartHits()
Gets the number of particle hits.
Class to store G4 position hits.
unsigned int GetNFiles()
The number of files handled by this object.
const std::string & GetFileName(unsigned int iFile)
Fetch the name of a handled file.
std::vector< TString > GetListOfDetectors()
Returns the list of detectors which are present in hits tree on standard output.
GGSTPartHit * GetPartHit(unsigned int iHit)
Get the specified particle hit.
void SetDetector(const char *detector, bool readPartHits=false, bool readPosHits=false)
Enables reading hit informations of the specified detector.