-- RicardoVazquezGomez - 2016-09-07

Test a Stripping line with git (work in progress)



If you are completely unfamiliar with git, a good place to start is the Git4LHCb web page.

Setup the environment

Before you can test a stripping line you need to set up the environment. In order to do that, setup DaVinci as follows (XX, YY and ZZ are placeholders for the correct version of DaVinci to be used for testing which will be announced at the beginning of every campaign by the stripping coordinators). If you are unsure, check with the Stripping liaison of your WG.

lb-dev DaVinci/vXXrYYpZZ
cd DaVinciDev_vXXrYYpZZ

Checkout the master version of Phys/StrippingSelections

First set the project to be used, in this case "Stripping"

git lb-use Stripping

then checkout and compile StrippingSelections from the master or the currently used branch for the development of a certain Stripping campaign (check with liaisons if unsure). In this example, we assume master is the correct branch to use.

git lb-checkout Stripping/master Phys/StrippingSelections
make configure

Now you can modify the contect of StrippingSelections by adding or modifying a line; every time you do it, the package must be recompiled.

make purge

Add a new line

If you are modifying an existing line you can skip this part. The lines in StrippingSelections are organised in WGs. Suppose we want to add the module StrippingMyCharmDecay.py to the lines of the Charm WG. We need to copy StrippingMyCharmDecay.py to the Phys/StrippingSelections/python/StrippingSelections/StrippingCharm/ directory

cp <path_of_your_file/StrippingMyCharmDecay.py Phys/StrippingSelections/python/StrippingSelections/StrippingCharm/>

Since this is a new line, it has to be added to Phys/StrippingSelections/python/StrippingSelections/StrippingCharm/__init__.py in the, open the init.py file with your favourite editor and add your line to the end of the "_selections" list at the beginning of the file (omit the .py extension)

_selections = [ "StrippingSomeCharm","StrippingSomeOtherCharm", "StrippingMyCharmDecay"]

Now you are ready to recompile StrippingSelections, so as usual do

make purge

If you get compilation errors or a warning due to your line please fix them and then recompile. If get an error/warning NOT due to your line, please inform the stripping coordinators.

Modify an existing line

To modify a an existing module is sufficient to apply the changes using your favourite editor and then compile again

make purge

Test a stripping line

To set up the correct environment variables, issue the command

./run bash --norc

This will bring you to a new bash shell with the correct environment settings (e.g. you will be able to use gaudirun.py). You will need to do this every time that you recompile the package.

The test scripts for users can be found under $STRIPPINGSELECTIONSROOT/tests/users. Among others you can find one called TestMyStrippingLine.py. To test your line by simply editing the file to set the variable 'confname' with the value of the key 'NAME' in your default_config (or directly the key identifying your specific configuration as explained here). So if the name of your configuration is "MyCharmLines" you have simply to set


At this point you can finally test your line by doing, from any location

gaudirun.py -T Phys/StrippingSelections/tests/users/TestMyStrippingLine.py >& someOutputDir/StripTest.log & 

the -T option allows for a better handling of the memory of the process and it's not strictly necessary for testing purposes but it's recommended.

The output of the script will be in the log file, and contains the usual printout of StrippingReport with retention and timing of your lines. In addition, the output DST and/or micro-DST will be produced according to the settings you specified in the default_config (MDST.DST included). The TES location at which your lines are saved together with all related info and flavour tagging info (if requested) are the same as the stripping that will eventually run in production so that you can run your ntuple-maker script on these DSTs to check that all the information is stored correctly. If for some reason you are unhappy with the configuration or implementation of your lines, just go back issuing the command


This will bring you to the original bash session where you can apply your modifications, recompile and start again testing as in explained in this section.

If you are returning with a "fresh" lxplus session, return to the


directory, and you can run as follows:

./run gaudirun.py -T Phys/StrippingSelections/tests/users/TestMyStrippingLine.py >& someOutputDir/StripTest.log & 


Please do not import anything explicitly from the StrippingSelections package, which is used for development. In production the LineBuilders are copied into StrippingArchive to freeze them. Explicit imports from StrippingSelections break this scheme and may cause your line to crash if there are differences with what is put in the StrippingArchive and what is in StrippingSelections.

Before I commit my stripping line

Once you have successfully tested your line inform your WG group liaison about the results of the testing and ask for permission to commit to git. For new lines, please inform also the coordinators before committing the new code. Add the results of the tests as comment to the merge request.

Commit a new or modified line

*You must commit to a new branch and NEVER to the master of the project. The branch will be created in the moment of pushing the changes. Immagine that the name of the line is my_new_branch (please use something that you can identify afterwards), and that I need to change a couple of python files called file1.py and file2.py.

If the files are new first add them to the repository

git add file1.py file2.py

Then, issue the following two commands

git commit -m "message that identifies my commit"
git lb-push Stripping my_new_branch

Prior to making a merge request, merge changes from the master branch into your updated branch with

git fetch --all
git lb-checkout Stripping/master Phys/StrippingSelections

If there are any conflicts, resolve them and test again. To mark a conflicting file as resolved do

git add filename

then commit and push again to the same branch

git commit -m "Merging updates from master & resolving conflicts"
git lb-push Stripping my_new_branch

Were is my commit?

In the gitlab web page https://gitlab.cern.ch/lhcb/Stripping you can find all of the existing branches under Repository/Branches. Once you are satisfied with the results of your work you can ask to merge your branch with the master, so the changes or new lines will be executed in the next stripping campaign. To do so, click on the box Merge Request that follows the name of the branch, and the coordinators will check your changes and eventually accept it. You will be contacted by the coordinators in case that they found something to be changed.


Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r13 - 2018-12-13 - NicolaAnneSkidmore
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

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