def __init__(self) : from Configurables import ApplicationMgr appMgr = ApplicationMgr() if "GAUDIAPPNAME" in os.environ: appMgr.AppName = str(os.environ["GAUDIAPPNAME"]) if "GAUDIAPPVERSION" in os.environ: appMgr.AppVersion = str(os.environ["GAUDIAPPVERSION"]) self.log = logging.getLogger(__name__) self.printsequence = False
def generateOptions(counter, cmask, invmask, sampling_period, startatevent, storeresultsat, family): cmask = map(int, cmask) invmask = map(int, invmask) sampling_period = map(int, sampling_period) startatevent = int(startatevent) from Configurables import ApplicationMgr, AuditorSvc, PerfMonAuditor app = ApplicationMgr() app.AuditAlgorithms = 1 pfaud = PerfMonAuditor() try: pfaud.EVENT0 = counter[0] pfaud.SP0 = sampling_period[0] pfaud.INV0 = int(invmask[0]) pfaud.CMASK0 = int(cmask[0]) pfaud.EVENT1 = counter[1] pfaud.SP1 = sampling_period[1] pfaud.INV1 = int(invmask[1]) pfaud.CMASK1 = int(cmask[1]) pfaud.EVENT2 = counter[2] pfaud.SP2 = sampling_period[2] pfaud.INV2 = int(invmask[2]) pfaud.CMASK2 = int(cmask[2]) pfaud.EVENT3 = counter[3] pfaud.SP3 = sampling_period[3] pfaud.INV3 = int(invmask[3]) pfaud.CMASK3 = int(cmask[3]) except IndexError: pass pfaud.FAMILY = family pfaud.PREFIX = "%s_%s" % (storeresultsat, "S" if sampling_period[0] > 0 else "C") # for <2.5 Python use: test and true_value or false_value pfaud.SAMPLE = int(sampling_period[0] > 0) pfaud.START_AT_EVENT = startatevent #pfaud.LEVEL = 5 AuditorSvc().Auditors.append(pfaud) print pfaud
proc1.Parameters = {#"EncodingStringParameter": ["GlobalTrackerReadoutID"], "DD4hepXMLFile": [os.path.join(os.environ.get('LCGEO'), 'CLIC/compact/CLIC_o2_v04/CLIC_o2_v04.xml')] } algList.append(proc1) digiVxd = MarlinProcessorWrapper("VXDBarrelDigitiser") digiVxd.OutputLevel = DEBUG digiVxd.ProcessorType = "DDPlanarDigiProcessor" digiVxd.Parameters = { "SubDetectorName": ["Vertex"], "IsStrip": ["false"], "ResolutionU": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"], "ResolutionV": ["0.003", "0.003", "0.003", "0.003", "0.003", "0.003"], "SimTrackHitCollectionName": ["VertexBarrelCollection"], "SimTrkHitRelCollection": ["VXDTrackerHitRelations"], "TrackerHitCollectionName": ["VXDTrackerHits"], "Verbosity": ["DEBUG"], } algList.append(digiVxd) from Configurables import ApplicationMgr ApplicationMgr( TopAlg = algList, EvtSel = 'NONE', EvtMax = 10, ExtSvc = [evtsvc], OutputLevel=DEBUG )
nPhiWindow=windP, nEtaPosition=posE, nPhiPosition=posP, nEtaDuplicates=dupE, nPhiDuplicates=dupP, nEtaFinal=finE, nPhiFinal=finP, energyThreshold=threshold) createClusters.clusters.Path = "CaloClusters" out = PodioOutput("out", filename="output_allCalo_reco_noise.root") out.outputCommands = ["keep *"] #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] podioinput.AuditExecute = True createClusters.AuditExecute = True out.AuditExecute = True ApplicationMgr(TopAlg=[ podioinput, rewriteECalEC, rewriteHCalEC, positionsExtHcal, resegmentExtHcal, createEcalBarrelCells, createHcalBarrelCells, createEcalEndcapCells, createClusters, out ], EvtSel='NONE', EvtMax=num_events, ExtSvc=[podioevent, geoservice])
physicslisttool = SimG4UserLimitPhysicsList("Physics", fullphysics="SimG4FtfpBert") # attach those tools to the G4 service geantservice = SimG4Svc("SimG4Svc", physicslist=physicslisttool, regions=[regiontool]) # Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools from Configurables import SimG4Alg, SimG4PrimariesFromEdmTool # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg", eventProvider=particle_converter) # PODIO algorithm from Configurables import PodioOutput out = PodioOutput("out", filename="out_geant_userLimits.root") out.outputCommands = ["keep *"] out.OutputLevel = DEBUG # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[gen, hepmc_converter, geantsim, out], EvtSel='NONE', EvtMax=10, # order is important, as GeoSvc is needed by SimG4Svc ExtSvc=[podioevent, geoservice, geantservice], OutputLevel=INFO)
# creates histograms for HepMC genHisto = HepMCHistograms("GenHistograms") genHisto.DataInputs.hepmc.Path = "hepmc" # runs sample jet clustering algorithm jets = HepMCJetClustering("ktCluster") jets.JetAlgorithm = "kt" jets.RecominbationScheme = "E" jets.ConeRadius = 0.7 jets.PtMin = 1 jets.DataInputs.hepmc.Path = "hepmc" jets.DataOutputs.jets.Path = "ktJets" # creates histograms for jets jetHisto = JetHistograms("JetHistograms") jetHisto.DataInputs.jets.Path = "ktJets" # save all histograms THistSvc().Output = [ "rec DATAFILE='GenHistograms.root' TYP='ROOT' OPT='RECREATE'" ] THistSvc().PrintAll = True THistSvc().AutoSave = True THistSvc().AutoFlush = True THistSvc().OutputLevel = VERBOSE # ApplicationMgr ApplicationMgr(EvtSel='NONE', EvtMax=1, TopAlg=[reader, dumper, genHisto, jets, jetHisto])
"DelphesSaveNeutralParticles/neutral", "DelphesSaveGenJets/genJets", "DelphesSaveJets/jets", "DelphesSaveMet/met" ]) delphessim.DataInputs.hepmc.Path = "hepmc" delphessim.DataOutputs.genParticles.Path = "genParticles" delphessim.DataOutputs.genVertices.Path = "genVertices" ## FCC event-data model output -> define objects to be written out from Configurables import PodioOutput out = PodioOutput("out", OutputLevel=messageLevelOut) out.filename = "FCCDelphesOutput.root" #out.outputCommands = ["drop *", # "keep genParticles", # "keep genVertices", # "keep genJets", # "keep genJetsToMC"] out.outputCommands = ["keep *"] ############################################################ # # Run modules # ############################################################ # Run Pythia + Delphes ApplicationMgr(TopAlg=[pythia8gen, delphessim, out], EvtSel='NONE', EvtMax=nEvents, ExtSvc=[podioEvent])
import os from Gaudi.Configuration import * from Configurables import GeoSvc geoservice = GeoSvc("GeoSvc", detectors=['file:Detector/DetCommon/compact/Box.xml'], OutputLevel = DEBUG) from Configurables import SimG4Svc geantservice = SimG4Svc("SimG4Svc", detector='SimG4DD4hepDetector', physicslist="SimG4FtfpBert", actions="SimG4FullSimActions") export_fname = "TestBox.gdml" # check if file exists and delete it: if os.path.isfile(export_fname): os.remove(export_fname) from Configurables import GeoToGdmlDumpSvc geodumpservice = GeoToGdmlDumpSvc("GeoDump", gdml=export_fname) from Configurables import ApplicationMgr ApplicationMgr( TopAlg = [], EvtSel = 'NONE', EvtMax = 1, # order is important, as GeoSvc is needed by SimG4Svc ExtSvc = [geoservice, geantservice, geodumpservice], OutputLevel=DEBUG )
"InspectHitsCollectionsTool/inspect" ], eventProvider=pgun, OutputLevel=DEBUG) # PODIO algorithm from Configurables import PodioOutput out = PodioOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] out.filename = "output_hcalSim_e50GeV_eta0_10events.root" #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] geantsim.AuditExecute = True # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[geantsim, out], EvtSel='NONE', EvtMax=num_events, # order is important, as GeoSvc is needed by G4SimSvc ExtSvc=[podioevent, geoservice, geantservice, audsvc], OutputLevel=DEBUG)
def configureSequences(self, withMC, handleLumi, vetoHltErrorEvents): brunelSeq = GaudiSequencer("BrunelSequencer") brunelSeq.Context = self.getProp("Context") ApplicationMgr().TopAlg += [ brunelSeq ] brunelSeq.Members += [ "ProcessPhase/Init" ] physicsSeq = GaudiSequencer( "PhysicsSeq" ) # Treatment of luminosity events if handleLumi: lumiSeq = GaudiSequencer("LumiSeq") # Prepare the FSR if self.getProp("WriteFSR"): self.setOtherProps(LumiAlgsConf(),["Context","DataType","InputType","Simulation"]) lumiCounters = GaudiSequencer("LumiCounters") lumiSeq.Members += [ lumiCounters ] LumiAlgsConf().LumiSequencer = lumiCounters # Trigger masks changed in 2016, see LHCBPS-1486 if self.getProp( "DataType" ) in self.Run1DataTypes or self.getProp( "DataType" ) in [ "2015" ]: physFilterRequireMask = [ 0x0, 0x4, 0x0 ] lumiFilterRequireMask = [ 0x0, 0x2, 0x0 ] else: physFilterRequireMask = [ 0x0, 0x0, 0x80000000 ] lumiFilterRequireMask = [ 0x0, 0x0, 0x40000000 ] # Filter out Lumi only triggers from further processing, but still write to output from Configurables import HltRoutingBitsFilter physFilter = HltRoutingBitsFilter( "PhysFilter", RequireMask = physFilterRequireMask ) physicsSeq.Members += [ physFilter ] lumiFilter = HltRoutingBitsFilter( "LumiFilter", RequireMask = lumiFilterRequireMask ) lumiSeq.Members += [ lumiFilter, physFilter ] lumiSeq.ModeOR = True # Sequence to be executed if physics sequence not called (nano events) notPhysSeq = GaudiSequencer("NotPhysicsSeq") notPhysSeq.ModeOR = True notPhysSeq.Members = [ physFilter ] brunelSeq.Members += [ lumiSeq, notPhysSeq ] # Hlt decreports decoders from DAQSys.Decoders import DecoderDB from Configurables import LoKi__HDRFilter, AddToProcStatus hltStages = ('Hlt1',) if self.getProp('OnlineMode') else ('Hlt1', 'Hlt2') hltDecoders = [] hltErrorFilters = [] hltFilters = [] for stage in hltStages: decoder = DecoderDB["HltDecReportsDecoder/%sDecReportsDecoder" % stage].setup() hltDecoders += [decoder] # decode DecReports # identifies events that are not of type ErrorEvent errorFilterCode = "HLT_PASS_RE('%s(?!ErrorEvent).*Decision')" % stage hltErrorFilter = LoKi__HDRFilter('%sErrorFilter' % stage, Code = errorFilterCode, Location = decoder.OutputHltDecReportsLocation) hltErrorFilters += [decoder, hltErrorFilter] # and apply filter filterCode = self.getProp(stage + "FilterCode") if filterCode: hltFilter = LoKi__HDRFilter('%sFilter' % stage, Code = filterCode, Location = decoder.OutputHltDecReportsLocation) hltFilters += [decoder, hltFilter] # Do not process events flagged as error in Hlt, but still write procstatus if vetoHltErrorEvents: """ By Patrick Koppenburg, 16/6/2011 """ # Make a sequence that selects HltErrorEvents hltErrorFilterSeq = GaudiSequencer("HltErrorFilterSeq") if handleLumi: hltErrorFilterSeq.Members = [ physFilter ] # protect against lumi (that doesn't have decreports) hltErrorFilterSeq.Members += hltErrorFilters # Sequence to be executed if HltErrorFilter is failing to set ProcStatus hltErrorSeq = GaudiSequencer("HltErrorSeq", ModeOR = True, ShortCircuit = True) # anti-logic addToProc = AddToProcStatus("HltErrorProc", Reason = "HltError", Subsystem = "Hlt") # write a procstatus hltErrorSeq.Members += [hltErrorFilterSeq, addToProc] # only run if hltErrorFilterSeq fails brunelSeq.Members += [hltErrorSeq] # add this sequece to Brunel _before_ physseq physicsSeq.Members += [hltErrorFilterSeq] # take good events in physics seq # Filter events based on HLT decisions if filters were specified if hltFilters: hltFilterSeq = GaudiSequencer("HltFilterSeq") hltFilterSeq.Members = hltFilters physicsSeq.Members += [hltFilterSeq] # Convert Calo ReadoutStatus to ProcStatus caloBanks=GaudiSequencer("CaloBanksHandler") caloDetectors = [det for det in ['Spd','Prs','Ecal','Hcal'] if det in self.getProp("Detectors")] CaloDigitConf(ReadoutStatusConvert=True,Sequence=caloBanks,Detectors=caloDetectors) physicsSeq.Members += [caloBanks] # Decode L0 (and HLT if not already done) trgSeq = GaudiSequencer("DecodeTriggerSeq") l0TrgSeq = GaudiSequencer("L0TriggerSeq") if self.getProp( "DataType" ) not in [ "2008", "2009" ]: trgSeq.Members += hltDecoders trgSeq.Members += [ l0TrgSeq ] physicsSeq.Members += [ trgSeq ] L0Conf().L0Sequencer = l0TrgSeq if self.getProp("RecL0Only"): # Setup L0 filtering if requested, runs L0 before Reco L0Conf().FilterL0FromRaw = True self.setOtherProps( L0Conf(), ["DataType"] ) else: L0Conf().DecodeL0DU = True if not self.isPropertySet("MainSequence"): if withMC: mainSeq = self.DefaultMCSequence else: mainSeq = self.DefaultSequence self.MainSequence = mainSeq physicsSeq.Members += self.getProp("MainSequence") from Configurables import ProcessPhase outputPhase = ProcessPhase("Output") brunelSeq.Members += [ physicsSeq ] brunelSeq.Members += [ outputPhase ]
def defineOptions(self): # Kept for Dirac backward compatibility if self.getProp( "NoWarnings" ) : log.warning("Brunel().NoWarnings=True property is obsolete and maintained for Dirac compatibility. Please use Brunel().ProductionMode=True instead") self.setProp( "ProductionMode", True ) # Special settings for production if self.getProp( "ProductionMode" ) : if not self.isPropertySet( "OutputLevel" ) : self.setProp("OutputLevel", ERROR) if not LHCbApp().isPropertySet( "TimeStamp" ) : LHCbApp().setProp( "TimeStamp", True ) if not self.isPropertySet( "PrintFreq" ) : self.setProp("PrintFreq", 1000) # HC does not exist in Run 1, so use appropriate split output if self.getProp( "DataType" ) in self.Run1DataTypes : if not self.isPropertySet( "SplitRawEventOutput" ) : self.setProp( "SplitRawEventOutput", 4.0 ) # Online mode if self.getProp( "OnlineMode" ) : if not self.isPropertySet("Histograms") : self.setProp("Histograms","Online") if not CondDB().isPropertySet("Online") : CondDB().setProp("Online", True) inputType = self.getProp( "InputType" ).upper() if inputType not in self.KnownInputTypes: raise TypeError( "Invalid inputType '%s'"%inputType ) outputType = self.getProp( "OutputType" ).upper() histOpt = self.getProp("Histograms") if histOpt not in self.KnownHistograms: raise RuntimeError("Unknown Histograms option '%s'"%histOpt) withMC = self.getProp("WithMC") if withMC: if inputType in [ "MDF" ]: log.warning( "WithMC = True, but InputType = '%s'. Forcing WithMC = False"%inputType ) withMC = False # Force it, MDF never contains MC truth if outputType in [ "RDST" ]: log.warning( "WithMC = True, but OutputType = '%s'. Forcing WithMC = False"%inputType ) withMC = False # Force it, RDST never contains MC truth if self.getProp("WriteFSR") and self.getProp("PackType").upper() in ["MDF"]: if hasattr( self, "WriteFSR" ): log.warning("Don't know how to write FSR to MDF output file") self.setProp("WriteFSR", False) if self.getProp( "MergeGenFSR") and not self.getProp( "Simulation" ): if hasattr( self, "MergeGenFSR" ): log.warning("Cannot MergeGenFSR on real data") self.setProp( "MergeGenFSR", False ) # Do not look for Hlt errors in data without HltDecReports bank if self.getProp( "DataType" ) in [ "2008", "2009" ]: self.setProp( "VetoHltErrorEvents", False ) # For simulation, change the default but allow to override if self.getProp( "Simulation" ) and not hasattr( self, "VetoHltErrorEvents" ): self.setProp( "VetoHltErrorEvents", False ) # Flag to handle or not LumiEvents handleLumi = inputType in ["MDF"] and not withMC and not self.getProp('UseDBSnapshot') # Top level configuration for skipping tracking if self.getProp("SkipTracking"): if inputType in ["MDF", "DIGI" ]: raise RuntimeError( "Cannot skip tracking if tracks not present on the input file" ) if withMC: raise RuntimeError( "SkipTracking not (yet) supported for simulation input" ) if( self.getProp("DataType") is "Upgrade"): raise RuntimeError( "SkipTracking not (yet) supported for Upgrade configurations" ) ApplicationMgr().ExtSvc += [ "DataOnDemandSvc" ] # to decode the tracks from the DST DstConf().setProp("EnableUnpack", ["Tracking"] ) # veto Hlt Error Events vetoHltErrorEvents = self.getProp("VetoHltErrorEvents") self.configureSequences( withMC, handleLumi, vetoHltErrorEvents ) self.configureInit( inputType ) self.configureInput( inputType ) self.configureOutput( outputType, withMC, handleLumi ) if withMC: # Create associators for checking and for DST from Configurables import ProcessPhase ProcessPhase("MCLinks").DetectorList += self.getProp("MCLinksSequence") # Unpack Sim data GaudiSequencer("MCLinksUnpackSeq").Members += [ "UnpackMCParticle"] # particle gun uses MCVertex to fake a reconstructed one # unpacking again would lead to crash if "pGun" not in self.getProp("SpecialData"): GaudiSequencer("MCLinksUnpackSeq").Members += [ "UnpackMCVertex" ] else: # Cannot run trigger on pGun events... L0Conf().EnsureKnownTCK=False GaudiSequencer("MCLinksTrSeq").Members += [ "TrackAssociator" ] GaudiSequencer("MCLinksCaloSeq").Members += [ "CaloDigit2MCLinks2Table", "CaloClusterMCTruth", "CaloHypoMCTruth" ] # activate all configured checking (uses MC truth) self.configureCheck( histOpt == "Expert" ) # data on demand needed to pack RichDigitSummary for DST, when reading unpacked DIGI # Also needed to unpack MCHit containers when expert checking enabled ApplicationMgr().ExtSvc += [ "DataOnDemandSvc" ] # ROOT persistency for histograms ApplicationMgr().HistogramPersistency = "ROOT" from Configurables import RootHistCnv__PersSvc RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True if histOpt == "None" or histOpt == "": # HistogramPersistency still needed to read in CaloPID DLLs. # so do not set ApplicationMgr().HistogramPersistency = "NONE" return # Pass expert checking option to RecSys and RecMoni if histOpt == "Expert": DstConf().EnablePackingChecks = True # Use a default histogram file name if not already set if not HistogramPersistencySvc().isPropertySet( "OutputFile" ): histosName = self.getProp("DatasetName") if histosName == "": histosName = "Brunel" if self.getProp( "RecL0Only" ): histosName += '-L0Yes' if (self.evtMax() > 0): histosName += '-' + str(self.evtMax()) + 'ev' if histOpt == "Expert": histosName += '-expert' histosName += '-histos.root' HistogramPersistencySvc().OutputFile = histosName #reconfigure decoders to point to default location, if required! if DecodeRawEvent().isPropertySet("OverrideInputs") and DecodeRawEvent().getProp("OverrideInputs") is not None: #do nothing, it's been configured by someone else! pass elif self.isPropertySet("SplitRawEventInput") and self.getProp("SplitRawEventInput") is not None: #print "WAAAAH Overriding RawEvent Locations" DecodeRawEvent().setProp("OverrideInputs",self.getProp("SplitRawEventInput")) elif inputType in [ "MDF", "DIGI", "XDIGI" ]: #set to the default of what comes out of Moore DecodeRawEvent().setProp("OverrideInputs","Moore") #remember that the default is a long list of locations, #starting with places which only exist _after_ brunel has run! # Following needed to build RecSummary, even if tracking is skipped. if self.getProp("SkipTracking"): from TrackSys import RecoTracking RecoTracking.DecodeTracking(["FastVelo"])
input_file = 'root://castorlhcb.cern.ch//castor/cern.ch/grid//lhcb/data/2010/BHADRON.DST/00008399/0000/00008399_00001052_1.bhadron.dst?svcClass=lhcbdisk' #------------------------------------------------------------------------------------------------ def storeExplorer(load=1,freq=0.0001,name='StoreExplorerAlg'): from Configurables import StoreExplorerAlg alg = StoreExplorerAlg(name) alg.Load = load alg.PrintFreq = freq return alg #------------------------------------------------------------------------------------------------ if len(sys.argv)>1: input_file = sys.argv[1] appConf = ApplicationMgr(OutputLevel = INFO) appConf.HistogramPersistency = "NONE"; appConf.ExtSvc.append('Gaudi::IODataManager/IODataManager') appConf.ExtSvc.append('Gaudi::RootCnvSvc/RootCnvSvc') appConf.TopAlg.append(storeExplorer(freq=1.0)) EventDataSvc().RootCLID = 1 EventDataSvc().EnableFaultHandler = True root = Gaudi__RootCnvSvc('RootCnvSvc') root.CacheBranches = [] root.VetoBranches = ['*'] #root.OutputLevel = 2 # Enable specialized branch caching: root.CacheBranches = [ '_Event.*',
#HltRecoConf.MoreOfflineLikeFit = False # default is HltDecisionSequence, which Split = 'Hlt1' will remove (maybe it should remove Hlt2 from HltDecisionSequence instead???) #Moore().WriterRequires = [ 'Hlt1' ] #Moore().outputFile = '/data/bfys/graven/0x46/hlt1.raw' Moore().RemoveInputHltRawBanks = True Moore().Split = 'Hlt1' Moore().EnableDataOnDemand = True from Configurables import MooreExpert MooreExpert().Hlt2Independent=True from Configurables import HltConf HltConf().Verbose = True #### ENABLE UNPACKING #### DstConf ( EnableUnpack = ["Reconstruction","Stripping"] ) CaloDstUnPackConf().Enable = True ################################################## ## GAUDI CONFIG ## ################################################## from Configurables import ApplicationMgr appConf = ApplicationMgr() appConf.HistogramPersistency = 'ROOT' gaudi = GaudiPython.AppMgr(outputlevel=3) gaudi.initialize() TES = gaudi.evtsvc() from trigtree import * trigtree(gaudi, TES, run_opts.MCFilterLoc, eventstorun, run_opts.output)
from Configurables import (ApplicationMgr, EventDataSvc, RecordOutputStream, ReplayOutputStream, GaudiSequencer, GaudiTesting__OddEventsFilter as OddEvents, GaudiTesting__EvenEventsFilter as EvenEvents, SubAlg as EmptyAlg) outDelegate = ReplayOutputStream() outDelegate.OutputStreams = [EmptyAlg('Stream1'), EmptyAlg('Stream2')] oddEvtSelect = GaudiSequencer('OddEventsSelection') oddEvtSelect.Members = [OddEvents('OddEvents'), RecordOutputStream('Rec1', OutputStreamName='Stream1')] evenEvtSelect = GaudiSequencer('EvenEventsSelection') evenEvtSelect.Members = [EvenEvents('EvenEvents'), RecordOutputStream('Rec2', OutputStreamName='Stream2')] app = ApplicationMgr(EvtSel='NONE', EvtMax=4) app.TopAlg = [EmptyAlg("EventInit"), evenEvtSelect, oddEvtSelect] app.OutStream = [outDelegate] EventDataSvc(ForceLeaves=True) #from Gaudi.Configuration import VERBOSE #from Configurables import MessageSvc #MessageSvc(OutputLevel=VERBOSE)
from Configurables import HepMCConverter # reads an HepMC::GenEvent from the data service and writes # a collection of EDM Particles hepmc_converter = HepMCConverter("Converter") # the input product name matches the output product name of the previous module hepmc_converter.Inputs.hepmc.Path = "hepmc" hepmc_converter.Outputs.genparticles.Path = "all_genparticles" from Configurables import GenParticleFilter genfilter = GenParticleFilter("StableParticles") genfilter.Inputs.genparticles.Path = "all_genparticles" genfilter.Outputs.genparticles.Path = "genparticles" from Configurables import JetClustering_MCParticleCollection_GenJetCollection_GenJetParticleAssociationCollection_ as JetClustering genjet_clustering = JetClustering("GenJetClustering", verbose=False) genjet_clustering.Inputs.particles.Path = 'genparticles' # giving a meaningful name for the output product genjet_clustering.Outputs.jets.Path = 'genjets' genjet_clustering.Outputs.constituents.Path = 'genjets_particles' from Configurables import AlbersWrite, AlbersOutput out = AlbersOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] ApplicationMgr( TopAlg=[pythia8gen, hepmc_converter, genfilter, genjet_clustering, out], EvtSel='NONE', EvtMax=100, ExtSvc=[albersevent], OutputLevel=DEBUG)
out = PodioOutput("out", filename="output_BarrelTopo_50GeVe_3ev.root", OutputLevel=DEBUG) out.outputCommands = [ "drop *", "keep GenParticles", "keep GenVertices", "keep caloClustersBarrel", "keep caloClusterBarrelCells", "keep caloClusterBarrelCellPositions" ] #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] podioinput.AuditExecute = True createemptycells.AuditExecute = True createTopoClusters.AuditExecute = True positionsClusterBarrel.AuditExecute = True out.AuditExecute = True ApplicationMgr( TopAlg=[ podioinput, createemptycells, createTopoClusters, positionsClusterBarrel, out ], EvtSel='NONE', EvtMax=3, ExtSvc=[geoservice, podioevent, audsvc], #OutputLevel = VERBOSE )
#CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] genalg_pgun.AuditExecute = True hepmc_converter.AuditExecute = True geantsim.AuditExecute = True createEcalBarrelCellsStep1.AuditExecute = True resegmentEcalBarrel.AuditExecute = True createEcalBarrelCells.AuditExecute = True createHcalBarrelCells.AuditExecute = True out.AuditExecute = True from Configurables import ApplicationMgr ApplicationMgr( TopAlg = [genalg_pgun, hepmc_converter, geantsim, createEcalBarrelCellsStep1, resegmentEcalBarrel, createEcalBarrelCells, createHcalBarrelCells, out ], EvtSel = 'NONE', EvtMax = 10, ExtSvc = [geoservice, podioevent, geantservice, audsvc], )
from Configurables import DetSimSvc detsimsvc = DetSimSvc("DetSimSvc") from Configurables import DetSimAlg detsimalg = DetSimAlg("DetSimAlg") detsimalg.RandomSeeds = seed # detsimalg.VisMacs = ["vis.mac"] detsimalg.RunCmds = [ # "/tracking/verbose 1", ] detsimalg.AnaElems = [ # example_anatool.name() # "ExampleAnaElemTool", "Edm4hepWriterAnaElemTool" ] detsimalg.RootDetElem = "WorldDetElemTool" # output from Configurables import PodioOutput out = PodioOutput("outputalg") out.filename = "RCEcalSim00.root" out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr(TopAlg=[genalg, detsimalg, out], EvtSel='NONE', EvtMax=10, ExtSvc=[rndmengine, rndmgensvc, dsvc, geosvc], OutputLevel=INFO)
) createclusters.clusters.Path = "caloClusters" out = PodioOutput("output", filename = "output_ecalReco_noiseFromFile_test.root", OutputLevel = DEBUG) out.outputCommands = ["keep *"] #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] podioinput.AuditExecute = True createclusters.AuditExecute = True createcells.AuditExecute = True mergelayers.AuditExecute = True out.AuditExecute = True ApplicationMgr( TopAlg = [podioinput, mergelayers, createcells, createemptycells, createclusters, out ], EvtSel = 'NONE', EvtMax = 1, ExtSvc = [podioevent, geoservice], )
pgun = SimG4SingleParticleGeneratorTool("GeantinoGun", etaMin=-5, etaMax=5, particleName="geantino") geantsim = SimG4Alg("SimG4Alg", outputs=[ "SimG4SaveTrackerHits/saveTrackerHits", "SimG4SaveTrajectory/saveTrajectory" ], eventProvider=pgun) from Configurables import CompareTrackHitPositionAndCellId comparison = CompareTrackHitPositionAndCellId() comparison.hits.Path = "hits" comparison.positionedHits.Path = "positionedHits" # PODIO algorithm from Configurables import PodioOutput out = PodioOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[geantsim, comparison, out], EvtSel='NONE', EvtMax=1000, # order is important, as GeoSvc is needed by SimG4Svc ExtSvc=[podioevent, geoservice, geantservice], OutputLevel=DEBUG)
#!/usr/bin/env python from Gaudi.Configuration import * from Configurables import k4DataSvc dsvc = k4DataSvc("EventDataSvc") from Configurables import Edm4hepWriteAlg alg = Edm4hepWriteAlg("Edm4hepWriteAlg") alg.HeaderOut.Path = "EventHeader" alg.MCParticleOut.Path = "MCParticle" from Configurables import PodioOutput out = PodioOutput("out") out.filename = "test.root" out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( TopAlg = [alg, out], EvtSel = 'NONE', EvtMax = 10, ExtSvc=[dsvc], OutputLevel=DEBUG )
# guntool = ParticleGun("SignalProvider", PdgCodes=[211, 22, 11, -13, 2112, 2212]) guntool = ParticleGun("SignalProvider", PdgCodes=[11]) gun = GenAlg('ParticleGunAlg', SignalProvider=guntool) gun.hepmc.Path = "hepmcevent" ### Reads an HepMC::GenEvent from the data service and writes a collection of EDM Particles hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmcevent" hepmc_converter.genparticles.Path = "GenParticle" hepmc_converter.genvertices.Path = "Genvertex" # from CMS_detector_cfg import detservice from SCTau_detector_cfg import detservice from papas_cfg import papasalg #output fcc particles to root # out = PodioOutput("out", OutputLevel=INFO) out = PodioOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] ApplicationMgr( ## all algorithms should be put here TopAlg=[gun, hepmc_converter, papasalg, out], EvtSel='NONE', ## number of events EvtMax=100000, ## all services should be put here ExtSvc=[podioevent, detservice, particlePropertySvc], OutputLevel=DEBUG, SvcOptMapping=["Gaudi::ParticlePropertySvc/ParticlePropertySvc"])
from Gaudi.Configuration import * from Configurables import ApplicationMgr, Geant4Test, GeoSvc #geant4 = Geant4GeoConverterTool("Geant4GeoConverterTool") #detservice = DD4HepDetDesSvc("DD4HepDetDesSvc", OutputLevel = VERBOSE) detservice = GeoSvc("GeoSvc", OutputLevel = VERBOSE) test = Geant4Test("Geant4Test") ApplicationMgr(EvtSel='NONE', EvtMax=1, ExtSvc = [detservice], TopAlg=[test])
from Gaudi.Configuration import * from Configurables import ApplicationMgr ApplicationMgr().EvtSel = "NONE" ApplicationMgr().EvtMax = 1 ApplicationMgr().OutputLevel = INFO from Configurables import k4FWCoreTest_HelloWorldAlg producer = k4FWCoreTest_HelloWorldAlg("HelloWorldAlg1") producer.PerEventPrintMessage = "Hello World !" ApplicationMgr().TopAlg += [producer] from Configurables import k4FWCoreTest_HelloWorldAlg producer2 = k4FWCoreTest_HelloWorldAlg("HelloWorldAlg2") producer2.PerEventPrintMessage = "Hello World2 !" ApplicationMgr().TopAlg += [producer2]
from Gaudi.Configuration import * from Configurables import k4DataSvc podioevent = k4DataSvc("EventDataSvc") from Configurables import TestAlgorithmWithTFile producer = TestAlgorithmWithTFile() from Configurables import PodioOutput out = PodioOutput("out") out.filename = "output_TestAlgorithmWithTFile_framework.root" out.outputCommands = ["keep *"] from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[producer, out], EvtSel="NONE", EvtMax=100, ExtSvc=[podioevent], OutputLevel=INFO, StopOnSignal=True, )
full.SiTracks = "SubsetTracks" full.OutputTracks = "MarlinTrkTracks" full.SITHitToTrackDistance = 3. full.SETHitToTrackDistance = 5. #full.OutputLevel = DEBUG #TODO: more reconstruction, PFA etc. # output from Configurables import PodioOutput out = PodioOutput("outputalg") out.filename = "CRD_o1_v02-SimRec00.root" out.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( #TopAlg = [genalg, detsimalg, digiVXD, digiSIT, digiSET, digiFTD, spSET, spFTD, digiDC, tracking, forward, subset, clupatra, full, out], TopAlg=[ genalg, detsimalg, digiVXD, digiSIT, digiSET, digiFTD, spSET, spFTD, digiDC, tracking, forward, subset, full, out ], EvtSel='NONE', EvtMax=10, ExtSvc=[ rndmengine, rndmgensvc, dsvc, evtseeder, geosvc, gearsvc, tracksystemsvc ], HistogramPersistency='ROOT', OutputLevel=INFO)
hepmc_converter = HepMCToEDMConverter("Converter") hepmc_converter.hepmc.Path = "hepmcevent" hepmc_converter.hepmcStatusList = [] # convert particles with all statuses hepmc_converter.genparticles.Path = "all_genparticles" hepmc_converter.genvertices.Path = "all_genvertices" from Configurables import GenParticleFilter ### Filters generated particles # accept is a list of particle statuses that should be accepted genfilter = GenParticleFilter("StableParticles", accept=[1], OutputLevel=DEBUG) genfilter.allGenParticles.Path = "all_genparticles" genfilter.filteredGenParticles.Path = "genparticles" from Configurables import JetClustering_fcc__MCParticleCollection_fcc__GenJetCollection_ as JetClustering genjet_clustering = JetClustering("GenJetClustering", OutputLevel=DEBUG) genjet_clustering.particles.Path = 'genparticles' genjet_clustering.jets.Path = 'genjets' from Configurables import PodioOutput ### PODIO algorithm out = PodioOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] from Configurables import ApplicationMgr ApplicationMgr( TopAlg=[pythia8gen, hepmc_converter, genfilter, genjet_clustering, out], EvtSel='NONE', EvtMax=2, ExtSvc=[podioevent], OutputLevel=INFO)
out.outputCommands = ["keep *"] out.filename = output_name THistSvc().Output = [ "rec DATAFILE='hist_" + output_name + "' TYP='ROOT' OPT='RECREATE'" ] THistSvc().PrintAll = True THistSvc().AutoSave = True THistSvc().AutoFlush = False THistSvc().OutputLevel = INFO #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] out.AuditExecute = True list_of_algorithms = [podioinput, createemptycells, createclusters] if noise: list_of_algorithms += [ createEcalBarrelCells, createclustersNoise, correctedClustersNoise ] list_of_algorithms += [out] ApplicationMgr(TopAlg=list_of_algorithms, EvtSel='NONE', EvtMax=num_events, ExtSvc=[podioevent, geoservice])
import os from GaudiKernel import SystemOfUnits as units from GaudiKernel import PhysicalConstants as constants from Gaudi.Configuration import * from Configurables import ApplicationMgr main = ApplicationMgr() main.EvtSel = 'NONE' main.EvtMax = 10 main.TopAlg = [] main.ExtSvc = [] # PODIO algorithm from Configurables import FCCDataSvc podioevent = FCCDataSvc("EventDataSvc") main.ExtSvc += [podioevent] ### Generation ################################################# from Configurables import GaussSmearVertex smeartool = GaussSmearVertex() smeartool.xVertexSigma = 0.5 * units.mm smeartool.yVertexSigma = 0.5 * units.mm smeartool.zVertexSigma = 40.0 * units.mm smeartool.tVertexSigma = 180.0 * units.picosecond from Configurables import ConstPtParticleGun pgun_tool = ConstPtParticleGun() pgun_tool.PdgCodes = [13] pgun_tool.PhiMin = 0.0
'Overlap', # #Shots = 1000 , Shots=50, # Volume="/dd/Geometry/LHCb/lvLHCb" #Volume = "/dd/Geometry/MagnetRegion/Magnet/Magnet" ) from Configurables import TransportSvc TransportSvc(Recovery=True) from Configurables import ApplicationMgr ApplicationMgr(TopAlg=[check], EvtSel='NONE', EvtMax=1) # ============================================================================= if "__main__" == __name__: print __doc__ print __author__ print __version__ from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.run(1) # =============================================================================
OutputLevel=DEBUG) createcellsEndcap.hits.Path = "ECalEndcapHits" createcellsEndcap.cells.Path = "ECalEndcapCells" out = PodioOutput("out", filename="output_ecalInclinedWithEndcapDigi_test.root", OutputLevel=DEBUG) out.outputCommands = ["keep *"] #CPU information from Configurables import AuditorSvc, ChronoAuditor chra = ChronoAuditor() audsvc = AuditorSvc() audsvc.Auditors = [chra] geantsim.AuditExecute = True createcellsBarrel.AuditExecute = True positionsEcalBarrel.AuditExecute = True resegmentEcal.AuditExecute = True createcellsEndcap.AuditExecute = True out.AuditExecute = True ApplicationMgr( TopAlg=[ geantsim, createcellsBarrel, positionsEcalBarrel, resegmentEcal, createcellsEndcap, out ], EvtSel='NONE', EvtMax=1, ExtSvc=[podioevent, geoservice], )
"InspectHitsCollectionsTool/inspect" ]) from Configurables import MergeCells merge = MergeCells( "mergeCells", # take the bitfield description from the geometry service readout="ECalHits", # cells in which field should be merged identifier="x", # how many cells to merge # for signed fields (segmentation cells) this needs to be odd to keep middle cell centred in 0 # for unsigned field (volumes) this may be any number merge=3, OutputLevel=DEBUG) merge.DataInputs.inhits.Path = "caloHits" merge.DataOutputs.outhits.Path = "newCaloHits" from Configurables import FCCDataSvc, PodioOutput podiosvc = FCCDataSvc("EventDataSvc") out = PodioOutput("out", filename="testMergeCells.root") out.outputCommands = ["keep *"] ApplicationMgr(EvtSel='NONE', EvtMax=30, TopAlg=[reader, hepmc_converter, geantsim, merge, out], ExtSvc=[podiosvc, geoservice, geantservice], OutputLevel=DEBUG)
import os from Gaudi.Configuration import * from GaudiKernel import SystemOfUnits as units from GaudiKernel import PhysicalConstants as constants from Configurables import ApplicationMgr ApplicationMgr().EvtSel = 'NONE' ApplicationMgr().EvtMax = 2 ApplicationMgr().OutputLevel = INFO ApplicationMgr().ExtSvc += ['RndmGenSvc'] from Configurables import FCCDataSvc ## Data service podioevent = FCCDataSvc("EventDataSvc") ApplicationMgr().ExtSvc += [podioevent] # from Configurables import HepMCReader from Configurables import HepEVTReader reader = HepEVTReader("HepEVTReader") reader.HepEVTFilename = 'input_example_GuineaPig.hepevt' reader.GenParticles.Path = "GenParticles" ApplicationMgr().TopAlg += [reader] # DD4hep geometry service from Configurables import GeoSvc ## parse the given xml file path_to_detectors = os.environ.get("FCCDETECTORS", "") geoservice = GeoSvc("GeoSvc") geoservice.detectors = [ os.path.join(path_to_detectors, 'Detector/DetFCCeeCLD/compact/FCCee_o2_v02/FCCee_o2_v02.xml'),
OutputLevel = DEBUG) from Configurables import SimG4Alg, SimG4SaveCalHits, SimG4PrimariesFromEdmTool ## Geant4 algorithm # Translates EDM to G4Event, passes the event to G4, writes out outputs via tools # first, create a tool that saves the calorimeter hits (of type "hcal") # Name of that tool in GAUDI is "XX/YY" where XX is the tool class name ("SimG4SaveTrackerHits") # and YY is the given name ("saveTrackerHits") savehcaltool = SimG4SaveCalHits("saveHCalHits", readoutNames = ["BarHCal_Readout"]) savehcaltool.DataOutputs.positionedCaloHits.Path = "positionedCaloHits" savehcaltool.DataOutputs.caloHits.Path = "caloHits" # next, create the G4 algorithm, giving the list of names of tools ("XX/YY") particle_converter = SimG4PrimariesFromEdmTool("EdmConverter") particle_converter.DataInputs.genParticles.Path = "allGenParticles" geantsim = SimG4Alg("SimG4Alg", outputs = ["SimG4SaveCalHits/saveHCalHits"], eventProvider=particle_converter) from Configurables import PodioOutput out = PodioOutput("out", OutputLevel=DEBUG) out.outputCommands = ["keep *"] from Configurables import ApplicationMgr ApplicationMgr( TopAlg=mc_particle_algs + [geantsim, out], EvtSel='NONE', EvtMax=1, # order is important, as GeoSvc is needed by SimG4Svc ExtSvc=mc_particle_svcs + [podioevent, geoservice, geantservice], OutputLevel=DEBUG)
#genMonitor = GaudiSequencer( "GenMonitor" ) #genMonitor.Members += [ "DumpHepMCTree/DumpSignal", "DumpHepMC/DumpAll"] #delphesMonitor = GaudiSequencer( "DelphesMonitor" ) #delphesMonitor.Members += [ "PrintMCDecayTreeAlg/PrintMCInputDelphes", "PrintMCDecayTreeAlg/PrintMCOutputDelphes" ] #from Configurables import PrintMCDecayTreeAlg #PrintMCDecayTreeAlg("PrintMCOutputDelphes").MCParticleLocation = "MCFast/MCParticles" #PrintMCDecayTreeAlg("PrintMCOutputDelphes").MCParticleLocation = "Rec/Track/Best" #PrintMCDecayTreeAlg("PrintMCOutputDelphes").MCParticleLocation = "Rec/ProtoP/Charged" #PrintMCDecayTreeAlg("PrintMCOutputDelphes").MCParticleLocation = "Rec/ProtoP/Neutrals" #--Set name of output files for given job and read in options idFile = 'Gauss_' + str(eventType) HistogramPersistencySvc().OutputFile = idFile + '_histos.root' #--- Save ntuple with hadronic cross section information ApplicationMgr().ExtSvc += ["NTupleSvc"] NTupleSvc().Output = [ "FILE1 DATAFILE='GaussTuple_{idFile}.root' TYP='ROOT' OPT='NEW'".format( idFile=eventType) ] FileCatalog().Catalogs = ["xmlcatalog_file:Gauss_LbDelphes_0.xml"] #write to TES def writeHits(): OutputStream("GaussTape").ItemList.append("/Event/MC/Vertices#1") OutputStream("GaussTape").ItemList.append("/Event/MC/Particles#1") OutputStream("GaussTape").ItemList.append("/Event/MCFast/MCParticles#1") OutputStream("GaussTape").ItemList.append( "/Event/MCFast/MCSimpleParticles#1")
from Configurables import (ApplicationMgr, GaudiSequencer, GaudiTesting__OddEventsFilter as OddEvents, GaudiTesting__EvenEventsFilter as EvenEvents, SubAlg as EmptyAlg, OutputStream, InputCopyStream) oddEvtSelect = GaudiSequencer('OddEventsSelection') oddEvtSelect.Members = [OddEvents('OddEvents'), OutputStream('Stream1')] evenEvtSelect = GaudiSequencer('EvenEventsSelection') evenEvtSelect.Members = [EvenEvents('EvenEvents'), InputCopyStream('Stream2')] app = ApplicationMgr(EvtSel='NONE', EvtMax=4) app.TopAlg = [EmptyAlg("EventInit"), evenEvtSelect, oddEvtSelect] # Extension used to enforce deferring from Configurables import (ApplicationMgr, EventDataSvc, ReplayOutputStream, SubAlg as EmptyAlg) app = ApplicationMgr() app.AlgTypeAliases['OutputStream'] = 'RecordOutputStream' app.AlgTypeAliases['InputCopyStream'] = 'RecordOutputStream' EventDataSvc(ForceLeaves=True) outDelegate = ReplayOutputStream() outDelegate.OutputStreams = [EmptyAlg('Deferred:Stream1'),