Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-07 05:50:20

0001 // Original Author:  Alexandre Sakharov
0002 //         Created:  Sun May 10 15:43:28 CEST 2009
0003 
0004 #include <memory>
0005 #include <iostream>
0006 
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 
0014 #include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader.h"
0015 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0016 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
0017 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
0018 #include "DataFormats/CSCDigi/interface/CSCRPCDigiCollection.h"
0019 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
0020 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
0021 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
0022 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigiCollection.h"
0023 #include "DataFormats/CSCDigi/interface/CSCDDUStatusDigiCollection.h"
0024 #include "DataFormats/CSCDigi/interface/CSCDCCStatusDigiCollection.h"
0025 #include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h"
0026 #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h"
0027 
0028 class CSCViewDigi : public edm::one::EDAnalyzer<> {
0029 public:
0030   explicit CSCViewDigi(const edm::ParameterSet&);
0031   ~CSCViewDigi() override;
0032 
0033 private:
0034   void analyze(const edm::Event&, const edm::EventSetup&) override;
0035   void endJob() override;
0036 
0037   bool WiresDigiDump, AlctDigiDump, ClctDigiDump, CorrClctDigiDump;
0038   bool StripDigiDump, ComparatorDigiDump, RpcDigiDump, StatusDigiDump;
0039   bool DDUStatusDigiDump, DCCStatusDigiDump;
0040   bool gemPadsDigiDump, showerDigiDump;
0041 
0042   edm::EDGetTokenT<CSCWireDigiCollection> wd_token;
0043   edm::EDGetTokenT<CSCStripDigiCollection> sd_token;
0044   edm::EDGetTokenT<CSCComparatorDigiCollection> cd_token;
0045   edm::EDGetTokenT<CSCRPCDigiCollection> rd_token;
0046   edm::EDGetTokenT<CSCALCTDigiCollection> al_token;
0047   edm::EDGetTokenT<CSCCLCTDigiCollection> cl_token;
0048   edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> co_token;
0049   edm::EDGetTokenT<CSCDCCFormatStatusDigiCollection> st_token;
0050   edm::EDGetTokenT<CSCDDUStatusDigiCollection> dd_token;
0051   edm::EDGetTokenT<CSCDCCStatusDigiCollection> dc_token;
0052   edm::EDGetTokenT<GEMPadDigiClusterCollection> gem_token;
0053   edm::EDGetTokenT<CSCShowerDigiCollection> lct_shwr_token;
0054   edm::EDGetTokenT<CSCShowerDigiCollection> anode_shwr_token;
0055   edm::EDGetTokenT<CSCShowerDigiCollection> cathode_shwr_token;
0056   edm::EDGetTokenT<CSCShowerDigiCollection> alct_anode_shwr_token;
0057 };
0058 
0059 CSCViewDigi::CSCViewDigi(const edm::ParameterSet& conf) {
0060   wd_token = consumes<CSCWireDigiCollection>(conf.getParameter<edm::InputTag>("wireDigiTag"));
0061   sd_token = consumes<CSCStripDigiCollection>(conf.getParameter<edm::InputTag>("stripDigiTag"));
0062   cd_token = consumes<CSCComparatorDigiCollection>(conf.getParameter<edm::InputTag>("comparatorDigiTag"));
0063   rd_token = consumes<CSCRPCDigiCollection>(conf.getParameter<edm::InputTag>("rpcDigiTag"));
0064   al_token = consumes<CSCALCTDigiCollection>(conf.getParameter<edm::InputTag>("alctDigiTag"));
0065   cl_token = consumes<CSCCLCTDigiCollection>(conf.getParameter<edm::InputTag>("clctDigiTag"));
0066   co_token = consumes<CSCCorrelatedLCTDigiCollection>(conf.getParameter<edm::InputTag>("corrclctDigiTag"));
0067   st_token = consumes<CSCDCCFormatStatusDigiCollection>(conf.getParameter<edm::InputTag>("statusDigiTag"));
0068   dd_token = consumes<CSCDDUStatusDigiCollection>(conf.getParameter<edm::InputTag>("DDUstatusDigiTag"));
0069   dc_token = consumes<CSCDCCStatusDigiCollection>(conf.getParameter<edm::InputTag>("DCCstatusDigiTag"));
0070   gem_token = consumes<GEMPadDigiClusterCollection>(conf.getParameter<edm::InputTag>("gemPadsDigiTag"));
0071   lct_shwr_token = consumes<CSCShowerDigiCollection>(conf.getParameter<edm::InputTag>("lctShowerDigiTag"));
0072   anode_shwr_token = consumes<CSCShowerDigiCollection>(conf.getParameter<edm::InputTag>("anodeShowerDigiTag"));
0073   cathode_shwr_token = consumes<CSCShowerDigiCollection>(conf.getParameter<edm::InputTag>("cathodeShowerDigiTag"));
0074   alct_anode_shwr_token =
0075       consumes<CSCShowerDigiCollection>(conf.getParameter<edm::InputTag>("alct_anodeShowerDigiTag"));
0076 
0077   WiresDigiDump = conf.getUntrackedParameter<bool>("WiresDigiDump", false);
0078   StripDigiDump = conf.getUntrackedParameter<bool>("StripDigiDump", false);
0079   ComparatorDigiDump = conf.getUntrackedParameter<bool>("ComparatorDigiDump", false);
0080   RpcDigiDump = conf.getUntrackedParameter<bool>("RpcDigiDump", false);
0081   AlctDigiDump = conf.getUntrackedParameter<bool>("AlctDigiDump", false);
0082   ClctDigiDump = conf.getUntrackedParameter<bool>("ClctDigiDump", false);
0083   CorrClctDigiDump = conf.getUntrackedParameter<bool>("CorrClctDigiDump", false);
0084   StatusDigiDump = conf.getUntrackedParameter<bool>("StatusDigiDump", false);
0085   DDUStatusDigiDump = conf.getUntrackedParameter<bool>("DDUStatus", false);
0086   DCCStatusDigiDump = conf.getUntrackedParameter<bool>("DCCStatus", false);
0087   gemPadsDigiDump = conf.getUntrackedParameter<bool>("GEMPadsDigiDump", false);
0088   showerDigiDump = conf.getUntrackedParameter<bool>("ShowerDigiDump", false);
0089 }
0090 
0091 CSCViewDigi::~CSCViewDigi() {}
0092 
0093 void CSCViewDigi::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0094   using namespace edm;
0095 
0096   edm::Handle<CSCWireDigiCollection> wires;
0097   edm::Handle<CSCStripDigiCollection> strips;
0098   edm::Handle<CSCComparatorDigiCollection> comparators;
0099   edm::Handle<CSCRPCDigiCollection> rpcs;
0100   edm::Handle<CSCALCTDigiCollection> alcts;
0101   edm::Handle<CSCCLCTDigiCollection> clcts;
0102   edm::Handle<CSCCorrelatedLCTDigiCollection> correlatedlcts;
0103   edm::Handle<CSCDCCFormatStatusDigiCollection> statusdigis;
0104   edm::Handle<CSCDDUStatusDigiCollection> DDUstatusdigi;
0105   edm::Handle<CSCDCCStatusDigiCollection> DCCstatusdigi;
0106   edm::Handle<GEMPadDigiClusterCollection> gemPadsClusters;
0107   edm::Handle<CSCShowerDigiCollection> lctShower;
0108   edm::Handle<CSCShowerDigiCollection> anodeShower;
0109   edm::Handle<CSCShowerDigiCollection> cathodeShower;
0110   edm::Handle<CSCShowerDigiCollection> alct_anodeShower;
0111 
0112   iEvent.getByToken(wd_token, wires);
0113   iEvent.getByToken(sd_token, strips);
0114   iEvent.getByToken(cd_token, comparators);
0115   iEvent.getByToken(rd_token, rpcs);
0116   iEvent.getByToken(al_token, alcts);
0117   iEvent.getByToken(cl_token, clcts);
0118   iEvent.getByToken(co_token, correlatedlcts);
0119 
0120   if (StatusDigiDump)
0121     iEvent.getByToken(st_token, statusdigis);
0122 
0123   if (DDUStatusDigiDump)
0124     iEvent.getByToken(dd_token, DDUstatusdigi);
0125 
0126   if (DCCStatusDigiDump)
0127     iEvent.getByToken(dc_token, DCCstatusdigi);
0128 
0129   if (gemPadsDigiDump)
0130     iEvent.getByToken(gem_token, gemPadsClusters);
0131 
0132   if (showerDigiDump) {
0133     iEvent.getByToken(lct_shwr_token, lctShower);
0134     iEvent.getByToken(anode_shwr_token, anodeShower);
0135     iEvent.getByToken(cathode_shwr_token, cathodeShower);
0136     iEvent.getByToken(alct_anode_shwr_token, alct_anodeShower);
0137   }
0138 
0139   if (WiresDigiDump) {
0140     edm::LogVerbatim("ViewDigi") << std::endl;
0141     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0142     edm::LogVerbatim("ViewDigi") << std::endl;
0143     edm::LogVerbatim("ViewDigi") << "********WIRES Digis********" << std::endl;
0144     for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin(); j != wires->end(); j++) {
0145       edm::LogVerbatim("ViewDigi") << "Wire digis from " << CSCDetId((*j).first) << std::endl;
0146       std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
0147       std::vector<CSCWireDigi>::const_iterator last = (*j).second.second;
0148       for (; digiItr != last; ++digiItr) {
0149         digiItr->print();
0150       }
0151     }
0152   }
0153 
0154   if (StripDigiDump) {
0155     edm::LogVerbatim("ViewDigi") << std::endl;
0156     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0157     edm::LogVerbatim("ViewDigi") << std::endl;
0158     edm::LogVerbatim("ViewDigi") << "********STRIPS Digis********" << std::endl;
0159     for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin(); j != strips->end(); j++) {
0160       edm::LogVerbatim("ViewDigi") << "Strip digis from " << CSCDetId((*j).first) << std::endl;
0161       std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
0162       std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
0163       for (; digiItr != last; ++digiItr) {
0164         digiItr->print();
0165       }
0166     }
0167   }
0168 
0169   if (ComparatorDigiDump) {
0170     edm::LogVerbatim("ViewDigi") << std::endl;
0171     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0172     edm::LogVerbatim("ViewDigi") << std::endl;
0173     edm::LogVerbatim("ViewDigi") << "********COMPARATOR Digis********" << std::endl;
0174     for (CSCComparatorDigiCollection::DigiRangeIterator j = comparators->begin(); j != comparators->end(); j++) {
0175       edm::LogVerbatim("ViewDigi") << "Comparator digis from " << CSCDetId((*j).first) << std::endl;
0176       std::vector<CSCComparatorDigi>::const_iterator digiItr = (*j).second.first;
0177       std::vector<CSCComparatorDigi>::const_iterator last = (*j).second.second;
0178       for (; digiItr != last; ++digiItr) {
0179         digiItr->print();
0180       }
0181     }
0182   }
0183 
0184   if (RpcDigiDump) {
0185     edm::LogVerbatim("ViewDigi") << std::endl;
0186     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0187     edm::LogVerbatim("ViewDigi") << std::endl;
0188     edm::LogVerbatim("ViewDigi") << "********RPC Digis********" << std::endl;
0189     for (CSCRPCDigiCollection::DigiRangeIterator j = rpcs->begin(); j != rpcs->end(); j++) {
0190       edm::LogVerbatim("ViewDigi") << "RPC digis from " << CSCDetId((*j).first) << std::endl;
0191       std::vector<CSCRPCDigi>::const_iterator digiItr = (*j).second.first;
0192       std::vector<CSCRPCDigi>::const_iterator last = (*j).second.second;
0193       for (; digiItr != last; ++digiItr) {
0194         digiItr->print();
0195       }
0196     }
0197   }
0198 
0199   if (AlctDigiDump) {
0200     edm::LogVerbatim("ViewDigi") << std::endl;
0201     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0202     edm::LogVerbatim("ViewDigi") << std::endl;
0203     edm::LogVerbatim("ViewDigi") << "********ALCT Digis********" << std::endl;
0204     for (CSCALCTDigiCollection::DigiRangeIterator j = alcts->begin(); j != alcts->end(); j++) {
0205       std::vector<CSCALCTDigi>::const_iterator digiItr = (*j).second.first;
0206       std::vector<CSCALCTDigi>::const_iterator last = (*j).second.second;
0207       for (; digiItr != last; ++digiItr) {
0208         digiItr->print();
0209       }
0210     }
0211   }
0212 
0213   if (ClctDigiDump) {
0214     edm::LogVerbatim("ViewDigi") << std::endl;
0215     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0216     edm::LogVerbatim("ViewDigi") << std::endl;
0217     edm::LogVerbatim("ViewDigi") << "********CLCT Digis********" << std::endl;
0218     for (CSCCLCTDigiCollection::DigiRangeIterator j = clcts->begin(); j != clcts->end(); j++) {
0219       std::vector<CSCCLCTDigi>::const_iterator digiItr = (*j).second.first;
0220       std::vector<CSCCLCTDigi>::const_iterator last = (*j).second.second;
0221       for (; digiItr != last; ++digiItr) {
0222         digiItr->print();
0223       }
0224     }
0225   }
0226 
0227   if (CorrClctDigiDump) {
0228     edm::LogVerbatim("ViewDigi") << std::endl;
0229     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0230     edm::LogVerbatim("ViewDigi") << std::endl;
0231     edm::LogVerbatim("ViewDigi") << "********CorrelatedLCT Digis********" << std::endl;
0232     for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j = correlatedlcts->begin(); j != correlatedlcts->end();
0233          j++) {
0234       std::vector<CSCCorrelatedLCTDigi>::const_iterator digiItr = (*j).second.first;
0235       std::vector<CSCCorrelatedLCTDigi>::const_iterator last = (*j).second.second;
0236       for (; digiItr != last; ++digiItr) {
0237         digiItr->print();
0238       }
0239     }
0240   }
0241 
0242   if (StatusDigiDump) {
0243     edm::LogVerbatim("ViewDigi") << std::endl;
0244     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0245     edm::LogVerbatim("ViewDigi") << std::endl;
0246     edm::LogVerbatim("ViewDigi") << "********STATUS Digis********" << std::endl;
0247     for (CSCDCCFormatStatusDigiCollection::DigiRangeIterator j = statusdigis->begin(); j != statusdigis->end(); j++) {
0248       std::vector<CSCDCCFormatStatusDigi>::const_iterator digiItr = (*j).second.first;
0249       std::vector<CSCDCCFormatStatusDigi>::const_iterator last = (*j).second.second;
0250       for (; digiItr != last; ++digiItr) {
0251         digiItr->print();
0252       }
0253     }
0254   }
0255 
0256   if (DDUStatusDigiDump) {
0257     edm::LogVerbatim("ViewDigi") << std::endl;
0258     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0259     edm::LogVerbatim("ViewDigi") << std::endl;
0260     edm::LogVerbatim("ViewDigi") << "********DDU STATUS Digis********" << std::endl;
0261     for (CSCDDUStatusDigiCollection::DigiRangeIterator j = DDUstatusdigi->begin(); j != DDUstatusdigi->end(); j++) {
0262       std::vector<CSCDDUStatusDigi>::const_iterator digiItr = (*j).second.first;
0263       std::vector<CSCDDUStatusDigi>::const_iterator last = (*j).second.second;
0264       for (; digiItr != last; ++digiItr) {
0265         digiItr->print();
0266       }
0267     }
0268   }
0269 
0270   if (DCCStatusDigiDump) {
0271     edm::LogVerbatim("ViewDigi") << std::endl;
0272     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0273     edm::LogVerbatim("ViewDigi") << std::endl;
0274     edm::LogVerbatim("ViewDigi") << "********DCC STATUS Digis********" << std::endl;
0275     for (CSCDCCStatusDigiCollection::DigiRangeIterator j = DCCstatusdigi->begin(); j != DCCstatusdigi->end(); j++) {
0276       std::vector<CSCDCCStatusDigi>::const_iterator digiItr = (*j).second.first;
0277       std::vector<CSCDCCStatusDigi>::const_iterator last = (*j).second.second;
0278       for (; digiItr != last; ++digiItr) {
0279         digiItr->print();
0280       }
0281     }
0282   }
0283 
0284   if (showerDigiDump) {
0285     edm::LogVerbatim("ViewDigi") << std::endl;
0286     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0287     edm::LogVerbatim("ViewDigi") << std::endl;
0288     edm::LogVerbatim("ViewDigi") << "********lct Shower Digis********" << std::endl;
0289     for (CSCShowerDigiCollection::DigiRangeIterator j = lctShower->begin(); j != lctShower->end(); j++) {
0290       std::vector<CSCShowerDigi>::const_iterator digiItr = (*j).second.first;
0291       std::vector<CSCShowerDigi>::const_iterator last = (*j).second.second;
0292       for (; digiItr != last; ++digiItr) {
0293         edm::LogVerbatim("ViewDigi") << *digiItr << std::endl;
0294       }
0295     }
0296 
0297     edm::LogVerbatim("ViewDigi") << "********cathode Shower Digis********" << std::endl;
0298     for (CSCShowerDigiCollection::DigiRangeIterator j = cathodeShower->begin(); j != cathodeShower->end(); j++) {
0299       std::vector<CSCShowerDigi>::const_iterator digiItr = (*j).second.first;
0300       std::vector<CSCShowerDigi>::const_iterator last = (*j).second.second;
0301       for (; digiItr != last; ++digiItr) {
0302         edm::LogVerbatim("ViewDigi") << *digiItr << std::endl;
0303       }
0304     }
0305 
0306     edm::LogVerbatim("ViewDigi") << "********anode Shower Digis********" << std::endl;
0307     for (CSCShowerDigiCollection::DigiRangeIterator j = anodeShower->begin(); j != anodeShower->end(); j++) {
0308       std::vector<CSCShowerDigi>::const_iterator digiItr = (*j).second.first;
0309       std::vector<CSCShowerDigi>::const_iterator last = (*j).second.second;
0310       for (; digiItr != last; ++digiItr) {
0311         edm::LogVerbatim("ViewDigi") << *digiItr << std::endl;
0312       }
0313     }
0314 
0315     edm::LogVerbatim("ViewDigi") << "********ALCT anode Shower Digis********" << std::endl;
0316     for (CSCShowerDigiCollection::DigiRangeIterator j = alct_anodeShower->begin(); j != alct_anodeShower->end(); j++) {
0317       std::vector<CSCShowerDigi>::const_iterator digiItr = (*j).second.first;
0318       std::vector<CSCShowerDigi>::const_iterator last = (*j).second.second;
0319       for (; digiItr != last; ++digiItr) {
0320         if (digiItr->isValid())
0321           edm::LogVerbatim("ViewDigi") << *digiItr << " bx: " << digiItr->getCSCID() << std::endl;
0322       }
0323     }
0324   }
0325 
0326   if (gemPadsDigiDump) {
0327     edm::LogVerbatim("ViewDigi") << std::endl;
0328     edm::LogVerbatim("ViewDigi") << "Event " << iEvent.id() << std::endl;
0329     edm::LogVerbatim("ViewDigi") << std::endl;
0330     edm::LogVerbatim("ViewDigi") << "********GEMPadDigiCluster Digis********" << std::endl;
0331     for (GEMPadDigiClusterCollection::DigiRangeIterator j = gemPadsClusters->begin(); j != gemPadsClusters->end();
0332          j++) {
0333       GEMDetId gemdetid = (*j).first;
0334       std::vector<GEMPadDigiCluster>::const_iterator digiItr = (*j).second.first;
0335       std::vector<GEMPadDigiCluster>::const_iterator last = (*j).second.second;
0336       edm::LogVerbatim("ViewDigi") << "GEM" << gemdetid << std::endl;
0337       for (; digiItr != last; ++digiItr) {
0338         digiItr->print();
0339       }
0340     }
0341   }
0342 
0343 #ifdef THIS_IS_AN_EVENT_EXAMPLE
0344   Handle<ExampleData> pIn;
0345   iEvent.getByLabel("example", pIn);
0346 #endif
0347 
0348 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
0349   ESHandle<SetupData> pSetup;
0350   iSetup.get<SetupRecord>().get(pSetup);
0351 #endif
0352 }
0353 
0354 // ------------ method called once each job just after ending the event loop  ------------
0355 void CSCViewDigi::endJob() {}
0356 
0357 //define this as a plug-in
0358 DEFINE_FWK_MODULE(CSCViewDigi);