78 std::map<unsigned int, HGCHitTuple>&);
81 std::map<unsigned int, HGCHitTuple>
const& hitRefs);
85 std::vector<const HGCalDDDConstants*>
hgcCons_;
138 <<
" ieta values from BH plots (BH " 208 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDSimConstants: " 216 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDRecConstants: " 235 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HGCalDDDConstants for " 251 std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
260 for (std::map<unsigned int,HGCHitTuple>::iterator itr=eeHitRefs.begin();
261 itr != eeHitRefs.end(); ++itr) {
263 edm::LogInfo(
"HGCalValid") <<
"EEHit[" << idx <<
"] " << std::hex
264 << itr->first <<
std::dec <<
"; Energy " 265 << std::get<0>(itr->second)
266 <<
"; Position (" << std::get<1>(itr->second)
267 <<
", " << std::get<2>(itr->second) <<
", " 268 << std::get<3>(itr->second) <<
")" <<std::endl;
281 for (std::map<unsigned int,HGCHitTuple>::iterator itr=fhHitRefs.begin();
282 itr != fhHitRefs.end(); ++itr) {
284 edm::LogInfo(
"HGCalValid") <<
"FHHit[" << idx <<
"] " << std::hex
285 << itr->first <<
std::dec <<
"; Energy " 286 << std::get<0>(itr->second) <<
"; Position (" 287 << std::get<1>(itr->second) <<
", " 288 << std::get<2>(itr->second) <<
", " 289 << std::get<3>(itr->second) <<
")" <<std::endl;
300 for (std::vector<PCaloHit>::const_iterator
simHit = bhSimHits->begin();
307 double zp = cell.
rz/10;
310 int sign = (z==0)?(-1):(1);
314 float energy =
simHit->energy();
316 if (bhHitRefs.count(
id.rawId()) != 0) energySum += std::get<0>(bhHitRefs[
id.rawId()]);
320 bhHitRefs[
id.rawId()] = std::make_tuple(energySum,cell.
eta,cell.
phi,zp);
322 edm::LogInfo(
"HGCalValid") <<
"Accept " <<
id << std::endl;
324 edm::LogInfo(
"HGCalValid") <<
"Reject " <<
id << std::endl;
330 for (std::map<unsigned int,HGCHitTuple>::iterator itr=bhHitRefs.begin();
331 itr != bhHitRefs.end(); ++itr) {
333 edm::LogInfo(
"HGCalValid") <<
"BHHit[" << idx <<
"] " << std::hex
334 << itr->first <<
std::dec <<
"; Energy " 335 << std::get<0>(itr->second) <<
"; Position (" 336 << std::get<1>(itr->second) <<
", " 337 << std::get<2>(itr->second) <<
", " 338 << std::get<3>(itr->second) <<
")" <<std::endl;
350 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
351 double energy = it->energy();
353 std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
354 if (itr != eeHitRefs.end()) {
359 heedxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
360 heedyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
361 heedzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
364 edm::LogInfo(
"HGCalValid") <<
"EEHit: " << std::hex << it->id().rawId()
366 << std::get<0>(itr->second) <<
", " 367 << std::get<1>(itr->second) <<
", " 368 << std::get<2>(itr->second) <<
", " 369 << std::get<3>(itr->second) <<
") Rec (" 370 << energy <<
", " << xyz.
x() <<
", " 371 << xyz.
y() <<
", " << xyz.
z() <<
")\n";
384 for (
auto it = theHits->
begin(); it!=theHits->
end(); ++it) {
385 double energy = it->energy();
387 std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
388 if (itr != fhHitRefs.end()) {
394 hefdxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
395 hefdyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
396 hefdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
399 edm::LogInfo(
"HGCalValid") <<
"FHHit: " << std::hex << it->id().rawId()
401 << std::get<0>(itr->second) <<
", " 402 << std::get<1>(itr->second) <<
", " 403 << std::get<2>(itr->second) <<
", " 404 << std::get<3>(itr->second) <<
") Rec (" 405 << energy <<
"," << xyz.
x() <<
", " 406 << xyz.
y() <<
", " << xyz.
z() <<
")\n";
439 std::map<unsigned int, HGCHitTuple>& hitRefs) {
443 int subdet,
zside, layer, wafer, celltype, cell;
445 std::pair<float, float>
xy =
hgcCons_[idet]->locateCell(cell,layer,wafer,
false);
446 float zp =
hgcCons_[idet]->waferZ(layer,
false);
447 if (zside < 0) zp = -zp;
448 float xp = (zp<0) ? -xy.first/10 : xy.first/10;
449 float yp = xy.second/10.0;
452 std::pair<int,int> recoLayerCell=
hgcCons_[idet]->simToReco(cell,layer,wafer,hTopo.
detectorType());
453 cell = recoLayerCell.first;
454 layer = recoLayerCell.second;
457 if (layer<0 || cell<0) {
461 float energy =
simHit->energy();
464 if (hitRefs.count(
id.rawId()) != 0) energySum += std::get<0>(hitRefs[
id.rawId()]);
465 hitRefs[
id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
473 std::map<unsigned int, HGCHitTuple>
const& hitRefs) {
474 for (
auto it = theHits->begin(); it!=theHits->end(); ++it) {
477 double energy = it->energy();
481 std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(
id.rawId());
482 if (itr != hitRefs.end()) {
483 float ang3 = xyz.
phi().value();
484 double fac = sinh(std::get<1>(itr->second));
485 double pT = std::get<3>(itr->second) / fac;
486 double xp = pT *
cos(std::get<2>(itr->second));
487 double yp = pT *
sin(std::get<2>(itr->second));
492 hebdPhiVsPhi->
Fill(std::get<2>(itr->second),(ang3-std::get<2>(itr->second)));
493 hebdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
497 edm::LogInfo(
"HGCalValid") <<
"BHHit: " << std::hex <<
id.rawId()
499 << std::get<0>(itr->second) <<
", " 500 << std::get<1>(itr->second) <<
", " 501 << std::get<2>(itr->second) <<
", " 502 << std::get<3>(itr->second) <<
") Rec (" 503 << energy <<
", " << xyz.
x() <<
", " 504 << 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)
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
void setCurrentFolder(const std::string &fullpath)
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_