Skip to content

Commit

Permalink
Changing reference time for MC Hit to the event time
Browse files Browse the repository at this point in the history
  • Loading branch information
kdulski committed Apr 13, 2023
1 parent 522a7ef commit 024ca5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/GeantParser/JPetGeantParser/JPetGeantParserTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
class JPetGeantParserTools
{
public:
static JPetMCHit createJPetMCHit(JPetGeantScinHits* geantHit, const JPetParamBank& paramBank);
static JPetMCHit createJPetMCHit(JPetGeantScinHits* geantHit, const JPetParamBank& paramBank, const float timeShift);

static JPetHit reconstructHit(JPetMCHit& hit, const JPetParamBank& paramBank, const float timeShift, JPetHitExperimentalParametrizer& parametrizer);
static JPetHit reconstructHit(JPetMCHit& hit, const JPetParamBank& paramBank, JPetHitExperimentalParametrizer& parametrizer);

static bool isHitReconstructed(JPetHit& hit, const float th);

Expand Down
4 changes: 2 additions & 2 deletions src/GeantParser/JPetGeantParser/JPetGeantParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ void JPetGeantParser::processMCEvent(JPetGeantEventPack* evPack)
{

// translate geantHit -> JPetMCHit
JPetMCHit mcHit = JPetGeantParserTools::createJPetMCHit(evPack->GetHit(i), getParamBank());
JPetMCHit mcHit = JPetGeantParserTools::createJPetMCHit(evPack->GetHit(i), getParamBank(), timeShift);

if (fMakeHisto)
fillHistoMCGen(mcHit);
// create reconstructed hit and add all smearings
JPetHit recHit = JPetGeantParserTools::reconstructHit(mcHit, getParamBank(), timeShift, fExperimentalParametrizer);
JPetHit recHit = JPetGeantParserTools::reconstructHit(mcHit, getParamBank(), fExperimentalParametrizer);

// add criteria for possible rejection of reconstructed events (e.g. E>50 keV)
if (JPetGeantParserTools::isHitReconstructed(recHit, fExperimentalThreshold))
Expand Down
15 changes: 7 additions & 8 deletions src/GeantParser/JPetGeantParser/JPetGeantParserTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#include <TMath.h>

JPetMCHit JPetGeantParserTools::createJPetMCHit(JPetGeantScinHits* geantHit, const JPetParamBank& paramBank)
JPetMCHit JPetGeantParserTools::createJPetMCHit(JPetGeantScinHits* geantHit, const JPetParamBank& paramBank, const float timeShift)
{
JPetMCHit mcHit = JPetMCHit(0, // UInt_t MCDecayTreeIndex,
geantHit->GetEvtID(), // UInt_t MCVtxIndex,
geantHit->GetEneDepos(), // keV
geantHit->GetTime(), // ps
JPetMCHit mcHit = JPetMCHit(0, // UInt_t MCDecayTreeIndex,
geantHit->GetEvtID(), // UInt_t MCVtxIndex,
geantHit->GetEneDepos(), // keV
geantHit->GetTime() + timeShift, // ps
geantHit->GetHitPosition(), geantHit->GetPolarizationIn(), geantHit->GetMomentumIn());

JPetScin& scin = paramBank.getScintillator(geantHit->GetScinID());
Expand All @@ -33,15 +33,14 @@ JPetMCHit JPetGeantParserTools::createJPetMCHit(JPetGeantScinHits* geantHit, con
return mcHit;
}

JPetHit JPetGeantParserTools::reconstructHit(JPetMCHit& mcHit, const JPetParamBank& paramBank, const float timeShift,
JPetHitExperimentalParametrizer& parametrizer)
JPetHit JPetGeantParserTools::reconstructHit(JPetMCHit& mcHit, const JPetParamBank& paramBank, JPetHitExperimentalParametrizer& parametrizer)
{
JPetHit hit = dynamic_cast<JPetHit&>(mcHit);
/// Nonsmeared values
auto scinID = mcHit.getScintillator().getID();
auto posZ = mcHit.getPosZ();
auto energy = mcHit.getEnergy();
auto time = mcHit.getTime() + timeShift;
auto time = mcHit.getTime();

hit.setEnergy(parametrizer.addEnergySmearing(scinID, posZ, energy, time));
// adjust to time window and smear
Expand Down

0 comments on commit 024ca5a

Please sign in to comment.