Skip to content

Commit

Permalink
Merge pull request #396 from JeffersonLab/unusedshower_quality
Browse files Browse the repository at this point in the history
Add unused shower variable summed over only showers which pass quality cut
  • Loading branch information
aaust committed Jun 5, 2020
2 parents 23e7c2d + 7b12ded commit dda7cbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/libraries/ANALYSIS/DAnalysisUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ DLorentzVector DAnalysisUtilities::Calc_FinalStateP4(const DReaction* locReactio
return locFinalStateP4;
}

int DAnalysisUtilities::Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, double &locEnergy_UnusedShowers) const
int DAnalysisUtilities::Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, double &locEnergy_UnusedShowers, int &locNumber_UnusedShowers_Quality, double &locEnergy_UnusedShowers_Quality) const
{
DVector3 locVertex(0.0, 0.0, dTargetZCenter);
const DEventRFBunch* locEventRFBunch = locParticleCombo->Get_EventRFBunch();
Expand All @@ -964,8 +964,10 @@ int DAnalysisUtilities::Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, cons
vector<const DNeutralShower*> locUnusedNeutralShowers;
Get_UnusedNeutralShowers(locEventLoop, locParticleCombo, locUnusedNeutralShowers);

locEnergy_UnusedShowers = 0.;
int locNumber_UnusedShowers = 0;
locEnergy_UnusedShowers = 0.;
locEnergy_UnusedShowers_Quality = 0.;
locNumber_UnusedShowers_Quality = 0;
for(size_t loc_i = 0; loc_i < locUnusedNeutralShowers.size(); ++loc_i) {
const DNeutralShower* locUnusedNeutralShower = locUnusedNeutralShowers[loc_i];

Expand All @@ -979,6 +981,11 @@ int DAnalysisUtilities::Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, cons

locEnergy_UnusedShowers += locUnusedNeutralShower->dEnergy;
locNumber_UnusedShowers++;

if(locUnusedNeutralShower->dQuality > 0.5) {
locEnergy_UnusedShowers_Quality += locUnusedNeutralShower->dEnergy;
locNumber_UnusedShowers_Quality++;
}
}

return locNumber_UnusedShowers;
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/ANALYSIS/DAnalysisUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class DAnalysisUtilities : public JObject
DLorentzVector Calc_FinalStateP4(const DReaction* locReaction, const DParticleCombo* locParticleCombo, size_t locStepIndex, set<size_t> locToIncludeIndices, bool locUseKinFitDataFlag) const;
DLorentzVector Calc_FinalStateP4(const DReaction* locReaction, const DParticleCombo* locParticleCombo, size_t locStepIndex, set<size_t> locToIncludeIndices, set<pair<const JObject*, unsigned int> >& locSourceObjects, bool locUseKinFitDataFlag) const;

int Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, double &locEnergy_UnusedShowers) const;
int Calc_Energy_UnusedShowers(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, double &locEnergy_UnusedShowers, int &locNumber_UnusedShowers_Quality, double &locEnergy_UnusedShowers_Quality) const;
int Calc_Momentum_UnusedTracks(JEventLoop* locEventLoop, const DParticleCombo* locParticleCombo, double &locSumPMag_UnusedTracks, TVector3 &locSumP3_UnusedTracks) const;

// These routines use the MEAURED particle data. For the kinfit-data result, just use the error matrix from the missing particle
Expand Down
8 changes: 7 additions & 1 deletion src/libraries/ANALYSIS/DEventWriterROOT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,8 @@ void DEventWriterROOT::Create_Branches_Combo(DTreeBranchRegister& locBranchRegis
}
locBranchRegister.Register_FundamentalArray<UChar_t>("NumUnusedShowers", locNumComboString, dInitNumComboArraySize);
locBranchRegister.Register_FundamentalArray<Float_t>("Energy_UnusedShowers", locNumComboString, dInitNumComboArraySize);
locBranchRegister.Register_FundamentalArray<UChar_t>("NumUnusedShowers_Quality", locNumComboString, dInitNumComboArraySize);
locBranchRegister.Register_FundamentalArray<Float_t>("Energy_UnusedShowers_Quality", locNumComboString, dInitNumComboArraySize);
locBranchRegister.Register_FundamentalArray<Float_t>("SumPMag_UnusedTracks", locNumComboString, dInitNumComboArraySize);
locBranchRegister.Register_ClonesArray<TVector3>("SumP3_UnusedTracks", dInitNumComboArraySize);

Expand Down Expand Up @@ -1220,9 +1222,13 @@ void DEventWriterROOT::Fill_DataTree(JEventLoop* locEventLoop, const DReaction*

//ENERGY OF UNUSED SHOWERS (access to event loop required)
double locEnergy_UnusedShowers = 0.;
int locNumber_UnusedShowers = dAnalysisUtilities->Calc_Energy_UnusedShowers(locEventLoop, locParticleCombos[loc_i], locEnergy_UnusedShowers);
double locEnergy_UnusedShowers_Quality = 0.;
int locNumber_UnusedShowers_Quality = 0;
int locNumber_UnusedShowers = dAnalysisUtilities->Calc_Energy_UnusedShowers(locEventLoop, locParticleCombos[loc_i], locEnergy_UnusedShowers, locNumber_UnusedShowers_Quality, locEnergy_UnusedShowers_Quality);
locTreeFillData->Fill_Array<UChar_t>("NumUnusedShowers", locNumber_UnusedShowers, loc_i);
locTreeFillData->Fill_Array<Float_t>("Energy_UnusedShowers", locEnergy_UnusedShowers, loc_i);
locTreeFillData->Fill_Array<UChar_t>("NumUnusedShowers_Quality", locNumber_UnusedShowers_Quality, loc_i);
locTreeFillData->Fill_Array<Float_t>("Energy_UnusedShowers_Quality", locEnergy_UnusedShowers_Quality, loc_i);

//MOMENTUM OF UNUSED TRACKS (access to event loop required)
double locSumPMag_UnusedTracks = 0;
Expand Down

0 comments on commit dda7cbd

Please sign in to comment.