Skip to content

Commit

Permalink
First steps to build a visibles veto processor
Browse files Browse the repository at this point in the history
  • Loading branch information
horohoo committed Oct 25, 2024
1 parent 8efa112 commit 5c71589
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Hcal/include/Hcal/Event/VisiblesVetoResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef EVENT_VISIBLESVETORESULT_H_
#define EVENT_VISIBLESVETORESULT_H_

#include <iostream>

// ROOT //
#include <TObject.h>

namespace ldmx {

class VisiblesVetoResult {
public:
/** Constructor */
VisiblesVetoResult();

/** Destructor */
virtual ~VisiblesVetoResult();

void setVariables(int nLayersHit,
double xStd, double yStd, double zStd,
double xMean, double yMean, double rMean,
int isoHits, double isoEnergy,
int nReadoutHits, double summedDet,
double rMeanFromPhotonProj);

void Clear();

void Print() const;

bool passesVeto() const { return passesVeto_; }

double getDisc() const { return discValue_; }

int getNLayersHit() const { return nLayersHit_; }

double getXStd() const { return xStd_; }

double getYStd() const { return yStd_; }

double getZStd() const { return zStd_; }

double getXMean() const { return xMean_; }

double getYMean() const { return yMean_; }

double getRMean() const { return rMean_; }

int getIsoHits() const { return isoHits_; }

double getIsoEnergy() const { return isoEnergy_; }

int getNHits() const { return nReadoutHits_; }

double getSummedDet() const { return summedDet_; }

double getDistFromPhotonProj() const { return rMeanFromPhotonProj_; }

private:
bool passesVeto_{false};

int nLayersHit_{0};
double xStd_{0};
double yStd_{0};
double zStd_{0};
double xMean_{0};
double yMean_{0};
double rMean_{0};
int isoHits_{0};
double isoEnergy_{0};
int nReadoutHits_{0};
double summedDet_{0};
double rMeanFromPhotonProj_{0};

double discValue_{0};

};
} // namespace ldmx

#endif
64 changes: 64 additions & 0 deletions Hcal/include/Hcal/VisiblesVetoProcessor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#ifndef EVENTPROC_VISIBLESVETOPROCESSOR_H_
#define EVENTPROC_VISIBLESVETOPROCESSOR_H_

// LDMX
#include "Hcal/Event/HcalHit.h"
#include "Hcal/Event/VisiblesVetoResult.h"
#include "Framework/Configure/Parameters.h"
#include "Framework/EventProcessor.h"
#include "Tools/ONNXRuntime.h"

namespace hcal {

class VisiblesVetoProcessor : public framework::Producer {
public:
EcalVetoProcessor(const std::string& name, framework::Process& process)
: Producer(name, process) {}

virtual ~VisiblesVetoProcessor() {}

void configure(framework::config::Parameters& parameters) override;

void produce(framework::Event& event) override;

private:
void clearProcessor();

void buildBDTFeatureVector(const ldmx::VisiblesVetoResult& result);

int nLayersHit_{0};
double xStd_{0};
double yStd_{0};
double zStd_{0};
double xMean_{0};
double yMean_{0};
double rMean_{0};
int isoHits_{0};
double isoEnergy_{0};
int nReadoutHits_{0};
double summedDet_{0};
double rMeanFromPhotonProj_{0};

double bdtCutVal_{0};

double beamEnergyMeV_{0};

bool verbose_{false};

std::string bdtFileName_;
std::string rocFileName_;
std::vector<float> bdtFeatures_;
std::string featureListName_;

std::string rec_pass_name_;
std::string rec_coll_name_;

std::string collectionName_{"VisiblesVeto"};

std::unique_ptr<ldmx::Ort::ONNXRuntime> rt_;

};

} // namespace hcal

#endif
55 changes: 55 additions & 0 deletions Hcal/src/Hcal/Event/VisiblesVetoResult.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "Hcal/Event/VisiblesVetoResult.h"

ClassImp(ldmx::VisiblesVetoResult);

namespace ldmx {
VisiblesVetoResult::VisiblesVetoResult() {}

VisiblesVetoResult::~VisiblesVetoResult() { Clear(); }

void VisiblesVetoResult::Clear() {
passesVeto_ = false;

nLayersHit_ = 0;
xStd_ = 0.;
yStd_ = 0.;
zStd_ = 0.;
xMean_ = 0.;
yMean_ = 0.;
rMean_ = 0.;
isoHits_ = 0;
isoEnergy_ = 0.;
nReadoutHits_ = 0;
summedDet_ = 0.;
rMeanFromPhotonProj_ = 0.;

discValue_ = 0.;
}

void VisiblesVetoResult::setVariables(
int nLayersHit,
double xStd, double yStd, double zStd,
double xMean, double yMean, double rMean,
int isoHits, double isoEnergy,
int nReadoutHits, double summedDet,
double rMeanFromPhotonProj) {
nLayersHit_ = nLayersHit;
xStd_ = xStd;
yStd_ = yStd;
zStd_ = zStd;
xMean_ = xMean;
yMean_ = yMean;
rMean_ = rMean;
isoHits_ = isoHits;
isoEnergy_ = isoEnergy;
nReadoutHits_ = nReadoutHits;
summedDet_ = summedDet;
rMeanFromPhotonProj_ = rMeanFromPhotonProj;
}

void VisiblesVetoResult::Print() const {
std::cout << "[ VisiblesVetoResult ]:\n"
<< "\t Passes veto : " << passesVeto_ << "\n"
<< std::endl;
}
} // namespace ldmx
Loading

0 comments on commit 5c71589

Please sign in to comment.