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 16 of file JSONExport.py.

Constructor & Destructor Documentation

def JSONExport.JsonExport.__init__ (   self)

Definition at line 20 of file JSONExport.py.

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

Member Function Documentation

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

Definition at line 137 of file JSONExport.py.

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

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

Definition at line 23 of file JSONExport.py.

References muonDTDigis_cfi.pset.

Referenced by JSONExport.JsonExport.export().

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