63 std::vector<std::pair<TH1D*, TH1D*>>
histo_;
68 myInfo() { kount = f11 = f12 = f13 = f14 = f21 = f22 = f23 = f24 = runcheck = 0; }
82 usesResource(
"TFileService");
100 edm::LogVerbatim(
"RecAnalyzer") <<
" Flags (IgnoreL1): " << ignoreL1_ <<
" (NZS) " <<
nzs_ <<
" (Noise) " << noise_
103 for (
unsigned int k = 0;
k < ieta.size(); ++
k) {
110 edm::LogVerbatim(
"RecAnalyzer") <<
"Select on " << trigbit_.size() <<
" L1 Trigger selection";
112 for (
auto trig : trigbit_) {
123 desc.
add<
bool>(
"RunNZS",
true);
124 desc.
add<
bool>(
"Noise",
false);
125 desc.
add<
bool>(
"Ratio",
false);
126 desc.
add<
double>(
"ELowHF", 10);
127 desc.
add<
double>(
"EHighHF", 150);
128 std::vector<int> idummy;
129 desc.
addUntracked<std::vector<int>>(
"TriggerBits", idummy);
132 desc.
addUntracked<std::vector<int>>(
"HcalIeta", idummy);
133 desc.
addUntracked<std::vector<int>>(
"HcalIphi", idummy);
134 desc.
addUntracked<std::vector<int>>(
"HcalDepth", idummy);
136 descriptions.
add(
"recAnalyzerHF", desc);
146 for (
int i = 0;
i < 2; ++
i) {
147 sprintf(name,
"HF%d",
i);
148 sprintf(title,
"The metric F%d for HF",
i + 1);
152 for (
const auto&
id :
hcalID_) {
154 TH1D *h1(
nullptr), *h2(
nullptr);
155 for (
int i = 0;
i < 2; ++
i) {
156 sprintf(name,
"HF%d%d_%d_%d",
i, hid.
ieta(), hid.
iphi(), hid.
depth());
157 sprintf(title,
"The metric F%d for HF i#eta %d i#phi %d depth %d",
i + 1, hid.
ieta(), hid.
iphi(), hid.
depth());
163 histo_.push_back(std::pair<TH1D*, TH1D*>(h1, h2));
193 for (
const auto& itr :
myMap_) {
194 edm::LogVerbatim(
"RecAnalyzer") <<
"Fired trigger bit number " << itr.first.first;
196 if (info.
kount > 0) {
209 mysubd = itr.first.second.subdet();
210 depth = itr.first.second.depth();
211 iphi = itr.first.second.iphi();
212 ieta = itr.first.second.ieta();
241 edm::LogWarning(
"RecAnalyzer") <<
"HcalCalibAlgos: Error! can't get hf product!";
254 if (gtObjectMapRecord.
isValid()) {
255 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
256 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
258 bool resultGt = (*itMap).algoGtlResult();
260 int algoBit = (*itMap).algoBitNumber();
277 if (gtObjectMapRecord.
isValid()) {
278 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->
gtObjectMap();
280 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
282 bool resultGt = (*itMap).algoGtlResult();
284 int algoBit = (*itMap).algoBitNumber();
298 edm::LogVerbatim(
"RecAnalyzer") <<
"Enter analyzeHcal for bit " << algoBit <<
" Fill " << fill <<
" Collection size " 302 for (
const auto& hfItr : Hithf) {
304 double e0 = (hfItr.getHFQIE10Info(0) ==
nullptr) ? 0 : hfItr.getHFQIE10Info(0)->energy();
305 double e1 = (hfItr.getHFQIE10Info(1) ==
nullptr) ? 0 : hfItr.getHFQIE10Info(1)->energy();
306 double energy = e0 + e1;
308 energy = (energy > 0) ? 1
e-6 : -1
e-6;
309 double f1(e0),
f2(e1);
318 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
333 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
334 if (itr1 ==
myMap_.end()) {
336 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
337 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
339 itr1->second.kount += 1.0;
340 itr1->second.f11 += (
f1);
341 itr1->second.f12 += (
f1 *
f1);
342 itr1->second.f13 += (
f1 *
f1 *
f1);
343 itr1->second.f14 += (
f1 *
f1 *
f1 *
f1);
344 itr1->second.f21 += (
f2);
345 itr1->second.f22 += (f2 *
f2);
346 itr1->second.f23 += (f2 * f2 *
f2);
347 itr1->second.f24 += (f2 * f2 * f2 *
f2);
348 itr1->second.runcheck =
rnnum_;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > hcalID_
constexpr uint32_t rawId() const
get the raw id
std::vector< int > trigbit_
T * make(const Args &...args) const
make new ROOT object
void analyze(edm::Event const &, edm::EventSetup const &) override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~RecAnalyzerHF() override
const std::vector< L1GlobalTriggerObjectMap > & gtObjectMap() const
get / set the vector of object maps
int depth() const
get the tower depth
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::pair< TH1D *, TH1D * > > histo_
RecAnalyzerHF(const edm::ParameterSet &)
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< HFPreRecHitCollection > tok_hfreco_
int iphi() const
get the cell iphi
edm::Service< TFileService > fs_
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
void analyzeHcal(const HFPreRecHitCollection &, int, bool)