CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
50  const CTPPSPixelAnalysisMask &mask,
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 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
edm::ESGetToken< CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd > tokenCTPPSPixelAnalysisMask_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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:47
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
bool getData(T &iHolder) const
Definition: EventSetup.h:128
int iEvent
Definition: GenABIO.cc:224
Channel-mask mapping.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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
void buildClusters(unsigned int detId, const std::vector< CTPPSPixelDigi > &digi, std::vector< CTPPSPixelCluster > &clusters, const CTPPSPixelGainCalibrations *pcalibration, const CTPPSPixelAnalysisMask *mask)
CTPPSPixelClusterProducer(const edm::ParameterSet &param)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283