def configure(datafiles, catalogs=[], castor=False): """ Configure the job """ from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from PhysConf.Filters import LoKi_Filters ## "/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine" fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonHighMass.*Decision' ) """, VOID_Code=""" 0 < CONTAINS ('/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles') """) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, ## HistogramFile='Chib_Histos.root', TupleFile='Chib_Tuples.root', ## Lumi=True, ## ) ## from Configurables import CondDB ## CondDB ( UseLatestTags = ["2011"] , ## UseOracle = True ) from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # come back to Bender setData(datafiles, catalogs, castor) gaudi = appMgr() alg = Chib( 'Chib', ## Algorithm name , # input particles Inputs=[ '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles', '/Event/Phys/StdLooseAllPhotons/Particles' ], # take care about the proper particle combiner ParticleCombiners={'': 'LoKi::VertexFitter'}) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
def configure_common(rootInTES, datafiles, catalogs=[], castor=False): """ Job configuration """ from Configurables import DaVinci # needed for job configuration from Configurables import EventSelector # needed for job configuration from Configurables import FileCatalog # needed for job configuration from Configurables import NTupleSvc # needed for job configuration from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*CharmAndDiMuon.*Decision' ) | HLT_PASS_RE ( 'Stripping.*DiMuonAndCharm.*Decision' ) | HLT_PASS_RE ( 'Stripping.*DiCharm.*Decision' ) | HLT_PASS_RE ( 'Stripping.*DoubleDiMuon.*Decision' ) """ ) filters = fltrs.filters('Filters') # filters.reverse() davinci = DaVinci( DataType='2011', InputType='MDST', Simulation=False, PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, # HistogramFile='2xCharm_Histos.root', TupleFile='2xCharm.root', # Lumi=True, # ) from Configurables import CondDB CondDB(UseLatestTags=["2011"], ## UseOracle = True ) # from Configurables import Gaudi__IODataManager as IODataManager # IODataManager().AgeLimit = 2 # ------- decoding set-up start ---------- from Bender.MicroDST import uDstConf uDstConf(rootInTES) logger.info("Configure RootInTES: %s " % rootInTES) # ------- decoding set-up end ----------- # come back to Bender setData(datafiles, catalogs, castor) return SUCCESS
def configure(datafiles, catalogs=[], castor=False): """ Configure the job """ from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonInc.*Decision' ) """, VOID_Code=""" 0 < CONTAINS ('/Event/Leptonic/Phys/MicroDSTDiMuonDiMuonIncLine/Particles') """) filters = fltrs.filters('Filters') davinci = DaVinci( DataType='2012', PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, ## HistogramFile='Jpsi_Histos.root', TupleFile='Jpsi_Tuples.root', ## Lumi=True, ## ) ## from Configurables import CondDB ## CondDB ( UseLatestTags = ["2011"] , ## UseOracle = True ) RootInTES = 'Leptonic' from BenderTools.MicroDST import uDstConf uDstConf(RootInTES) from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # come back to Bender setData(datafiles, catalogs, castor) gaudi = appMgr() alg = Jpsi( 'Jpsi', ## Algorithm name , # input particles Inputs=['Phys/MicroDSTDiMuonDiMuonIncLine'], RootInTES=RootInTES) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
def configure(datafiles, catalogs=[], castor=False): """ Job configuration """ from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( VOID_Code= " 0.5 < CONTAINS('/Event/Charm/Phys/DstarForPromptCharm/Particles') ") ## ## 1. Static configuration using "Configurables" ## from Configurables import DaVinci davinci = DaVinci( DataType='2010', InputType='MDST', PrintFreq=1000, EventPreFilters=fltrs.filters('Filters'), HistogramFile='RealDstar_CHARM_Histos.root', TupleFile='RealDstar_CHARM.root', ## Lumi=True) from Configurables import CondDB CondDB(UseLatestTags=['2010']) from Configurables import NTupleSvc ntSvc = NTupleSvc() ## define the input data: setData(datafiles, catalogs, castor) ## ## 2. Jump into the wonderful world of the actual Gaudi components! ## ## get the actual application manager (create if needed) gaudi = appMgr() ## create local algorithm: alg = Dstar( # 'Dstar', ## Algorithm name # ## RecoStripping-09 conventions! RootInTES='/Event/Charm', Inputs=['Phys/DstarForPromptCharm/Particles'] ## input particles ) ## finally inform Application Manager about our algorithm userSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) userSeq.Members += [alg.name()] return SUCCESS
def configure(datafiles, catalogs=[], params={}, castor=False): from Configurables import DaVinci from Configurables import EventSelector from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( VOID_Code=""" 0 < CONTAINS ('/Event/PSIX/Phys/SelPsi3KPiForPsiX/Particles') """ ) filters = fltrs.filters('Filters') daVinci = DaVinci( DataType=params['year'], PrintFreq=1000, EvtMax=-1, # TupleFile='Bu2JpsiKpipi.root', EventPreFilters=filters, # Lumi=True, #RootInTES = 'PSIX' # ) from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # define input data setData(datafiles, catalogs, castor) # # Dynamic Configuration: Jump into the wonderful world of GaudiPython # # get the actual application manager (create if needed) gaudi = appMgr() # create local algorithm: alg = Bu2JpsiKpipi( 'JpsiKpipi', # input particles : RootInTES='/Event/PSIX', Inputs=['Phys/SelPsi3KPiForPsiX/Particles'] ) mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] # gaudi.addAlgorithm ( alg ) return SUCCESS
def configure(inputdata, catalogs=[]): """ The configuration of the job """ ## Define event-level filters: from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*ForPromptCharm.*Decision' ) """, VOID_Code=""" ( 0.5 < CONTAINS ('/Event/Charm/Phys/DForPromptCharm/Particles' ) ) | ( 0.5 < CONTAINS ('/Event/Charm/Phys/DsForPromptCharm/Particles' ) ) """) filters = fltrs.filters('Filters') filters.reverse() from Configurables import DaVinci, GaudiSequencer DaVinci(DataType='2011', EventPreFilters=filters, Lumi=False, HistogramFile='Dplus_Histos.root', TupleFile='Dplus_Tuples.root') from Configurables import CondDB CondDB(IgnoreHeartBeat=True) setData(inputdata, catalogs) ## get/create Application Manager gaudi = appMgr() # modify/update the configuration: ## create the algorithm alg = SelectDplus( 'Dplus', ## Reco10-Stripping13 : RootInTES='/Event/Charm', # Inputs=[ 'Phys/DForPromptCharm/Particles', 'Phys/DsForPromptCharm/Particles' ]) ## add algorithm into DaVinci sequence dvUser = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) dvUser.Members += [alg.name()] return SUCCESS
def configure ( inputdata , ## the list of input files catalogs = [] , ## xml-catalogs (filled by GRID) castor = False , ## use the direct access to castor/EOS ? params = {} ) : ## import DaVinci from Configurables import DaVinci from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( VOID_Code = """ 0 < CONTAINS('/Event/Rec/Vertex/V0') """ ) dv = DaVinci ( DataType = '2015' , InputType = 'RDST' , EventPreFilters = fltrs.filters('V0') , TupleFile = 'V0Tuples.root' , ## IMPORTANT HistogramFile = 'V0Histos.root' , ## IMPORTANT ) ## add the name of Bender algorithm into User sequence sequence alg_name = 'V0' dv.UserAlgorithms += [ alg_name ] from StandardParticles import StdKs2PiPiLL , StdKs2PiPiDD from StandardParticles import StdLambda2PPiLL , StdLambda2PPiDD ## define the input data setData ( inputdata , catalogs , castor ) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = V0 ( alg_name , Inputs = [ StdKs2PiPiLL.outputLocation () , StdKs2PiPiDD.outputLocation () , StdLambda2PPiLL.outputLocation () , StdLambda2PPiDD.outputLocation () , ] ) return SUCCESS
def configure( inputdata, ## the list of input files catalogs=[], ## xml-catalogs (filled by GRID) castor=False, ## use the direct access to castor/EOS ? params={}): ## read only events with Detached J/psi line fired Jpsi_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')") ## import DaVinci from Configurables import DaVinci ## delegate the actual configuration to DaVinci dv = DaVinci( EventPreFilters=fltrs.filters('Filters'), ## IMPORTANT Simulation=True, ## IMPORTANT DDDBtag='dddb-20130929-1', ## IMPORTANT CondDBtag='sim-20130522-1-vc-mu100', ## IMPORTANT DataType='2012', InputType='DST', PrintFreq=10, TupleFile='MCmatch.root') ## add the name of Bender algorithm into User sequence sequence alg_name = 'MCmatch' dv.UserAlgorithms += [alg_name] from StandardParticles import StdLooseKaons kaons = StdLooseKaons.outputLocation() from StandardParticles import StdLoosePions pions = StdLoosePions.outputLocation() ## define the input data setData(inputdata, catalogs, castor) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = MCmatch( alg_name, Inputs=[Jpsi_location, kaons, pions], ParticleCombiners={'': 'LoKi::VertexFitter'}, PPMCs=["Relations/Rec/ProtoP/Charged"] ## to speedup a bit ) return SUCCESS
def configure( inputdata, ## the list of input files catalogs=[], ## xml-catalogs (filled by GRID) castor=False, ## use the direct access to castor/EOS ? params={}): ## import DaVinci from Configurables import DaVinci ## delegate the actual configuration to DaVinci rootInTES = '/Event/PSIX' the_line = 'Phys/SelPsi2KPiForPsiX/Particles' from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(VOID_Code=""" 0 < CONTAINS('%s/%s') """ % (rootInTES, the_line)) dv = DaVinci( DataType='2012', InputType='MDST', RootInTES=rootInTES, EventPreFilters=fltrs.filters('WG'), TupleFile='TisTosTuples.root' ## IMPORTANT ) ## add the name of Bender algorithm into User sequence sequence alg_name = 'Fake' dv.UserAlgorithms += [alg_name] ## define the input data setData(inputdata, catalogs, castor) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = FakeParticle( alg_name, RootInTES=rootInTES, ## we are reading uDST Inputs=[the_line]) return SUCCESS
def configure( inputdata, ## the list of input files catalogs=[], ## xml-catalogs (filled by GRID) castor=False, ## use the direct access to castor/EOS ? params={}): ## read only events with Detached J/psi line fired Jpsi_location = '/Event/Dimuon/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')") ## import DaVinci from Configurables import DaVinci ## delegate the actual configuration to DaVinci dv = DaVinci( EventPreFilters=fltrs.filters('Filters'), ## IMPORTANT DataType='2012', InputType='DST', TupleFile='MakeB.root') ## add the name of Bender algorithm into User sequence sequence alg_name = 'MakeB' dv.UserAlgorithms += [alg_name] from StandardParticles import StdLooseKaons kaons = StdLooseKaons.outputLocation() ## define the input data setData(inputdata, catalogs, castor) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = MakeB(alg_name, Inputs=[Jpsi_location, kaons], ParticleCombiners={'': 'LoKi::VertexFitter'}) return SUCCESS
def configure( inputdata , catalogs = [] ) : """ The configuration of the job """ ## define event-levele filters: from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( HLT_Code = " HLT_PASS_RE ('Hlt1MBMicro.*Decision') | HLT_PASS_RE ('Hlt1.*Hadron.*Decision') " , STRIP_Code = " HLT_PASS('StrippingK0SLineDecision') " , VOID_Code = " EXISTS ('/Event/V0') " ) from Configurables import DaVinci , GaudiSequencer DaVinci ( DataType = '2010' , EventPreFilters = fltrs.filters ('Filters') , Lumi = False ) from Configurables import CondDB CondDB ( IgnoreHeartBeat = True ) setData ( inputdata , catalogs ) ## get/create Application Manager gaudi = appMgr() # modify/update the configuration: ## create the algorithm alg = SelectKs ( 'SelectKs' , RootInTES = '/Event/V0' , InputLocations = [ 'StrippingK0S' ] ) ## add algorithm into main DaVinci sequence dvMain = gaudi.algorithm('GaudiSequencer/DaVinciMainSequence' , True ) dvMain.Members += [ alg.name() ] return SUCCESS
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ logger.info("start: params: %s " % params) from BenderTools.Parser import hasInFile the_year = "2011" if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) # # dimuon locations in DIMUON.DST # Jpsi_det_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' Jpsi_unb_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuTOSLine/Particles' if hasInFile(datafiles, '/MC/MC11a/'): Jpsi_unb_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuLine/Particles' logger.warning('Rename ``unbised line'' to be %s ' % Jpsi_unb_location) from PhysSelPython.Wrappers import AutomaticData jpsi_det = AutomaticData(Location=Jpsi_det_location) jpsi_unb = AutomaticData(Location=Jpsi_unb_location) # pions : from GaudiConfUtils.ConfigurableGenerators import FilterDesktop alg_pions = FilterDesktop( # Preambulo=["from LoKiPhysMC.decorators import mcMatch"], Code=""" ( PT > 500 * MeV ) & ( CLONEDIST > 5000 ) & ( TRGHOSTPROB < 0.5 ) & ( TRCHI2DOF < 4 ) & in_range ( 2 , ETA , 5 ) & HASRICH & mcMatch( '[B_c+ => ( J/psi(1S) => mu+ mu- ) ^pi+ ]CC' , 1 ) """ , ) ## ( PROBNNpi > 0.10 ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllLoosePions pions = Selection( "ThePions", Algorithm=alg_pions, RequiredSelections=[StdAllLoosePions] ) alg_kaons = FilterDesktop( # Preambulo=["from LoKiPhysMC.decorators import mcMatch"], Code=""" ( PT > 500 * MeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.5 ) & in_range ( 2 , ETA , 5 ) & HASRICH & mcMatch( '[B+ => ( J/psi(1S) => mu+ mu- ) ^K+ ]CC' , 1 ) """ ) ## ( PROBNNk > 0.10 ) from StandardParticles import StdAllLooseKaons kaons = Selection( "TheKaons", Algorithm=alg_kaons, RequiredSelections=[StdAllLooseKaons] ) # Preambulo = [ # shortcut for chi2 of vertex fit "chi2vx = VFASPF(VCHI2)", # shortcut for the c*tau "from GaudiKernel.PhysicalConstants import c_light", # use the embedded cut for chi2(LifetimeFit)<16 "ctau_25 = BPVLTIME ( 25 ) * c_light ", "mbc_acut = in_range ( 6.050 * GeV , AM , 6.550 * GeV ) ", "mbp_acut = in_range ( 5.100 * GeV , AM , 5.550 * GeV ) ", # mass-cut for beauty particles "mbc_cut = in_range ( 6.100 * GeV , M , 6.500 * GeV ) ", "mbp_cut = in_range ( 5.150 * GeV , M , 5.500 * GeV ) ", # "from LoKiPhysMC.decorators import mcMatch" ] # Bc : from GaudiConfUtils.ConfigurableGenerators import CombineParticles alg_bc = CombineParticles( DecayDescriptor="[B_c+ -> J/psi(1S) pi+ ]cc", DaughtersCuts={ "J/psi(1S)": "mcMatch( '[ B_c+ => ^( J/psi(1S) => mu+ mu- ) pi+ ]CC' , 1 )" }, Preambulo=Preambulo, CombinationCut=" mbc_acut ", MotherCut=""" ( chi2vx < 25 ) & mbc_cut & ( ctau_25 > %s ) & mcMatch( '[ B_c+ => ( J/psi(1S) => mu+ mu- ) pi+ ]CC' , 1 ) """ % ( 40 * micrometer ) ) # B+ : alg_bu = CombineParticles( DecayDescriptor="[B+ -> J/psi(1S) K+ ]cc", DaughtersCuts={ "J/psi(1S)": "mcMatch( '[ B+ => ^( J/psi(1S) => mu+ mu- ) K+ ]CC' , 1 )" }, Preambulo=Preambulo, CombinationCut=" mbp_acut ", MotherCut=""" ( chi2vx < 25 ) & mbp_cut & ( ctau_25 > %s ) & mcMatch( '[ B+ => ( J/psi(1S) => mu+ mu- ) K+ ]CC' , 1 ) """ % ( 40 * micrometer ) ) sel_bc_det = Selection( "TheBc_det", Algorithm=alg_bc, RequiredSelections=[jpsi_det, pions] ) sel_bc_unb = Selection( "TheBc_unb", Algorithm=alg_bc, RequiredSelections=[jpsi_unb, pions] ) sel_bu_det = Selection( "TheB_det", Algorithm=alg_bu, RequiredSelections=[jpsi_det, kaons] ) sel_bu_unb = Selection( "TheB_unb", Algorithm=alg_bu, RequiredSelections=[jpsi_unb, kaons] ) from PhysSelPython.Wrappers import SelectionSequence Bc_det_seq = SelectionSequence("Bc_det", TopSelection=sel_bc_det) Bu_det_seq = SelectionSequence("Bu_det", TopSelection=sel_bu_det) Bc_unb_seq = SelectionSequence("Bc_unb", TopSelection=sel_bc_unb) Bu_unb_seq = SelectionSequence("Bu_unb", TopSelection=sel_bu_unb) # # selection sequence # mode = params['Mode'] mode = mode.upper() if 0 <= mode.find('BC') or 0 <= mode.find('PI'): seqs = [Bc_det_seq, Bc_unb_seq] # seqs = [ Bc_det_seq ] elif 0 <= mode.find('B+') or 0 <= mode.find('K+'): seqs = [Bu_det_seq, Bu_unb_seq] # seqs = [ Bu_det_seq ] else: raise from PhysSelPython.Wrappers import MultiSelectionSequence B_SEQ = MultiSelectionSequence( "B2PSI", Sequences=seqs, ) from DSTWriters.Configuration import (SelDSTWriter, stripMicroDSTStreamConf, stripMicroDSTElements) # Configuration of SelDSTWriter SelDSTWriterConf = { 'default': stripMicroDSTStreamConf(pack=False)} SelDSTWriterElements = { 'default': stripMicroDSTElements(pack=False)} udstWriter = SelDSTWriter( "MyMicroDSTWriter", StreamConf=SelDSTWriterConf, MicroDSTElements=SelDSTWriterElements, OutputFileSuffix='MCBSEQ', SelectionSequences=[B_SEQ] ) # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMu.*')", VOID_Code=""" ( 0.5 < CONTAINS('%s') ) | ( 0.5 < CONTAINS('%s') ) """ % ( Jpsi_det_location , Jpsi_unb_location ) ) # fltrs_0 = LoKi_Filters( VOID_Code=""" ( EXISTS ( '/Event/DAQ/RawEvent') | EXISTS('/Event/Trigger/RawEvent' ) ) & EXISTS ( '/Event/Strip/Phys/DecReports') & ( RECSUMMARY ( 0 , -1 ) > 0.5 ) """ ) # # finally: DaVinci # ## needed for job configuration from Configurables import DaVinci davinci = DaVinci( EventPreFilters=fltrs_0.filters( 'Filters0') + fltrs.filters('Filters1'), DataType=the_year, InputType='MDST', Simulation=True, PrintFreq=1000, EvtMax=-1, # HistogramFile='MCBc_Histos.root', TupleFile='MCBc.root', # DDDBtag=params['DDDB'], CondDBtag=params['SIMCOND'], # Lumi=False # True , # ) davinci.appendToMainSequence([udstWriter.sequence()]) # # come back to Bender # setData(datafiles, catalogs, castor) from BenderTools.Utils import silence silence() # gaudi = appMgr() # logger.info("end: params: %s " % params) return SUCCESS
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci the_year = "2012" from BenderTools.Parser import hasInFile if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Collision13'): the_year = '2013' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) rootInTES = '/Event/Charm' # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE( 'Stripping.*DsLamCForPromptCharm.*' ) """ ) dv = DaVinci( EventPreFilters=fltrs.filters('Filters'), DataType=the_year, InputType='MDST', RootInTES=rootInTES, Simulation=False, PrintFreq=1000, EvtMax=-1, # HistogramFile='LB_Histos.root', TupleFile='LB.root', # Lumi=True, # ) dv.UserAlgorithms = ['LB'] from Configurables import CondDB CondDB(LatestGlobalTagByDataType=the_year) from BenderTools.Utils import silence silence() # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() alg = LB( 'LB', RootInTES=rootInTES, Inputs=['Phys/DsLamCForPromptCharm/Particles'] ) return SUCCESS
highMult = False ns25 = True #### Stripping filter from Configurables import LoKi__HDRFilter as StripFilter stripFilter = StripFilter( 'stripPassFilter',\ Code = "HLT_PASS('StrippingMBNoBiasDecision')",\ Location= "/Event/Strip/Phys/DecReports") from PhysConf.Filters import LoKi_Filters if highMult: code = " HLT_PASS_RE ( 'Hlt1HighVeloMult.*Decision') " fltrs = LoKi_Filters (HLT1_Code = code) else: if not ns25: code = " HLT_PASS_RE ( 'Hlt2MBNoBiasLeadingCrossingDecision') " fltrs = LoKi_Filters (HLT2_Code = code) else: code ="HLT_PASS('Hlt1MBNoBiasDecision')" fltrs = LoKi_Filters (HLT1_Code = code) from Configurables import DeterministicPrescaler if not ns25: nobias_prescale = DeterministicPrescaler("PrescaleMinbias", AcceptFraction = 0.25) else: nobias_prescale = DeterministicPrescaler("PrescaleMinbias", AcceptFraction = 1.0) from Configurables import LoKi__HDRFilter, CheckPV
def configure(datafiles, catalogs=[]): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from GaudiConf.Configuration import FileCatalog ## needed for job configuration from GaudiConf.Configuration import NTupleSvc from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( # MC_Preambulo=[ "from LoKiCore.functions import in_range, count, has ", "from GaudiKernel.SystemOfUnits import GeV", "from_B = MCINANCESTORS ( BEAUTY )", "pt_d_cut = in_range ( 2 * GeV , MCPT , 12 * GeV ) ", "y_d_cut = in_range ( 2 , MCY , 4.0 ) ", "pt_j_cut = MCPT < 12 * GeV ", "y_j_cut = in_range ( 2 , MCY , 4.5 ) ", "d0 = 'D0' == MCABSID ", # MCDECTREE ( '[ D0 -> K- pi+ ]CC') " , "dp = 'D+' == MCABSID ", # MCDECTREE ( '[ D+ --> K- pi+ pi+ ]CC') " , "ds = 'D_s+' == MCABSID ", # MCDECTREE ( '[ D_s+ --> K- K+ pi+ ]CC') " , "lc = 'Lambda_c+' == MCABSID ", # MCDECTREE ( '[ Lambda_c+ --> p+ K- pi+ ]CC') " , # MCDECTREE ( ' J/psi(1S) => mu+ mu-' ) " , "psi = 'J/psi(1S)' == MCABSID ", "psi_B = psi & from_B ", "charm = ( d0 | dp | ds | lc ) ", "charm_B = charm & from_B ", ], # # di-charm mode # # MC_Code = """ ## has ( BEAUTY ) # & ## ( 1.5 < count ( y_d_cut & pt_d_cut & charm_B ) ) # """ # # dimuon & charm # # MC_Code = """ ## has ( BEAUTY ) # & ## ( 0.5 < count ( y_d_cut & pt_d_cut & charm_B ) ) # & ## ( 0.5 < count ( y_j_cut & pt_j_cut & psi_B ) ) # """ # # alltogather # MC_Code=""" has ( BEAUTY ) & ( 1.5 < count ( ( y_d_cut & pt_d_cut & charm_B ) | ( y_j_cut & pt_j_cut & psi_B ) ) ) """ ) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', InputType='DST', Simulation=True, PrintFreq=1000, #EventPreFilters = filters , EvtMax=-1, # HistogramFile='2xCharm_fromB_Histos.root', TupleFile='2xCharm_fromB.root', # Lumi=False # ) # come back to Bender setData(datafiles, catalogs) gaudi = appMgr() alg = MCB2( # 'MCB2', # Algorithm name # Inputs=[], # PP2MCs=[] ) # # mainSeq = gaudi.algorithm ('GaudiSequencer/DaVinciUserSequence', True ) # mainSeq.Members += [ alg.name() ] gaudi.setAlgorithms([alg]) return SUCCESS
def configure_Ups(datafiles, catalogs=[], castor=False): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonHighMass.*Decision' ) """, VOID_Code=""" ( 0.5 < CONTAINS ( '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles' ) ) & ( 0.5 < CONTAINS ( '/Event/Rec/Vertex/Primary' ) ) """ ) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', InputType='DST', Simulation=False, PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, # HistogramFile='TrgEff_Histos.root', TupleFile='TrgEff.root', # Lumi=True, # ) from Configurables import CondDB CondDB(UseLatestTags=["2011"]) # # come back to Bender # setData(datafiles, catalogs, castor) gaudi = appMgr() # for t in ( 'TrgEff.L0TriggerTisTos', # 'TrgEff.TriggerTisTos' ) : # # t1 = gaudi.tool ( t ) # t1.TOSFracMuon = 0.01 # t1.PropertiesPrint = True alg = TrgUpsEff( 'TrgEff', # Algorithm name , Inputs=[ '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles'] ) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
def configure(datafiles, catalogs=[], castor=False): """ Job configuration """ # ======================================================================= # J/psi # ======================================================================= from PhysSelPython.Wrappers import AutomaticData jpsi_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' jpsi = AutomaticData(Location=jpsi_location) from StrippingSelections.StrippingPromptCharm import StrippingPromptCharmConf as PC # ====================================== # REMOVED !!! + # ( TRGHOSTPROB < 0.5 ) & + # ====================================== pc = PC('PromptCharm', { 'TrackCuts' : """ ( TRCHI2DOF < 5 ) & ( PT > 250 * MeV ) & in_range ( 2 , ETA , 5 ) """ , 'KaonCuts': ' & ( 0 < PIDK - PIDpi ) ', 'PionCuts': ' & ( 0 < PIDpi - PIDK ) ', } ) pions = pc.pions() kaons = pc.kaons() Preambulo = [ # shortcut for chi2 of vertex fit 'chi2vx = VFASPF(VCHI2) ', # shortcut for the c*tau "from GaudiKernel.PhysicalConstants import c_light", # use the embedded cut for chi2(LifetimeFit)<25 "ctau = BPVLTIME ( 25 ) * c_light " ] from GaudiConfUtils.ConfigurableGenerators import CombineParticles # ======================================================================== # prepare Ds+ # ======================================================================== Ds_alg = CombineParticles( # the decays to be reconstructed DecayDescriptor="[D_s+ -> K- K+ pi+]cc ", # Preambulo=Preambulo, # combination cut : wide mass-cut & PT-cut CombinationCut=""" ( AM12 < 1050 * MeV ) & ( ( ADAMASS('D+') < 60 * MeV ) | ( ADAMASS('D_s+') < 60 * MeV ) ) & ( APT > 900 * MeV ) """ , # mother cut MotherCut=""" ( chi2vx < 25 ) & ( PT > 1 * GeV ) & ( ( ADMASS('D+') < 50 * MeV ) | ( ADMASS('D_s+') < 50 * MeV ) ) """ , # ParticleCombiners={'': 'LoKi::VertexFitter'} ) from PhysSelPython.Wrappers import Selection # make selection Ds_sel = Selection( 'DsForPsiC', Algorithm=Ds_alg, RequiredSelections=[kaons, pions] ) # ======================================================================== BDs_alg = CombineParticles( # the decays to be reconstructed DecayDescriptor="[ B_c+ -> J/psi(1S) D_s+ ]cc ", # Preambulo=Preambulo, # combination cut : CombinationCut=""" in_range ( 5 * GeV , AM , 7 * GeV ) """ , # mother cut MotherCut=""" ( chi2vx < 16 ) & ( ctau > -10 * micrometer ) """ , # ParticleCombiners={'': 'LoKi::VertexFitter'}, ReFitPVs=True ) # make the selection BDs_sel = Selection( 'PsiDs', Algorithm=BDs_alg, RequiredSelections=[jpsi, Ds_sel] ) # ======================================================================== # Bc -> J/psi + 3pi # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import CombineParticles bc_3pi = CombineParticles( DecayDescriptor='[B_c+ -> J/psi(1S) pi+ pi+ pi-]cc', # Preambulo=Preambulo, DaughtersCuts={ "J/psi(1S)": " M < 4.0 * GeV " }, # CombinationCut=""" in_range ( 5.9 * GeV , AM , 6.6 * GeV ) """ , # MotherCut=""" ( chi2vx < 49 ) & ( ctau > 50 * micrometer ) """ , # ParticleCombiners={'': 'LoKi::VertexFitter'}, ReFitPVs=True ) # Bc_3p = Selection( 'Psi3pi', Algorithm=bc_3pi, RequiredSelections=[jpsi, pions] ) # ======================================================================== # Bc -> J/psi + pi # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import CombineParticles bc_pi = CombineParticles( DecayDescriptor='[B_c+ -> J/psi(1S) pi+ ]cc', # Preambulo=Preambulo, DaughtersCuts={ "J/psi(1S)": " M < 4.0 * GeV " }, # CombinationCut=""" in_range ( 5.9 * GeV , AM , 6.6 * GeV ) """ , # MotherCut=""" ( chi2vx < 16 ) & ( ctau > 50 * micrometer ) """ , ParticleCombiners={'': 'LoKi::VertexFitter'}, ReFitPVs=True ) # Bc_1p = Selection( 'Psi1Pi', Algorithm=bc_pi, RequiredSelections=[jpsi, pions] ) from PhysSelPython.Wrappers import SelectionSequence Bc_1PI = SelectionSequence("PSIPi", TopSelection=Bc_1p) Bc_3PI = SelectionSequence("PSI3Pi", TopSelection=Bc_3p) Bc_Ds = SelectionSequence("PSIDs", TopSelection=BDs_sel) # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')", VOID_Code=""" 0.5 < CONTAINS('%s') """ % jpsi_location ) # ===================================================================== from Configurables import DaVinci # needed for job configuration the_year = '2011' davinci = DaVinci( EventPreFilters=fltrs.filters('FilterMC'), DataType=the_year, InputType='DST', Simulation=True, PrintFreq=1000, EvtMax=-1, # HistogramFile='BcMC_Histos.root', TupleFile='BcMC.root', ## HistogramFile = 'BcMC1pi_Histos.root' , ## TupleFile = 'BcMC1pi.root' , # # for Ds #DDDBtag = 'MC2011-20120727' , #CondDBtag = 'MC2011-20120727-vc-mu100' , # # for pi # DDDBtag = 'MC11-20111102' , # CondDBtag = 'sim-20111111-vc-md100' , # ## Lumi = True , # ) from Configurables import GaudiSequencer seqDs = GaudiSequencer( 'DS', Members=[Bc_Ds . sequence(), "MCBc2Ds"] ) from Configurables import GaudiSequencer seq1pi = GaudiSequencer( 'Pi1', Members=[Bc_1PI . sequence(), "MCBc1Pi"] ) from Configurables import TrackSmearState state_smear = TrackSmearState( 'StateSmear', ## RootInTES = rootInTES , ) davinci.UserAlgorithms = [state_smear, seqDs] ## davinci.UserAlgorithms = [ seq1pi ] # from Configurables import CondDB # CondDB ( LatestGlobalTagByDataType = the_year ) # ------- decoding set-up start ---------- # from BenderTools.MicroDST import uDstConf # uDstConf ( rootInTES ) # ------- decoding set-up end ----------- # come back to Bender setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() alg1 = MCBc( 'MCBc2Ds', # Algorithm name , Inputs=[Bc_Ds.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'] ) alg2 = MCBc1Pi( 'MCBc1Pi', # Algorithm name , Inputs=[Bc_1PI.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'] ) return SUCCESS
# Test data from GaudiConf import IOHelper #IOHelper('ROOT').inputFiles(['/eos/lhcb/grid/prod/lhcb/LHCb/Protonion16/IFT.DST/00076144/0000/00076144_00000038_1.ift.dst'], clear = True) #IOHelper('ROOT').inputFiles(['/tmp/dcraik/00076144_00000038_1.ift.dst'], clear = True) ## import DaVinci from Configurables import DaVinci from Configurables import CondDB from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( 'StrippingHeavyIonTopologyLowActivityLineDecision' ) """) dv = DaVinci( DataType='2016', InputType='DST', TupleFile='Tuples.root', ## IMPORTANT HistogramFile='Histos.root', ## IMPORTANT Simulation=False, Lumi=True, EventPreFilters=fltrs.filters('Filters'), #CondDBtag = 'cond-20180625-1', #DDDBtag = 'dddb-20180726-3', #DQFLAGStag = 'dq-20170627', EvtMax=-1 ##TODO #EvtMax = 1000 ##TODO ) db = CondDB(LatestGlobalTagByDataType='2016') db.LocalTags["DQFLAGS"] = ["herschel-20161018"]
#!/bin/env python import sys sys.path.append('.') from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE ( '.*Jpsi2MuMuDetached.*' ) """ ) # Data type configuration. from GaudiKernel import SystemOfUnits as Units ##Type = 'MC' JetPtMin = 10 * Units.GeV ## Data. #from GaudiConf import IOHelper #IOHelper('ROOT').inputFiles(['/eos/lhcb/grid/prod/lhcb/LHCb/Collision16/EW.DST/00061346/0000/00061346_00007712_1.ew.dst'],#/tmp/dcraik/00042952_00000002_1.ldst'], #/data/dst/MC15.MD.49000004.1.00.dst'], # clear = True) ##Type = 'MC' from StandardParticles import StdAllNoPIDsMuons as loosemuons from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles from commonSelections import *
def configure(datafiles, catalogs=[], castor=True, params={}): """ Configure the job """ from Configurables import DaVinci # needed for job configuration from Configurables import EventSelector # needed for job configuration from Configurables import NTupleSvc from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonHighMass.*Decision' ) """, VOID_Code=""" 0 < CONTAINS ( '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles') """ ) filters = fltrs.filters('Filters') filters.reverse() the_year = params["year"] davinci = DaVinci( # noqa DataType=the_year, InputType='MDST', HistogramFile="chib_histos.root", TupleFile="chib_tuples.root", PrintFreq=1000, Lumi=True, EvtMax=-1 ) from Configurables import CondDB CondDB(LatestGlobalTagByDataType=the_year) #========================================================================= # RootInTES = '/Event/ChiB' # RootInTES = '/Event/Bottomonia' RootInTES = '/Event/BOTTOM' #========================================================================= from BenderTools.MicroDST import uDstConf uDstConf(RootInTES) # ========================================================================= from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # ========================================================================= from Configurables import TrackScaleState state_scale = TrackScaleState('StateScale', RootInTES='/Event/BOTTOM') # ========================================================================= davinci.UserAlgorithms = [ state_scale, "ChibAlg", "UpsilonAlg" ] # ========================================================================= # come back to Bender setData(datafiles, catalogs, castor) gaudi = appMgr() alg_chib = Chib( 'ChibAlg', # Algorithm name , # input particles RootInTES=RootInTES, Inputs=[ # 'Phys/Chi_b/Particles' 'Phys/ChiB/Particles' ], # take care about the proper particle combiner ParticleCombiners={'': 'LoKi::VertexFitter'} ) alg_upsilon = Upsilon( 'UpsilonAlg', # Algorithm name , # input particles RootInTES=RootInTES, Inputs=[ 'Phys/Upsilon/Particles' ], # take care about the proper particle combiner ParticleCombiners={'': 'LoKi::VertexFitter'} ) # ========================================================================= # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) # mainSeq.Members += [state_scale, alg_chib.name(), alg_upsilon.name()] # ========================================================================= return SUCCESS
def options(year, mag, data_type, mode): #======================================# #=== DaVinci script for Data and MC ===# #======================================# #=== year = year of data taking ===# #=== mag = magnet polarity of data ===# #=== data_type = MC or data? ===# #======================================# #=== These variables are given to ===# #=== function by the ganga script, ===# #=== which is different, depending ===# #=== on whether MC or data is being ===# #=== looked at. ===# #======================================# from Configurables import DaVinci from Configurables import MCMatchObjP2MCRelator from PhysConf.Filters import LoKi_Filters #===========================# #=== Check if MC or Data ===# #===========================# if data_type == "data": data = True elif data_type == "MC": data = False else: print "WARNING: data type not recognised. Please enter either \"data\" or \"MC\" as the third argument to options()!" #====================================# #=== Setup depending on data type ===# #====================================# if data: stream = 'Bhadron' prefix = 'Data' else: stream = 'AllStreams' prefix = 'MC' #==============================# #=== Assign Stripping Lines ===# #==============================# #=== b2dk d2pi0hh ===# line_k = 'B2D0KD2Pi0HHResolvedBeauty2CharmLine' #=== b2dpi d2pi0hh ===# line_pi = 'B2D0PiD2Pi0HHResolvedBeauty2CharmLine' #=============================# #=== Stripping Pre-Filters ===# #=============================# fltrs = LoKi_Filters( STRIP_Code= "HLT_PASS_RE('StrippingB2D0KD2Pi0HHResolvedBeauty2CharmLineDecision') | HLT_PASS_RE('StrippingB2D0PiD2Pi0HHResolvedBeauty2CharmLineDecision')" ) #==============================# #=== Import necessary tools ===# #==============================# from Configurables import DecayTreeTuple from DecayTreeTuple.Configuration import * if data: from Configurables import TrackScaleState scaler = TrackScaleState('StateScale') scaler.RootInTES = '/Event/{0}/'.format(stream) #===================================================# #=== Setup DecayTreeTuples for each channel/mode ===# #===================================================# etuple = EventTuple() if data: dk_d2kpipi0 = DecayTreeTuple('B2DK_D2KPiPi0') dk_d2pikpi0 = DecayTreeTuple('B2DK_D2PiKPi0') dk_d2kkpi0 = DecayTreeTuple('B2DK_D2KKPi0') dk_d2pipipi0 = DecayTreeTuple('B2DK_D2PiPiPi0') dpi_d2kpipi0 = DecayTreeTuple('B2DPi_D2KPiPi0') dpi_d2pikpi0 = DecayTreeTuple('B2DPi_D2PiKPi0') dpi_d2kkpi0 = DecayTreeTuple('B2DPi_D2KKPi0') dpi_d2pipipi0 = DecayTreeTuple('B2DPi_D2PiPiPi0') else: dk_d2kpipi0 = DecayTreeTuple('B2DK_D2KPiPi0_MC') dk_d2pikpi0 = DecayTreeTuple('B2DK_D2PiKPi0_MC') dk_d2kkpi0 = DecayTreeTuple('B2DK_D2KKPi0_MC') dk_d2pipipi0 = DecayTreeTuple('B2DK_D2PiPiPi0_MC') dpi_d2kpipi0 = DecayTreeTuple('B2DPi_D2KPiPi0_MC') dpi_d2pikpi0 = DecayTreeTuple('B2DPi_D2PiKPi0_MC') dpi_d2kkpi0 = DecayTreeTuple('B2DPi_D2KKPi0_MC') dpi_d2pipipi0 = DecayTreeTuple('B2DPi_D2PiPiPi0_MC') #=== Assign vectors of DecayTreeTuples for easy use later ===# channels = [ dk_d2kpipi0, dk_d2pikpi0, dk_d2kkpi0, dk_d2pipipi0, dpi_d2kpipi0, dpi_d2pikpi0, dpi_d2kkpi0, dpi_d2pipipi0 ] k_chans = [dk_d2kpipi0, dk_d2pikpi0, dk_d2kkpi0, dk_d2pipipi0] pi_chans = [dpi_d2kpipi0, dpi_d2pikpi0, dpi_d2kkpi0, dpi_d2pipipi0] #=== Setting location/inputs is different depending on data type ===# if data: for channel in channels: channel.RootInTES = '/Event/{0}'.format(stream) for channel in k_chans: channel.Inputs = ['Phys/{0}/Particles'.format(line_k)] for channel in pi_chans: channel.Inputs = ['Phys/{0}/Particles'.format(line_pi)] else: for channel in k_chans: if year == '2012' or year == '2011': # 2012 and 2011 MC is DST! channel.Inputs = [ '/Event/{0}/Phys/{1}/Particles'.format(stream, line_k) ] else: channel.Inputs = ['Phys/{0}/Particles'.format(line_k)] for channel in pi_chans: if year == '2012' or year == '2011': channel.Inputs = [ '/Event/{0}/Phys/{1}/Particles'.format(stream, line_pi) ] else: channel.Inputs = ['Phys/{0}/Particles'.format(line_pi)] #=====================================================# #=== Setup decay descriptors for each channel/mode ===# #=====================================================# #=== B2DK ===# dk_d2kpipi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^K+) , (B- --> ^(D0 --> ^K- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^K- )]' dk_d2kpipi0.addBranches({ 'Bu': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) K+ ) , (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) K- )]', 'D0': '[(B+ --> ^(D0 --> K+ pi- (pi0 --> gamma gamma)) K+) , (B- --> ^(D0 --> K- pi+ (pi0 --> gamma gamma)) K- )]', 'K0': '[(B+ --> (D0 --> ^K+ pi- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> ^K- pi+ (pi0 --> gamma gamma)) K- )]', 'P0': '[(B+ --> (D0 --> K+ ^pi- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> K- ^pi+ (pi0 --> gamma gamma)) K- )]', 'Pi0': '[(B+ --> (D0 --> K+ pi- ^(pi0 --> gamma gamma)) K+) , (B- --> (D0 --> K- pi+ ^(pi0 --> gamma gamma)) K- )]', 'Bach': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) ^K+) , (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) ^K- )]', 'Gamma1': '[(B+ --> (D0 --> K+ pi- (pi0 --> ^gamma gamma)) K+) , (B- --> (D0 --> K- pi+ (pi0 --> ^gamma gamma)) K- )]', 'Gamma2': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma ^gamma)) K+) , (B- --> (D0 --> K- pi+ (pi0 --> gamma ^gamma)) K- )]' }) dk_d2pikpi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^K- ^(pi0 --> ^gamma ^gamma)) ^K+) , (B- --> ^(D0 --> ^pi- ^K+ ^(pi0 --> ^gamma ^gamma)) ^K- )]' dk_d2pikpi0.addBranches({ 'Bu': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) K+ ) , (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) K- )]', 'D0': '[(B+ --> ^(D0 --> pi+ K- (pi0 --> gamma gamma)) K+) , (B- --> ^(D0 --> pi- K+ (pi0 --> gamma gamma)) K- )]', 'P0': '[(B+ --> (D0 --> ^pi+ K- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> ^pi- K+ (pi0 --> gamma gamma)) K- )]', 'K0': '[(B+ --> (D0 --> pi+ ^K- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> pi- ^K+ (pi0 --> gamma gamma)) K- )]', 'Pi0': '[(B+ --> (D0 --> pi+ K- ^(pi0 --> gamma gamma)) K+) , (B- --> (D0 --> pi- K+ ^(pi0 --> gamma gamma)) K- )]', 'Bach': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) ^K+) , (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) ^K- )]', 'Gamma1': '[(B+ --> (D0 --> pi+ K- (pi0 --> ^gamma gamma)) K+) , (B- --> (D0 --> pi- K+ (pi0 --> ^gamma gamma)) K- )]', 'Gamma2': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma ^gamma)) K+) , (B- --> (D0 --> pi- K+ (pi0 --> gamma ^gamma)) K- )]' }) dk_d2kkpi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^K- ^(pi0 --> ^gamma ^gamma)) ^K+) , (B- --> ^(D0 --> ^K- ^K+ ^(pi0 --> ^gamma ^gamma)) ^K- )]' dk_d2kkpi0.addBranches({ 'Bu': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) K+ ) , (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) K- )]', 'D0': '[(B+ --> ^(D0 --> K+ K- (pi0 --> gamma gamma)) K+) , (B- --> ^(D0 --> K- K+ (pi0 --> gamma gamma)) K- )]', 'K0': '[(B+ --> (D0 --> ^K+ K- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> ^K- K+ (pi0 --> gamma gamma)) K- )]', 'K1': '[(B+ --> (D0 --> K+ ^K- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> K- ^K+ (pi0 --> gamma gamma)) K- )]', 'Pi0': '[(B+ --> (D0 --> K+ K- ^(pi0 --> gamma gamma)) K+) , (B- --> (D0 --> K- K+ ^(pi0 --> gamma gamma)) K- )]', 'Bach': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) ^K+) , (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) ^K- )]', 'Gamma1': '[(B+ --> (D0 --> K+ K- (pi0 --> ^gamma gamma)) K+) , (B- --> (D0 --> K- K+ (pi0 --> ^gamma gamma)) K- )]', 'Gamma2': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma ^gamma)) K+) , (B- --> (D0 --> K- K+ (pi0 --> gamma ^gamma)) K- )]' }) dk_d2pipipi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^K+) , (B- --> ^(D0 --> ^pi- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^K- )]' dk_d2pipipi0.addBranches({ 'Bu': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) K+ ) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) K- )]', 'D0': '[(B+ --> ^(D0 --> pi+ pi- (pi0 --> gamma gamma)) K+) , (B- --> ^(D0 --> pi- pi+ (pi0 --> gamma gamma)) K- )]', 'P0': '[(B+ --> (D0 --> ^pi+ pi- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> ^pi- pi+ (pi0 --> gamma gamma)) K- )]', 'P1': '[(B+ --> (D0 --> pi+ ^pi- (pi0 --> gamma gamma)) K+) , (B- --> (D0 --> pi- ^pi+ (pi0 --> gamma gamma)) K- )]', 'Pi0': '[(B+ --> (D0 --> pi+ pi- ^(pi0 --> gamma gamma)) K+) , (B- --> (D0 --> pi- pi+ ^(pi0 --> gamma gamma)) K- )]', 'Bach': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) ^K+) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) ^K- )]', 'Gamma1': '[(B+ --> (D0 --> pi+ pi- (pi0 --> ^gamma gamma)) K+) , (B- --> (D0 --> pi- pi+ (pi0 --> ^gamma gamma)) K- )]', 'Gamma2': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma ^gamma)) K+) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma ^gamma)) K- )]' }) #=== B2DPi ===# dpi_d2kpipi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^pi+) , (B- --> ^(D0 --> ^K- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^pi- )]' dpi_d2kpipi0.addBranches({ 'Bu': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) pi+ ) , (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) pi- )]', 'D0': '[(B+ --> ^(D0 --> K+ pi- (pi0 --> gamma gamma)) pi+) , (B- --> ^(D0 --> K- pi+ (pi0 --> gamma gamma)) pi- )]', 'K0': '[(B+ --> (D0 --> ^K+ pi- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> ^K- pi+ (pi0 --> gamma gamma)) pi- )]', 'P0': '[(B+ --> (D0 --> K+ ^pi- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> K- ^pi+ (pi0 --> gamma gamma)) pi- )]', 'Pi0': '[(B+ --> (D0 --> K+ pi- ^(pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> K- pi+ ^(pi0 --> gamma gamma)) pi- )]', 'Bach': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) ^pi+) , (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) ^pi- )]', 'Gamma1': '[(B+ --> (D0 --> K+ pi- (pi0 --> ^gamma gamma)) pi+) , (B- --> (D0 --> K- pi+ (pi0 --> ^gamma gamma)) pi- )]', 'Gamma2': '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma ^gamma)) pi+) , (B- --> (D0 --> K- pi+ (pi0 --> gamma ^gamma)) pi- )]' }) dpi_d2pikpi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^K- ^(pi0 --> ^gamma ^gamma)) ^pi+) , (B- --> ^(D0 --> ^pi- ^K+ ^(pi0 --> ^gamma ^gamma)) ^pi-)]' dpi_d2pikpi0.addBranches({ 'Bu': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) pi+ ) , (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) pi- )]', 'D0': '[(B+ --> ^(D0 --> pi+ K- (pi0 --> gamma gamma)) pi+) , (B- --> ^(D0 --> pi- K+ (pi0 --> gamma gamma)) pi-)]', 'P0': '[(B+ --> (D0 --> ^pi+ K- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> ^pi- K+ (pi0 --> gamma gamma)) pi-)]', 'K0': '[(B+ --> (D0 --> pi+ ^K- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> pi- ^K+ (pi0 --> gamma gamma)) pi-)]', 'Pi0': '[(B+ --> (D0 --> pi+ K- ^(pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> pi- K+ ^(pi0 --> gamma gamma)) pi-)]', 'Bach': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) ^pi+) , (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) ^pi-)]', 'Gamma1': '[(B+ --> (D0 --> pi+ K- (pi0 --> ^gamma gamma)) pi+) , (B- --> (D0 --> pi- K+ (pi0 --> ^gamma gamma)) pi-)]', 'Gamma2': '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma ^gamma)) pi+) , (B- --> (D0 --> pi- K+ (pi0 --> gamma ^gamma)) pi-)]' }) dpi_d2kkpi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^K- ^(pi0 --> ^gamma ^gamma)) ^pi+) , (B- --> ^(D0 --> ^K- ^K+ ^(pi0 --> ^gamma ^gamma)) ^pi-)]' dpi_d2kkpi0.addBranches({ 'Bu': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) pi+ ) , (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) pi- )]', 'D0': '[(B+ --> ^(D0 --> K+ K- (pi0 --> gamma gamma)) pi+) , (B- --> ^(D0 --> K- K+ (pi0 --> gamma gamma)) pi-)]', 'K0': '[(B+ --> (D0 --> ^K+ K- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> ^K- K+ (pi0 --> gamma gamma)) pi-)]', 'K1': '[(B+ --> (D0 --> K+ ^K- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> K- ^K+ (pi0 --> gamma gamma)) pi-)]', 'Pi0': '[(B+ --> (D0 --> K+ K- ^(pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> K- K+ ^(pi0 --> gamma gamma)) pi-)]', 'Bach': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) ^pi+) , (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) ^pi-)]', 'Gamma1': '[(B+ --> (D0 --> K+ K- (pi0 --> ^gamma gamma)) pi+) , (B- --> (D0 --> K- K+ (pi0 --> ^gamma gamma)) pi-)]', 'Gamma2': '[(B+ --> (D0 --> K+ K- (pi0 --> gamma ^gamma)) pi+) , (B- --> (D0 --> K- K+ (pi0 --> gamma ^gamma)) pi-)]' }) dpi_d2pipipi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^pi+) , (B- --> ^(D0 --> ^pi- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^pi- )]' dpi_d2pipipi0.addBranches({ 'Bu': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) pi+ ) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) pi- )]', 'D0': '[(B+ --> ^(D0 --> pi+ pi- (pi0 --> gamma gamma)) pi+) , (B- --> ^(D0 --> pi- pi+ (pi0 --> gamma gamma)) pi- )]', 'P0': '[(B+ --> (D0 --> ^pi+ pi- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> ^pi- pi+ (pi0 --> gamma gamma)) pi- )]', 'P1': '[(B+ --> (D0 --> pi+ ^pi- (pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> pi- ^pi+ (pi0 --> gamma gamma)) pi- )]', 'Pi0': '[(B+ --> (D0 --> pi+ pi- ^(pi0 --> gamma gamma)) pi+) , (B- --> (D0 --> pi- pi+ ^(pi0 --> gamma gamma)) pi- )]', 'Bach': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) ^pi+) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) ^pi- )]', 'Gamma1': '[(B+ --> (D0 --> pi+ pi- (pi0 --> ^gamma gamma)) pi+) , (B- --> (D0 --> pi- pi+ (pi0 --> ^gamma gamma)) pi- )]', 'Gamma2': '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma ^gamma)) pi+) , (B- --> (D0 --> pi- pi+ (pi0 --> gamma ^gamma)) pi- )]' }) #========================================# #=== Setup LoKi variables to be added ===# #========================================# #=== Added to all branches ===# LoKiVars = { "Q": "Q", "DIRA_BPV": "BPVDIRA", "MAXDOCA": "DOCAMAX", "AMAXDOCA": "PFUNA(AMAXDOCA(''))", "MIPCHI2_PV": "MIPCHI2DV(PRIMARY)", "VTXCHI2DOF": "VFASPF(VCHI2/VDOF)", "LT_BPV": "BPVLTIME('PropertimeFitter/ProperTime::PUBLIC')", } if data: #=== Added only to B2DK channels ===# LoKiVars_K = { "ptasy_1.50": "RELINFO('/Event/Bhadron/Phys/B2D0KD2Pi0HHResolvedBeauty2CharmLine/P2ConeVar1','CONEPTASYM',-1000.)" } #=== Added only to B2DPi channels ===# LoKiVars_Pi = { "ptasy_1.50": "RELINFO('/Event/Bhadron/Phys/B2D0PiD2Pi0HHResolvedBeauty2CharmLine/P2ConeVar1','CONEPTASYM',-1000.)" } #============================================# #=== Add tuple tools to relevent branches ===# #============================================# #=== Needed for new MC which has "turbo" in LFN path name ===# default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty( 'RelTableLocations') rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc] if not data: etuple.addTupleTool("TupleToolGeneration") etuple.addTupleTool("TupleToolTrigger") for channel in channels: #=== Added to all branches ===# channel.ToolList += [ "TupleToolAngles", "TupleToolEventInfo", "TupleToolGeometry", "TupleToolKinematic", "TupleToolPid", "TupleToolPrimaries", "TupleToolPropertime", "TupleToolRecoStats", "TupleToolTrackInfo" ] if not data: ttMCt = channel.addTupleTool("TupleToolMCTruth") ttMCt.addTool(MCMatchObjP2MCRelator) ttMCt.MCMatchObjP2MCRelator.RelTableLocations = rel_locs channel.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All") channel.LoKi_All.Variables = LoKiVars #=== Neutral variables added to photons from pi0 decay ===# channel.Gamma1.addTupleTool("TupleToolPhotonInfo") channel.Gamma1.addTupleTool("TupleToolCaloHypo") channel.Gamma1.addTupleTool("TupleToolProtoPData/ProtoPData") channel.Gamma1.ProtoPData.DataList = ["IsNotE"] channel.Gamma2.addTupleTool("TupleToolPhotonInfo") channel.Gamma2.addTupleTool("TupleToolCaloHypo") channel.Gamma2.addTupleTool("TupleToolProtoPData/ProtoPData") channel.Gamma2.ProtoPData.DataList = ["IsNotE"] #=== Add Pi0 information ===# channel.Pi0.addTupleTool("TupleToolPi0Info") channel.Pi0.addTupleTool("TupleToolCaloHypo") #=== Trigger information added to Bu ===# channel.Bu.addTupleTool("TupleToolTISTOS") channel.Bu.TupleToolTISTOS.Verbose = True # Trigger names changed with runs! TriggerListL0 = ["L0HadronDecision"] TriggerListHlt1 = [] TriggerListHlt2 = [] if year == '2011' or year == '2012': TriggerListHlt1 = ["Hlt1TrackAllL0Decision"] TriggerListHlt2 = [ "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision" ] if year == '2015' or year == '2016' or year == '2017': TriggerListHlt1 = [ "Hlt1TrackMVADecision", "Hlt1TwoTrackMVADecision" ] TriggerListHlt2 = [ "Hlt2Topo2BodyDecision", "Hlt2Topo3BodyDecision", "Hlt2Topo4BodyDecision" ] AllTriggers = TriggerListL0 + TriggerListHlt1 + TriggerListHlt2 channel.Bu.TupleToolTISTOS.TriggerList = AllTriggers #=== Kinematic refit of Bu based on fixing D0 mass and fixing origin vertex ===# #=== DPVCFIT = D0 (mass), primary vertex constrained fit ===# channel.Bu.addTupleTool("TupleToolDecayTreeFitter/DPVCFIT") channel.Bu.DPVCFIT.constrainToOriginVertex = True channel.Bu.DPVCFIT.Verbose = True channel.Bu.DPVCFIT.daughtersToConstrain = ["D0"] channel.Bu.DPVCFIT.UpdateDaughters = True #=== Add branches which are exclusive to MC data ===# if not data: channel.ToolList += ["TupleToolMCBackgroundInfo"] ttMCt.ToolList = [ "MCTupleToolDecayType", "MCTupleToolHierarchy", "MCTupleToolKinematic", "MCTupleToolReconstructed" ] #=== Add ptasy_1.50 variable ===# channel.addTupleTool("TupleToolTrackIsolation/ttti") channel.ttti.FillAsymmetry = True channel.ttti.MinConeAngle = 1.5 channel.ttti.MaxConeAngle = 1.5 #=== Add ptasy_1.50 variable for data ===# if data: for channel in k_chans: channel.Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu") channel.Bu.LoKi_Bu.Variables = dict(LoKiVars.items() + LoKiVars_K.items()) channel.Pi0.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Pi0") channel.Pi0.LoKi_Pi0.Variables = dict(LoKiVars.items() + LoKiVars_K.items()) channel.Gamma1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma1") channel.Gamma1.LoKi_Gamma1.Variables = dict(LoKiVars.items() + LoKiVars_K.items()) channel.Gamma2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma2") channel.Gamma2.LoKi_Gamma2.Variables = dict(LoKiVars.items() + LoKiVars_K.items()) for channel in pi_chans: channel.Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu") channel.Bu.LoKi_Bu.Variables = dict(LoKiVars.items() + LoKiVars_Pi.items()) channel.Pi0.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Pi0") channel.Pi0.LoKi_Pi0.Variables = dict(LoKiVars.items() + LoKiVars_Pi.items()) channel.Gamma1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma1") channel.Gamma1.LoKi_Gamma1.Variables = dict(LoKiVars.items() + LoKiVars_Pi.items()) channel.Gamma2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma2") channel.Gamma2.LoKi_Gamma2.Variables = dict(LoKiVars.items() + LoKiVars_Pi.items()) #==============================# #=== Finalise configuration ===# #==============================# #=== Set database tags ===# from Configurables import CondDB if data: CondDB(LatestGlobalTagByDataType=year) #=== Configure DaVinci ===# if data: DaVinci().RootInTES = '/Event/{0}'.format(stream) DaVinci().appendToMainSequence([scaler]) DaVinci().EventPreFilters = fltrs.filters('Filters') channels += [etuple] DaVinci().UserAlgorithms += channels #=== Input type for 2012 MC is DST, but all data is MDST ===# if data: DaVinci().InputType = 'MDST' DaVinci( ).TupleFile = prefix + '_Bu2DH_AllModes_' + year + '_Mag' + mag + '.root' if not data: DaVinci( ).TupleFile = prefix + '_Bu2' + mode + '_' + year + '_Mag' + mag + '.root' if year == "2012" or year == "2011": DaVinci().InputType = 'DST' else: DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event/{0}'.format(stream) DaVinci().PrintFreq = 1000 DaVinci().DataType = year DaVinci().Simulation = not data DaVinci().Lumi = not DaVinci().Simulation DaVinci().EvtMax = -1 DaVinci().RootCompressionLevel = 'ZLIB:1' #=======================================================# #=== Set database tags! Only needs to be done for MC ===# #=======================================================# if not data: #=== D --> K Pi Pi0 ===# if mode == "DK_D2KPiPi0" or mode == "DPi_D2KPiPi0": if year == "2012": if mag == 'Up': DaVinci().CondDBtag = 'sim-20160321-2-vc-mu100' if mag == 'Down': DaVinci().CondDBtag = 'sim-20160321-2-vc-md100' DaVinci().DDDBtag = 'dddb-20150928' if year == "2015": if mag == 'Up': DaVinci().CondDBtag = 'sim-20161124-vc-mu100' if mag == 'Down': DaVinci().CondDBtag = 'sim-20161124-vc-md100' DaVinci().DDDBtag = 'dddb-20170721-3' #=== D --> Pi Pi Pi0 ===# if mode == "DK_D2PiPiPi0" or mode == "DPi_D2PiPiPi0": if year == "2012": if mag == 'Up': DaVinci().CondDBtag = 'sim-20130522-1-vc-mu100' if mag == 'Down': DaVinci().CondDBtag = 'sim-20130522-1-vc-md100' DaVinci().DDDBtag = 'dddb-20130929-1' #=== D --> K K Pi0 ===# if mode == "DK_D2KKPi0" or mode == "DPi_D2KKPi0": if year == "2012": if mag == 'Up': DaVinci().CondDBtag = 'sim-20130522-1-vc-mu100' if mag == 'Down': DaVinci().CondDBtag = 'sim-20130522-1-vc-md100' DaVinci().DDDBtag = 'dddb-20130929-1' return
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci from BenderTools.Parser import hasInFile the_year = "2011" if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) rootInTES = '/Event/PSIX' # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( VOID_Code=""" ( CONTAINS('/Event/PSIX/Phys/SelPsiKForPsiX/Particles' ) > 0.5 ) | ( CONTAINS('/Event/PSIX/Phys/SelPsiPiForPsiX/Particles' ) > 0.5 ) """ ) davinci = DaVinci( EventPreFilters=fltrs.filters('Filters'), DataType=the_year, InputType='MDST', RootInTES=rootInTES, Simulation=False, PrintFreq=1000, EvtMax=-1, # HistogramFile='Bc_Histos.root', TupleFile='Bc.root', # Lumi=True, # ) from BenderTools.Utils import silence silence() from Configurables import TrackScaleState state_scale = TrackScaleState('StateScale') davinci.UserAlgorithms = [ state_scale, 'B2K', 'B2P' ] from Configurables import CondDB CondDB(LatestGlobalTagByDataType=the_year) # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() # alg1 = B2PsiH( 'B2K', # Algorithm name , RootInTES=rootInTES, Inputs=['Phys/SelPsiKForPsiX/Particles'] ) # Phys/SelPsiKForPsiX/Particles alg2 = B2PsiH( 'B2P', # Algorithm name , RootInTES=rootInTES, Inputs=['Phys/SelPsiPiForPsiX/Particles'] ) return SUCCESS
#DaVinci().CondDBtag = 'cond-20161004' #DaVinci().DDDBtag = 'dddb-20150724' DaVinci().UserAlgorithms = [ convLLSeq, convDDSeq, caloSeq, #mergedpi0Seq, dimuSeq ] #================ # Setup Turbo if TYPE == "Displ": from PhysConf.Filters import LoKi_Filters hltFilter = LoKi_Filters( HLT2_Code="HLT_PASS_RE('.*ExoticaDisplDiMuonDecision.*')") DaVinci().EventPreFilters = hltFilter.filters('TriggerFilters') #fltrSeq = hltFilter.sequence ( 'MyHLTFilters' ) #DaVinci().EventPreFilters = [fltrSeq] rootInTes = "" else: if YEAR == 2016: from Configurables import DstConf from Configurables import TurboConf DaVinci().Turbo = True DstConf().Turbo = True TurboConf().PersistReco = True
SelDSTWriterElements = {'default': stripMicroDSTElements(pack=False)} udstWriter = SelDSTWriter( "MyDSTWriter", StreamConf=SelDSTWriterConf, MicroDSTElements=SelDSTWriterElements, OutputFileSuffix='BX', SelectionSequences=[b_seq] ) # # Read only fired events to speed up # from PhysConf.Filters import LoKi_Filters fltrs1 = LoKi_Filters( STRIP_Code=" HLT_PASS_RE('Stripping.*%s.*') " % jpsi_name ) fltrs2 = LoKi_Filters( VOID_Code=""" ( RECSUMMARY ( 0 , -1 ) > 0.5 ) & ( RECSUMMARY ( 10 , -1 ) < 500 ) & ( RECSUMMARY ( 13 , -1 ) < 500 ) """ ) ##the_year = "2011" the_year = "2012" from Configurables import DaVinci dv = DaVinci( EventPreFilters=fltrs1.filters(
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci from BenderTools.Parser import hasInFile the_year = "2011" if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) rootInTES = '/Event/Charm' from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*Xicc.*ForPromptCharm.*' ) """ ) davinci = DaVinci( DataType=the_year, EventPreFilters=fltrs.filters('Filters'), InputType='MDST', RootInTES=rootInTES, Simulation=False, PrintFreq=1000, EvtMax=-1, # HistogramFile='Xic_Histos.root', TupleFile='Xic.root', # Lumi=True, # ) from BenderTools.Utils import silence silence() from Configurables import TrackScaleState state_scale = TrackScaleState( 'StateScale', ) davinci.UserAlgorithms = [state_scale, 'Xi1', 'Xi2'] from Configurables import CondDB CondDB(LatestGlobalTagByDataType=the_year) # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() # alg1 = Xicc( 'Xi1', # Algorithm name , RootInTES=rootInTES, Inputs=['Phys/Xicc+ForPromptCharm/Particles'] ) alg2 = Xicc( 'Xi2', # Algorithm name , RootInTES=rootInTES, Inputs=['Phys/Xicc++ForPromptCharm/Particles'] ) alg2.mode = " [ Xi_cc++ -> Lambda_c+ (K-|K+) (pi+|pi-) (pi+|pi-)]CC" return SUCCESS
#elif jobType.startswith('Data'): DaVinci().Simulation = False DaVinci().Lumi = False DaVinci().DataType = '2016' DaVinci().CondDBtag = 'cond-20161004' DaVinci().DDDBtag = 'dddb-20150724' DaVinci().UserAlgorithms = [ convLLSeq, convDDSeq, caloSeq, mergedpi0Seq, dimuSeq ] #================ # Setup Turbo #from Configurables import DstConf #from Configurables import TurboConf from PhysConf.Filters import LoKi_Filters hltFilter = LoKi_Filters( HLT2_Code="HLT_PASS_RE('.*ExoticaDisplDiMuonDecision.*')") #DstConf().Turbo = True #DstConf().Turbo = False #TurboConf().PersistReco = True #from GaudiConf import IOHelper #IOHelper().inputFiles([ # '~/DSTs/pPbPhotons/MinBiasMC.dst' #],clear=True) #=================== # Setup GaudiPython if False: from Configurables import HltParticleFlow, HltJetBuilder pf = HltParticleFlow('pf')
leptonicMicroDSTname = 'Leptonic' charmMicroDSTname = 'Charm' pidMicroDSTname = 'PID' bhadronMicroDSTname = 'Bhadron' mdstStreams = [ leptonicMicroDSTname,charmMicroDSTname,pidMicroDSTname,bhadronMicroDSTname ] dstStreams = [ "BhadronCompleteEvent", "CharmCompleteEvent", "CharmToBeSwum", "Dimuon", "EW", "Semileptonic", "Calibration", "MiniBias", "Radiative" ] stripTESPrefix = 'Strip' from Configurables import ProcStatusCheck from PhysConf.Filters import LoKi_Filters flts = LoKi_Filters(VOID_Code = "( TrSource(TrSOURCE('/Event/Rec/Track/Best', TrLONG))"\ " >> ( sum( TrPT,TrP < 1 * TeV ) > 1 * TeV ) )" , VOID_Preambulo = ["from LoKiTracks.decorators import *" , "from LoKiCore.functions import * ", "from GaudiKernel.SystemOfUnits import *"]) filterBadEvents = GaudiSequencer("BadEventFilter", ModeOR = True, Members = [ flts.sequencer("GECFilter"), ProcStatusCheck() ] ) streamFilter = { 'default' : filterBadEvents, 'MiniBias' : ProcStatusCheck() } sc = StrippingConf( Streams = streams, MaxCandidates = 2000, AcceptBadEvents = False, BadEventSelection = streamFilter, TESPrefix = stripTESPrefix,
SelDSTWriterConf = {'default': stripMicroDSTStreamConf(pack=False)} SelDSTWriterElements = {'default': stripMicroDSTElements(pack=False)} udstWriter = SelDSTWriter( "MyMicroDSTWriter", StreamConf=SelDSTWriterConf, MicroDSTElements=SelDSTWriterElements, OutputFileSuffix='PsiC', SelectionSequences=[B_ALL] ) # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')", VOID_Code=""" 0.5 < CONTAINS('%s') """ % Jpsi_location ) # # protection agains ``corrupted'' Stripping 17b DIMUON.DST fltrs_0 = LoKi_Filters( VOID_Code=""" ( EXISTS ( '/Event/DAQ/RawEvent') | EXISTS('/Event/Trigger/RawEvent' ) ) & EXISTS ( '/Event/Strip/Phys/DecReports') """ ) ## the_year = "2011" the_year = "2012" from Configurables import DaVinci
def configure(datafiles, catalogs=[], params={}, castor=False): from Configurables import DaVinci from Configurables import EventSelector from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( VOID_Code=""" 0 < CONTAINS ('/Event/PSIX/Phys/SelPsi3KForPsiX/Particles') """ ) filters = fltrs.filters('Filters') the_year = '2011' daVinci = DaVinci( # EventPreFilters = filters , # DataType = params['year'] , InputType = 'MDST' , RootInTES = 'PSIX' , # PrintFreq = 1000 , EvtMax = -1 , # TupleFile='Bu2JpsiKKK.root', # Lumi=True # ) daVinci.UserAlgorithms = [ 'JpsiKKK' ] from Configurables import CondDB CondDB ( LatestGlobalTagByDataType = the_year ) # ## define input data # setData(datafiles, catalogs, castor) # ## suppress some extra printput # from BenderTools.Utils import silence silence() # ## get the actual application manager (create if needed) # gaudi = appMgr() # ## create local algorithm: # alg = Bu2JpsiKKK ( 'JpsiKKK', # input particles : RootInTES='/Event/PSIX', Inputs=['Phys/SelPsi3KForPsiX/Particles'] ) return SUCCESS
def configure(datafiles, catalogs=[]): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from GaudiConf.Configuration import FileCatalog ## needed for job configuration from GaudiConf.Configuration import NTupleSvc from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonInc.*Decision' ) """, VOID_Code=""" 0.5 < CONTAINS ('/Event/Leptonic/Phys/MicroDSTDiMuonDiMuonIncLine/Particles' ) """ ) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', InputType='MDST', Simulation=False, PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, # HistogramFile='MuPidEff_Histos.root', TupleFile='MuPidEff.root', # Lumi=True, # ) from Configurables import CondDB CondDB(UseLatestTags=["2011"], UseOracle=True ) # from Configurables import Gaudi__IODataManager as IODataManager # IODataManager().AgeLimit = 2 # configure TIS-TOS rootInTES = '/Event/Leptonic' # ------- decoding set-up start ---------- ## from MicroDSTConf.TriggerConfUtils import configureL0AndHltDecoding # configureL0AndHltDecoding(rootInTES) # ------- decoding set-up end ----------- # come back to Bender setData(datafiles, catalogs) gaudi = appMgr() alg = MuPidEff( 'MuPidEff', # Algorithm name , RootInTES=rootInTES, Inputs=['Phys/MicroDSTDiMuonDiMuonIncLine/Particles'] ) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
def configure_PsiP(datafiles, catalogs=[], castor=False): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonInc.*Decision' ) """, VOID_Code=""" ( 0.5 < CONTAINS ( '/Event/Leptonic/Phys/MicroDSTDiMuonDiMuonIncLine/Particles' ) ) & ( 0.5 < CONTAINS ( '/Event/Leptonic/Rec/Vertex/Primary' ) ) """ ) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', InputType='MDST', Simulation=False, PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, # HistogramFile='TrgEff_Histos.root', TupleFile='TrgEff.root', # Lumi=True, # ) from Configurables import CondDB CondDB(UseLatestTags=["2011"]) # # configure microDST treatment # rootInTES = '/Event/Leptonic' from BenderTools.MicroDST import uDstConf uDstConf(rootInTES) # # come back to Bender # setData(datafiles, catalogs, castor) gaudi = appMgr() alg = TrgPsiPEff( RootInTES=rootInTES, Inputs=['Phys/MicroDSTDiMuonDiMuonIncLine/Particles'] ) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
'Hlt2RadiativeBd2KstGamma','Hlt2RadiativeBd2KstGammaULUnbiased', 'Hlt2RadiativeLb2L0GammaLL', 'Hlt2RadiativeLb2L0GammaEELL', 'Hlt2RadiativeB2GammaGamma', 'Hlt2RadiativeB2GammaGammaLL', 'Hlt2RadiativeB2GammaGammaDD', 'Hlt2RadiativeB2GammaGammaDouble', 'Hlt2RadiativeIncHHGamma','Hlt2RadiativeIncHHHGamma', 'Hlt2RadiativeIncHHGammaEE','Hlt2RadiativeIncHHHGammaEE', 'Hlt2Topo2Body','Hlt2Topo3Body','Hlt2Topo4Body' 'Hlt2TopoE2Body','Hlt2TopoE3Body','Hlt2TopoE4Body', 'Hlt2TopoEE2Body','Hlt2TopoEE3Body','Hlt2TopoEE4Body', ] ##### Stripping filter ########## from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = "HLT_PASS_RE('.*Beauty2XGamma.*')" ) DaVinci().EventPreFilters = fltrs.filters('Filters') ##### Mass substitution ########## # ie do the magic from Configurables import SubstitutePID from PhysSelPython.Wrappers import DataOnDemand name = 'kkpi0RG' line = 'Beauty2XGamma2pi_pi0R_Line' #line = 'Beauty2XGammaphiOmega_2pipi0R_Line' particles = '/Event/AllStreams/Phys/'+line+'/Particles' inputs = [DataOnDemand(particles)] b = 'B_s0'
# add custom variables with functors hybridtool = tup.addTupleTool('LoKi::Hybrid::TupleTool') hybridtool.Variables = { 'ETA': '0.5 * log( (P+PZ)/(P-PZ) )', 'PHI': 'atan2(PY,PX)' } # refit PVs with exclusion of our tracks of interest tup.ReFitPVs = True # add ntuple to the list of running algorithms DaVinci().UserAlgorithms += [tup] # Filter events for faster processing from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping{0}Decision')".format(line1)) DaVinci().EventPreFilters = fltrs.filters('Filters') stream = "AllStreams" #DaVinci().RootInTES = "/Event/{0}".format(stream) DaVinci().InputType = "DST" DaVinci().DataType = "MC{0}".format(year[2:]) DaVinci().Simulation = True DaVinci().Lumi = False DaVinci().PrintFreq = 1000 DaVinci().EvtMax = -1 DaVinci().DDDBtag = dddbtag DaVinci().CondDBtag = conddbtag # output fName = "MC_Lc2pKpiTuple_{0}".format(eventtype)
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci the_year = "2011" from BenderTools.Parser import hasInFile if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' elif hasInFile(datafiles, 'Stripping20'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) # Jpsi_location = '/Event/Dimuon/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' # # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code="HLT_PASS_RE('Stripping.*DiMuonJpsi2MuMuDeta.*')", VOID_Code=""" 0.5 < CONTAINS('%s') """ % Jpsi_location ) # # protection agains ``corrupted'' Stripping 17b DIMUON.DST fltrs_0 = LoKi_Filters( VOID_Code=""" ( EXISTS ( '/Event/DAQ/RawEvent') | EXISTS('/Event/Trigger/RawEvent' ) ) & EXISTS ( '/Event/Strip/Phys/DecReports') """ ) davinci = DaVinci( EventPreFilters=fltrs_0.filters( 'Filters0') + fltrs.filters('Filters'), DataType=the_year, InputType='DST', Simulation=False, PrintFreq=1000, EvtMax=-1, # HistogramFile='Bcc1_Histos.root', TupleFile='Bcc1.root', # Lumi=True, # ) from Configurables import CondDB CondDB(LatestGlobalTagByDataType=the_year) # ------- decoding set-up start ---------- ## from BenderTools.MicroDST import uDstConf ## uDstConf ( rootInTES ) # ------- decoding set-up end ----------- # # dimuon locations in DIMUON.DST # from PhysSelPython.Wrappers import AutomaticData jpsi = AutomaticData(Location=Jpsi_location) # # get the prompt charm # from StrippingSelections.StrippingPromptCharm import StrippingPromptCharmConf as PC # # ====================================== pc = PC('PromptCharm', { 'TrackCuts' : """ ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.5 ) & ( PT > 250 * MeV ) & in_range ( 2 , ETA , 5 ) """ , 'KaonCuts': ' & in_range ( 3.2 * GeV , P , 100 * GeV ) & ( 2 < PIDK - PIDpi ) ', 'PionCuts': ' & in_range ( 3.2 * GeV , P , 100 * GeV ) & ( 0 < PIDpi - PIDK ) ', } ) pions = pc.pions() kaons = pc.kaons() Preambulo = [ # shortcut for chi2 of vertex fit 'chi2vx = VFASPF(VCHI2) ', # shortcut for the c*tau "from GaudiKernel.PhysicalConstants import c_light", # use the embedded cut for chi2(LifetimeFit)<9 !!! "ctau = BPVLTIME ( 9 ) * c_light " # ATTENTION, 9 is here! ] from GaudiConfUtils.ConfigurableGenerators import CombineParticles # ======================================================================== # B -> J/psi + K pi pi # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import CombineParticles bc_Kpp = CombineParticles( DecayDescriptor='[B+ -> J/psi(1S) K+ pi+ pi-]cc', # Preambulo=Preambulo, DaughtersCuts={ "J/psi(1S)": " in_range( 3.096 * GeV - 45 * MeV , M , 3.096 * GeV + 45 * MeV ) " }, # CombinationCut=""" in_range ( 5.0 * GeV , AM , 5.6 * GeV ) """ , # MotherCut=""" in_range ( 5.1 * GeV , M , 5.5 * GeV ) & ( PT > 1 * GeV ) & ( chi2vx < 49 ) & in_range ( 150 * micrometer , ctau , 1000 * micrometer ) """ , # ParticleCombiners={'': 'LoKi::VertexFitter'}, ReFitPVs=True ) # from PhysSelPython.Wrappers import Selection Bc_Kpp = Selection( 'PsiKpp', Algorithm=bc_Kpp, RequiredSelections=[jpsi, pions, kaons] ) # ======================================================================== # B -> J/psi + K # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import CombineParticles bc_K = CombineParticles( DecayDescriptor='[ B+ -> J/psi(1S) K+ ]cc', # Preambulo=Preambulo, DaughtersCuts={ "J/psi(1S)": " in_range( 3.096 * GeV - 45 * MeV , M , 3.096 * GeV + 45 * MeV ) " }, # CombinationCut=""" in_range ( 5.0 * GeV , AM , 5.6 * GeV ) """ , # MotherCut=""" in_range ( 5.1 * GeV , M , 5.5 * GeV ) & ( PT > 1 * GeV ) & ( chi2vx < 16 ) & in_range ( 150 * micrometer , ctau , 1000 * micrometer ) """ , ParticleCombiners={'': 'LoKi::VertexFitter'}, ReFitPVs=True ) # Bc_K = Selection( 'PsiK', Algorithm=bc_K, RequiredSelections=[jpsi, kaons] ) from PhysSelPython.Wrappers import SelectionSequence Seq_Kpp = SelectionSequence("PSIKPP", TopSelection=Bc_Kpp) Seq_K = SelectionSequence("PSIK", TopSelection=Bc_K) from Configurables import GaudiSequencer davinci.UserAlgorithms = [ GaudiSequencer( 'K', Members=[Seq_K .sequence(), 'B2PsiK']), GaudiSequencer('KPP', Members=[Seq_Kpp.sequence(), 'B2PsiKpp']) ] # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() # algKpp = B2Kpp( 'B2PsiKpp', # Algorithm name , Inputs=[Seq_Kpp.outputLocation()] ) algK = B2K( 'B2PsiK', # Algorithm name , Inputs=[Seq_K .outputLocation()] ) return SUCCESS
#=============== # Setup DaVinci DaVinci().EvtMax = -1 DaVinci().PrintFreq = 1000 DaVinci().Simulation = False #if jobType.startswith('MC'): DaVinci().Simulation = True #elif jobType.startswith('Data'): DaVinci().Simulation = False DaVinci().Lumi = False DaVinci().DataType = '2016' DaVinci().UserAlgorithms = [convLLSeq, convDDSeq, caloSeq, dimuSeq] #================ # Setup Turbo from Configurables import DstConf, TurboConf from PhysConf.Filters import LoKi_Filters hltFilter = LoKi_Filters( HLT2_Code="HLT_PASS_RE('.*ExoticaPrmptDiMuonTurboDecision.*')") DstConf().Turbo = True TurboConf().PersistReco = True #from GaudiConf import IOHelper #IOHelper().inputFiles([ # '~/DSTs/pPbPhotons/MinBiasMC.dst' #],clear=True) #=================== # Setup GaudiPython # Create gaudi and tes import GaudiPython gaudi = GaudiPython.AppMgr() tes = gaudi.evtsvc()
SelDSTWriterConf = {'default': myMicroDSTStreamConf(pack=False)} SelDSTWriterElements = {'default': stripMicroDSTElements(pack=False)} udstWriter = SelDSTWriter( "MyDSTWriter", StreamConf=SelDSTWriterConf, MicroDSTElements=SelDSTWriterElements, OutputFileSuffix='CFake', ## SelectionSequences = [ charmEW ] SelectionSequences=[s_cW] ) # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=" HLT_PASS_RE('Stripping.*(D0|Dh|D2|Ds|Lc|Lambdac)*.*') " # , VOID_Code = " SKIP ( 50 ) " ) the_year = "2011" ## the_year = "2012" fltrs = fltrs.filters('Filters') fltrs.reverse() from Configurables import DaVinci dv = DaVinci( EventPreFilters=fltrs, InputType='DST', DataType=the_year, EvtMax=-1, Lumi=True,
def configChkTrg ( config , colors = False ) : """ """ config.teslocation = config.teslocation.strip() # the basic configuration from BenderTools.DstExplorer import configure configure ( config , colors ) root = config.RootInTES line = config.teslocation if root : if 0 == line.find ( root + '/') : line = line.replace( root + '/' , '' ) logger.info('Line name is adjusted to be %s' % line ) elif 0 != config.teslocation.find ( '/Event/' ) : tmpl = '/Event/' + line if 0 == tmpl.find ( root ) : line = tmpl.replace( root , '' ) logger.info('Line name is adjusted to be %s' % line ) if 0 == line.find('/Event/') : line = line.replace( '/Event/' , '' ) logger.info('Line name is adjusted to be %s' % line ) if config.Simulation and 0 != line.find ( 'AllStreams/Phys/' ) : logger.warning('Suspicious line name %s' % line ) elif not config.Simulation and 0 != line.find ( 'Phys/' ) : logger.warning('Suspicious line name %s' % line ) if not 0 < line.rfind ('/Particles') : line = line + '/Particles' logger.info('Line name is adjusted to be %s' % line ) config.teslocation = line ## ## add filters: # from PhysConf.Filters import LoKi_Filters if root : location = root + '/' + line else : location = '/Event/' + line logger.info("Use filter for non-empty location:'%s'" % location ) fltrs = LoKi_Filters ( VOID_Code = " 0.5 < CONTAINS ('%s',True) " % location ) from Configurables import DaVinci dv = DaVinci ( EventPreFilters = fltrs.filters('Filters') , UserAlgorithms = [ 'CheckTrg' ] ) from BenderTools.Utils import silence, totalSilence silence() if config.Quiet or 5 <=config.OutputLevel : totalSilence() from Bender.Main import appMgr gaudi = appMgr() ## create algorithm ALGTYPE = chkTrg() ## .. and configure it kwargs = { 'Inputs' : [ config.teslocation ] } if config.OutputLevel <3 and not config.Quiet : kwargs.update ( { 'PropertiesPrint' : True } ) if config.RootInTES : kwargs.update ( { 'RootInTES' : config.RootInTES } ) alg = ALGTYPE ( 'CheckTrg', **kwargs ) return alg
def configure(datafiles, catalogs=[]): """ Configure the job: common part """ from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( VOID_Code=""" ( 0 < CONTAINS ( '/Event/Charm/Phys/CharmAndDiMuonForPromptCharm/Particles') ) | ( 0 < CONTAINS ( '/Event/Charm/Phys/DiCharmForPromptCharm/Particles' ) ) | ( 0 < CONTAINS ( '/Event/Charm/Phys/D02HHForPromptCharm/Particles' ) ) | ( 0 < CONTAINS ( '/Event/Charm/Phys/DForPromptCharm/Particles' ) ) | ( 0 < CONTAINS ( '/Event/Charm/Phys/DsForPromptCharm/Particles' ) ) """ ) filters = fltrs.filters('Filters') filters.reverse() from Configurables import DaVinci daVinci = DaVinci( DataType='2011', InputType='MDST', Simulation=False, PrintFreq=1000, # HistogramFile='CheckCuts_Histos.root', TupleFile='CheckCuts.root', # EventPreFilters=filters, Lumi=True ) from Configurables import CondDB CondDB(UseLatestTags=["2011"], ##UseOracle = True ) # define/set the input data setData(datafiles, catalogs) # get the actual application manager (create if needed) gaudi = appMgr() # create local algorithm: dplus = Dplus( 'Dplus', PropertiesPrint=True, HistoPrint=True, # RootInTES='/Event/Charm', Inputs=['Phys/DForPromptCharm/Particles'] # ) # create local algorithm: d0 = D0( 'D0', PropertiesPrint=True, HistoPrint=True, # RootInTES='/Event/Charm', Inputs=['Phys/D02HHForPromptCharm/Particles'] # ) # create local algorithm: dstar = Dstar( 'Dstar', PropertiesPrint=True, HistoPrint=True, # RootInTES='/Event/Charm', Inputs=['Phys/DstarForPromptCharm/Particles'] # ) # create local algorithm: dimu = Dimu( 'Dimu', PropertiesPrint=True, HistoPrint=True, # RootInTES='/Event/Charm', Inputs=['Phys/CharmAndDiMuonForPromptCharm/Particles'] ) # finally inform Application Manager about our algorithm mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [dplus . name(), d0 . name(), dstar . name(), dimu . name()] return SUCCESS
## Test data #from GaudiConf import IOHelper #IOHelper('ROOT').inputFiles(['/eos/lhcb/grid/prod/lhcb/LHCb/Collision16/EW.DST/00069603/0000/00069603_00001133_1.ew.dst'], clear = True) ##IOHelper('ROOT').inputFiles(['/tmp/dcraik/00069603_00001133_1.ew.dst'], clear = True) ## import DaVinci from Configurables import DaVinci from Configurables import CondDB from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( 'StrippingLowMultLMR2HHLineDecision' ) """) dv = DaVinci( DataType='2016', InputType='DST', TupleFile='Tuples.root', ## IMPORTANT HistogramFile='Histos.root', ## IMPORTANT Simulation=False, Lumi=True, EventPreFilters=fltrs.filters('Filters'), CondDBtag='cond-20180625-1', DDDBtag='dddb-20180726-3', DQFLAGStag='dq-20170627', EvtMax=-1 ##TODO #EvtMax = 1000 ##TODO ) db = CondDB(LatestGlobalTagByDataType='2016') db.LocalTags["DQFLAGS"] = ["herschel-20161018"]
#!/bin/env python import sys sys.path.append('.') from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code=""" HLT_PASS_RE ( '.*DarkBoson.*' ) """) stream = 'Bhadron' lines = [ 'B2KX2KKPi', 'B2KpiX2KKPi', 'B2KX2KKPiM', 'B2KpiX2KKPiM', 'B2KX2PiPiPi', 'B2KpiX2PiPiPi', 'B2KX2PiPiPiM', 'B2KpiX2PiPiPiM', 'B2KX2EtaPiPi23PI', 'B2KpiX2EtaPiPi23PI', 'B2KX2EtaPiPi2GG', 'B2KpiX2EtaPiPi2GG', 'B2KX24Pi', 'B2KpiX24Pi', 'B2KX26Pi', 'B2KpiX26Pi', 'B2KX22K2Pi', 'B2KpiX22K2Pi', 'B2KX24K', 'B2KpiX24K', 'B2KpiX2MuMuDD', 'B2KpiX2MuMuDDSS', 'B2KX2MuMuDD', 'B2KX2MuMuDDSS', 'B2KpiX2MuMu', 'B2KpiX2MuMuSS', 'B2KX2MuMu', 'B2KX2MuMuSS', 'B2KpiX2PiPi', 'B2KX2PiPi', 'B2KX2PiPiSS', 'B2KpiX2KK', 'B2KX2KK', 'B2KX2KKSS', 'B2KpiX2EE', 'B2KpiX2EESS', 'B2KX2EE', 'B2KX2EESS', 'B2JK', 'B2JKst', 'B2KstX2GammaGamma', 'B2KstX2PiGamma', 'B2KstX2PiGammaM' ] ## Data. #from GaudiConf import IOHelper #IOHelper('ROOT').inputFiles(['/data/alps/00103400_00000004_1.bhadron.mdst'],#'/tmp/dcraik/00095518_00000372_1.bhadron.mdst'], # clear = True) ##Type = 'MC' #from StandardParticles import StdAllLooseMuons as loosemuons #from StandardParticles import StdAllNoPIDsKaons as loosekaons #from StandardParticles import StdAllNoPIDsPions as loosepions
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci the_year = "2011" from BenderTools.Parser import hasInFile if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Collision13'): the_year = '2013' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' elif hasInFile(datafiles, 'Stripping20r1'): the_year = '2011' elif hasInFile(datafiles, 'Stripping20r1p1'): the_year = '2011' elif hasInFile(datafiles, 'Stripping20r0p1'): the_year = '2012' elif hasInFile(datafiles, 'MC11'): the_year = '2011' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) W_Location = '/Event/AllStreams/Phys/WMuLine/Particles' from PhysSelPython.Wrappers import AutomaticData W_Strip = AutomaticData(Location=W_Location) EW_preambulo = [ "pion_cuts = in_range ( 300 * MeV , PT , 10 * GeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 5 ) & ( TRGHOSTPROB < 0.5 ) & ( PERR2/P2 < 0.05**2 ) ", "ptCone_ = SUMCONE ( 0.25 , PT , '/Event/Phys/StdAllLoosePions/Particles' )", "ptCone_2 = SUMCONE ( 0.25 , PT , '/Event/Phys/StdAllLoosePions/Particles' , pion_cuts )", "etCone_ = SUMCONE ( 0.25 , PT , '/Event/Phys/StdLooseAllPhotons/Particles' )", "ptCone = SINFO ( 55001 , ptCone_ , True ) ", "ptCone2 = SINFO ( 55003 , ptCone_2 , True ) ", "etCone = SINFO ( 55002 , etCone_ , True ) ", ] # ======================================================================== # good W # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import FilterDesktop gW = FilterDesktop( Preambulo=EW_preambulo, Code=""" in_range ( 15 * GeV , PT , 100 * GeV ) & ( -1e+10 * GeV < ptCone ) & ( -1e+10 * GeV < ptCone2 ) & ( -1e+10 * GeV < etCone ) """ ) from PhysSelPython.Wrappers import Selection W_Data = Selection( 'W', Algorithm=gW, RequiredSelections=[W_Strip] ) from PhysSelPython.Wrappers import SelectionSequence seq = SelectionSequence("Wseq", TopSelection=W_Data) # counters from Configurables import LoKi__CounterAlg as CounterAlg cnt = CounterAlg( 'CharmEWCounters', Location="Counters/CharmEW", Preambulo=[ "from LoKiPhys.decorators import *", "from LoKiCore.functions import *", "pion_cuts = in_range ( 300 * MeV , PT , 120 * GeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 5 ) ", "gamma_cuts = in_range ( 300 * MeV , PT , 10 * GeV ) ", "pions = SOURCE ( '/Event/Phys/StdAllNoPIDsPions/Particles' , pion_cuts ) ", "gammas = SOURCE ( '/Event/Phys/StdLooseAllPhotons/Particles' , gamma_cuts ) ", ], Variables={ "px_c": " pions >> sum ( PX ) ", "py_c": " pions >> sum ( PY ) ", "px_g": " gammas >> sum ( PX ) ", "py_g": " gammas >> sum ( PY ) ", "n_c": " pions >> SIZE ", "g_c": " gammas >> SIZE ", } ) from Configurables import DataOnDemandSvc dod = DataOnDemandSvc() dod.AlgMap['/Event/Counters/CharmEW'] = cnt # ======================================================================== # prefilters for drastical speedup in the reading of input data # ======================================================================== from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=" HLT_PASS_RE ( 'Stripping.*WMuLine.*Decision' ) " ) davinci = DaVinci( EventPreFilters=fltrs.filters('Filters'), # PREFILTERS DataType=the_year, InputType='DST', Simulation=True, PrintFreq=10000, EvtMax=-1, # HistogramFile='MCW_Histos.root', TupleFile='MCW.root', # ) # connect to DaVinci from Configurables import GaudiSequencer davinci.UserAlgorithms = [ GaudiSequencer('MySeq', Members=[seq.sequence(), 'MCW']) ] # # take care abotu DB-tags: # # try to get the tags from Rec/Header from BenderTools.GetDBtags import getDBTags tags = getDBTags( datafiles[0], castor ) logger.info('Extract tags from DATA : %s' % tags) if tags.has_key('DDDB') and tags['DDDB']: davinci.DDDBtag = tags['DDDB'] logger.info('Set DDDB %s ' % davinci.DDDBtag) if tags.has_key('CONDDB') and tags['CONDDB']: davinci.CondDBtag = tags['CONDDB'] logger.info('Set CONDDB %s ' % davinci.CondDBtag) if tags.has_key('SIMCOND') and tags['SIMCOND']: davinci.CondDBtag = tags['SIMCOND'] logger.info('Set SIMCOND %s ' % davinci.CondDBtag) # # remove excessive printout # from Configurables import MessageSvc msg = MessageSvc() msg.setError += ['HcalDet.Quality', 'EcalDet.Quality', 'MagneticFieldSvc', 'PropertyConfigSvc', 'ToolSvc.L0DUConfig', 'ToolSvc.L0CondDBProvider', 'L0MuonFromRaw', 'IntegrateBeamCrossing'] # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() # # more silence # _a = gaudi.tool('ToolSvc.L0DUConfig') _a.OutputLevel = 4 alg = MCW( 'MCW', Inputs=[seq.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'] ) return SUCCESS
from Configurables import DaVinci DaVinci().DataType = ThisDataType DaVinci().DDDBtag = ThisDDDBtag DaVinci().CondDBtag = ThisCLCondDBtag DaVinci().DQFLAGStag = ThisDQFLAGStag DaVinci().Lumi = True #DaVinci().Lumi = False DaVinci().TupleFile = 'lumi.root' if 'MC' in Type: DaVinci().Simulation = True DaVinci().Lumi = False DaVinci().CondDBtag = ThisMCCondDBtag if 'Turbo' in Type: from Configurables import DstConf, TurboConf from PhysConf.Filters import LoKi_Filters hlt = LoKi_Filters( HLT2_Code="HLT_PASS_RE('.*Hlt2Exotica.*TurboDecision.*')") DstConf().Turbo = True TurboConf().PersistReco = True DaVinci().EventPreFilters = hlt.filters('TriggerFilters') # Tag configuration. TrkCats = [('ve', 1), ('tt', 2), ('it', 3), ('ot', 4), ('mu', 7)] #TrgLocs = ['Hlt2ExoticaPrmptDiMuonSSTurbo', # 'Hlt2ExoticaPrmptDiMuonTurbo', # 'Hlt2ExoticaDiMuonNoIPTurbo', # 'Hlt2ExoticaQuadMuonNoIP', # 'Hlt2ExoticaDisplDiMuon'] TrgLocs = [] #TrgLocs = ['Hlt2ExoticaDisplDiE']
dtt.Dstar.addTupleTool('TupleToolDecayTreeFitter/ConsDKpi') dtt.Dstar.ConsDKpi.constrainToOriginVertex = True dtt.Dstar.ConsDKpi.Verbose = True dtt.Dstar.ConsDKpi.daughtersToConstrain = ['D0'] dtt.Dstar.ConsDKpi.Substitutions = { # mark particle in key to substitute with ^, substitute with value 'Charm -> (D0 -> K- ^K+) Meson': 'pi+', # generalised: D*(2010)->Charm, pisoft->Meson 'Charm -> (D~0 -> K+ ^K-) Meson': 'pi-' } from Configurables import DaVinci from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = "HLT_PASS_RE('StrippingD2hhPromptDst2D2KKLineDecision')" ) DaVinci().EventPreFilters = fltrs.filters('Filters') # Configure DaVinci DaVinci().UserAlgorithms += [dtt] DaVinci().InputType = 'DST' DaVinci().TupleFile = 'DVntuple.root' DaVinci().PrintFreq = 1000 DaVinci().DataType = '2016' DaVinci().Simulation = True #DaVinci().RootInTES = '/Event/{0}'.format(stream) # for microDST # Only ask for luminosity information when not using simulated data DaVinci().Lumi = not DaVinci().Simulation DaVinci().EvtMax = -1 DaVinci().CondDBtag = 'sim-20170721-2-vc-md100' DaVinci().DDDBtag = 'dddb-20170721-3'
StreamConf = SelDSTWriterConf , MicroDSTElements = SelDSTWriterElements , OutputFileSuffix = 'BandQ' , ## output PRE-fix! SelectionSequences = [ psi_x0 , ] ) # ## Read only fired events to speed up # from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE ( 'Stripping.*DiMuonJpsi2MuMuDetached.*' ) | HLT_PASS_RE ( 'Stripping.*DiMuonPsi2MuMuDetached.*' ) | HLT_PASS_RE ( 'Stripping.*DiMuonDiMuonHighMass.*' ) """ ) # ## protection against ``corrupted'' Stripping 17b DIMUON.DST # obsolete? # also add protection against very busy events fltrs_0 = LoKi_Filters ( VOID_Code = """ ( EXISTS ( '/Event/DAQ/RawEvent' ) | EXISTS ( '/Event/Trigger/RawEvent' ) ) & EXISTS ( '/Event/Strip/Phys/DecReports') & ( RECSUMMARY ( 0 , -1 ) > 0.5 ) & ( RECSUMMARY ( 10 , -1 ) < 500 ) & ( RECSUMMARY ( 13 , -1 ) < 500 ) &
#------------------------------------------------------------------------- from Configurables import DaVinci from Configurables import OfflineVertexFitter from Configurables import DecayTreeTuple, MCDecayTreeTuple importOptions("Xb2JpsiXTree.py") tuple = DecayTreeTuple( "Lb2JpsiSTree" ) tuple.Inputs = [ SeqLb2JpsiS.outputLocation() ] from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(STRIP_Code = "(HLT_PASS_RE('StrippingFullDSTDiMuonJpsi2MuMuDetachedLineDecision'))" ) from Configurables import DaVinci DaVinci().Simulation = False DaVinci().EvtMax = -1 # Number of events DaVinci().EventPreFilters = fltrs.filters('Filter') DaVinci().UserAlgorithms = [ seq, tuple ] from Configurables import CondDB #CondDB(UseOracle = True) #importOptions("$APPCONFIGOPTS/DisableLFC.py") #CondDB().IgnoreHeartBeat = True DaVinci().DataType = "2012" #DaVinci().DDDBtag = "head-20110914" #DaVinci().CondDBtag = "head-20111102" DaVinci().TupleFile = "DVNtuples.root" DaVinci().PrintFreq = 10000
def configure ( datafiles , catalogs = [] , castor = False ) : """ Configure the job """ from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from PhysConf.Filters import LoKi_Filters # "/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine" fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE ( 'Stripping.*DiMuonHighMass.*Decision' ) """ , VOID_Code = """ 0 < CONTAINS ('/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles') """ ) filters = fltrs.filters('Filters') filters.reverse() script = os.path.basename(__file__).split('.')[0] davinci = DaVinci ( DataType = '2012' , PrintFreq = 1000 , EventPreFilters = filters , EvtMax = -1 , ## HistogramFile = '%s_Histos.root' % script, TupleFile = '%s_Tuples.root' % script, ## Lumi = True , ## ) # # ========================================================================= # RootInTES = 'Leptonic' # # ========================================================================= # from BenderTools.MicroDST import uDstConf # uDstConf(RootInTES) # ========================================================================= from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # ========================================================================= # come back to Bender setData ( datafiles , catalogs , castor ) gaudi = appMgr() alg = Chib ( 'Chib' , ## Algorithm name , # input particles # RootInTES = RootInTES , # For DiMuon DST # Inputs = [ '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles'] , # '/Event/Phys/StdLooseAllPhotons/Particles'] , # Inputs = ['Phys/MicroDSTDiMuonDiMuonIncLine/Particles'], # take care about the proper particle combiner ParticleCombiners = { '' : 'LoKi::VertexFitter'} ) # ========================================================================= mainSeq = gaudi.algorithm ('GaudiSequencer/DaVinciUserSequence', True ) mainSeq.Members += [ alg.name() ] # ========================================================================= return SUCCESS
#!/bin/env python import sys sys.path.append('.') from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( ####DiJet* STRIP_Code=""" HLT_PASS_RE ( 'StrippingHltQEEJetsDiJet.*LineDecision' ) """) ####DiJetSV{,HighPt,LowPt} # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVLineDecision' ) # | HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVHighPtLineDecision' ) # | HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVLowPtLineDecision' ) # """ # ) ####DiJetSV* # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSV.*LineDecision' ) # """ # ) ####DiJet # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetLineDecision' ) # """ # ) # Data type configuration. from GaudiKernel import SystemOfUnits as Units ##Type = 'MC'
def configure(datafiles, catalogs=[], castor=True, params=None): """ Configure the job """ from Configurables import DaVinci # needed for job configuration # from Configurables import EventSelector # needed for job configuration # from Configurables import NTupleSvc from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*DiMuonHighMass.*Decision' ) """, VOID_Code=""" 0 < CONTAINS ( '/Event/AllStreams/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles') """ ) filters = fltrs.filters('Filters') filters.reverse() from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence # # defimuon in stripping DST # # DiMuLocation = # '/Event/Dimuon/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles' DiMuLocation = '/Event/AllStreams/Phys/FullDSTDiMuonDiMuonHighMassLine/Particles' from PhysSelPython.Wrappers import AutomaticData DiMuData = AutomaticData(Location=DiMuLocation) # ========================================================================= # Upsilon -> mumu, cuts by Giulia Manca # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import FilterDesktop UpsAlg = FilterDesktop( Code=""" ( M > 7 * GeV ) & DECTREE ('Meson -> mu+ mu-' ) & CHILDCUT( 1 , HASMUON & ISMUON ) & CHILDCUT( 2 , HASMUON & ISMUON ) & ( MINTREE ( 'mu+' == ABSID , PT ) > 1 * GeV ) & ( MAXTREE ( ISBASIC & HASTRACK , TRCHI2DOF ) < 4 ) & ( MINTREE ( ISBASIC & HASTRACK , CLONEDIST ) > 5000 ) & ( VFASPF ( VPCHI2 ) > 0.5/100 ) & ( abs ( BPV ( VZ ) ) < 0.5 * meter ) & ( BPV ( vrho2 ) < ( 10 * mm ) ** 2 ) """, Preambulo=[ "vrho2 = VX**2 + VY**2" ], ReFitPVs=True ) UpsSel = Selection( 'UpsSel', Algorithm=UpsAlg, RequiredSelections=[DiMuData] ) # ========================================================================= # chi_b -> Upsilon gamma # ======================================================================== from GaudiConfUtils.ConfigurableGenerators import CombineParticles ChibCombine = CombineParticles( DecayDescriptor="chi_b1(1P) -> J/psi(1S) gamma", DaughtersCuts={ "gamma": " ( 350 * MeV < PT ) & ( CL > 0.01 ) " }, CombinationCut=""" ( AM - AM1 ) < 3 * GeV """, MotherCut=" PALL", # # we are dealing with photons! # ParticleCombiners={ '': 'LoKi::VertexFitter' } ) from StandardParticles import StdLooseAllPhotons # needed for chi_b ChibSel1 = Selection( 'PreSelChib', Algorithm=ChibCombine, RequiredSelections=[UpsSel, StdLooseAllPhotons] ) from GaudiConfUtils.ConfigurableGenerators import Pi0Veto__Tagger TagAlg = Pi0Veto__Tagger( ExtraInfoIndex=25001, # should be unique! MassWindow=20 * MeV, # cut on delta-mass MassChi2=-1, # no cut for chi2(mass) ) ChibSel2 = Selection( 'Chi_b', Algorithm=TagAlg, RequiredSelections=[ChibSel1] ) Chib = SelectionSequence("ChiB", TopSelection=ChibSel2) # print 'OUTPUT!!!' , output_loc # ========================================================================= # Upsilons # ======================================================================== Ups = SelectionSequence("UpsSelSeq", TopSelection=UpsSel) # ======================================================================== from Configurables import GaudiSequencer myChibSeq = GaudiSequencer('MyChibSeq') myChibSeq.Members = [Chib.sequence()] + ["ChibAlg"] myUpsSeq = GaudiSequencer('MyUpsSeq') myUpsSeq.Members = [Ups.sequence()] + ["UpsilonAlg"] davinci = DaVinci( EventPreFilters=filters, DataType='2011', Simulation=True, InputType='DST', HistogramFile="chib_histos.root", TupleFile="chib_tuples.root", PrintFreq=1000, Lumi=True, EvtMax=-1 ) davinci.UserAlgorithms = [myChibSeq, myUpsSeq] # ========================================================================= from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # ========================================================================= # come back to Bender setData(datafiles, catalogs, castor) gaudi = appMgr() alg_chib = ChibMC( 'ChibAlg', # Algorithm name , # input particles Inputs=[ Chib.outputLocation() ], # take care about the proper particle combiner ParticleCombiners={'': 'LoKi::VertexFitter'} ) alg_ups = UpsilonMC( 'UpsilonAlg', # Algorithm name , # input particles Inputs=[ Ups.outputLocation() ], # take care about the proper particle combiner ParticleCombiners={'': 'LoKi::VertexFitter'} ) alg_chib.nb = alg_ups.nb = params['nb'] alg_chib.np = alg_ups.np = params['np'] # ========================================================================= return SUCCESS
uDstWriter = SelDSTWriter( "MyDSTWriter", StreamConf=SelDSTWriterConf, MicroDSTElements=SelDSTWriterElements, OutputFileSuffix='BandQ', # output PRE-fix! SelectionSequences=[ups_charm] ) # # Read only fired events to speed up # from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*%s.*' ) """ % ups_name ) # ======================================================================== # The last step: DaVinci & DB # ======================================================================== ##the_year = '2012' the_year = '2011' from Configurables import DaVinci davinci = DaVinci( # DataType=the_year, # ATTENTION !! #
def configure(datafiles, catalogs=[], castor=False, params={}): """ Job configuration """ from BenderTools.Parser import hasInFile the_year = "2011" if params: the_year = params['Year'] logger.info('Year is set from params to be %s ' % the_year) else: if hasInFile(datafiles, 'Collision11'): the_year = '2011' elif hasInFile(datafiles, 'Collision12'): the_year = '2012' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping13'): the_year = '2011' elif hasInFile(datafiles, 'Stripping15'): the_year = '2011' elif hasInFile(datafiles, 'Stripping17'): the_year = '2011' elif hasInFile(datafiles, 'Stripping19'): the_year = '2012' logger.info('Year is set from files to be %s ' % the_year) # # check # if '2011' == the_year and hasInFile(datafiles, 'Collision12'): raise AttributeError, 'Invalid Year %s ' % the_year if '2012' == the_year and hasInFile(datafiles, 'Collision11'): raise AttributeError, 'Invalid Year %s ' % the_year logger.info('Use the Year = %s ' % the_year) # # pseudo stripping & WG-production # # from PhysSelPython.Wrappers import AutomaticData # jpsi_location = '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles' # jpsi = AutomaticData ( Location = jpsi_location ) # if '2012' == the_year : ## import StrippingArchive.Stripping20.StrippingDiMuonNew as DiMuon ## import StrippingSettings.Stripping20.LineConfigDictionaries_BandQ as LineSettings # elif '2011' == the_year : ## import StrippingArchive.Stripping20r1.StrippingDiMuonNew as DiMuon ## import StrippingSettings.Stripping20r1.LineConfigDictionaries_BandQ as LineSettings ## config = LineSettings.FullDSTDiMuon['CONFIG'] ## name = 'FullDST' ## builder = DiMuon.DiMuonConf ( name , config ) # selection ## jpsi = builder.SelJpsi2MuMuDetached import CommonParticles.StdLooseJpsi2MuMu # from StandardParticles import StdLooseJpsi2MuMu # jpsi = StdLooseJpsi2MuMu from PhysSelPython.Wrappers import AutomaticData jpsi = AutomaticData('/Event/Phys/StdLooseJpsi2MuMu/Particles') from GaudiConfUtils.ConfigurableGenerators import FilterDesktop # pions : alg_pions = FilterDesktop( # Code=""" ( PT > 500 * MeV ) & ( CLONEDIST > 5000 ) & ( TRGHOSTPROB < 0.5 ) & ( TRCHI2DOF < 4 ) & in_range ( 2 , ETA , 5 ) & HASRICH & ( PIDpi - PIDK > -2 ) """ , ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllLoosePions pions = Selection( "ThePions", Algorithm=alg_pions, RequiredSelections=[StdAllLoosePions] ) alg_kaons = FilterDesktop( # Code=""" ( PT > 500 * MeV ) & ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.5 ) & in_range ( 2 , ETA , 5 ) & HASRICH & ( PIDK - PIDpi > -2 ) """ ) from StandardParticles import StdAllLooseKaons kaons = Selection( "TheKaons", Algorithm=alg_kaons, RequiredSelections=[StdAllLooseKaons] ) # Preambulo = [ # shortcut for chi2 of vertex fit "chi2vx = VFASPF(VCHI2)", # shortcut for the c*tau "from GaudiKernel.PhysicalConstants import c_light", # use the embedded cut for chi2(LifetimeFit)<16 "ctau_25 = BPVLTIME ( 25 ) * c_light ", "mbc_acut = in_range ( 6.050 * GeV , AM , 6.550 * GeV ) ", "mbp_acut = in_range ( 5.100 * GeV , AM , 5.550 * GeV ) ", # mass-cut for beauty particles "mbc_cut = in_range ( 6.100 * GeV , M , 6.500 * GeV ) ", "mbp_cut = in_range ( 5.150 * GeV , M , 5.500 * GeV ) ", ] # Bc : from GaudiConfUtils.ConfigurableGenerators import CombineParticles alg_bc = CombineParticles( DecayDescriptor="[B_c+ -> J/psi(1S) pi+ ]cc", Preambulo=Preambulo, CombinationCut=" mbc_acut ", MotherCut=""" ( chi2vx < 20 ) & mbc_cut & ( ctau_25 > %s ) """ % ( 40 * micrometer ) ) sel_bc = Selection( "TheBc", Algorithm=alg_bc, RequiredSelections=[jpsi, pions] ) # B+ : alg_bu = CombineParticles( DecayDescriptor="[B+ -> J/psi(1S) K+ ]cc", Preambulo=Preambulo, CombinationCut=" mbp_acut ", MotherCut=""" ( chi2vx < 20 ) & mbp_cut & ( ctau_25 > %s ) """ % ( 40 * micrometer ) ) sel_bu = Selection( "TheB", Algorithm=alg_bu, RequiredSelections=[jpsi, kaons] ) # B0 : alg_bd = CombineParticles( DecayDescriptor="[B0 -> J/psi(1S) K+ pi-]cc", Preambulo=Preambulo, CombinationCut=""" mbp_acut & in_range ( 600 * MeV , AM23 , 1.2 * GeV ) """ , MotherCut=""" ( chi2vx < 50 ) & mbp_cut & ( ctau_25 > %s ) """ % ( 40 * micrometer ) ) sel_bd = Selection( "TheB0", Algorithm=alg_bd, RequiredSelections=[jpsi, kaons, pions] ) from PhysSelPython.Wrappers import SelectionSequence selseq_pi = SelectionSequence("Bc", TopSelection=sel_bc) selseq_k = SelectionSequence("Bu", TopSelection=sel_bu) selseq_kst = SelectionSequence("Bd", TopSelection=sel_bd) # Read only fired events to speed up from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( # # Require at least one primary vertex # VOID_Code=""" ( RECSUMMARY ( 0 , -1 ) > 0.5 ) """ ) # # make the final sequencers: # from Configurables import GaudiSequencer seq_pi = GaudiSequencer( 'PION', Members=[selseq_pi . sequence(), "MCB2PI"] ) seq_k = GaudiSequencer( 'KAON', Members=[selseq_k . sequence(), "MCB2K"] ) seq_kst = GaudiSequencer( 'KSTAR', Members=[selseq_kst . sequence(), "MCB2KST"] ) # # make the final choice # mode = params['Mode'] mode = mode.upper() if 0 <= mode.find('BC') or 0 <= mode.find('PI'): seq = seq_pi elif 0 <= mode.find( 'B+' ) or 0 <= mode.find('BP') or \ 0 <= mode.find('BU') or 0 <= mode.find('K+'): seq = seq_k elif 0 <= mode.find('B0') or 0 <= mode.find('BZ') or 0 <= mode.find('K*'): seq = seq_kst # # finally: DaVinci # ## needed for job configuration from Configurables import DaVinci davinci = DaVinci( EventPreFilters=fltrs.filters('Filters'), DataType=the_year, InputType='MDST', Simulation=True, PrintFreq=1000, EvtMax=-1, # HistogramFile='MCBc_Histos.root', TupleFile='MCBc.root', # DDDBtag=params['DDDB'], CondDBtag=params['SIMCOND'], # Lumi=False # True , # ) from BenderTools.Utils import silence silence() # # finally inform Davinci about algorithsm # davinci.UserAlgorithms = [ seq ] # # come back to Bender # setData(datafiles, catalogs, castor) # # start Gaudi # gaudi = appMgr() # # alg1 = MCB2PsiH( 'MCB2PI', # Algorithm name , Inputs=[selseq_pi.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'], ReFitPVs=True ) alg2 = MCB2PsiH( 'MCB2K', # Algorithm name , Inputs=[selseq_k.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'], ReFitPVs=True ) alg3 = MCB2PsiH( 'MCB2KST', # Algorithm name , Inputs=[selseq_kst.outputLocation()], PP2MCs=['Relations/Rec/ProtoP/Charged'], ReFitPVs=True ) alg3._decay = '[ Beauty -> ( J/psi(1S) -> mu+ mu- ) K+ pi- ]CC' return SUCCESS
#!/bin/env python import sys sys.path.append('.') from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( ####DiJet* # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJet.*LineDecision' ) # """ # ) ####DiJetSV{,HighPt,LowPt} STRIP_Code=""" HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVLineDecision' ) | HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVHighPtLineDecision' ) | HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSVLowPtLineDecision' ) """) ####DiJetSV* # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetSV.*LineDecision' ) # """ # ) ####DiJet # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHltQEEJetsDiJetLineDecision' ) # """ # ) # Data type configuration.
def configure_Charm(datafiles, catalogs=[]): """ Job configuration """ ## needed for job configuration from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from GaudiConf.Configuration import FileCatalog ## needed for job configuration from GaudiConf.Configuration import NTupleSvc from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters( STRIP_Code=""" HLT_PASS_RE ( 'Stripping.*ForPromptCharm.*Decision' ) """, VOID_Code=""" ( 0.5 < CONTAINS ('/Event/Charm/Phys/D02HHForPromptCharm/Particles' ) ) | ( 0.5 < CONTAINS ('/Event/Charm/Phys/DstarForPromptCharm/Particles' ) ) | ( 0.5 < CONTAINS ('/Event/Charm/Phys/DForPromptCharm/Particles' ) ) | ( 0.5 < CONTAINS ('/Event/Charm/Phys/DsForPromptCharm/Particles' ) ) | ( 0.5 < CONTAINS ('/Event/Charm/Phys/LambdaCForPromptCharm/Particles' ) ) """ ) filters = fltrs.filters('Filters') filters.reverse() davinci = DaVinci( DataType='2011', InputType='MDST', Simulation=False, PrintFreq=1000, EventPreFilters=filters, EvtMax=-1, # HistogramFile='TrgEff_Histos.root', TupleFile='TrgEff.root', # Lumi=True, # ) from Configurables import CondDB CondDB(UseLatestTags=["2011"]) # from Configurables import Gaudi__IODataManager as IODataManager # IODataManager().AgeLimit = 2 # # configure TIS-TOS # rootInTES = '/Event/Charm' from MicroDSTConf.TriggerConfUtils import configureL0AndHltDecoding configureL0AndHltDecoding(rootInTES) # come back to Bender setData(datafiles, catalogs) gaudi = appMgr() # Set properties of the TisTosTools for t in (gaudi.tool('TrgEff.L0TriggerTisTos'), gaudi.tool('TrgEff.TriggerTisTos')): t . UseParticle2LHCbIDsMap = 2 t . PropertiesPrint = True alg = TrgEff( RootInTES=rootInTES, Inputs=['Phys/D02HHForPromptCharm/Particles', 'Phys/DstarForPromptCharm/Particles', 'Phys/DForPromptCharm/Particles', 'Phys/DsForPromptCharm/Particles', 'Phys/LambdaCForPromptCharm/Particles'] ) # mainSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True) mainSeq.Members += [alg.name()] return SUCCESS
def configure( inputdata, ## the list of input files catalogs=[], ## xml-catalogs (filled by GRID) castor=False, ## use the direct access to castor/EOS ? params={}): ## import DaVinci from Configurables import DaVinci decay = '[(D0 => K- mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC' decay_K = '[(D0 => ^K- mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC' decay_mu = '[(D0 => K- ^mu+ nu_mu) && ~(D0 --> K- (pi0|eta) mu+ nu_mu ... )]CC' from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters(MC_Code="has ( MCDECTREE('%s') )" % decay, MC_Preambulo=["from LoKiCore.functions import has"]) ## delegate the actual configuration to DaVinci dv = DaVinci(DataType='2012', EventPreFilters=fltrs.filters('MC-filter'), InputType='DST', Simulation=True, TupleFile='Xuhao.root', DDDBtag='Sim08-20130503-1', CondDBtag='Sim08-20130503-1-vc-md100') ## ## reconstruct D0 -> K mu candidates ## from StandardParticles import StdAllLooseKaons as kaons from StandardParticles import StdAllLooseMuons as muons from PhysSelPython.Wrappers import SimpleSelection from GaudiConfUtils.ConfigurableGenerators import FilterDesktop # true_kaons = SimpleSelection( 'MCTrueKaon', ## selection name FilterDesktop, ## algorithm type [kaons], ## input/required selection ## algorithm propperties Preambulo=["from LoKiPhysMC.decorators import *"], Code="mcMatch ('%s', 2 )" % decay_K) # true_muons = SimpleSelection( 'MCTrueMuon', ## selection name FilterDesktop, ## algorithm type [muons], ## input/required selection ## algorithm propperties Preambulo=["from LoKiPhysMC.decorators import *"], Code="mcMatch ('%s', 2 )" % decay_mu) from GaudiConfUtils.ConfigurableGenerators import CombineParticles sel_D0 = SimpleSelection( 'SelD0', ## name CombineParticles, ## algorithm type [true_muons, true_kaons], ## input/required selections ## the decays to be reconstructed DecayDescriptor='[D0 -> K- mu+]cc', ## combination cut : mass window CombinationCut=""" in_range ( 1 * GeV , AM , 2 * GeV ) """, ## mother cut : require good vertex & some separation MotherCut=""" ( VFASPF( VCHI2 ) < 10 ) & ( BPVVDCHI2 > 9 ) """, ) from PhysSelPython.Wrappers import SelectionSequence SEQ_D0 = SelectionSequence('TRUED0', sel_D0) alg1_name = 'Lines' ## add the name of Bender algorithm into User sequence sequence from Configurables import GaudiSequencer seq_lines = GaudiSequencer('SEQ_lines', Members=[SEQ_D0.sequence(), alg1_name]) alg2_name = 'TisTosAlg' ## add the name of Bender algorithm into User sequence sequence from Configurables import GaudiSequencer seq_tistos = GaudiSequencer('SEQ_tistos', Members=[SEQ_D0.sequence(), alg2_name]) dv.UserAlgorithms = [seq_lines, seq_tistos] ## define the input data setData(inputdata, catalogs, castor) from BenderTools.Utils import silence, totalSilence silence() totalSilence() ## get/create application manager gaudi = appMgr() alg1 = Lines(alg1_name, Inputs=[SEQ_D0.outputLocation()]) alg2 = Tistos(alg2_name, Inputs=[SEQ_D0.outputLocation()]) return SUCCESS
#IOHelper('ROOT').inputFiles(['/eos/lhcb/grid/prod/lhcb/LHCb/Protonion16/IFT.DST/00076144/0000/00076144_00000038_1.ift.dst'], clear = True) #IOHelper('ROOT').inputFiles(['/tmp/dcraik/00076144_00000038_1.ift.dst'], clear = True) #IOHelper('ROOT').inputFiles(["/eos/lhcb/grid/prod/lhcb/LHCb/Lead18/IFT.DST/00089031/0000/00089031_00009979_1.ift.dst"], clear = True) ## import DaVinci from Configurables import DaVinci from Configurables import CondDB from PhysConf.Filters import LoKi_Filters #fltrs = LoKi_Filters ( # STRIP_Code = """ # HLT_PASS_RE ( 'StrippingHeavyIonTopologyLowActivityLineDecision' ) # """ #) fltrs = LoKi_Filters( HLT1_Code= "(HLT_PASS('Hlt1BBMicroBiasSoftCEPDecision')) | (HLT_PASS('Hlt1BBMicroBiasLowMultVeloDecision'))" ) dv = DaVinci( DataType='2018', InputType='DST', TupleFile='Tuples.root', ## IMPORTANT HistogramFile='Histos.root', ## IMPORTANT Simulation=False, Lumi=True, EventPreFilters=fltrs.filters('Filters'), #CondDBtag = 'cond-20180625-1', #DDDBtag = 'dddb-20180726-3', #DQFLAGStag = 'dq-20170627', EvtMax=-1 ##TODO #EvtMax = 10000 ##TODO
def configure(datafiles, catalogs=[], params={}, castor=False): """ Configure the job """ from Configurables import DaVinci ## needed for job configuration ## get the builder from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PSIX ## for MC it is better to exclude PID/DLL/PROBNN cuts builder_configuration = { # 'PionCut' : """ # ( PT > 200 * MeV ) & 'PionCut' : """ ( CLONEDIST > 5000 ) & """ # ( TRGHOSTPROB < 0.5 ) & # ( TRCHI2DOF < 4 ) & # in_range ( 2 , ETA , 5 ) & # in_range ( 3.2 * GeV , P , 150 * GeV ) & # HASRICH & # ( PROBNNpi > 0.1 ) #( MIPCHI2DV() > 4 ) , # ( PT > 200 * MeV ) & 'KaonCut' : """ ( CLONEDIST > 5000 ) & ( TRGHOSTPROB < 0.5 ) & ( TRCHI2DOF < 4 ) & in_range ( 2 , ETA , 5 ) & in_range ( 3.2 * GeV , P , 150 * GeV ) & HASRICH & ( PROBNNk > 0.1 ) """ # ( MIPCHI2DV() > 4 ) } def _kaons_ ( self ) : """ Kaons for B -> psi X lines """ from GaudiConfUtils.ConfigurableGenerators import FilterDesktop ## from StandardParticles import StdAllLooseKaons as inpts from StandardParticles import StdNoPIDsKaons as inpts ## return self.make_selection ( 'Kaon' , FilterDesktop , [ inpts ] , Code = self['KaonCut'] , ) def _pions_ ( self ) : """ Pions for B -> psi X lines """ from GaudiConfUtils.ConfigurableGenerators import FilterDesktop ## from StandardParticles import StdAllLoosePions as inpts from StandardParticles import StdNoPIDsPions as inpts ## return self.make_selection ( 'Pion' , FilterDesktop , [ inpts ] , Code = self['PionCut'] , ) jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine' psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine' from PhysSelPython.Wrappers import AutomaticData jpsi = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ) psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name ) # ## merged selectoon for J/psi & psi' # from PhysSelPython.Wrappers import MergedSelection psis = MergedSelection ( 'SelDetachedPsisForBandQ' , RequiredSelections = [ jpsi ] ) def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return psis PSIX.pions = _pions_ PSIX.kaons = _kaons_ PSIX.psi = _psi_ ## use builder builder = PSIX ( 'PsiX' , builder_configuration ) from PhysSelPython.Wrappers import SelectionSequence psi3k = SelectionSequence ( 'Psi3K' , builder.psi_3K () ) psi3kpi = SelectionSequence ( 'Psi3Kpi' , builder.psi_3Kpi () ) from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE('Stripping.*FullDSTDiMuonJpsi2MuMuDetachedLine.*') """ ) davinci = DaVinci( EventPreFilters = fltrs.filters('WG'), InputType = 'DST' , Simulation = True , PrintFreq = 1000 , EvtMax = -1 , Lumi = True , DataType = params['Year'], DDDBtag = params['DDDB'], CondDBtag = params['SIMCOND'], # HistogramFile = 'DVHistos.root' , TupleFile = 'output_kpipi.root' , ) from Configurables import GaudiSequencer # seq = GaudiSequencer('SEQ1', Members=[psi3k.sequence()]) seq = GaudiSequencer('SEQ2', Members=[psi3kpi.sequence()]) my_name = "Bplus" davinci.UserAlgorithms = [ my_name ] setData ( datafiles , catalogs , castor ) gaudi = appMgr() from StandardParticles import StdAllNoPIDsPions, StdAllNoPIDsKaons # create local algorithm: alg = MCAnalysisAlgorithm( my_name, Inputs = [ StdAllNoPIDsPions.outputLocation(), StdAllNoPIDsKaons.outputLocation(), '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ] , PP2MCs = [ 'Relations/Rec/ProtoP/Charged' ], ReFitPVs = True ) return SUCCESS
def configure ( datafiles , catalogs = [] , castor = False ) : """ Configure the job """ from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE ( 'Stripping.*DiMuonInc.*Decision' ) """ , VOID_Code = """ 0 < CONTAINS ('/Event/Leptonic/Phys/MicroDSTDiMuonDiMuonIncLine/Particles') """ ) filters = fltrs.filters('Filters') davinci = DaVinci ( DataType = '2012' , PrintFreq = 1000 , EventPreFilters = filters , EvtMax = -1 , ## HistogramFile = 'Jpsi_Histos.root' , TupleFile = 'Jpsi_Tuples.root' , ## Lumi = True , ## ) ## from Configurables import CondDB ## CondDB ( UseLatestTags = ["2011"] , ## UseOracle = True ) RootInTES = 'Leptonic' from BenderTools.MicroDST import uDstConf uDstConf(RootInTES) from Configurables import Gaudi__IODataManager as IODataManager IODataManager().AgeLimit = 2 # come back to Bender setData ( datafiles , catalogs , castor ) gaudi = appMgr() alg = Jpsi ( 'Jpsi' , ## Algorithm name , # input particles Inputs = [ 'Phys/MicroDSTDiMuonDiMuonIncLine' ] , RootInTES = RootInTES ) # mainSeq = gaudi.algorithm ('GaudiSequencer/DaVinciUserSequence', True ) mainSeq.Members += [ alg.name() ] return SUCCESS
#!/bin/env python import sys sys.path.append('.') from PhysConf.Filters import LoKi_Filters fltrs = LoKi_Filters ( STRIP_Code = """ HLT_PASS_RE ( 'StrippingZ02MuMu.*' ) """ ) # Data type configuration. from GaudiKernel import SystemOfUnits as Units ##Type = 'MC' JetPtMin = 10 * Units.GeV from StandardParticles import StdAllNoPIDsMuons as loosemuons from PhysSelPython.Wrappers import SimpleSelection, MergedSelection, DataOnDemand, Selection from GaudiConfUtils.ConfigurableGenerators import FilterDesktop, CombineParticles from commonSelections import * from PhysSelPython.Wrappers import SelectionSequence Z_seq = SelectionSequence('Z_Seq', TopSelection=Zs) # Create the generated jets.
def __init__(self, name, config): LineBuilder.__init__(self, name, config) ####################################################################### ### ### ### VELO BASED VERTEXING SEQUENCE ### ### ### ####################################################################### bestTracks = AutomaticData("Rec/Track/Best") withVeloTracksForVertexing = bestTracks if self.configurationParameter("VeloGEC")["Apply"]: from GaudiConfUtils.ConfigurableGenerators import VeloEventShapeCutsS20p3 veloGEC = VeloEventShapeCutsS20p3() self.validatedSetProps("VeloGEC", DisplVerticesLinesConf.veloGECCuts, veloGEC) withVeloTracksForVertexing = PassThroughSelection( "%sVeloGEC" % self.name(), RequiredSelection=withVeloTracksForVertexing, Algorithm=veloGEC) if self.configurationParameter("FilterVelo")["Apply"]: from GaudiConfUtils.ConfigurableGenerators import SelectVeloTracksNotFromPVS20p3 veloWithIP = SelectVeloTracksNotFromPVS20p3() self.validatedSetProps("FilterVelo", DisplVerticesLinesConf.veloWithIPCuts, veloWithIP) withVeloTracksForVertexing = Selection( "%sVeloFilteredTracks" % self.name(), RequiredSelections=[withVeloTracksForVertexing], Algorithm=veloWithIP) # Displaced Vertex reconstruction with best tracks (dominated by those with a Velo segment) from Configurables import PatPV3D, PVOfflineTool, PVSeed3DTool, LSAdaptPV3DFitter, LSAdaptPVFitter withVeloVertexAlg = PatPV3D("%sWithVeloVertexAlg" % self.name()) withVeloVertexFinder = addPrivateToolAndGet(withVeloVertexAlg, PVOfflineTool) withVeloVertexFinder.PVsChi2Separation = 0 withVeloVertexFinder.PVsChi2SeparationLowMult = 0 withVeloSeeder = addPrivateToolAndGet(withVeloVertexFinder, PVSeed3DTool) withVeloVertexFinder.PVSeedingName = withVeloSeeder.getTitleName() withVeloSeeder.MinCloseTracks = 3 withVeloFitter = addPrivateToolAndGet(withVeloVertexFinder, LSAdaptPV3DFitter) withVeloVertexFinder.PVFitterName = withVeloFitter.getTitleName() withVeloFitter.MinTracks = 4 withVeloVertexing = SelectionPatPV3DWrapper( "%sWithVeloVertexing" % self.name(), withVeloVertexAlg, RequiredSelections=[withVeloTracksForVertexing]) # Make Particles out of the RecVertices from GaudiConfUtils.ConfigurableGenerators import LLParticlesFromRecVertices rv2pWithVelo = LLParticlesFromRecVertices( VerticesFromVeloOnly=False, RequireUpstreamPV=False, WriteP2PVRelations=False, ForceP2PVBuild=False, VeloProtoParticlesLocation="Phys/%s/VeloProtoP" % self.name()) self.validatedSetProps( "RV2PWithVelo", DisplVerticesLinesConf.recoCuts + DisplVerticesLinesConf.singleCuts, rv2pWithVelo) withVeloCandidates = Selection("%sWithVeloCandidates" % self.name(), RequiredSelections=[withVeloVertexing], Algorithm=rv2pWithVelo, InputDataSetter="RecVertexLocations") ####################################################################### ### ### ### DOWNSTREAM VERTEXING SEQUENCE ### ### ### ####################################################################### from GaudiConfUtils.ConfigurableGenerators import CopyDownstreamTracks downTracks = Selection("%sDownstreamTracks" % self.name(), RequiredSelections=[bestTracks], Algorithm=CopyDownstreamTracks()) # Displaced Vertex reconstruction from downstream tracks downVertexAlg = PatPV3D("%sDownVertexAlg" % self.name()) downVertexFinder = addPrivateToolAndGet(downVertexAlg, PVOfflineTool) downVertexFinder.RequireVelo = False downVertexFinder.PVsChi2Separation = 0 downVertexFinder.PVsChi2SeparationLowMult = 0 downSeeder = addPrivateToolAndGet(downVertexFinder, PVSeed3DTool) downVertexFinder.PVSeedingName = downSeeder.getTitleName() downSeeder.TrackPairMaxDistance = 2.0 * units.mm downSeeder.zMaxSpread = 20.0 * units.mm downSeeder.MinCloseTracks = 4 downFitter = addPrivateToolAndGet(downVertexFinder, LSAdaptPVFitter) downVertexFinder.PVFitterName = downFitter.getTitleName() downFitter.MinTracks = 4 downFitter.maxChi2 = 400.0 downFitter.maxDeltaZ = 0.0005 * units.mm downFitter.maxDeltaChi2NDoF = 0.002 downFitter.acceptTrack = 0.000000001 downFitter.trackMaxChi2 = 9 downFitter.trackMaxChi2Remove = 64 downVertexing = SelectionPatPV3DWrapper( "%sDownVertexing" % self.name(), downVertexAlg, RequiredSelections=[downTracks]) # Make Particles out of the RecVertices rv2pDown = LLParticlesFromRecVertices(VerticesFromVeloOnly=False, RequireUpstreamPV=False, WriteP2PVRelations=False, ForceP2PVBuild=False #, OutputLevel = VERBOSE ) self.validatedSetProps( "RV2PDown", DisplVerticesLinesConf.recoCuts + DisplVerticesLinesConf.singleCuts, rv2pDown) downCandidates = Selection("%sDownCandidates" % self.name(), RequiredSelections=[downVertexing], Algorithm=rv2pDown, InputDataSetter="RecVertexLocations") ####################################################################### ### ### ### HLT JET SEQUENCE ### ### ### ####################################################################### # timing is already fine, so one algo with loose JetID is sufficient # Hlt prefilter and vertex candidates from Hlt2 from Configurables import HltVertexConverterS20p3 revivedHlt2Candidates = "Phys/%sHlt2Cand/Particles" % self.name() hltCandReviver = GaudiSequenceroid( ModeOR=True, ShortCircuit=False, Members=[ GaudiSequencer( "%sHlt2CandFilterTCK%s-%s" % (self.name(), tckBegin, tckEnd), Members=(LoKi_Filters( HLT2_Code= "in_range( {begin}, HLT_TCK % 0x40000000 , {end} ) & ( {decisions} )" .format(begin=tckBegin, end=tckEnd, decisions=" | ".join( "HLT_PASS('%s')" % ln for ln in hltLines))).filters( "%sHlt2DecisionFilterTCK%s-%s" % (self.name(), tckBegin, tckEnd)) + [ HltVertexConverterS20p3( "%sHltConverter%s-%s" % (self.name(), tckBegin, tckEnd), HltSelReports="Hlt2/SelReports", HltLines=hltLines, Recursive=True, Output=revivedHlt2Candidates, WriteP2PVRelations=False, ForceP2PVBuild=False) ])) for (tckBegin, tckEnd), hltLines in self.configurationParameter("HLT")["SignalLines"] ]) hltCandSelection = EventSelection("%sHltCandidates" % self.name(), Algorithm=hltCandReviver) hltVeloGEC = VeloEventShapeCutsS20p3() self.validatedSetProps("VeloGEC", DisplVerticesLinesConf.veloGECCuts, hltVeloGEC) hltVeloGEC.HistoProduce = False hltVeloGECSel = EventSelection("%sHltVeloGEC" % self.name(), Algorithm=hltVeloGEC) hlt2CandAndGECSelection = Selection( "".join((self.name(), "Hlt2CandVertices")), RequiredSelections=[ hltCandSelection, AutomaticData(revivedHlt2Candidates), hltVeloGECSel ], Algorithm=FilterDesktop( Code="( ABSID == '{pid}' )".format(pid=LLPLHCbName), WriteP2PVRelations=False, ForceP2PVBuild=False)) ####################################################################### ### ### ### LINE DEFINITIONS ### ### ### ####################################################################### # one line for every configuratoin key of the format # "Single.*Selection" # "JetSingle.*Selection" # "JetHltSingle.*Selection" # "Double.*Selection" # ".*HLTPS" # "HltEff.*Selection" ##============================== Single ===================================## singleLineNames = [ p.split("Single")[1].split("Selection")[0] for p in self.configKeys() if p.startswith("Single") and p.endswith("Selection") ] for lAcroName in singleLineNames: lShortName = "Single%s" % lAcroName # SingleMedium lSelName = "%sSelection" % lShortName # SingleMediumSelection lLineName = "%s%s" % (self.name(), lShortName ) # DisplVerticesSingleMedium # Choose between Velo-based and downstream vertexing input candidates = withVeloCandidates code = None if "Down" in lAcroName: candidates = downCandidates code = self.getLLPSelection( self.validatedGetProps( lSelName, DisplVerticesLinesConf.singleCuts + DisplVerticesLinesConf.downCuts)) else: code = self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts)) lineFilter = FilterDesktop( DecayDescriptor=LLPLHCbName, Preambulo=DisplVerticesLinesConf.llpSelectionPreambulo, Code=code, WriteP2PVRelations=False, ForceP2PVBuild=False #, OutputLevel = VERBOSE ) lineSel = Selection("".join((self.name(), lSelName)), RequiredSelections=[candidates], Algorithm=lineFilter) line = StrippingLine(lLineName, prescale=self.validatedGetProps( lSelName, ["PreScale"])["PreScale"], selection=lineSel, RequiredRawEvents=["Calo"], RelatedInfoTools=[{ "Type": "AddVeloEventShapeS21", "TopSelection": lineSel, "Location": "P2VES" }]) if lShortName in self.configurationParameter("HLT"): line.HLT2 = self.configurationParameter("HLT")[lShortName] self.registerLine(line) ##========================= Single with jets ==============================## jetSingleLineNames = [ p.split("JetSingle")[1].split("Selection")[0] for p in self.configKeys() if p.startswith("JetSingle") and p.endswith("Selection") ] for lAcroName in jetSingleLineNames: lShortName = "JetSingle%s" % lAcroName # JetSingleMedium lSelName = "%sSelection" % lShortName # JetSingleMediumSelection lLineName = "%s%s" % (self.name(), lShortName ) # DisplVerticesJetSingleMedium # Choose between Velo-based and downstream vertexing input vertexCandidates = withVeloCandidates code = self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts)) vertexFilter = FilterDesktop( DecayDescriptor=LLPLHCbName, Preambulo=DisplVerticesLinesConf.llpSelectionPreambulo, Code=code, WriteP2PVRelations=False, ForceP2PVBuild=False #, OutputLevel = VERBOSE ) goodVertices = Selection("".join( (self.name(), lSelName, "Vertices")), RequiredSelections=[vertexCandidates], Algorithm=vertexFilter) jetProps = self.validatedGetProps(lSelName, DisplVerticesLinesConf.jetCuts) vertWithJets = Selection("".join((self.name(), lSelName, "Jets")), RequiredSelections=[goodVertices], Algorithm=self.makeJetCandidateAlg( "".join((self.name(), lSelName, "JetAlg")), MinNumJets=jetProps["MinNumJets"], ConeSize=jetProps["ConeSize"], JetIDCut=jetProps["JetIDCut"], MinDOCABL=jetProps["MinDOCABL"])) jetCode = self.getLLPJetSelection(jetProps) jetCandFilter = FilterDesktop(DecayDescriptor=LLPLHCbName, Preambulo=self.jetSelectionPreambulo, Code=jetCode, WriteP2PVRelations=False, ForceP2PVBuild=False) lineSel = Selection("".join((self.name(), lSelName)), RequiredSelections=[vertWithJets], Algorithm=jetCandFilter) line = StrippingLine(lLineName, prescale=self.validatedGetProps( lSelName, ["PreScale"])["PreScale"], selection=lineSel, RequiredRawEvents=["Calo"], RelatedInfoTools=[{ "Type": "AddVeloEventShapeS21", "TopSelection": lineSel, "Location": "P2VES" }]) if lShortName in self.configurationParameter("HLT"): line.HLT2 = self.configurationParameter("HLT")[lShortName] self.registerLine(line) ##============= Single with jets based on Hlt candidate ==================## jetHltSingleLineNames = [ p.split("JetHltSingle")[1].split("Selection")[0] for p in self.configKeys() if p.startswith("JetHltSingle") and p.endswith("Selection") ] for lAcroName in jetHltSingleLineNames: lShortName = "JetHltSingle%s" % lAcroName # JetHltSingleMedium lSelName = "%sSelection" % lShortName # JetHltSingleMediumSelection lLineName = "%s%s" % (self.name(), lShortName ) # DisplVerticesJetHltSingleMedium jetProps = self.validatedGetProps(lSelName, DisplVerticesLinesConf.jetCuts) vertWithJets = Selection( "".join((self.name(), lSelName, "HltJets")), RequiredSelections=[hlt2CandAndGECSelection], Algorithm=self.makeJetCandidateAlg( "".join((self.name(), lSelName, "HltJetAlg")), MinNumJets=jetProps["MinNumJets"], ConeSize=jetProps["ConeSize"], JetIDCut=jetProps["JetIDCut"], MinDOCABL=jetProps["MinDOCABL"])) jetCode = self.getLLPJetSelection(jetProps) jetCandFilter = FilterDesktop(DecayDescriptor=LLPLHCbName, Preambulo=self.jetSelectionPreambulo, Code=jetCode, WriteP2PVRelations=False, ForceP2PVBuild=False) lineSel = Selection("".join((self.name(), lSelName)), RequiredSelections=[vertWithJets], Algorithm=jetCandFilter) line = StrippingLine(lLineName, prescale=self.validatedGetProps( lSelName, ["PreScale"])["PreScale"], selection=lineSel, RequiredRawEvents=["Calo"], RelatedInfoTools=[{ "Type": "AddVeloEventShapeS21", "TopSelection": lineSel, "Location": "P2VES" }]) if lShortName in self.configurationParameter("HLT"): line.HLT2 = self.configurationParameter("HLT")[lShortName] self.registerLine(line) ##============================== Double ===================================## doubleLineNames = [ p.split("Double")[1].split("Selection")[0] for p in self.configKeys() if p.startswith("Double") and p.endswith("Selection") ] for lAcroName in doubleLineNames: lShortName = "Double%s" % lAcroName lSelName = "%sSelection" % lShortName lLineName = "%s%s" % (self.name(), lShortName) combinationCut, motherCut = self.getResonanceSelection( self.validatedGetProps( lSelName, DisplVerticesLinesConf.doubleResonanceCuts)) lineFilter = CombineParticles( DecayDescriptor="H_10 -> %s %s" % (LLPLHCbName, LLPLHCbName), Preambulo=DisplVerticesLinesConf.llpSelectionPreambulo, DaughtersCuts={ LLPLHCbName: self.getLLPSelection( self.validatedGetProps( lSelName, DisplVerticesLinesConf.singleCuts)) }, CombinationCut=combinationCut, MotherCut=motherCut, WriteP2PVRelations=False, ForceP2PVBuild=False #, OutputLevel = VERBOSE ) lineSel = Selection("".join((self.name(), lSelName)), RequiredSelections=[withVeloCandidates], Algorithm=lineFilter) line = StrippingLine(lLineName, prescale=self.validatedGetProps( lSelName, ["PreScale"])["PreScale"], selection=lineSel, RequiredRawEvents=["Calo"], RelatedInfoTools=[{ "Type": "AddVeloEventShapeS21", "TopSelection": lineSel, "Location": "P2VES" }]) if lShortName in self.configurationParameter("HLT"): line.HLT2 = self.configurationParameter("HLT")[lShortName] self.registerLine(line) ##============================== HLT PS ===================================## hltPSLineNames = [ p.split("HLTPS")[0] for p in self.configKeys() if p.endswith("HLTPS") ] for lAcroName in hltPSLineNames: lShortName = "%sHLTPS" % lAcroName lLineName = "%s%s" % (self.name(), lShortName ) # DisplVerticesSingleMedium orFilters = [] for (tckBegin, tckEnd), hltFilter in self.validatedGetProps( "HLT", [lShortName])[lShortName]: filters = LoKi_Filters( HLT2_Code= "in_range( {begin}, HLT_TCK % 0x40000000, {end} ) & ( {decisions} )" .format(begin=tckBegin, end=tckEnd, decisions=hltFilter)).filters( "%sHlt2FilterTCK%s-%s" % (lLineName, tckBegin, tckEnd)) assert len(filters) == 1 orFilters.append(filters[0]) assert len(orFilters) == len( self.validatedGetProps("HLT", [lShortName])[lShortName]) hltSelection = EventSelection("%sHltFilter" % lLineName, Algorithm=GaudiSequenceroid( ModeOR=True, ShortCircuit=False, Members=orFilters)) line = StrippingLine( lLineName, prescale=self.validatedGetProps(lShortName, ["PreScale"])["PreScale"], selection=hltSelection, RequiredRawEvents=["Muon", "Calo", "Rich", "Velo", "Tracker"]) self.registerLine(line) ##============================== OTHER ===================================## hltEffLineNames = [ p.split("HltEff")[1].split("Selection")[0] for p in self.configKeys() if p.startswith("HltEff") and p.endswith("Selection") ] for lShortName in hltEffLineNames: lSelName = "HltEff%sSelection" % lShortName lLineName = "%s%s" % (self.name(), lShortName) # HltEff lines are single, Velo-vertexing based lines lineFilter = FilterDesktop( DecayDescriptor=LLPLHCbName, Preambulo=DisplVerticesLinesConf.llpSelectionPreambulo, Code=self.getLLPSelection( self.validatedGetProps(lSelName, DisplVerticesLinesConf.singleCuts)), WriteP2PVRelations=False, ForceP2PVBuild=False #, OutputLevel = VERBOSE ) lineSel = Selection("".join((self.name(), lSelName)), RequiredSelections=[withVeloCandidates], Algorithm=lineFilter) line = StrippingLine( lLineName, prescale=self.validatedGetProps(lSelName, ["PreScale"])["PreScale"] # these lines MUST have an HLT filter , HLT2=self.configurationParameter("HLT")[lShortName], selection=lineSel, RequiredRawEvents=["Muon", "Calo", "Rich", "Velo", "Tracker"], RelatedInfoTools=[{ "Type": "AddVeloEventShapeS21", "TopSelection": lineSel, "Location": "P2VES" }]) self.registerLine(line)