Difference: MakeNTupleFromTurbo (1 vs. 21)

Revision 212019-09-24 - MichaelWilkinson

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 88 to 88
  This is necessary because the MC relations tables for Turbo data are in a non-standard location. The configuration for 2015 data is slightly different.
Added:
>
>
Note that if you are using the Modern Selection Framework, e.g., TupleSelection, instead of a DecayTreeTuple you will need to pass it as dtt.algorithm() instead to avoid a TypeError:
# DaVinci                   INFO    Append to Main Sequence has been called
Traceback (most recent call last):
  File "/cvmfs/lhcb.cern.ch/lib/lhcb/GAUDI/GAUDI_v32r1/InstallArea/x86_64-centos7-gcc8-opt/scripts/gaudirun.py", line 525, in <module>
    exec (o, g, l)
  File "<string>", line 1, in <module>
  File "/workspace/build/GAUDI/GAUDI_v32r1/InstallArea/x86_64-centos7-gcc8-opt/python/GaudiKernel/ProcessJobOptions.py", line 490, in importOptions
  File "/workspace/build/GAUDI/GAUDI_v32r1/InstallArea/x86_64-centos7-gcc8-opt/python/GaudiKernel/ProcessJobOptions.py", line 458, in _import_python
  File "/afs/cern.ch/work/m/mwilkins/Xic0/options/Xic0.py", line 529, in <module>
    TeslaTruthUtils.makeTruth(tup, relations, mc_tools)
  File "/workspace/build/PHYS/PHYS_v26r2/InstallArea/x86_64-centos7-gcc8-opt/python/TeslaTools/TeslaTruthUtils.py", line 80, in makeTruth
  File "/workspace/build/PHYS/PHYS_v26r2/InstallArea/x86_64-centos7-gcc8-opt/python/PhysSelPython/Wrappers.py", line 1531, in addTool
  File "/workspace/build/PHYS/PHYS_v26r2/InstallArea/x86_64-centos7-gcc8-opt/python/PhysSelPython/Wrappers.py", line 1525, in addTupleTool
  File "/workspace/build/ANALYSIS/ANALYSIS_v21r2/InstallArea/x86_64-centos7-gcc8-opt/python/DecayTreeTuple/Configuration.py", line 68, in addTupleTool
TypeError: You are trying to add a default public tool-configurable to your ntuple: TupleToolMCTruth/TupleToolMCTruth This is dangerous so not allowed with addTTool. Either add it yourself manually, or, better, supply an instance name
 

LoKi functors

To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:

Revision 202019-07-03 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 180 to 180
 )
Changed:
<
<

2015 data

>
>

2015 and 2016 data

 
Changed:
<
<
Algorithms must be explicitly configured to pick up the Turbo primary vertices, and so the Turbo-specific DecayTreeTuple configuration will look like this:
>
>
If you see errors like this when processing data:

Hlt2PackedDataD...WARNING HltPackedDataDecoder:: No HltPackedData raw bank (the DstData bank) in raw event. Quitting.
LinkHltPersistR...WARNING Gaudi::DataLink:: No valid data is found at '/Event/Hlt2/Vertex/PV3D'
LoKiSvc.REPORT    WARNING The WARNING message is suppressed : 'LoKi::Vertices::SourceDesktop:    No input primary vertices from IDVAlgorithm [myalg]' StatusCode=FAILURE
LoKiSvc.REPORT    WARNING The WARNING message is suppressed : 'LoKi::Vertices::SourceDesktop:    No vertices are selected by 'PRIMARY' [myalg]' StatusCode=FAILURE
LoKiSvc.REPORT      ERROR The   ERROR message is suppressed : 'LoKi::Particles::MinImpParChi2DV:        Empty list of vertices is loaded! [myalg]' StatusCode=FAILURE

then one or more algorithms or tools are trying to access primary vertices directly from the Brunel location, rather than going via the Particle-to-PV relations tables created in HLT2 which point to the Turbo location.

In this case, algorithms and tools must be explicitly configured to pick up the Turbo primary vertices. The Turbo-specific DecayTreeTuple configuration will look like this:

 
dtt.Inputs = ['{0}/Particles'.format(hlt2_line)]
Deleted:
<
<
dtt.WriteP2PVRelations = False
 dtt.InputPrimaryVertices = '/Event/Turbo/Primary'

Revision 192019-04-15 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 29 to 29
 hlt2_line = 'Hlt2CharmHadD02KmPipTurbo'
Changed:
<
<

2016, 2017, and 2018 data

>
>

2015, 2016, 2017, and 2018 data

  In general, the latest DaVinci version is recommended, but anything past v44r3 should be sufficient for both collision data and MC.
Line: 42 to 42
 

The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons.

Changed:
<
<
In 2016 the stream_name is always empty, so the RootInTES is just /Event/Turbo.
>
>
In 2015 and 2016 the stream_name is always empty, so the RootInTES is just /Event/Turbo.
  An example of a full location of Particle objects in 2017 is:
Line: 86 to 86
 TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
Changed:
<
<
This is necessary because the MC relations tables for Turbo data are in a non-standard location.
>
>
This is necessary because the MC relations tables for Turbo data are in a non-standard location. The configuration for 2015 data is slightly different.
 

LoKi functors

Line: 182 to 182
 

2015 data

Deleted:
<
<
The location of the output Particle objects from an HLT2 Turbo line must be specified in full:

hlt2_line = '/Event/Turbo/{0}/Particles'.format(hlt2_line)
 Algorithms must be explicitly configured to pick up the Turbo primary vertices, and so the Turbo-specific DecayTreeTuple configuration will look like this:
Changed:
<
<
dtt.Inputs = ['/Event/Turbo/{0}/Particles'.format(hlt2_line)]
>
>
dtt.Inputs = ['{0}/Particles'.format(hlt2_line)]
 dtt.WriteP2PVRelations = False dtt.InputPrimaryVertices = '/Event/Turbo/Primary'

If your line had PV refitting enabled, and you wish to use the refitted PVs, change InputPrimaryVertices to point to the corresponding location.

Deleted:
<
<
No Turbo-specific configuration of the DaVinci() configurable is needed. RootInTES should not be set and InputType can be left as the default value ('DST').
 

Monte Carlo truth

This is similar to the procedure for 2016+ data, but the list of relations locations is specified differently:

Revision 182018-09-17 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 74 to 74
 
from TeslaTools import TeslaTruthUtils
Changed:
<
<
relations = [
>
>
relations = TeslaTruthUtils.getRelLocs() + [
  TeslaTruthUtils.getRelLoc(''), # Location of the truth tables for PersistReco objects 'Relations/Hlt2/Protos/Charged'

Revision 172018-07-20 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

This page shows you how to configure DaVinci to process Turbo data.

Changed:
<
<
Due to the historical development cycle of the Turbo processing model, the format of Turbo data has changed from 2015 to 2016 and again from 2016 to 2017. Although a stable DaVinci configuration is always a prority for the Turbo developers, some changes are required when analysing datasets from different years.
>
>
Due to the historical development cycle of the Turbo processing model, the format of Turbo data has changed from 2015 to 2016 and again from 2016 to 2017. Although a stable DaVinci configuration is always a priority for the Turbo developers, some changes are required when analysing datasets from different years.
  The sections below are organised per year, and are standalone after reading the introduction.
Line: 12 to 12
 

Introduction

Changed:
<
<
It is expected that any TupleTool that works on a microDST Stripping output will work with Tesla output.
>
>
It is expected that any TupleTool that works on a microDST Stripping output will work with Turbo data.
  In what follows, it is assumed that the DecayTreeTuple to be configured has been instantiated as dtt:
Line: 29 to 29
 hlt2_line = 'Hlt2CharmHadD02KmPipTurbo'
Changed:
<
<

2017

>
>

2016, 2017, and 2018 data

 
Changed:
<
<
In 2017 the treatment of Turbo and PersistReco was unified. Now, the only properties of the DaVinci() configurable you need to modify are:
>
>
In general, the latest DaVinci version is recommended, but anything past v44r3 should be sufficient for both collision data and MC.

You must set the following properties on the DaVinci() configurable for both Turbo and TurCal data:

 
DaVinci().InputType = 'MDST'
Line: 39 to 41
 DaVinci().Turbo = True
Changed:
<
<
Neither DstConf nor TurboConf should be configured in your options.

You also no longer need to modify the WriteP2PVRelations and InputPrimaryVertices properties of your algorithms, the PVs will be picked up automatically.

Setting the three DaVinci() properties above is mandatory for Turbo and TurCal data. The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons.

>
>
The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons. In 2016 the stream_name is always empty, so the RootInTES is just /Event/Turbo.
  An example of a full location of Particle objects in 2017 is:
Line: 59 to 58
 DaVinci().RootInTES = '/Event/Charmspec/Turbo'
Deleted:
<
<
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the following section.
 

Monte Carlo truth

Changed:
<
<
Accessing Monte Carlo truth for 2017 data is under development.
>
>
To get Monte Carlo truth information, add TupleToolMCTruth and TupleToolMCBackgroundInfo to the DecayTreeTuple ToolList as usual.
 
Changed:
<
<

2016

The configuration of algorithms and the DaVinci() configurable for 2016 is as for 2015.

PersistReco

>
>
dtt.ToolList += [
    'TupleToolMCBackgroundInfo',
    'TupleToolMCTruth'
]
 
Changed:
<
<
For accessing the output of the HLT2 reconstruction, available when your line has the PersistReco flag, add the following to your options file:
>
>
Then, add the following to your options:
 
Changed:
<
<
from Configurables import DstConf, TurboConf
>
>
from TeslaTools import TeslaTruthUtils
 
Changed:
<
<
DstConf().Turbo = True TurboConf().PersistReco = True
>
>
relations = [ TeslaTruthUtils.getRelLoc(''), # Location of the truth tables for PersistReco objects 'Relations/Hlt2/Protos/Charged' ] mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
 
Changed:
<
<
The Track objects are made available at /Event/Turbo/Rec/Track/Best, and the ProtoParticle objects are made available under /Event/Turbo/Rec/ProtoP/Charged. The rest of the reconstruction is under /Event/Hlt2. Primary vertices are under /Event/Turbo/Primary as usual, but the associated VELO tracks also exist for PersistReco events.
>
>
This is necessary because the MC relations tables for Turbo data are in a non-standard location.
 
Changed:
<
<

DaVinci v42r2 and above

>
>

LoKi functors

 
Changed:
<
<
For DaVinci versions v42r2 and above, you need some additional configuration. In these versions, all PersistReco objects are now available under /Event/Turbo by default, and so one should set RootInTES accordingly.
>
>
To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:
 
Changed:
<
<
from Configurables import DaVinci

DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event/Turbo' DaVinci().Turbo = True

>
>
loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool/SomeName') loki_tt.Preambulo = [ 'from LoKiPhysMC.decorators import *', 'from LoKiPhysMC.functions import mcMatch' ] # Use the (assumed existing) decay descriptor on the DecayTreeTuple to build # a MC-matching descriptor # The use of the DecayTreeTuple descriptor and of the '==>' arrow is # not always valid for every analysis, this is just an example; be careful! mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>') loki_tt.Variables = { 'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations) }
 
Changed:
<
<
It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles, such as StdAllLooseANNPions, the RebuildSelection method should be used. As an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:
>
>
Where the relations variable is as defined above.

PersistReco

When an HLT2 line has the PersistReco flag enabled, the full HLT2 reconstruction is available in events where that line fired.

The Track objects are made available at /Event/Turbo/Rec/Track/Best, and the ProtoParticle objects are made available under /Event/Turbo/Rec/ProtoP/Charged. The rest of the reconstruction is under /Event/Turbo/Hlt2. Primary vertices are under /Event/Turbo/Primary as usual, but the associated VELO tracks also exist for PersistReco events.

The family of Std* particles, like StdAllPions, should be rebuilt using the Python Selection framework. The following example shows how one can take the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combine it with a PersistReco pion:

 
from PhysSelPython.Selections import (
Line: 108 to 130
 combiner_sel = CombineSelection( 'CombineD0pi', inputs=[
Changed:
<
<
# Now this location can be relative to RootInTES
>
>
# The output of the HLT2 line
  AutomaticData('{0}/Particles'.format(hlt2_line)),
Added:
>
>
# Extra pions
  RebuildSelection(StdAllLooseANNPions) ], DecayDescriptors=[
Line: 142 to 165
 DaVinci().UserAlgorithms = [selseq.sequence(), dtt]
Changed:
<
<

Monte Carlo truth

The configuration of algorithms and the DaVinci() configurable for 2016 is similar to 2015, with the exception that the argument to getRelLoc should just be an empty string:

>
>

Exact clones in particle combinations in 2016 data

 
Changed:
<
<
relations = [TeslaTruthUtils.getRelLoc('')]
>
>
Due to some technicalities, you will see exact clones when trying to perform particle combinatorics with 2016 Turbo+PersistReco data. This means that the same underlying Track object is used twice in the same combination, and is an issue because it can create unphysical peaking structures in mass distributions.
 
Changed:
<
<
Some additional lines are also needed:
>
>
As an example, assume your Turbo candidate (the object that fired your HLT2 line) is $J/\psi \to \mu^{+}\mu^{-}$. The HLT2 line has PersistReco enabled, and you want to reconstruct $B^{+} \to J/\psi K^{+}$, taking the $J/\psi$ Turbo candidate and kaons from StdLooseKaons. With the default configuration of CombineParticles, you will end up saving $B^{+}$ candidates where the same track is used for the $\mu^{+}$ and the $K^{+}$, meaning that the 3-momenta of the two particles will be identical.
 
Added:
>
>
To avoid this issue, you can configure CombineParticles to perform a more robust overlap check:
 
Changed:
<
<
from Configurables import DaVinci, DstConf, TurboConf

DstConf().Turbo = True TurboConf().PersistReco = True

DaVinci().RootInTES = 'MDST'

>
>
my_combiner = CombineParticles( ..., CheckOverlapTool='LoKi::CheckOverlap' )
 
Changed:
<
<

Productions using DaVinci v41r2p5 or v41r4p2

When analysing the output of the most recent Monte Carlo productions for 2016 Turbo MC, which used DaVinci v41r2p5 (for Stripping26) or v41r4p2 (for Stripping28), those specific versions must be used in your DaVinci job.

>
>

2015 data

 
Changed:
<
<
In addition, you must always set RootInTES to /Event/Turbo, whether running over DST or microDST, as above.

2015

The location of the output Particle objects from an HLT2 Turbo line is:

>
>
The location of the output Particle objects from an HLT2 Turbo line must be specified in full:
 
hlt2_line = '/Event/Turbo/{0}/Particles'.format(hlt2_line)
Line: 188 to 200
  No Turbo-specific configuration of the DaVinci() configurable is needed. RootInTES should not be set and InputType can be left as the default value ('DST').
Deleted:
<
<

PersistReco

PersistReco was not available in 2015.

 

Monte Carlo truth

Changed:
<
<
To get Monte Carlo truth information, add TupleToolMCTruth and TupleToolMCBackgroundInfo to the DecayTreeTuple ToolList.

dtt.ToolList += [
      'TupleToolMCBackgroundInfo',
      'TupleToolMCTruth'
]

Then, add the following to your options:

>
>
This is similar to the procedure for 2016+ data, but the list of relations locations is specified differently:
 
Deleted:
<
<
from TeslaTools import TeslaTruthUtils
 relations = [TeslaTruthUtils.getRelLoc(hlt2_line + '/')]
Deleted:
<
<
mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
 
Changed:
<
<

LoKi functors

>
>

Efficient processing

 
Changed:
<
<
To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:
>
>
As for any other DaVinci job, it is recommended that you stop processing an event as soon as possible in order to reduce CPU time. A good way to acheive this with Turbo data is to filter out events that don't contain a positive decision for your trigger(s).
 
Changed:
<
<
loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool/SomeName') loki_tt.Preambulo = [ 'from LoKiPhysMC.decorators import *', 'from LoKiPhysMC.functions import mcMatch' ] # Use the (assumed existing) decay descriptor on the DecayTreeTuple to build # a MC-matching descriptor # The use of the DecayTreeTuple descriptor and of the '==>' arrow is # not always valid for every analysis; be careful! mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>') loki_tt.Variables = { 'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations) }
>
>
from PhysConf.Filters import LoKi_Filters
 
Changed:
<
<
Where the relation variables is the return value of the getRelLoc method shown above.

Exact clones in particle combinations

Due to some technicalities, you will see exact clones when trying to perform particle combinatorics with 2016 and 2017 Turbo+PersistReco data. This means that the same underlying Track object is used twice in the same combination, and is an issue because it can create unphysical peaking structures in mass distributions.

As an example, assume your Turbo candidate, that is the object that fired your HLT2 line, is $J/\psi \to \mu^{+}\mu^{-}$. The HLT2 line has PersistReco enabled, and you want to reconstruct $B^{+} \to J/\psi K^{+}$, taking the $J/\psi$ Turbo candidate and kaons from StdLooseKaons. With the default configuration of CombineParticles, you will end up saving $B^{+}$ candidates where the same track is used for the $\mu^{+}$ and the $K^{+}$, meaning that the 3-momenta of the two particles will be identical.

To avoid this issue, you can configure CombineParticles to perform a more robust overlap check:

my_combiner = CombineParticles(
   ...,
   CheckOverlapTool='LoKi::CheckOverlap'
>
>
trigger_filter = LoKi_Filters( # Adjust this regular expression to match whatever set of lines you're # interested in studying HLT2_Code="HLT_PASS_RE('.*{0}.*'.format(hlt2_line))"
 )
Added:
>
>
DaVinci().EventPreFilters = trigger_filter.filters('TriggerFilter')
 
Added:
>
>
This prevents expensive unpacking algorithms running on events where your candidates don't exist.

Revision 162018-03-09 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 198 to 198
 
dtt.ToolList += [
Changed:
<
<
'TupleToolMCBackgroundInfo'
>
>
'TupleToolMCBackgroundInfo',
  'TupleToolMCTruth' ]
Line: 208 to 208
 
from TeslaTools import TeslaTruthUtils
Changed:
<
<
relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/')
>
>
relations = [TeslaTruthUtils.getRelLoc(hlt2_line + '/')]
 mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use

Revision 152017-11-16 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 89 to 89
 
from Configurables import DaVinci
Added:
>
>
DaVinci().InputType = 'MDST'
 DaVinci().RootInTES = '/Event/Turbo' DaVinci().Turbo = True

Revision 142017-10-25 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 236 to 236
 

Where the relation variables is the return value of the getRelLoc method shown above. \ No newline at end of file

Added:
>
>

Exact clones in particle combinations

Due to some technicalities, you will see exact clones when trying to perform particle combinatorics with 2016 and 2017 Turbo+PersistReco data. This means that the same underlying Track object is used twice in the same combination, and is an issue because it can create unphysical peaking structures in mass distributions.

As an example, assume your Turbo candidate, that is the object that fired your HLT2 line, is $J/\psi \to \mu^{+}\mu^{-}$. The HLT2 line has PersistReco enabled, and you want to reconstruct $B^{+} \to J/\psi K^{+}$, taking the $J/\psi$ Turbo candidate and kaons from StdLooseKaons. With the default configuration of CombineParticles, you will end up saving $B^{+}$ candidates where the same track is used for the $\mu^{+}$ and the $K^{+}$, meaning that the 3-momenta of the two particles will be identical.

To avoid this issue, you can configure CombineParticles to perform a more robust overlap check:

my_combiner = CombineParticles(
   ...,
   CheckOverlapTool='LoKi::CheckOverlap'
)

Revision 132017-10-02 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 59 to 59
 DaVinci().RootInTES = '/Event/Charmspec/Turbo'
Changed:
<
<
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the previous section.
>
>
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the following section.
 

Monte Carlo truth

Line: 90 to 90
 from Configurables import DaVinci

DaVinci().RootInTES = '/Event/Turbo'

Added:
>
>
DaVinci().Turbo = True
 

It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles, such as StdAllLooseANNPions, the RebuildSelection method should be used. As an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:

Revision 122017-08-21 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 142 to 142
 

Monte Carlo truth

Changed:
<
<
The configuration of algorithms and the DaVinci() configurable for 2016 is as for 2015, which the exception that the argument to getRelLoc should just be an empty string:
>
>
The configuration of algorithms and the DaVinci() configurable for 2016 is similar to 2015, with the exception that the argument to getRelLoc should just be an empty string:
 
Changed:
<
<
relations = TeslaTruthUtils.getRelLoc('')
>
>
relations = [TeslaTruthUtils.getRelLoc('')]

Some additional lines are also needed:

from Configurables import DaVinci, DstConf, TurboConf

DstConf().Turbo = True
TurboConf().PersistReco = True

DaVinci().RootInTES = 'MDST'
 

Productions using DaVinci v41r2p5 or v41r4p2

Revision 112017-07-20 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Making ntuples from Turbo data

Line: 29 to 29
 hlt2_line = 'Hlt2CharmHadD02KmPipTurbo'
Changed:
<
<

2015

The location of the output Particle objects from an HLT2 Turbo line is:

hlt2_line = '/Event/Turbo/{0}/Particles'.format(hlt2_line)
>
>

2017

 
Changed:
<
<
Algorithms must be explicitly configured to pick up the Turbo primary vertices, and so the Turbo-specific DecayTreeTuple configuration will look like this:
>
>
In 2017 the treatment of Turbo and PersistReco was unified. Now, the only properties of the DaVinci() configurable you need to modify are:
 
Changed:
<
<
dtt.Inputs = ['/Event/Turbo/{0}/Particles'.format(hlt2_line)] dtt.WriteP2PVRelations = False dtt.InputPrimaryVertices = '/Event/Turbo/Primary'
>
>
DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event//Turbo' DaVinci().Turbo = True
 
Changed:
<
<
If your line had PV refitting enabled, and you wish to use the refitted PVs, change InputPrimaryVertices to point to the corresponding location.

No Turbo-specific configuration of the DaVinci() configurable is needed. RootInTES should not be set and InputType can be left as the default value ('DST').

>
>
Neither DstConf nor TurboConf should be configured in your options.
 
Changed:
<
<

PersistReco

>
>
You also no longer need to modify the WriteP2PVRelations and InputPrimaryVertices properties of your algorithms, the PVs will be picked up automatically.
 
Changed:
<
<
PersistReco was not available in 2015.
>
>
Setting the three DaVinci() properties above is mandatory for Turbo and TurCal data. The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons.
 
Changed:
<
<

Monte Carlo truth

To get Monte Carlo truth information, add TupleToolMCTruth and TupleToolMCBackgroundInfo to the DecayTreeTuple ToolList.

>
>
An example of a full location of Particle objects in 2017 is:
 
Changed:
<
<
dtt.ToolList += [ 'TupleToolMCBackgroundInfo' 'TupleToolMCTruth' ]
>
>
/Event/Charmspec/Turbo/Hlt2CharmHadD02KmPipTurbo/Particles
 
Changed:
<
<
Then, add the following to your options:
>
>
However, input locations to algorithms should be relative to the RootInTES property, e.g. for a DecayTreeTuple:
 
Changed:
<
<
from TeslaTools import TeslaTruthUtils

relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/') mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)

>
>
dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] # ... DaVinci().RootInTES = '/Event/Charmspec/Turbo'
 
Changed:
<
<

LoKi functors

To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:

>
>
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the previous section.
 
Changed:
<
<
loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool/SomeName')
loki_tt.Preambulo = [
      'from LoKiPhysMC.decorators import *',
      'from LoKiPhysMC.functions import mcMatch'
]
# Use the (assumed existing) decay descriptor on the DecayTreeTuple to build
# a MC-matching descriptor
# The use of the DecayTreeTuple descriptor and of the '==>' arrow is
# not always valid for every analysis; be careful!
mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>')
loki_tt.Variables = {
      'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations)
}
>
>

Monte Carlo truth

 
Changed:
<
<
Where the relation variables is the return value of the getRelLoc method shown above.
>
>
Accessing Monte Carlo truth for 2017 data is under development.
 

2016

Line: 188 to 154
  In addition, you must always set RootInTES to /Event/Turbo, whether running over DST or microDST, as above.
Changed:
<
<

2017

>
>

2015

 
Changed:
<
<
In 2017 the treatment of Turbo and PersistReco was unified. Now, the only properties of the DaVinci() configurable you need to modify are:
>
>
The location of the output Particle objects from an HLT2 Turbo line is:
 
Changed:
<
<
DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event//Turbo' DaVinci().Turbo = True
>
>
hlt2_line = '/Event/Turbo/{0}/Particles'.format(hlt2_line)
 
Changed:
<
<
Neither DstConf nor TurboConf should be configured in your options.
>
>
Algorithms must be explicitly configured to pick up the Turbo primary vertices, and so the Turbo-specific DecayTreeTuple configuration will look like this:
 
Changed:
<
<
You also no longer need to modify the WriteP2PVRelations and InputPrimaryVertices properties of your algorithms, the PVs will be picked up automatically.
>
>
dtt.Inputs = ['/Event/Turbo/{0}/Particles'.format(hlt2_line)]
dtt.WriteP2PVRelations = False
dtt.InputPrimaryVertices = '/Event/Turbo/Primary'
 
Changed:
<
<
Setting the three DaVinci() properties above is mandatory for Turbo and TurCal data. The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons.
>
>
If your line had PV refitting enabled, and you wish to use the refitted PVs, change InputPrimaryVertices to point to the corresponding location.

No Turbo-specific configuration of the DaVinci() configurable is needed. RootInTES should not be set and InputType can be left as the default value ('DST').

 
Changed:
<
<
Input locations to algorithms should be relative to the RootInTES property, e.g. for a DecayTreeTuple:
>
>

PersistReco

PersistReco was not available in 2015.

Monte Carlo truth

To get Monte Carlo truth information, add TupleToolMCTruth and TupleToolMCBackgroundInfo to the DecayTreeTuple ToolList.

 
Changed:
<
<
dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] # ... DaVinci().RootInTES = '/Event/Charmspec/Turbo'
>
>
dtt.ToolList += [ 'TupleToolMCBackgroundInfo' 'TupleToolMCTruth' ]
 
Changed:
<
<
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the previous section.
>
>
Then, add the following to your options:
 
Changed:
<
<

Monte Carlo truth

>
>
from TeslaTools import TeslaTruthUtils
 
Changed:
<
<
Accessing Monte Carlo truth for 2017 data is under development.
>
>
relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/') mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)

LoKi functors

To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:

loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool/SomeName')
loki_tt.Preambulo = [
      'from LoKiPhysMC.decorators import *',
      'from LoKiPhysMC.functions import mcMatch'
]
# Use the (assumed existing) decay descriptor on the DecayTreeTuple to build
# a MC-matching descriptor
# The use of the DecayTreeTuple descriptor and of the '==>' arrow is
# not always valid for every analysis; be careful!
mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>')
loki_tt.Variables = {
      'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations)
}

Where the relation variables is the return value of the getRelLoc method shown above.

Revision 102017-07-20 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"
Changed:
<
<

Introduction

>
>

Making ntuples from Turbo data

This page shows you how to configure DaVinci to process Turbo data.

Due to the historical development cycle of the Turbo processing model, the format of Turbo data has changed from 2015 to 2016 and again from 2016 to 2017. Although a stable DaVinci configuration is always a prority for the Turbo developers, some changes are required when analysing datasets from different years.

The sections below are organised per year, and are standalone after reading the introduction.

 
Changed:
<
<
As the Tesla application processes the Turbo stream to provide an output that mimics the Stripping framework, all that is required is to run DecayTreeTuple as a one-step process.
>
>

Introduction

  It is expected that any TupleTool that works on a microDST Stripping output will work with Tesla output.
Line: 15 to 23
 dtt = DecayTreeTuple(...)
Changed:
<
<

Standard configuration

The configuration in this section applies whenever one wishes to fill an ntuple with Turbo candidates, whether using data or MC.

You must provide DecayTreeTuple with the location of the input particles, which for HLT2 Turbo lines lives under:

>
>
An example HLT2 Turbo line is assumed, available as hlt2_line:
 
Changed:
<
<
hlt2_line = '/Event/Turbo//Particles'
>
>
hlt2_line = 'Hlt2CharmHadD02KmPipTurbo'
 
Changed:
<
<
For the HLT2 Turbo line Hlt2CharmHadD02KPi_XSecTurbo, the ntuple is then configured as:
>
>

2015

The location of the output Particle objects from an HLT2 Turbo line is:

 
Changed:
<
<
hlt2_line = '/Event/Turbo/Hlt2CharmHadD02KPi_XSecTurbo/Particles' dtt.Inputs = [hlt2_line]
>
>
hlt2_line = '/Event/Turbo/{0}/Particles'.format(hlt2_line)
 
Changed:
<
<
The ntuple must be configured to use particle-to-primary-vertex (P2PV) relations as defined in the Turbo stream, and to use the PVs as reconstructed in HLT2.
>
>
Algorithms must be explicitly configured to pick up the Turbo primary vertices, and so the Turbo-specific DecayTreeTuple configuration will look like this:
 
Added:
>
>
dtt.Inputs = ['/Event/Turbo/{0}/Particles'.format(hlt2_line)]
 dtt.WriteP2PVRelations = False dtt.InputPrimaryVertices = '/Event/Turbo/Primary'
Changed:
<
<
Note that if PV re-fitting was enabled in the HLT2 Turbo line, you must provide the location of the re-fitted PVs to DecayTreeTuple.
>
>
If your line had PV refitting enabled, and you wish to use the refitted PVs, change InputPrimaryVertices to point to the corresponding location.

No Turbo-specific configuration of the DaVinci() configurable is needed. RootInTES should not be set and InputType can be left as the default value ('DST').

PersistReco

PersistReco was not available in 2015.

Monte Carlo truth

To get Monte Carlo truth information, add TupleToolMCTruth and TupleToolMCBackgroundInfo to the DecayTreeTuple ToolList.

dtt.ToolList += [
      'TupleToolMCBackgroundInfo'
      'TupleToolMCTruth'
]

Then, add the following to your options:

from TeslaTools import TeslaTruthUtils

relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/')
mc_tools = [
      'MCTupleToolKinematic',
      # ...and any other tools you'd like to use
]
TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)

LoKi functors

To use LoKi functors that require Monte Carlo truth matching, you similarly need to set the location of the relations tables. When using the mcMatch functor, this location can be passed as the second argument to the functor:

loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool/SomeName')
loki_tt.Preambulo = [
      'from LoKiPhysMC.decorators import *',
      'from LoKiPhysMC.functions import mcMatch'
]
# Use the (assumed existing) decay descriptor on the DecayTreeTuple to build
# a MC-matching descriptor
# The use of the DecayTreeTuple descriptor and of the '==>' arrow is
# not always valid for every analysis; be careful!
mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>')
loki_tt.Variables = {
      'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations)
}

Where the relation variables is the return value of the getRelLoc method shown above.

2016

The configuration of algorithms and the DaVinci() configurable for 2016 is as for 2015.

 

PersistReco

Changed:
<
<
For accessing the output of the HLT2 reconstruction, available when your line has the PersistReco flag, you must add the following lines to your options file:
>
>
For accessing the output of the HLT2 reconstruction, available when your line has the PersistReco flag, add the following to your options file:
 
from Configurables import DstConf, TurboConf
Line: 50 to 114
 TurboConf().PersistReco = True
Added:
>
>
The Track objects are made available at /Event/Turbo/Rec/Track/Best, and the ProtoParticle objects are made available under /Event/Turbo/Rec/ProtoP/Charged. The rest of the reconstruction is under /Event/Hlt2. Primary vertices are under /Event/Turbo/Primary as usual, but the associated VELO tracks also exist for PersistReco events.
 

DaVinci v42r2 and above

Changed:
<
<
For DaVinci versions v42r2 and above, one needs some additional configuration. In these versions, PersistReco objects are now unpacked to /Event/Turbo by default, and so one should set RootInTES accordingly.
>
>
For DaVinci versions v42r2 and above, you need some additional configuration. In these versions, all PersistReco objects are now available under /Event/Turbo by default, and so one should set RootInTES accordingly.
 
from Configurables import DaVinci
Line: 60 to 126
 DaVinci().RootInTES = '/Event/Turbo'
Changed:
<
<
It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles such as StdAllLooseANNPions the RebuildSelection method should be used. An an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:
>
>
It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles, such as StdAllLooseANNPions, the RebuildSelection method should be used. As an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:
 
from PhysSelPython.Selections import (
Line: 74 to 140
 combiner_sel = CombineSelection( 'CombineD0pi', inputs=[
Changed:
<
<
AutomaticData(hlt2_line),
>
>
# Now this location can be relative to RootInTES AutomaticData('{0}/Particles'.format(hlt2_line)),
  RebuildSelection(StdAllLooseANNPions) ], DecayDescriptors=[
Line: 107 to 174
 DaVinci().UserAlgorithms = [selseq.sequence(), dtt]
Changed:
<
<

Configuration for Monte Carlo

>
>

Monte Carlo truth

The configuration of algorithms and the DaVinci() configurable for 2016 is as for 2015, which the exception that the argument to getRelLoc should just be an empty string:

 
Deleted:
<
<
To get MC truth information, first add TupleToolMCTruth and TupleToolMCBackgroundInfo to the list of tools used by the ntuple.
 
Changed:
<
<
dtt.ToolList += [ 'TupleToolMCBackgroundInfo' 'TupleToolMCTruth' ]
>
>
relations = TeslaTruthUtils.getRelLoc('')
 
Changed:
<
<
The following lines will then correctly configure the MC truth tuple tools and add them to the DecayTreeTuple instance.
from TeslaTools import TeslaTruthUtils
>
>

Productions using DaVinci v41r2p5 or v41r4p2

 
Changed:
<
<
relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/') mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
>
>
When analysing the output of the most recent Monte Carlo productions for 2016 Turbo MC, which used DaVinci v41r2p5 (for Stripping26) or v41r4p2 (for Stripping28), those specific versions must be used in your DaVinci job.

In addition, you must always set RootInTES to /Event/Turbo, whether running over DST or microDST, as above.

2017

In 2017 the treatment of Turbo and PersistReco was unified. Now, the only properties of the DaVinci() configurable you need to modify are:

 
Deleted:
<
<
For 2016 data and MC, you do not need to pass the HLT2 Turbo line name to getRelLoc.
 
Changed:
<
<
relations = TeslaTruthUtils.getRelLoc('') mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
>
>
DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event//Turbo' DaVinci().Turbo = True
 
Changed:
<
<

LoKi functors

>
>
Neither DstConf nor TurboConf should be configured in your options.

You also no longer need to modify the WriteP2PVRelations and InputPrimaryVertices properties of your algorithms, the PVs will be picked up automatically.

Setting the three DaVinci() properties above is mandatory for Turbo and TurCal data. The stream_name is the name of the stream, like CHARMSPEC or LEPTONS, but in lowercase with the first letter capitalised, like Charmspec or Leptons.

Input locations to algorithms should be relative to the RootInTES property, e.g. for a DecayTreeTuple:

 
Deleted:
<
<
For LoKi functors using MC truth matching, you similarly need to set the relations location. When using the mcMatch functor, the relations location is defined by the second argument to the functor:
 
Changed:
<
<
loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool') loki_tt.Preambulo = [ 'from LoKiPhysMC.decorators import *', 'from LoKiPhysMC.functions import mcMatch' ] # Use the (assumed existing) decay descriptor on the DecayTreeTuple to build # a MC-matching descriptor # The use of the DecayTreeTupleDescriptor and of the '==>' arrow is # not always valid for every analysis; be careful! mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>') loki_tt.Variables = { 'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations) }
>
>
dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] # ... DaVinci().RootInTES = '/Event/Charmspec/Turbo'
 
Added:
>
>
For events where a PersistReco line fired, the family of Std* particles, like StdAllPions, should be rebuilt using the Selection framework as shown in the previous section.

Monte Carlo truth

Accessing Monte Carlo truth for 2017 data is under development.

Revision 92017-05-20 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 63 to 63
 It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles such as StdAllLooseANNPions the RebuildSelection method should be used. An an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:
Changed:
<
<
from PhysSelPython.Wrappers import ( RebuildSelection,
>
>
from PhysSelPython.Selections import (
  AutomaticData,
Changed:
<
<
Selection,
>
>
CombineSelection, RebuildSelection,
  SelectionSequence )
Added:
>
>
from StandardParticles import StdAllLooseANNPions
 
Changed:
<
<
combination = CombineParticles( 'CombineD0Pi',
>
>
combiner_sel = CombineSelection( 'CombineD0pi', inputs=[ AutomaticData(hlt2_line), RebuildSelection(StdAllLooseANNPions) ],
  DecayDescriptors=[ 'D*(2010)+ -> D0 pi+', 'D*(2010)- -> D0 pi-' ],
Added:
>
>
DaughtersCuts={ 'pi+': 'PROBNNpi > 0.2' },
  CombinationCut=(
Changed:
<
<
'in_range(0, (AM - AM1 - AM2), 270)'
>
>
'in_range(0, (AM - AM1 - AM2), 170)'
  ), MotherCut=( '(VFASPF(VCHI2PDOF) < 10) &'
Changed:
<
<
'in_range(0, (M - M1 - M2), 250)' )
>
>
'in_range(0, (M - M1 - M2), 150)'
  )
Deleted:
<
<
sel = Selection( combination.getName() + 'Selection', Algorithm=combination, RequiredSelections=[ AutomaticData(hlt2_line), RebuildSelection(AutomaticData('Phys/StdAllLooseANNPions/Particles')) ]
 ) selseq = SelectionSequence(
Changed:
<
<
sel.name() + 'Sequence', TopSelection=sel
>
>
combiner_sel.name() + 'Sequence', TopSelection=combiner_sel
 )
Line: 102 to 102
 
dtt = DecayTreeTuple(...)
Changed:
<
<
dtt.Inputs = [sel.outputLocation()]
>
>
dtt.Inputs = [combiner_sel.outputLocation()]
 # ... DaVinci().UserAlgorithms = [selseq.sequence(), dtt]

Revision 82017-05-20 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 39 to 39
  Note that if PV re-fitting was enabled in the HLT2 Turbo line, you must provide the location of the re-fitted PVs to DecayTreeTuple.
Deleted:
<
<
You should not set DaVinci().InputType to MDST, nor should you set DaVinci().RootInTES.
 

PersistReco

For accessing the output of the HLT2 reconstruction, available when your line has the PersistReco flag, you must add the following lines to your options file:

Line: 52 to 50
 TurboConf().PersistReco = True
Added:
>
>

DaVinci v42r2 and above

For DaVinci versions v42r2 and above, one needs some additional configuration. In these versions, PersistReco objects are now unpacked to /Event/Turbo by default, and so one should set RootInTES accordingly.

from Configurables import DaVinci

DaVinci().RootInTES = '/Event/Turbo'

It is strongly advised to use the Python selection framework when building selections. In particular, when one wishes to use standard particles such as StdAllLooseANNPions the RebuildSelection method should be used. An an example of taking the output of a $D^{0} \rightarrow K^{-}\pi^{+}$ Turbo line and combining it with a PersistReco pion:

from PhysSelPython.Wrappers import (
    RebuildSelection,
    AutomaticData,
    Selection,
    SelectionSequence
)

combination = CombineParticles(
    'CombineD0Pi',
    DecayDescriptors=[
      'D*(2010)+ -> D0 pi+',
      'D*(2010)- -> D0 pi-'
    ],
    CombinationCut=(
      'in_range(0, (AM - AM1 - AM2), 270)'
    ),
    MotherCut=(
      '(VFASPF(VCHI2PDOF) < 10) &'
      'in_range(0, (M - M1 - M2), 250)'
    )
    )
sel = Selection(
    combination.getName() + 'Selection',
    Algorithm=combination,
    RequiredSelections=[
      AutomaticData(hlt2_line),
      RebuildSelection(AutomaticData('Phys/StdAllLooseANNPions/Particles'))
    ]
)
selseq = SelectionSequence(
    sel.name() + 'Sequence',
    TopSelection=sel
)

You can then add the full selection to some sequence with selseq.sequence(), getting the output particle location using sel.outputLocation(). For example:

dtt = DecayTreeTuple(...)
dtt.Inputs = [sel.outputLocation()]
# ...
DaVinci().UserAlgorithms = [selseq.sequence(), dtt]
 

Configuration for Monte Carlo

To get MC truth information, first add TupleToolMCTruth and TupleToolMCBackgroundInfo to the list of tools used by the ntuple.

Line: 74 to 129
 TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)
Deleted:
<
<

Configuration for Monte Carlo

 For 2016 data and MC, you do not need to pass the HLT2 Turbo line name to getRelLoc.
relations = TeslaTruthUtils.getRelLoc('')

Revision 72017-04-24 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 41 to 41
  You should not set DaVinci().InputType to MDST, nor should you set DaVinci().RootInTES.
Added:
>
>

PersistReco

For accessing the output of the HLT2 reconstruction, available when your line has the PersistReco flag, you must add the following lines to your options file:

from Configurables import DstConf, TurboConf

DstConf().Turbo = True
TurboConf().PersistReco = True
 

Configuration for Monte Carlo

To get MC truth information, first add TupleToolMCTruth and TupleToolMCBackgroundInfo to the list of tools used by the ntuple.

Revision 62017-02-23 - AlexPearce

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"
Changed:
<
<

Introduction

>
>

Introduction

 
Changed:
<
<
As the Tesla application processes the Turbo stream to provide an output that mimics the Stripping framework, all that is required is to run DecayTreeTuple as a one step process.
>
>
As the Tesla application processes the Turbo stream to provide an output that mimics the Stripping framework, all that is required is to run DecayTreeTuple as a one-step process.
 
Changed:
<
<
TEMPORARY: The head of "Phys/DecayTreeTupleReco" is required to allow TupleToolRecoStats to function correctly.
>
>
It is expected that any TupleTool that works on a microDST Stripping output will work with Tesla output.

In what follows, it is assumed that the DecayTreeTuple to be configured has been instantiated as dtt:

 
Deleted:
<
<
  • A sample file is provided at
 
Changed:
<
<
/afs/cern.ch/work/s/sbenson/public/forTeslaExtendedReps/MakeNTupleFromTurbo/MakeTuple.py
>
>
from Configurables import DecayTreeTuple from DecayTreeTuple import Configuration

dtt = DecayTreeTuple(...)

 
Changed:
<
<

Notes

>
>

Standard configuration

 
Changed:
<
<
  • While the process allows normal TupleTools to be used, a few modifications are required. Obviously you must provide DecayTreeTuple with your input particles:
tuple.Inputs = [ '/Event/Turbo/Hlt2CharmHadD02KPi_XSecTurbo/Particles' ]
where the above is used to resurrect the HLT2 Turbo line: Hlt2CharmHadD02KPi_XSecTurbo
>
>
The configuration in this section applies whenever one wishes to fill an ntuple with Turbo candidates, whether using data or MC.

You must provide DecayTreeTuple with the location of the input particles, which for HLT2 Turbo lines lives under:

 
Deleted:
<
<
  • The following line is required to allow for the relations tables resurrected in Tesla to be used:
 
Changed:
<
<
tuple.WriteP2PVRelations = False
>
>
hlt2_line = '/Event/Turbo//Particles'
 
Changed:
<
<
  • The location of the resurrected PVs must be given to DecayTreeTuple:
>
>
For the HLT2 Turbo line Hlt2CharmHadD02KPi_XSecTurbo, the ntuple is then configured as:
 
Changed:
<
<
tuple.InputPrimaryVertices = "/Event/Turbo/Primary"
>
>
hlt2_line = '/Event/Turbo/Hlt2CharmHadD02KPi_XSecTurbo/Particles' dtt.Inputs = [hlt2_line]
 
Deleted:
<
<
Note that if you have enabled PV re-fitting inside the HLT, you must provide the location of the re-fitted PVs to DecayTreeTuple.
 
Changed:
<
<
  • As you may expect, you must also tell DecayTreeTuple that you are using the micro-DST format:
>
>
The ntuple must be configured to use particle-to-primary-vertex (P2PV) relations as defined in the Turbo stream, and to use the PVs as reconstructed in HLT2.
 
Changed:
<
<
DaVinci().InputType = 'MDST'
>
>
dtt.WriteP2PVRelations = False dtt.InputPrimaryVertices = '/Event/Turbo/Primary'
 
Changed:
<
<

MC Truth

>
>
Note that if PV re-fitting was enabled in the HLT2 Turbo line, you must provide the location of the re-fitted PVs to DecayTreeTuple.

You should not set DaVinci().InputType to MDST, nor should you set DaVinci().RootInTES.

 
Changed:
<
<
  • To get MC truth information, please add "TupleToolMCTruth" to your main DecayTreeTuple "toollist", then the following lines:
>
>

Configuration for Monte Carlo

To get MC truth information, first add TupleToolMCTruth and TupleToolMCBackgroundInfo to the list of tools used by the ntuple.

 
Changed:
<
<
from TeslaTools import TeslaTruthUtils relations = TeslaTruthUtils.getRelLoc(HLT2LINENAME+"/") TeslaTruthUtils.makeTruth(dtt, relations, ['MCTupleToolKinematic','OTHERTOOLS ...'])
>
>
dtt.ToolList += [ 'TupleToolMCBackgroundInfo' 'TupleToolMCTruth' ]
 
Changed:
<
<
  • For more recent data (don't know how recent), you may need to use instead:
>
>
The following lines will then correctly configure the MC truth tuple tools and add them to the DecayTreeTuple instance.
 
from TeslaTools import TeslaTruthUtils
Deleted:
<
<
relations = TeslaTruthUtils.getRelLoc("") TeslaTruthUtils.makeTruth(dtt, [relations], ['MCTupleToolKinematic','OTHERTOOLS ...'])
 
Changed:
<
<
  • For LoKi functors using MC matching, you similarly need to set the relations location, eg, as the second argument to the mcMatch functor constructor:
lokituple = dtt.addTupleTool('LoKi::Hybrid::TupleTool')
lokituple.Preambulo = ['from LoKiPhysMC.decorators import *',
                    'from LoKiPhysMC.functions import mcMatch']
lokituple.Variables = {'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(dtt.Decay.replace('^', '').replace('->', '==>'), relations)}
>
>
relations = TeslaTruthUtils.getRelLoc(hlt2_line + '/') mc_tools = [ 'MCTupleToolKinematic', # ...and any other tools you'd like to use ] TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)

Configuration for Monte Carlo

For 2016 data and MC, you do not need to pass the HLT2 Turbo line name to getRelLoc.

relations = TeslaTruthUtils.getRelLoc('')
mc_tools = [
    'MCTupleToolKinematic',
    # ...and any other tools you'd like to use
]
TeslaTruthUtils.makeTruth(dtt, relations, mc_tools)

LoKi functors

For LoKi functors using MC truth matching, you similarly need to set the relations location. When using the mcMatch functor, the relations location is defined by the second argument to the functor:

loki_tt = dtt.addTupleTool('LoKi::Hybrid::TupleTool')
loki_tt.Preambulo = [
    'from LoKiPhysMC.decorators import *',
    'from LoKiPhysMC.functions import mcMatch'
]
# Use the (assumed existing) decay descriptor on the DecayTreeTuple to build
# a MC-matching descriptor
# The use of the DecayTreeTupleDescriptor and of the '==>' arrow is
# not always valid for every analysis; be careful!
mc_decay_descriptor = dtt.Decay.replace('^', '').replace('->', '==>')
loki_tt.Variables = {
    'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(mc_decay_descriptor, relations)
}
 
Deleted:
<
<
-- SeanBenson - 2015-06-07

Revision 52016-10-03 - MichaelAlexander

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 51 to 51
 TeslaTruthUtils.makeTruth(dtt, [relations], ['MCTupleToolKinematic','OTHERTOOLS ...'])
Added:
>
>
  • For LoKi functors using MC matching, you similarly need to set the relations location, eg, as the second argument to the mcMatch functor constructor:
lokituple = dtt.addTupleTool('LoKi::Hybrid::TupleTool')
lokituple.Preambulo = ['from LoKiPhysMC.decorators import *',
                    'from LoKiPhysMC.functions import mcMatch']
lokituple.Variables = {'mcMatch' : 'switch(mcMatch({0!r}, {1!r}), 1, 0)'.format(dtt.Decay.replace('^', '').replace('->', '==>'), relations)}
 -- SeanBenson - 2015-06-07

Revision 42016-09-08 - MichaelAlexander

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 39 to 39
 
  • To get MC truth information, please add "TupleToolMCTruth" to your main DecayTreeTuple "toollist", then the following lines:
Added:
>
>
from TeslaTools import TeslaTruthUtils
 relations = TeslaTruthUtils.getRelLoc(HLT2LINENAME+"/") TeslaTruthUtils.makeTruth(dtt, relations, ['MCTupleToolKinematic','OTHERTOOLS ...'])
Added:
>
>
  • For more recent data (don't know how recent), you may need to use instead:
from TeslaTools import TeslaTruthUtils
relations = TeslaTruthUtils.getRelLoc("")
TeslaTruthUtils.makeTruth(dtt, [relations], ['MCTupleToolKinematic','OTHERTOOLS ...'])
 -- SeanBenson - 2015-06-07 \ No newline at end of file

Revision 32016-04-28 - MichaelKolpin

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 39 to 39
 
  • To get MC truth information, please add "TupleToolMCTruth" to your main DecayTreeTuple "toollist", then the following lines:
Changed:
<
<
relations = TeslaTruthUtils.getRelLoc(HLT2LINENAME)
>
>
relations = TeslaTruthUtils.getRelLoc(HLT2LINENAME+"/")
 TeslaTruthUtils.makeTruth(dtt, relations, ['MCTupleToolKinematic','OTHERTOOLS ...'])

Revision 22015-07-20 - SeanBenson

Line: 1 to 1
 
META TOPICPARENT name="LHCbTeslaProject"

Introduction

Line: 35 to 35
 DaVinci().InputType = 'MDST'
Added:
>
>

MC Truth

  • To get MC truth information, please add "TupleToolMCTruth" to your main DecayTreeTuple "toollist", then the following lines:
relations = TeslaTruthUtils.getRelLoc(HLT2LINENAME)
TeslaTruthUtils.makeTruth(dtt, relations, ['MCTupleToolKinematic','OTHERTOOLS ...'])
 -- SeanBenson - 2015-06-07

Revision 12015-06-08 - SeanBenson

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="LHCbTeslaProject"

Introduction

As the Tesla application processes the Turbo stream to provide an output that mimics the Stripping framework, all that is required is to run DecayTreeTuple as a one step process.

TEMPORARY: The head of "Phys/DecayTreeTupleReco" is required to allow TupleToolRecoStats to function correctly.

  • A sample file is provided at
/afs/cern.ch/work/s/sbenson/public/forTeslaExtendedReps/MakeNTupleFromTurbo/MakeTuple.py

Notes

  • While the process allows normal TupleTools to be used, a few modifications are required. Obviously you must provide DecayTreeTuple with your input particles:
tuple.Inputs = [ '/Event/Turbo/Hlt2CharmHadD02KPi_XSecTurbo/Particles' ]
where the above is used to resurrect the HLT2 Turbo line: Hlt2CharmHadD02KPi_XSecTurbo

  • The following line is required to allow for the relations tables resurrected in Tesla to be used:
tuple.WriteP2PVRelations = False

  • The location of the resurrected PVs must be given to DecayTreeTuple:
tuple.InputPrimaryVertices = "/Event/Turbo/Primary"
Note that if you have enabled PV re-fitting inside the HLT, you must provide the location of the re-fitted PVs to DecayTreeTuple.

  • As you may expect, you must also tell DecayTreeTuple that you are using the micro-DST format:
DaVinci().InputType = 'MDST'

-- SeanBenson - 2015-06-07

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback