-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30323 from bsunanda/Run4-hgx247
Run4-hgx247 Add some new features for HGCal
- Loading branch information
Showing
11 changed files
with
200 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "Geometry/Records/interface/IdealGeometryRecord.h" | ||
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" | ||
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" | ||
#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" | ||
#include "CoralBase/Exception.h" | ||
|
||
class HGCalGeomLocaterTester : public edm::one::EDAnalyzer<> { | ||
public: | ||
explicit HGCalGeomLocaterTester(const edm::ParameterSet&); | ||
|
||
void analyze(edm::Event const& iEvent, edm::EventSetup const&) override; | ||
|
||
private: | ||
void doTest(const HGCalGeometry* geom, DetId::Detector det); | ||
|
||
std::string name_; | ||
edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geomToken_; | ||
}; | ||
|
||
HGCalGeomLocaterTester::HGCalGeomLocaterTester(const edm::ParameterSet& iC) | ||
: name_{iC.getParameter<std::string>("Detector")}, | ||
geomToken_{esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", name_})} {} | ||
|
||
void HGCalGeomLocaterTester::analyze(const edm::Event&, const edm::EventSetup& iSetup) { | ||
const auto& geomR = iSetup.getData(geomToken_); | ||
const HGCalGeometry* geom = &geomR; | ||
HGCalGeometryMode::GeometryMode mode = geom->topology().dddConstants().geomMode(); | ||
if ((mode == HGCalGeometryMode::Hexagon8) || (mode == HGCalGeometryMode::Hexagon8Full)) { | ||
DetId::Detector det; | ||
if (name_ == "HGCalHESiliconSensitive") | ||
det = DetId::HGCalHSi; | ||
else | ||
det = DetId::HGCalEE; | ||
std::cout << "Perform test for " << name_ << " Detector " << det << " Mode " << mode << std::endl; | ||
doTest(geom, det); | ||
} | ||
} | ||
|
||
void HGCalGeomLocaterTester::doTest(const HGCalGeometry* geom, DetId::Detector det) { | ||
const std::vector<DetId>& ids = geom->getValidDetIds(); | ||
std::cout << "doTestWafer:: " << ids.size() << " valid ids for " << geom->cellElement() << std::endl; | ||
const double tol = 0.001; | ||
const unsigned int step = 10; | ||
int all(0), good(0), bad(0); | ||
for (unsigned int k = 0; k < ids.size(); k += step) { | ||
++all; | ||
HGCSiliconDetId id(ids[k]); | ||
std::cout << "ID[" << k << "] " << id; | ||
GlobalPoint global = geom->getPosition(id); | ||
auto waferxy = geom->topology().dddConstants().locateCell(id, false); | ||
double dx = global.x() - waferxy.first; | ||
double dy = global.y() - waferxy.second; | ||
std::cout << " position (" << global.x() << ", " << global.y() << ", " << global.z() << ") waferXY (" | ||
<< waferxy.first << ", " << waferxy.second << ") Delta (" << dx << ", " << dy << ")"; | ||
if ((std::abs(dx) > tol) || (std::abs(dy) > tol)) { | ||
std::cout << "***** ERROR *****" << std::endl; | ||
++bad; | ||
geom->topology().dddConstants().locateCell(id, true); | ||
} else { | ||
std::cout << std::endl; | ||
++good; | ||
} | ||
} | ||
std::cout << "\n\nStudied " << all << " (" << ids.size() << ") IDs of which " << good << " are good and " << bad | ||
<< " are bad\n\n\n\n"; | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(HGCalGeomLocaterTester); |
49 changes: 49 additions & 0 deletions
49
Geometry/HGCalGeometry/test/python/testHGCalGeomLocator_cfg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("PROD") | ||
process.load("SimGeneral.HepPDTESSource.pdt_cfi") | ||
|
||
process.load("Configuration.Geometry.GeometryExtended2026D41Reco_cff") | ||
#process.load("Geometry.HGCalCommonData.testHGCV12XML_cfi") | ||
#process.load("Geometry.HGCalCommonData.hgcalParametersInitialization_cfi") | ||
#process.load("Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi") | ||
#process.load("Geometry.CaloEventSetup.HGCalV9Topology_cfi") | ||
#process.load("Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi") | ||
process.load('FWCore.MessageService.MessageLogger_cfi') | ||
|
||
if hasattr(process,'MessageLogger'): | ||
process.MessageLogger.categories.append('HGCalGeom') | ||
|
||
process.load("IOMC.RandomEngine.IOMC_cff") | ||
process.RandomNumberGeneratorService.generator.initialSeed = 456789 | ||
|
||
process.source = cms.Source("EmptySource") | ||
|
||
process.generator = cms.EDProducer("FlatRandomEGunProducer", | ||
PGunParameters = cms.PSet( | ||
PartID = cms.vint32(14), | ||
MinEta = cms.double(-3.5), | ||
MaxEta = cms.double(3.5), | ||
MinPhi = cms.double(-3.14159265359), | ||
MaxPhi = cms.double(3.14159265359), | ||
MinE = cms.double(9.99), | ||
MaxE = cms.double(10.01) | ||
), | ||
AddAntiParticle = cms.bool(False), | ||
Verbosity = cms.untracked.int32(0), | ||
firstRun = cms.untracked.uint32(1) | ||
) | ||
|
||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.prodEE = cms.EDAnalyzer("HGCalGeomLocaterTester", | ||
Detector = cms.string("HGCalEESensitive"), | ||
) | ||
|
||
process.prodHEF = process.prodEE.clone( | ||
Detector = "HGCalHESiliconSensitive", | ||
) | ||
|
||
process.p1 = cms.Path(process.generator*process.prodEE*process.prodHEF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters