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) {}
const edm::Event * m_event

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.

References cms::cuda::assert(), FWItemAccessorFactory::classAccessedAsCollection(), ztail::d, submitPVResolutionJobs::desc, FWFFMetadataUpdateRequest::event(), edmPickEvents::event, fwLog, cuy::ii, submitPVValidationJobs::infos, fwlog::kDebug, m_event, FWJobMetadataManager::m_typeAndReps, pi, crab_script::provenance, hgcalPlots::purpose, FWTypeToRepresentations::representationsForType(), 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 }
static bool classAccessedAsCollection(const TClass *)
assert(be >=bs)
const Double_t pi
std::vector< Data > & usableData()
d
Definition: ztail.py:151
const std::vector< FWRepresentationInfo > & representationsForType(const std::string &iTypeName) const
ii
Definition: cuy.py:589
#define fwLog(_level_)
Definition: fwLog.h:45
const edm::Event * m_event
FWTypeToRepresentations * m_typeAndReps
const edm::Event & event() const

◆ hasModuleLabel()

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

Implements FWJobMetadataManager.

Definition at line 12 of file FWFFMetadataManager.cc.

References edm::Event::getAllStableProvenance(), m_event, pi, and crab_script::provenance.

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

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().