CMS 3D CMS Logo

EcalZeroSuppressionProducer.cc
Go to the documentation of this file.
1 
3 
5  digiProducer_ = params.getParameter<std::string>("digiProducer");
6  EBdigiCollection_ = params.getParameter<std::string>("EBdigiCollection");
7  EEdigiCollection_ = params.getParameter<std::string>("EEdigiCollection");
8  EBZSdigiCollection_ = params.getParameter<std::string>("EBZSdigiCollection");
9  EEZSdigiCollection_ = params.getParameter<std::string>("EEZSdigiCollection");
10 
11  // initialize the default values for the thresholds in number of noise sigmas
12 
13  glbBarrelThreshold_ = params.getUntrackedParameter<double>("glbBarrelThreshold", 0.2);
14  glbEndcapThreshold_ = params.getUntrackedParameter<double>("glbEndcapThreshold", 0.4);
15 
16  produces<EBDigiCollection>(EBZSdigiCollection_);
17  produces<EEDigiCollection>(EEZSdigiCollection_);
18 
19  EB_token = consumes<EBDigiCollection>(edm::InputTag(digiProducer_));
20  EE_token = consumes<EEDigiCollection>(edm::InputTag(digiProducer_));
21  ;
22 }
23 
25 
27  // Get Inputs
28 
29  initCalibrations(eventSetup);
30 
33 
34  const EBDigiCollection *fullBarrelDigis = nullptr;
35  const EEDigiCollection *fullEndcapDigis = nullptr;
36 
37  event.getByToken(EB_token, pEBDigis);
38  if (pEBDigis.isValid()) {
39  fullBarrelDigis = pEBDigis.product(); // get a ptr to the produc
40  edm::LogInfo("ZeroSuppressionInfo") << "total # fullBarrelDigis: " << fullBarrelDigis->size();
41  } else {
42  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EBdigiCollection_.c_str();
43  }
44 
45  event.getByToken(EE_token, pEEDigis);
46  if (pEEDigis.isValid()) {
47  fullEndcapDigis = pEEDigis.product(); // get a ptr to the product
48  edm::LogInfo("ZeroSuppressionInfo") << "total # fullEndcapDigis: " << fullEndcapDigis->size();
49  } else {
50  edm::LogError("ZeroSuppressionError") << "Error! can't get the product " << EEdigiCollection_.c_str();
51  }
52 
53  // collection of zero suppressed digis to put in the event
54 
55  std::unique_ptr<EBDigiCollection> gzsBarrelDigis(new EBDigiCollection());
56  std::unique_ptr<EEDigiCollection> gzsEndcapDigis(new EEDigiCollection());
57 
59 
60  // Barrel zero suppression
61 
62  if (fullBarrelDigis) {
63  for (EBDigiCollection::const_iterator digiItr = (*fullBarrelDigis).begin(); digiItr != (*fullBarrelDigis).end();
64  ++digiItr) {
65  bool isAccepted = theBarrelZeroSuppressor_.accept(*digiItr, glbBarrelThreshold_);
66  if (isAccepted) {
67  (*gzsBarrelDigis).push_back(digiItr->id(), digiItr->begin());
68  }
69  }
70  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
71 
72  // std::vector<EBDataFrame> sortedDigisEB =
73  // sorter.sortedVector(*gzsBarrelDigis); LogDebug("ZeroSuppressionDump") <<
74  // "Top 10 EB digis"; for(int i = 0; i < std::min(10,(int)
75  // sortedDigisEB.size()); ++i)
76  // {
77  // LogDebug("ZeroSuppressionDump") << sortedDigisEB[i];
78  // }
79  }
80 
81  // Endcap zero suppression
82 
83  if (fullEndcapDigis) {
84  for (EEDigiCollection::const_iterator digiItr = (*fullEndcapDigis).begin(); digiItr != (*fullEndcapDigis).end();
85  ++digiItr) {
86  bool isAccepted = theEndcapZeroSuppressor_.accept(*digiItr, glbEndcapThreshold_);
87  if (isAccepted) {
88  (*gzsEndcapDigis).push_back(digiItr->id(), digiItr->begin());
89  }
90  }
91  edm::LogInfo("ZeroSuppressionInfo") << "EB Digis: " << gzsBarrelDigis->size();
92 
93  // std::vector<EEDataFrame> sortedDigisEE =
94  // sorter.sortedVector(*gzsEndcapDigis);
95  // LogDebug("ZeroSuppressionDump") << "Top 10 EE digis";
96  // for(int i = 0; i < std::min(10,(int) sortedDigisEE.size()); ++i)
97  // {
98  // LogDebug("ZeroSuppressionDump") << sortedDigisEE[i];
99  // }
100  }
101  // Step D: Put outputs into event
102  event.put(std::move(gzsBarrelDigis), EBZSdigiCollection_);
103  event.put(std::move(gzsEndcapDigis), EEZSdigiCollection_);
104 }
105 
107  // Pedestals from event setup
108 
110  eventSetup.get<EcalPedestalsRcd>().get(dbPed);
111  const EcalPedestals *thePedestals = dbPed.product();
112 
115 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
EcalZeroSuppressor::setPedestals
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalZeroSuppressor.h:40
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
EcalZeroSuppressionProducer.h
edm::LogInfo
Definition: MessageLogger.h:254
EcalZeroSuppressor::accept
bool accept(const C &frame, const double &threshold)
EcalZeroSuppressionProducer::EB_token
edm::EDGetTokenT< EBDigiCollection > EB_token
Definition: EcalZeroSuppressionProducer.h:49
EcalZeroSuppressionProducer::EBdigiCollection_
std::string EBdigiCollection_
Definition: EcalZeroSuppressionProducer.h:41
EcalZeroSuppressionProducer::EBZSdigiCollection_
std::string EBZSdigiCollection_
Definition: EcalZeroSuppressionProducer.h:43
EcalCondObjectContainer< EcalPedestal >
edm::Handle< EBDigiCollection >
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalZeroSuppressionProducer::~EcalZeroSuppressionProducer
~EcalZeroSuppressionProducer() override
Definition: EcalZeroSuppressionProducer.cc:24
edm::ESHandle
Definition: DTSurvey.h:22
EcalZeroSuppressionProducer::EE_token
edm::EDGetTokenT< EEDigiCollection > EE_token
Definition: EcalZeroSuppressionProducer.h:50
EcalZeroSuppressionProducer::initCalibrations
void initCalibrations(const edm::EventSetup &eventSetup)
Definition: EcalZeroSuppressionProducer.cc:106
EcalZeroSuppressionProducer::EEdigiCollection_
std::string EEdigiCollection_
Definition: EcalZeroSuppressionProducer.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
EBDigiCollection
Definition: EcalDigiCollections.h:32
EEDigiCollection
Definition: EcalDigiCollections.h:45
EcalZeroSuppressionProducer::EEZSdigiCollection_
std::string EEZSdigiCollection_
Definition: EcalZeroSuppressionProducer.h:44
EcalZeroSuppressionProducer::glbEndcapThreshold_
double glbEndcapThreshold_
Definition: EcalZeroSuppressionProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
EcalZeroSuppressionProducer::digiProducer_
std::string digiProducer_
Definition: EcalZeroSuppressionProducer.h:40
get
#define get
EcalZeroSuppressionProducer::theEndcapZeroSuppressor_
EcalZeroSuppressor< EEDataFrame > theEndcapZeroSuppressor_
Definition: EcalZeroSuppressionProducer.h:47
MCScenario_CRAFT1_22X.sorter
def sorter(a, b)
Definition: MCScenario_CRAFT1_22X.py:97
eostools.move
def move(src, dest)
Definition: eostools.py:511
EcalZeroSuppressionProducer::EcalZeroSuppressionProducer
EcalZeroSuppressionProducer(const edm::ParameterSet &params)
Definition: EcalZeroSuppressionProducer.cc:4
EcalPedestalsRcd
Definition: EcalPedestalsRcd.h:5
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
EcalZeroSuppressionProducer::produce
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Definition: EcalZeroSuppressionProducer.cc:26
CaloDigiCollectionSorter
Definition: CaloDigiCollectionSorter.h:16
EcalZeroSuppressionProducer::theBarrelZeroSuppressor_
EcalZeroSuppressor< EBDataFrame > theBarrelZeroSuppressor_
Definition: EcalZeroSuppressionProducer.h:46
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162
EcalZeroSuppressionProducer::glbBarrelThreshold_
double glbBarrelThreshold_
Definition: EcalZeroSuppressionProducer.h:37