@@ -189,7 +189,7 @@ bdm::SmearedReconstructionAlg::reconstruct
189189
190190    //  retrieve the reconstruction parameters for this type of particle
191191    auto  const & recoParams = fParameters [particle->PdgCode ()];
192-     
192+     //  std::cout << "TrackID: " << particle->TrackId() << ", PDGCode: " << particle->PdgCode() << std::endl; 
193193    // --------------------------------------------------------------------------
194194    unsigned  int  nPoints = particle->NumberTrajectoryPoints ();
195195
@@ -211,14 +211,21 @@ bdm::SmearedReconstructionAlg::reconstruct
211211      { particle->Px (), particle->Py (), particle->Pz () };
212212
213213    double  const  energy = particle->E ();
214+     double  const  kenergy = energy - particle->Mass ();
214215
215216    // --------------------------------------------------------------------------
216217    //  TODO apply smearing and thresholds
217218    bool  bCouldReconstruct = rndUniform.fire () < recoParams.fRecoEff ;
219+     //  std::cout << " => passed reconstruction efficiency (" << recoParams.fRecoEff << ")? " << bCouldReconstruct << std::endl;
218220
219-     double  smearedEnergy  = energy  *
221+     double  smearedKEnergy  = kenergy  *
220222      (1.0  + recoParams.fEnergySmearingFraction  * cappedGaus (rndGaus, -1.0 , 3.0 ));
223+ 
224+     bCouldReconstruct &= smearedKEnergy > recoParams.fKEThreshold ;
225+     //  std::cout << " => passed detection threshold (" << smearedKEnergy << " vs. " << recoParams.fKEThreshold << ")? " << bCouldReconstruct << std::endl;
221226
227+     double  smearedEnergy = smearedKEnergy + particle->Mass ();
228+ 
222229    bdm::SmearedMCParticle::Momentum_t smearedMomentum;
223230    if  (recoParams.fDirectionSmearingAngle  == 0.0 )
224231      smearedMomentum = momentum;
@@ -306,6 +313,7 @@ bdm::SmearedReconstructionAlg::fillParameters
306313    partParams.fRecoEff  = particleConfig.efficiency ();
307314    partParams.fDirectionSmearingAngle  = particleConfig.direction ();
308315    partParams.fEnergySmearingFraction  = particleConfig.energy ();
316+     partParams.fKEThreshold  = particleConfig.threshold ();
309317
310318    parameters.registerParams (std::move (partParams), particleConfig.id ());
311319
@@ -330,6 +338,9 @@ bdm::SmearedReconstructionAlg::fillParameters
330338      = particleConfig.get <double >(" direction"  , 0.0 );
331339    partParams.fEnergySmearingFraction 
332340      = particleConfig.get <double >(" energy"  , 0.0 );
341+     partParams.fKEThreshold 
342+       = particleConfig.get <double >(" threshold"  , 0.0 );
343+      
333344
334345    parameters.registerParams 
335346      (std::move (partParams), particleConfig.get <std::vector<PDGID_t>>(" id"  ));
0 commit comments