CMS 3D CMS Logo

CTPPSPixelClusterProducer.cc
Go to the documentation of this file.
1 
4 
6  src_ = conf.getParameter<std::string>("label");
7  verbosity_ = conf.getUntrackedParameter<int>("RPixVerbosity");
8 
9  tokenCTPPSPixelDigi_ = consumes<edm::DetSetVector<CTPPSPixelDigi> >(edm::InputTag(src_));
10 
11  produces<edm::DetSetVector<CTPPSPixelCluster> >();
12 }
13 
15 
18  desc.addUntracked<int>("RPixVerbosity", 0);
19  desc.add<std::string>("label", "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 
34  // get analysis mask to mask channels
36 
37  if (!rpd->empty())
38  iSetup.get<CTPPSPixelAnalysisMaskRcd>().get(aMask);
39 
41 
42  // run clusterisation
43  if (!rpd->empty()) {
44  // get calibration DB
45  theGainCalibrationDB.getDB(iEvent, iSetup);
46  run(*rpd, output, aMask.product());
47  }
48  // write output
49  iEvent.put(std::make_unique<edm::DetSetVector<CTPPSPixelCluster> >(output));
50 }
51 
54  const CTPPSPixelAnalysisMask *mask) {
55  for (const auto &ds_digi : input) {
56  edm::DetSet<CTPPSPixelCluster> &ds_cluster = output.find_or_insert(ds_digi.id);
57  clusterizer_.buildClusters(ds_digi.id, ds_digi.data, ds_cluster.data, theGainCalibrationDB.getCalibs(), mask);
58 
59  if (verbosity_) {
60  unsigned int cluN = 0;
61  for (std::vector<CTPPSPixelCluster>::iterator iit = ds_cluster.data.begin(); iit != ds_cluster.data.end();
62  iit++) {
63  edm::LogInfo("CTPPSPixelClusterProducer") << "Cluster " << ++cluN << " avg row " << (*iit).avg_row()
64  << " avg col " << (*iit).avg_col() << " ADC.size " << (*iit).size();
65  }
66  }
67  }
68 }
69 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void run(const edm::DetSetVector< CTPPSPixelDigi > &input, edm::DetSetVector< CTPPSPixelCluster > &output, const CTPPSPixelAnalysisMask *mask)
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelDigi > > tokenCTPPSPixelDigi_
struct @680 param_
const CTPPSPixelGainCalibrations * getCalibs() const
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
static std::string const input
Definition: EdmProvDump.cc:48
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:234
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Channel-mask mapping.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void getDB(const edm::Event &e, const edm::EventSetup &c)
CTPPSPixelGainCalibrationDBService theGainCalibrationDB
void produce(edm::Event &, const edm::EventSetup &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
collection_type data
Definition: DetSet.h:81
T get() const
Definition: EventSetup.h:73
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)
T const * product() const
Definition: ESHandle.h:86