CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Phase2TrackerClusterizer.cc
Go to the documentation of this file.
11 
13 
18 
23 
24 #include <vector>
25 #include <memory>
26 
28 
29  public:
30  explicit Phase2TrackerClusterizer(const edm::ParameterSet& conf);
31  virtual ~Phase2TrackerClusterizer();
32  void produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup& eventSetup) const override final;
33 
34  private:
35  std::unique_ptr< Phase2TrackerClusterizerAlgorithm > clusterizer_;
37 
38 };
39 
40 
41  /*
42  * Initialise the producer
43  */
44 
46  clusterizer_(new Phase2TrackerClusterizerAlgorithm(conf.getParameter< unsigned int >("maxClusterSize"), conf.getParameter< unsigned int >("maxNumberClusters"))),
47  token_(consumes< edm::DetSetVector< Phase2TrackerDigi > >(conf.getParameter<edm::InputTag>("src"))) {
48  produces< Phase2TrackerCluster1DCollectionNew >();
49  }
50 
52 
53  /*
54  * Clusterize the events
55  */
56 
58 
59  // Get the Digis
61  event.getByToken(token_, digis);
62 
63  // Get the geometry
65  eventSetup.get< TrackerDigiGeometryRecord >().get(geomHandle);
66  const TrackerGeometry* tkGeom(&(*geomHandle));
67 
68  // Global container for the clusters of each modules
69  std::auto_ptr< Phase2TrackerCluster1DCollectionNew > outputClusters(new Phase2TrackerCluster1DCollectionNew());
70 
71  // Go over all the modules
72  for (auto DSViter : *digis) {
73  DetId detId(DSViter.detId());
74 
75  // Geometry
76  const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
77  const PixelGeomDetUnit* pixDet = dynamic_cast< const PixelGeomDetUnit* >(geomDetUnit);
78  if (!pixDet) assert(0);
79 
80  // Container for the clusters that will be produced for this modules
81  Phase2TrackerCluster1DCollectionNew::FastFiller clusters(*outputClusters, DSViter.detId());
82 
83  // Setup the clusterizer algorithm for this detector (see ClusterizerAlgorithm for more details)
84  clusterizer_->setup(pixDet);
85 
86  // Pass the list of Digis to the main algorithm
87  // This function will store the clusters in the previously created container
88  clusterizer_->clusterizeDetUnit(DSViter, clusters);
89 
90  if (clusters.empty()) clusters.abort();
91  }
92 
93  // Add the data to the output
94  outputClusters->shrink_to_fit();
95  event.put(outputClusters);
96  }
97 
virtual const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edmNew::DetSetVector< Phase2TrackerCluster1D > Phase2TrackerCluster1DCollectionNew
assert(m_qm.get())
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
Phase2TrackerClusterizer(const edm::ParameterSet &conf)
std::unique_ptr< Phase2TrackerClusterizerAlgorithm > clusterizer_
void produce(edm::StreamID sid, edm::Event &event, const edm::EventSetup &eventSetup) const overridefinal
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56