109 std::ifstream
infile(cfile.c_str());
113 <<
"' for the correction file";
115 unsigned int ndets(0), nrec(0);
120 if (!
infile.good())
break;
123 std::map<DetId,double>::iterator itr =
corrFactor_.find(detId);
130 edm::LogInfo(
"AnalyzerMB") <<
"Reads " << nrec <<
" correction factors for "
131 << ndets <<
" detIds";
136 <<
" (IgnoreL1): " << ignoreL1_ <<
" (NZS) "
137 <<
runNZS_ <<
" and with " << ieta.size()
138 <<
" detId for full histogram";
139 edm::LogInfo(
"AnalyzerMB") <<
"Thresholds for HB " << eLowHB_ <<
":"
140 << eHighHB_ <<
" for HE " << eLowHE_ <<
":"
141 << eHighHE_ <<
" for HF " << eLowHF_ <<
":"
143 for (
unsigned int k=0;
k<ieta.size(); ++
k) {
148 unsigned int id = (
HcalDetId(subd,ieta[k],iphi[k],depth[k])).rawId();
152 edm::LogInfo(
"AnalyzerMB") <<
"Select on " << trigbit_.size()
153 <<
" L1 Trigger selection";
154 for (
unsigned int k=0;
k<trigbit_.size(); ++
k)
164 for(
int idet=1; idet<=4; idet++){
165 sprintf(name,
"%s", hc[idet].c_str());
166 sprintf (title,
"Noise distribution for %s", hc[idet].c_str());
170 for (
unsigned int i=0;
i<
hcalID_.size();
i++) {
172 int subdet =
id.subdetId();
173 sprintf (name,
"%s%d_%d_%d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
174 sprintf (title,
"Energy Distribution for %s ieta %d iphi %d depth %d", hc[subdet].c_str(),
id.
ieta(),
id.
iphi(),
id.
depth());
175 double xmin = (subdet == 4) ? -10 : -1;
176 double xmax = (subdet == 4) ? 90 : 9;
214 double x_min = (
Noise_) ? -3. : 0.;
220 if (hcaltopology->
valid(cell)) {
221 sprintf (name,
"HBeta%dphi%ddep%d",
eta,
phi,
depth);
222 sprintf (title,
"HB #eta %d #phi %d depth %d",
eta,
phi,
depth);
232 x_min = (
Noise_) ? -3. : 0.;
238 if (hcaltopology->
valid(cell)) {
239 sprintf (name,
"HEeta%dphi%ddep%d",
eta,
phi,
depth);
240 sprintf (title,
"HE #eta %d #phi %d depth %d",
eta,
phi,
depth);
250 x_min = (
Noise_) ? -10. : 0.;
256 if (hcaltopology->
valid(cell)) {
257 sprintf (name,
"HFeta%dphi%ddep%d",
eta,
phi,
depth);
258 sprintf (title,
"Energy (HF #eta %d #phi %d depth %d)",
eta,
phi,
depth);
276 for (std::map<std::pair<int,HcalDetId>,
myInfo>::const_iterator itr=
myMap_.begin(); itr !=
myMap_.end(); ++itr) {
277 edm::LogInfo(
"AnalyzerMB") <<
"Fired trigger bit number "<<itr->first.first;
279 std::cout <<
"Fired trigger bit number "<<itr->first.first << std::endl;
290 mysubd = itr->first.second.subdet();
291 depth = itr->first.second.depth();
292 iphi = itr->first.second.iphi();
293 ieta = itr->first.second.ieta();
295 <<
" " <<
ieta <<
" " <<
iphi <<
" mom0 "
301 <<
" " <<
ieta <<
" " <<
iphi <<
" mom0 "
304 << mom4_MB << std::endl;
316 std::cout <<
"Exiting from RecAnalyzerMinbias::endjob" << std::endl;
331 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hbhe product!";
335 edm::LogInfo(
"AnalyzerMB") <<
"HBHE MB size of collection "<<HithbheMB.
size();
344 edm::LogWarning(
"AnalyzerMB") <<
"HcalCalibAlgos: Error! can't get hf product!";
348 edm::LogInfo(
"AnalyzerMB") <<
"HF MB size of collection " << HithfMB.
size();
358 if (gtObjectMapRecord.
isValid()) {
359 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
360 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
361 itMap != objMapVec.end(); ++itMap) {
362 bool resultGt = (*itMap).algoGtlResult();
364 int algoBit = (*itMap).algoBitNumber();
380 if (gtObjectMapRecord.
isValid()) {
381 const std::vector<L1GlobalTriggerObjectMap>& objMapVec = gtObjectMapRecord->gtObjectMap();
383 for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itMap = objMapVec.begin();
384 itMap != objMapVec.end(); ++itMap) {
385 bool resultGt = (*itMap).algoGtlResult();
387 int algoBit = (*itMap).algoBitNumber();
393 edm::LogInfo(
"AnalyzerMB") <<
"No passed L1 Trigger found";
401 int algoBit,
bool fill) {
404 hbheItr!=HithbheMB.
end(); hbheItr++) {
407 double icalconst(1.);
409 std::map<DetId,double>::iterator itr =
corrFactor_.find(mydetid);
410 if (itr !=
corrFactor_.end()) icalconst = itr->second;
412 HBHERecHit aHit(hbheItr->id(),hbheItr->energy()*icalconst,hbheItr->time());
413 double energyhit = aHit.
energy();
414 DetId id = (*hbheItr).detid();
419 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
426 std::map<HcalDetId,TH1D*>::iterator itr1 =
histHC_.find(hid);
427 if (itr1 !=
histHC_.end()) itr1->second->Fill(energyhit);
429 h_[hid.
subdet()-1]->Fill(energyhit);
432 if (
Noise_ ||
runNZS_ || (energyhit >= eLow && energyhit <= eHigh)) {
433 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
434 if (itr1 ==
myMap_.end()) {
436 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
437 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
439 itr1->second.theMB0++;
440 itr1->second.theMB1 += energyhit;
441 itr1->second.theMB2 += (energyhit*energyhit);
442 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
443 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
444 itr1->second.runcheck =
rnnum_;
451 hfItr!=HithfMB.
end(); hfItr++) {
454 double icalconst(1.);
456 std::map<DetId,double>::iterator itr =
corrFactor_.find(mydetid);
457 if (itr !=
corrFactor_.end()) icalconst = itr->second;
459 HFRecHit aHit(hfItr->id(),hfItr->energy()*icalconst,hfItr->time());
461 double energyhit = aHit.
energy();
462 DetId id = (*hfItr).detid();
465 for (
unsigned int i = 0;
i <
hcalID_.size();
i++) {
472 std::map<HcalDetId,TH1D*>::iterator itr1 =
histHC_.find(hid);
473 if (itr1 !=
histHC_.end()) itr1->second->Fill(energyhit);
475 h_[hid.
subdet()-1]->Fill(energyhit);
484 std::map<std::pair<int,HcalDetId>,
myInfo>::iterator itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
485 if (itr1 ==
myMap_.end()) {
487 myMap_[std::pair<int,HcalDetId>(algoBit,hid)] = info;
488 itr1 =
myMap_.find(std::pair<int,HcalDetId>(algoBit,hid));
490 itr1->second.theMB0++;
491 itr1->second.theMB1 += energyhit;
492 itr1->second.theMB2 += (energyhit*energyhit);
493 itr1->second.theMB3 += (energyhit*energyhit*energyhit);
494 itr1->second.theMB4 += (energyhit*energyhit*energyhit*energyhit);
495 itr1->second.runcheck =
rnnum_;
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
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::map< HcalDetId, TH1D * > histHC_
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_
T * make(const Args &...args) const
make new ROOT object
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)
const_iterator end() const
edm::Service< TFileService > fs_
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
return(e1-e2)*(e1-e2)+dp *dp
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_
const_iterator begin() const