-
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.
- Loading branch information
Bruno Alves
committed
Aug 28, 2020
1 parent
9bca0cb
commit bc1fc76
Showing
10 changed files
with
201 additions
and
227 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<use name="root"/> | ||
<use name="RecoLocalCalo/HGCalRecProducers"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> | ||
<Flags CXXFLAGS="-O0"/> | ||
<Flags CXXFLAGS="-g"/> |
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,15 @@ | ||
<library name="RecHitsValidator" file="HeterogeneousHGCalRecHitsValidator.cc"> | ||
<use name="cuda"/> | ||
<use name="HeterogeneousCore/CUDACore"/> | ||
<use name="HeterogeneousCore/CUDAUtilities"/> | ||
<use name="DataFormats/HcalDetId"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/MessageLogger"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="RecoLocalCalo/HGCalRecAlgos"/> | ||
<use name="RecoLocalCalo/HGCalRecProducers"/> | ||
<use name="Geometry/HGCalGeometry"/> | ||
<use name="Geometry/HGCalCommonData"/> | ||
<use name="UserCode/RecHitsValidator"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
84 changes: 84 additions & 0 deletions
84
UserCode/RecHitsValidator/plugins/HeterogeneousHGCalRecHitsValidator.cc
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,84 @@ | ||
#include "UserCode/RecHitsValidator/plugins/HeterogeneousHGCalRecHitsValidator.h" | ||
|
||
#include "DetectorDescription/OfflineDBLoader/interface/GeometryInfoDump.h" | ||
#include "Geometry/Records/interface/IdealGeometryRecord.h" | ||
#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" | ||
#include "SimG4CMS/Calo/interface/CaloHitID.h" | ||
|
||
#include "DetectorDescription/Core/interface/DDFilter.h" | ||
#include "DetectorDescription/Core/interface/DDFilteredView.h" | ||
#include "DetectorDescription/Core/interface/DDSolid.h" | ||
|
||
#include "DataFormats/GeometryVector/interface/Basic3DVector.h" | ||
|
||
#include "CLHEP/Units/GlobalSystemOfUnits.h" | ||
|
||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "CommonTools/UtilAlgos/interface/TFileService.h" | ||
|
||
HeterogeneousHGCalRecHitsValidator::HeterogeneousHGCalRecHitsValidator( const edm::ParameterSet &ps ) : | ||
tokens_( {{ {{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsCEEToken")), | ||
consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsCEEToken"))}}, | ||
{{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsCEEToken")), | ||
consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsCEEToken"))}}, | ||
{{consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("cpuRecHitsCEEToken")), | ||
consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsCEEToken"))}} }} ), | ||
treename_("tree") | ||
{ | ||
edm::Service<TFileService> fs; | ||
tree_ = fs->make<TTree>(treename_.c_str(), treename_.c_str()); | ||
tree_->Branch( "cpuDetid", "std::vector<unsigned int>", &cpuValidRecHits.detid ); | ||
tree_->Branch( "gpuDetid", "std::vector<unsigned int>", &gpuValidRecHits.detid ); | ||
//zhist.push_back(fs->make<TH1F>(("z"+treename_).c_str(), ("z"+treename_).c_str(), 2000, -10, 650)); | ||
} | ||
|
||
HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator() | ||
{ | ||
} | ||
|
||
void HeterogeneousHGCalRecHitsValidator::endJob() | ||
{ | ||
} | ||
|
||
void HeterogeneousHGCalRecHitsValidator::set_geometry_(const edm::EventSetup& setup, const unsigned int& detidx) | ||
{ | ||
edm::ESHandle<HGCalGeometry> handle; | ||
setup.get<IdealGeometryRecord>().get(handles_str_[detidx], handle); | ||
} | ||
|
||
void HeterogeneousHGCalRecHitsValidator::analyze(const edm::Event &event, const edm::EventSetup &setup) | ||
{ | ||
recHitTools_.getEventSetup(setup); | ||
|
||
//future subdetector loop | ||
for(size_t idet=0; idet<1; ++idet) { | ||
set_geometry_(setup, 1/*idet*/); | ||
|
||
//get hits produced with the CPU | ||
event.getByToken(tokens_[idet][0], handles_[idet][0]); | ||
const auto &cpuhits = *handles_[idet][0]; | ||
|
||
//get hits produced with the GPU | ||
event.getByToken(tokens_[idet][1], handles_[idet][1]); | ||
const auto &gpuhits = *handles_[idet][1]; | ||
|
||
size_t nhits = cpuhits.size(); | ||
assert( nhits == gpuhits.size() ); | ||
for(unsigned int i=0; i<nhits; i++) { | ||
const HGCRecHit &cpuHit = cpuhits[i]; | ||
const HGCRecHit &gpuHit = gpuhits[i]; | ||
|
||
const HGCalDetId cpuDetid = cpuHit.detid(); | ||
const HGCalDetId gpuDetid = gpuHit.detid(); | ||
cpuValidRecHits.detid.push_back( cpuDetid ); | ||
gpuValidRecHits.detid.push_back( gpuDetid ); | ||
|
||
std::cout << cpuDetid << ", " << gpuDetid << std::endl; | ||
} | ||
} | ||
tree_->Fill(); | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(HeterogeneousHGCalRecHitsValidator); |
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 was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
UserCode/RecHitsValidator/python/HeterogeneousHGCalRecHitsValidator_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,70 @@ | ||
import os, sys, glob | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.StandardSequences.Eras import eras | ||
from Configuration.ProcessModifiers.gpu_cff import gpu | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') | ||
|
||
#package loading | ||
process = cms.Process("gpuValidation", gpu) | ||
process.load('FWCore.MessageService.MessageLogger_cfi') | ||
process.load('Configuration.StandardSequences.Services_cff') | ||
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') | ||
process.load('Configuration.StandardSequences.MagneticField_cff') | ||
#process.load('Configuration.EventContent.EventContent_cff') | ||
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') | ||
process.load('Configuration.Geometry.GeometryExtended2026D46Reco_cff') | ||
process.load('HeterogeneousCore.CUDAServices.CUDAService_cfi') | ||
process.load('RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi') | ||
process.load('SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi') | ||
|
||
from RecoLocalCalo.HGCalRecProducers.HGCalRecHit_cfi import dEdX_weights_v10 | ||
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) | ||
|
||
#TFileService | ||
fileName = 'validation.root' | ||
process.TFileService = cms.Service("TFileService", | ||
fileName = cms.string(fileName), | ||
closeFileFast = cms.untracked.bool(True) | ||
) | ||
|
||
|
||
fNames = ['file:/afs/cern.ch/user/b/bfontana/CMSSW_11_1_0_pre6/src/20495.0_CloseByPGun_CE_E_Front_200um+CE_E_Front_200um_2026D41_GenSimHLBeamSpotFull+DigiFullTrigger_2026D41+RecoFullGlobal_2026D41+HARVESTFullGlobal_2026D41/step3.root'] | ||
keep = 'keep *' | ||
drop = 'drop CSCDetIdCSCALCTPreTriggerDigiMuonDigiCollection_simCscTriggerPrimitiveDigis__HLT' | ||
process.source = cms.Source("PoolSource", | ||
fileNames = cms.untracked.vstring(fNames), | ||
inputCommands = cms.untracked.vstring([keep, drop]), | ||
duplicateCheckMode = cms.untracked.string("noDuplicateCheck")) | ||
|
||
process.options = cms.untracked.PSet( | ||
wantSummary = cms.untracked.bool( False )) #add option for edmStreams | ||
process.HeterogeneousHGCalHEFRecHits = cms.EDProducer('HeterogeneousHGCalHEFRecHitProducer', | ||
HGCHEFUncalibRecHitsTok = cms.InputTag('HGCalUncalibRecHit', 'HGCHEFUncalibRecHits'), | ||
HGCHEF_keV2DIGI = HGCalRecHit.__dict__['HGCHEF_keV2DIGI'], | ||
minValSiPar = HGCalRecHit.__dict__['minValSiPar'], | ||
maxValSiPar = HGCalRecHit.__dict__['maxValSiPar'], | ||
constSiPar = HGCalRecHit.__dict__['constSiPar'], | ||
noiseSiPar = HGCalRecHit.__dict__['noiseSiPar'], | ||
HGCHEF_fCPerMIP = HGCalRecHit.__dict__['HGCHEF_fCPerMIP'], | ||
HGCHEF_isSiFE = HGCalRecHit.__dict__['HGCHEF_isSiFE'], | ||
HGCHEF_noise_fC = HGCalRecHit.__dict__['HGCHEF_noise_fC'], | ||
HGCHEF_cce = HGCalRecHit.__dict__['HGCHEF_cce'], | ||
rangeMatch = HGCalRecHit.__dict__['rangeMatch'], | ||
rangeMask = HGCalRecHit.__dict__['rangeMask'], | ||
rcorr = HGCalRecHit.__dict__['thicknessCorrection'], | ||
weights = HGCalRecHit.__dict__['layerWeights'] ) | ||
|
||
|
||
process.valid = cms.EDAnalyzer( "HeterogeneousHGCalRecHitsValidator", | ||
cpuRecHitsHSiToken = cms.InputTag('HeterogeneousHGCalHEFRecHits','HGCHEFRecHits'), | ||
gpuRecHitsHSiToken = cms.InputTag('HeterogeneousHGCalHEFRecHits','HGCHEFRecHits') ) | ||
|
||
|
||
process.task = cms.Task( process.HeterogeneousHGCalHEFRecHitProducer * process.valid ) | ||
process.path = cms.Path( process.task ) | ||
|
||
|
||
process.out = cms.OutputModule( "PoolOutputModule", | ||
fileName = cms.untracked.string('out.root') ) | ||
process.outpath = cms.EndPath(process.out) |
Oops, something went wrong.