Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c99e4b
Merge pull request #1 from gianipez/trackerParRec
gianipez Aug 30, 2019
4d8d757
Merge pull request #2 from gianipez/trackerParRec
gianipez Sep 3, 2019
d3e1587
Merge pull request #3 from gianipez/trackerParRec
gianipez Sep 4, 2019
2bc4cc4
Merge pull request #4 from Mu2e/master
gianipez Sep 4, 2019
51e00cc
Merge pull request #5 from Mu2e/master
gianipez Sep 20, 2019
85959cd
Merge pull request #7 from gianipez/trackerPatRec
gianipez Sep 20, 2019
4beb534
fixed calo-cluster z position offset in CalHelixFinderAlg
Sep 20, 2019
f420b2d
updated fcl parameter used to normalize the weight in the phi-z fit o…
Sep 21, 2019
b7a09a6
added configurations for setting backup track triggers that uses filt…
Sep 25, 2019
ef0a729
attempt to add the FHICL validation in CalHelixFinder module
Sep 26, 2019
ebfec6e
fixed bug in RobustHelixFit class
Sep 26, 2019
fa6381f
created .cc file for TriggerResultsNavigator class
Sep 26, 2019
28a213f
created sequences for the fast track-triggers
Sep 26, 2019
5ff0404
started coding migration to Validated parameters set
Sep 26, 2019
1c3c549
cleaned up code for Validation FHICL params in CalPatRec
Sep 27, 2019
8dd24a9
improving CalHelixFinderAlg
Sep 29, 2019
11602c5
changed default values for fitFZ minL and stepL
Sep 29, 2019
f1b1f8c
added option to run the function findDfDz before searchBestTriplet on…
Sep 29, 2019
5a514e3
Merge branch 'master' of github.com:gianipez/Offline into tpr1
Sep 29, 2019
ad989c5
Merge pull request #8 from Mu2e/master
gianipez Sep 29, 2019
03937c3
changed configuration of the RobustHelixFit when used in the trigger …
Sep 30, 2019
03faf8f
Merge pull request #9 from gianipez/master
gianipez Sep 30, 2019
7cbabaf
fixed constructor of the TriggerResultsNavigator class
Sep 30, 2019
27299bf
added cut on the maximum z of the seed-hit used in the calHelixFinderAlg
Sep 30, 2019
b86061d
added cut on the area defined by the triplet
Sep 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CalPatRec/fcl/prolog.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ CalPatRec : { @table::CalPatRec
chi2zphiMax : 5.0
chi2hel3DMax : @local::CalPatRec.chi2hel3DMax
dfdzErr : 0.1
minArea : 5000.
}
#------------------------------------------------------------------------------
# KalFitHack configuration for the KFF fits
Expand Down
3 changes: 2 additions & 1 deletion CalPatRec/fcl/prolog_trigger.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ CprTrigger : {
#------------------------------------------------------------------------------
TTHelixFinderAlg : { @table::CalPatRec.HelixFinderAlg
targetconsistent : 0
# maxZTripletSearch : 0. # mm
maxZTripletSearch : 0. # mm
maxDfDz : 0.025
initDfDz : 1
}
#------------------------------------------------------------------------------
# SeedFitter(SeedFitHackNew) configuration for the final track fit: NOT USED ANYMORE
Expand Down
7 changes: 5 additions & 2 deletions CalPatRec/inc/CalHelixFinderAlg.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace mu2e {
class CalHelixFinderAlg {
public:
enum { kMaxNHits = 10000 } ;

//-----------------------------------------------------------------------------
// data members
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -157,6 +158,7 @@ namespace mu2e {
int _phiCorrectedDefined;

float _dfdzErr; // error on dfdz by ::findDfDz
float _minarea2;
//-----------------------------------------------------------------------------
// checkpoints, used for debugging
//-----------------------------------------------------------------------------
Expand All @@ -166,7 +168,6 @@ namespace mu2e {
//-----------------------------------------------------------------------------
public:
// parameter set should be passed in on construction

explicit CalHelixFinderAlg(fhicl::ParameterSet const&);
virtual ~CalHelixFinderAlg();
// cached bfield accessor
Expand Down Expand Up @@ -197,7 +198,7 @@ namespace mu2e {
const XYZVec& HelCenter,
float Radius);

void calculateTrackParameters(const XYZVec& p1,
bool calculateTrackParameters(const XYZVec& p1,
const XYZVec& p2,
const XYZVec& p3,
XYZVec& Center,
Expand Down Expand Up @@ -323,6 +324,8 @@ namespace mu2e {
HitInfo_t& Iworst ,
float& HitChi2Worst);



};
}
#endif
2 changes: 2 additions & 0 deletions CalPatRec/inc/CalHelixFinder_module.hh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ namespace mu2e {
// functions
//-----------------------------------------------------------------------------
public:

enum fitType {helixFit=0,seedFit,kalFit};

explicit CalHelixFinder(const fhicl::ParameterSet& PSet);
virtual ~CalHelixFinder();

Expand Down
22 changes: 17 additions & 5 deletions CalPatRec/src/CalHelixFinderAlg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,15 @@ namespace mu2e {
_chi2hel3DMax (pset.get<float> ("chi2hel3DMax" )),
_dfdzErr (pset.get<float> ("dfdzErr" )){

float minarea(pset.get<float>("minArea"));
_minarea2 = minarea*minarea;

std::vector<std::string> bitnames;
bitnames.push_back("Outlier");
bitnames.push_back("OtherBackground");
//mu2e::ComboHit::_useflag = StrawHitFlag(bitnames);
}


//-----------------------------------------------------------------------------
CalHelixFinderAlg::~CalHelixFinderAlg() {
}
Expand Down Expand Up @@ -2017,14 +2019,14 @@ namespace mu2e {
int nhits = panelz->nChHits();
for (int i=0; i<nhits; ++i){
if (Helix._nStrawHits > (nSh - nHitsTested)) continue;
if ((nSh - nHitsTested) < _minNHits ) continue;
if ((nSh - nHitsTested) < _minNHits ) continue;
//clear the info of the tmp object used to test the triplet
TmpHelix.clearResults();

HitInfo_t seed(f,p,panelz->idChBegin + i);
findTrack(seed,TmpHelix,UseMPVdfdz);

nHitsTested += Helix._chHitsToProcess[panelz->idChBegin + i].nStrawHits();// panelz->_chHitsToProcess.at(i).nStrawHits();
nHitsTested += Helix._chHitsToProcess[panelz->idChBegin + i].nStrawHits();

//compare tripletHelix with bestTripletHelix
//2019-02-08: gianipez chanceg the logic;
Expand Down Expand Up @@ -3029,7 +3031,7 @@ namespace mu2e {
XYZVec p2(seedHit->_pos); // seed hit
XYZVec p3(fCaloX,fCaloY,fCaloZ); // cluster

calculateTrackParameters(p1,p2,p3,center,radius,phi0,dfdz);
if (!calculateTrackParameters(p1,p2,p3,center,radius,phi0,dfdz)) return;

//--------------------------------------------------------------------------------
// gianipez test 2019-09-28
Expand Down Expand Up @@ -3484,13 +3486,21 @@ namespace mu2e {
//-----------------------------------------------------------------------------
// helix parameters are defined at Z=p2.z, Phi0 corresponds to p2
//-----------------------------------------------------------------------------
void CalHelixFinderAlg::calculateTrackParameters(const XYZVec& p1 ,
bool CalHelixFinderAlg::calculateTrackParameters(const XYZVec& p1 ,
const XYZVec& p2 ,
const XYZVec& p3 ,
XYZVec& Center ,
float& Radius ,
float& Phi0 ,
float& DfDz32) {
//evaluate the area covered by the Triplet
float dist2ij = (p1 - p2).Mag2();
float dist2ik = (p1 - p3).Mag2();
float dist2jk = (p2 - p3).Mag2();
float area2 = (dist2ij*dist2jk + dist2ik*dist2jk + dist2ij*dist2ik) - 0.5*(dist2ij*dist2ij + dist2jk*dist2jk + dist2ik*dist2ik);
if(area2 < _minarea2) return false;


Center.SetZ(p2.z());

float x_m, y_m, x_n, y_n;
Expand Down Expand Up @@ -3595,6 +3605,8 @@ namespace mu2e {
Center.x(),Center.y(),Phi0,p1.z(),p2.z(),p3.z(),dphi32,DfDz32);
printf("[CalHelixFinderAlg:calculateTrackParameters] z0 = %9.3f d0 = %8.4f phi00 = %8.5f omega = %8.5f tandip = %8.4f\n",z0,d0,phi00,1/Radius,tandip);
}

return true;
}

//-----------------------------------------------------------------------------
Expand Down
4 changes: 1 addition & 3 deletions CalPatRec/src/CalHelixFinderDiag_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace mu2e {
SimParticleTimeOffset* _timeOffsets;

public:

CalHelixFinderDiag(const fhicl::ParameterSet& PSet);
~CalHelixFinderDiag();

Expand All @@ -49,13 +49,11 @@ namespace mu2e {
//
//-----------------------------------------------------------------------------
CalHelixFinderDiag::CalHelixFinderDiag(const fhicl::ParameterSet& PSet) {
printf(" CalHelixFinderDiag::CalHelixFinderDiag : HOORAY! \n");
_first_call = 1;
_event_number = -1;
_timeOffsets = NULL;
}


CalHelixFinderDiag::~CalHelixFinderDiag() {
}

Expand Down
39 changes: 18 additions & 21 deletions CalPatRec/src/CalHelixFinder_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ using CLHEP::HepVector;
using CLHEP::Hep3Vector;

namespace mu2e {
//-----------------------------------------------------------------------------
// module constructor, parameter defaults are defiend in CalPatRec/fcl/prolog.fcl
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// module constructor, parameter defaults are defiend in CalPatRec/fcl/prolog.fcl
//-----------------------------------------------------------------------------
CalHelixFinder::CalHelixFinder(fhicl::ParameterSet const& pset) :
art::EDFilter{pset},
_diagLevel (pset.get<int> ("diagLevel" )),
Expand All @@ -64,34 +64,31 @@ namespace mu2e {
_minNHitsTimeCluster(pset.get<int> ("minNHitsTimeCluster" )),
_tpart ((TrkParticle::type)(pset.get<int>("fitparticle"))),
_fdir ((TrkFitDirection::FitDirection)(pset.get<int>("fitdirection"))),
_hfinder (pset.get<fhicl::ParameterSet>("HelixFinderAlg",fhicl::ParameterSet()))
{
consumes<ComboHitCollection>(_shLabel);
consumes<StrawHitFlagCollection>(_shfLabel);
consumes<TimeClusterCollection>(_timeclLabel);

std::vector<int> helvals = pset.get<std::vector<int> >("Helicities",vector<int>{Helicity::neghel,Helicity::poshel});
for(auto hv : helvals) {
_hfinder (pset.get<fhicl::ParameterSet>("HelixFinderAlg",fhicl::ParameterSet())){
consumes<ComboHitCollection>(_shLabel);
consumes<StrawHitFlagCollection>(_shfLabel);
consumes<TimeClusterCollection>(_timeclLabel);

std::vector<int> helvals = pset.get<std::vector<int> >("Helicities",vector<int>{Helicity::neghel,Helicity::poshel}); //pset.get<std::vector<int> >("Helicities",vector<int>{Helicity::neghel,Helicity::poshel});
for(auto hv : helvals) {
Helicity hel(hv);
_hels.push_back(hel);
produces<HelixSeedCollection>(Helicity::name(hel));
}
// produces<HelixSeedCollection>();
//-----------------------------------------------------------------------------
// provide for interactive disanostics
//-----------------------------------------------------------------------------
_helTraj = 0;
_timeOffsets = new fhicl::ParameterSet(pset.get<fhicl::ParameterSet>("TimeOffsets",fhicl::ParameterSet()));
_helTraj = 0;
_timeOffsets = new fhicl::ParameterSet(pset.get<fhicl::ParameterSet>("TimeOffsets",fhicl::ParameterSet()));

_data.shLabel = _shLabel;
_data.timeOffsets = _timeOffsets;
_data.shLabel = _shLabel;
_data.timeOffsets = _timeOffsets;

if (_debugLevel != 0) _printfreq = 1;
if (_debugLevel != 0) _printfreq = 1;

if (_diagLevel != 0) _hmanager = art::make_tool <ModuleHistToolBase>(pset.get<fhicl::ParameterSet>("diagPlugin"));
else _hmanager = std::make_unique<ModuleHistToolBase>();

}
if (_diagLevel != 0) _hmanager = art::make_tool <ModuleHistToolBase>(pset.get<fhicl::ParameterSet>("diagPlugin"));
else _hmanager = std::make_unique<ModuleHistToolBase>();
}

//-----------------------------------------------------------------------------
// destructor
Expand Down
76 changes: 9 additions & 67 deletions Mu2eUtilities/inc/TriggerResultsNavigator.hh
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#ifndef Mu2eUtilities_TriggerResultsNavigator_hh
#define Mu2eUtilities_TriggerResultsNavigator_hh
//
//
// $Id: $
// $Author: $
// $Date: $
//
// Original author G. Pezzullo
//

#include "canvas/Persistency/Common/TriggerResults.h"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/ParameterSetRegistry.h"

#include <map>
#include <string>
Expand All @@ -23,74 +16,23 @@ namespace mu2e {
class TriggerResultsNavigator{

public:
TriggerResultsNavigator(const art::TriggerResults* trigResults):
_trigResults(trigResults)
{
auto const id = trigResults->parameterSetID();
auto const& pset = fhicl::ParameterSetRegistry::get(id);
//set the vector<string> with the names of the tirgger_paths
_trigPathsNames = pset.get<std::vector<std::string>>("trigger_paths");

//loop over trigResults to fill the map <string, unsigned int)
for (unsigned int i=0; i< _trigPathsNames.size(); ++i){
_trigMap.insert(std::pair<std::string, unsigned int>(_trigPathsNames[i], i));
}
}
TriggerResultsNavigator(const art::TriggerResults* trigResults);

// Trigger path information for the current process
size_t
size() const
size_t size() const
{
return _trigPathsNames.size();
}
std::vector<std::string> const&
getTrigPaths() const
{
return _trigPathsNames;
}
std::string const&
getTrigPath(unsigned int const i) const
{
return _trigPathsNames.at(i);
}
size_t
findTrigPath(std::string const& name) const
{
return find(_trigMap, name);
}

std::vector<std::string> const& getTrigPaths() const { return _trigPathsNames; }
std::string const& getTrigPath(unsigned int const i) const { return _trigPathsNames.at(i); }

size_t
find(std::map<std::string, unsigned int> const& posmap, std::string const& name) const
{
auto const pos = posmap.find(name);
if (pos == posmap.cend()) {
return posmap.size();
} else {
return pos->second;
}
}
size_t findTrigPath(std::string const& name) const;
size_t find(std::map<std::string, unsigned int> const& posmap, std::string const& name) const;

// Has ith path accepted the event?
bool
accept(std::string const& name) const
{
size_t index = findTrigPath(name);
return _trigResults->accept(index);
}
void print() const {
printf("TriggerResultsNaviogator Map\n");
printf("//------------------------------------------//\n");
printf("// trig_pathName id accepted //\n");
printf("//------------------------------------------//\n");

for (unsigned int i=0; i< _trigPathsNames.size(); ++i){
std::string name = _trigPathsNames[i];
size_t index = findTrigPath(name);
bool accepted = accept(name);
printf("// %24s %2li %i //\n", name.c_str(), index, accepted == true ? 1:0);
}

}
bool accept(std::string const& name) const;
void print() const;

private:
const art::TriggerResults* _trigResults;
Expand Down
1 change: 1 addition & 0 deletions Mu2eUtilities/src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mainlib = helper.make_mainlib ( [ 'mu2e_ConditionsService_ConditionsService_serv
'fhiclcpp',
'cetlib',
'cetlib_except',
'hep_concurrency',
rootlibs,
'boost_system'
] )
Expand Down
Loading