Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-10 02:20:49

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/EventSetup.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "FWCore/Utilities/interface/ESGetToken.h"
0005 #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
0006 #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
0007 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0008 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0009 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0010 #include "Geometry/CaloGeometry/interface/TruncatedPyramid.h"
0011 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
0012 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0013 #include "Geometry/CaloGeometry/interface/CaloGenericDetId.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0016 
0017 #include <fstream>
0018 #include <iomanip>
0019 #include <iterator>
0020 #include <CLHEP/Units/SystemOfUnits.h>
0021 #include "TH1.h"
0022 #include "TH1D.h"
0023 #include "TProfile.h"
0024 
0025 using namespace CLHEP;
0026 
0027 class SurveyToTransforms : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0028 public:
0029   SurveyToTransforms(const edm::ParameterSet&);
0030   ~SurveyToTransforms() override {}
0031 
0032   void beginJob() override {}
0033   void analyze(edm::Event const&, edm::EventSetup const&) override;
0034   void endJob() override {}
0035 
0036 private:
0037   edm::Service<TFileService> h_fs;
0038 
0039   TProfile* h_eta;
0040   TProfile* h_phi;
0041 
0042   TH1D* h_diffs[10][12];
0043 
0044   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geometryToken_;
0045 };
0046 
0047 SurveyToTransforms::SurveyToTransforms(const edm::ParameterSet& iConfig) {
0048   usesResource("TFileService");
0049 
0050   h_eta = h_fs->make<TProfile>("iEta", "Eta vs iEta", 86 * 2 * 4, -86, 86, " ");
0051   h_phi = h_fs->make<TProfile>("iPhi", "Phi vs iPhi", 360 * 4, 1, 361, " ");
0052 
0053   const std::string hname[10] = {"EB", "EE", "ES", "HB", "HO", "HE", "HF", "CT", "ZD", "CA"};
0054   const std::string cname[12] = {
0055       "XCtr", "YCtr", "ZCtr", "XCor0", "YCor0", "ZCor0", "XCor3", "YCor3", "ZCor3", "XCor6", "YCor6", "ZCor6"};
0056 
0057   for (unsigned int i(0); i != 10; ++i) {
0058     for (unsigned int j(0); j != 12; ++j) {
0059       h_diffs[i][j] =
0060           h_fs->make<TH1D>(std::string(hname[i] + cname[j] + std::string("Diff (microns)")).c_str(),
0061                            std::string(hname[i] + std::string(": New-Nom(") + cname[j] + std::string(")")).c_str(),
0062                            200,
0063                            -200.,
0064                            200.);
0065     }
0066   }
0067 
0068   geometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>(edm::ESInputTag{});
0069 }
0070 
0071 void SurveyToTransforms::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0072   const auto& pG = iSetup.getData(geometryToken_);
0073 
0074   pG.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
0075 }
0076 
0077 DEFINE_FWK_MODULE(SurveyToTransforms);