78 std::map<unsigned int, HGCHitTuple>&);
81 std::map<unsigned int, HGCHitTuple>
const& hitRefs);
85 std::vector<const HGCalDDDConstants*>
hgcCons_;
140 <<
" ieta values from BH plots (BH " 210 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDSimConstants: " 218 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDRecConstants: " 237 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HGCalDDDConstants for " 253 std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
262 for (std::map<unsigned int,HGCHitTuple>::iterator itr=eeHitRefs.begin();
263 itr != eeHitRefs.end(); ++itr) {
265 edm::LogInfo(
"HGCalValid") <<
"EEHit[" << idx <<
"] " << std::hex
266 << itr->first <<
std::dec <<
"; Energy " 267 << std::get<0>(itr->second)
268 <<
"; Position (" << std::get<1>(itr->second)
269 <<
", " << std::get<2>(itr->second) <<
", " 270 << std::get<3>(itr->second) <<
")";
283 for (std::map<unsigned int,HGCHitTuple>::iterator itr=fhHitRefs.begin();
284 itr != fhHitRefs.end(); ++itr) {
286 edm::LogInfo(
"HGCalValid") <<
"FHHit[" << idx <<
"] " << std::hex
287 << itr->first <<
std::dec <<
"; Energy " 288 << std::get<0>(itr->second) <<
"; Position (" 289 << std::get<1>(itr->second) <<
", " 290 << std::get<2>(itr->second) <<
", " 291 << std::get<3>(itr->second) <<
")";
303 for (std::vector<PCaloHit>::const_iterator
simHit = bhSimHits->begin();
310 double zp = cell.
rz/10;
313 int sign = (z==0)?(-1):(1);
317 float energy =
simHit->energy();
319 if (bhHitRefs.count(
id.rawId()) != 0) energySum += std::get<0>(bhHitRefs[
id.rawId()]);
323 bhHitRefs[
id.rawId()] = std::make_tuple(energySum,cell.
eta,cell.
phi,zp);
325 edm::LogInfo(
"HGCalValid") <<
"Accept " <<
id << std::endl;
327 edm::LogInfo(
"HGCalValid") <<
"Reject " <<
id << std::endl;
337 for (std::map<unsigned int,HGCHitTuple>::iterator itr=bhHitRefs.begin();
338 itr != bhHitRefs.end(); ++itr) {
340 edm::LogInfo(
"HGCalValid") <<
"BHHit[" << idx <<
"] " << std::hex
341 << itr->first <<
std::dec <<
"; Energy " 342 << std::get<0>(itr->second) <<
"; Position (" 343 << std::get<1>(itr->second) <<
", " 344 << std::get<2>(itr->second) <<
", " 345 << std::get<3>(itr->second) <<
")";
357 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
358 double energy = it->energy();
360 std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
361 if (itr != eeHitRefs.end()) {
366 heedxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
367 heedyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
368 heedzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
371 edm::LogInfo(
"HGCalValid") <<
"EEHit: " << std::hex << it->id().rawId()
373 << std::get<0>(itr->second) <<
", " 374 << std::get<1>(itr->second) <<
", " 375 << std::get<2>(itr->second) <<
", " 376 << std::get<3>(itr->second) <<
") Rec (" 377 << energy <<
", " << xyz.
x() <<
", " 378 << xyz.
y() <<
", " << xyz.
z() <<
")";
391 for (
auto it = theHits->
begin(); it!=theHits->
end(); ++it) {
392 double energy = it->energy();
394 std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
395 if (itr != fhHitRefs.end()) {
401 hefdxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
402 hefdyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
403 hefdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
406 edm::LogInfo(
"HGCalValid") <<
"FHHit: " << std::hex << it->id().rawId()
408 << std::get<0>(itr->second) <<
", " 409 << std::get<1>(itr->second) <<
", " 410 << std::get<2>(itr->second) <<
", " 411 << std::get<3>(itr->second) <<
") Rec (" 412 << energy <<
"," << xyz.
x() <<
", " 413 << xyz.
y() <<
", " << xyz.
z() <<
")";
446 std::map<unsigned int, HGCHitTuple>& hitRefs) {
450 int subdet,
zside, layer, wafer, celltype, cell;
452 std::pair<float, float>
xy =
hgcCons_[idet]->locateCell(cell,layer,wafer,
false);
453 float zp =
hgcCons_[idet]->waferZ(layer,
false);
454 if (zside < 0) zp = -zp;
455 float xp = (zp<0) ? -xy.first/10 : xy.first/10;
456 float yp = xy.second/10.0;
459 std::pair<int,int> recoLayerCell=
hgcCons_[idet]->simToReco(cell,layer,wafer,hTopo.
detectorType());
460 cell = recoLayerCell.first;
461 layer = recoLayerCell.second;
464 if (layer<0 || cell<0) {
468 float energy =
simHit->energy();
471 if (hitRefs.count(
id.rawId()) != 0) energySum += std::get<0>(hitRefs[
id.rawId()]);
472 hitRefs[
id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
480 std::map<unsigned int, HGCHitTuple>
const& hitRefs) {
481 for (
auto it = theHits->begin(); it!=theHits->end(); ++it) {
484 double energy = it->energy();
488 std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(
id.rawId());
489 if (itr != hitRefs.end()) {
490 float ang3 = xyz.
phi().value();
491 double fac = sinh(std::get<1>(itr->second));
492 double pT = std::get<3>(itr->second) / fac;
493 double xp = pT *
cos(std::get<2>(itr->second));
494 double yp = pT *
sin(std::get<2>(itr->second));
499 hebdPhiVsPhi->
Fill(std::get<2>(itr->second),(ang3-std::get<2>(itr->second)));
500 hebdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
504 edm::LogInfo(
"HGCalValid") <<
"BHHit: " << std::hex <<
id.rawId()
506 << std::get<0>(itr->second) <<
", " 507 << std::get<1>(itr->second) <<
", " 508 << std::get<2>(itr->second) <<
", " 509 << std::get<3>(itr->second) <<
") Rec (" 510 << energy <<
", " << xyz.
x() <<
", " 511 << xyz.
y() <<
", " << xyz.
z() <<
")\n";
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hebRecVsSimX
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
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
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
bool detectorType() const
MonitorElement * heeRecVsSimX
HcalCellType::HcalCell cell(const int &det, const int &zside, const int &depth, const int &etaR, const int &iphi) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< const HGCalDDDConstants * > hgcCons_
MonitorElement * heeRecVsSimZ
const HcalDDDSimConstants * hcCons_
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
std::vector< const HGCalGeometry * > hgcGeometry_
MonitorElement * hebEnRec
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
std::tuple< float, float, float, float > HGCHitTuple
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
void addDefault(ParameterSetDescription const &psetDescription)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
void analyzeHGCalRecHit(T1 const &theHits, std::map< unsigned int, HGCHitTuple > const &hitRefs)
std::vector< int > ietaExcludeBH_
MonitorElement * hefEnSim
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
Cos< T >::type cos(const T &t)
MonitorElement * hebRecVsSimZ
std::vector< std::string > geometrySource_
MonitorElement * hefEnRec
const CaloSubdetectorGeometry * hcGeometry_
MonitorElement * book1D(Args &&...args)
MonitorElement * heedxVsX
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * heeEnSim
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitTokenh_
MonitorElement * hebdPhiVsPhi
edm::InputTag fhSimHitSource
const_iterator end() const
MonitorElement * hebEnSimRec
edm::InputTag eeSimHitSource
HGCalHitValidation(const edm::ParameterSet &)
MonitorElement * hefdxVsX
T const * product() const
MonitorElement * book2D(Args &&...args)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const HcalDDDRecConstants * hcConr_
edm::EDGetTokenT< HGChebRecHitCollection > bhRecHitTokeng_
void analyzeHGCalSimHit(edm::Handle< std::vector< PCaloHit >> const &simHits, int idet, MonitorElement *hist, std::map< unsigned int, HGCHitTuple > &)
MonitorElement * hefRecVsSimZ
~HGCalHitValidation() override
MonitorElement * hefdzVsZ
double energySum(const DataFrame &df, int fs, int ls)
MonitorElement * hebdzVsZ
T const * product() const
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_