Go to the documentation of this file.00001 #include "Fireworks/FWInterface/src/FWFFMetadataManager.h"
00002 #include "Fireworks/FWInterface/src/FWFFMetadataUpdateRequest.h"
00003 #include "Fireworks/Core/interface/fwLog.h"
00004 #include "DataFormats/Provenance/interface/Provenance.h"
00005 #include "DataFormats/Provenance/interface/BranchDescription.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "Fireworks/Core/interface/FWItemAccessorFactory.h"
00008
00009 #include "TClass.h"
00010
00011 bool
00012 FWFFMetadataManager::doUpdate(FWJobMetadataUpdateRequest* request)
00013 {
00014
00015 usableData().clear();
00016
00017 assert(m_typeAndReps);
00018 FWFFMetadataUpdateRequest *fullRequest = dynamic_cast<FWFFMetadataUpdateRequest*>(request);
00019 if (!fullRequest)
00020 return false;
00021 const edm::Event &event = fullRequest->event();
00022 typedef std::set<std::string> Purposes;
00023 Purposes purposes;
00024 std::vector<edm::Provenance const *> provenances;
00025
00026 event.getAllProvenance(provenances);
00027
00028 for (size_t pi = 0, pe = provenances.size(); pi != pe; ++pi)
00029 {
00030 edm::Provenance const *provenance = provenances[pi];
00031 if (!provenance)
00032 continue;
00033 Data d;
00034 const edm::BranchDescription &desc = provenance->branchDescription();
00035
00036 if (!desc.present())
00037 continue;
00038
00039 const std::vector<FWRepresentationInfo>& infos
00040 = m_typeAndReps->representationsForType(desc.fullClassName());
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 purposes.clear();
00058 for (size_t ii = 0, ei = infos.size(); ii != ei; ++ii) {
00059
00060
00061
00062 purposes.insert(infos[ii].purpose());
00063 }
00064
00065 if (purposes.empty())
00066 purposes.insert("Table");
00067
00068 for (Purposes::const_iterator itPurpose = purposes.begin(),
00069 itEnd = purposes.end();
00070 itPurpose != itEnd;
00071 ++itPurpose)
00072 {
00073
00074
00075
00076
00077 TClass* theClass = TClass::GetClass(desc.fullClassName().c_str());
00078
00079 if (!theClass)
00080 continue;
00081
00082 if (!theClass->GetTypeInfo())
00083 continue;
00084
00085
00086 if (!FWItemAccessorFactory::classAccessedAsCollection(theClass))
00087 {
00088 fwLog(fwlog::kDebug) << theClass->GetName()
00089 << " will not be displayed in table." << std::endl;
00090 continue;
00091 }
00092 d.type_ = desc.fullClassName();
00093 d.purpose_ = *itPurpose;
00094 d.moduleLabel_ = desc.moduleLabel();
00095 d.productInstanceLabel_ = desc.productInstanceName();
00096 d.processName_ = desc.processName();
00097 usableData().push_back(d);
00098 fwLog(fwlog::kDebug) << "Add collection will display " << d.type_
00099 << " " << d.moduleLabel_
00100 << " " << d.productInstanceLabel_
00101 << " " << d.processName_ << std::endl;
00102 }
00103 }
00104 return true;
00105 }
00106