63 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
79 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
80 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
83 edm::LogInfo(
"Phase2OTValidateTrackingRecHit") <<
">>> Construct Phase2OTValidateTrackingRecHit ";
85 simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
94 edm::LogInfo(
"Phase2OTValidateTrackingRecHit") <<
">>> Destroy Phase2OTValidateTrackingRecHit ";
101 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
103 const auto& simHitHandle =
iEvent.getHandle(itoken);
104 if (!simHitHandle.isValid())
106 simHits.emplace_back(simHitHandle);
110 std::map<unsigned int, SimTrack> selectedSimTrackMap;
111 for (edm::SimTrackContainer::const_iterator simTrackIt(
simTracks->begin()); simTrackIt !=
simTracks->end();
114 selectedSimTrackMap.insert(std::make_pair(simTrackIt->trackId(), *simTrackIt));
124 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
128 std::map<std::string, unsigned int> nrechitLayerMapP_primary;
129 std::map<std::string, unsigned int> nrechitLayerMapS_primary;
132 for (
const auto&
hit :
track.recHits()) {
136 auto detId =
hit->geographicalId();
138 auto subdetid = (detId.subdetId());
146 if (nrechitLayerMapP_primary.find(
key) == nrechitLayerMapP_primary.end()) {
147 nrechitLayerMapP_primary.emplace(
key, 1);
149 nrechitLayerMapP_primary[
key] += 1;
152 if (nrechitLayerMapS_primary.find(
key) == nrechitLayerMapS_primary.end()) {
153 nrechitLayerMapS_primary.emplace(
key, 1);
155 nrechitLayerMapS_primary[
key] += 1;
162 <<
"Cannot cast tracking rechit to Phase2TrackerRecHit1D!" << std::endl;
165 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(*rechit);
166 const PSimHit* simhitClosest =
nullptr;
169 for (
const auto& simHitCol :
simHits) {
170 for (
const auto& simhitIt : *simHitCol) {
171 if (detId.rawId() != simhitIt.detUnitId())
173 for (
auto& mId : matchedId) {
174 if (simhitIt.trackId() == mId.first) {
175 float dx = simhitIt.localPosition().x() - lp.
x();
176 float dy = simhitIt.localPosition().y() - lp.
y();
178 if (!simhitClosest || dist < mind) {
180 simhitClosest = &simhitIt;
189 simhitClosest, rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
196 for (
auto& lme : nrechitLayerMapP_primary) {
197 layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
199 for (
auto& lme : nrechitLayerMapS_primary) {
200 layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
212 desc.add<
bool>(
"associatePixel",
false);
213 desc.add<
bool>(
"associateHitbySimTrack",
true);
214 desc.add<
bool>(
"Verbosity",
false);
215 desc.add<
bool>(
"associateStrip",
true);
217 desc.add<
bool>(
"associateRecoTracks",
false);
219 desc.add<
bool>(
"usePhase2Tracker",
true);
222 desc.add<
double>(
"SimTrackMinPt", 2.0);
223 desc.add<std::vector<edm::InputTag>>(
"PSimHitSource",
239 desc.add<std::vector<std::string>>(
"ROUList",
240 {
"TrackerHitsPixelBarrelLowTof",
241 "TrackerHitsPixelBarrelHighTof",
242 "TrackerHitsTIBLowTof",
243 "TrackerHitsTIBHighTof",
244 "TrackerHitsTIDLowTof",
245 "TrackerHitsTIDHighTof",
246 "TrackerHitsTOBLowTof",
247 "TrackerHitsTOBHighTof",
248 "TrackerHitsPixelEndcapLowTof",
249 "TrackerHitsPixelEndcapHighTof",
250 "TrackerHitsTECLowTof",
251 "TrackerHitsTECHighTof"});
253 desc.add<
std::string>(
"TopFolderName",
"TrackerPhase2OTTrackingRecHitV");
254 descriptions.
add(
"Phase2OTValidateTrackingRecHit",
desc);
const TrackerTopology * tTopo_
T getParameter(std::string const &) const
void fillOTRecHitHistos(const PSimHit *simhitClosest, const Phase2TrackerRecHit1D *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMapP_primary, std::map< std::string, unsigned int > &nrechitLayerMapS_primary)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< Track > TrackCollection
collection of Tracks
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
Log< level::Error, false > LogError
void fillOTHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
const double simtrackminpt_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
ModuleType getDetectorType(DetId) const
TrackerHitAssociator::Config trackerHitAssociatorConfig_
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
#define DEFINE_FWK_MODULE(type)
const TrackerGeometry * tkGeom_
Log< level::Info, false > LogInfo
~Phase2OTValidateTrackingRecHit() override
Phase2OTValidateTrackingRecHit(const edm::ParameterSet &)
edm::ParameterSet config_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
LocalPoint localPosition() const override
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::vector< SimTrack > SimTrackContainer
std::map< std::string, RecHitME > layerMEs_