Skip to content

Commit

Permalink
update groomer and counter
Browse files Browse the repository at this point in the history
  • Loading branch information
mverwe committed Sep 25, 2020
1 parent 45a7c2d commit e907ce8
Show file tree
Hide file tree
Showing 9 changed files with 849 additions and 828 deletions.
43 changes: 17 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ COMMONSRC =
F77SRC =
COMMONOBJ =

PROGSRC = runConstituentSubtraction.cc runConversionQPYTHIA.cc runCreatePythiaEvents.cc runCreatePythiaEvents10000E-W-320.cc runCreatePythiaEventsPartonLevel.cc runCreatePythiaEventsWJet.cc runCreateThermalEvents.cc runCSVariations.cc runFromFile.cc runHybridJetAnalysis.cc runJetPerformance.cc runJetProfile.cc runJetProfileJewelSub.cc runJewelSub.cc runSDGenVarious.cc runSDGenVariousJewelSub.cc runSharedLayerSubtraction.cc runSimpleJetAnalysis.cc runtest.cc
PROGOBJ = runConstituentSubtraction.o runConversionQPYTHIA.o runCreatePythiaEvents.o runCreatePythiaEvents10000E-W-320.o runCreatePythiaEventsPartonLevel.o runCreatePythiaEventsWJet.o runCreateThermalEvents.o runCSVariations.o runFromFile.o runHybridJetAnalysis.o runJetPerformance.o runJetProfile.o runJetProfileJewelSub.o runJewelSub.o runSDGenVarious.o runSDGenVariousJewelSub.o runSharedLayerSubtraction.o runSimpleJetAnalysis.o runtest.o
PROGSRC = runConstituentSubtraction.cc runConversionQPYTHIA.cc runCreatePythiaEvents.cc runCreatePythiaEventsPartonLevel.cc runCreatePythiaEventsWJet.cc runCreateThermalEvents.cc runCSVariations.cc runFromFile.cc runHybridJetAnalysis.cc runJetPerformance.cc runJetProfile.cc runJewelSub.cc runSDGenVarious.cc runSDGenVariousJewelSub.cc runSharedLayerSubtraction.cc runSimpleJetAnalysis.cc runSoftDrop.cc runtest.cc
PROGOBJ = runConstituentSubtraction.o runConversionQPYTHIA.o runCreatePythiaEvents.o runCreatePythiaEventsPartonLevel.o runCreatePythiaEventsWJet.o runCreateThermalEvents.o runCSVariations.o runFromFile.o runHybridJetAnalysis.o runJetPerformance.o runJetProfile.o runJewelSub.o runSDGenVarious.o runSDGenVariousJewelSub.o runSharedLayerSubtraction.o runSimpleJetAnalysis.o runSoftDrop.o runtest.o

INCLUDE +=
LIBRARIES += -LPU14 -lPU14 -lz


all: runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEvents10000E-W-320 runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest
all: runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runSoftDrop runtest


runConstituentSubtraction: runConstituentSubtraction.o $(COMMONOBJ)
Expand All @@ -52,9 +52,6 @@ runConversionQPYTHIA: runConversionQPYTHIA.o $(COMMONOBJ)
runCreatePythiaEvents: runCreatePythiaEvents.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreatePythiaEvents10000E-W-320: runCreatePythiaEvents10000E-W-320.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runCreatePythiaEventsPartonLevel: runCreatePythiaEventsPartonLevel.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

Expand All @@ -79,9 +76,6 @@ runJetPerformance: runJetPerformance.o $(COMMONOBJ)
runJetProfile: runJetProfile.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runJetProfileJewelSub: runJetProfileJewelSub.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runJewelSub: runJewelSub.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

Expand All @@ -97,6 +91,9 @@ runSharedLayerSubtraction: runSharedLayerSubtraction.o $(COMMONOBJ)
runSimpleJetAnalysis: runSimpleJetAnalysis.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runSoftDrop: runSoftDrop.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

runtest: runtest.o $(COMMONOBJ)
$(CXX) $(LDFLAGS) -o $@ $@.o $(COMMONOBJ) $(LIBRARIES)

Expand All @@ -108,7 +105,7 @@ clean:
rm -vf $(COMMONOBJ) $(PROGOBJ)

realclean: clean
rm -vf runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEvents10000E-W-320 runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJetProfileJewelSub runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runtest
rm -vf runConstituentSubtraction runConversionQPYTHIA runCreatePythiaEvents runCreatePythiaEventsPartonLevel runCreatePythiaEventsWJet runCreateThermalEvents runCSVariations runFromFile runHybridJetAnalysis runJetPerformance runJetProfile runJewelSub runSDGenVarious runSDGenVariousJewelSub runSharedLayerSubtraction runSimpleJetAnalysis runSoftDrop runtest

.cc.o: $<
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
Expand Down Expand Up @@ -141,10 +138,6 @@ runConversionQPYTHIA.o: PU14/CmdLine.hh
runCreatePythiaEvents.o: include/ProgressBar.h include/pythiaEvent.hh
runCreatePythiaEvents.o: include/extraInfo.hh include/extraInfo.hh
runCreatePythiaEvents.o: PU14/CmdLine.hh
runCreatePythiaEvents10000E-W-320.o: include/ProgressBar.h
runCreatePythiaEvents10000E-W-320.o: include/pythiaEventW.hh
runCreatePythiaEvents10000E-W-320.o: include/extraInfo.hh
runCreatePythiaEvents10000E-W-320.o: include/extraInfo.hh PU14/CmdLine.hh
runCreatePythiaEventsPartonLevel.o: include/ProgressBar.h
runCreatePythiaEventsPartonLevel.o: include/pythiaEvent.hh
runCreatePythiaEventsPartonLevel.o: include/extraInfo.hh include/extraInfo.hh
Expand Down Expand Up @@ -195,18 +188,10 @@ runJetProfile.o: PU14/HepPID/ParticleIDMethods.hh include/jetCollection.hh
runJetProfile.o: include/csSubtractor.hh PU14/PU14.hh
runJetProfile.o: include/csSubtractorFullEvent.hh include/skSubtractor.hh
runJetProfile.o: include/softDropGroomer.hh include/jetCollection.hh
runJetProfile.o: include/jewelMatcher.hh include/treeWriter.hh
runJetProfile.o: include/jetMatcher.hh include/randomCones.hh
runJetProfile.o: include/Angularity.hh
runJetProfileJewelSub.o: include/ProgressBar.h PU14/EventMixer.hh
runJetProfileJewelSub.o: PU14/CmdLine.hh PU14/EventSource.hh PU14/CmdLine.hh
runJetProfileJewelSub.o: PU14/PU14.hh PU14/HepPID/ParticleIDMethods.hh
runJetProfileJewelSub.o: include/jetCollection.hh include/csSubtractor.hh
runJetProfileJewelSub.o: PU14/PU14.hh include/csSubtractorFullEvent.hh
runJetProfileJewelSub.o: include/skSubtractor.hh include/softDropGroomer.hh
runJetProfileJewelSub.o: include/jetCollection.hh include/jewelMatcher.hh
runJetProfileJewelSub.o: include/treeWriter.hh include/jetMatcher.hh
runJetProfileJewelSub.o: include/randomCones.hh include/Angularity.hh
runJetProfile.o: include/jewelMatcher.hh include/softDropCounter.hh
runJetProfile.o: include/treeWriter.hh include/jetMatcher.hh
runJetProfile.o: include/randomCones.hh include/Angularity.hh
runJetProfile.o: include/jetProfile.hh
runJewelSub.o: include/ProgressBar.h PU14/EventMixer.hh PU14/CmdLine.hh
runJewelSub.o: PU14/EventSource.hh PU14/CmdLine.hh PU14/PU14.hh
runJewelSub.o: PU14/HepPID/ParticleIDMethods.hh include/jetCollection.hh
Expand Down Expand Up @@ -252,6 +237,12 @@ runSimpleJetAnalysis.o: include/softDropGroomer.hh PU14/PU14.hh
runSimpleJetAnalysis.o: include/jetCollection.hh include/jewelMatcher.hh
runSimpleJetAnalysis.o: include/treeWriter.hh include/jetMatcher.hh
runSimpleJetAnalysis.o: include/Angularity.hh
runSoftDrop.o: include/ProgressBar.h PU14/EventMixer.hh PU14/CmdLine.hh
runSoftDrop.o: PU14/EventSource.hh PU14/CmdLine.hh PU14/PU14.hh
runSoftDrop.o: PU14/HepPID/ParticleIDMethods.hh include/jetCollection.hh
runSoftDrop.o: include/softDropGroomer.hh PU14/PU14.hh
runSoftDrop.o: include/jetCollection.hh include/jewelMatcher.hh
runSoftDrop.o: include/softDropCounter.hh include/treeWriter.hh
runtest.o: PU14/CmdLine.hh include/ProgressBar.h include/jetCollection.hh
runtest.o: include/thermalEvent.hh include/extraInfo.hh
runtest.o: include/pythiaEvent.hh include/csSubtractor.hh PU14/PU14.hh
Expand Down
93 changes: 87 additions & 6 deletions include/jetCollection.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,31 @@ class jetCollection
{
private:
std::vector<fastjet::PseudoJet> p_;
std::map<std::string, std::vector<fastjet::PseudoJet>> jetmap_;
std::map<std::string, std::vector<double>> doublemap_;
std::map<std::string, std::vector<int>> intmap_;
std::map<std::string, std::vector<std::vector<double>>> doubledoublemap_;
std::map<std::string, std::vector<std::vector<int>>> intintmap_;
public:
jetCollection(const std::vector<fastjet::PseudoJet> &p);
~jetCollection();
void setJet(const std::vector<fastjet::PseudoJet> &v);
std::vector<fastjet::PseudoJet> getJet() const;
std::vector<fastjet::PseudoJet> getVectorJet(string tag) const;
std::vector<double> getVectorDouble(string tag) const;
std::vector<std::vector<double>> getVectorDoubleDouble(string tag) const;
std::vector<int> getVectorInt(string tag) const;
std::vector<std::vector<int>> getVectorIntInt(string tag) const;
void addVector(string tag, std::vector<fastjet::PseudoJet> v);
void addVector(string tag, std::vector<double> v);
void addVector(string tag, std::vector<std::vector<double>> v);
void addVector(string tag, std::vector<int> v);
void addVector(string tag, std::vector<std::vector<int>> v);
std::vector<std::string> getListOfKeysJet() const;
std::vector<std::string> getListOfKeysDouble() const;
std::vector<std::string> getListOfKeysDoubleDouble() const;
std::vector<std::string> getListOfKeysInt() const;
std::vector<std::string> getListOfKeysIntInt() const;
};

jetCollection::jetCollection(const std::vector<fastjet::PseudoJet> &p)
Expand All @@ -52,48 +64,117 @@ std::vector<fastjet::PseudoJet> jetCollection::getJet() const
return p_;
}

std::vector<fastjet::PseudoJet> jetCollection::getVectorJet(string tag) const
{
if(jetmap_.find(tag) == jetmap_.end())
return std::vector<fastjet::PseudoJet>();
return jetmap_.at(tag);
}

std::vector<double> jetCollection::getVectorDouble(string tag) const
{
if(doublemap_.find(tag) == doublemap_.end())
return std::vector<double>();
return doublemap_.at(tag);
}

std::vector<std::vector<double>> jetCollection::getVectorDoubleDouble(string tag) const
{
if(doubledoublemap_.find(tag) == doubledoublemap_.end())
return std::vector<std::vector<double>>();
return doubledoublemap_.at(tag);
}

std::vector<int> jetCollection::getVectorInt(string tag) const
{
if(intmap_.find(tag) == intmap_.end())
return std::vector<int>();
return intmap_.at(tag);
}

void jetCollection::addVector(string tag, std::vector<double> v)
std::vector<std::vector<int>> jetCollection::getVectorIntInt(string tag) const
{
if(intintmap_.find(tag) == intintmap_.end())
return std::vector<std::vector<int>>();
return intintmap_.at(tag);
}


void jetCollection::addVector(string tag, std::vector<fastjet::PseudoJet> v)
{
if(jetmap_.find(tag) != jetmap_.end())
jetmap_.erase(tag);
jetmap_[tag] = v;
}

void jetCollection::addVector(string tag, std::vector<int> v)
{
if(intmap_.find(tag) != intmap_.end())
intmap_.erase(tag);
doublemap_[tag] = v;
intmap_[tag] = v;
}

void jetCollection::addVector(string tag, std::vector<int> v)
void jetCollection::addVector(string tag, std::vector<double> v)
{
if(doublemap_.find(tag) != doublemap_.end())
doublemap_.erase(tag);
intmap_[tag] = v;
doublemap_[tag] = v;
}

void jetCollection::addVector(string tag, std::vector<std::vector<double>> v)
{
if(doubledoublemap_.find(tag) != doubledoublemap_.end())
doubledoublemap_.erase(tag);
doubledoublemap_[tag] = v;
}

void jetCollection::addVector(string tag, std::vector<std::vector<int>> v)
{
if(intintmap_.find(tag) != intintmap_.end())
intintmap_.erase(tag);
intintmap_[tag] = v;
}


std::vector<std::string> jetCollection::getListOfKeysJet() const
{
std::vector<std::string> Result;
for(auto iter = jetmap_.begin(); iter != jetmap_.end(); iter++)
Result.push_back(iter->first);
return Result;
}

std::vector<std::string> jetCollection::getListOfKeysDouble() const
{
std::vector<std::string> Result;
for(std::map<std::string, std::vector<double>>::const_iterator iter = doublemap_.begin(); iter != doublemap_.end(); iter++)
for(auto iter = doublemap_.begin(); iter != doublemap_.end(); iter++)
Result.push_back(iter->first);
return Result;
}

std::vector<std::string> jetCollection::getListOfKeysDoubleDouble() const
{
std::vector<std::string> Result;
for(auto iter = doubledoublemap_.begin(); iter != doubledoublemap_.end(); iter++)
Result.push_back(iter->first);
return Result;
}

std::vector<std::string> jetCollection::getListOfKeysInt() const
{
std::vector<std::string> Result;
for(std::map<std::string, std::vector<int>>::const_iterator iter = intmap_.begin(); iter != intmap_.end(); iter++)
for(auto iter = intmap_.begin(); iter != intmap_.end(); iter++)
Result.push_back(iter->first);
return Result;
}

std::vector<std::string> jetCollection::getListOfKeysIntInt() const
{
std::vector<std::string> Result;
for(auto iter = intintmap_.begin(); iter != intintmap_.end(); iter++)
Result.push_back(iter->first);
return Result;
}


#endif
121 changes: 121 additions & 0 deletions include/jetProfile.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#ifndef __jetProfile_HH__
#define __jetProfile_HH__

//------------------------------------------------------------------------
// Description
// This class calculate jet profiles for jets in a jet collection
// Author: L. Cunquiero, K. Garner, M. Verweij
//------------------------------------------------------------------------

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <fstream>
#include "TF1.h"
#include "TMath.h"
#include "TH2.h"

#include "fastjet/PseudoJet.hh"
#include "jetCollection.hh"

class jetProfile {
private:

std::vector<fastjet::PseudoJet> jets_;

double eventWeight_;

std::vector<double> min_delR_;
std::vector<double> max_delR_;

std::vector<std::vector<double>> jetProfiles_;

public:
jetProfile(jetCollection &c, double eventWeight = 1.);
jetProfile(std::vector<fastjet::PseudoJet> v, double eventWeight = 1.);

TH2F* calculateProfileHisto();
void calculateProfile();

void setBoundariesMin(std::vector<double> v) { min_delR_ = v; }
void setBoundariesMax(std::vector<double> v) { max_delR_ = v; }

std::vector<double> getJetProfile(int ijet) const {return jetProfiles_[ijet]; }
std::vector<std::vector<double>> getJetProfiles() const {return jetProfiles_; }

};


jetProfile::jetProfile(jetCollection &c, double eventWeight) :
jets_(c.getJet()),
eventWeight_(eventWeight)
{
}

jetProfile::jetProfile(std::vector<fastjet::PseudoJet> v, double eventWeight) :
jets_(v),
eventWeight_(eventWeight)
{
}

TH2F* jetProfile::calculateProfileHisto()
{
TH2F *h2PtJetRho = new TH2F("h2PtJetRhotemp","",150,0,150,20,0,0.5);
double min_pPt = 1;
double max_delR = 0.5;

for(fastjet::PseudoJet& jet : jets_) {

std::vector<fastjet::PseudoJet> const_all = jet.constituents();
std::vector<fastjet::PseudoJet> const_charged, const_neutral;
SelectorIsCharged().sift(const_all, const_charged, const_neutral);

for(fastjet::PseudoJet& p : const_charged) {
double pPt = p.perp();
double delR = p.delta_R(jet);
if(pPt > min_pPt && delR < max_delR) {
h2PtJetRho->Fill(jet.perp(),delR,eventWeight_*(pPt/jet.perp()));
}
}
}
return h2PtJetRho;
}

void jetProfile::calculateProfile()
{
const int np = min_delR_.size();

jetProfiles_.clear();
jetProfiles_.reserve(jets_.size());

for(fastjet::PseudoJet& jet : jets_) {

std::vector<double> jetProfile(np);
std::fill(jetProfile.begin(),jetProfile.end(),0.);

std::vector<fastjet::PseudoJet> const_all = jet.constituents();
for(fastjet::PseudoJet& p : const_all) {

double prof = 0.;
if(jet.perp()>0.) prof = p.perp()/jet.perp();

double delR = p.delta_R(jet);
for(int i = 0; i<np; ++i) {
if(delR>=min_delR_[i] && delR<max_delR_[i]) {
jetProfile[i] += prof;
}
}
}

for(int i = 0; i<np; ++i) {
double dr = max_delR_[i]-min_delR_[i];
double prof = jetProfile[i];
if(dr>0.) jetProfile[i] = prof/dr;
else jetProfile[i] = 0.;
}
jetProfiles_.push_back(jetProfile);
}//jet loop
}

#endif
Loading

0 comments on commit e907ce8

Please sign in to comment.