-
Notifications
You must be signed in to change notification settings - Fork 61
Code Conventions
- protect against multiple inclusion via
#pragma once - only include necessary headers. For header files, it might be enough to forward-declare or include
core/include/fwd.hfor many classes - do not use
using namespacein header files; use that only in source files
Make use of smart pointers for managing memory explicitly. A good choice is std::unique_ptr or (for shared ownership) std::shared_ptr. Remember you can create std::vectors (or other containers) of smart pointers, if necessary. In particular, do that if the actual type is not known at declaration time and only the base class is known, e.g. for abstract classes such as AnalysisModule.
For example, you could write quite generically in your AnalysisModule:
// in the class:
std::vector<std::unique_ptr<uhh2::AnalysisModule>> modules;
// in the constructor, add new modules:
modules.emplace_back(new JetCorrector(JERFiles::PHYS14_L123_MC));
// in process, call; all modules:
for(auto & m : modules){
m->process(event);
}
Document what each class and each function does, including a description of all input / output parameters. If applicable, also describe which event input is used or modified. Also document what happens in the case of an error.
For AnalysisModules document which Event content is read, written, or modified and whether some input / output is optional. State which options from the Context class are interpreted (if any) and what the allowed values are.
Use nouns as class names.
Be minimalistic for both data and methods: Only declare data members which are actually used and only implement methods which are used.
Hide details of the implementation by exposing no implementation-dependent data structures via the public interface.
Use verbs as method names. An exception is getter methods: they should be named after what they get (without the 'get' itself). Mark methods as const whenever possible.
Be minimalistic: only use arguments actually needed.
The simpler, the better: avoid using more advanced constructs (such as accepting smart pointers) if a simpler construct (such as accepting a bare pointer of reference) will also do. To judge what is "simpler" consider how many different classes are involved in the declaration and how easy it is for a caller to get these. For example, it is always easier for a caller to get a reference than a smart pointer, as the former can be trivially constructed from the latter.
As function input arguments, use pass-by-value for non-compound types (int, float, double, etc.) and const-reference for compound types (vectors, strings, Jets, Leptons, etc.). Only if the argument is optional, pass by pointer-to-const.
To return the result, use the return value of the function if possible. Alternatively, accept a parameter by reference which is modified, e.g. the Event container. Only if the argument is optional, pass by pointer.
Only pass smart pointers if ownership is transferred / shared between caller and callee. This can be the case for a constructor where the object takes (shared or exclusive) ownership of one or more objects. For functions, it is almost always better to use references, const-references, or raw pointers instead of smart pointers, as discussed above.
Use spaces only (no tabs), preferentially 4 spaces per indentation level.
-
Ntuple instructions per branch/release
- 10_6_X, UL16/17/18
- 10_2_X, 2016/17/18
- 9_4_X, 2017
- 9_2_X, 2017
-
8_0_X, 2016
- Installing and Compiling (Run II, 80X, miniAOD v1, 80X_v1)
- Ntuple Production (Run II, 80X, MiniAODv1)
- Installing, Compiling and Ntuples (Run II, 80X, miniAOD v2, 80X_v2)
- Installing, Compiling and Ntuples (Run II, 80X, Moriond17, 80X_v3)
- Installing, Compiling and Ntuples (Run II, 80X, miniAOD v2, HOTVR & XCone reprocessing, 80X_v5)
-
Analysis info
- crab kill, follow-up tasks, duplicates
- Running failing crab jobs locally
- Checking & Reprocessing of missing ntuples
- Creating & using luminosity ROOT file in SFrame
- Finding a MINIAOD file from an ntuple event
- Luminosity & cross-section weighting information for Monte Carlo samples
- NtupleFormat
- Pileup reweighting for MC
- 2017 MC samples with buggy pileup
- Recipe for PDF uncertainties (RunII, 25ns, MiniAODv2)
- Running
- Singularity (using SL6 on EL7)
- Storing user variables in objects
- Trigger Paths & Filters; storing trigger objects
- Working with DESY Tier 2 dCache (
/pnfs) - Tier2 UHH2 group space
- Application of Keras Neural-Network in UHH2
-
Developer tips
- (Top) Jet collections in Ntuples
- Adding a new object class to ntuples
- CMSSW vs. SFrame
- Code Conventions
- Code Overview
- Committing & Contributing Code
- Compiling and installing fastjet, fastjet contrib
- Continuous Integration
- Continuous Integration Setup Instructions
- Debugging tips
- git(hub) tutorial
- Handling different years (RunII_102_v1 10_2_X and beyond)
- Event Class
- Maintainer Responsibilities
- Metadata
- OS Acronyms
- Performance
- Porting changes across branches (cherry-picking)
- Renaming a ntuple collection
- Using an external package
- DNN/TF dev planning
-
Older ntuple instructions
-
7_6_X, 25ns, 2015
- Installing and Compiling (Run II, 25ns)
- Installing and Compiling (Run II, 25ns, miniAOD v2)
- Installing and Compiling (Run II, 76X, 25ns, miniAOD v2)
- Ntuple Production (Run II, 25ns v1 MC ONLY!)
- Ntuple Production (Run II, 25ns, MiniAODv2)
- Ntuple Production (Run II, 25ns, prompt reco D v3)
- Ntuple Production (Run II, 76X, 25ns, MiniAODv2)
- 7_4_X, 50ns, 2015
- Phys14, 2014
-
7_6_X, 25ns, 2015