CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( )

Definition at line 10 of file FWFFMetadataManager.cc.

10 : m_event(nullptr) {}
const edm::Event * m_event

Member Function Documentation

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.

References cms::cuda::assert(), edm::StableProvenance::branchDescription(), FWItemAccessorFactory::classAccessedAsCollection(), ztail::d, submitPVResolutionJobs::desc, FWFFMetadataUpdateRequest::event(), edmPickEvents::event, edm::BranchDescription::fullClassName(), fwLog, cuy::ii, submitPVValidationJobs::infos, fwlog::kDebug, m_event, FWJobMetadataManager::m_typeAndReps, edm::BranchDescription::moduleLabel(), FWJobMetadataManager::Data::moduleLabel_, pi, edm::BranchDescription::processName(), FWJobMetadataManager::Data::processName_, FWJobMetadataManager::Data::productInstanceLabel_, edm::BranchDescription::productInstanceName(), hgcalPlots::purpose, FWJobMetadataManager::Data::purpose_, FWTypeToRepresentations::representationsForType(), FWJobMetadataManager::Data::type_, and FWJobMetadataManager::usableData().

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 }
const edm::Event & event() const
static bool classAccessedAsCollection(const TClass *)
const std::vector< FWRepresentationInfo > & representationsForType(const std::string &iTypeName) const
BranchDescription const & branchDescription() const
std::string const & processName() const
int ii
Definition: cuy.py:589
assert(be >=bs)
const Double_t pi
tuple d
Definition: ztail.py:151
std::string const & moduleLabel() const
std::string const & productInstanceName() const
std::vector< Data > & usableData()
std::string const & fullClassName() const
#define fwLog(_level_)
Definition: fwLog.h:45
const edm::Event * m_event
FWTypeToRepresentations * m_typeAndReps
bool FWFFMetadataManager::hasModuleLabel ( std::string &  moduleLabel)
overridevirtual

Implements FWJobMetadataManager.

Definition at line 12 of file FWFFMetadataManager.cc.

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

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 }
BranchDescription const & branchDescription() const
const Double_t pi
std::string const & moduleLabel() const
const edm::Event * m_event
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:136

Member Data Documentation

const edm::Event* FWFFMetadataManager::m_event
private

Definition at line 20 of file FWFFMetadataManager.h.

Referenced by doUpdate(), and hasModuleLabel().