-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27895 from makortel/mkfit_110x_integ
Add EDProducers for mkFit
- Loading branch information
Showing
22 changed files
with
1,437 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<use name="DataFormats/Provenance"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/MessageLogger"/> | ||
<use name="mkfit"/> | ||
<use name="rootcore"/> | ||
<export> | ||
<lib name="RecoTrackerMkFit"/> | ||
</export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# mkFit | ||
|
||
This package holds the glue modules for running | ||
[mkFit](http://trackreco.github.io/) within CMSSW. | ||
|
||
Note that at the moment there may be only one `MkFitProducer` in a | ||
single job. This restriction will be removed in the future. | ||
|
||
Also note that at the moment the mkFit works only with the CMS phase1 | ||
tracker detector. Support for the phase2 tracker will be added later. | ||
|
||
## Customize functions for runTheMatrix workflows (offline reconstruction) | ||
|
||
* `RecoTracker/MkFit/customizeInitialStepToMkFit.customizeInitialStepToMkFit` | ||
* Replaces initialStep track building module with `mkFit`. | ||
* `RecoTracker/MkFit/customizeInitialStepOnly.customizeInitialStepOnly` | ||
* Run only the initialStep tracking. In practice this configuration | ||
runs the initialStepPreSplitting iteration, but named as | ||
initialStep. MultiTrackValidator is included, and configured to | ||
monitor initialStep. Intended to provide the minimal configuration | ||
for CMSSW tests. | ||
* `RecoTracker/MkFit/customizeInitialStepOnly.customizeInitialStepOnlyNoMTV` | ||
* Otherwise same as `customizeInitialStepOnly` except drops | ||
MultiTrackValidator. Intended for profiling. | ||
|
||
|
||
These can be used with e.g. | ||
```bash | ||
$ runTheMatrix.py -l <workflow(s)> --apply 2 --command "--customise RecoTracker/MkFit/customizeInitialStepToMkFit.customizeInitialStepToMkFit" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#ifndef RecoTracker_MkFit_MkFitHitIndexMap_h | ||
#define RecoTracker_MkFit_MkFitHitIndexMap_h | ||
|
||
#include "DataFormats/Provenance/interface/ProductID.h" | ||
|
||
#include <vector> | ||
|
||
class TrackingRecHit; | ||
|
||
/** | ||
* This class provides mappings | ||
* - from CMSSW(ProductID, cluster index) to mkFit(layer index, hit index) | ||
* - from mkFit(layer index, hit index) to pointer to CMSSW hit | ||
*/ | ||
class MkFitHitIndexMap { | ||
public: | ||
// This class holds the index and layer of a hit in the hit data | ||
// structure passed to mkFit | ||
class MkFitHit { | ||
public: | ||
MkFitHit() = default; | ||
explicit MkFitHit(int i, int l) : index_{i}, layer_{l} {} | ||
|
||
int index() const { return index_; } | ||
int layer() const { return layer_; } | ||
|
||
private: | ||
int index_ = -1; | ||
int layer_ = -1; | ||
}; | ||
|
||
MkFitHitIndexMap() = default; | ||
|
||
/** | ||
* Can be used to preallocate the internal vectors for CMSSW->mkFit mapping | ||
*/ | ||
void resizeByClusterIndex(edm::ProductID id, size_t clusterIndex); | ||
|
||
/** | ||
* Can be used to preallocate the internal vectors for mkFit->CMSSW mapping | ||
* | ||
* \param layer Layer index (in mkFit convention) | ||
* \param additionalSize Number of additional elements to make space for | ||
*/ | ||
void increaseLayerSize(int layer, size_t additionalSize); | ||
|
||
/** | ||
* Inserts a new hit in the mapping | ||
* | ||
* \param id ProductID of the cluster collection | ||
* \param clusterIndex Index of the cluster in the cluster collection | ||
* \param hit Index and layer of the hit in the mkFit hit data structure | ||
* \param hitPtr Pointer to the TrackingRecHit | ||
*/ | ||
void insert(edm::ProductID id, size_t clusterIndex, MkFitHit hit, const TrackingRecHit* hitPtr); | ||
|
||
/// Get mkFit hit index and layer | ||
const MkFitHit& mkFitHit(edm::ProductID id, size_t clusterIndex) const; | ||
|
||
/// Get CMSSW hit pointer | ||
const TrackingRecHit* hitPtr(MkFitHit hit) const { return mkFitToCMSSW_.at(hit.layer()).at(hit.index()).ptr; } | ||
|
||
/// Get CMSSW cluster index (currently used only for debugging) | ||
size_t clusterIndex(MkFitHit hit) const { return mkFitToCMSSW_.at(hit.layer()).at(hit.index()).clusterIndex; } | ||
|
||
private: | ||
// Helper struct to map (edm::ProductID, cluster index) to MkFitHit | ||
struct ClusterToMkFitHit { | ||
explicit ClusterToMkFitHit(edm::ProductID id) : productID(id) {} | ||
edm::ProductID productID; | ||
std::vector<MkFitHit> mkFitHits; // indexed by cluster index | ||
}; | ||
|
||
// Helper struct to map MkFitHit to (TrackingRecHit *, cluster index) | ||
struct CMSSWHit { | ||
CMSSWHit() = default; | ||
explicit CMSSWHit(const TrackingRecHit* p, size_t i) : ptr{p}, clusterIndex{i} {} | ||
const TrackingRecHit* ptr = nullptr; | ||
size_t clusterIndex = 0; | ||
}; | ||
|
||
std::vector<ClusterToMkFitHit> cmsswToMkFit_; // mapping from CMSSW(ProductID, cluster index) -> mkFit(index, layer) | ||
std::vector<std::vector<CMSSWHit> > mkFitToCMSSW_; // reverse mapping, mkFit(layer, index) -> CMSSW hit | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef RecoTracker_MkFit_MkFitInputWrapper_h | ||
#define RecoTracker_MkFit_MkFitInputWrapper_h | ||
|
||
#include "RecoTracker/MkFit/interface/MkFitHitIndexMap.h" | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace mkfit { | ||
class Hit; | ||
class Track; | ||
class LayerNumberConverter; | ||
using HitVec = std::vector<Hit>; | ||
using TrackVec = std::vector<Track>; | ||
} // namespace mkfit | ||
|
||
class MkFitInputWrapper { | ||
public: | ||
MkFitInputWrapper(); | ||
MkFitInputWrapper(MkFitHitIndexMap&& hitIndexMap, | ||
std::vector<mkfit::HitVec>&& hits, | ||
mkfit::TrackVec&& seeds, | ||
mkfit::LayerNumberConverter&& lnc); | ||
~MkFitInputWrapper(); | ||
|
||
MkFitInputWrapper(MkFitInputWrapper const&) = delete; | ||
MkFitInputWrapper& operator=(MkFitInputWrapper const&) = delete; | ||
MkFitInputWrapper(MkFitInputWrapper&&); | ||
MkFitInputWrapper& operator=(MkFitInputWrapper&&); | ||
|
||
MkFitHitIndexMap const& hitIndexMap() const { return hitIndexMap_; } | ||
mkfit::TrackVec const& seeds() const { return *seeds_; } | ||
std::vector<mkfit::HitVec> const& hits() const { return hits_; } | ||
mkfit::LayerNumberConverter const& layerNumberConverter() const { return *lnc_; } | ||
unsigned int nlayers() const; | ||
|
||
private: | ||
MkFitHitIndexMap hitIndexMap_; | ||
std::vector<mkfit::HitVec> hits_; | ||
std::unique_ptr<mkfit::TrackVec> seeds_; // for pimpl pattern | ||
std::unique_ptr<mkfit::LayerNumberConverter> lnc_; // for pimpl pattern | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef RecoTracker_MkFit_MkFitOutputWrapper_h | ||
#define RecoTracker_MkFit_MkFitOutputWrapper_h | ||
|
||
#include <vector> | ||
|
||
namespace mkfit { | ||
class Track; | ||
using TrackVec = std::vector<Track>; | ||
} // namespace mkfit | ||
|
||
class MkFitOutputWrapper { | ||
public: | ||
MkFitOutputWrapper(); | ||
MkFitOutputWrapper(mkfit::TrackVec&& candidateTracks, mkfit::TrackVec&& fitTracks); | ||
~MkFitOutputWrapper(); | ||
|
||
MkFitOutputWrapper(MkFitOutputWrapper const&) = delete; | ||
MkFitOutputWrapper& operator=(MkFitOutputWrapper const&) = delete; | ||
MkFitOutputWrapper(MkFitOutputWrapper&&); | ||
MkFitOutputWrapper& operator=(MkFitOutputWrapper&&); | ||
|
||
mkfit::TrackVec const& candidateTracks() const { return candidateTracks_; } | ||
mkfit::TrackVec const& fitTracks() const { return fitTracks_; } | ||
|
||
private: | ||
mkfit::TrackVec candidateTracks_; | ||
mkfit::TrackVec fitTracks_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<library file="*.cc" name="RecoTrackerMkFitPlugins"> | ||
<use name="DataFormats/TrackCandidate"/> | ||
<use name="DataFormats/TrackReco"/> | ||
<use name="DataFormats/TrackerCommon"/> | ||
<use name="DataFormats/TrackerRecHit2D"/> | ||
<use name="DataFormats/TrajectorySeed"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/MessageLogger"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="Geometry/Records"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="RecoTracker/MeasurementDet"/> | ||
<use name="RecoTracker/MkFit"/> | ||
<use name="RecoTracker/TkDetLayers"/> | ||
<use name="RecoTracker/TransientTrackingRecHit"/> | ||
<use name="TrackingTools/GeomPropagators"/> | ||
<use name="TrackingTools/KalmanUpdators"/> | ||
<use name="TrackingTools/MaterialEffects"/> | ||
<use name="TrackingTools/Records"/> | ||
<use name="TrackingTools/TrackFitters"/> | ||
<use name="TrackingTools/TrajectoryState"/> | ||
<use name="TrackingTools/TransientTrackingRecHit"/> | ||
<use name="mkfit"/> | ||
<use name="rootmath"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
Oops, something went wrong.