42 #include "TEveManager.h"
43 #include "TEveEventManager.h"
44 #include "TEveTrackPropagator.h"
47 #include "TEveBrowser.h"
53 class CmsEveMagField :
public TEveMagField {
59 CmsEveMagField() : TEveMagField(), fField(-3.8), fFieldMag(3.8) {}
60 ~CmsEveMagField()
override {}
63 void SetFieldByCurrent(Float_t avg_current) {
64 fField = -3.8 * avg_current / 18160.0;
69 Float_t GetMaxFieldMag()
const override {
return fFieldMag; }
71 TEveVector GetField(Float_t
x, Float_t
y, Float_t
z)
const override {
72 static const Float_t barrelFac = 1.2 / 3.8;
73 static const Float_t endcapFac = 2.0 / 3.8;
82 return TEveVector(0, 0, fField);
85 if ((
R > 461.0
f &&
R < 490.5
f) || (
R > 534.5
f &&
R < 597.5
f) || (
R > 637.0
f &&
R < 700.0
f)) {
86 return TEveVector(0, 0, -fField * barrelFac);
89 if ((absZ > 724.0
f && absZ < 786.0
f) || (absZ > 850.0
f && absZ < 910.0
f) || (absZ > 975.0
f && absZ < 1003.0
f)) {
90 const Float_t fac = (
z >= 0 ? fField : -fField) * endcapFac /
R;
91 return TEveVector(
x * fac,
y * fac, 0);
94 return TEveVector(0, 0, 0);
112 : m_EveManager(nullptr),
117 m_ContinueButton(nullptr),
118 m_StepButton(nullptr),
119 m_StepLabel(nullptr) {
120 printf(
"EveService::EveService CTOR\n");
122 std::cout <<
" gApplication " << gApplication << std::endl;
123 std::cout <<
" is batch " << gROOT->IsBatch() << std::endl;
124 std::cout <<
" display " << gSystem->Getenv(
"DISPLAY") << std::endl;
126 const char* dummyArgvArray[] = {
"cmsRun"};
127 char** dummyArgv = const_cast<char**>(dummyArgvArray);
130 m_Rint =
new TRint(
"App", &dummyArgc, dummyArgv);
131 assert(TApplication::GetApplications()->GetSize());
133 gROOT->SetBatch(kFALSE);
134 std::cout <<
"calling NeedGraphicsLibs()" << std::endl;
135 TApplication::NeedGraphicsLibs();
139 m_EveManager->AddEvent(
new TEveEventManager(
"Event",
"Event Data"));
156 printf(
"EveService::~EveService DTOR\n");
166 printf(
"EveService::postBeginJob\n");
169 gSystem->ProcessEvents();
173 printf(
"EveService::postEndJob\n");
175 TEveManager::Terminate();
181 float current = 18160.0f;
207 printf(
"RunInfo not available \n");
208 static_cast<CmsEveMagField*>(
m_MagField)->SetFieldByCurrent(current);
214 printf(
"EveService::postProcessEvent: Starting GUI loop.\n");
227 gEve->GetCurrentEvent()->DestroyElements();
270 TGTextButton* MkTxtButton(
271 TGCompositeFrame*
p,
const char* txt, Int_t
width = 0, Int_t lo = 0, Int_t ro = 0, Int_t
to = 0, Int_t bo = 0) {
275 TGTextButton*
b =
new TGTextButton(
p, txt);
278 b->ChangeOptions(
b->GetOptions() | kFixedWidth);
280 p->AddFrame(
b,
new TGLayoutHints(kLHintsNormal, lo, ro,
to, bo));
286 const TString cls(
"EveService");
288 TEveBrowser* browser = gEve->GetBrowser();
289 browser->StartEmbedding(TRootBrowser::kBottom);
291 TGMainFrame* mf =
new TGMainFrame(gClient->GetRoot(), 400, 100, kVerticalFrame);
293 TGHorizontalFrame*
f =
new TGHorizontalFrame(mf);
294 mf->AddFrame(
f,
new TGLayoutHints(kLHintsExpandX, 0, 0, 2, 2));
296 MkTxtButton(
f,
"Exit", 100, 2, 2)->Connect(
"Clicked()", cls,
this,
"slotExit()");
298 MkTxtButton(
f,
"Next Event", 100, 2, 2)->Connect(
"Clicked()", cls,
this,
"slotNextEvent()");
304 m_StepButton->Connect(
"Clicked()", cls,
this,
"slotStep()");
308 mf->AddFrame(
m_StepLabel,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
310 mf->SetCleanup(kDeepCleanup);
315 browser->StopEmbedding(
"EventCtrl");
320 printf(
"EveService exiting on user request.\n");