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
Fake CPE #24175
Changes from 14 commits
ce66c53
28d74d9
cd8718b
abee726
028f868
6a1d2e2
ab4089d
6ad5255
ea998db
ef22939
40cb1c0
f9d6cb6
9578064
c89be9e
91c39e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
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. do these need to be public? |
||
}; | ||
|
||
|
||
Map & map() { return m_map;} | ||
Map const & map() const { return m_map;} | ||
|
||
private: | ||
|
||
Map m_map; | ||
|
||
}; | ||
|
||
#endif |
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; | ||
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. does this have to be public? |
||
|
||
}; | ||
|
||
#endif |
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; | ||
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. make this private? |
||
|
||
|
||
}; | ||
|
||
|
||
#endif | ||
|
||
|
||
|
||
|
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); | ||
|
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