67 std::map<unsigned int, HGCHitTuple>&);
71 std::vector<const HGCalDDDConstants*>
hgcCons_;
83 std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>>
tok_ddd_;
84 std::vector<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>>
tok_geom_;
113 esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{
"",
name}));
115 esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{
"",
name}));
129 std::vector<std::string>
source = {
"HGCalEESensitive",
"HGCalHESiliconSensitive",
"HGCalHEScintillatorSensitive"};
130 desc.
add<std::vector<std::string>>(
"geometrySource",
source);
137 std::vector<int> dummy;
138 desc.
add<std::vector<int>>(
"ietaExcludeBH", dummy);
139 descriptions.
add(
"hgcalHitValidation", desc);
146 heedzVsZ = iB.
book2D(
"heedzVsZ",
"", 720, -360, 360, 100, -0.1, 0.1);
147 heedyVsY = iB.
book2D(
"heedyVsY",
"", 400, -200, 200, 100, -0.02, 0.02);
148 heedxVsX = iB.
book2D(
"heedxVsX",
"", 400, -200, 200, 100, -0.02, 0.02);
153 hefdzVsZ = iB.
book2D(
"hefdzVsZ",
"", 820, -410, 410, 100, -0.1, 0.1);
154 hefdyVsY = iB.
book2D(
"hefdyVsY",
"", 400, -200, 200, 100, -0.02, 0.02);
155 hefdxVsX = iB.
book2D(
"hefdxVsX",
"", 400, -200, 200, 100, -0.02, 0.02);
160 hebdzVsZ = iB.
book2D(
"hebdzVsZ",
"", 1080, -540, 540, 100, -1.0, 1.0);
199 std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
208 for (std::map<unsigned int, HGCHitTuple>::iterator itr = eeHitRefs.begin(); itr != eeHitRefs.end(); ++itr) {
210 edm::LogInfo(
"HGCalValid") <<
"EEHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
211 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
212 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
225 for (std::map<unsigned int, HGCHitTuple>::iterator itr = fhHitRefs.begin(); itr != fhHitRefs.end(); ++itr) {
227 edm::LogInfo(
"HGCalValid") <<
"FHHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
228 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
229 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
242 for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) {
244 edm::LogInfo(
"HGCalValid") <<
"BHHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
245 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
246 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
258 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
259 double energy = it->energy();
261 std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
262 if (itr != eeHitRefs.end()) {
267 heedxVsX->
Fill(std::get<1>(itr->second), (xyz.
x() - std::get<1>(itr->second)));
268 heedyVsY->
Fill(std::get<2>(itr->second), (xyz.
y() - std::get<2>(itr->second)));
269 heedzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
273 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
274 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
275 << energy <<
", " << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")";
288 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
289 double energy = it->energy();
291 std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
292 if (itr != fhHitRefs.end()) {
298 hefdxVsX->
Fill(std::get<1>(itr->second), (xyz.
x() - std::get<1>(itr->second)));
299 hefdyVsY->
Fill(std::get<2>(itr->second), (xyz.
y() - std::get<2>(itr->second)));
300 hefdzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
304 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
305 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
306 << energy <<
"," << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")";
319 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
320 double energy = it->energy();
322 std::map<unsigned int, HGCHitTuple>::const_iterator itr = bhHitRefs.find(it->id().rawId());
324 if (itr != bhHitRefs.end()) {
326 double fac = sinh(std::get<1>(itr->second));
327 double pT = std::get<3>(itr->second) / fac;
328 double xp = pT *
cos(std::get<2>(itr->second));
329 double yp = pT *
sin(std::get<2>(itr->second));
334 hebdPhiVsPhi->
Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second)));
335 hebdzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
340 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
341 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
342 << energy <<
", " << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")\n";
354 std::map<unsigned int, HGCHitTuple>& hitRefs) {
356 for (std::vector<PCaloHit>::const_iterator simHit =
simHits->begin(); simHit !=
simHits->end(); ++simHit) {
357 int subdet,
zside,
layer, wafer, celltype, cell;
359 std::pair<float, float>
xy =
hgcCons_[idet]->locateCell(cell, layer, wafer,
false);
360 float zp =
hgcCons_[idet]->waferZ(layer,
false);
363 float xp = (zp < 0) ? -xy.first / 10 : xy.first / 10;
364 float yp = xy.second / 10.0;
367 std::pair<int, int> recoLayerCell =
hgcCons_[idet]->simToReco(cell, layer, wafer, hTopo.
detectorType());
368 cell = recoLayerCell.first;
369 layer = recoLayerCell.second;
372 if (layer < 0 || cell < 0) {
376 float energy = simHit->energy();
379 if (hitRefs.count(
id.rawId()) != 0)
380 energySum += std::get<0>(hitRefs[
id.rawId()]);
381 hitRefs[
id.rawId()] = std::make_tuple(energySum, xp, yp, zp);
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
MonitorElement * hebRecVsSimX
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > > tok_geom_
edm::InputTag bhSimHitSource
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * hebRecVsSimY
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > tok_ddd_
T1 value() const
Explicit access to value in case implicit conversion not OK.
edm::EDGetTokenT< HGChebRecHitCollection > bhRecHitToken_
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
bool detectorType() const
MonitorElement * heeRecVsSimX
std::vector< const HGCalDDDConstants * > hgcCons_
MonitorElement * heeRecVsSimZ
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< const HGCalGeometry * > hgcGeometry_
MonitorElement * hebEnRec
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
std::vector< int > ietaExcludeBH_
MonitorElement * hefEnSim
Cos< T >::type cos(const T &t)
MonitorElement * hebRecVsSimZ
std::vector< std::string > geometrySource_
MonitorElement * hefEnRec
MonitorElement * heedxVsX
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * heeEnSim
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * hebdPhiVsPhi
edm::InputTag fhSimHitSource
const_iterator end() const
MonitorElement * hebEnSimRec
Log< level::Info, false > LogInfo
Basic2DVector< T > xy() const
edm::InputTag eeSimHitSource
HGCalHitValidation(const edm::ParameterSet &)
MonitorElement * hefdxVsX
T const * product() const
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T const * product() const
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void analyzeHGCalSimHit(edm::Handle< std::vector< PCaloHit >> const &simHits, int idet, MonitorElement *hist, std::map< unsigned int, HGCHitTuple > &)
MonitorElement * hefRecVsSimZ
~HGCalHitValidation() override
std::tuple< float, float, float, float > HGCHitTuple
MonitorElement * hefdzVsZ
double energySum(const DataFrame &df, int fs, int ls)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * hebdzVsZ
static std::string const source
MonitorElement * heedyVsY
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
const_iterator begin() const
MonitorElement * hebdEtaVsEta
edm::EDGetTokenT< HGChefRecHitCollection > fhRecHitToken_