63 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
75 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
76 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
79 edm::LogInfo(
"Phase2ITValidateRecHit") <<
">>> Construct Phase2ITValidateRecHit ";
86 edm::LogInfo(
"Phase2ITValidateTrackingRecHit") <<
">>> Destroy Phase2ITValidateTrackingRecHit ";
90 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
92 const auto& simHitHandle =
iEvent.getHandle(itoken);
93 if (!simHitHandle.isValid())
95 simHits.emplace_back(simHitHandle);
100 std::map<unsigned int, SimTrack> selectedSimTrackMap;
101 for (
const auto& simTrackIt : *
simTracks) {
103 selectedSimTrackMap.emplace(simTrackIt.trackId(), simTrackIt);
113 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
118 std::map<std::string, unsigned int> nrechitLayerMap_primary;
123 for (
auto const&
hit :
track.recHits()) {
127 auto id =
hit->geographicalId();
129 auto subdetid = (
id.subdetId());
138 if (nrechitLayerMap_primary.find(
key) == nrechitLayerMap_primary.end()) {
139 nrechitLayerMap_primary.emplace(
key, 1);
141 nrechitLayerMap_primary[
key] += 1;
148 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(*rechit);
149 const PSimHit* simhitClosest =
nullptr;
152 for (
const auto& simHitCol :
simHits) {
153 for (
const auto& simhitIt : *simHitCol) {
154 if (
id.
rawId() != simhitIt.detUnitId())
156 for (
const auto&
mId : matchedId) {
157 if (simhitIt.trackId() ==
mId.first) {
158 if (!simhitClosest ||
std::abs(simhitIt.localPosition().x() - lp.
x()) < minx) {
159 minx =
std::abs(simhitIt.localPosition().x() - lp.
x());
160 simhitClosest = &simhitIt;
171 fillRechitHistos(simhitClosest, rechit, selectedSimTrackMap, nrechitLayerMap_primary);
177 for (
const auto& lme : nrechitLayerMap_primary) {
178 layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]);
190 desc.add<
bool>(
"associatePixel",
true);
191 desc.add<
bool>(
"associateStrip",
false);
192 desc.add<
bool>(
"usePhase2Tracker",
true);
193 desc.add<
bool>(
"associateRecoTracks",
false);
194 desc.add<
bool>(
"associateHitbySimTrack",
true);
196 desc.add<std::vector<std::string>>(
"ROUList",
198 "TrackerHitsPixelBarrelLowTof",
199 "TrackerHitsPixelBarrelHighTof",
200 "TrackerHitsPixelEndcapLowTof",
201 "TrackerHitsPixelEndcapHighTof",
206 desc.add<
double>(
"SimTrackMinPt", 2.0);
208 desc.add<
std::string>(
"TopFolderName",
"TrackerPhase2ITTrackingRecHitV");
209 desc.add<
bool>(
"Verbosity",
false);
210 descriptions.
add(
"Phase2ITValidateTrackingRecHit",
desc);
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
T getParameter(std::string const &) const
~Phase2ITValidateTrackingRecHit() override
std::map< std::string, RecHitME > layerMEs_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const double simtrackminpt_
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
std::vector< Track > TrackCollection
collection of Tracks
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
const TrackerGeometry * tkGeom_
const TrackerTopology * tTopo_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
void fillITHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
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)
Phase2ITValidateTrackingRecHit(const edm::ParameterSet &)
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
LocalPoint localPosition() const override
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< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
std::vector< SimTrack > SimTrackContainer