66 std::map<unsigned int, HGCHitTuple>&);
70 std::vector<const HGCalDDDConstants*>
hgcCons_;
82 std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>>
tok_ddd_;
83 std::vector<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>>
tok_geom_;
112 esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{
"",
name}));
114 esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{
"",
name}));
128 std::vector<std::string>
source = {
"HGCalEESensitive",
"HGCalHESiliconSensitive",
"HGCalHEScintillatorSensitive"};
129 desc.
add<std::vector<std::string>>(
"geometrySource",
source);
136 std::vector<int> dummy;
137 desc.
add<std::vector<int>>(
"ietaExcludeBH", dummy);
138 descriptions.
add(
"hgcalHitValidation", desc);
145 heedzVsZ = iB.
book2D(
"heedzVsZ",
"", 720, -360, 360, 100, -0.1, 0.1);
146 heedyVsY = iB.
book2D(
"heedyVsY",
"", 400, -200, 200, 100, -0.02, 0.02);
147 heedxVsX = iB.
book2D(
"heedxVsX",
"", 400, -200, 200, 100, -0.02, 0.02);
152 hefdzVsZ = iB.
book2D(
"hefdzVsZ",
"", 820, -410, 410, 100, -0.1, 0.1);
153 hefdyVsY = iB.
book2D(
"hefdyVsY",
"", 400, -200, 200, 100, -0.02, 0.02);
154 hefdxVsX = iB.
book2D(
"hefdxVsX",
"", 400, -200, 200, 100, -0.02, 0.02);
159 hebdzVsZ = iB.
book2D(
"hebdzVsZ",
"", 1080, -540, 540, 100, -1.0, 1.0);
198 std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
207 for (std::map<unsigned int, HGCHitTuple>::iterator itr = eeHitRefs.begin(); itr != eeHitRefs.end(); ++itr) {
209 edm::LogInfo(
"HGCalValid") <<
"EEHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
210 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
211 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
224 for (std::map<unsigned int, HGCHitTuple>::iterator itr = fhHitRefs.begin(); itr != fhHitRefs.end(); ++itr) {
226 edm::LogInfo(
"HGCalValid") <<
"FHHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
227 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
228 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
241 for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) {
243 edm::LogInfo(
"HGCalValid") <<
"BHHit[" << idx <<
"] " << std::hex << itr->first <<
std::dec <<
"; Energy "
244 << std::get<0>(itr->second) <<
"; Position (" << std::get<1>(itr->second) <<
", "
245 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
")";
257 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
258 double energy = it->energy();
260 std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
261 if (itr != eeHitRefs.end()) {
266 heedxVsX->
Fill(std::get<1>(itr->second), (xyz.
x() - std::get<1>(itr->second)));
267 heedyVsY->
Fill(std::get<2>(itr->second), (xyz.
y() - std::get<2>(itr->second)));
268 heedzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
272 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
273 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
274 << energy <<
", " << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")";
287 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
288 double energy = it->energy();
290 std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
291 if (itr != fhHitRefs.end()) {
297 hefdxVsX->
Fill(std::get<1>(itr->second), (xyz.
x() - std::get<1>(itr->second)));
298 hefdyVsY->
Fill(std::get<2>(itr->second), (xyz.
y() - std::get<2>(itr->second)));
299 hefdzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
303 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
304 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
305 << energy <<
"," << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")";
318 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
319 double energy = it->energy();
321 std::map<unsigned int, HGCHitTuple>::const_iterator itr = bhHitRefs.find(it->id().rawId());
323 if (itr != bhHitRefs.end()) {
325 double fac = sinh(std::get<1>(itr->second));
326 double pT = std::get<3>(itr->second) / fac;
327 double xp = pT *
cos(std::get<2>(itr->second));
328 double yp = pT *
sin(std::get<2>(itr->second));
333 hebdPhiVsPhi->
Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second)));
334 hebdzVsZ->
Fill(std::get<3>(itr->second), (xyz.
z() - std::get<3>(itr->second)));
339 << std::get<0>(itr->second) <<
", " << std::get<1>(itr->second) <<
", "
340 << std::get<2>(itr->second) <<
", " << std::get<3>(itr->second) <<
") Rec ("
341 << energy <<
", " << xyz.
x() <<
", " << xyz.
y() <<
", " << xyz.
z() <<
")\n";
353 std::map<unsigned int, HGCHitTuple>& hitRefs) {
355 for (std::vector<PCaloHit>::const_iterator simHit =
simHits->begin(); simHit !=
simHits->end(); ++simHit) {
356 int subdet,
zside,
layer, wafer, celltype, cell;
358 std::pair<float, float>
xy =
hgcCons_[idet]->locateCell(cell, layer, wafer,
false);
359 float zp =
hgcCons_[idet]->waferZ(layer,
false);
362 float xp = (zp < 0) ? -xy.first / 10 : xy.first / 10;
363 float yp = xy.second / 10.0;
366 std::pair<int, int> recoLayerCell =
hgcCons_[idet]->simToReco(cell, layer, wafer, hTopo.
detectorType());
367 cell = recoLayerCell.first;
368 layer = recoLayerCell.second;
371 if (layer < 0 || cell < 0) {
375 float energy = simHit->energy();
378 if (hitRefs.count(
id.rawId()) != 0)
379 energySum += std::get<0>(hitRefs[
id.rawId()]);
380 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_