Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-24 23:46:27

0001 // -*- C++ -*-
0002 //
0003 // Package:    FastTimeNumberingTester
0004 // Class:      FastTimeNumberingTester
0005 //
0006 /**\class FastTimeNumberingTester FastTimeNumberingTester.cc
0007  test/FastTimeNumberingTester.cc
0008 
0009  Description: <one line class summary>
0010 
0011  Implementation:
0012      <Notes on implementation>
0013 */
0014 //
0015 // Original Author:  Sunanda Banerjee
0016 //         Created:  Mon 2014/04/24
0017 // $Id: FastTimeNumberingTester.cc,v 1.0 2014/04/24 14:06:07 sunanda Exp $
0018 //
0019 //
0020 
0021 //#define EDM_ML_DEBUG
0022 
0023 // system include files
0024 #include <fstream>
0025 #include <iostream>
0026 #include <memory>
0027 
0028 // user include files
0029 #include "FWCore/Framework/interface/Frameworkfwd.h"
0030 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0031 
0032 #include "FWCore/Framework/interface/Event.h"
0033 #include "FWCore/Framework/interface/EventSetup.h"
0034 #include "FWCore/Framework/interface/MakerMacros.h"
0035 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0036 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0037 
0038 #include "DataFormats/ForwardDetId/interface/FastTimeDetId.h"
0039 #include "DetectorDescription/Core/interface/DDCompactView.h"
0040 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0041 #include "DetectorDescription/Core/interface/DDSpecifics.h"
0042 #include "Geometry/HGCalCommonData/interface/FastTimeDDDConstants.h"
0043 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0044 
0045 class FastTimeNumberingTester : public edm::one::EDAnalyzer<> {
0046 public:
0047   explicit FastTimeNumberingTester(const edm::ParameterSet&);
0048   ~FastTimeNumberingTester() override = default;
0049 
0050   void beginJob() override {}
0051   void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
0052   void endJob() override {}
0053 
0054 private:
0055   const edm::ESGetToken<FastTimeDDDConstants, IdealGeometryRecord> token_;
0056 };
0057 
0058 FastTimeNumberingTester::FastTimeNumberingTester(const edm::ParameterSet&)
0059     : token_{esConsumes<FastTimeDDDConstants, IdealGeometryRecord>(edm::ESInputTag{})} {}
0060 
0061 // ------------ method called to produce the data  ------------
0062 void FastTimeNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0063   const FastTimeDDDConstants& fTnDC = iSetup.getData(token_);
0064   edm::LogVerbatim("HGCalGeom") << "Fast timing device with " << fTnDC.getCells(1) << ":" << fTnDC.getCells(2)
0065                                 << " cells for barrel and endcap";
0066   for (int type = 1; type <= 2; ++type) {
0067     for (int ix = 0; ix < 400; ++ix) {
0068       for (int iy = 0; iy < 400; ++iy) {
0069         if (fTnDC.isValidXY(type, ix, iy)) {
0070           FastTimeDetId id1(type, ix, iy, 1), id2(type, ix, iy, -1);
0071           edm::LogVerbatim("HGCalGeom") << "Valid ID " << id1 << " and " << id2;
0072         } else {
0073 #ifdef EDM_ML_DEBUG
0074           edm::LogVerbatim("HGCalGeom") << "ix = " << ix << ", iy = " << iy << " is not valid for "
0075                                         << "FastTime type " << type;
0076 #endif
0077         }
0078         iy += 9;
0079       }
0080       ix += 9;
0081     }
0082   }
0083 }
0084 
0085 // define this as a plug-in
0086 DEFINE_FWK_MODULE(FastTimeNumberingTester);