CMS 3D CMS Logo

GEMCSCSegmentProducer.cc
Go to the documentation of this file.
1 
7 
11 
15 
19 
21  : kCSCGeometryToken_(esConsumes<CSCGeometry, MuonGeometryRecord>()),
22  kGEMGeometryToken_(esConsumes<GEMGeometry, MuonGeometryRecord>()),
23  kCSCSegmentCollectionToken_(consumes<CSCSegmentCollection>(pas.getParameter<edm::InputTag>("inputObjectsCSC"))),
24  kGEMRecHitCollectionToken_(consumes<GEMRecHitCollection>(pas.getParameter<edm::InputTag>("inputObjectsGEM"))),
25  iev(0) {
26  segmentBuilder_ = new GEMCSCSegmentBuilder(pas); // pass on the parameterset
27 
28  // register what this produces
29  produces<GEMCSCSegmentCollection>();
30 }
31 
33  LogDebug("GEMCSCSegment") << "deleting GEMCSCSegmentBuilder after " << iev << " events w/ gem and csc data.";
34  delete segmentBuilder_;
35 }
36 
38  LogDebug("GEMCSCSegment") << "start producing segments for " << ++iev << "th event w/ gem and csc data";
39 
40  // find the geometry (& conditions?) for this event & cache it in the builder
41  const auto cscg = setup.getHandle(kCSCGeometryToken_);
42  if (not cscg.isValid()) {
43  edm::LogError("GEMCSCSegment") << "invalid CSCGeometry";
44  return;
45  }
46  const CSCGeometry* cgeom = &*cscg;
47 
48  const auto gemg = setup.getHandle(kGEMGeometryToken_);
49  if (not gemg.isValid()) {
50  edm::LogError("GEMCSCSegment") << "invalid GEMGeometry";
51  return;
52  }
53  const GEMGeometry* ggeom = &*gemg;
54 
55  // cache the geometry in the builder
56  segmentBuilder_->setGeometry(ggeom, cgeom);
57 
58  // fill the map with matches between GEM and CSC chambers
60 
61  // get the collection of CSCSegment and GEMRecHits
62  const auto cscSegment = ev.getHandle(kCSCSegmentCollectionToken_);
63  if (not cscSegment.isValid()) {
64  edm::LogError("GEMCSCSegment") << "invalid CSCSegmentCollection";
65  return;
66  }
67 
68  const auto gemRecHits = ev.getHandle(kGEMRecHitCollectionToken_);
69  if (not gemRecHits.isValid()) {
70  edm::LogError("GEMCSCSegment") << "invalid GEMRecHitCollection";
71  return;
72  }
73 
74  // create empty collection of GEMCSC Segments
75  auto oc = std::make_unique<GEMCSCSegmentCollection>();
76 
77  // pass the empty collection of GEMCSC Segments and fill it
78  segmentBuilder_->build(gemRecHits.product(), cscSegment.product(), *oc); //@@ FILL oc
79 
80  // put the filled collection in event
81  ev.put(std::move(oc));
82 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
GEMCSCSegmentBuilder * segmentBuilder_
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > kGEMGeometryToken_
void LinkGEMRollsToCSCChamberIndex(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)
const edm::EDGetTokenT< GEMRecHitCollection > kGEMRecHitCollectionToken_
GEMCSCSegmentProducer(const edm::ParameterSet &)
Constructor.
Log< level::Error, false > LogError
~GEMCSCSegmentProducer() override
Destructor.
void build(const GEMRecHitCollection *rechits, const CSCSegmentCollection *cscsegments, GEMCSCSegmentCollection &oc)
void produce(edm::Event &, const edm::EventSetup &) override
Produce the GEM-CSCSegment collection.
HitContainer const *__restrict__ TkSoA const *__restrict__ Quality const *__restrict__ CAHitNtupletGeneratorKernelsGPU::HitToTuple const *__restrict__ int32_t int32_t int iev
HLT enums.
const edm::EDGetTokenT< CSCSegmentCollection > kCSCSegmentCollectionToken_
void setGeometry(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)
def move(src, dest)
Definition: eostools.py:511
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > kCSCGeometryToken_
#define LogDebug(id)