Skip to content

Commit

Permalink
update to solve properly some comflicts with the cms-sw#73 + update o…
Browse files Browse the repository at this point in the history
…f testHGCalL1T_cfg.py and testHGCalL1TBestChoiceTriggerCell_cfg.py to take SingleCellClusterAlgoBestChoice instead of SingleCellClusterAlgo
  • Loading branch information
mastrolorenzo authored and rekovic committed Feb 23, 2017
1 parent 841faf9 commit d862015
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 88 deletions.
76 changes: 43 additions & 33 deletions L1Trigger/L1THGCal/plugins/be_algorithms/FullModuleSumAlgo.cc
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
#include "L1Trigger/L1THGCal/interface/HGCalTriggerBackendAlgorithmBase.h"
#include "L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellBestChoiceCodec.h"
#include "L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellThresholdCodec.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"

#include "DataFormats/L1THGCal/interface/HGCalCluster.h"

using namespace HGCalTriggerBackend;

class FullModuleSumAlgo : public Algorithm<HGCalTriggerCellBestChoiceCodec>
template<typename FECODEC, typename DATA>
class FullModuleSumAlgo : public Algorithm<FECODEC>
{
public:

using Algorithm<FECODEC>::name;

protected:
using Algorithm<FECODEC>::codec_;

public:
FullModuleSumAlgo(const edm::ParameterSet& conf):
Algorithm<HGCalTriggerCellBestChoiceCodec>(conf),
cluster_product_( new l1t::HGCalClusterBxCollection ){}
Algorithm<FECODEC>(conf),
cluster_product_( new l1t::HGCalClusterBxCollection ){}

virtual void setProduces(edm::EDProducer& prod) const override final
{
prod.produces<l1t::HGCalClusterBxCollection>(name());
}

virtual void run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es) override final;
virtual void run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es) override final
{
for( const auto& digi : coll )
{
DATA data;
data.reset();
const HGCalDetId& moduleId = digi.getDetId<HGCalDetId>();
digi.decode(codec_, data);

// Sum of trigger cells inside the module
uint32_t moduleSum = 0;
for(const auto& triggercell : data.payload)
{
moduleSum += triggercell.hwPt();
}
// dummy cluster without position
// moduleId filled in place of hardware eta
l1t::HGCalCluster cluster( reco::LeafCandidate::LorentzVector(), moduleSum, 0, 0);
cluster.setModule(moduleId.wafer());
cluster.setLayer(moduleId.layer());
cluster.setSubDet(moduleId.subdetId());
cluster_product_->push_back(0,cluster);
}
}
virtual void putInEvent(edm::Event& evt) override final
{
evt.put(std::move(cluster_product_),name());
Expand All @@ -36,34 +66,14 @@ class FullModuleSumAlgo : public Algorithm<HGCalTriggerCellBestChoiceCodec>

};

/*****************************************************************/
void FullModuleSumAlgo::run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es)
/*****************************************************************/
{
for( const auto& digi : coll )
{
HGCalTriggerCellBestChoiceCodec::data_type data;
data.reset();
const HGCalDetId& moduleId = digi.getDetId<HGCalDetId>();
digi.decode(codec_, data);

// Sum of trigger cells inside the module
uint32_t moduleSum = 0;
for(const auto& triggercell : data.payload)
{
moduleSum += triggercell.hwPt();
}
// dummy cluster without position
// moduleId filled in place of hardware eta
l1t::HGCalCluster cluster( reco::LeafCandidate::LorentzVector(),
moduleSum, 0, 0);
cluster.setModule(moduleId.wafer());
cluster.setLayer(moduleId.layer());
cluster.setSubDet(moduleId.subdetId());
cluster_product_->push_back(0,cluster);
}
}
typedef FullModuleSumAlgo<HGCalTriggerCellBestChoiceCodec, HGCalTriggerCellBestChoiceCodec::data_type> FullModuleSumAlgoBestChoice;
typedef FullModuleSumAlgo<HGCalTriggerCellThresholdCodec, HGCalTriggerCellThresholdCodec::data_type> FullModuleSumAlgoThreshold;


DEFINE_EDM_PLUGIN(HGCalTriggerBackendAlgorithmFactory,
FullModuleSumAlgo,
"FullModuleSumAlgo");
FullModuleSumAlgoBestChoice,
"FullModuleSumAlgoBestChoice");

DEFINE_EDM_PLUGIN(HGCalTriggerBackendAlgorithmFactory,
FullModuleSumAlgoThreshold,
"FullModuleSumAlgoThreshold");
93 changes: 51 additions & 42 deletions L1Trigger/L1THGCal/plugins/be_algorithms/SingleCellClusterAlgo.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#include "L1Trigger/L1THGCal/interface/HGCalTriggerBackendAlgorithmBase.h"
#include "L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellBestChoiceCodec.h"
#include "L1Trigger/L1THGCal/interface/fe_codecs/HGCalTriggerCellThresholdCodec.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "L1Trigger/L1THGCal/interface/be_algorithms/HGCalTriggerCellCalibration.h"

using namespace HGCalTriggerBackend;

class SingleCellClusterAlgo : public Algorithm<HGCalTriggerCellBestChoiceCodec>
template<typename FECODEC, typename DATA>
class SingleCellClusterAlgo : public Algorithm<FECODEC>
{
public:
using Algorithm<FECODEC>::name;

protected:
using Algorithm<FECODEC>::codec_;

public:
SingleCellClusterAlgo(const edm::ParameterSet& conf):
Algorithm<HGCalTriggerCellBestChoiceCodec>(conf),
Algorithm<FECODEC>(conf),
cluster_product_( new l1t::HGCalTriggerCellBxCollection ),
HGCalEESensitive_(conf.getParameter<std::string>("HGCalEESensitive_tag")),
HGCalHESiliconSensitive_(conf.getParameter<std::string>("HGCalHESiliconSensitive_tag")),
Expand All @@ -24,8 +31,41 @@ class SingleCellClusterAlgo : public Algorithm<HGCalTriggerCellBestChoiceCodec>
prod.produces<l1t::HGCalTriggerCellBxCollection>(name());
}

virtual void run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es) override final;

virtual void run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es) override final
{
es.get<IdealGeometryRecord>().get(HGCalEESensitive_, hgceeTopoHandle_);
es.get<IdealGeometryRecord>().get(HGCalHESiliconSensitive_, hgchefTopoHandle_);

for( const auto& digi : coll )
{
HGCalDetId module_id(digi.id());
DATA data;
data.reset();
digi.decode(codec_, data);
for(const auto& triggercell : data.payload)
{
if(triggercell.hwPt()>0)
{

HGCalDetId detid(triggercell.detId());
int subdet = detid.subdetId();
int cellThickness = 0;

if( subdet == HGCEE ){
cellThickness = (hgceeTopoHandle_)->dddConstants().waferTypeL((unsigned int)detid.wafer() );
}else if( subdet == HGCHEF ){
cellThickness = (hgchefTopoHandle_)->dddConstants().waferTypeL((unsigned int)detid.wafer() );
}else if( subdet == HGCHEB ){
edm::LogWarning("DataNotFound") << "ATTENTION: the BH trgCells are not yet implemented !! ";
}
l1t::HGCalTriggerCell calibratedtriggercell(triggercell);
calibration_.calibrate(calibratedtriggercell, cellThickness);
cluster_product_->push_back(0,calibratedtriggercell);
}
}
}
}

virtual void putInEvent(edm::Event& evt) override final
{
evt.put(std::move(cluster_product_),name());
Expand All @@ -48,44 +88,13 @@ class SingleCellClusterAlgo : public Algorithm<HGCalTriggerCellBestChoiceCodec>

};

/*****************************************************************/
void SingleCellClusterAlgo::run(const l1t::HGCFETriggerDigiCollection& coll, const edm::EventSetup& es)
/*****************************************************************/
{
es.get<IdealGeometryRecord>().get(HGCalEESensitive_, hgceeTopoHandle_);
es.get<IdealGeometryRecord>().get(HGCalHESiliconSensitive_, hgchefTopoHandle_);


for( const auto& digi : coll )
{
HGCalDetId module_id(digi.id());
HGCalTriggerCellBestChoiceCodec::data_type data;
data.reset();
digi.decode(codec_, data);
for(const auto& triggercell : data.payload)
{
if(triggercell.hwPt()>0)
{

HGCalDetId detid(triggercell.detId());
int subdet = detid.subdetId();
int cellThickness = 0;
typedef SingleCellClusterAlgo<HGCalTriggerCellBestChoiceCodec, HGCalTriggerCellBestChoiceCodec::data_type> SingleCellClusterAlgoBestChoice;
typedef SingleCellClusterAlgo<HGCalTriggerCellThresholdCodec, HGCalTriggerCellThresholdCodec::data_type> SingleCellClusterAlgoThreshold;

if( subdet == HGCEE ){
cellThickness = (hgceeTopoHandle_)->dddConstants().waferTypeL((unsigned int)detid.wafer() );
}else if( subdet == HGCHEF ){
cellThickness = (hgchefTopoHandle_)->dddConstants().waferTypeL((unsigned int)detid.wafer() );
}else if( subdet == HGCHEB ){
edm::LogWarning("DataNotFound") << "ATTENTION: the BH trgCells are not yet implemented !! ";
}
l1t::HGCalTriggerCell calibratedtriggercell(triggercell);
calibration_.calibrate(calibratedtriggercell, cellThickness);
cluster_product_->push_back(0,calibratedtriggercell);
}
}
}
}
DEFINE_EDM_PLUGIN(HGCalTriggerBackendAlgorithmFactory,
SingleCellClusterAlgoBestChoice,
"SingleCellClusterAlgoBestChoice");

DEFINE_EDM_PLUGIN(HGCalTriggerBackendAlgorithmFactory,
SingleCellClusterAlgo,
"SingleCellClusterAlgo");
SingleCellClusterAlgoThreshold,
"SingleCellClusterAlgoThreshold");
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ setDataPayloadImpl(const l1t::HGCFETriggerDigi& digi)
conf.addParameter<double> ("tdcOnsetfC", codecImpl_.tdcOnsetfC());
conf.addParameter<uint32_t> ("triggerCellTruncationBits", codecImpl_.triggerCellTruncationBits());
conf.addParameter<double> ("TCThreshold_fC", codecImpl_.TCThreshold_fC());
HGCalTriggerCellThresholdCodec codecInput(conf);
conf.addParameter<int> ("triggerCellTruncationBits", codecImpl_.triggerCellTruncationBits()); HGCalTriggerCellThresholdCodec codecInput(conf);
codecInput.setGeometry(geometry_);
digi.decode(codecInput,data_);
// choose threshold selected cells in the module
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1THGCal/python/hgcalTriggerNtuples_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

ntuple_triggercells = cms.PSet(
NtupleName = cms.string('HGCalTriggerNtupleHGCTriggerCells'),
TriggerCells = cms.InputTag('hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgo')
TriggerCells = cms.InputTag('hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgoBestChoice')
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@
adcnBits = digiparam.hgceeDigitizer.digiCfg.feCfg.adcNbits,
tdcsaturation = digiparam.hgceeDigitizer.digiCfg.feCfg.tdcSaturation_fC,
tdcnBits = digiparam.hgceeDigitizer.digiCfg.feCfg.tdcNbits,
tdcOnsetfC = digiparam.hgceeDigitizer.digiCfg.feCfg.tdcOnset_fC
tdcOnsetfC = digiparam.hgceeDigitizer.digiCfg.feCfg.tdcOnset_fC,
TCThreshold = cms.int32(10)
)


calib_parValues = cms.PSet( cellLSB = cms.double( fe_codec.linLSB.value() * (2 ** fe_codec.triggerCellTruncationBits.value() ) ),
fCperMIPee = recoparam.HGCalUncalibRecHit.HGCEEConfig.fCPerMIP,
fCperMIPfh = recoparam.HGCalUncalibRecHit.HGCHEFConfig.fCPerMIP,
dEdXweights = recocalibparam.HGCalRecHit.layerWeights,
thickCorr = recocalibparam.HGCalRecHit.thicknessCorrection
)


cluster_algo = cms.PSet( AlgorithmName = cms.string('FullModuleSumAlgo'),
FECodec = fe_codec.clone(),
cluster_algo = cms.PSet( AlgorithmName = cms.string('FullModuleSumAlgoBestChoice'),
FECodec = fe_codec,
HGCalEESensitive_tag = cms.string('HGCalEESensitive'),
HGCalHESiliconSensitive_tag = cms.string('HGCalHESiliconSensitive'),
calib_parameters = calib_parValues.clone()
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1THGCal/test/L1TC_CalibWeightExt_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
2 ** process.hgcalTriggerPrimitiveDigiProducer.FECodec.triggerCellTruncationBits.value()
)

cluster_algo_all = cms.PSet( AlgorithmName = cms.string('SingleCellClusterAlgo'),
cluster_algo_all = cms.PSet( AlgorithmName = cms.string('SingleCellClusterAlgoBestChoice'),
FECodec = process.hgcalTriggerPrimitiveDigiProducer.FECodec,
HGCalEESensitive_tag = cms.string('HGCalEESensitive'),
HGCalHESiliconSensitive_tag = cms.string('HGCalHESiliconSensitive'),
Expand All @@ -128,7 +128,7 @@

process.digi2raw_step = cms.Path(process.DigiToRaw)
process.TC_CalibWeight = cms.EDAnalyzer("testCalibration",
triggerCellInputTag=cms.InputTag("hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgo")
triggerCellInputTag=cms.InputTag("hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgoBestChoice")
)

process.test_step = cms.Path(process.TC_CalibWeight)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff')
## define trigger emulator without trigger cell selection
process.hgcalTriggerPrimitiveDigiProducer.FECodec.NData = cms.uint32(999) # put number larger than max number of trigger cells in module
<<<<<<< HEAD
cluster_algo_all = cms.PSet( AlgorithmName = cms.string('SingleCellClusterAlgoBestChoice'),
FECodec = process.hgcalTriggerPrimitiveDigiProducer.FECodec )
process.hgcalTriggerPrimitiveDigiProducer.BEConfiguration.algorithms = cms.VPSet( cluster_algo_all )
Expand All @@ -133,8 +132,8 @@
eeSimHits = cms.InputTag('g4SimHits:HGCHitsEE'),
fhSimHits = cms.InputTag('g4SimHits:HGCHitsHEfront'),
#bhSimHits = cms.InputTag('g4SimHits:HGCHitsHEback'),
beTriggerCellsAll = cms.InputTag('hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgoBestChoice'),
beTriggerCellsSelect = cms.InputTag('hgcalTriggerPrimitiveDigiFEReproducer:SingleCellClusterAlgoBestChoice'),
beClustersAll = cms.InputTag('hgcalTriggerPrimitiveDigiProducer:SingleCellClusterAlgoBestChoice'),
beClustersSelect = cms.InputTag('hgcalTriggerPrimitiveDigiFEReproducer:SingleCellClusterAlgoBestChoice'),
FECodec = process.hgcalTriggerPrimitiveDigiFEReproducer.FECodec.clone()
)
process.hgcaltriggerbestchoicetester.FECodec.triggerCellTruncationBits = cms.uint32(7)
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/L1THGCal/test/testHGCalL1T_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
2 ** process.hgcalTriggerPrimitiveDigiProducer.FECodec.triggerCellTruncationBits.value()
)

cluster_algo_all = cms.PSet( AlgorithmName = cms.string('SingleCellClusterAlgo'),
cluster_algo_all = cms.PSet( AlgorithmName = cms.string('SingleCellClusterAlgoBestChoice'),
FECodec = process.hgcalTriggerPrimitiveDigiProducer.FECodec,
HGCalEESensitive_tag = cms.string('HGCalEESensitive'),
HGCalHESiliconSensitive_tag = cms.string('HGCalHESiliconSensitive'),
Expand All @@ -138,6 +138,7 @@

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.hgcl1tpg_step,process.digi2raw_step, process.ntuple_step, process.endjob_step, process.FEVTDEBUGoutput_step)

# filter all path with the production filter sequence
for path in process.paths:
getattr(process,path)._seq = process.generator * getattr(process,path)._seq
Expand Down

0 comments on commit d862015

Please sign in to comment.