Vis enabled
This commit is contained in:
parent
4bbb1399cc
commit
5c48fd699f
|
|
@ -8,12 +8,9 @@
|
||||||
#include "TBenchmark.h" // timing measurement
|
#include "TBenchmark.h" // timing measurement
|
||||||
#include "TGraph.h" // for energy loss interpolation
|
#include "TGraph.h" // for energy loss interpolation
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "TApplication.h" // ROOT app loop for TEve
|
#include "TApplication.h" // ROOT app loop
|
||||||
#include "TEveManager.h"
|
|
||||||
#include "TEvePointSet.h"
|
|
||||||
#include "ClassTransfer.h" // Reaction kinematics and MC event generation
|
#include "ClassTransfer.h" // Reaction kinematics and MC event generation
|
||||||
#include "ClassAnasen.h" // ANASEN detector model classes (SX3, PW, etc.)
|
#include "ClassAnasen.h" // ANASEN detector model classes (SX3, PW, etc.)
|
||||||
#include "vis_helpers.h" // Visualization utilities for TEve
|
|
||||||
|
|
||||||
//======== Generate light particle based on reaction
|
//======== Generate light particle based on reaction
|
||||||
// calculate real and reconstructed tracks and Q-value uncertainty
|
// calculate real and reconstructed tracks and Q-value uncertainty
|
||||||
|
|
@ -87,13 +84,6 @@ int main(int argc, char **argv){
|
||||||
TApplication *app = nullptr;
|
TApplication *app = nullptr;
|
||||||
if(enableVis){
|
if(enableVis){
|
||||||
app = new TApplication("anasenVis", &argc, argv);
|
app = new TApplication("anasenVis", &argc, argv);
|
||||||
TEveManager::Create();
|
|
||||||
TEvePointSet* pts = new TEvePointSet("hits");
|
|
||||||
pts->SetMarkerStyle(20);
|
|
||||||
pts->SetMarkerSize(1.4);
|
|
||||||
pts->SetMarkerColor(kRed);
|
|
||||||
gEve->AddElement(pts);
|
|
||||||
SetVisPointSet(pts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create detector representation in memory
|
// create detector representation in memory
|
||||||
|
|
@ -107,14 +97,6 @@ int main(int argc, char **argv){
|
||||||
TFile * saveFile = new TFile(saveFileName, "recreate");
|
TFile * saveFile = new TFile(saveFileName, "recreate");
|
||||||
TTree * tree = new TTree("tree", "tree");
|
TTree * tree = new TTree("tree", "tree");
|
||||||
TTree* tree2 = tree->CloneTree(0); // for 2D histograms or alternative data structure if needed
|
TTree* tree2 = tree->CloneTree(0); // for 2D histograms or alternative data structure if needed
|
||||||
TTree* visTree = nullptr;
|
|
||||||
std::vector<double> visX, visY, visZ;
|
|
||||||
if(enableVis){
|
|
||||||
visTree = new TTree("visTree", "vis points");
|
|
||||||
visTree->Branch("x", &visX);
|
|
||||||
visTree->Branch("y", &visY);
|
|
||||||
visTree->Branch("z", &visZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
// beam and CM variables saved in tree
|
// beam and CM variables saved in tree
|
||||||
double KEA;
|
double KEA;
|
||||||
|
|
@ -275,15 +257,6 @@ int main(int argc, char **argv){
|
||||||
sx3Y = hitPos.Y();
|
sx3Y = hitPos.Y();
|
||||||
sx3Z = hitPos.Z();
|
sx3Z = hitPos.Z();
|
||||||
|
|
||||||
// visualization point list
|
|
||||||
if(enableVis) {
|
|
||||||
visX.clear(); visY.clear(); visZ.clear();
|
|
||||||
visX.push_back(sx3X);
|
|
||||||
visY.push_back(sx3Y);
|
|
||||||
visZ.push_back(sx3Z);
|
|
||||||
PushEventAndRecord(visX, visY, visZ, visTree);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fill tree with original data before energy loss
|
// fill tree with original data before energy loss
|
||||||
tree->Fill();
|
tree->Fill();
|
||||||
|
|
||||||
|
|
@ -360,21 +333,25 @@ int main(int argc, char **argv){
|
||||||
// write results to ROOT file and close
|
// write results to ROOT file and close
|
||||||
tree->Write();
|
tree->Write();
|
||||||
tree2->Write();
|
tree2->Write();
|
||||||
if(visTree) visTree->Write();
|
|
||||||
int count = tree->GetEntries();
|
int count = tree->GetEntries();
|
||||||
int count2 = tree2->GetEntries();
|
int count2 = tree2->GetEntries();
|
||||||
saveFile->Close();
|
saveFile->Close();
|
||||||
|
|
||||||
printf("=============== done. saved as %s. tree entries: %d, tree2 entries: %d\n", saveFileName.Data(), count, count2);
|
printf("=============== done. saved as %s. tree entries: %d, tree2 entries: %d\n", saveFileName.Data(), count, count2);
|
||||||
|
|
||||||
|
if(enableVis){
|
||||||
|
printf("Displaying geometry via ANASEN::DrawAnasen()\n");
|
||||||
|
anasen->DrawAnasen();
|
||||||
|
anasen->DrawDeducedTrack(TVector3(sx3X, sx3Y, sx3Z), anodeID[0], cathodeID[0]);
|
||||||
|
if(app){
|
||||||
|
app->Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete anasen;
|
delete anasen;
|
||||||
delete elossLight;
|
delete elossLight;
|
||||||
delete elossHeavy;
|
delete elossHeavy;
|
||||||
|
|
||||||
if(enableVis && app){
|
|
||||||
printf("Entering TEve GUI event loop (close window to finish)\n");
|
|
||||||
app->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user