44 #include "TGLWidget.h"
46 #include "TEveManager.h"
47 #include "TEveEventManager.h"
48 #include "TEveTrackPropagator.h"
49 #include "TEveBrowser.h"
50 #include "TGeoManager.h"
54 class ModuleCallingContext;
58 class CmsEveMagField :
public TEveMagField {
64 CmsEveMagField() : TEveMagField(), fField(-3.8), fFieldMag(3.8) {}
65 ~CmsEveMagField()
override {}
68 void SetFieldByCurrent(Float_t avg_current) {
69 fField = -3.8 * avg_current / 18160.0;
70 fFieldMag = TMath::Abs(fField);
74 Float_t GetMaxFieldMag()
const override {
return fFieldMag; }
76 TEveVector GetField(Float_t
x, Float_t
y, Float_t
z)
const override {
77 static const Float_t barrelFac = 1.2 / 3.8;
78 static const Float_t endcapFac = 2.0 / 3.8;
80 const Float_t
R =
sqrt(x * x + y * y);
81 const Float_t absZ = TMath::Abs(z);
87 return TEveVector(0, 0, fField);
90 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)) {
91 return TEveVector(0, 0, -fField * barrelFac);
94 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)) {
95 const Float_t fac = (z >= 0 ? fField : -fField) * endcapFac / R;
96 return TEveVector(x * fac, y * fac, 0);
99 return TEveVector(0, 0, 0);
120 m_context(new fireworks::
Context(
121 changeManager(), selectionManager(), eiManager(), colorManager(), m_metadataManager.
get())),
122 m_Rint(m_appHelper->app()),
127 m_geomWatcher(this, &
FWFFLooper::remakeGeometry),
139 const char* releaseBase = std::getenv(
"CMSSW_RELEASE_BASE");
140 const char* workarea = std::getenv(
"CMSSW_BASE");
141 std::string displayConfigRelFilename =
"/src/Fireworks/FWInterface/macros/ffw.fwc";
142 std::string geometryRelFilename =
"/src/Fireworks/FWInterface/data/cmsGeom10.root";
147 if (releaseBase && access((releaseBase + displayConfigFilename).c_str(), R_OK) == 0)
148 displayConfigFilename = releaseBase + displayConfigRelFilename;
149 if (workarea && access((workarea + displayConfigRelFilename).c_str(), R_OK) == 0)
150 displayConfigFilename = workarea + displayConfigRelFilename;
152 if (releaseBase && access((releaseBase + geometryRelFilename).c_str(), R_OK) == 0)
153 geometryFilename = releaseBase + geometryRelFilename;
154 if (workarea && access((workarea + geometryRelFilename).c_str(), R_OK) == 0)
155 geometryFilename = workarea + geometryRelFilename;
159 if (!geometryFilename.empty()) {
165 if (!geometryFilename.empty()) {
203 f = std::bind(&TApplication::Terminate,
m_Rint, 0);
209 gSystem->ProcessEvents();
214 printf(
"FWFFLooper::postEndJob\n");
215 TEveManager::Terminate();
231 if (!
guiManager()->playEventsAction()->isEnabled())
244 if (!reachedEnd ||
loop()) {
306 float current = 18160.0f;
310 bool res = iRun.
getByLabel(
"conditionsInEdm", runCond);
311 if (res && runCond.
isValid()) {
312 printf(
"Got current from conds in edm %f\n", runCond->BAvgCurrent);
313 current = runCond->BAvgCurrent;
315 printf(
"Could not extract run-conditions get-result=%d, is-valid=%d\n", res, runCond.
isValid());
317 auto rec = iSetup.
find(edm::eventsetup::EventSetupRecordKey::makeKey<RunInfoRcd>());
328 static_cast<CmsEveMagField*
>(
m_MagField)->SetFieldByCurrent(current);
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
void startAutoLoadTimer()
TEveMagField * getMagField()
std::optional< eventsetup::EventSetupRecordGeneric > find(const eventsetup::EventSetupRecordKey &iKey) const
edm::EDLooperBase::Status endOfLoop(const edm::EventSetup &, unsigned int) override
bool getByLabel(std::string const &label, Handle< PROD > &result) const
T getUntrackedParameter(std::string const &, T const &) const
void setupFieldForPropagator(TEveTrackPropagator *prop)
const edm::ESGetToken< RunInfo, RunInfoRcd > m_runInfoToken
FWGUIManager * guiManager()
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void initMap(const FWRecoGeom::InfoMap &map)
void watchPreModuleEvent(PreModuleEvent::slot_type const &iSlot)
void startDoingTasks() override
FWEventItemsManager * eiManager()
ModuleChanges m_scheduledChanges
std::function< void()> TaskFunctor
void autoLoadNewEvent() override
void startingNewLoop(unsigned int) override
FWPathsPopup * m_pathsGUI
void watchPostModuleEvent(PostModuleEvent::slot_type const &iSlot)
TEveMagField * m_MagField
void attachTo(edm::ActivityRegistry &) override
Override this method if you need to monitor the state of the processing.
void setup(FWNavigatorBase *navigator, fireworks::Context *context, FWJobMetadataManager *metadataManager)
void remakeGeometry(const DisplayGeomRecord &dgRec)
void updateStatus(const char *status)
void setContext(fireworks::Context *)
FWFFLooper(const edm::ParameterSet &)
void enableNavigatorControls()
void loadDefaultGeometryFile(void)
void enableActions(bool enable=true)
void requestChanges(const std::string &, const edm::ParameterSet &)
bool getData(T &iHolder) const
edm::EDLooperBase::Status duringLoop(const edm::Event &, const edm::EventSetup &, edm::ProcessingController &) override
void display(const std::string &info="")
void setGeometryFilename(const std::string &filename)
void setTransitionToEvent(edm::EventID const &iID)
void setFFFieldMag(float)
virtual void stopPlaying()
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
FWMagField * getField() const
CmsShowTaskExecutor * startupTasks()
void setTransitionToPreviousEvent()
ForwardState forwardState() const
Returns the present state of processing.
void beginRun(const edm::Run &, const edm::EventSetup &) override
Called after all event modules have processed the begin of a Run.
std::unique_ptr< FWFFMetadataManager > m_metadataManager
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
char const * what() const noexceptoverride
fireworks::Context * context()
void setupConfiguration()
CmsShowMainFrame * getMainFrame() const
bool changeModule(const std::string &iLabel, const ParameterSet &iPSet)
ScheduleInfo const * scheduleInfo() const
This returns a non-zero value after the constructor has been called.
void checkPosition() override
std::unique_ptr< FWFFNavigator > m_navigator
const edm::ESGetToken< TGeoManager, DisplayGeomRecord > m_displayGeomToken
void setFilterButtonText(const char *txt)
bool check(const edm::EventSetup &iSetup)
CSGContinuousAction * playEventsAction()
void stopPlaying() override
void showEventFilterGUI()
void addTask(const TaskFunctor &iTask)
std::unique_ptr< fireworks::Context > m_context
static void setGeoManagerRuntime(TGeoManager *)
void showPathsGUI(const TGWindow *p)
void setTransitionToNextEvent()
ModuleChanger * moduleChanger()
This only returns a non-zero value during the call to endOfLoop.
sigc::signal< void()> filterButtonClicked_
const std::string & geometryFilename(void)
void enableComplexNavigation(bool enable=true)
sigc::signal< void(const TGWindow *)> showEventFilterGUI_
edm::EventID m_nextEventId
const edm::ESGetToken< FWRecoGeometry, FWRecoGeometryRecord > m_recoGeomToken
void setConfigFilename(const std::string &f)
ReverseState reverseState() const