CMS 3D CMS Logo

FWFFMetadataManager.cc
Go to the documentation of this file.
8 
9 #include "TClass.h"
11 
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 }
25 
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 }
hgcalPlots.purpose
purpose
Definition: hgcalPlots.py:2670
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
cms::cuda::assert
assert(be >=bs)
FWItemAccessorFactory.h
FWFFMetadataManager.h
FWFFMetadataManager::hasModuleLabel
bool hasModuleLabel(std::string &moduleLabel) override
Definition: FWFFMetadataManager.cc:12
FWFFMetadataUpdateRequest::event
const edm::Event & event() const
Definition: FWFFMetadataUpdateRequest.h:10
FWFFMetadataManager::doUpdate
bool doUpdate(FWJobMetadataUpdateRequest *) override
Definition: FWFFMetadataManager.cc:26
FWItemAccessorFactory::classAccessedAsCollection
static bool classAccessedAsCollection(const TClass *)
Definition: FWItemAccessorFactory.cc:202
FWFFMetadataUpdateRequest.h
edm::StableProvenance::branchDescription
BranchDescription const & branchDescription() const
Definition: StableProvenance.h:36
FWJobMetadataUpdateRequest
Definition: FWJobMetadataUpdateRequest.h:4
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BranchDescription.h
Event.h
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
fwLog.h
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::Data
Definition: FWJobMetadataManager.h:20
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:590
StableProvenance.h
submitPVValidationJobs.infos
dictionary infos
Definition: submitPVValidationJobs.py:221
FWFFMetadataManager::FWFFMetadataManager
FWFFMetadataManager()
Definition: FWFFMetadataManager.cc:10