79 std::vector<const HGCalDDDConstants*>
hgcCons_;
126 <<
" ieta values from BH plots";
195 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDSimConstants: "
203 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HcalDDDRecConstants: "
222 edm::LogWarning(
"HGCalValid") <<
"Cannot initiate HGCalDDDConstants for "
238 std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
249 for (std::vector<PCaloHit>::const_iterator simHit = eeSimHits->begin(); simHit != eeSimHits->end(); ++simHit) {
250 int subdet,
zside, layer, wafer, celltype, cell;
252 std::pair<float, float>
xy =
hgcCons_[0]->locateCell(cell,layer,wafer,
false);
253 float zp =
hgcCons_[0]->waferZ(layer,
false);
254 if (zside < 0) zp = -zp;
255 float xp = (zp<0) ? -xy.first/10 : xy.first/10;
256 float yp = xy.second/10.0;
259 std::pair<int,int> recoLayerCell=
hgcCons_[0]->simToReco(cell,layer,wafer,heeTopo.
detectorType());
260 cell = recoLayerCell.first;
261 layer = recoLayerCell.second;
264 if (layer<0 || cell<0) {
269 float energy = simHit->energy();
272 if (eeHitRefs.count(
id.rawId()) != 0) energySum = std::get<0>(eeHitRefs[
id.rawId()]);
274 eeHitRefs[
id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
279 for (std::map<unsigned int,HGCHitTuple>::iterator itr=eeHitRefs.begin();
280 itr != eeHitRefs.end(); ++itr) {
282 edm::LogInfo(
"HGCalValid") <<
"EEHit[" << idx <<
"] " << std::hex
283 << itr->first <<
std::dec <<
"; Energy "
284 << std::get<0>(itr->second)
285 <<
"; Position (" << std::get<1>(itr->second)
286 <<
", " << std::get<2>(itr->second) <<
", "
287 << std::get<3>(itr->second) <<
")" <<std::endl;
298 for (std::vector<PCaloHit>::const_iterator simHit = fhSimHits->begin();
299 simHit != fhSimHits->end();++simHit) {
300 int subdet,
zside, layer, wafer, celltype, cell;
302 std::pair<float, float>
xy =
hgcCons_[1]->locateCell(cell,layer,wafer,
false);
303 float zp =
hgcCons_[1]->waferZ(layer,
false);
304 if (zside < 0) zp = -zp;
305 float xp = (zp<0) ? -xy.first/10 : xy.first/10;
306 float yp = xy.second/10.0;
309 std::pair<int,int> recoLayerCell =
hgcCons_[1]->simToReco(cell,layer,wafer,hefTopo.
detectorType());
310 cell = recoLayerCell.first;
311 layer = recoLayerCell.second;
313 if(layer<0 || cell<0) {
318 float energy = simHit->energy();
320 if (fhHitRefs.count(
id.rawId()) != 0) energySum = std::get<0>(fhHitRefs[
id.rawId()]);
322 fhHitRefs[
id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
327 for (std::map<unsigned int,HGCHitTuple>::iterator itr=fhHitRefs.begin();
328 itr != fhHitRefs.end(); ++itr) {
330 edm::LogInfo(
"HGCalValid") <<
"FHHit[" << idx <<
"] " << std::hex
331 << itr->first <<
std::dec <<
"; Energy "
332 << std::get<0>(itr->second) <<
"; Position ("
333 << std::get<1>(itr->second) <<
", "
334 << std::get<2>(itr->second) <<
", "
335 << std::get<3>(itr->second) <<
")" <<std::endl;
346 for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin();
347 simHit != bhSimHits->end(); ++simHit) {
352 double zp = cell.
rz/10;
356 int sign = (z==0)?(-1):(1);
360 float energy = simHit->energy();
362 if (bhHitRefs.count(
id.rawId()) != 0) energySum = std::get<0>(bhHitRefs[
id.rawId()]);
367 bhHitRefs[
id.rawId()] = std::make_tuple(energySum,cell.eta,cell.phi,zp);
369 edm::LogInfo(
"HGCalValid") <<
"Accept " <<
id << std::endl;
371 edm::LogInfo(
"HGCalValid") <<
"Reject " <<
id << std::endl;
377 for (std::map<unsigned int,HGCHitTuple>::iterator itr=bhHitRefs.begin();
378 itr != bhHitRefs.end(); ++itr) {
380 edm::LogInfo(
"HGCalValid") <<
"BHHit[" << idx <<
"] " << std::hex
381 << itr->first <<
std::dec <<
"; Energy "
382 << std::get<0>(itr->second) <<
"; Position ("
383 << std::get<1>(itr->second) <<
", "
384 << std::get<2>(itr->second) <<
", "
385 << std::get<3>(itr->second) <<
")" <<std::endl;
397 for (
auto it = theHits->
begin(); it != theHits->
end(); ++it) {
398 double energy = it->energy();
400 std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
401 if (itr != eeHitRefs.end()) {
406 heedxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
407 heedyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
408 heedzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
411 edm::LogInfo(
"HGCalValid") <<
"EEHit: " << std::hex << it->id().rawId()
413 << std::get<0>(itr->second) <<
", "
414 << std::get<1>(itr->second) <<
", "
415 << std::get<2>(itr->second) <<
", "
416 << std::get<3>(itr->second) <<
") Rec ("
417 << energy <<
", " << xyz.
x() <<
", "
418 << xyz.
y() <<
", " << xyz.
z() <<
")\n";
431 for (
auto it = theHits->
begin(); it!=theHits->
end(); ++it) {
432 double energy = it->energy();
434 std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
435 if (itr != fhHitRefs.end()) {
441 hefdxVsX->
Fill(std::get<1>(itr->second),(xyz.
x()-std::get<1>(itr->second)));
442 hefdyVsY->
Fill(std::get<2>(itr->second),(xyz.
y()-std::get<2>(itr->second)));
443 hefdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
446 edm::LogInfo(
"HGCalValid") <<
"FHHit: " << std::hex << it->id().rawId()
448 << std::get<0>(itr->second) <<
", "
449 << std::get<1>(itr->second) <<
", "
450 << std::get<2>(itr->second) <<
", "
451 << std::get<3>(itr->second) <<
") Rec ("
452 << energy <<
"," << xyz.
x() <<
", "
453 << xyz.
y() <<
", " << xyz.
z() <<
")\n";
468 for (
auto it = theHits->
begin(); it!=theHits->
end(); ++it) {
471 double energy = it->energy();
475 std::map<unsigned int, HGCHitTuple>::const_iterator itr = bhHitRefs.find(
id.rawId());
476 if (itr != bhHitRefs.end()) {
478 double fac = sinh(std::get<1>(itr->second));
479 double pT = std::get<3>(itr->second) / fac;
480 double xp = pT *
cos(std::get<2>(itr->second));
481 double yp = pT *
sin(std::get<2>(itr->second));
486 hebdPhiVsPhi->
Fill(std::get<2>(itr->second),(ang3-std::get<2>(itr->second)));
487 hebdzVsZ->
Fill(std::get<3>(itr->second),(xyz.
z()-std::get<3>(itr->second)));
491 edm::LogInfo(
"HGCalValid") <<
"BHHit: " << std::hex <<
id.rawId()
493 << std::get<0>(itr->second) <<
", "
494 << std::get<1>(itr->second) <<
", "
495 << std::get<2>(itr->second) <<
", "
496 << std::get<3>(itr->second) <<
") Rec ("
497 << energy <<
", " << xyz.
x() <<
", "
498 << 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
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
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< const HGCalGeometry * > hgcGeometry_
MonitorElement * hebEnRec
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
std::tuple< float, float, float, float > HGCHitTuple
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitToken_
void addDefault(ParameterSetDescription const &psetDescription)
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
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_
MonitorElement * hebdPhiVsPhi
edm::InputTag fhSimHitSource
const_iterator end() const
MonitorElement * hebEnSimRec
T value() const
Explicit access to value in case implicit conversion not OK.
edm::InputTag eeSimHitSource
HGCalHitValidation(const edm::ParameterSet &)
MonitorElement * hefdxVsX
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const HcalDDDRecConstants * hcConr_
MonitorElement * hefRecVsSimZ
HcalCellType::HcalCell cell(int det, int zside, int depth, int etaR, int iphi) const
MonitorElement * hefdzVsZ
double energySum(const DataFrame &df, int fs, int ls)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
MonitorElement * hebdzVsZ
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_