CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Protected Member Functions
FWFFMetadataManager Class Reference

#include <FWFFMetadataManager.h>

Inheritance diagram for FWFFMetadataManager:
FWJobMetadataManager

Protected Member Functions

virtual bool doUpdate (FWJobMetadataUpdateRequest *)
 

Additional Inherited Members

- 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 ()
 
- 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 8 of file FWFFMetadataManager.h.

Member Function Documentation

bool FWFFMetadataManager::doUpdate ( FWJobMetadataUpdateRequest )
protectedvirtual

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 12 of file FWFFMetadataManager.cc.

References edm::Provenance::branchDescription(), FWItemAccessorFactory::classAccessedAsCollection(), FWFFMetadataUpdateRequest::event(), edm::BranchDescription::fullClassName(), fwLog, edm::Event::getAllProvenance(), benchmark_cfg::infos, fwlog::kDebug, FWJobMetadataManager::m_typeAndReps, edm::BranchDescription::moduleLabel(), FWJobMetadataManager::Data::moduleLabel_, pi, edm::BranchDescription::present(), edm::BranchDescription::processName(), FWJobMetadataManager::Data::processName_, FWJobMetadataManager::Data::productInstanceLabel_, edm::BranchDescription::productInstanceName(), FWJobMetadataManager::Data::purpose_, FWTypeToRepresentations::representationsForType(), FWJobMetadataManager::Data::type_, and FWJobMetadataManager::usableData().

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