CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Phase2TrackerClusterizer Class Reference
Inheritance diagram for Phase2TrackerClusterizer:
edm::stream::EDProducer<>

Public Member Functions

 Phase2TrackerClusterizer (const edm::ParameterSet &conf)
 
void produce (edm::Event &event, const edm::EventSetup &eventSetup) override
 
 ~Phase2TrackerClusterizer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 32 of file Phase2TrackerClusterizer.cc.

Constructor & Destructor Documentation

Phase2TrackerClusterizer::Phase2TrackerClusterizer ( const edm::ParameterSet conf)
explicit

Definition at line 52 of file Phase2TrackerClusterizer.cc.

52  :
53 #ifdef VERIFY_PH2_TK_CLUS
54  clusterizer_(new Phase2TrackerClusterizerAlgorithm(conf.getParameter< unsigned int >("maxClusterSize"), conf.getParameter< unsigned int >("maxNumberClusters"))),
55 #endif
57  produces< Phase2TrackerCluster1DCollectionNew >();
58  }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
Phase2TrackerClusterizer::~Phase2TrackerClusterizer ( )
override

Definition at line 60 of file Phase2TrackerClusterizer.cc.

60 { }

Member Function Documentation

void Phase2TrackerClusterizer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 66 of file Phase2TrackerClusterizer.cc.

References edmNew::DetSetVector< T >::FastFiller::abort(), patPFMETCorrections_cff::algo, GetRecoTauVFromDQM_MC_cff::cl, fastPrimaryVertexProducer_cfi::clusters, gather_cfg::cout, SimDataFormats::CaloAnalysis::cp, DEFINE_FWK_MODULE, edm::EventSetup::get(), mps_fire::i, TrackerGeometry::idToDetUnit(), createfilelist::int, eostools::move(), token_, and mitigatedMETSequence_cff::U.

66  {
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  if (!clusters.empty()) {
93  auto cp = clusters[0].column();
94  auto sp = clusters[0].firstStrip();
95  for (auto const & cl : clusters) {
96  if (cl.column()<cp) std::cout << "column not in order! " << std::endl;
97  if (cl.column()==cp && cl.firstStrip()<sp) std::cout << "strip not in order! " << std::endl;
98  cp = cl.column();
99  sp = cl.firstStrip();
100  }
101  }
102 #endif
103 
104 #ifdef VERIFY_PH2_TK_CLUS
105  // Geometry
106  const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
107  const PixelGeomDetUnit* pixDet = dynamic_cast< const PixelGeomDetUnit* >(geomDetUnit);
108  if (!pixDet) assert(0);
109 
110  // Container for the clusters that will be produced for this modules
111  Phase2TrackerCluster1DCollectionNew::FastFiller clustersOld(*outputClustersOld, DSViter.detId());
112 
113  // Setup the clusterizer algorithm for this detector (see ClusterizerAlgorithm for more details)
114  clusterizer_->setup(pixDet);
115 
116  // Pass the list of Digis to the main algorithm
117  // This function will store the clusters in the previously created container
118  clusterizer_->clusterizeDetUnit(DSViter, clustersOld);
119  if (clustersOld.empty()) clustersOld.abort();
120 
121  if (clusters.size() != clustersOld.size()) {
122  std::cout << "SIZEs " << int(detId) << ' ' << clusters.size() << ' ' << clustersOld.size() << std::endl;
123  for (auto const & cl : clusters) std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
124  std::cout << "Old " << std::endl;
125  for (auto const & cl : clustersOld) std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
126  }
127 #endif
128 
129  }
130 
131 #ifdef VERIFY_PH2_TK_CLUS
132  // std::cout << "SIZEs " << outputClusters->dataSize() << ' ' << outputClustersOld->dataSize() << std::endl;
133  assert(outputClusters->dataSize()==outputClustersOld->dataSize());
134  for (auto i=0U;i<outputClusters->dataSize(); ++i) {
135  assert(outputClusters->data()[i].size() == outputClustersOld->data()[i].size());
136  assert(outputClusters->data()[i].threshold() == outputClustersOld->data()[i].threshold());
137  assert(outputClusters->data()[i].firstRow() == outputClustersOld->data()[i].firstRow());
138  assert(outputClusters->data()[i].column() == outputClustersOld->data()[i].column());
139  }
140 #endif
141 
142  // Add the data to the output
143  outputClusters->shrink_to_fit();
144  event.put(std::move(outputClusters));
145  }
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
Definition: DetId.h:18
T get() const
Definition: EventSetup.h:62
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > Phase2TrackerClusterizer::token_
private

Definition at line 43 of file Phase2TrackerClusterizer.cc.

Referenced by produce().