CMS 3D CMS Logo

List of all members | Public Member Functions
JSONExport.JsonExport Class Reference
Inheritance diagram for JSONExport.JsonExport:

Public Member Functions

def __init__ (self)
 
def export (self, data, filename, filetype)
 
def produce (self, data)
 

Detailed Description

Definition at line 15 of file JSONExport.py.

Constructor & Destructor Documentation

def JSONExport.JsonExport.__init__ (   self)

Definition at line 19 of file JSONExport.py.

19  def __init__(self):
20  FileExportPlugin.__init__(self)
21 

Member Function Documentation

def JSONExport.JsonExport.export (   self,
  data,
  filename,
  filetype 
)

Definition at line 136 of file JSONExport.py.

References cond::EmptyIOVSource.produce(), DimuonMCMatcher.produce(), ShallowExampleProducer.produce(), WeakEffectsWeightProducer.produce(), ShallowEventDataProducer.produce(), MagneticFieldMapESProducer.produce(), PixelToFEDAssociateFromAsciiESProducer.produce(), FastSimGeometryESProducer.produce(), TrackerInteractionGeometryESProducer.produce(), PixelToLNKAssociateFromAsciiESProducer.produce(), DoubleProducer.produce(), PatElectronEAIsoCorrectionProducer.produce(), HLTDQMObjSelector< ObjType, ObjCollType >.produce(), HcalLaserEventFiltProducer2012.produce(), CandPtrProjector.produce(), ShallowTracksProducer.produce(), edm::EndPathStatusInserter.produce(), SiPixelFedCablingMapBuilder.produce(), SiPixelFakeCPEGenericErrorParmESSource.produce(), TrackingParticleConversionRefSelector.produce(), ElectronSqPtTkIsolationProducer.produce(), CSCChannelMapperESProducer.produce(), CSCIndexerESProducer.produce(), reco::modules::CaloRecHitCandidateProducer< HitCollection >.produce(), ConversionTrackRefFix.produce(), TrackingRecHitPipe.produce(), Phase2TrackerCablingESProducer.produce(), RazorVarProducer.produce(), SiPixelFakeGenErrorDBObjectESSource.produce(), SiPixelFakeTemplateDBObjectESSource.produce(), MFProducer.produce(), ShallowRechitClustersProducer.produce(), TkDetMapESProducer.produce(), AlphaTVarProducer.produce(), DistortedMETProducer.produce(), DTDigiToRawModule.produce(), edm::PathStatusInserter.produce(), L1TriggerKeyDummyProdExt.produce(), L1TriggerKeyListDummyProdExt.produce(), HLTDQMMuonSelector.produce(), ParticleDecayProducer.produce(), EventVtxInfoNtupleDumper.produce(), Phase2Tracker::Phase2TrackerCommissioningDigiProducer.produce(), ShallowTrackClustersProducer.produce(), ShallowSimhitClustersProducer.produce(), L1SubsystemKeysOnlineProdExt.produce(), JSONExport.JsonExport.produce(), L1TriggerKeyOnlineProdExt.produce(), sistrip::MeasureLA.produce(), ESRawToDigi.produce(), AssociationVectorSelector< KeyRefProd, CVal, KeySelector, ValSelector >.produce(), AssociationMapOneToOne2Association< CKey, CVal >.produce(), EmptySimHits.produce(), DiJetVarProducer.produce(), DistortedMuonProducerFromDB.produce(), MuonWithPFIsoProducer.produce(), CastorDbProducer.produce(), PFEGammaToCandidateRemapper.produce(), RawDataCollectorByLabel.produce(), evf::EvFFEDSelector.produce(), CastorFastTowerProducer.produce(), AssociationVector2ValueMap< KeyRefProd, CVal >.produce(), CalibratedPhotonProducerRun2T< T >.produce(), DistortedMuonProducer.produce(), DistortedPFCandProducer.produce(), IPTCorrector.produce(), CandViewRefMerger.produce(), ESDigiToRaw.produce(), HcalCalibFEDSelector.produce(), FamosProducer.produce(), CastorFastClusterProducer.produce(), ShallowSimTracksProducer.produce(), SiStripFedCablingESProducer.produce(), SiStripGainESSource.produce(), EcalIsolatedParticleCandidateProducer.produce(), SiStripHashedDetIdESProducer.produce(), RegressionEnergyPatElectronProducer.produce(), SiStripDelayESProducer.produce(), SiStripQualityESProducer.produce(), PFMuonUntagger.produce(), RPCPerformanceESSource.produce(), CollectionAdder< C >.produce(), ElectronSeedTrackRefFix.produce(), L1ObjectKeysOnlineProdBaseExt.produce(), SiStripNoiseESSource.produce(), SiStripPedestalsESSource.produce(), EcalLaserCorrectionService.produce(), SiStripBackPlaneCorrectionDepESProducer.produce(), ISRGammaWeightProducer.produce(), SiStripLorentzAngleDepESProducer.produce(), ShallowClustersProducer.produce(), FSRWeightProducer.produce(), ISRWeightProducer.produce(), DTUnpackingModule.produce(), HcalTimeSlewEP.produce(), RPCInverseCPPFLinkMapESProducer.produce(), RPCInverseLBLinkMapESProducer.produce(), RPCInverseOMTFLinkMapESProducer.produce(), RPCInverseTwinMuxLinkMapESProducer.produce(), SiStripTemplateEmptyFakeESSource< TObject, TRecord >.produce(), HBHEDarkeningEP.produce(), PdfWeightProducer.produce(), CSCDCCUnpacker.produce(), PFCandidateMuonUntagger.produce(), JetTracksAssociationToTrackRefs.produce(), RPCCPPFUnpacker.produce(), PixelTracksProducer.produce(), CalibratedElectronProducerRun2T< T >.produce(), IsolatedEcalPixelTrackCandidateProducer.produce(), AlignmentPrescaler.produce(), RPCAMCUnpacker.produce(), FastTSGFromL2Muon.produce(), CastorHardcodeCalibrations.produce(), NtpProducer< C >.produce(), FWRecoGeometryESProducer.produce(), LmfSource.produce(), SiStripProcessedRawDigiProducer.produce(), ElectronPATIdMVAProducer.produce(), SiStripGainESProducerTemplate< TDependentRecord, TInputRecord >.produce(), SiPixelGenErrorDBObjectESProducer.produce(), SiPixelTemplateDBObjectESProducer.produce(), FastTrackerRecHitMaskProducer.produce(), SiStripQualityFakeESSource.produce(), ZMuMuTrackUserData.produce(), CastorDigiToRaw.produce(), CandReducer.produce(), HcalDigiToRaw.produce(), HcalHistogramRawToDigi.produce(), PuppiPhoton.produce(), RawDataSelector.produce(), FRDStreamSource.produce(), CandidateTriggerObjectProducer.produce(), SiPixelFedFillerWordEventNumber.produce(), reco::modules::MatcherBase< C1, C2, M >.produce(), reco::modulesNew::Matcher< C1, C2, S, D >.produce(), TriggerMatchProducer< object >.produce(), ZMuMuMuonUserData.produce(), CloneProducer< C >.produce(), ShallowCloneProducer< C >.produce(), CTPPSPixelRawToDigi.produce(), AlcaBeamSpotFromDB.produce(), PFCandIsolatorFromDeposits.produce(), Phase2Tracker::Phase2TrackerDigiProducer.produce(), RPCAMCRawToDigi.produce(), RPCTwinMuxDigiToRaw.produce(), SiStripApvGainFakeESSource.produce(), SiStripBackPlaneCorrectionFakeESSource.produce(), SiStripBaseDelayFakeESSource.produce(), SiStripConfObjectFakeESSource.produce(), SiStripLatencyFakeESSource.produce(), SiStripPedestalsFakeESSource.produce(), SiStripThresholdFakeESSource.produce(), TrackInfoProducer.produce(), TotemTriggerRawToDigi.produce(), ShallowDigisProducer.produce(), EcalDCCTBUnpackingModule.produce(), DeltaBetaWeights.produce(), GEMDigiToRawModule.produce(), RPCUnpackingModule.produce(), VertexCompositeCandidateCollectionSelector.produce(), sistrip::ExcludedFEDListProducer.produce(), sistrip::RawToDigiModule.produce(), ElectronRecalibSuperClusterAssociator.produce(), SiStripBadModuleConfigurableFakeESSource.produce(), ZMuMuUserDataOneTrack.produce(), ZMuMuUserData.produce(), TkAlCaOverlapTagger.produce(), EcalDCCTB07UnpackingModule.produce(), HcalRawToDigi.produce(), FastTrackerRecHitCombiner.produce(), CastorTextCalibrations.produce(), AlcaBeamSpotProducer.produce(), L1GctInternJetProducer.produce(), ME0MuonTrackCollProducer.produce(), RPCPackingModule.produce(), LaserAlignmentProducer.produce(), PiZeroDiscriminatorProducer.produce(), MillePedeFileConverter.produce(), SubdetFEDSelector.produce(), PFMET.produce(), Type1PFMET.produce(), PuppiProducer.produce(), SiPixelDigiToRaw.produce(), EventCountProducer.produce(), edm::ThinningProducer< Collection, Selector >.produce(), SiStripNoisesFakeESSource.produce(), edm::FwdPtrProducer< T, H >.produce(), pf2pat::PFMETAlgo.produce(), sistrip::DigiToRawModule.produce(), SiPixelRawToDigi.produce(), edm::ProductFromFwdPtrProducer< T, H >.produce(), L1ConfigOnlineProdBaseExt< TRcd, TData >.produce(), EcalGlobalShowerContainmentCorrectionsVsEtaESProducer.produce(), SiStripRegFEDSelector.produce(), CSCDigiToRawModule.produce(), CSCTFPacker.produce(), HcalRawToDigiFake.produce(), DTFakeT0ESProducer.produce(), DaqFakeReader.produce(), EcalRegionCablingESProducer.produce(), EcalShowerContainmentCorrectionsESProducer.produce(), sistrip::SpyEventSummaryProducer.produce(), GEMRawToDigiModule.produce(), HcalDbProducer.produce(), CandMergerCleanOthersByDR.produce(), FWTGeoRecoGeometryESProducer.produce(), Merger< InputCollection, OutputCollection, P >.produce(), CastorRawToDigi.produce(), DTTFFEDSim.produce(), L1TTwinMuxRawToDigi.produce(), MatchedProbeMaker< T >.produce(), RPCTwinMuxRawToDigi.produce(), FastTrackerRecHitMatcher.produce(), L1TriggerKeyListDummyProd.produce(), TagProbeMassProducer.produce(), sistrip::SpyDigiConverterModule.produce(), SiStripLorentzAngleFakeESSource.produce(), AlcaPCCProducer.produce(), LaserAlignmentT0Producer.produce(), WMuNuProducer.produce(), CSCTFUnpacker.produce(), SiPixelFakeGainESSource.produce(), SiPixelFakeGainForHLTESSource.produce(), SiPixelFakeGainOfflineESSource.produce(), L1TriggerKeyDummyProd.produce(), AlCaEcalHcalReadoutsProducer.produce(), DTTFFEDReader.produce(), RawPCCProducer.produce(), EcalRecHitRecalib.produce(), HcalRecHitRecalib.produce(), PrimaryVertexSorter< ParticlesCollection >.produce(), AlCaElectronTracksReducer.produce(), pf2pat::PFIsoDepositAlgo.produce(), BufferedBoostIOESProducer< DataType, MyRecord >.produce(), L1SubsystemKeysOnlineProd.produce(), edm::TriggerResultInserter.produce(), SiPixelFakeLorentzAngleESSource.produce(), SiPixelFakeQualityESSource.produce(), ECALRegFEDSelector.produce(), L1TriggerKeyOnlineProd.produce(), ZToLLEdmNtupleDumper.produce(), TotemVFATRawToDigi.produce(), PFPileUp.produce(), PFCand_AssoMap.produce(), AlCaDiJetsProducer.produce(), SiPixelQualityESProducer.produce(), ObjectSelectorProducer< Selector, OutputCollection, PostProcessor, StoreManager, Base, Init >.produce(), AlCaGammaJetProducer.produce(), DTuROSDigiToRaw.produce(), SiStripFineDelayHit.produce(), HcalDigiToRawuHTR.produce(), L1ObjectKeysOnlineProdBase.produce(), ScalersRawToDigi.produce(), HBHENoiseFilterResultProducer.produce(), cms::HitReCalibrator.produce(), HcalTPGCoderULUT.produce(), LTCRawToDigi.produce(), GctDigiToRaw.produce(), MisalignedTrackerESProducer.produce(), TrackCandidateProducer.produce(), EventWithHistoryProducer.produce(), DTuROSRawToDigi.produce(), FromClusterSummaryMultiplicityProducer.produce(), PF_PU_AssoMap.produce(), AlCaHcalNoiseProducer.produce(), L1GlobalTriggerRecordProducer.produce(), EventWithHistoryProducerFromL1ABC.produce(), IsolatedPixelTrackCandidateProducer.produce(), TcdsRawToDigi.produce(), pf2pat::TopProjectorAlgo< Top, Bottom >.produce(), CaloTPGTranscoderULUTs.produce(), SiStripBadModuleFedErrESSource.produce(), EcalRawToDigi.produce(), HcalTextCalibrations.produce(), EcalFEDWithCRCErrorProducer.produce(), RctRawToDigi.produce(), MisalignedMuonESProducer.produce(), l1t::L1TRawToDigi.produce(), ConfigurableAPVCyclePhaseProducer.produce(), ValueMapTraslator.produce(), IsolatedPixelTrackCandidateL1TProducer.produce(), MuonMillepedeTrackRefitter.produce(), SoftKillerProducer.produce(), omtf::OmtfPacker.produce(), GctRawToDigi.produce(), PF_PU_FirstVertexTracks.produce(), EcalDigiToRaw.produce(), OnlineMetaDataRawToDigi.produce(), AlCaECALRecHitReducer.produce(), L1GlobalTriggerEvmRawToDigi.produce(), AlCaHBHEMuonProducer.produce(), MultiplicityProducer< T >.produce(), HLTTauRefProducer.produce(), TrackingRecHitProducer.produce(), CaloMiscalibToolsMC.produce(), L1ConfigOnlineProdBase< TRcd, TData >.produce(), omtf::OmtfUnpacker.produce(), l1t::L1TDigiToRaw.produce(), ConditionDumperInEdm.produce(), CaloMiscalibTools.produce(), HcalHardcodeCalibrations.produce(), L1GTEvmDigiToRaw.produce(), L1GtTextToRaw.produce(), JetDeltaRTagInfoValueMapProducer< T, I >.produce(), PFCand_NoPU_WithAM.produce(), l1t::AMC13DumpToRaw.produce(), AlignmentMuonHIPTrajectorySelector.produce(), TGeoMgrFromDdd.produce(), l1t::AMCDumpToRaw.produce(), L1GtTriggerMenuLiteProducer.produce(), sistrip::SpyUnpackerModule.produce(), reco::modules::TrackFullCloneSelectorBase< Selector >.produce(), L1GTDigiToRaw.produce(), SiPixelCalibDigiProducer.produce(), APVCyclePhaseProducerFromL1ABC.produce(), L1GlobalTriggerRawToDigi.produce(), MEtoEDMConverter.produce(), APVCyclePhaseProducerFromL1TS.produce(), CTPPSSimHitProducer.produce(), l1t::MP7BufferDumpToRaw.produce(), sistrip::FEDEmulatorModule.produce(), ShallowGainCalibration.produce(), JetConstituentSelector< T, C >.produce(), EDMtoMEConverter.produce(), Pi0FixedMassWindowCalibration.produce(), TrackerToMuonPropagator.produce(), edm::stream::EDProducerBase.produce(), CSCOverlapsTrackPreparation.produce(), TkLasBeamFitter.produce(), CTPPSFastTrackingProducer.produce(), reco::PhysObjectMatcher< C1, C2, S, D, Q >.produce(), FastSimProducer.produce(), JetDeltaRValueMapProducer< T, C >.produce(), CTPPSRecHitProducer.produce(), TotemDAQMappingESSourceXML.produce(), L1TCaloLayer1RawToDigi.produce(), MuonSimHitProducer.produce(), TrajectorySeedProducer.produce(), ZeeCalibration.produce(), edm::EDProducer.produce(), CandidateProducer< TColl, CColl, Selector, Conv, Creator, Init >.produce(), LaserAlignment.produce(), SelectedElectronFEDListProducer< TEle, TCand >.produce(), AlCaIsoTracksProducer.produce(), edm::one::EDProducerBase.produce(), edm::global::EDProducerBase.produce(), edm::limited::EDProducerBase.produce(), reco::modules::NamedCandCombiner< Selector, PairSelector, Cloner, Setup, Init >.produce(), MatacqProducer.produce(), reco::modules::CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup, Init >.produce(), TopProjector< Top, Bottom, Matcher >.produce(), AlCaHOCalibProducer.produce(), edm::one::impl::Accumulator< T >.produce(), edm::stream::impl::Accumulator.produce(), edm::stream::CallBeginRunProduceImpl< T, bool >.produce(), edm::stream::CallBeginRunProduceImpl< T, false >.produce(), edm::stream::CallEndRunProduceImpl< T, bProduce, bSummary >.produce(), edm::stream::CallEndRunProduceImpl< T, true, false >.produce(), edm::stream::CallEndRunProduceImpl< T, true, true >.produce(), edm::stream::CallBeginLuminosityBlockProduceImpl< T, bool >.produce(), edm::stream::CallBeginLuminosityBlockProduceImpl< T, false >.produce(), edm::stream::CallEndLuminosityBlockProduceImpl< T, bProduce, bSummary >.produce(), edm::limited::impl::Accumulator< T >.produce(), edm::stream::CallEndLuminosityBlockProduceImpl< T, true, false >.produce(), edm::stream::CallEndLuminosityBlockProduceImpl< T, true, true >.produce(), edm::global::impl::Accumulator< T >.produce(), HTMLExport.HTMLExport.produce(), and HTMLExport.HTMLExportStatic.produce().

136  def export(self,data,filename,filetype):
137  if not data.process():
138  raise "JSONExport requires a cms.Process object"
139 
140  json = self.produce(data)
141 
142  if filetype=='json':
143  jsonfile = open(filename,'w')
144  jsonfile.write(json)
145  jsonfile.close()
146  if filetype=='html':
147  #open the HTML template and inject the JSON...
148  pass
149 
150 
def produce(self, data)
Definition: JSONExport.py:22
def export(self, data, filename, filetype)
Definition: JSONExport.py:136
def JSONExport.JsonExport.produce (   self,
  data 
)

Definition at line 22 of file JSONExport.py.

References muonDTDigis_cfi.pset.

Referenced by JSONExport.JsonExport.export().

22  def produce(self,data):
23 
24  #pset = lambda pdict: [[k,repr(v).split('(',1)[0],(repr(v).split('(',1)[1][:-1])] for k,v in pdict.items()]
25  def pset(pdict):
26  result = []
27  for k,v in pdict.items():
28  if v.pythonTypeName()=='cms.PSet' or v.pythonTypeName()=='cms.untracked.PSet':
29  result.append([k,v.pythonTypeName(),'pset',pset(v.parameters_())])
30  elif v.pythonTypeName()=='cms.VPSet' or v.pythonTypeName()=='cms.untracked.VPSet':
31  result.append([k,v.pythonTypeName(),'vpset',[pset(a.parameters_()) for a in v]])
32  elif v.pythonTypeName().lower().startswith('cms.v') or v.pythonTypeName().lower().startswith('cms.untracked.v'):
33  result.append([k,v.pythonTypeName(),'list',[repr(a) for a in v]])
34  else:
35  result.append([k,v.pythonTypeName(),'single',repr(v.pythonValue())])
36  return result
37 
38  #allObjects = [d for d in data._allObjects if (data.type(d) in ("EDProducer","EDFilter","EDAnalyzer","OutputModule"))]
39  #data.readConnections(allObjects)
40 
41  def moduledict(mod,prefix,links=False):
42  result={}
43  result['label']=data.label(mod)
44  result['class']=data.classname(mod)
45  result['file']=data.pypath(mod)
46  result['line']=data.lineNumber(mod)
47  result['package']=data.pypackage(mod)
48  result['pset']=pset(mod.parameters_())
49  result['type']=data.type(mod)
50  if links:
51  result['uses']=[data.uses(mod)]
52  result['usedby']=[data.usedBy(mod)]
53  result['id']='%s_%s'%(prefix,data.label(mod))
54  return result
55 
56  all={}
57  for tlo in data.topLevelObjects():
58  children=data.children(tlo)
59  if children:
60  all[tlo._label]=children
61 
62  process = {'name':data.process().name_(),'src':data._filename}
63 
64  #now unavailable
65  #schedule = []
66  #if 'Schedule' in all:
67  # for s in all['Schedule']:
68  # schedule.append(data.label(s))
69 
70  source={}
71  if 'source' in all:
72  s = all['source'][0]
73  source['class']=data.classname(s)
74  source['pset']=pset(s.parameters_())
75 
76  essources=[]
77  if 'essources' in all:
78  for e in all['essources']:
79  essources.append(moduledict(e,'essource'))
80  esproducers=[]
81  if 'esproducers' in all:
82  for e in all['esproducers']:
83  essources.append(moduledict(e,'esproducer'))
84  esprefers=[]
85  if 'esprefers' in all:
86  for e in all['esprefers']:
87  essources.append(moduledict(e,'esprefers'))
88  services=[]
89  if 'services' in all:
90  for s in all['services']:
91  services.append({'class':data.classname(s),'pset':pset(s.parameters_())})
92 
93 
94  def jsonPathRecursive(p,prefix):
95  #print "At:",self.label(p),self.type(p)
96  children = data.children(p)
97  if children:
98  children = [jsonPathRecursive(c,prefix) for c in children]
99  return {'type':'Sequence','label':'Sequence %s'%(data.label(p)),'id':'seq_%s' % data.label(p),'children':children}
100  else:
101  return moduledict(p,prefix,True)
102 
103 
104  paths=[]
105  if 'paths' in all:
106  for p in all['paths']:
107  path=jsonPathRecursive(p,data.label(p))
108  if path:
109  if not type(path)==type([]):
110  if path['type']=='Sequence':
111  path = path['children']
112  else:
113  path = [path]
114  else:
115  path=[]
116  paths.append({'label':data.label(p),'path':path})
117  endpaths=[]
118  if 'endpaths' in all:
119  for p in all['endpaths']:
120  path=jsonPathRecursive(p,data.label(p))
121  if path:
122  if not type(path)==type([]):
123  if path['type']=='Sequence':
124  path = path['children']
125  else:
126  path = [path]
127  else:
128  path=[]
129  endpaths.append({'label':data.label(p),'path':path})
130 
131  #json={'process':process,'schedule':schedule,'source':source,'essources':essources,'esproducers':esproducers,'esprefers':esprefers,'services':services,'paths':paths,'endpaths':endpaths}
132  json={'process':process,'source':source,'essources':essources,'esproducers':esproducers,'esprefers':esprefers,'services':services,'paths':paths,'endpaths':endpaths}
133 
134  return repr(json)
135 
def produce(self, data)
Definition: JSONExport.py:22