00001
00002
00003 #include "VisReco/VisMagneticField/interface/VisCMSMagFieldContent.h"
00004 #include "VisReco/VisMagneticField/interface/VisCMSMagFieldTwig.h"
00005 #include "VisFramework/VisFrameworkBase/interface/VisEventProcessorService.h"
00006 #include "Iguana/Studio/interface/IgQtLock.h"
00007 #include "Iguana/Framework/interface/IgRepSet.h"
00008 #include "Iguana/Studio/interface/IgDocumentData.h"
00009 #include "Iguana/Studio/interface/IgQtAppStatusBarService.h"
00010 #include <classlib/utils/Callback.h>
00011
00012
00013
00014
00015
00016
00017
00018
00019 IG_DEFINE_STATE_ELEMENT (VisCMSMagFieldContent, "Data/Reco/CMS Magnetic Field");
00020
00021
00022
00023
00024
00026 VisCMSMagFieldContent::VisCMSMagFieldContent (IgState *state)
00027 : VisContent (state, s_key, MAIN_THREAD,
00028 lat::CreateCallback (this, &VisCMSMagFieldContent::init))
00029 {
00030 }
00031
00034 void
00035 VisCMSMagFieldContent::init (void)
00036 {
00037
00038 IgQtLock ();
00039
00040 IgTwig *rootTwig = IgDocumentData::get (state ())->root ();
00041 IgTwig *topTwig = 0;
00042
00043 topTwig = rootTwig->lookup ("CMS Event and Detector");
00044 if (!topTwig) topTwig = new IgSimpleTwig (rootTwig, "CMS Event and Detector");
00045
00046 IgTwig *annotations = 0;
00047 annotations = topTwig->lookup ("Annotations");
00048
00049 if (! annotations)
00050 annotations = new IgSimpleTwig (topTwig, "Annotations");
00051
00052 VisCMSMagFieldTwig *magFieldTwig = new VisCMSMagFieldTwig (annotations, state ());
00053
00054 if (VisEventProcessorService *procService = VisEventProcessorService::get (state ()))
00055 {
00056 (*procService)->postProcessEventSignal().connect (sigc::mem_fun (magFieldTwig, &VisCMSMagFieldTwig::onNewEvent));
00057 }
00058 else
00059 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00060 {
00061 sbar->setMessage ("ERROR: EventProcessor initialisation failed.");
00062 }
00063
00064 IgRepSet::invalidate (rootTwig, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK);
00065 }