62 std::vector<std::pair<TH1D*, TH1D*>>
histo_;
80 : nzs_(iConfig.getParameter<bool>(
"RunNZS")),
81 noise_(iConfig.getParameter<bool>(
"Noise")),
82 ratio_(iConfig.getParameter<bool>(
"Ratio")),
83 ignoreL1_(iConfig.getUntrackedParameter<bool>(
"IgnoreL1",
false)),
84 fillTree_(iConfig.getUntrackedParameter<bool>(
"FillTree",
true)),
85 eLowHF_(iConfig.getParameter<double>(
"ELowHF")),
86 eHighHF_(iConfig.getParameter<double>(
"EHighHF")),
87 trigbit_(iConfig.getUntrackedParameter<std::
vector<int>>(
"TriggerBits")),
90 usesResource(
"TFileService");
99 for (
unsigned int k = 0;
k < ieta.size(); ++
k) {
117 desc.
add<
bool>(
"RunNZS",
true);
118 desc.
add<
bool>(
"Noise",
false);
119 desc.
add<
bool>(
"Ratio",
false);
120 desc.
add<
double>(
"ELowHF", 10);
121 desc.
add<
double>(
"EHighHF", 150);
122 std::vector<int> idummy;
123 desc.
addUntracked<std::vector<int>>(
"TriggerBits", idummy);
126 desc.
addUntracked<std::vector<int>>(
"HcalIeta", idummy);
127 desc.
addUntracked<std::vector<int>>(
"HcalIphi", idummy);
128 desc.
addUntracked<std::vector<int>>(
"HcalDepth", idummy);
130 descriptions.
add(
"recAnalyzerHF", desc);
141 for (
int i = 0;
i < 2; ++
i) {
142 sprintf(name,
"HF%d",
i);
143 sprintf(title,
"The metric F%d for HF",
i + 1);
147 for (
const auto&
id :
hcalID_) {
149 TH1D *h1(
nullptr), *h2(
nullptr);
150 for (
int i = 0;
i < 2; ++
i) {
151 sprintf(name,
"HF%d%d_%d_%d",
i, hid.
ieta(), hid.
iphi(), hid.
depth());
152 sprintf(title,
"The metric F%d for HF i#eta %d i#phi %d depth %d",
i + 1, hid.
ieta(), hid.
iphi(), hid.
depth());
158 histo_.push_back(std::pair<TH1D*, TH1D*>(h1, h2));
162 myTree_ = fs->
make<TTree>(
"RecJet",
"RecJet Tree");
188 for (
const auto& itr :
myMap_) {
189 edm::LogVerbatim(
"RecAnalyzerHF") <<
"Fired trigger bit number " << itr.first.first;
191 if (info.
kount > 0) {
204 mysubd = itr.first.second.subdet();
205 depth = itr.first.second.depth();
206 iphi = itr.first.second.iphi();
207 ieta = itr.first.second.ieta();
234 edm::LogWarning(
"RecAnalyzerHF") <<
"HcalCalibAlgos: Error! can't get hf product!";
246 if (gtObjectMapRecord.
isValid()) {
247 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
248 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
250 bool resultGt = (*itMap).algoGtlResult();
252 int algoBit = (*itMap).algoBitNumber();
268 if (gtObjectMapRecord.
isValid()) {
269 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
271 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin(); itMap != objMapVec.end();
273 bool resultGt = (*itMap).algoGtlResult();
275 int algoBit = (*itMap).algoBitNumber();
289 edm::LogVerbatim(
"RecAnalyzerHF") <<
"Enter analyzeHcal for bit " << algoBit <<
" Fill " << fill
290 <<
" Collection size " << Hithf.
size();
293 for (
const auto& hfItr : Hithf) {
295 double e0 = (hfItr.getHFQIE10Info(0) ==
nullptr) ? 0 : hfItr.getHFQIE10Info(0)->energy();
296 double e1 = (hfItr.getHFQIE10Info(1) ==
nullptr) ? 0 : hfItr.getHFQIE10Info(1)->energy();
299 energy = (energy > 0) ? 1
e-6 : -1
e-6;
300 double f1(e0),
f2(e1);
306 edm::LogVerbatim(
"RecAnalyzerHF") << hid <<
" E " << e0 <<
":" << e1 <<
" F " <<
f1 <<
":" <<
f2;
309 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
324 std::map<std::pair<int, HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
325 if (itr1 ==
myMap_.end()) {
327 myMap_[std::pair<int, HcalDetId>(algoBit, hid)] = info;
328 itr1 =
myMap_.find(std::pair<int, HcalDetId>(algoBit, hid));
330 itr1->second.kount += 1.0;
331 itr1->second.f11 += (
f1);
332 itr1->second.f12 += (
f1 *
f1);
333 itr1->second.f13 += (
f1 *
f1 *
f1);
334 itr1->second.f14 += (
f1 *
f1 *
f1 *
f1);
335 itr1->second.f21 += (
f2);
336 itr1->second.f22 += (f2 *
f2);
337 itr1->second.f23 += (f2 * f2 *
f2);
338 itr1->second.f24 += (f2 * f2 * f2 *
f2);
339 itr1->second.runcheck =
rnnum_;
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
#define DEFINE_FWK_MODULE(type)
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
~RecAnalyzerHF() override=default
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)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr int iphi() const
get the cell iphi
std::vector< std::pair< TH1D *, TH1D * > > histo_
RecAnalyzerHF(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< HFPreRecHitCollection > tok_hfreco_
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
constexpr int depth() const
get the tower depth
Log< level::Warning, false > LogWarning
void analyzeHcal(const HFPreRecHitCollection &, int, bool)