IncludeFiles: Difference between revisions

From Mu2eWiki
Jump to navigation Jump to search
Line 25: Line 25:
This is true whether Offline is in a local clone or in a backing release.  Similarly, if the leading element of the path is Tutorial, then you can find the file relative to path defined in the environment variable TUTORIAL_INC.  And so on for other Mu2e Muse-ready repositories.  These environment variables are only defined for repositories that are present in your Muse environment, either via a local clone or by a backing release.
This is true whether Offline is in a local clone or in a backing release.  Similarly, if the leading element of the path is Tutorial, then you can find the file relative to path defined in the environment variable TUTORIAL_INC.  And so on for other Mu2e Muse-ready repositories.  These environment variables are only defined for repositories that are present in your Muse environment, either via a local clone or by a backing release.


With very few exceptions, the code in the Mu2e repositories in the namespace mu2e::.  Some code is also in a namespace nested under mu2e::.
With very few exceptions, the code in the Mu2e repositories is in the namespace mu2e::.  Some code is also in a namespace nested under mu2e::.


There is a second way to find the source code for Mu2e repositories.  Go to the Mu2e GitHub organization, [https://github.com/Mu2e https://github.com/Mu2e] and click on the name of a repository, which will bring you to a source code brower.  But there is a catch: it will bring you to the development head from that repository, not to the version that you are actually using.  It is your responsibility to navigate to the source for the correct version of Offline.  To learn the version to select, find the version field in the output of
There is a second way to find the source code for Mu2e repositories.  Go to the Mu2e GitHub organization, [https://github.com/Mu2e https://github.com/Mu2e] and click on the name of a repository, which will bring you to a source code brower.  But there is a catch: it will bring you to the development head from that repository, not to the version that you are actually using.  It is your responsibility to navigate to the source for the correct version of Offline.  To learn the version to select, you can usually find it in the output of


   echo $OFFLINE_INC
   echo $OFFLINE_INC

Revision as of 22:35, 7 September 2023

Introduction

This page discusses where to find the source for files that are #include'ed that are into Mu2e files. There are separate discussions for include directives in C++ files, in .fcl files and in auxilliary files, such as the geometry files and the Magnetic Field map files. The section on source code files also discusses the namespaces associated with each respository.

C++ Code

This section discusses where to find header files specified by include directives in C++ files. It will not discuss finding source for system and compiler supplied headers; those headers are well documented in the standard literature, to which you can find references in Mu2e C++ FAQ.

Such header files fall into 4 categories

  1. From a Mu2e repository, such as Offline, Production, Tutorial, TrkAna, Stuntple ..
  2. From an external product other than ROOT.
  3. ROOT
  4. Exceptions to the above patterns

Files from Mu2e Muse-Ready Repositories

A typical include directive referencing a header file from the Mu2e Offline repository looks like:

#include "Offline/DataProducts/inc/PDGCode.hh"

From the leading element of the path, you learn that this file comes from the Offline repository and you can find this file at:

 $OFFLINE_INC/Offline/DataProducts/inc/PDGCode.hh

This is true whether Offline is in a local clone or in a backing release. Similarly, if the leading element of the path is Tutorial, then you can find the file relative to path defined in the environment variable TUTORIAL_INC. And so on for other Mu2e Muse-ready repositories. These environment variables are only defined for repositories that are present in your Muse environment, either via a local clone or by a backing release.

With very few exceptions, the code in the Mu2e repositories is in the namespace mu2e::. Some code is also in a namespace nested under mu2e::.

There is a second way to find the source code for Mu2e repositories. Go to the Mu2e GitHub organization, https://github.com/Mu2e and click on the name of a repository, which will bring you to a source code brower. But there is a catch: it will bring you to the development head from that repository, not to the version that you are actually using. It is your responsibility to navigate to the source for the correct version of Offline. To learn the version to select, you can usually find it in the output of

 echo $OFFLINE_INC

Then see section #Selecting Source for a Tag in GitHub for instructions on how to choose that version in the GitHub browser.

Files from External Products

In the Mu2e repositories, you will see include directives that take one of the following forms,

#include "Offline/RecoDataProducts/inc/KalSeed.hh"
#include "art/Framework/Principal/Event.h"
#include "TH1F.h"
#include <iostream>

The remainder of this page will discuss how to find the source code for header files included in the Mu2e code.

The table below summarizes information about each external product that is used by Mu2e. The first column specifies the UPS package name. Second column gives the first element in an include path; it is often but not always the same as the UPS package name; note that there are some differences in capitalization and dash (-) vs underscore (_). The third column gives the environment variable used to locate the source file; in most, but not all cases, it follows the pattern of capitalizing the UPS package name and adding _INC. Note that include directives for ROOT files are just filenames with no additional path information. The fourth column gives the name of the namespace using within that packages; this is irregular and you just need to look it up as needed. Note that some repositories do not use a namespace and their symbols are in the global namespace; in all cases these packages name their files with a distinct prefix, such as gsl_, G4 or T, which serves as proxy for a namespace. The final column gives the url of the respository; if you use these urls, it's your responsibility to navigate to the correct version of the files you wish to view.


UPS Package Name Include Prefix Environment Variable Namespace Source - Be careful to use the correct tag!
art art ART_INC art:: https://github.com/art-framework-suite/art
artdaq-core artdaq-core ARTDAQ_CORE_INC artdaq:: https://github.com/art-daq/artdaq_core
artdaq-core-mu2e artdaq-core-mu2e ARTDAQ_CORE_MU2E_INC mu2e:: https://github.com/Mu2e/artdaq_core_mu2e
art_root_io art_root_io ART_ROOT_IO_INC art:: https://github.com/art-framework-suite/art-root-io
boost boost BOOST_INC boost:: https://github.com/boostorg/boost
BTrk BTrk BTRK_INC (global) https://github.com/KFTrack/BTrk
canvas canvas CANVAS_INC art:: https://github.com/art-framework-suite/canvas
cetlib cetlib CETLIB_INC cet:: https://github.com/art-framework-suite/cetlib
cetlib_except cetlib_except CETLIB_EXCEPT_INC cet:: https://github.com/art-framework-suite/cetlib-except
clhep CLHEP CLHEP_INC CLHEP:: https://gitlab.cern.ch/CLHEP/CLHEP
fhiclepp fhiclcpp FHICLCPP_INC fhicl:: https://github.com/art-framework-suite/fhicl-cpp
geatn4 Geant4 G4INCLUDE (global) https://gitlab.cern.ch/geant4/geant4
gsl gsl GSL_INC (global) https://github.com/ampl/gsl
KinKal KinKal KINKAL_INC KinKal:: https://github.com/KFTrack/KinKal]
mu2e_pcie_utils mu2e_pcie_utils MU2E_PCIE_UTILS_INC DTCLib:: https://github.com/Mu2e/mu2e_pcie_utils
messagefaciltiy messagefacility MESSAGEFACILITY_INC mf:: https://github.com/art-framework-suite/messagefacility
tbb tbb TBB_INC tbb::
xercesc xercesc XERCES_C_INC xercesc:: https://github.com/apache/xerces-c
root (none) ROOT_INC (global) https://github.com/root-project/root


Files Included from ROOT

The syntax to incluude a root header file is to specify a path relative to $ROOT_INC. Because of the way that the root repository is structured, this results in most include directives containing only the filename. In almost all cases, the filename starts with a capital letter T, for example

 #include "TH1F.h"

There are a small number of exceptional cases in which the filename starts with a capital letter R. Two cases that occur in the Mu2e code base are:

 #include "Rtypes.h"
 #include "Riostream.h" 

Finally, some header files live in subdirectories under $ROOT_INC. The two subdirectories that occur in the Mu2e code base are Math and TVMA, for example

 #include "Math/Vector3D.h"
 #include "TMVA/Factory.h"

Exceptions

One other exception was found in a recent scan of Offline. The file included with,

 #include "dtcInterfaceLib/DTC_Packets.h"

is found in the repository mu2e_pcie_utils, which can be found in the above table.


IDES vim and emacs

.fcl Files

Auxillary Files

FCL Files

Auxillary Files

 SimpleConfig, BField maps ...

Selecting Source for a Tag in GitHub

This section explains how to choose the source for a given tag of Offline using the GitHub code browser. Go to the Mu2e Offline web page, https://github.com/Mu2e/Offline. It will look like the figure below. In the figure, the branch/tag selector button is circled in red.

  1. Click on this button and a menu will pop up.
  2. Choose the "Tags" tag
  3. Scroll to the tab of interest and double click on it
Mu2eGitHub.png