1 #include "TEveBrowser.h"
2 #include "TEveManager.h"
6 #include "application/Application.h"
7 #include "application/event/GGSFileManager.h"
11 static const std::string routineName(
"GGSFileManager::GGSFileManager");
16 GGSFileManager::~GGSFileManager() {}
18 void GGSFileManager::Load(TString fileName) {
20 static const std::string routineName(
"GGSFileManager::Load");
23 gEve->GetDefaultGLViewer()->GetClipSet()->SetClipType(TGLClip::EType(0));
25 COUT(DEBUG) <<
"Opening " << fileName <<
ENDL;
29 COUT(ERROR) <<
"There was an error opening file " << fileName <<
ENDL;
36 _Reader = GetReader<GGSTHitsReader>(hand);
38 for (TString _det : _detList) {
40 COUT(DEBUG) <<
"Adding " << _det <<
" to detlist" <<
ENDL;
43 _MCTruthReader = GetReader<GGSTMCTruthReader>(hand);
47 COUT(DEBUG) <<
"_Reader at " << _Reader <<
ENDL;
48 COUT(DEBUG) <<
"_pTree at " << _pTree <<
ENDL;
55 void GGSFileManager::PrevEvent() {
56 static const std::string routineName(
"GGSFileManager::PrevEvent");
60 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
63 ReadEvent(_currEvent - 1);
67 void GGSFileManager::NextEvent() {
68 static const std::string routineName(
"GGSFileManager::NextEvent");
72 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
75 ReadEvent(_currEvent + 1);
79 void GGSFileManager::ReadEvent(
int iev,
bool force) {
80 static const std::string routineName(
"GGSFileManager::ReadEvent");
82 COUT(DEBUG) <<
"Click! " << iev <<
ENDL;
84 COUT(ERROR) <<
"You must open a file before clicking!" <<
ENDL;
87 if (!force && (iev < 0 || _currEvent == iev))
91 BuildInteractionTree();
97 void GGSFileManager::BuildInteractionTree() {
98 static const std::string routineName(
"GGSFileManager::BuildInteractionTree");
102 COUT(DEBUG) << _pTree->hashMap.size() <<
ENDL;
104 for (TString _det : _detList) {
107 int nHits = _Reader->
GetNHits(_det);
111 bool partHitClassChecked =
false;
112 for (
int iHit = 0; iHit < nHits; iHit++) {
113 thisHit = _Reader->
GetHit(_det, iHit);
114 if (!partHitClassChecked) {
116 COUT(WARNING) <<
"Particle hits for detector " << _det
117 <<
" are not of class GGSTPartHit. Interaction teree for them will not be built." <<
ENDL;
120 partHitClassChecked =
true;
124 for (
int iPHit = 0; iPHit < nPHits; iPHit++) {
126 _pTree->AddHit(thisPHit->
trackID, thisPHit);
bool HasPartHits(const char *detector)
Check if particle hits data is available for the specified detector.
GGSTIntHitBase * GetHit(const char *detector, unsigned int iHit)
Get the specified hit.
Class to manage ROOT output readers.
GGSTPartHitBase * GetPartHit(unsigned int iHit)
Get the specified particle hit.
#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.
Int_t GetNHits(const char *detector)
Gets the number of hits for the specified detector.
GGSTFilesHandler * Open(const std::string &fileName, GGSTFilesHandler *filesHandler=nullptr, bool force=false)
Open ROOT files.
unsigned int GetNFiles()
The number of files handled by this object.
std::string GetPartHitsClassName()
Gets the name of the class of the particle hits.
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.
Int_t GetNPartHits()
Gets the number of particle hits.
Base class for storing G4 integrated hits.
void SetDetector(const char *detector, bool readPartHits=false, bool readPosHits=false)
Enables reading hit informations of the specified detector.