Skip to content

Commit

Permalink
Merge pull request #179 from JeffersonLab/iss89
Browse files Browse the repository at this point in the history
Iss89:  Trident and WAB track rates/shapes and track efficiency
  • Loading branch information
mgignac authored Feb 1, 2025
2 parents d6e1332 + 4c7936b commit ea09ee4
Show file tree
Hide file tree
Showing 150 changed files with 21,774 additions and 14 deletions.
11 changes: 10 additions & 1 deletion analysis/include/AnaHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
// HPSTR
#include "Track.h"
#include "TrackerHit.h"
#include "RawSvtHit.h"
#include "Particle.h"
#include "Vertex.h"

#include "CalCluster.h"
#include "CalHit.h"
/**
* @brief brief description
* more details
Expand Down Expand Up @@ -97,7 +99,14 @@ class AnaHelpers {
*/
bool MatchToGBLTracks(int ele_id, int pos_id, Track* & ele_trk, Track* & pos_trk, std::vector<Track*>& trks);


bool GetParticlesFromVtxAndParticleList(std::vector<Particle*>& parts, Vertex* vtx, Particle*& ele, Particle*& pos);
bool IsECalFiducial(CalCluster* clu);
double GetClusterCoplanarity(CalCluster* cl1,CalCluster* cl2);
Particle* GetParticleFromCluster(std::vector<Particle*>& parts,CalCluster* cluster);
static std::string getFileName(std::string filePath, bool withExtension);
Track* GetTrackFromParticle(std::vector<Track*>& trks,Particle* part);


private:

Expand Down
4 changes: 3 additions & 1 deletion analysis/include/MCAnaHistos.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class MCAnaHistos : public HistoManager {
* @param weight
*/
void FillMCEcalHits(std::vector<MCEcalHit*> *mcEcalHits, float weight = 1.);

void FillAllFindableTracks(MCParticle* eleRad,MCParticle* eleRec, MCParticle* pos, double weight);
void FillMCParticleHistos(MCParticle* mcpart, std::string label, double weight);
void FillMCPairHistos(MCParticle* ele,MCParticle* pos,std::string label, double weight);
};

#endif //MCANAHISTOS_H
40 changes: 40 additions & 0 deletions analysis/include/ThreeProngHistos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef THREEPRONGHISTOS_H
#define THREEPRONGHISTOS_H

#include "HistoManager.h"
#include "Track.h"
#include "CalCluster.h"
#include "Vertex.h"
#include "Particle.h"
//#include "AnaHelpers.h"
#include <string>
#include <vector>

class ThreeProngHistos : public HistoManager {

public:

ThreeProngHistos(const std::string& inputName) :
HistoManager(inputName)
{
m_name = inputName;
// _ah = std::make_shared<AnaHelpers>();
// BuildAxes();
}

virtual void Define3DHistos(){};
virtual void Define2DHistos(){};


void BuildAxes(){};
void setBeamEnergy(double beamEnergy){eBeam=beamEnergy;};
void FillThreeProngPlots(Particle* ele, Particle* pos, Particle* rec,float weight=1.0);
private:
// Vertices
// std::vector<std::string> vPs{"vtx_chi2", "vtx_X", "vtx_Y", "vtx_Z", "vtx_sigma_X","vtx_sigma_Y","vtx_sigma_Z","vtx_InvM","vtx_InvMErr"};
double eBeam{3.74};
//bool doTrkCompPlots{false};

};

#endif //TRACKEFFIC_H
54 changes: 54 additions & 0 deletions analysis/include/TrackEfficHistos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#ifndef TRACKEFFICHISTOS_H
#define TRACKEFFICHISTOS_H

#include "HistoManager.h"
#include "Track.h"
#include "CalCluster.h"
#include "Vertex.h"
#include "Particle.h"
#include "AnaHelpers.h"
#include <string>
#include <vector>

class TrackEfficHistos : public HistoManager {

public:

TrackEfficHistos(const std::string& inputName, std::shared_ptr<AnaHelpers> ah) :
HistoManager(inputName)
{
m_name = inputName;
_ah=ah;
// _ah = std::make_shared<AnaHelpers>();
// BuildAxes();
}

virtual void Define3DHistos(){};
virtual void Define2DHistos(){};


void BuildAxes(){};

void FillEffPlots(std::pair<CalCluster*,Track*> ele, std::pair<CalCluster*,Track*> pos, float weight = 1.);
void FillPreSelectionPlots(CalCluster*, float weight=1.);
void FillPairSelectionPlots(CalCluster* eleClu, CalCluster* posClu,
float weight);
std::pair<CalCluster*, Track*> getClusterTrackPair(CalCluster* cluster,std::vector<Track*>& tracks, float weight=1.0);
void FillEffPlots(Particle* ele, Particle* pos, float weight=1.0);
void SetCalTimeOffset(double offset){
std::cout<<"setting TrackEfficHistos::timeOffset_ = "<<offset<<std::endl;
timeOffset_ = offset;
};


private:
std::shared_ptr<AnaHelpers> _ah ;
double timeOffset_{0.0};
// Vertices
// std::vector<std::string> vPs{"vtx_chi2", "vtx_X", "vtx_Y", "vtx_Z", "vtx_sigma_X","vtx_sigma_Y","vtx_sigma_Z","vtx_InvM","vtx_InvMErr"};

//bool doTrkCompPlots{false};

};

#endif //TRACKEFFIC_H
80 changes: 80 additions & 0 deletions analysis/include/TridentHistos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#ifndef TRIDENTHISTOS_H
#define TRIDENTHISTOS_H

#include "HistoManager.h"
#include "Track.h"
#include "TrackerHit.h"
#include "RawSvtHit.h"
#include "CalCluster.h"
#include "Vertex.h"
#include "Particle.h"
#include <string>
#include <vector>

class TridentHistos : public HistoManager {

public:

TridentHistos(const std::string& inputName) :
HistoManager(inputName)
{
m_name = inputName;
BuildAxes();
}

virtual void Define3DHistos(){};
virtual void Define2DHistos();
void DefineHistos();
void saveHistos(TFile* outF,std::string folder);
void AssignLayerCode(Track* ele_trk, Track* pos_trk);
std::string getLayerCodeFromHistoName(std::string name);
bool isLayerCode(std::string histoName, int nLayers, int ptr );
void setOutputDir(TFile* outF, std::string folder, std::string histoName);
std::string getLayerCodeFromTrack(Track* trk);
std::string splitByElePosLayerCombos(std::string histoName);
void BuildAxes();

void Fill1DTrack(Track* track, double trkTimeOffset,float weight = 1., const std::string& trkname = "");
void Fill2DTrack(Track* track,float weight = 1., const std::string& trkname = "");

//This should probably go somewhere else
void FillResidualHistograms(Track* track, int ly, double res, double sigma);

void Fill1DVertex(Vertex* vtx, float weight = 1.);

//TODO Change this
void Fill1DVertex(Vertex* vtx, Particle* ele, Particle* pos, Track* ele_trk, Track* pos_trk, double trkTimeOffset,float weight = 1.);

void Fill1DHistograms(Track* track = nullptr, Vertex* vtx = nullptr, float weight = 1.);
void Fill2DHistograms(Vertex* vtx = nullptr, float weight = 1.);

//Truth comparison
void Fill1DTrackTruth(Track* track, Track* truth_track, float weight=1.,const std::string& ="");
std::pair<CalCluster*, Track*> getTrackClusterPair(Track* trk,std::vector<CalCluster*>& clusters, float weight);
//track_x goes for x axis, and y for y axis
void FillTrackComparisonHistograms(Track* track_x, Track* track_y, float weight = 1.);
void doTrackComparisonPlots(bool doplots) {doTrkCompPlots = doplots;};
// void FillTrackClusterHistos(std::pair<CalCluster, Track*> ele, std::pair<CalCluster, Track*> posOrGamma, double calTimeOffset, double trkTimeOffset,std::vector<CalCluster*> * clusterList, double weight);
void FillTrackClusterHistos(std::pair<CalCluster, Track*> ele,
std::pair<CalCluster, Track*> posOrGamma, double calTimeOffset,
double trkTimeOffset,double weight);
void FillWABHistos(std::pair<CalCluster*, Track*> ele, CalCluster* gamma, double weight);
void setBeamEnergy(double ebeam){eBeam_=ebeam;};
private:

// Vertices
std::vector<std::string> vPs{"vtx_chi2", "vtx_X", "vtx_Y", "vtx_Z", "vtx_sigma_X","vtx_sigma_Y","vtx_sigma_Z","vtx_InvM","vtx_InvMErr"};
std::string layerCode;

bool doTrkCompPlots{false};

//histogram template splitting
virtual void DefineHistosFromTemplateOnly(std::vector<std::string> histoCopyNames,
std::string makeCopyJsonTag = "default=single_copy");
virtual void DefineOneTimeHistos();
double eBeam_;
double stdBeamEnergy_=4.5; // GeV...use this to shift PSums from different beam energies in order to compare...

};

#endif //TRACKHISTOS_H
Loading

0 comments on commit ea09ee4

Please sign in to comment.