2 #include "boost/bind.hpp"
33 #include "TEveManager.h"
34 #include "TEveEventManager.h"
35 #include "TEveTrackPropagator.h"
36 #include "TGLWidget.h"
38 #include "TEveBrowser.h"
41 class CmsEveMagField :
public TEveMagField {
47 CmsEveMagField() : TEveMagField(), fField(-3.8), fFieldMag(3.8) {}
48 ~CmsEveMagField()
override {}
51 void SetFieldByCurrent(Float_t avg_current) {
52 fField = -3.8 * avg_current / 18160.0;
57 Float_t GetMaxFieldMag()
const override {
return fFieldMag; }
59 TEveVector GetField(Float_t
x, Float_t
y, Float_t
z)
const override {
60 static const Float_t barrelFac = 1.2 / 3.8;
61 static const Float_t endcapFac = 2.0 / 3.8;
70 return TEveVector(0, 0, fField);
73 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)) {
74 return TEveVector(0, 0, -fField * barrelFac);
77 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)) {
78 const Float_t fac = (
z >= 0 ? fField : -fField) * endcapFac /
R;
79 return TEveVector(
x * fac,
y * fac, 0);
82 return TEveVector(0, 0, 0);
104 changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.
get())),
106 m_Rint(m_appHelper.app()),
110 printf(
"FWFFService::FWFFService CTOR\n");
120 const char* releaseBase = std::getenv(
"CMSSW_RELEASE_BASE");
121 const char* workarea = std::getenv(
"CMSSW_BASE");
122 std::string displayConfigRelFilename =
"/src/Fireworks/FWInterface/macros/ffw.fwc";
123 std::string geometryRelFilename =
"/src/Fireworks/FWInterface/data/cmsGeom10.root";
128 if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
129 displayConfigFilename = releaseBase + displayConfigRelFilename;
130 if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
131 displayConfigFilename = workarea + displayConfigRelFilename;
133 if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
135 if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
164 printf(
"FWFFService::~FWFFService DTOR\n");
174 printf(
"FWFFService::postBeginJob\n");
180 f = boost::bind(&TApplication::Terminate,
m_Rint, 0);
186 gSystem->ProcessEvents();
190 printf(
"FWFFService::postEndJob\n");
192 TEveManager::Terminate();
207 if (!
guiManager()->playEventsAction()->isEnabled())
237 float current = 18160.0f;
243 printf(
"Got current from conds in edm %f\n", runCond->
BAvgCurrent);
246 printf(
"Could not extract run-conditions get-result=%d, is-valid=%d\n",
res, runCond.
isValid());
251 current = sum->m_avg_current;
252 printf(
"Got current from RunInfoRcd %f\n", sum->m_avg_current);
255 static_cast<CmsEveMagField*>(
m_MagField)->SetFieldByCurrent(current);
260 printf(
"FWFFService::postProcessEvent: Starting GUI loop.\n");
291 printf(
"FWFFService exiting on user request.\n");