CMS 3D CMS Logo

MTDTrackingRecHitProducer.cc
Go to the documentation of this file.
6 
9 
16 
19 
21 
23 public:
24  explicit MTDTrackingRecHitProducer(const edm::ParameterSet& ps);
25  ~MTDTrackingRecHitProducer() override = default;
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28  void produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const override;
29 
30 private:
31  const edm::EDGetTokenT<FTLClusterCollection> ftlbClusters_; // collection of barrel digis
32  const edm::EDGetTokenT<FTLClusterCollection> ftleClusters_; // collection of endcap digis
33 
36 };
37 
39  : ftlbClusters_(consumes<FTLClusterCollection>(ps.getParameter<edm::InputTag>("barrelClusters"))),
40  ftleClusters_(consumes<FTLClusterCollection>(ps.getParameter<edm::InputTag>("endcapClusters"))),
42  cpeToken_(esConsumes<MTDClusterParameterEstimator, MTDCPERecord>(edm::ESInputTag("", "MTDCPEBase"))) {
43  produces<MTDTrackingDetSetVector>();
44 }
45 
46 // Configuration descriptions
49  desc.add<edm::InputTag>("barrelClusters", edm::InputTag("mtdClusters:FTLBarrel"));
50  desc.add<edm::InputTag>("endcapClusters", edm::InputTag("mtdClusters:FTLEndcap"));
51  descriptions.add("mtdTrackingRecHitProducer", desc);
52 }
53 
55  auto const& geom = es.getData(mtdgeoToken_);
56 
57  auto const& cpe = es.getData(cpeToken_);
58 
60  evt.getByToken(ftlbClusters_, inputBarrel);
61 
63  evt.getByToken(ftleClusters_, inputEndcap);
64 
65  std::array<edm::Handle<FTLClusterCollection>, 2> inputHandle{{inputBarrel, inputEndcap}};
66 
67  auto outputhits = std::make_unique<MTDTrackingDetSetVector>();
68  auto& theoutputhits = *outputhits;
69 
70  //---------------------------------------------------------------------------
73  //---------------------------------------------------------------------------
74 
75  for (auto const& theInput : inputHandle) {
76  const edmNew::DetSetVector<FTLCluster>& input = *theInput;
77 
78  LogDebug("MTDTrackingRecHitProducer") << "inputCollection " << input.size();
79  for (const auto& DSVit : input) {
80  unsigned int detid = DSVit.detId();
81  DetId detIdObject(detid);
82  const auto genericDet = geom.idToDetUnit(detIdObject);
83  if (genericDet == nullptr) {
84  throw cms::Exception("MTDTrackingRecHitProducer")
85  << "GeographicalID: " << std::hex << detid << " is invalid!" << std::dec << std::endl;
86  }
87 
88  MTDTrackingDetSetVector::FastFiller recHitsOnDet(theoutputhits, detid);
89 
90  for (const auto& clustIt : DSVit) {
91  LogDebug("MTDTrackingRcHitProducer") << "Cluster: size " << clustIt.size() << " " << clustIt.x() << ","
92  << clustIt.y() << " " << clustIt.energy() << " " << clustIt.time();
93  MTDClusterParameterEstimator::ReturnType tuple = cpe.getParameters(clustIt, *genericDet);
94  LocalPoint lp(std::get<0>(tuple));
95  LocalError le(std::get<1>(tuple));
96 
97  // Create a persistent edm::Ref to the cluster
99  // Make a RecHit and add it to the DetSet
100  MTDTrackingRecHit hit(lp, le, *genericDet, cluster);
101  LogDebug("MTDTrackingRcHitProducer")
102  << "MTD_TRH: " << hit.localPosition().x() << "," << hit.localPosition().y() << " : "
103  << hit.localPositionError().xx() << "," << hit.localPositionError().yy() << " : " << hit.time() << " : "
104  << hit.timeError();
105  // Now save it =================
106  recHitsOnDet.push_back(hit);
107  } // <-- End loop on Clusters
108  } // <-- End loop on DetUnits
109  LogDebug("MTDTrackingRcHitProducer") << "outputCollection " << theoutputhits.size();
110  }
111 
112  evt.put(std::move(outputhits));
113 }
114 
ConfigurationDescriptions.h
MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
edm::StreamID
Definition: StreamID.h:30
MTDTrackingRecHitProducer
Definition: MTDTrackingRecHitProducer.cc:22
Handle.h
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
MTDClusterParameterEstimator::ReturnType
std::tuple< LocalPoint, LocalError, TimeValue, TimeValueError > ReturnType
Definition: MTDClusterParameterEstimator.h:25
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
MTDCPERecord
Definition: MTDCPERecord.h:10
ESInputTag
MTDCPERecord.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
FTLCluster
Definition: FTLCluster.h:20
edm
HLT enums.
Definition: AlignableModifier.h:19
MTDTrackingRecHitProducer::~MTDTrackingRecHitProducer
~MTDTrackingRecHitProducer() override=default
MTDTrackingRecHitProducer::ftleClusters_
const edm::EDGetTokenT< FTLClusterCollection > ftleClusters_
Definition: MTDTrackingRecHitProducer.cc:32
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edmNew::makeRefTo
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
Definition: DetSetVectorNew.h:704
MTDGeometry.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MeasurementError.h
MTDDigiGeometryRecord.h
MTDTrackingRecHitProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MTDTrackingRecHitProducer.cc:47
edmNew::DetSetVector::FastFiller::push_back
void push_back(data_type const &d)
Definition: DetSetVectorNew.h:283
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
MTDTrackingRecHitProducer::produce
void produce(edm::StreamID, edm::Event &evt, const edm::EventSetup &es) const override
Definition: MTDTrackingRecHitProducer.cc:54
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
MTDClusterParameterEstimator
Definition: MTDClusterParameterEstimator.h:15
DetId
Definition: DetId.h:17
MTDTrackingRecHitProducer::mtdgeoToken_
const edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
Definition: MTDTrackingRecHitProducer.cc:34
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
Point3DBase< float, LocalTag >
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
MTDTrackingRecHit.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
LocalError
Definition: LocalError.h:12
MTDTrackingRecHit
A 2D TrackerRecHit with time and time error information.
Definition: MTDTrackingRecHit.h:10
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
MeasurementPoint.h
MTDTrackingRecHitProducer::ftlbClusters_
const edm::EDGetTokenT< FTLClusterCollection > ftlbClusters_
Definition: MTDTrackingRecHitProducer.cc:31
edm::EventSetup
Definition: EventSetup.h:58
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
MTDGeometry
Definition: MTDGeometry.h:14
edmNew::DetSetVector
Definition: DetSetNew.h:13
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Exception
Definition: hltDiff.cc:245
EventSetup.h
MTDClusterParameterEstimator.h
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
ParameterSet.h
EDProducer.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
FTLClusterCollections.h
MTDTrackingRecHitProducer::cpeToken_
const edm::ESGetToken< MTDClusterParameterEstimator, MTDCPERecord > cpeToken_
Definition: MTDTrackingRecHitProducer.cc:35
Topology.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MTDTrackingRecHitProducer::MTDTrackingRecHitProducer
MTDTrackingRecHitProducer(const edm::ParameterSet &ps)
Definition: MTDTrackingRecHitProducer.cc:38