CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWFFMetadataManager.cc
Go to the documentation of this file.
8 
9 #include "TClass.h"
10 
11 bool
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();
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 }
106 
const edm::Event & event() const
void getAllProvenance(std::vector< Provenance const * > &provenances) const
Definition: Event.cc:86
static bool classAccessedAsCollection(const TClass *)
const std::vector< FWRepresentationInfo > & representationsForType(const std::string &iTypeName) const
virtual bool doUpdate(FWJobMetadataUpdateRequest *)
std::string const & processName() const
int ii
Definition: cuy.py:588
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:44
#define fwLog(_level_)
Definition: fwLog.h:50
FWTypeToRepresentations * m_typeAndReps
double pi