34 #include "TEveManager.h"
35 #include "TEveEventManager.h"
36 #include "TEveTrackPropagator.h"
37 #include "TGLWidget.h"
39 #include "TEveBrowser.h"
42 class CmsEveMagField :
public TEveMagField {
48 CmsEveMagField() : TEveMagField(), fField(-3.8), fFieldMag(3.8) {}
49 ~CmsEveMagField()
override {}
52 void SetFieldByCurrent(Float_t avg_current) {
53 fField = -3.8 * avg_current / 18160.0;
58 Float_t GetMaxFieldMag()
const override {
return fFieldMag; }
60 TEveVector GetField(Float_t
x, Float_t
y, Float_t
z)
const override {
61 static const Float_t barrelFac = 1.2 / 3.8;
62 static const Float_t endcapFac = 2.0 / 3.8;
71 return TEveVector(0, 0, fField);
74 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)) {
75 return TEveVector(0, 0, -fField * barrelFac);
78 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)) {
79 const Float_t fac = (
z >= 0 ? fField : -fField) * endcapFac /
R;
80 return TEveVector(
x * fac,
y * fac, 0);
83 return TEveVector(0, 0, 0);
105 changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.
get())),
107 m_Rint(m_appHelper.app()),
111 printf(
"FWFFService::FWFFService CTOR\n");
121 const char* releaseBase = std::getenv(
"CMSSW_RELEASE_BASE");
122 const char* workarea = std::getenv(
"CMSSW_BASE");
123 std::string displayConfigRelFilename =
"/src/Fireworks/FWInterface/macros/ffw.fwc";
124 std::string geometryRelFilename =
"/src/Fireworks/FWInterface/data/cmsGeom10.root";
129 if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
130 displayConfigFilename = releaseBase + displayConfigRelFilename;
131 if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
132 displayConfigFilename = workarea + displayConfigRelFilename;
134 if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
136 if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
165 printf(
"FWFFService::~FWFFService DTOR\n");
175 printf(
"FWFFService::postBeginJob\n");
181 f = std::bind(&TApplication::Terminate,
m_Rint, 0);
187 gSystem->ProcessEvents();
191 printf(
"FWFFService::postEndJob\n");
193 TEveManager::Terminate();
208 if (!
guiManager()->playEventsAction()->isEnabled())
238 float current = 18160.0f;
244 printf(
"Got current from conds in edm %f\n", runCond->
BAvgCurrent);
247 printf(
"Could not extract run-conditions get-result=%d, is-valid=%d\n",
res, runCond.
isValid());
252 current = sum->m_avg_current;
253 printf(
"Got current from RunInfoRcd %f\n", sum->m_avg_current);
256 static_cast<CmsEveMagField*>(
m_MagField)->SetFieldByCurrent(current);
261 printf(
"FWFFService::postProcessEvent: Starting GUI loop.\n");
292 printf(
"FWFFService exiting on user request.\n");