def configure ( inputdata , ## the list of input files catalogs = [] , ## xml-catalogs (filled by GRID) castor = False , ## use the direct access to castor/EOS ? params = {} ) : from PhysSelPython.Wrappers import AutomaticData jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine' psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine' jpsi = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ) psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name ) from PhysSelPython.Wrappers import MergedSelection psis = MergedSelection ( 'SelDetachedPsisForBandQ' , RequiredSelections = [ jpsi , psi2s ] ) from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PsiX from StrippingSelections.StrippingPsiX0 import PsiX0Conf as PsiX0 def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return psis PsiX0 . psi = _psi_ PsiX . psi = _psi_ logger.warning ( "Redefine PsiX .psi" ) psix = PsiX ( 'PsiX' , {} ) psix0 = PsiX0 ( 'PsiX0' , {} ) for s in ( psix.psi_pi () , psix.psi_K () , # psix.psi_2pi () , psix.psi_2K () , psix.psi_2Kpi () , ## psix.psi_3pi () , psix.psi_3K () , psix.psi_3Kpi () , ## psix.psi_4pi () , psix.psi_4Kpi () , psix.psi_4K () , ## psix.psi_5pi () , psix.psi_5K () , psix.psi_5Kpi () , ## psix.psi_6pi () , psix.psi_6Kpi () , ## psix.psi_7pi () , psix.psi_7Kpi () , ## # Lb psix.psi_pK () , psix.psi_ppi () , psix.psi_pKpipi () , ## # 2protons psix.psi_pp () , psix.psi_pppi () , psix.psi_ppK () , psix.psi_pppipi () , psix.psi_ppKpipi () , psix.psi_pppipipi () , ## ) : a = s.algorithm () a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' } # a.MaxCandidates = 2000 a.StopAtMaxCandidates = True a.StopIncidentType = 'ExceedsCombinatoricsLimit' # from PhysSelPython.Wrappers import MultiSelectionSequence from PhysSelPython.Wrappers import SelectionSequence psi_x = MultiSelectionSequence ( "PSIX" , Sequences = [ ## channels with chic # SelectionSequence ( 'B2CHICK' , psix0 . b2chicK () ) , SelectionSequence ( 'B2CHICKK' , psix0 . b2chicKK () ) , SelectionSequence ( 'B2CHICKPi' , psix0 . b2chicKpi () ) , SelectionSequence ( 'B2CHICKPiPi' , psix0 . b2chicKpipi () ) , SelectionSequence ( 'B2CHICPiPi' , psix0 . b2chicpipi () ) , # SelectionSequence ( 'BC2CHICPi' , psix0 . bc2chicpi () ) , SelectionSequence ( 'Lb2CHICPi' , psix0 . lb2chicpK () ) , ] ) ## import DaVinci from Configurables import DaVinci ## delegate the actual configuration to DaVinci dv = DaVinci ( DataType = '2011' , InputType = 'DST' , Simulation = True , Lumi = False , TupleFile = 'Tuples.root' ## IMPORTANT ) ## add the name of Bender algorithm into User sequence sequence alg_name = 'HistosAndTuples' dv.UserAlgorithms += [ psi_x.sequence(), 'TrackScaleState', alg_name ] ## define the input data setData ( inputdata , catalogs , castor ) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = HistosAndTuples ( alg_name , Inputs = [ 'Phys/SelB2ChicPiPiForPsiX0/Particles' ] ) return SUCCESS
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 ( inputdata , ## the list of input files catalogs = [] , ## xml-catalogs (filled by GRID) castor = False , ## use the direct access to castor/EOS ? params = {} ) : from PhysSelPython.Wrappers import AutomaticData jpsi_name = 'FullDSTDiMuonJpsi2MuMuDetachedLine' psi2_name = 'FullDSTDiMuonPsi2MuMuDetachedLine' jpsi = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % jpsi_name ) psi2s = AutomaticData ( '/Event/AllStreams/Phys/%s/Particles' % psi2_name ) from PhysSelPython.Wrappers import MergedSelection psis = MergedSelection ( 'SelDetachedPsisForBandQ' , RequiredSelections = [ jpsi , psi2s ] ) from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PsiX from StrippingSelections.StrippingPsiX0 import PsiX0Conf as PsiX0 def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return psis PsiX0 . psi = _psi_ PsiX . psi = _psi_ logger.warning ( "Redefine PsiX .psi" ) psix = PsiX ( 'PsiX' , {} ) psix0 = PsiX0 ( 'PsiX0' , {} ) for s in ( psix.psi_pi () , psix.psi_K () , # psix.psi_2pi () , psix.psi_2K () , psix.psi_2Kpi () , ## psix.psi_3pi () , psix.psi_3K () , psix.psi_3Kpi () , ## psix.psi_4pi () , psix.psi_4Kpi () , psix.psi_4K () , ## psix.psi_5pi () , psix.psi_5K () , psix.psi_5Kpi () , ## psix.psi_6pi () , psix.psi_6Kpi () , ## psix.psi_7pi () , psix.psi_7Kpi () , ## # Lb psix.psi_pK () , psix.psi_ppi () , psix.psi_pKpipi () , ## # 2protons psix.psi_pp () , psix.psi_pppi () , psix.psi_ppK () , psix.psi_pppipi () , psix.psi_ppKpipi () , psix.psi_pppipipi () , ## ) : a = s.algorithm () a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' } # a.MaxCandidates = 2000 a.StopAtMaxCandidates = True a.StopIncidentType = 'ExceedsCombinatoricsLimit' # from PhysSelPython.Wrappers import MultiSelectionSequence from PhysSelPython.Wrappers import SelectionSequence psi_x = MultiSelectionSequence ( "PSIX" , Sequences = [ ## channels with chic # SelectionSequence ( 'B2CHICK' , psix0 . b2chicK () ) , SelectionSequence ( 'B2CHICKK' , psix0 . b2chicKK () ) , SelectionSequence ( 'B2CHICKPi' , psix0 . b2chicKpi () ) , SelectionSequence ( 'B2CHICKPiPi' , psix0 . b2chicKpipi () ) , SelectionSequence ( 'B2CHICPiPi' , psix0 . b2chicpipi () ) , # SelectionSequence ( 'BC2CHICPi' , psix0 . bc2chicpi () ) , SelectionSequence ( 'Lb2CHICPi' , psix0 . lb2chicpK () ) , ] ) ## import DaVinci from Configurables import DaVinci ## delegate the actual configuration to DaVinci dv = DaVinci ( DataType = '2012' , InputType = 'DST' , Simulation = True , Lumi = False , TupleFile = 'Tuples.root' ## IMPORTANT ) ## add the name of Bender algorithm into User sequence sequence alg_name = 'HistosAndTuples' dv.UserAlgorithms += [ psi_x.sequence(), 'TrackScaleState', alg_name ] ## define the input data setData ( inputdata , catalogs , castor ) ## get/create application manager gaudi = appMgr() ## (1) create the algorithm with given name alg = HistosAndTuples ( alg_name , Inputs = [ 'Phys/SelB2ChicPiPiForPsiX0/Particles' ] ) return SUCCESS
def configure ( 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 MessageSvc msg = MessageSvc() msg.setError += [ 'HcalDet.Quality' , 'EcalDet.Quality' , 'MagneticFieldSvc' , 'PropertyConfigSvc' ] ## # ========================================================================= ## ## 0) Rerun stripping if MC is nt MC/2011 or MC/2012 ## # ========================================================================= ## 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 # ========================================================================= ## 0) Otherwise use existing stripping ilne # ========================================================================= from PhysSelPython.Wrappers import AutomaticData jpsi_location = 'FullDSTDiMuonJpsi2MuMuDetachedLine' jpsi = AutomaticData ( Location = '/Event/AllStreams/Phys/%s/Particles' % jpsi_location ) # ============================================================================= from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PsiX # ============================================================================= ## 1) redefine stripping configurations # ============================================================================= # ## redefine psi(') -> mu+ mu- # def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return jpsi PsiX . psi = _psi_ logger.warning ( "Redefine PsiX .psi" ) # ============================================================================= ## 2) unify the pion& kaon selections # ============================================================================= _PionCut_ = """ ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.4 ) & ( PT > 200 * MeV ) & in_range ( 2 , ETA , 4.9 ) & in_range ( 3.2 * GeV , P , 150 * GeV ) & HASRICH & ( PROBNNpi > 0.15 ) & ( MIPCHI2DV() > 9. ) """ _KaonCut_ = """ ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.4 ) & ( PT > 200 * MeV ) & in_range ( 2 , ETA , 4.9 ) & in_range ( 3.2 * GeV , P , 150 * GeV ) & HASRICH & ( PROBNNk > 0.15 ) & ( MIPCHI2DV() > 9. ) """ from GaudiConfUtils.ConfigurableGenerators import FilterDesktop _alg_pi = FilterDesktop ( ## Code = _PionCut_ , ## ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllNoPIDsPions as input_pions pions = Selection ( "SelPiForBQ" , Algorithm = _alg_pi , RequiredSelections = [ input_pions ] ) from GaudiConfUtils.ConfigurableGenerators import FilterDesktop _alg_k = FilterDesktop ( ## Code = _KaonCut_ , ## ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllNoPIDsKaons as input_kaons kaons = Selection ( "SelKForBQ" , Algorithm = _alg_k , RequiredSelections = [ input_kaons ] ) def _kaons_ ( self ) : return kaons def _pions_ ( self ) : return pions # ## get the selections # for s in [ PsiX ] : s.pions = _pions_ s.kaons = _kaons_ logger.warning ( "Redefine PsiX.kaons " ) logger.warning ( "Redefine PsiX.kaons " ) psix = PsiX ( 'PsiX' , {} ) for s in [ psix.psi_pi() ] : a = s.algorithm () a.ParticleCombiners = { '' : 'LoKi::VertexFitter:PUBLIC' } from PhysSelPython.Wrappers import SelectionSequence sel_seq = SelectionSequence ( 'B2PsiPi' , psix . psi_pi () ) the_year = '2012' davinci = DaVinci ( DataType = the_year , InputType = 'DST' , Simulation = True , PrintFreq = 1000 , EvtMax = -1 , HistogramFile = 'DVHistos.root' , TupleFile = 'DVNtuples.root' , Lumi = True , ## # MC : ## SIMCOND : 'Sim08-20130503-1', 'Sim08-20130503-1-vc-md100' # DDDBtag = "Sim08-20130503-1" , CondDBtag = "Sim08-20130503-1-vc-md100" ) my_name = "Bplus" from Configurables import GaudiSequencer davinci.UserAlgorithms = [ sel_seq.sequence() , my_name ] setData ( datafiles , catalogs , castor ) gaudi = appMgr() print 'seq.outputLocation()= ', sel_seq.outputLocation() # Phys/SelPsi3KPiForPsiX/Particles alg = Jpsi_mu( my_name , ## Algorithm name Inputs = [ sel_seq.outputLocation() ] , PP2MCs = [ 'Relations/Rec/ProtoP/Charged' ] ) return SUCCESS
def configure(datafiles, catalogs=[], params={}, castor=False): """ Configure the job """ from Configurables import DaVinci ## needed for job configuration from Configurables import EventSelector ## needed for job configuration from Configurables import MessageSvc msg = MessageSvc() msg.setError += [ 'HcalDet.Quality' , 'EcalDet.Quality' , 'MagneticFieldSvc' , 'PropertyConfigSvc' ] from PhysSelPython.Wrappers import AutomaticData jpsi_location = 'FullDSTDiMuonJpsi2MuMuDetachedLine' jpsi = AutomaticData( Location='/Event/AllStreams/Phys/%s/Particles' % jpsi_location) # ============================================================================= from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PsiX ## 1) redefine stripping configurations def _psi_(self): """ psi(') -> mu+ mu- """ return jpsi PsiX.psi = _psi_ logger.warning("Redefine PsiX .psi") ## 2) unify the pion& kaon selections # ============================================================================= _PionCut_ = """ ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.4 ) & ( PT > 200 * MeV ) & in_range ( 2 , ETA , 4.9 ) & in_range ( 3.2 * GeV , P , 150 * GeV ) & HASRICH & ( PROBNNpi > 0.15 ) & ( MIPCHI2DV() > 9. ) """ _KaonCut_ = """ ( CLONEDIST > 5000 ) & ( TRCHI2DOF < 4 ) & ( TRGHOSTPROB < 0.4 ) & ( PT > 200 * MeV ) & in_range ( 2 , ETA , 4.9 ) & in_range ( 3.2 * GeV , P , 150 * GeV ) & HASRICH & ( PROBNNk > 0.15 ) & ( MIPCHI2DV() > 9. ) """ from GaudiConfUtils.ConfigurableGenerators import FilterDesktop _alg_pi = FilterDesktop( ## Code=_PionCut_, ## ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllNoPIDsPions as input_pions pions = Selection( "SelPiForBQ", Algorithm=_alg_pi, RequiredSelections=[input_pions] ) from GaudiConfUtils.ConfigurableGenerators import FilterDesktop _alg_k = FilterDesktop( ## Code=_KaonCut_, ## ) from PhysSelPython.Wrappers import Selection from StandardParticles import StdAllNoPIDsKaons as input_kaons kaons = Selection( "SelKForBQ", Algorithm=_alg_k, RequiredSelections=[input_kaons] ) def _kaons_(self): return kaons def _pions_(self): return pions # ## get the selections # for s in [PsiX]: s.pions = _pions_ s.kaons = _kaons_ logger.warning("Redefine PsiX.kaons ") logger.warning("Redefine PsiX.kaons ") psix = PsiX('PsiX', {}) for s in [psix.psi_3Kpi()]: a = s.algorithm() a.ParticleCombiners = {'': 'LoKi::VertexFitter:PUBLIC'} from PhysSelPython.Wrappers import SelectionSequence sel_seq = SelectionSequence('B2Psi3Kpi', psix . psi_3Kpi()) davinci = DaVinci( InputType = 'DST' , Simulation = True , PrintFreq = 1000 , EvtMax = -1 , Lumi = True , DataType = params['Year'], DDDBtag = params['DDDB'], CondDBtag = params['SIMCOND'], # HistogramFile = 'DVHistos.root' , TupleFile = 'DVNtuples.root' , ) my_name = "Bplus" from Configurables import GaudiSequencer davinci.UserAlgorithms = [ sel_seq.sequence() , my_name ] setData ( datafiles , catalogs , castor ) gaudi = appMgr() print 'seq.outputLocation()= ', sel_seq.outputLocation() # Phys/SelPsi3KPiForPsiX/Particles # create local algorithm: alg = MCAnalysisAlgorithm( my_name, Inputs = [ sel_seq.outputLocation() ] , PP2MCs = [ 'Relations/Rec/ProtoP/Charged' ] ) return SUCCESS
RequiredSelections = [ jpsi , psi2s ] ) from StrippingSelections.StrippingPsiXForBandQ import PsiX_BQ_Conf as PsiX from StrippingSelections.StrippingPsiX0 import PsiX0Conf as PsiX0 def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return psis PsiX0 . psi = _psi_ PsiX . psi = _psi_ psix = PsiX ( 'PsiX' , {} ) psix0 = PsiX0 ( 'PsiX0' , {} ) for s in ( psix.psi_pi () , psix.psi_K () , # psix.psi_2pi () , psix.psi_2K () , psix.psi_2Kpi () , ## psix.psi_3pi () , psix.psi_3K () , psix.psi_3Kpi () , ## psix.psi_4pi () , psix.psi_4Kpi () , psix.psi_4K () ,
# ============================================================================= def _psi_ ( self ) : """ psi(') -> mu+ mu- """ return psis PsiX0 . psi = _psi_ PsiX . psi = _psi_ logger.warning ( "Redefine PsiX .psi" ) logger.warning ( "Redefine PsiX0.psi" ) psix = PsiX ( 'PsiX' , {} ) psix0 = PsiX0 ( 'PsiX0' , {} ) # ============================================================================- ## adjust vertex fitter # ============================================================================- for s in ( psix.psi_pi () , psix.psi_K () , # psix.psi_2pi () , psix.psi_2K () , psix.psi_2Kpi () , ## psix.psi_3pi () , psix.psi_3K () , psix.psi_3Kpi () ,