Exercises to try

Last update: 16 Aug 2024 [History] [Edit]

Things to try in the hands-on session or in your own time

Create a new branch

  • Make a new branch within your project (many guides exist example, ask for help if it’s needed)
      git checkout -b <name_of_branch>
    
  • Try make some changes to your MyAnalysis package, add some printouts, a histogram or something similar. Anything simple you have previously done in the Analysis Software Tutorial.
  • Commit and push the new branch

    Now when you commit,

    # instead of 
    git push origin master
    # You will do this instead for the branch
    git push origin <name_of_branch>
    

Create merge request

  • If you now check your gitlab project, you should see your added branch

  • Have a look at your branch and you should see your recent commit which you didn’t have on the master branch. You should now see a ‘Create Merge Request’ button.

Start this process and create a merge request for your branch to be merged into master. This is a very common thing to be doing throughout your ATLAS analysis, especially if collaborating with many people on the same project. I would highly recommend getting used to this doing this often. NOTE - The process will differ when committing and merging to the Athena repository or official ATLAS software.

  • Add as much description to your merge request as you can, let your collaborators know what this branch introduces.
  • There are lots of options with a merge request but you shouldn’t need to worry about the majority of them. Tick the delete source branch option if you don’t plan on continuing work on this branch after the merge.
  • For this exercise you can assign yourself to review the merge request (MR) but this would usually be a maintainer of your analysis software.

Merge a branch into master

Finally, you should see a screen like this

  • Here you can add comments and discuss the request. Go ahead and merge the branch into your master! (Hopefully you had better commit messages than I did)

Your changes should now be in master, feel free to switch back branches locally

Add a collaborator and approve a merge request

One important part of ATLAS analysis is to collaborate with the analysis team, making sure all commits and changes to the analysis are communicated and added properly between collaborators. You will at some point be adding collaborators to your repository, so we can try this now.

Add a colleague or someone else from the tutorial to your project as a developer, the breakout rooms can help with this. Let us know if you can’t find anyone.

Have your partner clone your repository, create a new branch and make a small change to the code in this branch (with clear commit messages). Let them push this to the remote branch and submit a merge request to merge into master. This will give you a chance to review the change and choose whether to accept the merge.

Resolve a Conflict

You may at some point have to resolve a conflict where multiple people have been working on the same piece of code locally and one or more lines conflict when trying to merge back into master.

Try make a new branch where you change your MyxAODAnalysis.cxx in some way, make an eta cut on the jets or add another print out in the jet loop.

Have your partner or more people in your group create a new branch and do a similar change. If you both push and submit merge requests, you may have a conflict if you accept one merge over the other. Try the handle this conflict.

Modify and update your submodule

When you added your JetSelectionHelper submodule to the your repository, the added repository is at a certain commit tag.

Try to make a change to the JetSelectionHelper package, for example change the jet pT threshold in the src/JetSelectionHelper.cxx. This can be done from your fork on gitlab.cern.ch because it is a small change or you can do this from the terminal.

Guides are available how to update this submodule within your working area repository, try do this for yourself but helpers will be on hand if you’re struggling.

Additional Resources