Skip to content
Dylan Teague edited this page Jul 25, 2017 · 6 revisions

Particle divides the particles up into a tree of heirarchy as such:

             Generated
          /
         /
Particle ---Jet 
         \         _Electron
          \       /
           Lepton --Muon
                  \_
                     Taus

This means that qualities that are shared across multiple types of particles can initalized for each with only one writing of the code. So if more properties are added for analysis to leptons, adding this becomes simple.

In the source files, there are two lines to initialize each value: SetBranchStatus, SetBranchAddress

When the file is openned, all of the values have their status set to 0 or false. When initializing the values to be used, then it must be set back to 1 or true again. The point of this is to speed up the overhead for setting up an event. Each call of GetEntry looks through all of the possible branches of the main tree to see if it needs to set any of the values to the respective addresses. By setting everything not used to false status, the GetEntry doesn't look at those branches, saving the check for every single event, speeding up each event process

The info for each particle is stored in a PartDet file:

Particle Info File
Generated PartDet/Gen_info.in
Jets PartDet/Jet_info.in
Electrons PartDet/Electron_info.in
Muons PartDet/Muon_info.in
Taus PartDet/Tau_info.in

PartStats is the Object that is used extensively by the Particle object. It holds all of the cuts in the PartDet files. To make it easy to access all of the information, the PartStats is made up of 4 main maps

unordered_map<string,double> dmap;
unordered_map<string,string> smap;
unordered_map<string,pair<double,double> > pmap;
unordered_map<string,bool> bmap;

The pmap is used for specifying a certain range for a cut while the dmap only gives a single value. The smap and bmap likewise give string and boolean information if needed for a cut. Since maps are used, all cuts are put into the PartStats object, even if they aren't used, making adding new cuts very flexible.

PType

enum class PType {
  Electron, 
  Muon, 
  Tau, 
  Jet, 
  None };

Constructors and Destructor

Particle();
Particle(TTree*, string, string);
virtual ~Particle();

Setters and Getters

double pt(uint index) const;
double eta(uint index) const;
double phi(uint index) const;
double energy(uint index) const;
TLorentzVector p4(uint index) const;
TLorentzVector& p4(uint index);

These are the basic getters for the values of the TLorentzVector at spot index


uint size() const;
vector<TLorentzVector>::iterator begin();
vector<TLorentzVector>::iterator end();
vector<TLorentzVector>::const_iterator begin() const;
vector<TLorentzVector>::const_iterator end() const;

These are all convenient functions that make the Particle object act like a vector. This means for loops can be cleared up to look like c++11 style loops, ie:

for(auto vector: *_Muon)


void addPtEtaPhiESyst(double, double, double, double, string);
void addP4Syst(TLorentzVector, string);

These are the basic functions to set the TLorentzVectors in the systVec so that the correct systematic vectors are in each systematic branch of the map.


  void setCurrentP(string);

Important function. This is what switches the cur_P to point to different sets of vectors in the systematics map, systVec. When accessing values using the TLorentzVector getter functions described above, it is getting the values from the vector described by cur_P and this function does the switching between the vectors.


string getName() {return GenName;};

This returns the GenName which is a shorthand variable that describes the general name used to label the particles' variables in the ntuples.


Public Functions

  void init();

Done at the start of every event. This clears out all of the vectors in the systVec to be ready for the new event.


virtual void findExtraCuts();

This function looks to see in the config files of each particle, if there are dependences on other particles. The Analyzer is designed to only run over the particles and cuts actually needed, so if a particle requires information about another particle, this function ensures that this information is included

An example of this is checking for overlap. If ones analysis doesn't require Muons, the Analyzer will skip over all Muon related cuts. But the user wants to remove jets that overlap with muons, this function finds that the overlap variable is turned on, and runs over the Muons so there are good muons to check against.


void unBranch();

The largest time spend in the Analyzer is setting up the data for each event. This is done by the TTree as it looks at its TBranches and sets the address of the data to the correct position for each vector or primitive value.

To speed up the code, if a certain particle is not needed, unBranch removes all TBranches relating to the particle so this setting process isn't done uselessly


void getPartStats(string filename);

At construction, the cut information needs to be read in and put into the PartStats object for easy access. This function reads in the file corresponding to filename and puts the data into the pstats for the Particle object.

Public Value

vector<CUTS> extraCuts;
PType type; 
TTree* BOOM;
string GenName;
vector<double>* mpt;
vector<double>* meta;
vector<double>* mphi;
vector<double>* menergy;
vector<double>* menergy;
unordered_map<string, PartStats> pstats;
vector<TLorentzVector> Reco;
vector<TLorentzVector>* cur_P;
 unordered_map<string, vector<TLorentzVector>* > systVec;
string activeSystematic;
  • extraCuts - This determines if a particle has dependences on other particles. This makes sure particles are run over in the Analyzer
  • type - type of particle corresponding to the enum value in PType; used in background
  • BOOM - This is the actual TTree where the particle information is retrieved
  • GenName - This value is name used in the TTree, not needed by the user
  • mpt, meta, mphi, menergy, charge - these are examples of basic variables stored in the particle group. These vectors have the values for each particle corresponding to the index
  • pstats - The map that holds all of the cut information. Since there are multiple definitions available for the same basic particle (eg BJet and CentralJet are both derived from the Jet object), to access the particle specific cuts, simply give the name of the particle to get the PartStats object.
  • Reco - The vector that holds the TLorentzVectors that are the basic reco vectors from the ntuple
  • cur_P - This value points to the vector that holds the active TLorentzVector for the particle. This is set with the setCurrentP function so all of the getter functions pull from this vector set.
  • systVec - This map holds the sets of vectors corresponding to each systematic. Systematics might change the overall vectors of an particle, so this map stores all the different iterations of it.
  • activeSystematic - as the name suggests, it is the systematic vector that cur_P is pointing at

Clone this wiki locally