104 std::ifstream
infile(cfile);
105 if (!infile.is_open()) {
108 <<
"' for the correction file";
110 unsigned int ndets(0), nrec(0);
114 infile >>
id >> cfac;
115 if (!infile.good())
break;
118 std::map<DetId,double>::iterator itr =
corrFactor_.find(detId);
125 edm::LogInfo(
"AnalyzerMB") <<
"Reads " << nrec <<
" correction factors for "
126 << ndets <<
" detIds";
131 <<
" (IgnoreL1): " << ignoreL1_ <<
" (NZS) "
132 <<
runNZS_ <<
" and with " << ieta.size()
133 <<
" detId for full histogram";
134 edm::LogInfo(
"AnalyzerMB") <<
"Thresholds for HB " << eLowHB_ <<
":"
135 << eHighHB_ <<
" for HE " << eLowHE_ <<
":"
136 << eHighHE_ <<
" for HF " << eLowHF_ <<
":"
138 for (
unsigned int k=0;
k<ieta.size(); ++
k) {
143 unsigned int id = (
HcalDetId(subd,ieta[k],iphi[k],depth[k])).rawId();
147 edm::LogInfo(
"AnalyzerMB") <<
"Select on " << trigbit_.size()
148 <<
" L1 Trigger selection";
149 for (
unsigned int k=0;
k<trigbit_.size(); ++
k)
159 for (
unsigned int i=0;
i<
hcalID_.size();
i++) {
161 int subdet =
id.subdetId();
162 sprintf (name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
163 sprintf (title,
"Energy Distribution for %s ieta %d iphi %d depth %d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
164 double xmin = (subdet == 4) ? -10 : -1;
165 double xmax = (subdet == 4) ? 90 : 9;
166 TH1D* hh =
new TH1D(name, title, 50, xmin, xmax);
171 myTree_ =
new TTree(
"RecJet",
"RecJet Tree");
172 myTree_->Branch(
"cells", &
cells,
"cells/I");
173 myTree_->Branch(
"mysubd", &
mysubd,
"mysubd/I");
174 myTree_->Branch(
"depth", &
depth,
"depth/I");
175 myTree_->Branch(
"ieta", &
ieta,
"ieta/I");
176 myTree_->Branch(
"iphi", &
iphi,
"iphi/I");
177 myTree_->Branch(
"mom0_MB", &
mom0_MB,
"mom0_MB/F");
178 myTree_->Branch(
"mom1_MB", &
mom1_MB,
"mom1_MB/F");
179 myTree_->Branch(
"mom2_MB", &
mom2_MB,
"mom2_MB/F");
180 myTree_->Branch(
"mom3_MB", &
mom2_MB,
"mom3_MB/F");
181 myTree_->Branch(
"mom4_MB", &
mom4_MB,
"mom4_MB/F");
182 myTree_->Branch(
"trigbit", &
trigbit,
"trigbit/I");
183 myTree_->Branch(
"rnnumber", &
rnnumber,
"rnnumber/D");
207 if (hcaltopology->
valid(cell)) {
208 sprintf (name,
"HBeta%dphi%ddep%d",
eta,
phi,
depth);
209 sprintf (title,
"Energy (HB #eta %d #phi %d depth %d)",
eta,
phi,
depth);
210 TH1D*
h =
new TH1D(name, title, nbinHB, 0, 2*
eHighHB_);
223 if (hcaltopology->
valid(cell)) {
224 sprintf (name,
"HEeta%dphi%ddep%d",
eta,
phi,
depth);
225 sprintf (title,
"Energy (HE #eta %d #phi %d depth %d)",
eta,
phi,
depth);
226 TH1D*
h =
new TH1D(name, title, nbinHE, 0, 2*
eHighHE_);
239 if (hcaltopology->
valid(cell)) {
240 sprintf (name,
"HFeta%dphi%ddep%d",
eta,
phi,
depth);
241 sprintf (title,
"Energy (HF #eta %d #phi %d depth %d)",
eta,
phi,
depth);
242 TH1D*
h =
new TH1D(name, title, nbinHF, 0, 2*
eHighHF_);
259 edm::LogInfo(
"AnalyzerMB") <<
"Fired trigger bit number "<<itr->first.first;
269 mysubd = itr->first.second.subdet();
270 depth = itr->first.second.depth();
271 iphi = itr->first.second.iphi();
272 ieta = itr->first.second.ieta();
274 <<
" " <<
ieta <<
" " <<
iphi <<
" mom0 "
287 for (std::map<HcalDetId,TH1D*>::iterator itr=
histHB_.begin();
288 itr !=
histHB_.end(); ++itr) itr->second->Write();
289 for (std::map<HcalDetId,TH1D*>::iterator itr=
histHE_.begin();
290 itr !=
histHE_.end(); ++itr) itr->second->Write();
291 for (std::map<HcalDetId,TH1D*>::iterator itr=
histHF_.begin();
292 itr !=
histHF_.end(); ++itr) itr->second->Write();
309 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
313 edm::LogInfo(
"AnalyzerMB") <<
"HBHE MB size of collection "<<HithbheMB.
size();
323 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
327 edm::LogInfo(
"AnalyzerMB") <<
"HF MB size of collection " << HithfMB.
size();
338 if (gtObjectMapRecord.
isValid()) {
339 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
340 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
341 itMap != objMapVec.end(); ++itMap) {
342 bool resultGt = (*itMap).algoGtlResult();
344 int algoBit = (*itMap).algoBitNumber();
360 if (gtObjectMapRecord.
isValid()) {
361 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
363 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
364 itMap != objMapVec.end(); ++itMap) {
365 bool resultGt = (*itMap).algoGtlResult();
367 int algoBit = (*itMap).algoBitNumber();
373 edm::LogInfo(
"AnalyzerMB") <<
"No passed L1 Trigger found";
381 int algoBit,
bool fill) {
384 hbheItr!=HithbheMB.
end(); hbheItr++) {
387 double icalconst(1.);
389 std::map<DetId,double>::iterator itr =
corrFactor_.find(mydetid);
390 if (itr !=
corrFactor_.end()) icalconst = itr->second;
392 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
393 double energyhit = aHit.
energy();
394 DetId id = (*hbheItr).detid();
399 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
405 std::map<HcalDetId,TH1D*>::iterator itr1 =
histHB_.find(hid);
406 if (itr1 !=
histHB_.end()) itr1->second->Fill(energyhit);
407 std::map<HcalDetId,TH1D*>::iterator itr2 =
histHE_.find(hid);
408 if (itr2 !=
histHE_.end()) itr2->second->Fill(energyhit);
411 if (
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
412 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
413 if (itr1 ==
myMap_.end()) {
415 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
416 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
418 itr1->second.theMB0++;
419 itr1->second.theMB1 += energyhit;
420 itr1->second.theMB2 += (energyhit*energyhit);
421 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
422 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
423 itr1->second.runcheck =
rnnum_;
429 hfItr!=HithfMB.
end(); hfItr++) {
432 double icalconst(1.);
434 std::map<DetId,double>::iterator itr =
corrFactor_.find(mydetid);
435 if (itr !=
corrFactor_.end()) icalconst = itr->second;
437 HFRecHit aHit(hfItr->id(),hfItr->energy()*icalconst,hfItr->time());
439 double energyhit = aHit.
energy();
440 DetId id = (*hfItr).detid();
443 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
449 std::map<HcalDetId,TH1D*>::iterator itr1 =
histHF_.find(hid);
450 if (itr1 !=
histHF_.end()) itr1->second->Fill(energyhit);
456 if ((
runNZS_ && fabs(energyhit) <= 40.) ||
458 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
459 if (itr1 ==
myMap_.end()) {
461 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
462 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
464 itr1->second.theMB0++;
465 itr1->second.theMB1 += energyhit;
466 itr1->second.theMB2 += (energyhit*energyhit);
467 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
468 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
469 itr1->second.runcheck =
rnnum_;
std::map< HcalDetId, TH1D * > histHE_
T getParameter(std::string const &) const
RecAnalyzerMinbias(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > trigbit_
HcalSubdetector subdet() const
get the subdetector
std::map< HcalDetId, TH1D * > histHB_
std::string fOutputFileName_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< HBHERecHit >::const_iterator const_iterator
std::map< DetId, double > corrFactor_
void analyzeHcal(const HBHERecHitCollection &, const HFRecHitCollection &, int, bool)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< TH1D * > histo_
uint32_t rawId() const
get the raw id
edm::EDGetTokenT< HFRecHitCollection > tok_hfrecoMB_
Abs< T >::type abs(const T &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const_iterator end() const
T const * product() const
std::vector< unsigned int > hcalID_
T const * product() const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbherecoMB_
virtual bool valid(const DetId &id) const
virtual void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup)
std::map< std::pair< int, HcalDetId >, myInfo > myMap_
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< L1GlobalTriggerObjectMapRecord > tok_hltL1GtMap_
std::map< HcalDetId, TH1D * > histHF_
const_iterator begin() const