Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-05 00:07:43

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