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