test
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 
12 #ifdef VERIFY_PH2_TK_CLUS
14 #endif
16 
21 
26 
27 #include <vector>
28 #include <memory>
29 
30 
31 
33 
34  public:
35  explicit Phase2TrackerClusterizer(const edm::ParameterSet& conf);
36  virtual ~Phase2TrackerClusterizer();
37  virtual void produce(edm::Event& event, const edm::EventSetup& eventSetup) override;
38 
39  private:
40 #ifdef VERIFY_PH2_TK_CLUS
41  std::unique_ptr< Phase2TrackerClusterizerAlgorithm > clusterizer_;
42 #endif
44 
45 };
46 
47 
48  /*
49  * Initialise the producer
50  */
51 
53 #ifdef VERIFY_PH2_TK_CLUS
54  clusterizer_(new Phase2TrackerClusterizerAlgorithm(conf.getParameter< unsigned int >("maxClusterSize"), conf.getParameter< unsigned int >("maxNumberClusters"))),
55 #endif
56  token_(consumes< edm::DetSetVector< Phase2TrackerDigi > >(conf.getParameter<edm::InputTag>("src"))) {
57  produces< Phase2TrackerCluster1DCollectionNew >();
58  }
59 
61 
62  /*
63  * Clusterize the events
64  */
65 
67 
68  // Get the Digis
70  event.getByToken(token_, digis);
71 
72 #ifdef VERIFY_PH2_TK_CLUS
73  // Get the geometry
75  eventSetup.get< TrackerDigiGeometryRecord >().get(geomHandle);
76  const TrackerGeometry* tkGeom(&(*geomHandle));
77  // Global container for the clusters of each modules
78  auto outputClustersOld = std::make_unique<Phase2TrackerCluster1DCollectionNew>();
79 #endif
80  auto outputClusters = std::make_unique<Phase2TrackerCluster1DCollectionNew>();
81 
82  // Go over all the modules
83  for (auto DSViter : *digis) {
84  DetId detId(DSViter.detId());
85 
86  Phase2TrackerCluster1DCollectionNew::FastFiller clusters(*outputClusters, DSViter.detId());
88  algo.clusterizeDetUnit(DSViter, clusters);
89  if (clusters.empty()) clusters.abort();
90 
91 #ifdef VERIFY_PH2_TK_CLUS
92  // Geometry
93  const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
94  const PixelGeomDetUnit* pixDet = dynamic_cast< const PixelGeomDetUnit* >(geomDetUnit);
95  if (!pixDet) assert(0);
96 
97  // Container for the clusters that will be produced for this modules
98  Phase2TrackerCluster1DCollectionNew::FastFiller clustersOld(*outputClustersOld, DSViter.detId());
99 
100  // Setup the clusterizer algorithm for this detector (see ClusterizerAlgorithm for more details)
101  clusterizer_->setup(pixDet);
102 
103  // Pass the list of Digis to the main algorithm
104  // This function will store the clusters in the previously created container
105  clusterizer_->clusterizeDetUnit(DSViter, clustersOld);
106  if (clustersOld.empty()) clustersOld.abort();
107 
108  if (clusters.size() != clustersOld.size()) {
109  std::cout << "SIZEs " << int(detId) << ' ' << clusters.size() << ' ' << clustersOld.size() << std::endl;
110  for (auto const & cl : clusters) std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
111  std::cout << "Old " << std::endl;
112  for (auto const & cl : clustersOld) std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
113  }
114 #endif
115 
116  }
117 
118 #ifdef VERIFY_PH2_TK_CLUS
119  // std::cout << "SIZEs " << outputClusters->dataSize() << ' ' << outputClustersOld->dataSize() << std::endl;
120  assert(outputClusters->dataSize()==outputClustersOld->dataSize());
121  for (auto i=0U;i<outputClusters->dataSize(); ++i) {
122  assert(outputClusters->data()[i].size() == outputClustersOld->data()[i].size());
123  assert(outputClusters->data()[i].threshold() == outputClustersOld->data()[i].threshold());
124  assert(outputClusters->data()[i].firstRow() == outputClustersOld->data()[i].firstRow());
125  assert(outputClusters->data()[i].column() == outputClustersOld->data()[i].column());
126  }
127 #endif
128 
129  // Add the data to the output
130  outputClusters->shrink_to_fit();
131  event.put(std::move(outputClusters));
132  }
133 
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
assert(m_qm.get())
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
Phase2TrackerClusterizer(const edm::ParameterSet &conf)
def move
Definition: eostools.py:510
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
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
tuple cout
Definition: gather_cfg.py:145