CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
FWFFMetadataManager Class Reference

#include <FWFFMetadataManager.h>

Inheritance diagram for FWFFMetadataManager:
FWJobMetadataManager

Public Member Functions

 FWFFMetadataManager ()
 
bool hasModuleLabel (std::string &moduleLabel) override
 
- Public Member Functions inherited from FWJobMetadataManager
 FWJobMetadataManager ()
 
void initReps (const FWTypeToRepresentations &iTypeAndReps)
 
std::vector< std::string > & processNamesInJob ()
 
void update (FWJobMetadataUpdateRequest *request)
 
std::vector< Data > & usableData ()
 
virtual ~FWJobMetadataManager ()
 

Protected Member Functions

bool doUpdate (FWJobMetadataUpdateRequest *) override
 

Private Attributes

const edm::Eventm_event
 

Additional Inherited Members

- Public Attributes inherited from FWJobMetadataManager
sigc::signal< void > metadataChanged_
 
- Protected Attributes inherited from FWJobMetadataManager
std::vector< Datam_metadata
 
std::vector< std::string > m_processNamesInJob
 
FWTypeToRepresentationsm_typeAndReps
 

Detailed Description

Definition at line 11 of file FWFFMetadataManager.h.

Constructor & Destructor Documentation

◆ FWFFMetadataManager()

FWFFMetadataManager::FWFFMetadataManager ( )

Definition at line 10 of file FWFFMetadataManager.cc.

10 : m_event(nullptr) {}

Member Function Documentation

◆ doUpdate()

bool FWFFMetadataManager::doUpdate ( FWJobMetadataUpdateRequest )
overrideprotectedvirtual

This is the bit that needs to be implemented by a derived class to update the various metadata structures.

Returns
true if any update actually took place.

Implements FWJobMetadataManager.

Definition at line 26 of file FWFFMetadataManager.cc.

26  {
27  // Clean up previous data.
28  usableData().clear();
29 
31  FWFFMetadataUpdateRequest *fullRequest = dynamic_cast<FWFFMetadataUpdateRequest *>(request);
32  if (!fullRequest)
33  return false;
34  const edm::Event &event = fullRequest->event();
35  m_event = &event;
36 
37  typedef std::set<std::string> Purposes;
38  Purposes purposes;
39  std::vector<edm::StableProvenance const *> provenances;
40 
41  event.getAllStableProvenance(provenances);
42 
43  for (size_t pi = 0, pe = provenances.size(); pi != pe; ++pi) {
44  edm::StableProvenance const *provenance = provenances[pi];
45  if (!provenance)
46  continue;
47  Data d;
48  const edm::BranchDescription &desc = provenance->branchDescription();
49 
50  const std::vector<FWRepresentationInfo> &infos = m_typeAndReps->representationsForType(desc.fullClassName());
51 
52  /*
53  //std::cout <<"try to find match "<<itBranch->fullClassName()<<std::endl;
54  //For each view we need to find the non-sub-part builder whose proximity is smallest and
55  // then register only that purpose
56  //NOTE: for now, we will ignore the view and only look for the closest proximity
57  unsigned int minProx = ~(0U);
58  for (size_t ii = 0, ei = infos.size(); ii != ei; ++ii) {
59  if (!infos[ii].representsSubPart() && minProx > infos[ii].proximity()) {
60  minProx = infos[ii].proximity();
61  }
62  }
63  */
64 
65  //the infos list can contain multiple items with the same purpose so we will just find
66  // the unique ones
67  purposes.clear();
68  for (size_t ii = 0, ei = infos.size(); ii != ei; ++ii) {
69  /* if(!infos[ii].representsSubPart() && minProx != infos[ii].proximity()) {
70  continue;
71  } */
72  purposes.insert(infos[ii].purpose());
73  }
74 
75  if (purposes.empty())
76  purposes.insert("Table");
77 
78  for (Purposes::const_iterator itPurpose = purposes.begin(), itEnd = purposes.end(); itPurpose != itEnd;
79  ++itPurpose) {
80  // Determine whether or not the class can be iterated
81  // either by using a TVirtualCollectionProxy (of the class
82  // itself or on one of its members), or by using a
83  // FWItemAccessor plugin.
84  TClass *theClass = TClass::GetClass(desc.fullClassName().c_str());
85 
86  if (!theClass)
87  continue;
88 
89  if (!theClass->GetTypeInfo())
90  continue;
91 
92  // This is pretty much the same thing that happens
94  fwLog(fwlog::kDebug) << theClass->GetName() << " will not be displayed in table." << std::endl;
95  continue;
96  }
97  d.type_ = desc.fullClassName();
98  d.purpose_ = *itPurpose;
99  d.moduleLabel_ = desc.moduleLabel();
100  d.productInstanceLabel_ = desc.productInstanceName();
101  d.processName_ = desc.processName();
102  usableData().push_back(d);
103  fwLog(fwlog::kDebug) << "Add collection will display " << d.type_ << " " << d.moduleLabel_ << " "
104  << d.productInstanceLabel_ << " " << d.processName_ << std::endl;
105  }
106  }
107  return true;
108 }

References cms::cuda::assert(), edm::StableProvenance::branchDescription(), FWItemAccessorFactory::classAccessedAsCollection(), ztail::d, submitPVResolutionJobs::desc, FWFFMetadataUpdateRequest::event(), edmPickEvents::event, fwLog, cuy::ii, submitPVValidationJobs::infos, fwlog::kDebug, m_event, FWJobMetadataManager::m_typeAndReps, pi, hgcalPlots::purpose, FWTypeToRepresentations::representationsForType(), and FWJobMetadataManager::usableData().

◆ hasModuleLabel()

bool FWFFMetadataManager::hasModuleLabel ( std::string &  moduleLabel)
overridevirtual

Implements FWJobMetadataManager.

Definition at line 12 of file FWFFMetadataManager.cc.

12  {
13  if (m_event) {
14  std::vector<edm::StableProvenance const *> provenances;
15  m_event->getAllStableProvenance(provenances);
16 
17  for (size_t pi = 0, pe = provenances.size(); pi != pe; ++pi) {
18  edm::StableProvenance const *provenance = provenances[pi];
19  if (provenance && (provenance->branchDescription().moduleLabel() == iModuleLabel))
20  return true;
21  }
22  }
23  return false;
24 }

References edm::StableProvenance::branchDescription(), edm::Event::getAllStableProvenance(), m_event, edm::BranchDescription::moduleLabel(), and pi.

Member Data Documentation

◆ m_event

const edm::Event* FWFFMetadataManager::m_event
private

Definition at line 20 of file FWFFMetadataManager.h.

Referenced by doUpdate(), and hasModuleLabel().

hgcalPlots.purpose
purpose
Definition: hgcalPlots.py:2679
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
cms::cuda::assert
assert(be >=bs)
FWFFMetadataUpdateRequest::event
const edm::Event & event() const
Definition: FWFFMetadataUpdateRequest.h:10
FWItemAccessorFactory::classAccessedAsCollection
static bool classAccessedAsCollection(const TClass *)
Definition: FWItemAccessorFactory.cc:202
edm::StableProvenance::branchDescription
BranchDescription const & branchDescription() const
Definition: StableProvenance.h:36
edm::StableProvenance
Definition: StableProvenance.h:30
FWTypeToRepresentations::representationsForType
const std::vector< FWRepresentationInfo > & representationsForType(const std::string &iTypeName) const
Definition: FWTypeToRepresentations.cc:81
edmPickEvents.event
event
Definition: edmPickEvents.py:273
FWFFMetadataUpdateRequest
Definition: FWFFMetadataUpdateRequest.h:7
FWJobMetadataManager::m_typeAndReps
FWTypeToRepresentations * m_typeAndReps
Definition: FWJobMetadataManager.h:65
edm::Event::getAllStableProvenance
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:136
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
FWFFMetadataManager::m_event
const edm::Event * m_event
Definition: FWFFMetadataManager.h:20
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
fwlog::kDebug
Definition: fwLog.h:35
FWJobMetadataManager::usableData
std::vector< Data > & usableData()
Definition: FWJobMetadataManager.h:31
edm::BranchDescription
Definition: BranchDescription.h:32
ztail.d
d
Definition: ztail.py:151
pi
const Double_t pi
Definition: trackSplitPlot.h:36
edm::Event
Definition: Event.h:73
cuy.ii
ii
Definition: cuy.py:589
submitPVValidationJobs.infos
dictionary infos
Definition: submitPVValidationJobs.py:221