CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
DummyEvelyser Class Reference
Inheritance diagram for DummyEvelyser:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DummyEvelyser (const edm::ParameterSet &)
 
 ~DummyEvelyser () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

edm::EDGetTokenT< reco::TrackCollectiontrackCollectionToken_
 

Protected Member Functions

TEveGeoTopNode * make_node (const TString &path, Int_t vis_level, Bool_t global_cs)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void remakeGeometry (const DisplayGeomRecord &dgRec)
 

Private Attributes

edm::Service< EveServicem_eve
 
TEveElement * m_geomList
 
edm::ESWatcher< DisplayGeomRecordm_geomWatcher
 
TEveTrackList * m_trackList
 
edm::InputTag m_trackTags
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 49 of file DummyEvelyser.cc.

Constructor & Destructor Documentation

DummyEvelyser::DummyEvelyser ( const edm::ParameterSet iConfig)
explicit

Definition at line 94 of file DummyEvelyser.cc.

References m_trackTags, and trackCollectionToken_.

94  :
95  m_eve(),
97  m_geomList(nullptr),
98  m_trackList(nullptr),
100 {
101  trackCollectionToken_ = consumes<reco::TrackCollection >(m_trackTags);
102 }
T getUntrackedParameter(std::string const &, T const &) const
edm::Service< EveService > m_eve
TEveElement * m_geomList
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
edm::InputTag m_trackTags
TEveTrackList * m_trackList
void remakeGeometry(const DisplayGeomRecord &dgRec)
DummyEvelyser::~DummyEvelyser ( )
override

Definition at line 104 of file DummyEvelyser.cc.

105 {}

Member Function Documentation

void DummyEvelyser::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 207 of file DummyEvelyser.cc.

References EveService::AddElement(), edm::ESWatcher< T >::check(), EveService::display(), edm::Event::getByToken(), edm::HandleBase::isValid(), m_eve, m_geomWatcher, m_trackList, fireworks::prepareTrack(), edm::Handle< T >::product(), findElectronsInSiStrips_cfi::trackCollection, and trackCollectionToken_.

208 {
209  printf("DummyEvelyser::analyze\n");
210 
212  iEvent.getByToken(trackCollectionToken_, trackHandle);
213  const reco::TrackCollection trackCollection = *(trackHandle.product());
214  if (!trackHandle.isValid()) {
215  edm::LogError("DummyEvelyser")
216  << "Error! Can't get Track collection "
217  << std::endl;
218  return;
219  }
220 
221  if (m_eve)
222  {
223  // Remake geometry if it has changed.
224  m_geomWatcher.check(iSetup);
225 
226  // Stripped down demo from Tracking twiki.
227 
228  using namespace edm;
229 
230  m_trackList->DestroyElements();
231 
232  // All top-level elements are removed from default event-store at
233  // the end of each event.
235 
236  int cnt = 0;
237 
238  for (auto itTrack = trackCollection.begin();
239  itTrack != trackCollection.end(); ++itTrack, ++cnt)
240  {
241  TEveTrack* trk = fireworks::prepareTrack(*itTrack, m_trackList->GetPropagator());
242  trk->SetElementName (TString::Format("Track %d", cnt));
243  trk->SetElementTitle(TString::Format("Track %d, pt=%.3f", cnt, itTrack->pt()));
244  trk->MakeTrack();
245 
246  trk->SetAttLineAttMarker(m_trackList);
247  m_trackList->AddElement(trk);
248  }
249 
250 
251  // The display() function runs the GUI event-loop and shows
252  // whatever has been registered so far to eve.
253  // It returns when user presses the "Step" button (or "Continue" or
254  // "Next Event").
255  m_eve->display(Form("DummyEvelyser::analyze done for %d tracks\n", m_trackList->NumChildren()) );
256  }
257 }
edm::Service< EveService > m_eve
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:63
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
edm::ESWatcher< DisplayGeomRecord > m_geomWatcher
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
bool isValid() const
Definition: HandleBase.h:74
void display(const std::string &info="")
Definition: EveService.cc:250
T const * product() const
Definition: Handle.h:74
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
HLT enums.
void AddElement(TEveElement *el)
Definition: EveService.cc:288
TEveTrackList * m_trackList
void DummyEvelyser::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file DummyEvelyser.cc.

References m_eve, m_trackList, and EveService::setupFieldForPropagator().

137 {
138  printf("DummyEvelyser::beginJob\n");
139 
140  if (m_eve)
141  {
142  // Make a track-list container we'll hold on until the end of the job.
143  // This allows us to preserve settings done by user via GUI.
144  m_trackList = new TEveTrackList("Tracks");
145  m_trackList->SetMainColor(6);
146  m_trackList->SetMarkerColor(kYellow);
147  m_trackList->SetMarkerStyle(4);
148  m_trackList->SetMarkerSize(0.5);
149 
150  m_trackList->IncDenyDestroy();
151 
152  TEveTrackPropagator *prop = m_trackList->GetPropagator();
153  prop->SetStepper(TEveTrackPropagator::kRungeKutta);
154  // Use simplified magnetic field provided by EveService.
156  }
157 }
edm::Service< EveService > m_eve
void setupFieldForPropagator(TEveTrackPropagator *prop)
Definition: EveService.cc:279
TEveTrackList * m_trackList
void DummyEvelyser::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 172 of file DummyEvelyser.cc.

References EveService::AddGlobalElement(), EveService::getManager(), m_eve, and m_geomList.

173 {
174  printf("DummyEvelyser::beginRun\n");
175 
176  if (m_eve)
177  {
178  m_geomList = new TEveElementList("DummyEvelyzer Geom");
180  m_eve->getManager()->GetGlobalScene()->GetGLScene()->SetStyle(TGLRnrCtx::kWireFrame);
181  }
182 }
edm::Service< EveService > m_eve
TEveElement * m_geomList
TEveManager * getManager()
Definition: EveService.cc:269
void AddGlobalElement(TEveElement *el)
Definition: EveService.cc:293
void DummyEvelyser::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file DummyEvelyser.cc.

References m_trackList.

160 {
161  printf("DummyEvelyser::endJob\n");
162 
163  if (m_trackList)
164  {
165  m_trackList->DecDenyDestroy();
166  m_trackList = nullptr;
167  }
168 }
TEveTrackList * m_trackList
void DummyEvelyser::endRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivate

Definition at line 184 of file DummyEvelyser.cc.

185 {
186  printf("DummyEvelyser::endRun\n");
187 }
TEveGeoTopNode * DummyEvelyser::make_node ( const TString &  path,
Int_t  vis_level,
Bool_t  global_cs 
)
protected

Definition at line 112 of file DummyEvelyser.cc.

References m_geomList.

Referenced by remakeGeometry().

113 {
114  if (! gGeoManager->cd(path))
115  {
116  Warning("make_node", "Path '%s' not found.", path.Data());
117  return nullptr;
118  }
119 
120  TEveGeoTopNode* tn = new TEveGeoTopNode(gGeoManager, gGeoManager->GetCurrentNode());
121  tn->SetVisLevel(vis_level);
122  if (global_cs)
123  {
124  tn->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
125  }
126  m_geomList->AddElement(tn);
127 
128  return tn;
129 }
TEveElement * m_geomList
void DummyEvelyser::remakeGeometry ( const DisplayGeomRecord dgRec)
private

Definition at line 191 of file DummyEvelyser.cc.

References relativeConstraints::geom, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), m_geomList, make_node(), and edm::ESHandle< T >::product().

192 {
193  m_geomList->DestroyElements();
194 
196  dgRec.get(geom);
197  TEveGeoManagerHolder _tgeo(const_cast<TGeoManager*>(geom.product()));
198 
199  // To have a full one, all detectors in one top-node:
200  // make_node("/cms:World_1/cms:CMSE_1", 4, kTRUE);
201 
202  make_node("/cms:World_1/cms:CMSE_1/tracker:Tracker_1", 1, kTRUE);
203  make_node("/cms:World_1/cms:CMSE_1/caloBase:CALO_1", 1, kTRUE);
204  make_node("/cms:World_1/cms:CMSE_1/muonBase:MUON_1", 1, kTRUE);
205 }
TEveElement * m_geomList
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
TEveGeoTopNode * make_node(const TString &path, Int_t vis_level, Bool_t global_cs)
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

edm::Service<EveService> DummyEvelyser::m_eve
private

Definition at line 69 of file DummyEvelyser.cc.

Referenced by analyze(), beginJob(), and beginRun().

TEveElement* DummyEvelyser::m_geomList
private

Definition at line 72 of file DummyEvelyser.cc.

Referenced by beginRun(), make_node(), and remakeGeometry().

edm::ESWatcher<DisplayGeomRecord> DummyEvelyser::m_geomWatcher
private

Definition at line 75 of file DummyEvelyser.cc.

Referenced by analyze().

TEveTrackList* DummyEvelyser::m_trackList
private

Definition at line 73 of file DummyEvelyser.cc.

Referenced by analyze(), beginJob(), and endJob().

edm::InputTag DummyEvelyser::m_trackTags
private

Definition at line 71 of file DummyEvelyser.cc.

Referenced by DummyEvelyser().

edm::EDGetTokenT<reco::TrackCollection > DummyEvelyser::trackCollectionToken_

Definition at line 54 of file DummyEvelyser.cc.

Referenced by analyze(), and DummyEvelyser().