def test_instantiate_StrippingConf_with_all_streams() : ''' Test that Stripping Streams can be instantiated. This is the most basic test that should be run when modifying or adding Stripping Streams to StrippingSelections.Streams.allStreams. ''' from StrippingConf.Configuration import StrippingConf from StrippingSelections import buildersConf stripping = buildersConf() from StrippingSelections.Utils import buildStreams streams = buildStreams(stripping) sc = StrippingConf (Streams = streams)
def test_buildStreams_filter_name2(): list_stream = buildStreams(allconf, ['Z02MuMu', 'B2ppipiSigmacmm_Lcpi']) assert len(list_stream) == 2 # Check stream from StrippingConf.StrippingStream import StrippingStream for stream in list_stream: assert isinstance(stream, StrippingStream) assert stream.name() in ('EW', 'Charm') if stream.name() == 'EW': assert len(stream.lines) == 1 assert stream.lines[0].name() == 'StrippingZ02MuMuLine' if stream.name() == 'Charm': assert len(stream.lines) == 7 clean()
def test_buildStreams_filter_name(): list_stream = buildStreams(allconf, 'Z02MuMu') assert len(list_stream) == 1 # Check stream from StrippingConf.StrippingStream import StrippingStream stream = list_stream[0] assert isinstance(stream, StrippingStream) assert stream.name() == 'EW' # Check line member, after build assert len(stream.lines) == 1 line = stream.lines[0] assert line.name() == 'StrippingZ02MuMuLine' clean()
from Configurables import DecodeRawEvent DecodeRawEvent().setProp("OverrideInputs", 4.2) # Specify the name of your configuration my_wg = 'B2CC' #FOR LIAISONS # NOTE: this will work only if you inserted correctly the # default_config dictionary in the code where your LineBuilder # is defined. from StrippingSelections import buildersConf confs = buildersConf() from StrippingSelections.Utils import lineBuilder, buildStreams streams = buildStreams(confs, WGs=my_wg) leptonicMicroDSTname = 'Leptonic' charmMicroDSTname = 'Charm' pidMicroDSTname = 'PID' bhadronMicroDSTname = 'Bhadron' mdstStreams = [ leptonicMicroDSTname, charmMicroDSTname, pidMicroDSTname, bhadronMicroDSTname ] dstStreams = [ "BhadronCompleteEvent", "CharmCompleteEvent", "Dimuon", "EW", "Semileptonic", "Calibration", "MiniBias", "Radiative" ] stripTESPrefix = 'Strip'
# #Fix for TrackEff lines # from Configurables import DecodeRawEvent DecodeRawEvent().setProp("OverrideInputs", 4.2) # NOTE: this will work only if you inserted correctly the # default_config dictionary in the code where your LineBuilder # is defined. from StrippingSelections import buildersConf confs = buildersConf() from StrippingSelections.Utils import lineBuilder, buildStreamsFromBuilder, buildStreams # streams = buildStreamsFromBuilder(confs, 'Ditau') streams = buildStreams(confs, WGs='QEE') #clone lines for CommonParticles overhead-free timing print "Creating line clones for timing" for s in streams: for l in s.lines: if "_TIMING" not in l.name(): cloned = l.clone(l.name().replace("Stripping", '') + "_TIMING") s.appendLines([cloned]) #define stream names leptonicMicroDSTname = 'Leptonic' charmMicroDSTname = 'Charm' pidMicroDSTname = 'PID' bhadronMicroDSTname = 'Bhadron' mdstStreams = [
from Configurables import RawEventJuggler juggler = RawEventJuggler(DataOnDemand=True, Input=0.3, Output=4.2) # #Fix for TrackEff lines # from Configurables import DecodeRawEvent DecodeRawEvent().setProp("OverrideInputs", 4.2) # NOTE: this will work only if you inserted correctly the # default_config dictionary in the code where your LineBuilder # is defined. from StrippingSelections import buildersConf confs = buildersConf() from StrippingSelections.Utils import lineBuilder, buildStreams streams = buildStreams(confs) leptonicMicroDSTname = 'Leptonic' charmMicroDSTname = 'Charm' pidMicroDSTname = 'PID' bhadronMicroDSTname = 'Bhadron' mdstStreams = [ leptonicMicroDSTname, charmMicroDSTname, pidMicroDSTname, bhadronMicroDSTname ] dstStreams = [ "BhadronCompleteEvent", "CharmCompleteEvent", "Dimuon", "EW", "Semileptonic", "Calibration", "MiniBias", "Radiative" ] stripTESPrefix = 'Strip'
def test_buildStreams_badconf(): allconf = {'GOODNAME': {'NOSTREAM': None}} with pytest.raises(KeyError): buildStreams(allconf, 'GOODNAME')
def test_buildStreams_badname(): with pytest.raises(ValueError): buildStreams(allconf, 'BADNAME')
def test_buildStreams_good_from_builderConf(): buildStreams(allconf) clean()
def test_buildStreams_from_string_bad(): with pytest.raises(Exception): buildStreams('BADNAME')
def test_buildStreams_from_string_good(): buildStreams('stripping21') clean()
def test_buildStreams_from_bad(): with pytest.raises(ValueError): buildStreams(None) with pytest.raises(ValueError): buildStreams({})