CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 30 of file Phase2TrackerClusterizer.cc.

Constructor & Destructor Documentation

◆ Phase2TrackerClusterizer()

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

Definition at line 47 of file Phase2TrackerClusterizer.cc.

48  :
49 #ifdef VERIFY_PH2_TK_CLUS
50  clusterizer_(new Phase2TrackerClusterizerAlgorithm(conf.getParameter<unsigned int>("maxClusterSize"),
51  conf.getParameter<unsigned int>("maxNumberClusters"))),
52 #endif
54  produces<Phase2TrackerCluster1DCollectionNew>();
55 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_

◆ ~Phase2TrackerClusterizer()

Phase2TrackerClusterizer::~Phase2TrackerClusterizer ( )
override

Definition at line 57 of file Phase2TrackerClusterizer.cc.

57 {}

Member Function Documentation

◆ produce()

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

Definition at line 63 of file Phase2TrackerClusterizer.cc.

References edmNew::DetSetVector< T >::FastFiller::abort(), cms::cuda::assert(), haddnano::cl, bsc_activity_cfg::clusters, gather_cfg::cout, CommonMethods::cp(), hcalRecHitTable_cff::detId, options_cfi::eventSetup, mps_fire::i, TrackerGeometry::idToDetUnit(), createfilelist::int, eostools::move(), slimmedTrackExtras_cff::outputClusters, token_, and mitigatedMETSequence_cff::U.

63  {
64  // Get the Digis
66  event.getByToken(token_, digis);
67 
68 #ifdef VERIFY_PH2_TK_CLUS
69  // Get the geometry
71  eventSetup.get<TrackerDigiGeometryRecord>().get(geomHandle);
72  const TrackerGeometry* tkGeom(&(*geomHandle));
73  // Global container for the clusters of each modules
74  auto outputClustersOld = std::make_unique<Phase2TrackerCluster1DCollectionNew>();
75 #endif
76  auto outputClusters = std::make_unique<Phase2TrackerCluster1DCollectionNew>();
77 
78  // Go over all the modules
79  for (const auto& DSViter : *digis) {
80  DetId detId(DSViter.detId());
81 
84  algo.clusterizeDetUnit(DSViter, clusters);
85  if (clusters.empty())
86  clusters.abort();
87 
88 #ifdef VERIFY_PH2_TK_CLUS
89  if (!clusters.empty()) {
90  auto cp = clusters[0].column();
91  auto sp = clusters[0].firstStrip();
92  for (auto const& cl : clusters) {
93  if (cl.column() < cp)
94  std::cout << "column not in order! " << std::endl;
95  if (cl.column() == cp && cl.firstStrip() < sp)
96  std::cout << "strip not in order! " << std::endl;
97  cp = cl.column();
98  sp = cl.firstStrip();
99  }
100  }
101 #endif
102 
103 #ifdef VERIFY_PH2_TK_CLUS
104  // Geometry
105  const GeomDetUnit* geomDetUnit(tkGeom->idToDetUnit(detId));
106  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(geomDetUnit);
107  if (!pixDet)
108  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())
120  clustersOld.abort();
121 
122  if (clusters.size() != clustersOld.size()) {
123  std::cout << "SIZEs " << int(detId) << ' ' << clusters.size() << ' ' << clustersOld.size() << std::endl;
124  for (auto const& cl : clusters)
125  std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
126  std::cout << "Old " << std::endl;
127  for (auto const& cl : clustersOld)
128  std::cout << cl.size() << ' ' << cl.threshold() << ' ' << cl.firstRow() << ' ' << cl.column() << std::endl;
129  }
130 #endif
131  }
132 
133 #ifdef VERIFY_PH2_TK_CLUS
134  // std::cout << "SIZEs " << outputClusters->dataSize() << ' ' << outputClustersOld->dataSize() << std::endl;
135  assert(outputClusters->dataSize() == outputClustersOld->dataSize());
136  for (auto i = 0U; i < outputClusters->dataSize(); ++i) {
137  assert(outputClusters->data()[i].size() == outputClustersOld->data()[i].size());
138  assert(outputClusters->data()[i].threshold() == outputClustersOld->data()[i].threshold());
139  assert(outputClusters->data()[i].firstRow() == outputClustersOld->data()[i].firstRow());
140  assert(outputClusters->data()[i].column() == outputClustersOld->data()[i].column());
141  }
142 #endif
143 
144  // Add the data to the output
145  outputClusters->shrink_to_fit();
146  event.put(std::move(outputClusters));
147 }
assert(be >=bs)
Definition: DetId.h:17
edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > token_
def move(src, dest)
Definition: eostools.py:511
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)

Member Data Documentation

◆ token_

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

Definition at line 40 of file Phase2TrackerClusterizer.cc.

Referenced by produce().