CMS 3D CMS Logo

CTPPSPixelClusterProducer.cc
Go to the documentation of this file.
1 
4 
6  : tokenCTPPSPixelDigi_(consumes<edm::DetSetVector<CTPPSPixelDigi> >(conf.getParameter<edm::InputTag>("tag"))),
7  tokenCTPPSPixelAnalysisMask_(esConsumes()),
8  tokenGainCalib_(esConsumes()),
9  verbosity_(conf.getUntrackedParameter<int>("RPixVerbosity")),
10  clusterizer_(conf) {
11  produces<edm::DetSetVector<CTPPSPixelCluster> >();
12 }
13 
15 
18  desc.addUntracked<int>("RPixVerbosity", 0);
19  desc.add<edm::InputTag>("tag", edm::InputTag("ctppsPixelDigis"));
20  desc.add<int>("SeedADCThreshold", 2);
21  desc.add<int>("ADCThreshold", 2);
22  desc.add<double>("ElectronADCGain", 135.0);
23  desc.add<int>("VCaltoElectronGain", 50);
24  desc.add<int>("VCaltoElectronOffset", -411);
25  desc.add<bool>("doSingleCalibration", false);
26  descriptions.add("ctppsPixelClusters", desc);
27 }
28 
32  iEvent.getByToken(tokenCTPPSPixelDigi_, rpd);
33 
35 
36  if (!rpd->empty()) {
37  // get analysis mask to mask channels
38  const auto &mask = iSetup.getData(tokenCTPPSPixelAnalysisMask_);
39  // get calibration DB
40  const auto &gainCalibrations = iSetup.getData(tokenGainCalib_);
41  // run clusterisation
42  run(*rpd, output, mask, gainCalibrations);
43  }
44  // write output
45  iEvent.put(std::make_unique<edm::DetSetVector<CTPPSPixelCluster> >(output));
46 }
47 
51  const CTPPSPixelGainCalibrations &gainCalibration) {
52  for (const auto &ds_digi : input) {
53  edm::DetSet<CTPPSPixelCluster> &ds_cluster = output.find_or_insert(ds_digi.id);
54  clusterizer_.buildClusters(ds_digi.id, ds_digi.data, ds_cluster.data, &gainCalibration, &mask);
55 
56  if (verbosity_) {
57  unsigned int cluN = 0;
58  for (std::vector<CTPPSPixelCluster>::iterator iit = ds_cluster.data.begin(); iit != ds_cluster.data.end();
59  iit++) {
60  edm::LogInfo("CTPPSPixelClusterProducer") << "Cluster " << ++cluN << " avg row " << (*iit).avg_row()
61  << " avg col " << (*iit).avg_col() << " ADC.size " << (*iit).size();
62  }
63  }
64  }
65 }
66 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd > tokenCTPPSPixelAnalysisMask_
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tokenCTPPSPixelDigi_
void run(const edm::DetSetVector< CTPPSPixelDigi > &input, edm::DetSetVector< CTPPSPixelCluster > &output, const CTPPSPixelAnalysisMask &mask, const CTPPSPixelGainCalibrations &gainCalibration)
static std::string const input
Definition: EdmProvDump.cc:50
int iEvent
Definition: GenABIO.cc:224
Channel-mask mapping.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESGetToken< CTPPSPixelGainCalibrations, CTPPSPixelGainCalibrationsRcd > tokenGainCalib_
Log< level::Info, false > LogInfo
void produce(edm::Event &, const edm::EventSetup &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
collection_type data
Definition: DetSet.h:80
HLT enums.
void buildClusters(unsigned int detId, const std::vector< CTPPSPixelDigi > &digi, std::vector< CTPPSPixelCluster > &clusters, const CTPPSPixelGainCalibrations *pcalibration, const CTPPSPixelAnalysisMask *mask)
Definition: output.py:1
CTPPSPixelClusterProducer(const edm::ParameterSet &param)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)