Skip to content

Commit c8d01ce

Browse files
authored
Merge pull request #48003 from bsunanda/Phase2-hgx363W
Phase2-hgx363W Make an example to show the wafer characteristic of all valid DetIds of the silicon type
2 parents 1019309 + a512872 commit c8d01ce

File tree

4 files changed

+180
-2
lines changed

4 files changed

+180
-2
lines changed

DataFormats/ForwardDetId/interface/HGCSiliconDetId.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class HGCSiliconDetId : public DetId {
6464
if (!gen.null()) {
6565
if ((gen.det() != HGCalEE) && (gen.det() != HGCalHSi)) {
6666
throw cms::Exception("Invalid DetId")
67-
<< "Cannot initialize HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
67+
<< "Cannot initialize HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec << " Det " << gen.det();
6868
}
6969
}
7070
id_ = gen.rawId();
@@ -75,7 +75,7 @@ class HGCSiliconDetId : public DetId {
7575
if (!gen.null()) {
7676
if ((gen.det() != HGCalEE) && (gen.det() != HGCalHSi)) {
7777
throw cms::Exception("Invalid DetId")
78-
<< "Cannot assign HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec;
78+
<< "Cannot assign HGCSiliconDetId from " << std::hex << gen.rawId() << std::dec << " Det " << gen.det();
7979
}
8080
}
8181
id_ = gen.rawId();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
from Geometry.HGCalGeometry.hgcalWaferInfoEE_cfi import *
4+
5+
hgcalWaferInfoHE = hgcalWaferInfoEE.clone(
6+
detector = "HGCalHESiliconSensitive",
7+
)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// -*- C++ -*-
2+
//
3+
// Package: HGCalWaferInfo
4+
// Class: HGCalWaferInfo
5+
//
6+
/**\class HGCalWaferInfo HGCalWaferInfo.cc
7+
test/HGCalWaferInfo.cc
8+
9+
Description: <one line class summary>
10+
11+
Implementation:
12+
<Notes on implementation>
13+
*/
14+
//
15+
// Original Author: Sunanda Banerjee
16+
// Created: Mon 2025/05/02
17+
//
18+
//
19+
20+
// system include files
21+
#include <fstream>
22+
#include <iostream>
23+
#include <memory>
24+
#include <string>
25+
#include <vector>
26+
27+
// user include files
28+
#include "FWCore/Framework/interface/Frameworkfwd.h"
29+
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
30+
#include "FWCore/Framework/interface/Event.h"
31+
#include "FWCore/Framework/interface/EventSetup.h"
32+
#include "FWCore/Framework/interface/MakerMacros.h"
33+
#include "FWCore/MessageLogger/interface/MessageLogger.h"
34+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
35+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
36+
37+
#include "DataFormats/DetId/interface/DetId.h"
38+
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
39+
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
40+
#include "Geometry/Records/interface/IdealGeometryRecord.h"
41+
42+
class HGCalWaferInfo : public edm::one::EDAnalyzer<> {
43+
public:
44+
explicit HGCalWaferInfo(const edm::ParameterSet&);
45+
~HGCalWaferInfo() override = default;
46+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
47+
48+
void beginJob() override {}
49+
void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
50+
void endJob() override {}
51+
52+
private:
53+
const std::string name_;
54+
const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geomToken_;
55+
};
56+
57+
HGCalWaferInfo::HGCalWaferInfo(const edm::ParameterSet& iC)
58+
: name_(iC.getParameter<std::string>("detector")),
59+
geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag("", name_))) {}
60+
61+
void HGCalWaferInfo::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
62+
edm::ParameterSetDescription desc;
63+
desc.add<std::string>("detector", "HGCalEESensitive");
64+
descriptions.add("hgcalWaferInfoEE", desc);
65+
}
66+
67+
// ------------ method called to produce the data ------------
68+
void HGCalWaferInfo::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
69+
const auto& geom = &iSetup.getData(geomToken_);
70+
DetId::Detector det = (name_ == "HGCalHESiliconSensitive") ? DetId::HGCalHSi : DetId::HGCalEE;
71+
edm::LogVerbatim("HGCalGeom") << "Perform test for " << name_ << " Detector " << det;
72+
73+
const std::vector<DetId>& ids = geom->getValidDetIds();
74+
edm::LogVerbatim("HGCalGeom") << "Use " << ids.size() << " valid ids for " << geom->cellElement();
75+
std::string parts[26] = {"Full", "Five", "ChopTwo", "ChopTwoM", "Half", "Semi", "Semi2", "Three", "Half2",
76+
"Five2", "????", "LDTop", "LDBottom", "LDLeft", "LDRight", "LDFive", "LDThree", "????",
77+
"????", "????", "????", "HDTop", "HDBottom", "HDLeft", "HDRight", "HDFive"};
78+
std::string types[4] = {"HD120", "LD200", "LD300", "HD200"};
79+
80+
for (auto const& id : ids) {
81+
if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
82+
HGCSiliconDetId detId(id);
83+
HGCalParameters::waferInfo info =
84+
geom->topology().dddConstants().waferInfo(detId.layer(), detId.waferU(), detId.waferV());
85+
edm::LogVerbatim("HGCalGeom") << "ID: " << detId << " Type " << info.type << ":" << types[info.type] << " Part "
86+
<< info.part << ":" << parts[info.part] << " Orient " << info.orient << " Cassette "
87+
<< info.cassette << " at " << geom->getPosition(id, true, false);
88+
} else {
89+
edm::LogVerbatim("HGCalGeom") << "Illegal Det " << id.det() << " in " << std::hex << id.rawId() << std::dec
90+
<< " ERROR";
91+
}
92+
}
93+
}
94+
95+
// define this as a plug-in
96+
DEFINE_FWK_MODULE(HGCalWaferInfo);
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
###############################################################################
2+
# Way to use this:
3+
# cmsRun testHGCalWaferInfo_cfg.py geometry=D110
4+
#
5+
# Options for geometry D95, D96, D98, D99, D100, D101, D102, D103, D104,
6+
# D105, D106, D107, D108, D109, D110, D111, D112, D113,
7+
# D114, D115, D116, D120
8+
#
9+
###############################################################################
10+
import FWCore.ParameterSet.Config as cms
11+
import os, sys, imp, re
12+
import FWCore.ParameterSet.VarParsing as VarParsing
13+
14+
####################################################################
15+
### SETUP OPTIONS
16+
options = VarParsing.VarParsing('standard')
17+
options.register('geometry',
18+
"D110",
19+
VarParsing.VarParsing.multiplicity.singleton,
20+
VarParsing.VarParsing.varType.string,
21+
"geometry of operations: D95, D96, D98, D99, D100, D101, D102, D103, D104, D105, D106, D107, D108, D109, D110, D111, D112, D113, D114, D115, D116, D120")
22+
23+
### get and parse the command line arguments
24+
options.parseArguments()
25+
print(options)
26+
27+
####################################################################
28+
# Use the options
29+
30+
geomName = "Run4" + options.geometry
31+
geomFile = "Configuration.Geometry.GeometryExtended" + geomName + "Reco_cff"
32+
import Configuration.Geometry.defaultPhase2ConditionsEra_cff as _settings
33+
GLOBAL_TAG, ERA = _settings.get_era_and_conditions(geomName)
34+
35+
print("Geometry Name: ", geomName)
36+
print("Geom file Name: ", geomFile)
37+
print("Global Tag Name: ", GLOBAL_TAG)
38+
print("Era Name: ", ERA)
39+
40+
process = cms.Process('PROD',ERA)
41+
42+
process.load(geomFile)
43+
process.load("SimGeneral.HepPDTESSource.pdt_cfi")
44+
process.load("Geometry.HGCalGeometry.hgcalWaferInfo_cff")
45+
46+
process.load('FWCore.MessageService.MessageLogger_cfi')
47+
if hasattr(process,'MessageLogger'):
48+
process.MessageLogger.HGCalGeom=dict()
49+
process.MessageLogger.HGCalGeomX=dict()
50+
51+
process.load("IOMC.RandomEngine.IOMC_cff")
52+
process.RandomNumberGeneratorService.generator.initialSeed = 456789
53+
54+
process.source = cms.Source("EmptySource")
55+
56+
process.generator = cms.EDProducer("FlatRandomEGunProducer",
57+
PGunParameters = cms.PSet(
58+
PartID = cms.vint32(14),
59+
MinEta = cms.double(-3.5),
60+
MaxEta = cms.double(3.5),
61+
MinPhi = cms.double(-3.14159265359),
62+
MaxPhi = cms.double(3.14159265359),
63+
MinE = cms.double(9.99),
64+
MaxE = cms.double(10.01)
65+
),
66+
AddAntiParticle = cms.bool(False),
67+
Verbosity = cms.untracked.int32(0),
68+
firstRun = cms.untracked.uint32(1)
69+
)
70+
71+
process.maxEvents = cms.untracked.PSet(
72+
input = cms.untracked.int32(1)
73+
)
74+
75+
process.p1 = cms.Path(process.generator*process.hgcalWaferInfoEE*process.hgcalWaferInfoHE)

0 commit comments

Comments
 (0)