1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/EZArrayFL.h"
#include <iomanip>
#include <iostream>
#include <sstream>
typedef EZArrayFL<GlobalPoint> CornersVec;
class EcalBarrelCellParameterDump : public edm::one::EDAnalyzer<> {
public:
explicit EcalBarrelCellParameterDump(const edm::ParameterSet&);
void beginJob() override {}
void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
void endJob() override {}
private:
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_;
};
EcalBarrelCellParameterDump::EcalBarrelCellParameterDump(const edm::ParameterSet&)
: tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()) {}
void EcalBarrelCellParameterDump::analyze(const edm::Event& /*iEvent*/, const edm::EventSetup& iSetup) {
const CaloGeometry* geo = &iSetup.getData(tok_geom_);
const CaloSubdetectorGeometry* ecalGeom =
static_cast<const CaloSubdetectorGeometry*>(geo->getSubdetectorGeometry(DetId::Ecal, EcalBarrel));
edm::LogVerbatim("EcalGeom") << "\n\nStudy Detector = Ecal SubDetector = EB"
<< "\n======================================\n";
const std::vector<DetId>& ids = ecalGeom->getValidDetIds(DetId::Ecal, EcalBarrel);
int nall(0);
for (auto id : ids) {
++nall;
auto geom = ecalGeom->getGeometry(id);
EBDetId ebid(id.rawId());
std::ostringstream st1;
st1 << "IEta = " << ebid.ieta() << "; IPhi = " << ebid.iphi() << " geom->getPosition " << std::setprecision(4)
<< geom->getPosition() << " BackPoint " << geom->getBackPoint() << " [rho,eta:etaSpan,phi:phiSpan] ("
<< geom->rhoPos() << ", " << geom->etaPos() << ":" << geom->etaSpan() << ", " << geom->phiPos() << ":"
<< geom->phiSpan() << ")";
const CaloCellGeometry::CornersVec& corners(geom->getCorners());
for (unsigned int ci(0); ci != corners.size(); ci++) {
st1 << " Corner: " << ci << " Location" << corners[ci] << " ; ";
}
edm::LogVerbatim("EcalGeom") << st1.str();
}
edm::LogVerbatim("EcalGeom") << "\n\nDumps a total of : " << nall << " cells of the detector\n";
}
DEFINE_FWK_MODULE(EcalBarrelCellParameterDump);
|