Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:18

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/GetterOfProducts.h"
0004 #include "FWCore/Framework/interface/TypeMatch.h"
0005 #include "DataFormats/Common/interface/Handle.h"
0006 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0007 #include "DataFormats/HcalDigi/interface/HcalUMNioDigi.h"
0008 #include <iostream>
0009 
0010 using namespace std;
0011 
0012 /** \class HcalDigiDump
0013       
0014 \author J. Mans - Minnesota
0015 */
0016 class HcalDigiDump : public edm::one::EDAnalyzer<> {
0017 public:
0018   explicit HcalDigiDump(edm::ParameterSet const& conf);
0019   ~HcalDigiDump() override = default;
0020   void analyze(edm::Event const& e, edm::EventSetup const& c) override;
0021 
0022 private:
0023   edm::GetterOfProducts<HBHEDigiCollection> getterOfProducts1_;
0024   edm::GetterOfProducts<HODigiCollection> getterOfProducts2_;
0025   edm::GetterOfProducts<HFDigiCollection> getterOfProducts3_;
0026   edm::GetterOfProducts<ZDCDigiCollection> getterOfProducts4_;
0027   edm::GetterOfProducts<CastorDigiCollection> getterOfProducts5_;
0028   edm::GetterOfProducts<CastorTrigPrimDigiCollection> getterOfProducts6_;
0029   edm::GetterOfProducts<HcalCalibDigiCollection> getterOfProducts7_;
0030   edm::GetterOfProducts<HcalTrigPrimDigiCollection> getterOfProducts8_;
0031   edm::GetterOfProducts<HOTrigPrimDigiCollection> getterOfProducts9_;
0032   edm::GetterOfProducts<HcalHistogramDigiCollection> getterOfProducts10_;
0033   edm::GetterOfProducts<HcalTTPDigiCollection> getterOfProducts11_;
0034   edm::GetterOfProducts<QIE10DigiCollection> getterOfProducts12_;
0035   edm::GetterOfProducts<QIE11DigiCollection> getterOfProducts13_;
0036   edm::GetterOfProducts<HcalUMNioDigi> getterOfProducts14_;
0037 };
0038 
0039 HcalDigiDump::HcalDigiDump(edm::ParameterSet const& conf)
0040     : getterOfProducts1_(edm::TypeMatch(), this),
0041       getterOfProducts2_(edm::TypeMatch(), this),
0042       getterOfProducts3_(edm::TypeMatch(), this),
0043       getterOfProducts4_(edm::TypeMatch(), this),
0044       getterOfProducts5_(edm::TypeMatch(), this),
0045       getterOfProducts6_(edm::TypeMatch(), this),
0046       getterOfProducts7_(edm::TypeMatch(), this),
0047       getterOfProducts8_(edm::TypeMatch(), this),
0048       getterOfProducts9_(edm::TypeMatch(), this),
0049       getterOfProducts10_(edm::TypeMatch(), this),
0050       getterOfProducts11_(edm::TypeMatch(), this),
0051       getterOfProducts12_(edm::TypeMatch(), this),
0052       getterOfProducts13_(edm::TypeMatch(), this),
0053       getterOfProducts14_(edm::TypeMatch(), this) {
0054   callWhenNewProductsRegistered([this](edm::BranchDescription const& bd) {
0055     getterOfProducts1_(bd);
0056     getterOfProducts2_(bd);
0057     getterOfProducts3_(bd);
0058     getterOfProducts4_(bd);
0059     getterOfProducts5_(bd);
0060     getterOfProducts6_(bd);
0061     getterOfProducts7_(bd);
0062     getterOfProducts8_(bd);
0063     getterOfProducts9_(bd);
0064     getterOfProducts10_(bd);
0065     getterOfProducts11_(bd);
0066     getterOfProducts12_(bd);
0067     getterOfProducts13_(bd);
0068     getterOfProducts14_(bd);
0069   });
0070 }
0071 
0072 void HcalDigiDump::analyze(edm::Event const& e, edm::EventSetup const& c) {
0073   std::vector<edm::Handle<HBHEDigiCollection> > hbhe;
0074   std::vector<edm::Handle<HODigiCollection> > ho;
0075   std::vector<edm::Handle<HFDigiCollection> > hf;
0076   std::vector<edm::Handle<ZDCDigiCollection> > zdc;
0077   std::vector<edm::Handle<CastorDigiCollection> > castor;
0078   std::vector<edm::Handle<CastorTrigPrimDigiCollection> > castortp;
0079   std::vector<edm::Handle<HcalCalibDigiCollection> > hc;
0080   std::vector<edm::Handle<HcalTrigPrimDigiCollection> > htp;
0081   std::vector<edm::Handle<HOTrigPrimDigiCollection> > hotp;
0082   std::vector<edm::Handle<HcalHistogramDigiCollection> > hh;
0083   std::vector<edm::Handle<HcalTTPDigiCollection> > ttp;
0084   std::vector<edm::Handle<QIE10DigiCollection> > qie10s;
0085   std::vector<edm::Handle<QIE11DigiCollection> > qie11s;
0086   std::vector<edm::Handle<HcalUMNioDigi> > umnio;
0087 
0088   try {
0089     getterOfProducts1_.fillHandles(e, hbhe);
0090     std::vector<edm::Handle<HBHEDigiCollection> >::iterator i;
0091     for (i = hbhe.begin(); i != hbhe.end(); i++) {
0092       const HBHEDigiCollection& c = *(*i);
0093 
0094       cout << "HB/HE Digis: " << i->provenance()->branchName() << endl;
0095 
0096       for (HBHEDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0097         cout << *j << std::endl;
0098     }
0099   } catch (...) {
0100     cout << "No HB/HE Digis." << endl;
0101   }
0102 
0103   try {
0104     getterOfProducts3_.fillHandles(e, hf);
0105     std::vector<edm::Handle<HFDigiCollection> >::iterator i;
0106     for (i = hf.begin(); i != hf.end(); i++) {
0107       const HFDigiCollection& c = *(*i);
0108 
0109       cout << "HF Digis: " << i->provenance()->branchName() << endl;
0110 
0111       for (HFDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0112         cout << *j << std::endl;
0113     }
0114   } catch (...) {
0115     cout << "No HF Digis." << endl;
0116   }
0117 
0118   try {
0119     getterOfProducts2_.fillHandles(e, ho);
0120     std::vector<edm::Handle<HODigiCollection> >::iterator i;
0121     for (i = ho.begin(); i != ho.end(); i++) {
0122       const HODigiCollection& c = *(*i);
0123 
0124       cout << "HO Digis: " << i->provenance()->branchName() << endl;
0125 
0126       for (HODigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0127         cout << *j << std::endl;
0128     }
0129   } catch (...) {
0130     cout << "No HO Digis." << endl;
0131   }
0132 
0133   try {
0134     getterOfProducts8_.fillHandles(e, htp);
0135     std::vector<edm::Handle<HcalTrigPrimDigiCollection> >::iterator i;
0136     for (i = htp.begin(); i != htp.end(); i++) {
0137       const HcalTrigPrimDigiCollection& c = *(*i);
0138 
0139       cout << "HcalTrigPrim Digis: " << i->provenance()->branchName() << endl;
0140 
0141       for (HcalTrigPrimDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0142         cout << *j << std::endl;
0143     }
0144   } catch (...) {
0145     cout << "No HCAL Trigger Primitive Digis." << endl;
0146   }
0147 
0148   try {
0149     getterOfProducts9_.fillHandles(e, hotp);
0150     std::vector<edm::Handle<HOTrigPrimDigiCollection> >::iterator i;
0151     for (i = hotp.begin(); i != hotp.end(); i++) {
0152       const HOTrigPrimDigiCollection& c = *(*i);
0153 
0154       cout << "HO TP Digis: " << i->provenance()->branchName() << endl;
0155 
0156       for (HOTrigPrimDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0157         cout << *j << std::endl;
0158     }
0159   } catch (...) {
0160     cout << "No HCAL Trigger Primitive Digis." << endl;
0161   }
0162 
0163   try {
0164     getterOfProducts7_.fillHandles(e, hc);
0165     std::vector<edm::Handle<HcalCalibDigiCollection> >::iterator i;
0166     for (i = hc.begin(); i != hc.end(); i++) {
0167       const HcalCalibDigiCollection& c = *(*i);
0168 
0169       cout << "Calibration Digis: " << i->provenance()->branchName() << endl;
0170 
0171       for (HcalCalibDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0172         cout << *j << std::endl;
0173     }
0174   } catch (...) {
0175   }
0176 
0177   try {
0178     getterOfProducts4_.fillHandles(e, zdc);
0179     std::vector<edm::Handle<ZDCDigiCollection> >::iterator i;
0180     for (i = zdc.begin(); i != zdc.end(); i++) {
0181       const ZDCDigiCollection& c = *(*i);
0182 
0183       cout << "ZDC Digis: " << i->provenance()->branchName() << endl;
0184 
0185       for (ZDCDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0186         cout << *j << std::endl;
0187     }
0188   } catch (...) {
0189   }
0190 
0191   try {
0192     getterOfProducts5_.fillHandles(e, castor);
0193     std::vector<edm::Handle<CastorDigiCollection> >::iterator i;
0194     for (i = castor.begin(); i != castor.end(); i++) {
0195       const CastorDigiCollection& c = *(*i);
0196 
0197       cout << "Castor Digis: " << i->provenance()->branchName() << endl;
0198 
0199       for (CastorDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0200         cout << *j << std::endl;
0201     }
0202   } catch (...) {
0203   }
0204 
0205   try {
0206     getterOfProducts6_.fillHandles(e, castortp);
0207     std::vector<edm::Handle<CastorTrigPrimDigiCollection> >::iterator i;
0208     for (i = castortp.begin(); i != castortp.end(); i++) {
0209       const CastorTrigPrimDigiCollection& c = *(*i);
0210 
0211       for (CastorTrigPrimDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0212         cout << *j << std::endl;
0213     }
0214   } catch (...) {
0215     cout << "No CASTOR Trigger Primitive Digis." << endl;
0216   }
0217 
0218   try {
0219     getterOfProducts11_.fillHandles(e, ttp);
0220     std::vector<edm::Handle<HcalTTPDigiCollection> >::iterator i;
0221     for (i = ttp.begin(); i != ttp.end(); i++) {
0222       const HcalTTPDigiCollection& c = *(*i);
0223 
0224       for (HcalTTPDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0225         cout << *j << std::endl;
0226     }
0227   } catch (...) {
0228   }
0229 
0230   try {
0231     getterOfProducts10_.fillHandles(e, hh);
0232     std::vector<edm::Handle<HcalHistogramDigiCollection> >::iterator i;
0233     for (i = hh.begin(); i != hh.end(); i++) {
0234       const HcalHistogramDigiCollection& c = *(*i);
0235 
0236       for (HcalHistogramDigiCollection::const_iterator j = c.begin(); j != c.end(); j++)
0237         cout << *j << std::endl;
0238     }
0239   } catch (...) {
0240   }
0241 
0242   try {
0243     getterOfProducts14_.fillHandles(e, umnio);
0244     std::vector<edm::Handle<HcalUMNioDigi> >::iterator i;
0245     for (i = umnio.begin(); i != umnio.end(); i++) {
0246       cout << *(*i) << std::endl;
0247     }
0248   } catch (...) {
0249   }
0250 
0251   try {
0252     getterOfProducts12_.fillHandles(e, qie10s);
0253     std::vector<edm::Handle<QIE10DigiCollection> >::iterator i;
0254     for (i = qie10s.begin(); i != qie10s.end(); i++) {
0255       const QIE10DigiCollection& c = *(*i);
0256 
0257       for (unsigned j = 0; j < c.size(); j++)
0258         cout << QIE10DataFrame(c[j]) << std::endl;
0259     }
0260   } catch (...) {
0261   }
0262 
0263   try {
0264     getterOfProducts13_.fillHandles(e, qie11s);
0265     std::vector<edm::Handle<QIE11DigiCollection> >::iterator i;
0266     for (i = qie11s.begin(); i != qie11s.end(); i++) {
0267       const QIE11DigiCollection& c = *(*i);
0268 
0269       for (unsigned j = 0; j < c.size(); j++)
0270         cout << QIE11DataFrame(c[j]) << std::endl;
0271     }
0272   } catch (...) {
0273   }
0274 
0275   cout << endl;
0276 }
0277 
0278 #include "FWCore/PluginManager/interface/ModuleDef.h"
0279 #include "FWCore/Framework/interface/MakerMacros.h"
0280 
0281 DEFINE_FWK_MODULE(HcalDigiDump);