61 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
74 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
75 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
78 edm::LogInfo(
"Phase2ITValidateRecHit") <<
">>> Construct Phase2ITValidateRecHit ";
85 edm::LogInfo(
"Phase2ITValidateRecHit") <<
">>> Destroy Phase2ITValidateRecHit ";
89 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
91 const auto& simHitHandle =
iEvent.getHandle(itoken);
92 if (!simHitHandle.isValid())
94 simHits.emplace_back(simHitHandle);
99 std::map<unsigned int, SimTrack> selectedSimTrackMap;
100 for (
const auto& simTrackIt : *
simTracks) {
102 selectedSimTrackMap.emplace(simTrackIt.trackId(), simTrackIt);
112 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
117 std::map<std::string, unsigned int> nrechitLayerMap_primary;
119 for (
const auto& DSViter : *
rechits) {
121 unsigned int rawid(DSViter.detId());
125 if (nrechitLayerMap_primary.find(
key) == nrechitLayerMap_primary.end()) {
126 nrechitLayerMap_primary.emplace(
key, DSViter.size());
128 nrechitLayerMap_primary[
key] += DSViter.size();
131 for (
const auto& rechit : DSViter) {
133 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(rechit);
134 const PSimHit* simhitClosest =
nullptr;
137 for (
const auto& simHitCol :
simHits) {
138 for (
const auto& simhitIt : *simHitCol) {
139 if (
detId.rawId() != simhitIt.detUnitId())
141 for (
const auto&
mId : matchedId) {
142 if (simhitIt.trackId() ==
mId.first) {
143 if (!simhitClosest ||
abs(simhitIt.localPosition().x() - lp.
x()) < minx) {
144 minx =
std::abs(simhitIt.localPosition().x() - lp.
x());
145 simhitClosest = &simhitIt;
155 fillRechitHistos(simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMap_primary);
161 for (
const auto& lme : nrechitLayerMap_primary) {
162 layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]);
174 desc.add<
bool>(
"associatePixel",
true);
175 desc.add<
bool>(
"associateStrip",
false);
176 desc.add<
bool>(
"usePhase2Tracker",
true);
177 desc.add<
bool>(
"associateRecoTracks",
false);
178 desc.add<
bool>(
"associateHitbySimTrack",
true);
180 desc.add<std::vector<std::string>>(
"ROUList",
182 "TrackerHitsPixelBarrelLowTof",
183 "TrackerHitsPixelBarrelHighTof",
184 "TrackerHitsPixelEndcapLowTof",
185 "TrackerHitsPixelEndcapHighTof",
190 desc.add<
double>(
"SimTrackMinPt", 2.0);
193 desc.add<
bool>(
"Verbosity",
false);
194 descriptions.
add(
"Phase2ITValidateRecHit",
desc);
Phase2ITValidateRecHit(const edm::ParameterSet &)
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
std::map< std::string, RecHitME > layerMEs_
const double simtrackminpt_
~Phase2ITValidateRecHit() override
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
TrackerHitAssociator::Config trackerHitAssociatorConfig_
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
const TrackerTopology * tTopo_
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Abs< T >::type abs(const T &t)
key
prepare the HTCondor submission files and eventually submit them
#define DEFINE_FWK_MODULE(type)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
const edm::EDGetTokenT< SiPixelRecHitCollection > tokenRecHitsIT_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void fillITHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
edm::ParameterSet config_
void fillRechitHistos(const PSimHit *simhitClosest, const SiPixelRecHit *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMap_primary)
std::vector< SimTrack > SimTrackContainer