CMS 3D CMS Logo

VectorHitBuilderEDProducer.cc
Go to the documentation of this file.
6 
12 
15 
17 public:
19  ~VectorHitBuilderEDProducer() override = default;
20  void produce(edm::Event&, const edm::EventSetup&) override;
24  VectorHitCollection& outputAcc,
25  VectorHitCollection& outputRej);
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27  const VectorHitBuilderAlgorithm* algo() const { return stubsBuilder_; }
28 
29 private:
32  unsigned int maxOfflinestubs_;
35 };
36 
38  : offlinestubsTag_(conf.getParameter<std::string>("offlinestubs")),
39  maxOfflinestubs_(conf.getParameter<int>("maxVectorHits")),
40  stubsBuilderToken_(esConsumes(conf.getParameter<edm::ESInputTag>("Algorithm"))) {
42  consumes<edmNew::DetSetVector<Phase2TrackerCluster1D>>(edm::InputTag(conf.getParameter<std::string>("Clusters")));
43 
44  produces<edmNew::DetSetVector<Phase2TrackerCluster1D>>("accepted");
45  produces<edmNew::DetSetVector<Phase2TrackerCluster1D>>("rejected");
46  produces<VectorHitCollection>("accepted");
47  produces<VectorHitCollection>("rejected");
48 }
49 
51  LogDebug("VectorHitBuilderEDProducer") << "VectorHitBuilderEDProducer::produce() begin";
52 
53  // get input clusters data
54  auto clustersHandle = event.getHandle(clusterProducer_);
55  // create the final output collection
56  auto outputClustersAccepted = std::make_unique<edmNew::DetSetVector<Phase2TrackerCluster1D>>();
57  auto outputClustersRejected = std::make_unique<edmNew::DetSetVector<Phase2TrackerCluster1D>>();
58  std::unique_ptr<VectorHitCollection> outputVHAccepted(new VectorHitCollection());
59  std::unique_ptr<VectorHitCollection> outputVHRejected(new VectorHitCollection());
60 
62 #ifdef EDM_ML_DEBUG
63  // check on the input clusters
64  stubsBuilder_->printClusters(*clustersHandle);
65 #endif //EDM_ML_DEBUG
66 
67  // running the stub building algorithm
68  //ERICA::output should be moved in the different algo classes?
69  run(clustersHandle, *outputClustersAccepted, *outputClustersRejected, *outputVHAccepted, *outputVHRejected);
70 #ifdef EDM_ML_DEBUG
71  unsigned int numberOfVectorHits = 0;
72  for (const auto& dSViter : *outputVHAccepted) {
73  for (const auto& vh : dSViter) {
74  numberOfVectorHits++;
75  LogDebug("VectorHitBuilderEDProducer") << "\t vectorhit in output " << vh;
76  }
77  }
78  LogDebug("VectorHitBuilderEDProducer") << "found\n" << numberOfVectorHits << " .\n";
79 #endif //EDM_ML_DEBUG
80  // write output to file
81  event.put(std::move(outputClustersAccepted), "accepted");
82  event.put(std::move(outputClustersRejected), "rejected");
83  event.put(std::move(outputVHAccepted), "accepted");
84  event.put(std::move(outputVHRejected), "rejected");
85 }
86 
90  VectorHitCollection& outputAcc,
91  VectorHitCollection& outputRej) {
92  stubsBuilder_->run(clusters, outputAcc, outputRej, clustersAcc, clustersRej);
93 }
96  desc.add<std::string>("offlinestubs", "vectorHits");
97  desc.add<int>("maxVectorHits", 999999999);
98  desc.add<edm::ESInputTag>("Algorithm", edm::ESInputTag("", "SiPhase2VectorHitMatcher"));
99  desc.add<edm::ESInputTag>("CPE", edm::ESInputTag("phase2StripCPEESProducer", "Phase2StripCPE"));
100  desc.add<std::vector<double>>("BarrelCut",
101  {
102  0.0,
103  0.05,
104  0.06,
105  0.08,
106  0.09,
107  0.12,
108  0.2,
109  });
110  desc.add<std::string>("Clusters", "siPhase2Clusters");
111  desc.add<int>("maxVectorHitsInAStack", 999);
112  desc.add<std::vector<double>>("EndcapCut",
113  {
114  0.0,
115  0.1,
116  0.1,
117  0.1,
118  0.1,
119  0.1,
120  });
121  descriptions.add("siPhase2VectorHits", desc);
122 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const VectorHitBuilderAlgorithm * algo() const
edm::ESGetToken< VectorHitBuilderAlgorithm, TkPhase2OTCPERecord > stubsBuilderToken_
const VectorHitBuilderAlgorithm * stubsBuilder_
void run(edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D >> clusters, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersAcc, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersRej, VectorHitCollection &outputAcc, VectorHitCollection &outputRej)
VectorHitBuilderEDProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void printClusters(const edmNew::DetSetVector< Phase2TrackerCluster1D > &clusters) const
bool getData(T &iHolder) const
Definition: EventSetup.h:122
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
void produce(edm::Event &, const edm::EventSetup &) override
void run(edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D >> clusters, VectorHitCollection &vhAcc, VectorHitCollection &vhRej, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersAcc, edmNew::DetSetVector< Phase2TrackerCluster1D > &clustersRej) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edmNew::DetSetVector< VectorHit > VectorHitCollection
Definition: VectorHit.h:154
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > clusterProducer_
HLT enums.
~VectorHitBuilderEDProducer() override=default
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
#define LogDebug(id)