From f74748e2e7faad8c7a890912b350d4ce3179d3ac Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 2 Oct 2020 15:45:30 -0500 Subject: [PATCH 01/20] first FACILE commit --- .../Configuration/test/OnLine_HLT_GRun.py | 37 +++-- RecoLocalCalo/HcalRecProducers/BuildFile.xml | 4 + .../src/HcalPhase1Reconstructor_FACILE.cc | 129 ++++++++++++++++++ 3 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index e1bdb994ae40b..ff62cbe8dcd75 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -7331,9 +7331,9 @@ processQIE11 = cms.bool( True ), pulseShapeParametersQIE11 = cms.PSet( ), algoConfigClass = cms.string( "" ), - saveInfos = cms.bool( False ), + saveInfos = cms.bool( True ), flagParametersQIE11 = cms.PSet( ), - makeRecHits = cms.bool( True ), + makeRecHits = cms.bool( False ), pulseShapeParametersQIE8 = cms.PSet( UseDualFit = cms.bool( True ), LinearCut = cms.vdouble( -3.0, -0.054, -0.054 ), @@ -7423,6 +7423,21 @@ dropZSmarkedPassed = cms.bool( True ), recoParamsFromDB = cms.bool( True ) ) +process.hltHbherecoFACILE = cms.EDProducer("HcalPhase1Reconstructor_FACILE", + Client = cms.PSet( + batchSize = cms.untracked.uint32(16000), + address = cms.untracked.string("ailab01.fnal.gov"), + port = cms.untracked.uint32(8001), + timeout = cms.untracked.uint32(30), + modelName = cms.string("facile_all_v2"), + mode = cms.string("Async"), + modelVersion = cms.int32(-1),#string("Async"), + verbose = cms.untracked.bool(False), + allowedTries = cms.untracked.uint32(0), + outputs = cms.untracked.vstring("output/BiasAdd"), + ), + ChannelInfoName = cms.InputTag("hltHbhereco") +) process.hltHfprereco = cms.EDProducer( "HFPreReconstructor", soiShift = cms.int32( 0 ), sumAllTimeSlices = cms.bool( False ), @@ -90783,7 +90798,7 @@ process.HLTBeamSpot = cms.Sequence( process.hltScalersRawToDigi + process.hltOnlineBeamSpot ) process.HLTBeginSequence = cms.Sequence( process.hltTriggerType + process.HLTL1UnpackerSequence + process.HLTBeamSpot ) process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.hltEcalDigis + process.hltEcalUncalibRecHit + process.hltEcalDetIdToBeRecovered + process.hltEcalRecHit ) -process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) +process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHbherecoFACILE + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) process.HLTDoCaloSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence + process.HLTDoLocalHcalSequence + process.hltTowerMakerForAll ) process.HLTAK8CaloJetsReconstructionSequence = cms.Sequence( process.HLTDoCaloSequence + process.hltAK8CaloJets + process.hltAK8CaloJetsIDPassed ) process.HLTAK8CaloCorrectorProducersSequence = cms.Sequence( process.hltAK8CaloFastJetCorrector + process.hltAK8CaloRelativeCorrector + process.hltAK8CaloAbsoluteCorrector + process.hltAK8CaloResidualCorrector + process.hltAK8CaloCorrector ) @@ -91037,7 +91052,7 @@ process.HLTMu24IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu24Eta2p1IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu30IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) -process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco ) +process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHbherecoFACILE) process.HLTStoppedHSCPJetSequence = cms.Sequence( process.hltStoppedHSCPTowerMakerForAll + process.hltStoppedHSCPIterativeCone4CaloJets ) process.HLTMuonLocalRecoMeanTimerSequence = cms.Sequence( process.hltMuonDTDigis + process.hltDt1DRecHits + process.hltDt4DSegmentsMeanTimer + process.hltMuonCSCDigis + process.hltCsc2DRecHits + process.hltCscSegments + process.hltMuonRPCDigis + process.hltRpcRecHits ) process.HLTL2muonrecoNocandCosmicSeedMeanTimerSequence = cms.Sequence( process.HLTMuonLocalRecoMeanTimerSequence + process.hltL2CosmicOfflineMuonSeeds + process.hltL2CosmicMuonSeeds + process.hltL2CosmicMuons ) @@ -92083,7 +92098,7 @@ # enable TrigReport, TimeReport and MultiThreading process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool( True ), - numberOfThreads = cms.untracked.uint32( 4 ), + numberOfThreads = cms.untracked.uint32( 1 ), numberOfStreams = cms.untracked.uint32( 0 ), sizeOfStackForThreadsInKB = cms.untracked.uint32( 10*1024 ) ) @@ -92094,10 +92109,10 @@ process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = 'auto:run3_hlt_GRun') if 'MessageLogger' in process.__dict__: - process.MessageLogger.categories.append('TriggerSummaryProducerAOD') - process.MessageLogger.categories.append('L1GtTrigReport') - process.MessageLogger.categories.append('L1TGlobalSummary') - process.MessageLogger.categories.append('HLTrigReport') + #process.MessageLogger.categories.append('TriggerSummaryProducerAOD') + #process.MessageLogger.categories.append('L1GtTrigReport') + #process.MessageLogger.categories.append('L1TGlobalSummary') + #process.MessageLogger.categories.append('HLTrigReport') process.MessageLogger.categories.append('FastReport') # add specific customizations @@ -92108,10 +92123,10 @@ _customInfo['globalTags'][False] = "auto:run3_mc_GRun" _customInfo['inputFiles']={} _customInfo['inputFiles'][True] = "file:RelVal_Raw_GRun_DATA.root" -_customInfo['inputFiles'][False] = "file:RelVal_Raw_GRun_MC.root" +_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" _customInfo['maxEvents' ]= 100 _customInfo['globalTag' ]= "auto:run3_hlt_GRun" -_customInfo['inputFile' ]= ['file:RelVal_Raw_GRun_DATA.root'] +_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] _customInfo['realData' ]= True from HLTrigger.Configuration.customizeHLTforALL import customizeHLTforAll process = customizeHLTforAll(process,"GRun",_customInfo) diff --git a/RecoLocalCalo/HcalRecProducers/BuildFile.xml b/RecoLocalCalo/HcalRecProducers/BuildFile.xml index c3ae589a0c0a7..c3b30a5a802a7 100644 --- a/RecoLocalCalo/HcalRecProducers/BuildFile.xml +++ b/RecoLocalCalo/HcalRecProducers/BuildFile.xml @@ -4,5 +4,9 @@ + + + + diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc new file mode 100644 index 0000000000000..3544957b757b3 --- /dev/null +++ b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc @@ -0,0 +1,129 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "HeterogeneousCore/SonicTriton/interface/TritonClient.h" +#include "HeterogeneousCore/SonicCore/interface/SonicEDProducer.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" + +//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE2.h" +class HcalPhase1Reconstructor_FACILE : public SonicEDProducer +{ +public: + explicit HcalPhase1Reconstructor_FACILE(edm::ParameterSet const& cfg) : + SonicEDProducer(cfg), + //nInputs_(cfg.getParameter("nInputs")), + //batchSize_(cfg.getParameter("batchSize")), + fChannelInfoName(cfg.getParameter("ChannelInfoName")), + fTokChannelInfo(this->template consumes(fChannelInfoName)) + + { + this->template produces(); + this->setDebugName("HcalPhase1Reconstructor_FACILE"); + } + + void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { + + const HBHEChannelInfoCollection *channelInfo = 0; + edm::Handle hChannelInfo; + iEvent.getByToken(fTokChannelInfo, hChannelInfo); + channelInfo = hChannelInfo.product(); + + //iInput = Input(1000, 0.f); + auto& input1 = iInput.begin()->second; + auto data1 = std::make_shared>(); + data1->reserve(input1.batchSize()); + + unsigned int iBatch = 0; + for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ + + //keeptrack of batching for inputs + iBatch = std::distance(channelInfo->begin(),itC); + + const HBHEChannelInfo& pChannel(*itC); + const HcalDetId pDetId = pChannel.id(); + hcalIds.push_back(pDetId); + + //FACILE uses iphi as a continuous variable + //iInput[iBatch*nInputs_ + 0] = (float)pDetId.iphi(); + //iInput[iBatch*nInputs_ + 1] = (float)pChannel.tsGain(0); + data1->emplace_back(iBatch, (float)pDetId.iphi()); + + for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { + //iInput[iBatch*nInputs_ + itTS + 2] = (float)pChannel.tsRawCharge(itTS); + data1->emplace_back(iBatch, (float)pChannel.tsRawCharge(itTS)); + } + + //FACILE considers 7 Hcal depths as binary variables + for (int itDepth=1; itDepth < 8; itDepth++){ + if (pDetId.depth() == itDepth) data1->emplace_back(iBatch, 1.);//iInput[iBatch*nInputs_ + itDepth + 9] = 1.; + else data1->emplace_back(iBatch, 0.);//iInput[iBatch*nInputs_ + itDepth + 9] = 0.; + } + + //ieta is also encoded as a binary variable + for (int itIeta = 0; itIeta < 30; itIeta++){ + if (std::abs(pDetId.ieta()) == itIeta) data1->emplace_back(iBatch, 1.);//iInput[iBatch*nInputs_ + itIeta + 17] = 1.; + else data1->emplace_back(iBatch, 0.);//iInput[iBatch*nInputs_ + itIeta + 17] = 0.; + } + } + + input1.toServer(data1); + } + + void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { + std::unique_ptr out; + out = std::make_unique(); + out->reserve(hcalIds.size()); + + unsigned int iBatch = 0; + const auto& output1 = iOutput.begin()->second; + const auto& tmp = output1.fromServer(); + + for(HBHERecHitCollection::const_iterator itRH = out->begin(); itRH != out->end(); itRH++){ + + //float rhE = iOutput[iBatch]; + float rhE = tmp[0][iBatch]; + //FACILE uses rectified linear activation function =>should be positive definite + if(rhE < 0.) rhE = 0.; + //throw cms exception? + if(std::isnan(rhE)) rhE = 0; + if(std::isinf(rhE)) rhE = 0; + + //FACILE does no time reco + HBHERecHit rh = HBHERecHit(hcalIds[iBatch],rhE,0.f,0.f); + out->push_back(rh); //hcalIds[iBatch],rhE,0.f,0.f); + + iBatch++; + } + iEvent.put(std::move(out)); + } + + /*static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + TritonClient::fillPSetDescription(desc); + //add producer-specific parameters + desc.add("ChannelInfoName","hbheprereco"); + descriptions.add("HcalPhase1Reconstructor_FACILE",desc); + }*/ + + +private: + //int nInputs_, batchSize_; + edm::InputTag fChannelInfoName; + edm::EDGetTokenT fTokChannelInfo; + std::vector hcalIds; +}; + +DEFINE_FWK_MODULE(HcalPhase1Reconstructor_FACILE); From ec5a06c72db98884d2d9a551fb7f17185627645a Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Sat, 3 Oct 2020 10:40:11 -0500 Subject: [PATCH 02/20] second FACILE commit --- .../Configuration/test/OnLine_HLT_GRun.py | 4 +-- .../src/HcalPhase1Reconstructor_FACILE.cc | 26 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index ff62cbe8dcd75..f9e108b703adc 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -92108,12 +92108,12 @@ from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = 'auto:run3_hlt_GRun') -if 'MessageLogger' in process.__dict__: +#if 'MessageLogger' in process.__dict__: #process.MessageLogger.categories.append('TriggerSummaryProducerAOD') #process.MessageLogger.categories.append('L1GtTrigReport') #process.MessageLogger.categories.append('L1TGlobalSummary') #process.MessageLogger.categories.append('HLTrigReport') - process.MessageLogger.categories.append('FastReport') + #process.MessageLogger.categories.append('FastReport') # add specific customizations _customInfo = {} diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc index 3544957b757b3..5b66dba2abb26 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc @@ -42,44 +42,40 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer channelInfo = hChannelInfo.product(); //iInput = Input(1000, 0.f); - auto& input1 = iInput.begin()->second; + auto& input1 = iInput.end()->second; auto data1 = std::make_shared>(); data1->reserve(input1.batchSize()); - unsigned int iBatch = 0; for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ - //keeptrack of batching for inputs - iBatch = std::distance(channelInfo->begin(),itC); - + std::vector input; const HBHEChannelInfo& pChannel(*itC); const HcalDetId pDetId = pChannel.id(); hcalIds.push_back(pDetId); //FACILE uses iphi as a continuous variable - //iInput[iBatch*nInputs_ + 0] = (float)pDetId.iphi(); - //iInput[iBatch*nInputs_ + 1] = (float)pChannel.tsGain(0); - data1->emplace_back(iBatch, (float)pDetId.iphi()); - + input.push_back((float)pDetId.iphi()); for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { - //iInput[iBatch*nInputs_ + itTS + 2] = (float)pChannel.tsRawCharge(itTS); - data1->emplace_back(iBatch, (float)pChannel.tsRawCharge(itTS)); + input.push_back((float)pChannel.tsRawCharge(itTS)); } //FACILE considers 7 Hcal depths as binary variables for (int itDepth=1; itDepth < 8; itDepth++){ - if (pDetId.depth() == itDepth) data1->emplace_back(iBatch, 1.);//iInput[iBatch*nInputs_ + itDepth + 9] = 1.; - else data1->emplace_back(iBatch, 0.);//iInput[iBatch*nInputs_ + itDepth + 9] = 0.; + if (pDetId.depth() == itDepth) input.push_back(1.); + else input.push_back(0.); } //ieta is also encoded as a binary variable for (int itIeta = 0; itIeta < 30; itIeta++){ - if (std::abs(pDetId.ieta()) == itIeta) data1->emplace_back(iBatch, 1.);//iInput[iBatch*nInputs_ + itIeta + 17] = 1.; - else data1->emplace_back(iBatch, 0.);//iInput[iBatch*nInputs_ + itIeta + 17] = 0.; + if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.); + else input.push_back(0.); } + + data1->push_back(input); } input1.toServer(data1); + std::cout << "inputs made" << std::endl; } void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { From 959b7dd24b2361ad350b54d8316835321f5ff435 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 6 Oct 2020 09:40:25 -0500 Subject: [PATCH 03/20] output debug --- .../Configuration/test/OnLine_HLT_GRun.py | 32 +++++++------- RecoLocalCalo/HcalRecProducers/BuildFile.xml | 1 + .../src/HcalPhase1Reconstructor_FACILE.cc | 43 +++++++++++-------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index f9e108b703adc..375018f75e380 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -7318,12 +7318,12 @@ saveQIE11DataTags = cms.untracked.vstring( ), firstSample = cms.int32( 0 ) ) -process.hltHbhereco = cms.EDProducer( "HBHEPhase1Reconstructor", +process.hltHbherecopre = cms.EDProducer( "HBHEPhase1Reconstructor", tsFromDB = cms.bool( False ), setPulseShapeFlagsQIE8 = cms.bool( False ), use8ts = cms.bool( True ), digiLabelQIE11 = cms.InputTag( "hltHcalDigis" ), - saveDroppedInfos = cms.bool( False ), + saveDroppedInfos = cms.bool( True ), setNoiseFlagsQIE8 = cms.bool( False ), saveEffectivePedestal = cms.bool( True ), digiLabelQIE8 = cms.InputTag( "hltHcalDigis" ), @@ -7375,7 +7375,7 @@ ), setNegativeFlagsQIE8 = cms.bool( False ), setNegativeFlagsQIE11 = cms.bool( False ), - processQIE8 = cms.bool( False ), + processQIE8 = cms.bool( True ), algorithm = cms.PSet( ts4Thresh = cms.double( 0.0 ), meanTime = cms.double( 0.0 ), @@ -7423,20 +7423,20 @@ dropZSmarkedPassed = cms.bool( True ), recoParamsFromDB = cms.bool( True ) ) -process.hltHbherecoFACILE = cms.EDProducer("HcalPhase1Reconstructor_FACILE", +process.hltHbhereco = cms.EDProducer("HcalPhase1Reconstructor_FACILE", Client = cms.PSet( batchSize = cms.untracked.uint32(16000), address = cms.untracked.string("ailab01.fnal.gov"), port = cms.untracked.uint32(8001), - timeout = cms.untracked.uint32(30), + timeout = cms.untracked.uint32(300), modelName = cms.string("facile_all_v2"), mode = cms.string("Async"), modelVersion = cms.int32(-1),#string("Async"), - verbose = cms.untracked.bool(False), - allowedTries = cms.untracked.uint32(0), + verbose = cms.untracked.bool(True), + allowedTries = cms.untracked.uint32(5), outputs = cms.untracked.vstring("output/BiasAdd"), ), - ChannelInfoName = cms.InputTag("hltHbhereco") + ChannelInfoName = cms.InputTag("hltHbherecopre") ) process.hltHfprereco = cms.EDProducer( "HFPreReconstructor", soiShift = cms.int32( 0 ), @@ -90798,7 +90798,7 @@ process.HLTBeamSpot = cms.Sequence( process.hltScalersRawToDigi + process.hltOnlineBeamSpot ) process.HLTBeginSequence = cms.Sequence( process.hltTriggerType + process.HLTL1UnpackerSequence + process.HLTBeamSpot ) process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.hltEcalDigis + process.hltEcalUncalibRecHit + process.hltEcalDetIdToBeRecovered + process.hltEcalRecHit ) -process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHbherecoFACILE + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) +process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) process.HLTDoCaloSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence + process.HLTDoLocalHcalSequence + process.hltTowerMakerForAll ) process.HLTAK8CaloJetsReconstructionSequence = cms.Sequence( process.HLTDoCaloSequence + process.hltAK8CaloJets + process.hltAK8CaloJetsIDPassed ) process.HLTAK8CaloCorrectorProducersSequence = cms.Sequence( process.hltAK8CaloFastJetCorrector + process.hltAK8CaloRelativeCorrector + process.hltAK8CaloAbsoluteCorrector + process.hltAK8CaloResidualCorrector + process.hltAK8CaloCorrector ) @@ -91052,7 +91052,7 @@ process.HLTMu24IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu24Eta2p1IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu30IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) -process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHbherecoFACILE) +process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco) process.HLTStoppedHSCPJetSequence = cms.Sequence( process.hltStoppedHSCPTowerMakerForAll + process.hltStoppedHSCPIterativeCone4CaloJets ) process.HLTMuonLocalRecoMeanTimerSequence = cms.Sequence( process.hltMuonDTDigis + process.hltDt1DRecHits + process.hltDt4DSegmentsMeanTimer + process.hltMuonCSCDigis + process.hltCsc2DRecHits + process.hltCscSegments + process.hltMuonRPCDigis + process.hltRpcRecHits ) process.HLTL2muonrecoNocandCosmicSeedMeanTimerSequence = cms.Sequence( process.HLTMuonLocalRecoMeanTimerSequence + process.hltL2CosmicOfflineMuonSeeds + process.hltL2CosmicMuonSeeds + process.hltL2CosmicMuons ) @@ -92106,7 +92106,7 @@ # override the GlobalTag, connection string and pfnPrefix if 'GlobalTag' in process.__dict__: from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag - process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = 'auto:run3_hlt_GRun') + process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = '112X_mcRun3_2021_realistic_v7') #if 'MessageLogger' in process.__dict__: #process.MessageLogger.categories.append('TriggerSummaryProducerAOD') @@ -92120,14 +92120,14 @@ _customInfo['menuType' ]= "GRun" _customInfo['globalTags']= {} _customInfo['globalTags'][True ] = "auto:run3_hlt_GRun" -_customInfo['globalTags'][False] = "auto:run3_mc_GRun" +_customInfo['globalTags'][False] = "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" _customInfo['inputFiles']={} _customInfo['inputFiles'][True] = "file:RelVal_Raw_GRun_DATA.root" -_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" +_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root" #"root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" _customInfo['maxEvents' ]= 100 -_customInfo['globalTag' ]= "auto:run3_hlt_GRun" -_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] -_customInfo['realData' ]= True +_customInfo['globalTag' ]= "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" +_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root']#'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] +_customInfo['realData' ]= False #True from HLTrigger.Configuration.customizeHLTforALL import customizeHLTforAll process = customizeHLTforAll(process,"GRun",_customInfo) diff --git a/RecoLocalCalo/HcalRecProducers/BuildFile.xml b/RecoLocalCalo/HcalRecProducers/BuildFile.xml index c3b30a5a802a7..451251f2617c5 100644 --- a/RecoLocalCalo/HcalRecProducers/BuildFile.xml +++ b/RecoLocalCalo/HcalRecProducers/BuildFile.xml @@ -8,5 +8,6 @@ + diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc index 5b66dba2abb26..b1b4a03d87a1b 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc @@ -41,10 +41,9 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer iEvent.getByToken(fTokChannelInfo, hChannelInfo); channelInfo = hChannelInfo.product(); - //iInput = Input(1000, 0.f); - auto& input1 = iInput.end()->second; + auto& input1 = iInput.begin()->second; auto data1 = std::make_shared>(); - data1->reserve(input1.batchSize()); + data1->reserve(std::distance(channelInfo->begin(), channelInfo->end())); for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ @@ -55,27 +54,37 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer //FACILE uses iphi as a continuous variable input.push_back((float)pDetId.iphi()); + input.push_back((float)pChannel.tsGain(0.)); for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { input.push_back((float)pChannel.tsRawCharge(itTS)); } //FACILE considers 7 Hcal depths as binary variables for (int itDepth=1; itDepth < 8; itDepth++){ - if (pDetId.depth() == itDepth) input.push_back(1.); - else input.push_back(0.); + if (pDetId.depth() == itDepth) input.push_back(1.f); + else input.push_back(0.f); } //ieta is also encoded as a binary variable - for (int itIeta = 0; itIeta < 30; itIeta++){ - if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.); - else input.push_back(0.); + for (int itIeta = 1; itIeta < 30; itIeta++){ + if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); + else input.push_back(0.f); } data1->push_back(input); } + + //set batch at maximum RH size after ZS and pad + unsigned int last = std::distance(channelInfo->begin(), channelInfo->end()); + if(last < input1.batchSize()){ + std::vector pV(47,0.f); + for(unsigned int iP = last; iP != input1.batchSize(); iP++){ + data1->push_back(pV); + } + } + input1.toServer(data1); - std::cout << "inputs made" << std::endl; } void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { @@ -83,25 +92,23 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer out = std::make_unique(); out->reserve(hcalIds.size()); - unsigned int iBatch = 0; const auto& output1 = iOutput.begin()->second; - const auto& tmp = output1.fromServer(); + const auto& outputs = output1.fromServer(); - for(HBHERecHitCollection::const_iterator itRH = out->begin(); itRH != out->end(); itRH++){ + for(std::size_t iB = 0; iB < hcalIds.size(); iB++){ - //float rhE = iOutput[iBatch]; - float rhE = tmp[0][iBatch]; - //FACILE uses rectified linear activation function =>should be positive definite + float rhE = outputs[iB][0]; + std::cout << rhE << "/" << outputs[iB][1] << std::endl; if(rhE < 0.) rhE = 0.; - //throw cms exception? + //exception? if(std::isnan(rhE)) rhE = 0; if(std::isinf(rhE)) rhE = 0; //FACILE does no time reco - HBHERecHit rh = HBHERecHit(hcalIds[iBatch],rhE,0.f,0.f); + HBHERecHit rh = HBHERecHit(hcalIds[iB],rhE,0.f,0.f); out->push_back(rh); //hcalIds[iBatch],rhE,0.f,0.f); - iBatch++; + //iBatch++; } iEvent.put(std::move(out)); } From cbd1cd7051df084d2fa78369827db60813f8c354 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 6 Oct 2020 10:02:52 -0500 Subject: [PATCH 04/20] outputs working --- .../src/HcalPhase1Reconstructor_FACILE.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc index b1b4a03d87a1b..96cb56216cb18 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc @@ -44,6 +44,8 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer auto& input1 = iInput.begin()->second; auto data1 = std::make_shared>(); data1->reserve(std::distance(channelInfo->begin(), channelInfo->end())); + + hcalIds.clear(); for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ @@ -66,7 +68,7 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer } //ieta is also encoded as a binary variable - for (int itIeta = 1; itIeta < 30; itIeta++){ + for (int itIeta = 0; itIeta < 30; itIeta++){ if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); else input.push_back(0.f); } @@ -78,9 +80,9 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer //set batch at maximum RH size after ZS and pad unsigned int last = std::distance(channelInfo->begin(), channelInfo->end()); if(last < input1.batchSize()){ - std::vector pV(47,0.f); + std::vector pad(47,0.f); for(unsigned int iP = last; iP != input1.batchSize(); iP++){ - data1->push_back(pV); + data1->push_back(pad); } } From 0a2f08d82dd7574e6bc9ee5c45763433460ca21a Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 6 Oct 2020 10:06:42 -0500 Subject: [PATCH 05/20] outputs working --- .../src/HcalPhase1Reconstructor_FACILE.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc index 96cb56216cb18..c4dda84c67a31 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc @@ -18,14 +18,12 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/HcalRecHit/interface/HBHERecHit.h" -//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE2.h" +//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.h" class HcalPhase1Reconstructor_FACILE : public SonicEDProducer { public: explicit HcalPhase1Reconstructor_FACILE(edm::ParameterSet const& cfg) : SonicEDProducer(cfg), - //nInputs_(cfg.getParameter("nInputs")), - //batchSize_(cfg.getParameter("batchSize")), fChannelInfoName(cfg.getParameter("ChannelInfoName")), fTokChannelInfo(this->template consumes(fChannelInfoName)) @@ -100,17 +98,14 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer for(std::size_t iB = 0; iB < hcalIds.size(); iB++){ float rhE = outputs[iB][0]; - std::cout << rhE << "/" << outputs[iB][1] << std::endl; - if(rhE < 0.) rhE = 0.; + if(rhE < 0.) rhE = 0.;//shouldn't be necessary, relu activation function //exception? if(std::isnan(rhE)) rhE = 0; if(std::isinf(rhE)) rhE = 0; //FACILE does no time reco HBHERecHit rh = HBHERecHit(hcalIds[iB],rhE,0.f,0.f); - out->push_back(rh); //hcalIds[iBatch],rhE,0.f,0.f); - - //iBatch++; + out->push_back(rh); } iEvent.put(std::move(out)); } @@ -125,7 +120,6 @@ class HcalPhase1Reconstructor_FACILE : public SonicEDProducer private: - //int nInputs_, batchSize_; edm::InputTag fChannelInfoName; edm::EDGetTokenT fTokChannelInfo; std::vector hcalIds; From ce16d3e6931f123848627be200a4f8c2a1f0f868 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 6 Oct 2020 14:43:10 -0500 Subject: [PATCH 06/20] cleanup 1 --- .../Configuration/test/OnLine_HLT_GRun.py | 2 +- .../src/HcalPhase1Reconstructor_FACILE.cc | 128 ------------------ 2 files changed, 1 insertion(+), 129 deletions(-) delete mode 100644 RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index 375018f75e380..9a215f3c96698 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -7423,7 +7423,7 @@ dropZSmarkedPassed = cms.bool( True ), recoParamsFromDB = cms.bool( True ) ) -process.hltHbhereco = cms.EDProducer("HcalPhase1Reconstructor_FACILE", +process.hltHbhereco = cms.EDProducer("HcalReconstructor", Client = cms.PSet( batchSize = cms.untracked.uint32(16000), address = cms.untracked.string("ailab01.fnal.gov"), diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc b/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc deleted file mode 100644 index c4dda84c67a31..0000000000000 --- a/RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.cc +++ /dev/null @@ -1,128 +0,0 @@ -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "HeterogeneousCore/SonicTriton/interface/TritonClient.h" -#include "HeterogeneousCore/SonicCore/interface/SonicEDProducer.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" - -//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.h" -class HcalPhase1Reconstructor_FACILE : public SonicEDProducer -{ -public: - explicit HcalPhase1Reconstructor_FACILE(edm::ParameterSet const& cfg) : - SonicEDProducer(cfg), - fChannelInfoName(cfg.getParameter("ChannelInfoName")), - fTokChannelInfo(this->template consumes(fChannelInfoName)) - - { - this->template produces(); - this->setDebugName("HcalPhase1Reconstructor_FACILE"); - } - - void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { - - const HBHEChannelInfoCollection *channelInfo = 0; - edm::Handle hChannelInfo; - iEvent.getByToken(fTokChannelInfo, hChannelInfo); - channelInfo = hChannelInfo.product(); - - auto& input1 = iInput.begin()->second; - auto data1 = std::make_shared>(); - data1->reserve(std::distance(channelInfo->begin(), channelInfo->end())); - - hcalIds.clear(); - - for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ - - std::vector input; - const HBHEChannelInfo& pChannel(*itC); - const HcalDetId pDetId = pChannel.id(); - hcalIds.push_back(pDetId); - - //FACILE uses iphi as a continuous variable - input.push_back((float)pDetId.iphi()); - input.push_back((float)pChannel.tsGain(0.)); - for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { - input.push_back((float)pChannel.tsRawCharge(itTS)); - } - - //FACILE considers 7 Hcal depths as binary variables - for (int itDepth=1; itDepth < 8; itDepth++){ - if (pDetId.depth() == itDepth) input.push_back(1.f); - else input.push_back(0.f); - } - - //ieta is also encoded as a binary variable - for (int itIeta = 0; itIeta < 30; itIeta++){ - if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); - else input.push_back(0.f); - } - - data1->push_back(input); - } - - - //set batch at maximum RH size after ZS and pad - unsigned int last = std::distance(channelInfo->begin(), channelInfo->end()); - if(last < input1.batchSize()){ - std::vector pad(47,0.f); - for(unsigned int iP = last; iP != input1.batchSize(); iP++){ - data1->push_back(pad); - } - } - - input1.toServer(data1); - } - - void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { - std::unique_ptr out; - out = std::make_unique(); - out->reserve(hcalIds.size()); - - const auto& output1 = iOutput.begin()->second; - const auto& outputs = output1.fromServer(); - - for(std::size_t iB = 0; iB < hcalIds.size(); iB++){ - - float rhE = outputs[iB][0]; - if(rhE < 0.) rhE = 0.;//shouldn't be necessary, relu activation function - //exception? - if(std::isnan(rhE)) rhE = 0; - if(std::isinf(rhE)) rhE = 0; - - //FACILE does no time reco - HBHERecHit rh = HBHERecHit(hcalIds[iB],rhE,0.f,0.f); - out->push_back(rh); - } - iEvent.put(std::move(out)); - } - - /*static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { - edm::ParameterSetDescription desc; - TritonClient::fillPSetDescription(desc); - //add producer-specific parameters - desc.add("ChannelInfoName","hbheprereco"); - descriptions.add("HcalPhase1Reconstructor_FACILE",desc); - }*/ - - -private: - edm::InputTag fChannelInfoName; - edm::EDGetTokenT fTokChannelInfo; - std::vector hcalIds; -}; - -DEFINE_FWK_MODULE(HcalPhase1Reconstructor_FACILE); From 430893d77df1941aba698980c053ae223f24d290 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 6 Oct 2020 14:43:26 -0500 Subject: [PATCH 07/20] cleanup 1 --- .../HcalRecProducers/src/HcalReconstructor.cc | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc new file mode 100644 index 0000000000000..5b80d32406268 --- /dev/null +++ b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc @@ -0,0 +1,126 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "HeterogeneousCore/SonicTriton/interface/TritonClient.h" +#include "HeterogeneousCore/SonicCore/interface/SonicEDProducer.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" + +//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.h" +class HcalReconstructor : public SonicEDProducer +{ +public: + explicit HcalReconstructor(edm::ParameterSet const& cfg) : + SonicEDProducer(cfg), + fChannelInfoName_(cfg.getParameter("ChannelInfoName")), + fTokChannelInfo(this->consumes(fChannelInfoName_)) + + { + this->produces(); + this->setDebugName("HcalReconstructor"); + } + + void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { + + const HBHEChannelInfoCollection *channelInfo = 0; + edm::Handle hChannelInfo; + iEvent.getByToken(fTokChannelInfo_, hChannelInfo); + channelInfo = hChannelInfo.product(); + + auto& input1 = iInput.begin()->second; + auto data1 = std::make_shared>(); + data1->reserve(std::distance(channelInfo->begin(), channelInfo->end())); + + hcalIds_.clear(); + + for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ + + std::vector input; + const HBHEChannelInfo& pChannel(*itC); + const HcalDetId pDetId = pChannel.id(); + hcalIds_.push_back(pDetId); + + //FACILE uses iphi as a continuous variable + input.push_back((float)pDetId.iphi()); + input.push_back((float)pChannel.tsGain(0.)); + for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { + input.push_back((float)pChannel.tsRawCharge(itTS)); + } + + //FACILE considers 7 Hcal depths as binary variables + for (int itDepth=1; itDepth < 8; itDepth++){ + if (pDetId.depth() == itDepth) input.push_back(1.f); + else input.push_back(0.f); + } + + //ieta is also encoded as a binary variable + for (int itIeta = 0; itIeta < 30; itIeta++){ + if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); + else input.push_back(0.f); + } + + data1->push_back(input); + } + + //set batch at maximum RHcollsize; pad the remainder + if(std::distance(channelInfo->begin(), channelInfo->end()) < input1.batchSize()){ + std::vector pad(47,0.f); + for(unsigned int iP = last; iP != input1.batchSize(); iP++){ + data1->push_back(pad); + } + } + + input1.toServer(data1); + } + + void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { + std::unique_ptr out; + out = std::make_unique(); + out->reserve(hcalIds_.size()); + + const auto& output1 = iOutput.begin()->second; + const auto& outputs = output1.fromServer(); + + for(std::size_t iB = 0; iB < hcalIds_.size(); iB++){ + + float rhE = outputs[iB][0]; + if(rhE < 0.) rhE = 0.;//shouldn't be necessary, relu activation function + //exception? + if(std::isnan(rhE)) rhE = 0; + if(std::isinf(rhE)) rhE = 0; + + //FACILE does no time reco + HBHERecHit rh = HBHERecHit(hcalIds_[iB],rhE,0.f,0.f); + out->push_back(rh); + } + iEvent.put(std::move(out)); + } + + /*static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + TritonClient::fillPSetDescription(desc); + //add producer-specific parameters + desc.add("ChannelInfoName","hbheprereco"); + descriptions.add("HcalPhase1Reconstructor_FACILE",desc); + }*/ + + +private: + edm::InputTag fChannelInfoName_; + edm::EDGetTokenT fTokChannelInfo_; + std::vector hcalIds_; +}; + +DEFINE_FWK_MODULE(HcalReconstructor); From eb114c207eef74c53d75023aff006c866318d301 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 11:15:13 -0500 Subject: [PATCH 08/20] sonic hlt config --- .../Configuration/test/OnLine_HLT_GRun.py | 25 ++++--------------- .../HcalRecProducers/src/HcalReconstructor.cc | 5 ++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index 9a215f3c96698..97d98291c7a21 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -7318,7 +7318,7 @@ saveQIE11DataTags = cms.untracked.vstring( ), firstSample = cms.int32( 0 ) ) -process.hltHbherecopre = cms.EDProducer( "HBHEPhase1Reconstructor", +process.hltHbhereco = cms.EDProducer( "HBHEPhase1Reconstructor", tsFromDB = cms.bool( False ), setPulseShapeFlagsQIE8 = cms.bool( False ), use8ts = cms.bool( True ), @@ -7331,9 +7331,9 @@ processQIE11 = cms.bool( True ), pulseShapeParametersQIE11 = cms.PSet( ), algoConfigClass = cms.string( "" ), - saveInfos = cms.bool( True ), + saveInfos = cms.bool( False ), flagParametersQIE11 = cms.PSet( ), - makeRecHits = cms.bool( False ), + makeRecHits = cms.bool( True ), pulseShapeParametersQIE8 = cms.PSet( UseDualFit = cms.bool( True ), LinearCut = cms.vdouble( -3.0, -0.054, -0.054 ), @@ -7423,21 +7423,6 @@ dropZSmarkedPassed = cms.bool( True ), recoParamsFromDB = cms.bool( True ) ) -process.hltHbhereco = cms.EDProducer("HcalReconstructor", - Client = cms.PSet( - batchSize = cms.untracked.uint32(16000), - address = cms.untracked.string("ailab01.fnal.gov"), - port = cms.untracked.uint32(8001), - timeout = cms.untracked.uint32(300), - modelName = cms.string("facile_all_v2"), - mode = cms.string("Async"), - modelVersion = cms.int32(-1),#string("Async"), - verbose = cms.untracked.bool(True), - allowedTries = cms.untracked.uint32(5), - outputs = cms.untracked.vstring("output/BiasAdd"), - ), - ChannelInfoName = cms.InputTag("hltHbherecopre") -) process.hltHfprereco = cms.EDProducer( "HFPreReconstructor", soiShift = cms.int32( 0 ), sumAllTimeSlices = cms.bool( False ), @@ -90798,7 +90783,7 @@ process.HLTBeamSpot = cms.Sequence( process.hltScalersRawToDigi + process.hltOnlineBeamSpot ) process.HLTBeginSequence = cms.Sequence( process.hltTriggerType + process.HLTL1UnpackerSequence + process.HLTBeamSpot ) process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence = cms.Sequence( process.hltEcalDigis + process.hltEcalUncalibRecHit + process.hltEcalDetIdToBeRecovered + process.hltEcalRecHit ) -process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) +process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) process.HLTDoCaloSequence = cms.Sequence( process.HLTDoFullUnpackingEgammaEcalWithoutPreshowerSequence + process.HLTDoLocalHcalSequence + process.hltTowerMakerForAll ) process.HLTAK8CaloJetsReconstructionSequence = cms.Sequence( process.HLTDoCaloSequence + process.hltAK8CaloJets + process.hltAK8CaloJetsIDPassed ) process.HLTAK8CaloCorrectorProducersSequence = cms.Sequence( process.hltAK8CaloFastJetCorrector + process.hltAK8CaloRelativeCorrector + process.hltAK8CaloAbsoluteCorrector + process.hltAK8CaloResidualCorrector + process.hltAK8CaloCorrector ) @@ -91052,7 +91037,7 @@ process.HLTMu24IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu24Eta2p1IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu30IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) -process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco) +process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco) process.HLTStoppedHSCPJetSequence = cms.Sequence( process.hltStoppedHSCPTowerMakerForAll + process.hltStoppedHSCPIterativeCone4CaloJets ) process.HLTMuonLocalRecoMeanTimerSequence = cms.Sequence( process.hltMuonDTDigis + process.hltDt1DRecHits + process.hltDt4DSegmentsMeanTimer + process.hltMuonCSCDigis + process.hltCsc2DRecHits + process.hltCscSegments + process.hltMuonRPCDigis + process.hltRpcRecHits ) process.HLTL2muonrecoNocandCosmicSeedMeanTimerSequence = cms.Sequence( process.HLTMuonLocalRecoMeanTimerSequence + process.hltL2CosmicOfflineMuonSeeds + process.hltL2CosmicMuonSeeds + process.hltL2CosmicMuons ) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc index 5b80d32406268..e60d94d8e7fee 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc @@ -25,7 +25,7 @@ class HcalReconstructor : public SonicEDProducer explicit HcalReconstructor(edm::ParameterSet const& cfg) : SonicEDProducer(cfg), fChannelInfoName_(cfg.getParameter("ChannelInfoName")), - fTokChannelInfo(this->consumes(fChannelInfoName_)) + fTokChannelInfo_(this->consumes(fChannelInfoName_)) { this->produces(); @@ -75,7 +75,8 @@ class HcalReconstructor : public SonicEDProducer } //set batch at maximum RHcollsize; pad the remainder - if(std::distance(channelInfo->begin(), channelInfo->end()) < input1.batchSize()){ + unsigned last = std::distance(channelInfo->begin(), channelInfo->end()); + if(last < input1.batchSize()){ std::vector pad(47,0.f); for(unsigned int iP = last; iP != input1.batchSize(); iP++){ data1->push_back(pad); From 2934857b26208a889387aa70a4801de060de0f36 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 11:31:32 -0500 Subject: [PATCH 09/20] sonic hlt config --- .../Configuration/test/sonic_hlt_test.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 HLTrigger/Configuration/test/sonic_hlt_test.py diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/HLTrigger/Configuration/test/sonic_hlt_test.py new file mode 100644 index 0000000000000..3e44432412745 --- /dev/null +++ b/HLTrigger/Configuration/test/sonic_hlt_test.py @@ -0,0 +1,54 @@ +import FWCore.ParameterSet.Config as cms +import os,sys +#sys.argv = sys.argv[0:1] + +#sys.path = [os.path.expandvars("$CMSSW_BASE/src/HLTrigger/Configuration/test/"), os.path.expandvars("$CMSSW_RELEASE_BASE/src/HLTrigger/Configuration/test/")] + +sys.path.insert(0,os.path.expandvars("$CMSSW_RELEASE_BASE/src/HLTrigger/Configuration/test")) +from OnLine_HLT_GRun import process + +process.hltHbherecopre = process.hltHbhereco.clone() +process.hltHbherecopre.__setattr__('makeRecHits',False) +process.hltHbherecopre.__setattr__('saveInfos',True) + +process.hltHbhereco = cms.EDProducer("HcalReconstructor", + Client = cms.PSet( + batchSize = cms.untracked.uint32(16000), + address = cms.untracked.string("ailab01.fnal.gov"), + port = cms.untracked.uint32(8001), + timeout = cms.untracked.uint32(300), + modelName = cms.string("facile_all_v2"), + mode = cms.string("Async"), + modelVersion = cms.int32(-1),#string("Async"), + verbose = cms.untracked.bool(True), + allowedTries = cms.untracked.uint32(5), + outputs = cms.untracked.vstring("output/BiasAdd"), + ), + ChannelInfoName = cms.InputTag("hltHbherecopre") +) + +process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) +process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco) + +_customInfo = {} +_customInfo['menuType' ]= "GRun" +_customInfo['globalTags']= {} +_customInfo['globalTags'][True ] = "auto:run3_hlt_GRun" +_customInfo['globalTags'][False] = "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" +_customInfo['inputFiles']={} +_customInfo['inputFiles'][True] = "file:RelVal_Raw_GRun_DATA.root" +_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root" #"root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" +_customInfo['maxEvents' ]= 100 +_customInfo['globalTag' ]= "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" +_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root']#'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] +_customInfo['realData' ]= False #True + + +process.options.numberOfThreads = cms.untracked.uint32(1) +process.options.numberOfStreams = cms.untracked.uint32(0) + +from HLTrigger.Configuration.customizeHLTforALL import customizeHLTforAll +process = customizeHLTforAll(process,"GRun",_customInfo) + +from HLTrigger.Configuration.customizeHLTforCMSSW import customizeHLTforCMSSW +process = customizeHLTforCMSSW(process,"GRun") From 363aeab5bfb9ff9c650b09ae65cb9445ed5c2bd3 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 12:24:20 -0500 Subject: [PATCH 10/20] sonic hlt config --- .../Configuration/test/sonic_hlt_test.py | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/HLTrigger/Configuration/test/sonic_hlt_test.py index 3e44432412745..d025aeef2aa85 100644 --- a/HLTrigger/Configuration/test/sonic_hlt_test.py +++ b/HLTrigger/Configuration/test/sonic_hlt_test.py @@ -1,10 +1,8 @@ import FWCore.ParameterSet.Config as cms import os,sys -#sys.argv = sys.argv[0:1] -#sys.path = [os.path.expandvars("$CMSSW_BASE/src/HLTrigger/Configuration/test/"), os.path.expandvars("$CMSSW_RELEASE_BASE/src/HLTrigger/Configuration/test/")] +sys.path = sys.path + [os.path.expandvars("$CMSSW_BASE/src/HLTrigger/Configuration/test/"), os.path.expandvars("$CMSSW_RELEASE_BASE/src/HLTrigger/Configuration/test/")] -sys.path.insert(0,os.path.expandvars("$CMSSW_RELEASE_BASE/src/HLTrigger/Configuration/test")) from OnLine_HLT_GRun import process process.hltHbherecopre = process.hltHbhereco.clone() @@ -30,25 +28,10 @@ process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco ) process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco) -_customInfo = {} -_customInfo['menuType' ]= "GRun" -_customInfo['globalTags']= {} -_customInfo['globalTags'][True ] = "auto:run3_hlt_GRun" -_customInfo['globalTags'][False] = "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" -_customInfo['inputFiles']={} -_customInfo['inputFiles'][True] = "file:RelVal_Raw_GRun_DATA.root" -_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root" #"root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" -_customInfo['maxEvents' ]= 100 -_customInfo['globalTag' ]= "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" -_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root']#'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] -_customInfo['realData' ]= False #True - - +process.source.fileNames = cms.untracked.vstring("file:RelVal_Raw_GRun_MC.root") + process.options.numberOfThreads = cms.untracked.uint32(1) process.options.numberOfStreams = cms.untracked.uint32(0) -from HLTrigger.Configuration.customizeHLTforALL import customizeHLTforAll -process = customizeHLTforAll(process,"GRun",_customInfo) - from HLTrigger.Configuration.customizeHLTforCMSSW import customizeHLTforCMSSW process = customizeHLTforCMSSW(process,"GRun") From 93c3b6980e8c3fd864c45ad9316b99f7d140cb2b Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 12:28:52 -0500 Subject: [PATCH 11/20] sonic hlt config --- HLTrigger/Configuration/test/sonic_hlt_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/HLTrigger/Configuration/test/sonic_hlt_test.py index d025aeef2aa85..0341751b880cb 100644 --- a/HLTrigger/Configuration/test/sonic_hlt_test.py +++ b/HLTrigger/Configuration/test/sonic_hlt_test.py @@ -5,9 +5,10 @@ from OnLine_HLT_GRun import process -process.hltHbherecopre = process.hltHbhereco.clone() -process.hltHbherecopre.__setattr__('makeRecHits',False) -process.hltHbherecopre.__setattr__('saveInfos',True) +process.hltHbherecopre = process.hltHbhereco.clone( + makeRecHits = cms.bool(False), + saveInfos = cms.bool(True), +) process.hltHbhereco = cms.EDProducer("HcalReconstructor", Client = cms.PSet( From 9edea1243b785b79b008c521e07e4e394c62f933 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 14:28:17 -0500 Subject: [PATCH 12/20] sonic hlt config --- .../Configuration/test/OnLine_HLT_GRun.py | 32 +++++++++---------- .../Configuration/test/sonic_hlt_test.py | 10 ++---- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index 97d98291c7a21..e1bdb994ae40b 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -7323,7 +7323,7 @@ setPulseShapeFlagsQIE8 = cms.bool( False ), use8ts = cms.bool( True ), digiLabelQIE11 = cms.InputTag( "hltHcalDigis" ), - saveDroppedInfos = cms.bool( True ), + saveDroppedInfos = cms.bool( False ), setNoiseFlagsQIE8 = cms.bool( False ), saveEffectivePedestal = cms.bool( True ), digiLabelQIE8 = cms.InputTag( "hltHcalDigis" ), @@ -7375,7 +7375,7 @@ ), setNegativeFlagsQIE8 = cms.bool( False ), setNegativeFlagsQIE11 = cms.bool( False ), - processQIE8 = cms.bool( True ), + processQIE8 = cms.bool( False ), algorithm = cms.PSet( ts4Thresh = cms.double( 0.0 ), meanTime = cms.double( 0.0 ), @@ -91037,7 +91037,7 @@ process.HLTMu24IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu24Eta2p1IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3crIsoL1sSingleMu22erL1f0L2f10QL3f24QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) process.HLTMu30IsolationSequence = cms.Sequence( process.HLTL3muonEcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfecalIsoRhoFilteredEB0p14EE0p10 + process.HLTL3muonHcalPFisorecoSequenceNoBoolsForMuons + process.hltL3fL1sMu22Or25L1f0L2f10QL3Filtered30QL3pfhcalIsoRhoFilteredHB0p16HE0p20 + process.HLTTrackReconstructionForIsoL3MuonIter02 + process.hltMuonTkRelIsolationCut0p07Map ) -process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco) +process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco ) process.HLTStoppedHSCPJetSequence = cms.Sequence( process.hltStoppedHSCPTowerMakerForAll + process.hltStoppedHSCPIterativeCone4CaloJets ) process.HLTMuonLocalRecoMeanTimerSequence = cms.Sequence( process.hltMuonDTDigis + process.hltDt1DRecHits + process.hltDt4DSegmentsMeanTimer + process.hltMuonCSCDigis + process.hltCsc2DRecHits + process.hltCscSegments + process.hltMuonRPCDigis + process.hltRpcRecHits ) process.HLTL2muonrecoNocandCosmicSeedMeanTimerSequence = cms.Sequence( process.HLTMuonLocalRecoMeanTimerSequence + process.hltL2CosmicOfflineMuonSeeds + process.hltL2CosmicMuonSeeds + process.hltL2CosmicMuons ) @@ -92083,7 +92083,7 @@ # enable TrigReport, TimeReport and MultiThreading process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool( True ), - numberOfThreads = cms.untracked.uint32( 1 ), + numberOfThreads = cms.untracked.uint32( 4 ), numberOfStreams = cms.untracked.uint32( 0 ), sizeOfStackForThreadsInKB = cms.untracked.uint32( 10*1024 ) ) @@ -92091,28 +92091,28 @@ # override the GlobalTag, connection string and pfnPrefix if 'GlobalTag' in process.__dict__: from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag - process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = '112X_mcRun3_2021_realistic_v7') + process.GlobalTag = customiseGlobalTag(process.GlobalTag, globaltag = 'auto:run3_hlt_GRun') -#if 'MessageLogger' in process.__dict__: - #process.MessageLogger.categories.append('TriggerSummaryProducerAOD') - #process.MessageLogger.categories.append('L1GtTrigReport') - #process.MessageLogger.categories.append('L1TGlobalSummary') - #process.MessageLogger.categories.append('HLTrigReport') - #process.MessageLogger.categories.append('FastReport') +if 'MessageLogger' in process.__dict__: + process.MessageLogger.categories.append('TriggerSummaryProducerAOD') + process.MessageLogger.categories.append('L1GtTrigReport') + process.MessageLogger.categories.append('L1TGlobalSummary') + process.MessageLogger.categories.append('HLTrigReport') + process.MessageLogger.categories.append('FastReport') # add specific customizations _customInfo = {} _customInfo['menuType' ]= "GRun" _customInfo['globalTags']= {} _customInfo['globalTags'][True ] = "auto:run3_hlt_GRun" -_customInfo['globalTags'][False] = "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" +_customInfo['globalTags'][False] = "auto:run3_mc_GRun" _customInfo['inputFiles']={} _customInfo['inputFiles'][True] = "file:RelVal_Raw_GRun_DATA.root" -_customInfo['inputFiles'][False] = "root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root" #"root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root" +_customInfo['inputFiles'][False] = "file:RelVal_Raw_GRun_MC.root" _customInfo['maxEvents' ]= 100 -_customInfo['globalTag' ]= "112X_mcRun3_2021_realistic_v7" #"auto:phase1_2021_realistic" -_customInfo['inputFile' ]= ['root://cmsxrootd.fnal.gov//store/relval/CMSSW_11_2_0_pre6_ROOT622/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/112X_mcRun3_2021_realistic_v7-v1/20000/FED4709C-569E-0A42-8FF7-20E565ABE999.root']#'root://cmsxrootd.fnal.gov//store/relval/CMSSW_10_6_0/RelValProdTTbar_13UP17/GEN-SIM-RAW/106X_mc2017_realistic_v3-v1/10000/723AD11F-750D-A74C-A364-9E80132075DF.root'] -_customInfo['realData' ]= False #True +_customInfo['globalTag' ]= "auto:run3_hlt_GRun" +_customInfo['inputFile' ]= ['file:RelVal_Raw_GRun_DATA.root'] +_customInfo['realData' ]= True from HLTrigger.Configuration.customizeHLTforALL import customizeHLTforAll process = customizeHLTforAll(process,"GRun",_customInfo) diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/HLTrigger/Configuration/test/sonic_hlt_test.py index 0341751b880cb..34227aa14483c 100644 --- a/HLTrigger/Configuration/test/sonic_hlt_test.py +++ b/HLTrigger/Configuration/test/sonic_hlt_test.py @@ -18,8 +18,8 @@ timeout = cms.untracked.uint32(300), modelName = cms.string("facile_all_v2"), mode = cms.string("Async"), - modelVersion = cms.int32(-1),#string("Async"), - verbose = cms.untracked.bool(True), + modelVersion = cms.int32(-1), + verbose = cms.untracked.bool(False), allowedTries = cms.untracked.uint32(5), outputs = cms.untracked.vstring("output/BiasAdd"), ), @@ -30,9 +30,3 @@ process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbherecopre + process.hltHbhereco) process.source.fileNames = cms.untracked.vstring("file:RelVal_Raw_GRun_MC.root") - -process.options.numberOfThreads = cms.untracked.uint32(1) -process.options.numberOfStreams = cms.untracked.uint32(0) - -from HLTrigger.Configuration.customizeHLTforCMSSW import customizeHLTforCMSSW -process = customizeHLTforCMSSW(process,"GRun") From 34ef691579227053c5bbbde364dadd77548738cb Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 15:33:43 -0500 Subject: [PATCH 13/20] cleanup --- RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc index e60d94d8e7fee..ec843319d2e65 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc @@ -2,14 +2,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CaloTopology/interface/HcalTopology.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +//#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "HeterogeneousCore/SonicTriton/interface/TritonClient.h" #include "HeterogeneousCore/SonicCore/interface/SonicEDProducer.h" From bf01cb1e6c246f45b92ee8760597789154ef31d1 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 15:34:54 -0500 Subject: [PATCH 14/20] cleanup header --- RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc index ec843319d2e65..e0bb60a8c21d6 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc @@ -2,7 +2,6 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/InputTag.h" #include "DataFormats/Common/interface/Handle.h" -//#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "HeterogeneousCore/SonicTriton/interface/TritonClient.h" #include "HeterogeneousCore/SonicCore/interface/SonicEDProducer.h" @@ -11,7 +10,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/HcalRecHit/interface/HBHERecHit.h" -//#include "RecoLocalCalo/HcalRecProducers/src/HcalPhase1Reconstructor_FACILE.h" class HcalReconstructor : public SonicEDProducer { public: From 4e974f7781a354ec8b66518ba56463bea6a64732 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Fri, 9 Oct 2020 15:53:15 -0500 Subject: [PATCH 15/20] cleanup BuildFile --- RecoLocalCalo/HcalRecProducers/BuildFile.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/BuildFile.xml b/RecoLocalCalo/HcalRecProducers/BuildFile.xml index 451251f2617c5..9c4b594ab430e 100644 --- a/RecoLocalCalo/HcalRecProducers/BuildFile.xml +++ b/RecoLocalCalo/HcalRecProducers/BuildFile.xml @@ -4,10 +4,7 @@ - - - From b789f7e6c1ee19b0c9b0028b3835e20134367726 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 13 Oct 2020 14:25:08 -0500 Subject: [PATCH 16/20] code review changes --- .../Configuration/test/sonic_hlt_test.py | 4 +- ...structor.cc => FacileHcalReconstructor.cc} | 56 ++++++++----------- 2 files changed, 26 insertions(+), 34 deletions(-) rename RecoLocalCalo/HcalRecProducers/src/{HcalReconstructor.cc => FacileHcalReconstructor.cc} (63%) diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/HLTrigger/Configuration/test/sonic_hlt_test.py index 34227aa14483c..a7f50c0c3bc47 100644 --- a/HLTrigger/Configuration/test/sonic_hlt_test.py +++ b/HLTrigger/Configuration/test/sonic_hlt_test.py @@ -10,10 +10,10 @@ saveInfos = cms.bool(True), ) -process.hltHbhereco = cms.EDProducer("HcalReconstructor", +process.hltHbhereco = cms.EDProducer("FacileHcalReconstructor", Client = cms.PSet( batchSize = cms.untracked.uint32(16000), - address = cms.untracked.string("ailab01.fnal.gov"), + address = cms.untracked.string("0.0.0.0"), port = cms.untracked.uint32(8001), timeout = cms.untracked.uint32(300), modelName = cms.string("facile_all_v2"), diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc similarity index 63% rename from RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc rename to RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc index e0bb60a8c21d6..f120ae85038c0 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc @@ -9,37 +9,42 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/HcalRecHit/interface/HBHERecHit.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -class HcalReconstructor : public SonicEDProducer +class FacileHcalReconstructor : public SonicEDProducer { public: - explicit HcalReconstructor(edm::ParameterSet const& cfg) : + explicit FacileHcalReconstructor(edm::ParameterSet const& cfg) : SonicEDProducer(cfg), fChannelInfoName_(cfg.getParameter("ChannelInfoName")), - fTokChannelInfo_(this->consumes(fChannelInfoName_)) + fTokChannelInfo_(consumes(fChannelInfoName_)) { - this->produces(); - this->setDebugName("HcalReconstructor"); + produces(); + setDebugName("FacileHcalReconstructor"); } void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { - const HBHEChannelInfoCollection *channelInfo = 0; edm::Handle hChannelInfo; iEvent.getByToken(fTokChannelInfo_, hChannelInfo); - channelInfo = hChannelInfo.product(); + const HBHEChannelInfoCollection *channelInfo = hChannelInfo.product(); + + edm::ESHandle hcalTopology; + iSetup.get().get(hcalTopology); + const HcalTopology* theHcalTopology = hcalTopology.product(); auto& input1 = iInput.begin()->second; auto data1 = std::make_shared>(); - data1->reserve(std::distance(channelInfo->begin(), channelInfo->end())); + data1->reserve(channelInfo->size()); + client_.setBatchSize(channelInfo->size()); hcalIds_.clear(); - - for(HBHEChannelInfoCollection::const_iterator itC = channelInfo->begin(); itC != channelInfo->end(); itC++){ + + for(const auto& pChannel : *channelInfo){ std::vector input; - const HBHEChannelInfo& pChannel(*itC); const HcalDetId pDetId = pChannel.id(); hcalIds_.push_back(pDetId); @@ -51,13 +56,13 @@ class HcalReconstructor : public SonicEDProducer } //FACILE considers 7 Hcal depths as binary variables - for (int itDepth=1; itDepth < 8; itDepth++){ + for (int itDepth=1; itDepth < theHcalTopology->maxDepth(); itDepth++){ if (pDetId.depth() == itDepth) input.push_back(1.f); else input.push_back(0.f); } //ieta is also encoded as a binary variable - for (int itIeta = 0; itIeta < 30; itIeta++){ + for (int itIeta = 0; itIeta < theHcalTopology->lastHERing(); itIeta++){ if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); else input.push_back(0.f); } @@ -65,15 +70,6 @@ class HcalReconstructor : public SonicEDProducer data1->push_back(input); } - //set batch at maximum RHcollsize; pad the remainder - unsigned last = std::distance(channelInfo->begin(), channelInfo->end()); - if(last < input1.batchSize()){ - std::vector pad(47,0.f); - for(unsigned int iP = last; iP != input1.batchSize(); iP++){ - data1->push_back(pad); - } - } - input1.toServer(data1); } @@ -88,10 +84,7 @@ class HcalReconstructor : public SonicEDProducer for(std::size_t iB = 0; iB < hcalIds_.size(); iB++){ float rhE = outputs[iB][0]; - if(rhE < 0.) rhE = 0.;//shouldn't be necessary, relu activation function - //exception? - if(std::isnan(rhE)) rhE = 0; - if(std::isinf(rhE)) rhE = 0; + if(rhE < 0. or std::isnan(rhE) or std::isinf(rhE)) rhE = 0; //FACILE does no time reco HBHERecHit rh = HBHERecHit(hcalIds_[iB],rhE,0.f,0.f); @@ -100,13 +93,12 @@ class HcalReconstructor : public SonicEDProducer iEvent.put(std::move(out)); } - /*static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; TritonClient::fillPSetDescription(desc); - //add producer-specific parameters - desc.add("ChannelInfoName","hbheprereco"); - descriptions.add("HcalPhase1Reconstructor_FACILE",desc); - }*/ + desc.add("ChannelInfoName"); + descriptions.add("FacileHcalReconstructor",desc); + } private: @@ -115,4 +107,4 @@ class HcalReconstructor : public SonicEDProducer std::vector hcalIds_; }; -DEFINE_FWK_MODULE(HcalReconstructor); +DEFINE_FWK_MODULE(FacileHcalReconstructor); From 33d6a5b455a50eb8127bef245cd2e13394ff4c60 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 13 Oct 2020 21:57:56 -0500 Subject: [PATCH 17/20] esConsumes --- .../src/FacileHcalReconstructor.cc | 156 +++++++++--------- 1 file changed, 75 insertions(+), 81 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc index f120ae85038c0..3449f57dbed68 100644 --- a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc @@ -12,99 +12,93 @@ #include "Geometry/CaloTopology/interface/HcalTopology.h" #include "Geometry/Records/interface/HcalRecNumberingRecord.h" -class FacileHcalReconstructor : public SonicEDProducer -{ +class FacileHcalReconstructor : public SonicEDProducer { public: - explicit FacileHcalReconstructor(edm::ParameterSet const& cfg) : - SonicEDProducer(cfg), + explicit FacileHcalReconstructor(edm::ParameterSet const& cfg) + : SonicEDProducer(cfg), fChannelInfoName_(cfg.getParameter("ChannelInfoName")), - fTokChannelInfo_(consumes(fChannelInfoName_)) - - { - produces(); - setDebugName("FacileHcalReconstructor"); + fTokChannelInfo_(consumes(fChannelInfoName_)), + htopoToken_(esConsumes()) { + produces(); + setDebugName("FacileHcalReconstructor"); + } + + void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { + edm::Handle hChannelInfo; + iEvent.getByToken(fTokChannelInfo_, hChannelInfo); + const HBHEChannelInfoCollection* channelInfo = hChannelInfo.product(); + + const HcalTopology* htopo = &iSetup.getData(htopoToken_); + + auto& input1 = iInput.begin()->second; + auto data1 = std::make_shared>(); + data1->reserve(channelInfo->size()); + client_.setBatchSize(channelInfo->size()); + + hcalIds_.clear(); + + for (const auto& pChannel : *channelInfo) { + std::vector input; + const HcalDetId pDetId = pChannel.id(); + hcalIds_.push_back(pDetId); + + //FACILE uses iphi as a continuous variable + input.push_back((float)pDetId.iphi()); + input.push_back((float)pChannel.tsGain(0.)); + for (unsigned int itTS = 0; itTS < pChannel.nSamples(); ++itTS) { + input.push_back((float)pChannel.tsRawCharge(itTS)); + } + + //FACILE considers 7 Hcal depths as binary variables + std::cout << htopo->maxDepth() << std::endl; + for (int itDepth = 1; itDepth < htopo->maxDepth(); itDepth++) { + input.push_back(pDetId.depth() == itDepth); + } + + std::cout << htopo->lastHERing() << std::endl; + //ieta is also encoded as a binary variable + for (int itIeta = 0; itIeta <= htopo->lastHERing(); itIeta++) { + input.push_back(pDetId.ieta() == itIeta); + } + + data1->push_back(input); } - void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { + input1.toServer(data1); + } - edm::Handle hChannelInfo; - iEvent.getByToken(fTokChannelInfo_, hChannelInfo); - const HBHEChannelInfoCollection *channelInfo = hChannelInfo.product(); + void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { + std::unique_ptr out; + out = std::make_unique(); + out->reserve(hcalIds_.size()); - edm::ESHandle hcalTopology; - iSetup.get().get(hcalTopology); - const HcalTopology* theHcalTopology = hcalTopology.product(); + const auto& output1 = iOutput.begin()->second; + const auto& outputs = output1.fromServer(); - auto& input1 = iInput.begin()->second; - auto data1 = std::make_shared>(); - data1->reserve(channelInfo->size()); - client_.setBatchSize(channelInfo->size()); + for (std::size_t iB = 0; iB < hcalIds_.size(); iB++) { + float rhE = outputs[iB][0]; + if (rhE < 0. or std::isnan(rhE) or std::isinf(rhE)) + rhE = 0; - hcalIds_.clear(); - - for(const auto& pChannel : *channelInfo){ - - std::vector input; - const HcalDetId pDetId = pChannel.id(); - hcalIds_.push_back(pDetId); - - //FACILE uses iphi as a continuous variable - input.push_back((float)pDetId.iphi()); - input.push_back((float)pChannel.tsGain(0.)); - for (unsigned int itTS=0; itTS < pChannel.nSamples(); ++itTS) { - input.push_back((float)pChannel.tsRawCharge(itTS)); - } - - //FACILE considers 7 Hcal depths as binary variables - for (int itDepth=1; itDepth < theHcalTopology->maxDepth(); itDepth++){ - if (pDetId.depth() == itDepth) input.push_back(1.f); - else input.push_back(0.f); - } - - //ieta is also encoded as a binary variable - for (int itIeta = 0; itIeta < theHcalTopology->lastHERing(); itIeta++){ - if (std::abs(pDetId.ieta()) == itIeta) input.push_back(1.f); - else input.push_back(0.f); - } - - data1->push_back(input); - } - - input1.toServer(data1); - } - - void produce(edm::Event& iEvent, edm::EventSetup const& iSetup, Output const& iOutput) override { - std::unique_ptr out; - out = std::make_unique(); - out->reserve(hcalIds_.size()); - - const auto& output1 = iOutput.begin()->second; - const auto& outputs = output1.fromServer(); - - for(std::size_t iB = 0; iB < hcalIds_.size(); iB++){ - - float rhE = outputs[iB][0]; - if(rhE < 0. or std::isnan(rhE) or std::isinf(rhE)) rhE = 0; - - //FACILE does no time reco - HBHERecHit rh = HBHERecHit(hcalIds_[iB],rhE,0.f,0.f); - out->push_back(rh); - } - iEvent.put(std::move(out)); - } - - static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { - edm::ParameterSetDescription desc; - TritonClient::fillPSetDescription(desc); - desc.add("ChannelInfoName"); - descriptions.add("FacileHcalReconstructor",desc); + //FACILE does no time reco + HBHERecHit rh = HBHERecHit(hcalIds_[iB], rhE, 0.f, 0.f); + out->push_back(rh); } + iEvent.put(std::move(out)); + } + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + TritonClient::fillPSetDescription(desc); + desc.add("ChannelInfoName"); + descriptions.add("FacileHcalReconstructor", desc); + } private: - edm::InputTag fChannelInfoName_; - edm::EDGetTokenT fTokChannelInfo_; - std::vector hcalIds_; + edm::InputTag fChannelInfoName_; + edm::EDGetTokenT fTokChannelInfo_; + std::vector hcalIds_; + edm::ESGetToken htopoToken_; }; DEFINE_FWK_MODULE(FacileHcalReconstructor); From ace95e29ddd3cffcae8399c37df864bb4661d747 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 13 Oct 2020 22:02:19 -0500 Subject: [PATCH 18/20] remove cout --- RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc index 3449f57dbed68..208947619ee79 100644 --- a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc @@ -50,12 +50,10 @@ class FacileHcalReconstructor : public SonicEDProducer { } //FACILE considers 7 Hcal depths as binary variables - std::cout << htopo->maxDepth() << std::endl; - for (int itDepth = 1; itDepth < htopo->maxDepth(); itDepth++) { + for (int itDepth = 1; itDepth <= htopo->maxDepth(); itDepth++) { input.push_back(pDetId.depth() == itDepth); } - std::cout << htopo->lastHERing() << std::endl; //ieta is also encoded as a binary variable for (int itIeta = 0; itIeta <= htopo->lastHERing(); itIeta++) { input.push_back(pDetId.ieta() == itIeta); From 81910ec1310d1a2645c3ee71d885f74ebc2c6849 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Tue, 13 Oct 2020 22:16:45 -0500 Subject: [PATCH 19/20] small fix --- .../HcalRecProducers/src/FacileHcalReconstructor.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc index 208947619ee79..be638060d0f77 100644 --- a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc @@ -26,18 +26,17 @@ class FacileHcalReconstructor : public SonicEDProducer { void acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput) override { edm::Handle hChannelInfo; iEvent.getByToken(fTokChannelInfo_, hChannelInfo); - const HBHEChannelInfoCollection* channelInfo = hChannelInfo.product(); const HcalTopology* htopo = &iSetup.getData(htopoToken_); auto& input1 = iInput.begin()->second; auto data1 = std::make_shared>(); - data1->reserve(channelInfo->size()); - client_.setBatchSize(channelInfo->size()); + data1->reserve(hChannelInfo->size()); + client_.setBatchSize(hChannelInfo->size()); hcalIds_.clear(); - for (const auto& pChannel : *channelInfo) { + for (const auto& pChannel : *hChannelInfo) { std::vector input; const HcalDetId pDetId = pChannel.id(); hcalIds_.push_back(pDetId); From b2e10d3cec8953e35805fbcef29e0bd8249ab085 Mon Sep 17 00:00:00 2001 From: Jeffrey Krupa Date: Thu, 15 Oct 2020 09:38:21 -0500 Subject: [PATCH 20/20] use ietaAbs() in HcalDetId --- .../HcalRecProducers/src/FacileHcalReconstructor.cc | 13 +++++-------- .../HcalRecProducers}/test/sonic_hlt_test.py | 0 2 files changed, 5 insertions(+), 8 deletions(-) rename {HLTrigger/Configuration => RecoLocalCalo/HcalRecProducers}/test/sonic_hlt_test.py (100%) diff --git a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc index be638060d0f77..b43243c3ab735 100644 --- a/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/FacileHcalReconstructor.cc @@ -41,21 +41,19 @@ class FacileHcalReconstructor : public SonicEDProducer { const HcalDetId pDetId = pChannel.id(); hcalIds_.push_back(pDetId); - //FACILE uses iphi as a continuous variable - input.push_back((float)pDetId.iphi()); - input.push_back((float)pChannel.tsGain(0.)); + //inputs for Facile: iphi, gain, raw[8], depth (categorical), ieta (categorical) + input.push_back(pDetId.iphi()); + input.push_back(pChannel.tsGain(0.)); for (unsigned int itTS = 0; itTS < pChannel.nSamples(); ++itTS) { - input.push_back((float)pChannel.tsRawCharge(itTS)); + input.push_back(pChannel.tsRawCharge(itTS)); } - //FACILE considers 7 Hcal depths as binary variables for (int itDepth = 1; itDepth <= htopo->maxDepth(); itDepth++) { input.push_back(pDetId.depth() == itDepth); } - //ieta is also encoded as a binary variable for (int itIeta = 0; itIeta <= htopo->lastHERing(); itIeta++) { - input.push_back(pDetId.ieta() == itIeta); + input.push_back(pDetId.ietaAbs() == itIeta); } data1->push_back(input); @@ -77,7 +75,6 @@ class FacileHcalReconstructor : public SonicEDProducer { if (rhE < 0. or std::isnan(rhE) or std::isinf(rhE)) rhE = 0; - //FACILE does no time reco HBHERecHit rh = HBHERecHit(hcalIds_[iB], rhE, 0.f, 0.f); out->push_back(rh); } diff --git a/HLTrigger/Configuration/test/sonic_hlt_test.py b/RecoLocalCalo/HcalRecProducers/test/sonic_hlt_test.py similarity index 100% rename from HLTrigger/Configuration/test/sonic_hlt_test.py rename to RecoLocalCalo/HcalRecProducers/test/sonic_hlt_test.py