CMS 3D CMS Logo

MTDTrackingRecHitProducer.cc
Go to the documentation of this file.
6 
9 
16 
19 
21 
22 //#define DEBUG_ENABLED
23 #ifdef DEBUG_ENABLED
24 #define DEBUG(x) \
25  do { \
26  std::cout << x << std::endl; \
27  } while (0)
28 #else
29 #define DEBUG(x)
30 #endif
31 
33 public:
34  explicit MTDTrackingRecHitProducer(const edm::ParameterSet& ps);
35  ~MTDTrackingRecHitProducer() override = default;
36  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
37 
38  void produce(edm::Event& evt, const edm::EventSetup& es) override;
40 
41 private:
42  const edm::EDGetTokenT<FTLClusterCollection> ftlbClusters_; // collection of barrel digis
43  const edm::EDGetTokenT<FTLClusterCollection> ftleClusters_; // collection of endcap digis
44 
47 };
48 
50  : ftlbClusters_(consumes<FTLClusterCollection>(ps.getParameter<edm::InputTag>("barrelClusters"))),
51  ftleClusters_(consumes<FTLClusterCollection>(ps.getParameter<edm::InputTag>("endcapClusters"))) {
52  produces<MTDTrackingDetSetVector>();
53 }
54 
55 // Configuration descriptions
58  desc.add<edm::InputTag>("barrelClusters", edm::InputTag("mtdClusters:FTLBarrel"));
59  desc.add<edm::InputTag>("endcapClusters", edm::InputTag("mtdClusters:FTLEndcap"));
60  descriptions.add("mtdTrackingRecHitProducer", desc);
61 }
62 
66  geom_ = geom.product();
67 
69  es.get<MTDCPERecord>().get("MTDCPEBase", cpe);
70  cpe_ = cpe.product();
71 
73  evt.getByToken(ftlbClusters_, inputBarrel);
74 
76  evt.getByToken(ftleClusters_, inputEndcap);
77 
78  auto outputhits = std::make_unique<MTDTrackingDetSetVector>();
79  auto& theoutputhits = *outputhits;
80 
81  run(inputBarrel, theoutputhits);
82  run(inputEndcap, theoutputhits);
83 
84  evt.put(std::move(outputhits));
85 }
86 
87 //---------------------------------------------------------------------------
90 //---------------------------------------------------------------------------
92  const edmNew::DetSetVector<FTLCluster>& input = *inputHandle;
94 
95  DEBUG("inputCollection " << input.size());
96  for (; DSViter != input.end(); DSViter++) {
97  unsigned int detid = DSViter->detId();
98  DetId detIdObject(detid);
99  const auto genericDet = geom_->idToDetUnit(detIdObject);
100  if (genericDet == nullptr) {
101  throw cms::Exception("MTDTrackingRecHitProducer")
102  << "GeographicalID: " << std::hex << detid << " is invalid!" << std::dec << std::endl;
103  }
104 
105  MTDTrackingDetSetVector::FastFiller recHitsOnDet(output, detid);
106 
107  edmNew::DetSet<FTLCluster>::const_iterator clustIt = DSViter->begin(), clustEnd = DSViter->end();
108 
109  for (; clustIt != clustEnd; clustIt++) {
110  DEBUG("Cluster: size " << clustIt->size() << " " << clustIt->x() << "," << clustIt->y() << " "
111  << clustIt->energy() << " " << clustIt->time());
112  MTDClusterParameterEstimator::ReturnType tuple = cpe_->getParameters(*clustIt, *genericDet);
113  LocalPoint lp(std::get<0>(tuple));
114  LocalError le(std::get<1>(tuple));
115 
116  // Create a persistent edm::Ref to the cluster
118  // Make a RecHit and add it to the DetSet
119  MTDTrackingRecHit hit(lp, le, *genericDet, cluster);
120  DEBUG("MTD_TRH: " << hit.localPosition().x() << "," << hit.localPosition().y() << " : "
121  << hit.localPositionError().xx() << "," << hit.localPositionError().yy() << " : " << hit.time()
122  << " : " << hit.timeError());
123  // Now save it =================
124  recHitsOnDet.push_back(hit);
125  } // <-- End loop on Clusters
126  } // <-- End loop on DetUnits
127  DEBUG("outputCollection " << output.size());
128 }
129 
ConfigurationDescriptions.h
MTDDigiGeometryRecord
Definition: MTDDigiGeometryRecord.h:15
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
MTDTrackingRecHitProducer
Definition: MTDTrackingRecHitProducer.cc:32
MTDTrackingRecHitProducer::geom_
const MTDGeometry * geom_
Definition: MTDTrackingRecHitProducer.cc:45
Handle.h
DEBUG
#define DEBUG(x)
Definition: MTDTrackingRecHitProducer.cc:29
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
MTDCPERecord.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT
Definition: EDGetToken.h:33
FTLCluster
Definition: FTLCluster.h:21
edm
HLT enums.
Definition: AlignableModifier.h:19
MTDTrackingRecHitProducer::~MTDTrackingRecHitProducer
~MTDTrackingRecHitProducer() override=default
MTDTrackingRecHitProducer::ftleClusters_
const edm::EDGetTokenT< FTLClusterCollection > ftleClusters_
Definition: MTDTrackingRecHitProducer.cc:43
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
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:689
MTDGeometry.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
MeasurementError.h
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
MTDDigiGeometryRecord.h
EDProducer.h
edmNew::DetSetVector::begin
const_iterator begin(bool update=false) const
Definition: DetSetVectorNew.h:530
MTDTrackingRecHitProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MTDTrackingRecHitProducer.cc:56
edmNew::DetSetVector::FastFiller::push_back
void push_back(data_type const &d)
Definition: DetSetVectorNew.h:274
edm::Handle
Definition: AssociativeIterator.h:50
MTDGeometry::idToDetUnit
const MTDGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: MTDGeometry.cc:163
edm::Ref
Definition: AssociativeIterator.h:58
edmNew::DetSet::size
size_type size() const
Definition: DetSetNew.h:68
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
MTDClusterParameterEstimator
Definition: MTDClusterParameterEstimator.h:15
DetId
Definition: DetId.h:17
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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
edm::ESHandle
Definition: DTSurvey.h:22
MTDTrackingRecHitProducer::produce
void produce(edm::Event &evt, const edm::EventSetup &es) override
Definition: MTDTrackingRecHitProducer.cc:63
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
Point3DBase< float, LocalTag >
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
MTDTrackingRecHit.h
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:42
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
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
MTDTrackingRecHitProducer::cpe_
const MTDClusterParameterEstimator * cpe_
Definition: MTDTrackingRecHitProducer.cc:46
MTDClusterParameterEstimator::getParameters
virtual ReturnType getParameters(const FTLCluster &cl, const GeomDetUnit &det) const =0
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:535
Exception
Definition: hltDiff.cc:246
EventSetup.h
MTDClusterParameterEstimator.h
MTDTrackingRecHitProducer::run
void run(edm::Handle< edmNew::DetSetVector< FTLCluster > > inputHandle, MTDTrackingDetSetVector &output)
Definition: MTDTrackingRecHitProducer.cc:91
edmNew::DetSetVector::FastFiller
Definition: DetSetVectorNew.h:202
ParameterSet.h
edm::Event
Definition: Event.h:73
FTLClusterCollections.h
Topology.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
MTDTrackingRecHitProducer::MTDTrackingRecHitProducer
MTDTrackingRecHitProducer(const edm::ParameterSet &ps)
Definition: MTDTrackingRecHitProducer.cc:49
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31