CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MaskedMeasurementTrackerEventProducer.cc
Go to the documentation of this file.
7 
9 public:
12 
13 private:
14  void produce(edm::Event &, const edm::EventSetup &) override;
15 
19 
21 
24 
28 };
29 
31  : src_(consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("src"))),
32  skipClusters_(false),
33  phase2skipClusters_(false) {
34  //FIXME:temporary solution in order to use this class for both phase0/1 and phase2
35  if (iConfig.existsAs<edm::InputTag>("clustersToSkip")) {
36  skipClusters_ = true;
37  edm::InputTag clustersToSkip = iConfig.getParameter<edm::InputTag>("clustersToSkip");
38  maskPixels_ = consumes<PixelMask>(clustersToSkip);
39  maskStrips_ = consumes<StripMask>(clustersToSkip);
40  }
41  if (iConfig.existsAs<edm::InputTag>("phase2clustersToSkip")) {
42  phase2skipClusters_ = true;
43  edm::InputTag phase2clustersToSkip = iConfig.getParameter<edm::InputTag>("phase2clustersToSkip");
44  maskPixels_ = consumes<PixelMask>(phase2clustersToSkip);
45  maskPhase2OTs_ = consumes<Phase2OTMask>(phase2clustersToSkip);
46  }
47  produces<MeasurementTrackerEvent>();
48 }
49 
52  iEvent.getByToken(src_, mte);
53 
54  // prepare output
55  std::unique_ptr<MeasurementTrackerEvent> out;
56 
57  if (skipClusters_) {
58  edm::Handle<PixelMask> maskPixels;
59  iEvent.getByToken(maskPixels_, maskPixels);
60  edm::Handle<StripMask> maskStrips;
61  iEvent.getByToken(maskStrips_, maskStrips);
62 
63  out = std::make_unique<MeasurementTrackerEvent>(*mte, *maskStrips, *maskPixels);
64 
65  } else if (phase2skipClusters_) {
66  edm::Handle<PixelMask> maskPixels;
67  iEvent.getByToken(maskPixels_, maskPixels);
68  edm::Handle<Phase2OTMask> maskPhase2OTs;
69  iEvent.getByToken(maskPhase2OTs_, maskPhase2OTs);
70 
71  out = std::make_unique<MeasurementTrackerEvent>(*mte, *maskPixels, *maskPhase2OTs);
72  }
73 
74  // put into event
75  iEvent.put(std::move(out));
76 }
77 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< MeasurementTrackerEvent > src_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MaskedMeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:224
tuple phase2clustersToSkip
def move
Definition: eostools.py:511
#define dso_hidden
Definition: Visibility.h:12
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ContainerMask< edmNew::DetSetVector< Phase2TrackerCluster1D > > Phase2OTMask
edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMask
tuple clustersToSkip
edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMask