Useful links on EOS utilities at FNAL LPC:

Monitoring service for all things LPC:

Two’s complement is the most common way to represent signed numbers in fixed-point integer operations. Here is a simple implementation in C++ to convert from C++ signed integer to N-bit two’s complement value.

#include <iostream>

template<int N>
int to_twos_complement(int x) {
return (x < 0) ? ((~abs(x) + 1) & ((1<<N)-1)) : x;
}

template<int N>
int from_twos_complement(int x) {
return (x & (1<<(N-1))) ? (~(x-1) & ((1<<N)-1)) : x;
}

int main()
{
int x = -1;
int y = to_twos_complement<8>(x);
int z = from_twos_complement<8>(y);

std::cout << x << std::endl;  // = -1
std::cout << y << std::endl;  // = 255
std::cout << z << std::endl;  // = 1
}


I recently found that CMSSW has a very nice implementation of delta-phi calculation with a very clever use of std::round(). See https://github.com/cms-sw/cmssw/blob/CMSSW_8_1_X/DataFormats/Math/interface/deltaPhi.h

But I realized it can be made even better by removing the branching condition. Hence this is my modified deltaPhi() function:

#include <cmath>

template <typename T>
inline T deltaPhiInRadians(T phi1, T phi2) {
T result = phi1 - phi2;  // same convention as reco::deltaPhi()
constexpr T _twopi = M_PI*2.;
result /= _twopi;
result -= std::round(result);
result *= _twopi;  // result in [-pi,pi]
return result;
}

template <typename T>
inline T deltaPhiInDegrees(T phi1, T phi2) {
T result = phi1 - phi2;  // same convention as reco::deltaPhi()
constexpr T _twopi = 360.;
result /= _twopi;
result -= std::round(result);
result *= _twopi;  // result in [-180,180]
return result;
}


Xrootd is a service implemented in ROOT that allows the user to remotely read data located at various CMS sites. The protocol details can be found at the following TWiki page:

Once you have a valid grid proxy (obtained by doing voms-proxy-init --voms cms), you can read a file on a remote site by using a ROOT command like.

TFile *f = TFile::Open("root://cmsxrootd.fnal.gov//store/mc/path/to/file");


The prefix root://cmsxrootd.fnal.gov/ is known as the redirector. In this case, it is the Fermilab redirector. There are also root://xrootd-cms.infn.it/ for Europe regional redirector, and root://cms-xrd-global.cern.ch/ for global redirector. The path /store/mc/... or /store/data/... is known as the Logical File Name (LFN), which is the global identifier of an official CMS dataset. You can also access non-official files stored under /store/user/username/... at any CMS storage element that provides Xrootd service. To download the file, you can use xrdcp:

xrdcp root://cmsxrootd.fnal.gov//store/mc/path/to/file /some/local/path


In case your grid proxy is not recognized, check if the environment variable \$X509_USER_PROXY is set. If not, set it by doing:

export X509_USER_PROXY=/tmp/x509up_uid -u


or:

export X509_USER_PROXY=voms-proxy-info -path


To debug what’s wrong with Xrootd, do

export XRD_LOGLEVEL=Debug


crab is used to create and submit CMSSW jobs, distributing them to computing centers all over the world. The reference TWiki pages are:

The status of the submitted jobs can be monitored at:

The status of Asynchronous Stage Out (ASO) can be monitored at:

To find the site names for whitelisting or blacklisting, check the CMS CRIC web portal. If you know which dataset you want to analyze, you can also find the site names of the sites that host the dataset using DAS. Note that a user can only access datasets on Tier2 sites, not Tier1 sites. For quicker DAS queries, use the command-line tool dasgoclient.

The CRAB3 output files are stored in a directory with this structure: outLFNDirBase/inputPrimaryDataset/outputDatasetTag/timestamp/; if doing MC event generation, the directory structure is outLFNDirBase/outputPrimaryDataset/outputDatasetTag/timestamp/ where outputPrimaryDataset is specified by the user.

The source codes responsible for the CRAB server and client and other services can be found at:

If you have questions regarding CRAB, you can ask in the Hypernews forum: