Skip to content

Commit 5562a1d

Browse files
authored
Merge pull request #47794 from bsunanda/Phase2-hgx363B
Phase2-hgx363B Make some corrections to remove certain bugs in the description of scintillator tiles of HGCal V19
2 parents 00bacc9 + 4aa231c commit 5562a1d

File tree

10 files changed

+379
-256
lines changed

10 files changed

+379
-256
lines changed

Geometry/HGCalCommonData/data/hgcalHEmix/v19/hgcalHEmix.xml

Lines changed: 233 additions & 233 deletions
Large diffs are not rendered by default.

Geometry/HGCalCommonData/plugins/DDHGCalMixRotatedFineCassette.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class DDHGCalMixRotatedFineCassette : public DDAlgorithm {
6060
HGCalGeomTools geomTools_;
6161
HGCalCassette cassette_;
6262

63+
static constexpr double tol0_ = 0.0001;
6364
static constexpr double tol1_ = 0.01;
6465
static constexpr double tol2_ = 0.00001;
6566

@@ -391,7 +392,7 @@ void DDHGCalMixRotatedFineCassette::initialize(const DDNumericArguments& nArgs,
391392
unsigned int j2 = std::min((j1 + 6), j2max);
392393
for (unsigned int j = j1; j < j2; ++j)
393394
st1 << " [" << j << "] " << std::setw(9) << cassetteShiftScnt_[j];
394-
edm::LogVerbatim("HGCalGeom") << st1.str();
395+
edm::LogVerbatim("HGCalGeom") << "Scintillator Cassette shiftt " << convertRadToDeg(dphi) << " " << st1.str();
395396
}
396397
#endif
397398
nameSpace_ = DDCurrentNamespace::ns();
@@ -607,7 +608,7 @@ void DDHGCalMixRotatedFineCassette::positionMix(const DDLogicalPart& glog,
607608
<< fimin << ":" << fimax;
608609
#endif
609610
double phi1 = dphi * (fimin - 1);
610-
double phi2 = dphi * (fimax - fimin + 1);
611+
double phi2 = dphi * (fimax - fimin + 1) - tol0_;
611612
auto cshift = cassette_.getShift(layer + 1, 1, cassette, true);
612613
#ifdef EDM_ML_DEBUG
613614
int cassette0 = HGCalCassette::cassetteType(2, 1, cassette); //
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
# This config came from a copy of 2 files from Configuration/Geometry/python
4+
5+
from Geometry.HGCalCommonData.testHGCalV19XML_cfi import *
6+
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cff import *
7+
from SLHCUpgradeSimulations.Geometry.fakePhase2OuterTrackerConditions_cff import *
8+
from Geometry.EcalCommonData.ecalSimulationParameters_cff import *
9+
from Geometry.HcalCommonData.hcalDDDSimConstants_cff import *
10+
from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import *
11+
from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *
12+
from Geometry.MuonNumbering.muonGeometryConstants_cff import *
13+
from Geometry.MuonNumbering.muonOffsetESProducer_cff import *
14+
from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *
15+
16+
# tracker
17+
from Geometry.CommonTopologies.globalTrackingGeometry_cfi import *
18+
from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import *
19+
from Geometry.TrackerGeometryBuilder.trackerParameters_cff import *
20+
from Geometry.TrackerNumberingBuilder.trackerTopology_cfi import *
21+
from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *
22+
trackerGeometry.applyAlignment = False
23+
24+
# calo
25+
from Geometry.CaloEventSetup.HGCalTopology_cfi import *
26+
from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import *
27+
from Geometry.CaloEventSetup.CaloTopology_cfi import *
28+
from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import *
29+
CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder",
30+
SelectedCalos = cms.vstring("HCAL",
31+
"ZDC",
32+
"EcalBarrel",
33+
"TOWER",
34+
"HGCalEESensitive",
35+
"HGCalHESiliconSensitive",
36+
"HGCalHEScintillatorSensitive"
37+
)
38+
)
39+
from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import *
40+
from Geometry.HcalEventSetup.HcalGeometry_cfi import *
41+
from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import *
42+
from Geometry.HcalEventSetup.CaloTowerTopology_cfi import *
43+
from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import *
44+
from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import *
45+
from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import *
46+
from Geometry.EcalMapping.EcalMapping_cfi import *
47+
from Geometry.EcalMapping.EcalMappingRecord_cfi import *
48+
49+
# muon
50+
from Geometry.MuonNumbering.muonNumberingInitialization_cfi import *
51+
from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import *
52+
from Geometry.GEMGeometryBuilder.gemGeometry_cff import *
53+
from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import *
54+
from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import *
55+
56+
# forward
57+
from Geometry.ForwardGeometry.ForwardGeometry_cfi import *
58+
59+
# timing
60+
from RecoMTD.DetLayers.mtdDetLayerGeometry_cfi import *
61+
from Geometry.MTDGeometryBuilder.mtdParameters_cff import *
62+
from Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cff import *
63+
from Geometry.MTDNumberingBuilder.mtdTopology_cfi import *
64+
from Geometry.MTDGeometryBuilder.mtdGeometry_cfi import *
65+
from Geometry.MTDGeometryBuilder.idealForDigiMTDGeometry_cff import *
66+
mtdGeometry.applyAlignment = False

Geometry/HGCalCommonData/src/HGCalCassette.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#include "FWCore/MessageLogger/interface/MessageLogger.h"
32
#include "Geometry/HGCalCommonData/interface/HGCalCassette.h"
43
#include <algorithm>
@@ -40,7 +39,7 @@ void HGCalCassette::setParameter(int cassette, const std::vector<double>& shifts
4039
}
4140

4241
void HGCalCassette::setParameterScint(const std::vector<double>& shifts) {
43-
shifts_.insert(shifts_.end(), shifts.begin(), shifts.end());
42+
// shifts_.insert(shifts_.end(), shifts.begin(), shifts.end());
4443
shiftsScnt_.insert(shiftsScnt_.end(), shifts.begin(), shifts.end());
4544
#ifdef EDM_ML_DEBUG
4645
for (uint32_t j1 = 0; j1 < shifts.size(); j1 += 12) {
@@ -66,8 +65,8 @@ std::pair<double, double> HGCalCassette::getShift(int layer, int zside, int cass
6665
<< cassette << ":" << scnt << " loc " << locc << ":" << loc << " size "
6766
<< shiftsScnt_.size() << ":" << shifts_.size();
6867
#endif
69-
std::pair<double, double> xy = (typeHE_ && scnt) ? (std::make_pair(-zside * shiftsScnt_[loc], shiftsScnt_[loc + 1]))
70-
: (std::make_pair(-zside * shifts_[loc], shifts_[loc + 1]));
68+
std::pair<double, double> xy = (typeHE_ && scnt) ? (std::make_pair(shiftsScnt_[loc], shiftsScnt_[loc + 1]))
69+
: (std::make_pair(shifts_[loc], shifts_[loc + 1]));
7170
#ifdef EDM_ML_DEBUG
7271
edm::LogVerbatim("HGCalGeom") << "HGCalCassette::getShift: Layer " << layer << " zside " << zside << " type "
7372
<< typeHE_ << " cassette " << cassette << " Loc " << locc << ":" << loc << " shift "

Geometry/HGCalCommonData/src/HGCalDDDConstants.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ std::array<int, 5> HGCalDDDConstants::assignCellHex(
199199
std::array<int, 3> HGCalDDDConstants::assignCellTrap(float x, float y, float z, int layer, bool reco) const {
200200
int irad(-1), iphi(-1), type(-1);
201201
const auto& indx = getIndex(layer, reco);
202+
#ifdef EDM_ML_DEBUG
203+
edm::LogVerbatim("HGCalGeom") << "assignCellTrap: Layer " << layer << ":" << reco << " indx " << indx.first << ":"
204+
<< indx.second;
205+
#endif
202206
if (indx.first < 0)
203207
return std::array<int, 3>{{irad, iphi, type}};
204208
int zside = (z > 0) ? 1 : -1;
@@ -1008,8 +1012,10 @@ std::pair<float, float> HGCalDDDConstants::locateCellTrap(
10081012
int zside, int lay, int irad, int iphi, bool reco, bool debug) const {
10091013
float x(0), y(0);
10101014
const auto& indx = getIndex(lay, reco);
1015+
#ifdef EDM_ML_DEBUG
10111016
edm::LogVerbatim("HGCalGeom") << "locateCellTrap:: Input " << lay << ":" << irad << ":" << iphi << ":" << zside << ":"
10121017
<< reco << ":" << indx.first;
1018+
#endif
10131019
debug = true;
10141020
if (indx.first >= 0) {
10151021
int ir = std::abs(irad);
@@ -1499,6 +1505,10 @@ std::pair<int, int> HGCalDDDConstants::tileType(int layer, int ring, int phi) co
14991505
type = 1 + (itr->second).type;
15001506
sipm = ((itr->second).sipm == HGCalTypes::SiPMLarge) ? 0 : 1;
15011507
}
1508+
#ifdef EDM_ML_DEBUG
1509+
edm::LogVerbatim("HGCalGeom") << "tileType::Input layet:ring:phi " << layer << ":" << ring << ":" << phi
1510+
<< " Output Type:SiPM " << type << ":" << sipm;
1511+
#endif
15021512
return std::make_pair(type, sipm);
15031513
}
15041514

Geometry/HGCalCommonData/test/HGCalConvert.cpp

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,8 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
17741774
}
17751775
}
17761776
if (((debug / 100) % 10) > 0)
1777-
std::cout << "Layer|Phi|Ring " << layer << ":" << phi << ":" << irmin << ":" << irmax << std::endl;
1777+
std::cout << "Layer Phi Ring " << layer << ":" << phi << ":" << irmin << ":" << irmax << " nphi " << nphis
1778+
<< std::endl;
17781779
if (phi == 1) {
17791780
tile0.layer = layer;
17801781
tile0.rmin = irmin;
@@ -1788,13 +1789,21 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
17881789
do {
17891790
int phimax = tile0.phimax;
17901791
tile0.phimax = tile0.cassette * tilePhisWord;
1792+
if (((debug / 1000) % 10) > 0)
1793+
std::cout << "1Layer " << tile0.layer << " R " << tile0.rmin << ":" << tile0.rmax << " Cassett "
1794+
<< tile0.cassette << " Phi " << tile0.phimin << ":" << tile0.phimax << " Word "
1795+
<< tilePhisWord << ":" << tile0.phimax << std::endl;
17911796
zones.push_back(tile0);
17921797
tile0.phimin = tile0.phimax + 1;
17931798
tile0.phimax = phimax;
17941799
++tile0.cassette;
1795-
} while (tile0.cassette * tilePhisWord < tile0.phimax);
1800+
} while (tile0.cassette * tilePhisWord <= tile0.phimax);
17961801
}
17971802
}
1803+
if (((debug / 1000) % 10) > 0)
1804+
std::cout << "2Layer " << tile0.layer << " R " << tile0.rmin << ":" << tile0.rmax << " Cassett "
1805+
<< tile0.cassette << " Phi " << tile0.phimin << ":" << tile0.phimax << " Word " << tilePhisWord
1806+
<< ":" << tile0.phimax << std::endl;
17981807
zones.push_back(tile0);
17991808
int cassette = (cassette_ == 0) ? 0 : (1 + ((phi - 1) / tilePhisWord));
18001809
tile0.layer = layer;
@@ -1803,12 +1812,22 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
18031812
tile0.phimin = phi;
18041813
tile0.phimax = phi;
18051814
tile0.cassette = cassette;
1806-
if (phi == HGCalProperty::kHGCalTilePhis)
1815+
if (phi == nphis) {
1816+
if (((debug / 1000) % 10) > 0)
1817+
std::cout << "3Layer " << tile0.layer << " R " << tile0.rmin << ":" << tile0.rmax << " Cassett "
1818+
<< tile0.cassette << " Phi " << tile0.phimin << ":" << tile0.phimax << " Word " << tilePhisWord
1819+
<< ":" << tile0.phimax << std::endl;
18071820
zones.push_back(tile0);
1821+
}
18081822
} else {
18091823
tile0.phimax = phi;
1810-
if (phi == HGCalProperty::kHGCalTilePhis)
1824+
if (phi == nphis) {
1825+
if (((debug / 1000) % 10) > 0)
1826+
std::cout << "4Layer " << tile0.layer << " R " << tile0.rmin << ":" << tile0.rmax << " Cassett "
1827+
<< tile0.cassette << " Phi " << tile0.phimin << ":" << tile0.phimax << " Word " << tilePhisWord
1828+
<< ":" << tile0.phimax << std::endl;
18111829
zones.push_back(tile0);
1830+
}
18121831
}
18131832
}
18141833
}
@@ -1827,31 +1846,51 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
18271846
std::map<int, std::pair<double, double> >::const_iterator it1;
18281847
fout << " <Vector name=" << apost << head << "RMin" << apost << " type=" << apost << "numeric" << apost
18291848
<< " nEntries=" << apost << ringR.size() << apost << ">";
1849+
if ((debug % 10) > 0)
1850+
std::cout << " <Vector name=" << apost << head << "RMin" << apost << " type=" << apost << "numeric" << apost
1851+
<< " nEntries=" << apost << ringR.size() << apost << ">";
18301852
for (it1 = ringR.begin(); it1 != ringR.end(); ++it1) {
18311853
std::string last = ((l1 + 1) == ringR.size()) ? " " : ",";
1832-
if (l1 % 6 == 0)
1854+
if (l1 % 6 == 0) {
18331855
fout << "\n " << std::setw(8) << std::setprecision(6) << (it1->second).first << "*mm" << last;
1834-
else
1856+
if ((debug % 10) > 0)
1857+
std::cout << "\n " << std::setw(8) << std::setprecision(6) << (it1->second).first << "*mm" << last;
1858+
} else {
18351859
fout << std::setw(8) << std::setprecision(6) << (it1->second).first << "*mm" << last;
1860+
if ((debug % 10) > 0)
1861+
std::cout << std::setw(8) << std::setprecision(6) << (it1->second).first << "*mm" << last;
1862+
}
18361863
++l1;
18371864
}
18381865
fout << "\n </Vector>\n";
18391866
fout << " <Vector name=" << apost << head << "RMax" << apost << " type=" << apost << "numeric" << apost
18401867
<< " nEntries=" << apost << ringR.size() << apost << ">";
1868+
if ((debug % 10) > 0) {
1869+
std::cout << "\n </Vector>\n";
1870+
std::cout << " <Vector name=" << apost << head << "RMax" << apost << " type=" << apost << "numeric" << apost
1871+
<< " nEntries=" << apost << ringR.size() << apost << ">";
1872+
}
18411873
for (it1 = ringR.begin(); it1 != ringR.end(); ++it1) {
18421874
std::string last = ((l2 + 1) == ringR.size()) ? " " : ",";
1843-
if (l2 % 6 == 0)
1875+
if (l2 % 6 == 0) {
18441876
fout << "\n " << std::setw(8) << std::setprecision(6) << (it1->second).second << "*mm" << last;
1845-
else
1877+
if ((debug % 10) > 0)
1878+
std::cout << "\n " << std::setw(8) << std::setprecision(6) << (it1->second).second << "*mm" << last;
1879+
} else {
18461880
fout << std::setw(8) << std::setprecision(6) << (it1->second).second << "*mm" << last;
1881+
if ((debug % 10) > 0)
1882+
std::cout << std::setw(8) << std::setprecision(6) << (it1->second).second << "*mm" << last;
1883+
}
18471884
++l2;
18481885
}
18491886
fout << "\n </Vector>\n";
18501887
fout << " <Vector name=" << apost << head << "LayerRings" << apost << " type=" << apost << "numeric" << apost
18511888
<< " nEntries=" << apost << nmax << apost << ">";
1852-
if ((debug % 10) > 0)
1889+
if ((debug % 10) > 0) {
1890+
std::cout << "\n </Vector>\n";
18531891
std::cout << " <Vector name=" << apost << head << "LayerRings" << apost << " type=" << apost << "numeric"
18541892
<< apost << " nEntries=" << apost << nmax << apost << ">";
1893+
}
18551894
for (int k = 0; k < nmax; ++k) {
18561895
std::string last = ((k + 1) == nmax) ? " " : ",";
18571896
int lyr1r2 = HGCalTileIndex::tilePack(zones[k].layer, zones[k].rmin, zones[k].rmax);
@@ -1916,6 +1955,8 @@ void ConvertScintillatorV1::makeTitle(std::ofstream& fout,
19161955
if ((debug & 10) > 0)
19171956
std::cout << "\n </Vector>\n";
19181957
}
1958+
if ((debug & 10) > 0)
1959+
std::cout << "\n\n";
19191960
}
19201961

19211962
ConvertNoseV0::ConvertNoseV0(unsigned int layMax1, unsigned int layMax2) : layMax1_(layMax1), layMax2_(layMax2) {

SimCalorimetry/HGCalSimProducers/src/HGCFEElectronics.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "vdt/vdtMath.h"
77

88
using namespace hgc_digi;
9+
#define EDM_ML_DEBUG
910

1011
//
1112
template <class DFr>

SimG4CMS/Calo/src/CaloSD.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,5 +1181,5 @@ void CaloSD::printDetectorLevels(const G4VTouchable* touch) const {
11811181
st1 << " " << name << ":" << touch->GetReplicaNumber(i);
11821182
}
11831183
}
1184-
edm::LogVerbatim("CaloSim") << st1.str();
1184+
edm::LogVerbatim("CaloSim") << "DetectorLeves: " << st1.str();
11851185
}

SimG4CMS/Calo/src/HGCalNumberingScheme.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz
157157
}
158158
} else if (hgcons_.tileTrapezoid()) {
159159
std::array<int, 3> id = hgcons_.assignCellTrap(pos.x(), pos.y(), pos.z(), layer, false);
160+
#ifdef EDM_ML_DEBUG
161+
edm::LogVerbatim("HGCSim") << "Trapezoid Position Layer " << layer << " Position " << pos.x() << ":" << pos.y()
162+
<< ":" << pos.z() << " ID " << id[0] << ":" << id[1] << ":" << id[2];
163+
#endif
160164
if (id[2] >= 0) {
161165
std::pair<int, int> typm = hgcons_.tileType(layer, id[0], 0);
162166
HGCScintillatorDetId detId(id[2], layer, iz * id[0], id[1], false, 0);
@@ -174,7 +178,7 @@ uint32_t HGCalNumberingScheme::getUnitID(int layer, int module, int cell, int iz
174178
if (debug)
175179
edm::LogVerbatim("HGCSim") << "Radius/Phi " << id[0] << ":" << id[1] << " Type " << id[2] << ":" << typm.first
176180
<< " SiPM " << typm.second << ":" << hgcons_.tileSiPM(typm.second) << " Layer "
177-
<< layer << " z " << iz << " " << detId << " wt " << wt << " position " << pos
181+
<< layer << " z " << iz << " ID " << detId << " wt " << wt << " position " << pos
178182
<< " R " << pos.perp();
179183
#ifdef EDM_ML_DEBUG
180184
} else {

SimG4CMS/Calo/test/python/runHGC1_cfg.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# Way to use this:
33
# cmsRun ttbar.py geometry=V18
4-
# Options for geometry V17Shift, V18
4+
# Options for geometry V17Shift, V18, V19
55
#
66
###############################################################################
77
import FWCore.ParameterSet.Config as cms
@@ -15,7 +15,7 @@
1515
"V18",
1616
VarParsing.VarParsing.multiplicity.singleton,
1717
VarParsing.VarParsing.varType.string,
18-
"geometry of operations: V17Shift, V18")
18+
"geometry of operations: V17Shift, V18, V19")
1919

2020
### get and parse the command line arguments
2121

@@ -24,12 +24,12 @@
2424

2525
####################################################################
2626

27-
if (options.geometry == "V18"):
28-
from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
29-
process = cms.Process("PROD",Phase2C22I13M9)
30-
else:
27+
if (options.geometry == "V17Shift"):
3128
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
3229
process = cms.Process("PROD",Phase2C17I13M9)
30+
else:
31+
from Configuration.Eras.Era_Phase2C22I13M9_cff import Phase2C22I13M9
32+
process = cms.Process("PROD",Phase2C22I13M9)
3333

3434
geomFile = "Geometry.HGCalCommonData.testHGCal" + options.geometry + "Reco_cff"
3535
print("Geometry file: ", geomFile)
@@ -49,6 +49,7 @@
4949
if hasattr(process,'MessageLogger'):
5050
process.MessageLogger.G4cout = dict()
5151
process.MessageLogger.G4cerr = dict()
52+
process.MessageLogger.HGCalGeom = dict()
5253
process.MessageLogger.HGCSim = dict()
5354
process.MessageLogger.CaloSim = dict()
5455

0 commit comments

Comments
 (0)