CMS 3D CMS Logo

MaskedMeasurementTrackerEventProducer.cc
Go to the documentation of this file.
7 
9 public:
12 private:
13  void produce(edm::Event&, const edm::EventSetup&) override;
14 
18 
20 
24 
27 };
28 
29 
31  src_(consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("src")))
32 {
33  //FIXME:temporary solution in order to use this class for both phase0/1 and phase2
34  if (iConfig.existsAs<edm::InputTag>("clustersToSkip")) {
35  skipClusters_ = true;
36  edm::InputTag clustersToSkip = iConfig.getParameter<edm::InputTag>("clustersToSkip");
37  maskPixels_ = consumes<PixelMask>(clustersToSkip);
38  maskStrips_ = consumes<StripMask>(clustersToSkip);
39  }
40  if (iConfig.existsAs<edm::InputTag>("phase2clustersToSkip")) {
41  phase2skipClusters_ = true;
42  edm::InputTag phase2clustersToSkip = iConfig.getParameter<edm::InputTag>("phase2clustersToSkip");
43  maskPixels_ = consumes<PixelMask>(phase2clustersToSkip);
44  maskPhase2OTs_ = consumes<Phase2OTMask>(phase2clustersToSkip);
45  }
46  produces<MeasurementTrackerEvent>();
47 }
48 
49 void
51 {
53  iEvent.getByToken(src_, mte);
54 
55  // prepare output
56  std::unique_ptr<MeasurementTrackerEvent> out;
57 
58  if (skipClusters_) {
59 
60  edm::Handle<PixelMask> maskPixels;
61  iEvent.getByToken(maskPixels_, maskPixels);
62  edm::Handle<StripMask> maskStrips;
63  iEvent.getByToken(maskStrips_, maskStrips);
64 
65  out = std::make_unique<MeasurementTrackerEvent>(*mte, *maskStrips, *maskPixels);
66 
67  } else if (phase2skipClusters_) {
68 
69  edm::Handle<PixelMask> maskPixels;
70  iEvent.getByToken(maskPixels_, maskPixels);
71  edm::Handle<Phase2OTMask> maskPhase2OTs;
72  iEvent.getByToken(maskPhase2OTs_, maskPhase2OTs);
73 
74  out = std::make_unique<MeasurementTrackerEvent>(*mte, *maskPixels, *maskPhase2OTs);
75  }
76 
77  // put into event
78  iEvent.put(std::move(out));
79 }
80 
T getParameter(std::string const &) const
#define dso_hidden
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< MeasurementTrackerEvent > src_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
virtual void produce(Event &, EventSetup const &)=0
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MaskedMeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:230
edm::ContainerMask< edmNew::DetSetVector< Phase2TrackerCluster1D > > Phase2OTMask
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMask
HLT enums.
def move(src, dest)
Definition: eostools.py:510
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMask