Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HGCAL trigger] make code compatible with V9 geometry #24256

Merged
merged 29 commits into from Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
60caa62
make public detid constants for trigger geometry access
jbsauvan Aug 2, 2018
ddcfdca
Add v9 geometry
jbsauvan Aug 2, 2018
61d054f
Add data files
jbsauvan Aug 2, 2018
a366d03
Add custom function for V9 geometry
jbsauvan Aug 2, 2018
681526c
Cleaning V9 geometry
jbsauvan Aug 2, 2018
4791a28
Add digi detid converter module
jbsauvan Aug 2, 2018
ef2acfb
Merged hgc-tpg-devel-CMSSW_10_2_0_pre5 from repository PFCal-dev with…
jbsauvan Aug 8, 2018
6d74d6d
Merge branch 'geom-v9-devel' into geom-v9-devel-1030pre1
jbsauvan Aug 8, 2018
33a4fef
Remove unused variable
jbsauvan Aug 8, 2018
b028db2
V9 geometry fixes
jbsauvan Aug 8, 2018
86d18cc
Add exceptions for incompatible geometry initialization
jbsauvan Aug 8, 2018
1abc0e9
Remove commented code
jbsauvan Aug 8, 2018
66f9578
Merge pull request #214 from jbsauvan/geom-v9-devel-1030pre1
jbsauvan Aug 9, 2018
8f60cca
Merged hgc-tpg-devel-CMSSW_10_3_0_pre1 from repository PFCal-dev with…
jbsauvan Aug 9, 2018
a66c5bb
Update scintillator TC mapping
jbsauvan Aug 9, 2018
c800cfb
code-check fix
jbsauvan Aug 9, 2018
836821a
Put HGCAL TPG back in sequence for V9 geometry
jbsauvan Aug 9, 2018
e1b44a6
Remove V9 geometry data files
jbsauvan Aug 9, 2018
8f97487
Remove commented code
jbsauvan Aug 9, 2018
7c78b2b
Cleaning
jbsauvan Aug 11, 2018
87609f9
Adding protections in bhGeometry and hscGeometry access
jbsauvan Aug 11, 2018
b486d4e
Use typedefs
jbsauvan Aug 11, 2018
068e5d5
Change warnings to exceptions
jbsauvan Aug 11, 2018
ccf96cc
Remove duplicate function
jbsauvan Aug 11, 2018
4696234
Remove set
jbsauvan Aug 11, 2018
d048617
move try/catch
jbsauvan Aug 11, 2018
fbbcb27
Use stream::EDAnalyzer for geometry tester
jbsauvan Aug 11, 2018
34d9b32
Remove variable duplicates
jbsauvan Aug 11, 2018
0fa0557
Fix era in geoemtry tester V9
jbsauvan Aug 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h
Expand Up @@ -61,7 +61,7 @@ class HGCScintillatorDetId : public DetId {

static const HGCScintillatorDetId Undefined;

private:
public:

static const int kHGCalPhiOffset = 0;
static const int kHGCalPhiMask = 0x1FF;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/ForwardDetId/interface/HGCSiliconDetId.h
Expand Up @@ -106,7 +106,7 @@ class HGCSiliconDetId : public DetId {

static const HGCSiliconDetId Undefined;

private:
public:

static const int kHGCalCellUOffset = 0;
static const int kHGCalCellUMask = 0x1F;
Expand Down
3 changes: 1 addition & 2 deletions L1Trigger/Configuration/python/SimL1Emulator_cff.py
Expand Up @@ -62,8 +62,7 @@
_phase2_siml1emulator += hgcalTriggerPrimitives

from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
from Configuration.Eras.Modifier_phase2_hgcalV9_cff import phase2_hgcalV9
(phase2_hgcal & ~phase2_hgcalV9).toReplaceWith( SimL1Emulator , _phase2_siml1emulator )
phase2_hgcal.toReplaceWith( SimL1Emulator , _phase2_siml1emulator )

# If PreMixing, don't run these modules during first step
# TODO: Do we actually need anything from here run in stage1?
Expand Down
42 changes: 39 additions & 3 deletions L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h
Expand Up @@ -31,16 +31,46 @@ class HGCalTriggerGeometryBase

const std::string& name() const { return name_; }

bool isV9Geometry() const {return !calo_geometry_.isValid();}
const edm::ESHandle<CaloGeometry>& caloGeometry() const {return calo_geometry_;}
const HGCalGeometry* eeGeometry() const {return (static_cast<const HGCalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Forward,HGCEE)));}
const HGCalGeometry* fhGeometry() const {return (static_cast<const HGCalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Forward,HGCHEF)));}
const HcalGeometry* bhGeometry() const {return (static_cast<const HcalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)));}
const HGCalGeometry* eeGeometry() const
{
return ( hgc_ee_geometry_.isValid() ? hgc_ee_geometry_.product() : (static_cast<const HGCalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Forward,HGCEE))) );
}
const HGCalGeometry* fhGeometry() const
{
return (hgc_hsi_geometry_.isValid() ? hgc_hsi_geometry_.product() : (static_cast<const HGCalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Forward,HGCHEF))) );
}
const HcalGeometry* bhGeometry() const
{
if(hgc_hsc_geometry_.isValid())
{
throw cms::Exception("HGCalTriggerGeometry")
<< "bhGeometry cannot be used with the V9 geometry";
}
return (static_cast<const HcalGeometry*>(calo_geometry_->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)));
}
const HGCalGeometry* hsiGeometry() const {return fhGeometry();}
const HGCalGeometry* hscGeometry() const
{
if(!hgc_hsc_geometry_.isValid())
{
throw cms::Exception("HGCalTriggerGeometry")
<< "hscGeometry cannot be used with the V7 and V8 geometries";
}
return hgc_hsc_geometry_.product();
}
const HGCalTopology& eeTopology() const {return eeGeometry()->topology();}
const HGCalTopology& fhTopology() const {return fhGeometry()->topology();}
const HcalTopology& bhTopology() const {return bhGeometry()->topology();}
const HGCalTopology& hsiTopology() const {return hsiGeometry()->topology();}
const HGCalTopology& hscTopology() const {return hscGeometry()->topology();}

// non-const access to the geometry class
virtual void initialize(const edm::ESHandle<CaloGeometry>&) = 0;
virtual void initialize(const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&) = 0;
virtual void reset();

// const access to the geometry class
Expand All @@ -66,12 +96,18 @@ class HGCalTriggerGeometryBase

protected:
void setCaloGeometry(const edm::ESHandle<CaloGeometry>& geom) {calo_geometry_=geom;}
void setEEGeometry(const edm::ESHandle<HGCalGeometry>& geom) {hgc_ee_geometry_=geom;}
void setHSiGeometry(const edm::ESHandle<HGCalGeometry>& geom) {hgc_hsi_geometry_=geom;}
void setHScGeometry(const edm::ESHandle<HGCalGeometry>& geom) {hgc_hsc_geometry_=geom;}


private:
const std::string name_;

edm::ESHandle<CaloGeometry> calo_geometry_;
edm::ESHandle<HGCalGeometry> hgc_ee_geometry_;
edm::ESHandle<HGCalGeometry> hgc_hsi_geometry_;
edm::ESHandle<HGCalGeometry> hgc_hsc_geometry_;

};

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/plugins/HGCalTriggerDigiProducer.cc
Expand Up @@ -97,7 +97,7 @@ void HGCalTriggerDigiProducer::produce(edm::Event& e, const edm::EventSetup& es)
}
std::unordered_map<uint32_t,HGCalDigiCollection> hit_modules_bh;
for(const auto& bhdata : bh_digis) {
if(HcalDetId(bhdata.id()).subdetId()!=HcalEndcap) continue;
if(DetId(bhdata.id()).det()!=DetId::HGCalHSc && HcalDetId(bhdata.id()).subdetId()!=HcalEndcap) continue;
uint32_t module = triggerGeometry_->getModuleFromCell(bhdata.id());
if(triggerGeometry_->disconnectedModule(module)) continue;
auto itr_insert = hit_modules_bh.emplace(module, HGCalDigiCollection());
Expand Down
21 changes: 20 additions & 1 deletion L1Trigger/L1THGCal/plugins/HGCalTriggerGeometryESProducer.cc
Expand Up @@ -52,7 +52,26 @@ produce(const CaloGeometryRecord& iRecord)
geometry->reset();
edm::ESHandle<CaloGeometry> calo_geometry;
iRecord.get(calo_geometry);
geometry->initialize(calo_geometry);
// Initialize trigger geometry for V7/V8 HGCAL geometry
if(calo_geometry.isValid() &&
calo_geometry->getSubdetectorGeometry(DetId::Forward,HGCEE) &&
calo_geometry->getSubdetectorGeometry(DetId::Forward,HGCHEF) &&
calo_geometry->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)
)
{
geometry->initialize(calo_geometry);
}
// Initialize trigger geometry for V9 HGCAL geometry
else
{
edm::ESHandle<HGCalGeometry> ee_geometry;
edm::ESHandle<HGCalGeometry> hsi_geometry;
edm::ESHandle<HGCalGeometry> hsc_geometry;
iRecord.getRecord<IdealGeometryRecord>().get("HGCalEESensitive",ee_geometry);
iRecord.getRecord<IdealGeometryRecord>().get("HGCalHESiliconSensitive",hsi_geometry);
iRecord.getRecord<IdealGeometryRecord>().get("HGCalHEScintillatorSensitive",hsc_geometry);
geometry->initialize(ee_geometry, hsi_geometry, hsc_geometry);
}
return geometry;

}
Expand Down
Expand Up @@ -15,6 +15,9 @@ class HGCalTriggerGeometryHexImp1 : public HGCalTriggerGeometryGenericMapping
HGCalTriggerGeometryHexImp1(const edm::ParameterSet& conf);

void initialize(const edm::ESHandle<CaloGeometry>& ) final;
void initialize(const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&) final;

private:
edm::FileInPath l1tCellsMapping_;
Expand All @@ -34,7 +37,6 @@ HGCalTriggerGeometryHexImp1::HGCalTriggerGeometryHexImp1(const edm::ParameterSet
{
}


/*****************************************************************/
void HGCalTriggerGeometryHexImp1::initialize(const edm::ESHandle<CaloGeometry>& calo_geometry)
/*****************************************************************/
Expand All @@ -48,6 +50,17 @@ void HGCalTriggerGeometryHexImp1::initialize(const edm::ESHandle<CaloGeometry>&

}

/*****************************************************************/
void HGCalTriggerGeometryHexImp1::initialize(const edm::ESHandle<HGCalGeometry>& hgc_ee_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsi_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsc_geometry
)
/*****************************************************************/
{
throw cms::Exception("BadGeometry")
<< "HGCalTriggerGeometryHexImp1 geometry cannot be initialized with the V9 HGCAL geometry";
}



/*****************************************************************/
Expand Down
Expand Up @@ -16,6 +16,9 @@ class HGCalTriggerGeometryHexImp2 : public HGCalTriggerGeometryBase
HGCalTriggerGeometryHexImp2(const edm::ParameterSet& conf);

void initialize(const edm::ESHandle<CaloGeometry>& ) final;
void initialize(const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&) final;
void reset() final;

unsigned getTriggerCellFromCell( const unsigned ) const final;
Expand Down Expand Up @@ -118,6 +121,17 @@ initialize(const edm::ESHandle<CaloGeometry>& calo_geometry)

}

void
HGCalTriggerGeometryHexImp2::
initialize(const edm::ESHandle<HGCalGeometry>& hgc_ee_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsi_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsc_geometry
)
{
throw cms::Exception("BadGeometry")
<< "HGCalTriggerGeometryHexImp2 geometry cannot be initialized with the V9 HGCAL geometry";
}

unsigned
HGCalTriggerGeometryHexImp2::
getTriggerCellFromCell( const unsigned cell_id ) const
Expand Down
Expand Up @@ -17,6 +17,9 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase
HGCalTriggerGeometryHexLayerBasedImp1(const edm::ParameterSet& conf);

void initialize(const edm::ESHandle<CaloGeometry>& ) final;
void initialize(const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&) final;
void reset() final;

unsigned getTriggerCellFromCell( const unsigned ) const final;
Expand Down Expand Up @@ -155,6 +158,17 @@ initialize(const edm::ESHandle<CaloGeometry>& calo_geometry)

}

void
HGCalTriggerGeometryHexLayerBasedImp1::
initialize(const edm::ESHandle<HGCalGeometry>& hgc_ee_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsi_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsc_geometry
)
{
throw cms::Exception("BadGeometry")
<< "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL geometry";
}

unsigned
HGCalTriggerGeometryHexLayerBasedImp1::
getTriggerCellFromCell( const unsigned cell_id ) const
Expand Down
Expand Up @@ -15,9 +15,14 @@ class HGCalTriggerGeometryImp1 : public HGCalTriggerGeometryGenericMapping
HGCalTriggerGeometryImp1(const edm::ParameterSet& conf);

void initialize(const edm::ESHandle<CaloGeometry>& ) final;
void initialize(const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&,
const edm::ESHandle<HGCalGeometry>&) final;

private:
edm::FileInPath l1tCellsMapping_;

void buildMaps();
};


Expand All @@ -29,7 +34,6 @@ HGCalTriggerGeometryImp1::HGCalTriggerGeometryImp1(const edm::ParameterSet& conf
{
}


/*****************************************************************/
void HGCalTriggerGeometryImp1::initialize(const edm::ESHandle<CaloGeometry>& calo_geometry)
/*****************************************************************/
Expand All @@ -39,6 +43,24 @@ void HGCalTriggerGeometryImp1::initialize(const edm::ESHandle<CaloGeometry>& cal
<< "WARNING: Only the EE part is covered.\n"\
<< "WARNING: There is no neighbor information.\n";
setCaloGeometry(calo_geometry);
}

/*****************************************************************/
void HGCalTriggerGeometryImp1::initialize(const edm::ESHandle<HGCalGeometry>& hgc_ee_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsi_geometry,
const edm::ESHandle<HGCalGeometry>& hgc_hsc_geometry
)
/*****************************************************************/
{
throw cms::Exception("BadGeometry")
<< "HGCalTriggerGeometryImp1 geometry cannot be initialized with the V9 HGCAL geometry";
}


/*****************************************************************/
void HGCalTriggerGeometryImp1::buildMaps()
/*****************************************************************/
{
//
// read trigger cell mapping file
std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
Expand Down