File indexing completed on 2024-04-06 12:22:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "L1Trigger/TrackTrigger/plugins/TTClusterBuilder.h"
0011
0012
0013 template <>
0014 void TTClusterBuilder<Ref_Phase2TrackerDigi_>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0015
0016 auto ttClusterDSVForOutput = std::make_unique<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>();
0017 std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>> rawHits;
0018 this->RetrieveRawHits(rawHits, iEvent);
0019
0020
0021 const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken);
0022 const TrackerGeometry* const theTrackerGeom = &iSetup.getData(tGeomToken);
0023 auto const& theClusterFindingAlgo = iSetup.getData(theClusterFindingAlgoToken);
0024
0025
0026 for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
0027 DetId detid = (*gd)->geographicalId();
0028 if (detid.subdetId() == 1 || detid.subdetId() == 2)
0029 continue;
0030 if (!tTopo->isLower(detid))
0031 continue;
0032 DetId lowerDetid = detid;
0033 DetId upperDetid = tTopo->partnerDetId(detid);
0034
0035
0036
0037 std::vector<std::vector<Ref_Phase2TrackerDigi_>> lowerHits, upperHits;
0038
0039
0040 typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator lowerHitFind =
0041 rawHits.find(lowerDetid);
0042 typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator upperHitFind =
0043 rawHits.find(upperDetid);
0044
0045
0046
0047
0048 bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid) == TrackerGeometry::ModuleType::Ph2PSP);
0049 if (lowerHitFind != rawHits.end())
0050 theClusterFindingAlgo.Cluster(lowerHits, lowerHitFind->second, isPSP);
0051 if (upperHitFind != rawHits.end())
0052 theClusterFindingAlgo.Cluster(upperHits, upperHitFind->second, false);
0053
0054
0055
0056 {
0057 edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller lowerOutputFiller(*ttClusterDSVForOutput,
0058 lowerDetid);
0059 for (unsigned int i = 0; i < lowerHits.size(); i++) {
0060 TTCluster<Ref_Phase2TrackerDigi_> temp(lowerHits.at(i), lowerDetid, 0, storeLocalCoord);
0061 lowerOutputFiller.push_back(temp);
0062 }
0063 if (lowerOutputFiller.empty())
0064 lowerOutputFiller.abort();
0065 }
0066 {
0067 edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller upperOutputFiller(*ttClusterDSVForOutput,
0068 upperDetid);
0069 for (unsigned int i = 0; i < upperHits.size(); i++) {
0070 TTCluster<Ref_Phase2TrackerDigi_> temp(upperHits.at(i), upperDetid, 1, storeLocalCoord);
0071 upperOutputFiller.push_back(temp);
0072 }
0073 if (upperOutputFiller.empty())
0074 upperOutputFiller.abort();
0075 }
0076 }
0077
0078
0079 iEvent.put(std::move(ttClusterDSVForOutput), "ClusterInclusive");
0080 }
0081
0082
0083 template <>
0084 void TTClusterBuilder<Ref_Phase2TrackerDigi_>::RetrieveRawHits(
0085 std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>& mRawHits, const edm::Event& iEvent) {
0086 mRawHits.clear();
0087
0088 std::vector<edm::EDGetTokenT<edm::DetSetVector<Phase2TrackerDigi>>>::iterator it;
0089 for (it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it) {
0090
0091 edm::Handle<edm::DetSetVector<Phase2TrackerDigi>> HitHandle;
0092 iEvent.getByToken(*it, HitHandle);
0093 edm::DetSetVector<Phase2TrackerDigi>::const_iterator detsIter;
0094 edm::DetSet<Phase2TrackerDigi>::const_iterator hitsIter;
0095
0096
0097 for (detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++) {
0098 DetId id = detsIter->id;
0099 for (hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++) {
0100 mRawHits[id].push_back(edm::makeRefTo(HitHandle, id, hitsIter));
0101 }
0102 }
0103 }
0104 }