New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fake CPE #24175
Merged
Merged
Fake CPE #24175
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ce66c53
add a fakecpe
VinInn 28d74d9
compiles
VinInn cd8718b
add producer
VinInn abee726
strip as well
VinInn 028f868
add builder
VinInn 6a1d2e2
works
VinInn ab4089d
add a filler of FakeCPE
VinInn 6ad5255
fix encoding
VinInn ea998db
add test
VinInn ef22939
add one more printout
VinInn 40cb1c0
add useless override
VinInn f9d6cb6
make the filter a filter, remove unscheduling
VinInn 9578064
make it production grade
VinInn c89be9e
remove extra space
VinInn 91c39e9
remove regression
VinInn File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
RecoLocalTracker/ClusterParameterEstimator/interface/FakeCPE.h
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,67 @@ | ||
#ifndef RecoLocalTracker_Cluster_Parameter_Estimator_Fake_H | ||
#define RecoLocalTracker_Cluster_Parameter_Estimator_Fake_H | ||
|
||
#include "DataFormats/GeometrySurface/interface/LocalError.h" | ||
#include "DataFormats/GeometryVector/interface/LocalPoint.h" | ||
|
||
#include "Geometry/CommonDetUnit/interface/GeomDet.h" | ||
|
||
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" | ||
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" | ||
|
||
|
||
#include <cstdint> | ||
#include <unordered_map> | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
class FakeCPE { | ||
public: | ||
|
||
using LocalValues = std::pair<LocalPoint,LocalError>; | ||
|
||
// store position and error for each cluster... | ||
class Map { | ||
public: | ||
using LocalValues = std::pair<LocalPoint,LocalError>; | ||
void clear() {m_map.clear();} | ||
void error(const GeomDetUnit& gd) const {edm::LogError("FakeCPE") << "hit not found in det " << gd.geographicalId().rawId(); } | ||
template<typename Cluster> | ||
void add(const Cluster& cluster, const GeomDetUnit& gd,LocalValues const & lv) { m_map[encode(cluster,gd)] = lv; } | ||
|
||
template<typename Cluster> | ||
LocalValues const & get(const Cluster& cluster, const GeomDetUnit& gd) const { | ||
auto p = m_map.find(encode(cluster,gd)); | ||
if (p!=m_map.end()) { return (*p).second; } | ||
error(gd); | ||
return dummy; | ||
} | ||
|
||
static uint64_t encode(const SiPixelCluster& cluster, const GeomDetUnit& det) { | ||
uint64_t u1 = det.geographicalId().rawId(); | ||
uint64_t u2 = cluster.minPixelRow(); | ||
uint64_t u3 = cluster.minPixelCol(); | ||
return (u1<<32) | (u2<<16) | u3; | ||
} | ||
static uint64_t encode(const SiStripCluster& cluster, const GeomDetUnit& det) { | ||
uint64_t u1 = det.geographicalId().rawId(); | ||
uint64_t u2 = cluster.firstStrip(); | ||
return (u1<<32) | u2; | ||
} | ||
|
||
private: | ||
std::unordered_map<uint64_t,LocalValues> m_map; | ||
LocalValues dummy; | ||
}; | ||
|
||
|
||
Map & map() { return m_map;} | ||
Map const & map() const { return m_map;} | ||
|
||
private: | ||
|
||
Map m_map; | ||
|
||
}; | ||
|
||
#endif |
53 changes: 53 additions & 0 deletions
53
RecoLocalTracker/ClusterParameterEstimator/interface/PixelFakeCPE.h
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,53 @@ | ||
#ifndef RecoLocalTracker_Fake_PixelCluster_Parameter_Estimator_H | ||
#define RecoLocalTracker_Fake_PixelCluster_Parameter_Estimator_H | ||
|
||
#include "DataFormats/GeometrySurface/interface/LocalError.h" | ||
#include "DataFormats/GeometryVector/interface/LocalPoint.h" | ||
|
||
#include "Geometry/CommonDetUnit/interface/GeomDet.h" | ||
#include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" | ||
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" | ||
|
||
#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" | ||
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h" | ||
#include<tuple> | ||
|
||
|
||
#include "RecoLocalTracker/ClusterParameterEstimator/interface/FakeCPE.h" | ||
#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" | ||
|
||
class PixelFakeCPE final : public PixelClusterParameterEstimator { | ||
public: | ||
|
||
PixelFakeCPE() = default; | ||
~PixelFakeCPE() = default; | ||
|
||
typedef std::pair<LocalPoint,LocalError> LocalValues; | ||
typedef std::vector<LocalValues> VLocalValues; | ||
|
||
using ReturnType = std::tuple<LocalPoint,LocalError,SiPixelRecHitQuality::QualWordType>; | ||
|
||
// here just to implement it in the clients; | ||
// to be properly implemented in the sub-classes in order to make them thread-safe | ||
|
||
ReturnType getParameters(const SiPixelCluster & cl, | ||
const GeomDetUnit & det) const override { | ||
auto const & lv = fakeCPE().map().get(cl,det); | ||
return {lv.first,lv.second,0}; | ||
} | ||
|
||
ReturnType getParameters(const SiPixelCluster & cl, | ||
const GeomDetUnit & det, | ||
const LocalTrajectoryParameters &) const override{ | ||
return getParameters(cl,det); | ||
} | ||
|
||
void setFakeCPE(FakeCPE * iFakeCPE) { m_fakeCPE = iFakeCPE;} | ||
FakeCPE const & fakeCPE() const { return *m_fakeCPE; } | ||
|
||
private: | ||
FakeCPE const * m_fakeCPE=nullptr; | ||
|
||
}; | ||
|
||
#endif |
55 changes: 55 additions & 0 deletions
55
RecoLocalTracker/ClusterParameterEstimator/interface/StripFakeCPE.h
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,55 @@ | ||
#ifndef RecoLocalTracker_Fake_StripCluster_Parameter_Estimator_H | ||
#define RecoLocalTracker_Fake_StripCluster_Parameter_Estimator_H | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use an include guard matching the full file name subsystem_package_fileName_h There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just copied for base class head -n 1
|
||
|
||
#include "DataFormats/GeometrySurface/interface/LocalError.h" | ||
#include "DataFormats/GeometryVector/interface/LocalPoint.h" | ||
|
||
#include "Geometry/CommonDetUnit/interface/GeomDet.h" | ||
#include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" | ||
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" | ||
|
||
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" | ||
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h" | ||
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h" | ||
|
||
#include "CommonTools/Utils/interface/DynArray.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
|
||
|
||
#include "RecoLocalTracker/ClusterParameterEstimator/interface/FakeCPE.h" | ||
#include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h" | ||
|
||
class StripFakeCPE final : public StripClusterParameterEstimator | ||
{ | ||
public: | ||
|
||
StripFakeCPE() = default; | ||
~StripFakeCPE() override = default; | ||
|
||
using LocalValues = std::pair<LocalPoint,LocalError>; | ||
|
||
LocalValues localParameters( const SiStripCluster& cl , const GeomDetUnit& gd) const override { | ||
return fakeCPE().map().get(cl,gd); | ||
} | ||
|
||
// used by Validation.... | ||
LocalVector driftDirection(const StripGeomDetUnit* ) const override { return LocalVector();} | ||
|
||
void setFakeCPE(FakeCPE * iFakeCPE) { m_fakeCPE = iFakeCPE;} | ||
FakeCPE const & fakeCPE() const { return *m_fakeCPE; } | ||
|
||
|
||
private: | ||
|
||
FakeCPE const * m_fakeCPE=nullptr; | ||
|
||
|
||
}; | ||
|
||
|
||
#endif | ||
|
||
|
||
|
||
|
52 changes: 52 additions & 0 deletions
52
RecoLocalTracker/SiPixelRecHits/plugins/FakePixelCPEESProducer.cc
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,52 @@ | ||
#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelFakeCPE.h" | ||
|
||
#include "MagneticField/Engine/interface/MagneticField.h" | ||
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/Records/interface/TrackerTopologyRcd.h" | ||
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" | ||
|
||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
||
|
||
|
||
#include <string> | ||
#include <memory> | ||
|
||
|
||
#include "FWCore/Framework/interface/ESProducer.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h" | ||
|
||
namespace { | ||
|
||
class FakePixelCPEESProducer final : public edm::ESProducer{ | ||
public: | ||
|
||
FakePixelCPEESProducer(const edm::ParameterSet & p) { | ||
std::string myname = p.getParameter<std::string>("ComponentName"); | ||
setWhatProduced(this,myname); | ||
} | ||
|
||
~FakePixelCPEESProducer() = default; | ||
|
||
std::unique_ptr<PixelClusterParameterEstimator> produce(const TkPixelCPERecord &) { | ||
return std::make_unique<PixelFakeCPE>(); | ||
} | ||
|
||
private: | ||
|
||
}; | ||
|
||
} | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
|
||
DEFINE_FWK_EVENTSETUP_MODULE(FakePixelCPEESProducer); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use an include guard matching the full file name subsystem_package_fileName_h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consistent with base class