60 const std::map<unsigned int, SimTrack>& selectedSimTrackMap);
74 trackerHitAssociatorConfig_(iConfig, consumesCollector()),
75 simtrackminpt_(iConfig.getParameter<double>(
"SimTrackMinPt")),
78 edm::LogInfo(
"Phase2OTValidateRecHit") <<
">>> Construct Phase2OTValidateRecHit ";
80 simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
89 edm::LogInfo(
"Phase2OTValidateRecHit") <<
">>> Destroy Phase2OTValidateRecHit ";
96 std::vector<edm::Handle<edm::PSimHitContainer>>
simHits;
98 const auto& simHitHandle = iEvent.
getHandle(itoken);
99 if (!simHitHandle.isValid())
101 simHits.emplace_back(simHitHandle);
105 std::map<unsigned int, SimTrack> selectedSimTrackMap;
106 for (
const auto& simTrackIt : *simTracks)
108 selectedSimTrackMap.insert(std::make_pair(simTrackIt.trackId(), simTrackIt));
111 fillOTHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap);
117 const std::map<unsigned int, SimTrack>& selectedSimTrackMap) {
122 std::map<std::string, unsigned int> nrechitLayerMapP_primary;
123 std::map<std::string, unsigned int> nrechitLayerMapS_primary;
126 for (
const auto& DSViter : *
rechits) {
128 unsigned int rawid(DSViter.detId());
134 if (nrechitLayerMapP_primary.find(key) == nrechitLayerMapP_primary.end()) {
135 nrechitLayerMapP_primary.insert(std::make_pair(key, DSViter.size()));
137 nrechitLayerMapP_primary[
key] += DSViter.size();
140 if (nrechitLayerMapS_primary.find(key) == nrechitLayerMapS_primary.end()) {
141 nrechitLayerMapS_primary.insert(std::make_pair(key, DSViter.size()));
143 nrechitLayerMapS_primary[
key] += DSViter.size();
147 for (
const auto& rechit : DSViter) {
149 const std::vector<SimHitIdpr>& matchedId = associateRecHit.
associateHitId(rechit);
150 const PSimHit* simhitClosest =
nullptr;
153 for (
const auto& simHitCol :
simHits) {
154 for (
const auto& simhitIt : *simHitCol) {
155 if (detId.rawId() != simhitIt.detUnitId())
157 for (
auto& mId : matchedId) {
158 if (simhitIt.trackId() == mId.first) {
159 float dx = simhitIt.localPosition().x() - lp.
x();
160 float dy = simhitIt.localPosition().y() - lp.
y();
161 float dist = dx * dx + dy *
dy;
162 if (!simhitClosest || dist < mind) {
164 simhitClosest = &simhitIt;
173 simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
180 for (
auto& lme : nrechitLayerMapP_primary) {
181 layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
183 for (
auto& lme : nrechitLayerMapS_primary) {
184 layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
196 desc.
add<
bool>(
"associatePixel",
false);
198 desc.
add<
bool>(
"associateHitbySimTrack",
true);
199 desc.
add<
bool>(
"Verbosity",
false);
200 desc.
add<
bool>(
"associateStrip",
true);
202 desc.
add<
bool>(
"associateRecoTracks",
false);
204 desc.
add<
bool>(
"usePhase2Tracker",
true);
207 desc.
add<
double>(
"SimTrackMinPt", 2.0);
208 desc.
add<std::vector<edm::InputTag>>(
"PSimHitSource",
224 desc.
add<std::vector<std::string>>(
"ROUList",
225 {
"TrackerHitsPixelBarrelLowTof",
226 "TrackerHitsPixelBarrelHighTof",
227 "TrackerHitsTIBLowTof",
228 "TrackerHitsTIBHighTof",
229 "TrackerHitsTIDLowTof",
230 "TrackerHitsTIDHighTof",
231 "TrackerHitsTOBLowTof",
232 "TrackerHitsTOBHighTof",
233 "TrackerHitsPixelEndcapLowTof",
234 "TrackerHitsPixelEndcapHighTof",
235 "TrackerHitsTECLowTof",
236 "TrackerHitsTECHighTof"});
238 descriptions.
add(
"Phase2OTValidateRecHit", desc);
const TrackerTopology * tTopo_
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 fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
#define DEFINE_FWK_MODULE(type)
const double simtrackminpt_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
tuple key
prepare the HTCondor submission files and eventually submit them
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
ModuleType getDetectorType(DetId) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const TrackerGeometry * tkGeom_
Phase2OTValidateRecHit(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > tokenRecHitsOT_
T getParameter(std::string const &) const
edm::ParameterSet config_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
void fillOTHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
~Phase2OTValidateRecHit() override
std::vector< SimTrack > SimTrackContainer
std::map< std::string, RecHitME > layerMEs_
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_