Skip to content

Commit

Permalink
add SoftDrop
Browse files Browse the repository at this point in the history
  • Loading branch information
jackaraz committed Mar 21, 2022
1 parent 0ab2939 commit 873af20
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
4 changes: 3 additions & 1 deletion madanalysis/build/makefile_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ def Makefile(
libs.extend(['-lfastjet_for_ma5'])
if options.has_fastjet_lib:
# libs.extend(['$(shell fastjet-config --libs --plugins)']) # --rpath=no)'])
libs.extend(['$(shell $(MA5_BASE)/tools/SampleAnalyzer/ExternalSymLink/Bin/fastjet-config --libs --plugins)']) # --rpath=no)'])
libs.extend(['$(shell $(MA5_BASE)/tools/SampleAnalyzer/ExternalSymLink/Bin/fastjet-config --libs --plugins)'])
# Add fjcontrib libraries
libs.extend(["-lRecursiveTools"]) # SoftDrop
file.write('LIBFLAGS += '+' '.join(libs)+'\n')

# - delphes
Expand Down
100 changes: 100 additions & 0 deletions tools/SampleAnalyzer/Interfaces/fastjet/SoftDrop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2012-2022 Jack Araz, Eric Conte & Benjamin Fuks
// The MadAnalysis development team, email: <[email protected]>
//
// This file is part of MadAnalysis 5.
// Official website: <https://launchpad.net/madanalysis5>
//
// MadAnalysis 5 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MadAnalysis 5 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
//
////////////////////////////////////////////////////////////////////////////////

#ifndef MADANALYSIS5_SOFTDROP_H
#define MADANALYSIS5_SOFTDROP_H

// STL headers
#include <vector>
#include <algorithm>

// FastJet headers
#include "fastjet/contrib/SoftDrop.hh"
#include "fastjet/PseudoJet.hh"

// SampleAnalyser headers
#include "SampleAnalyzer/Commons/Base/PortableDatatypes.h"
#include "SampleAnalyzer/Commons/DataFormat/RecJetFormat.h"

using namespace std;

namespace MA5 {
namespace Substructure {
class SoftDrop {

//---------------------------------------------------------------------------------
// data members
//---------------------------------------------------------------------------------
protected :

// SoftDrop input variables
MAfloat32 beta_;
MAfloat32 symmetry_cut_;

// -------------------------------------------------------------
// method members
// -------------------------------------------------------------
public:

/// Constructor without argument
SoftDrop() {}

/// Destructor
virtual ~SoftDrop() {}

// Constructor with arguments
SoftDrop(MAfloat32 beta, MAfloat32 symmetry_cut) { Initialize(beta, symmetry_cut); }

void Initialize(MAfloat32 beta, MAfloat32 symmetry_cut)
{
beta_ = beta;
symmetry_cut_ = symmetry_cut;
}

// Execute with a single jet
const RecJetFormat *Execute(const RecJetFormat *jet)
{
RecJetFormat *NewJet = new RecJetFormat();
NewJet->Reset();
fastjet::contrib::SoftDrop sd(beta_, symmetry_cut_);
fastjet::PseudoJet sd_jet = sd(jet->pseudojet());
MALorentzVector q(sd_jet.px(), sd_jet.py(), sd_jet.pz(), sd_jet.e());
NewJet->setMomentum(q);
NewJet->setPseudoJet(sd_jet);
return NewJet;
}

// Execute with a list of jets
std::vector<const RecJetFormat *> Execute(std::vector<const RecJetFormat *> &jets)
{
std::vector<const RecJetFormat *> output_jets;
for (auto &jet: jets)
output_jets.push_back(Execute(jet));

return output_jets;
}

};
}
}
#endif //MADANALYSIS5_SOFTDROP_H
5 changes: 5 additions & 0 deletions tools/SampleAnalyzer/Process/Analyzer/AnalyzerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
#include "SampleAnalyzer/Process/RegionSelection/RegionSelectionManager.h"
#include "SampleAnalyzer/Commons/Base/PortableDatatypes.h"

// FJcontrib tools
#ifdef MA5_FASTJET_MODE
#include "SampleAnalyzer/Interfaces/fastjet/SoftDrop.h"
#endif

// STL headers
#include <set>
#include <string>
Expand Down

0 comments on commit 873af20

Please sign in to comment.