Skip to content

Commit

Permalink
Merge pull request #4908 from bsunanda/Phase2-hgx22
Browse files Browse the repository at this point in the history
Phase2-hgx22
  • Loading branch information
cmsbuild committed Aug 11, 2014
2 parents 3c06f72 + 2ad424c commit 6f5188a
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Geometry/CaloTopology/src/HGCalTopology.cc
Expand Up @@ -39,7 +39,7 @@ DetId HGCalTopology::denseId2detId(uint32_t hi) const {
id_.zside = ((int)(hi)<kHGhalf_ ? -1 : 1);
int di = ((int)(hi)%kHGhalf_);
int iSubSec= (di%subSectors_);
id_.iSubSec= (iSubSec = 0 ? -1 : 1);
id_.iSubSec= (iSubSec == 0 ? -1 : 1);
id_.iSec = (((di-iSubSec)/subSectors_)%sectors_+1);
id_.iLay = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_)%layers_+1);
id_.iCell = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_-id_.iLay+1)/layers_+1);
Expand Down Expand Up @@ -96,7 +96,7 @@ HGCalTopology::DecodedDetId HGCalTopology::geomDenseId2decId(const uint32_t& hi)
id_.zside = ((int)(hi)<kHGeomHalf_ ? -1 : 1);
int di = ((int)(hi)%kHGeomHalf_);
int iSubSec= (di%subSectors_);
id_.iSubSec= (iSubSec = 0 ? -1 : 1);
id_.iSubSec= (iSubSec == 0 ? -1 : 1);
id_.iSec = (((di-iSubSec)/subSectors_)%sectors_+1);
id_.iLay = (((((di-iSubSec)/subSectors_)-id_.iSec+1)/sectors_)%layers_+1);
}
Expand Down
5 changes: 5 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Expand Up @@ -318,6 +318,11 @@ std::pair<int,int> HGCalDDDConstants::simToReco(int cell, int lay,
for (int iky=0; iky<ky; ++iky)
kx += floor((iky*cellSize+b)/(a*cellSize));

#ifdef DebugLog
std::cout << "simToReco: input " << cell << ":" << lay << ":" << half
<< " kxy " << kxy.first << ":" << kxy.second << " output "
<< kx << ":" << depth << std::endl;
#endif
return std::pair<int,int>(kx,depth);
}

Expand Down
4 changes: 4 additions & 0 deletions SimCalorimetry/HGCSimProducers/interface/HGCDigitizer.h
Expand Up @@ -79,6 +79,10 @@ private :

//subdetector id
ForwardSubdetector mySubDet_;

//misc switches
bool useAllChannels_;
int verbosity_;
};

#endif
Expand Down
18 changes: 15 additions & 3 deletions SimCalorimetry/HGCSimProducers/src/HGCDigitizer.cc
Expand Up @@ -26,6 +26,8 @@ HGCDigitizer::HGCDigitizer(const edm::ParameterSet& ps) :
maxSimHitsAccTime_ = ps.getParameter< uint32_t >("maxSimHitsAccTime");
bxTime_ = ps.getParameter< int32_t >("bxTime");
digitizationType_ = ps.getParameter< uint32_t >("digitizationType");
useAllChannels_ = ps.getParameter< bool >("useAllChannels");
verbosity_ = ps.getUntrackedParameter< int32_t >("verbosity",0);

//get the random number generator
edm::Service<edm::RandomNumberGenerator> rng;
Expand Down Expand Up @@ -153,6 +155,12 @@ void HGCDigitizer::accumulate(edm::Handle<edm::PCaloHitContainer> const &hits, i
(uint32_t)HGCEEDetId(mySubDet_,simId.zside(),layer,simId.sector(),simId.subsector(),cell):
(uint32_t)HGCHEDetId(mySubDet_,simId.zside(),layer,simId.sector(),simId.subsector(),cell) );

if (verbosity_>0) {
if (producesEEDigis())
std::cout << "HGCDigitizer: i/p " << simId << " o/p " << HGCEEDetId(id) << std::endl;
else
std::cout << "HGCDigitizer: i/p " << simId << " o/p " << HGCHEDetId(id) << std::endl;
}
//hit time: [time()]=ns [zPos]=cm [CLHEP::c_light]=mm/ns
//for now accumulate in buckets of bxTime_
int itime=floor( (hit_it->time()-zPos/(0.1*CLHEP::c_light))/bxTime_);
Expand Down Expand Up @@ -185,14 +193,18 @@ void HGCDigitizer::accumulate(edm::Handle<edm::PCaloHitContainer> const &hits, i
baseData.fill(0.);
const std::vector<DetId> &validIds=geom->getValidDetIds();
int nadded(0);
for(std::vector<DetId>::const_iterator it=validIds.begin(); it!=validIds.end(); it++)
{
if (useAllChannels_) {
for(std::vector<DetId>::const_iterator it=validIds.begin(); it!=validIds.end(); it++) {
uint32_t id(it->rawId());
if(simHitAccumulator_->find(id)!=simHitAccumulator_->end()) continue;
simHitAccumulator_->insert( std::make_pair(id,baseData) );
nadded++;
}
std::cout << "Added " << nadded << " detIds without " << hitCollection_ << " in first event processed" << std::endl;
}
if (verbosity_ > 0)
std::cout << "HGCDigitizer:Added " << nadded << ":" << validIds.size()
<< " detIds without " << hitCollection_
<< " in first event processed" << std::endl;
checkValidDetIds_=false;
}

Expand Down
13 changes: 13 additions & 0 deletions SimCalorimetry/HGCSimProducers/test/BuildFile.xml
@@ -0,0 +1,13 @@
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="SimGeneral/MixingModule"/>
<use name="SimCalorimetry/HGCSimProducers"/>
<use name="DataFormats/ForwardDetId"/>
<use name="DataFormats/HGCDigi"/>
<use name="Geometry/Records"/>
<use name="Geometry/FCalGeometry"/>
<use name="hepmc"/>
<use name="CLHEP"/>
<flags EDM_PLUGIN="1"/>
<library file="HGCalDigiTester.cc" name="testSimCalorimetryHCCalDigi"> </library>
121 changes: 121 additions & 0 deletions SimCalorimetry/HGCSimProducers/test/HGCalDigiTester.cc
@@ -0,0 +1,121 @@
#include <iostream>
#include <string>
#include <vector>

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/FCalGeometry/interface/HGCalGeometry.h"
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h"
#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"

class HGCalDigiTester : public edm::EDAnalyzer {
public:
explicit HGCalDigiTester(const edm::ParameterSet& );
~HGCalDigiTester();


virtual void analyze(const edm::Event&, const edm::EventSetup& );

private:
// ----------member data ---------------------------
};

HGCalDigiTester::HGCalDigiTester(const edm::ParameterSet& ) {}


HGCalDigiTester::~HGCalDigiTester() {}

void HGCalDigiTester::analyze(const edm::Event& iEvent,
const edm::EventSetup& iSetup ) {

std::string name;
edm::ESHandle<HGCalGeometry> geom;

name = "HGCalEESensitive";
iSetup.get<IdealGeometryRecord>().get(name,geom);
if (geom.isValid()) {
edm::Handle<HGCEEDigiCollection> digis;
iEvent.getByLabel(edm::InputTag("mix","HGCDigisEE"),digis);
if (digis.isValid()) {
std::cout << "HGCEE with " << (*digis).size() << " elements"
<< std::endl;
for (unsigned int k=0; k < (*digis).size(); ++k) {
HGCEEDetId id = (*digis)[k].id();
GlobalPoint global = (*geom).getPosition(id);
HGCEEDetId idc = (HGCEEDetId)((*geom).getClosestCell(global));
std::cout << "HGCalDigiTester:ID " << id << " global (" << global.x()
<< ", " << global.y() << ", " << global.z() << ") new ID "
<< idc << std::endl;
}
} else {
std::cout << "No valid collection for HGCEE" << std::endl;
}
} else {
std::cout << "Cannot get valid HGCalGeometry Object for " << name
<< std::endl;
}

name = "HGCalHESiliconSensitive";
iSetup.get<IdealGeometryRecord>().get(name,geom);
if (geom.isValid()) {
edm::Handle<HGCHEDigiCollection> digis;
iEvent.getByLabel(edm::InputTag("mix","HGCDigisHEfront"),digis);
if (digis.isValid()) {
std::cout << "HGCHEfront with " << (*digis).size() << " elements"
<< std::endl;
for (unsigned int k=0; k < (*digis).size(); ++k) {
HGCHEDetId id = (*digis)[k].id();
GlobalPoint global = (*geom).getPosition(id);
HGCHEDetId idc = (HGCHEDetId)((*geom).getClosestCell(global));
std::cout << "HGCalDigiTester:ID " << id << " global (" << global.x()
<< ", " << global.y() << ", " << global.z() << ") new ID "
<< idc << std::endl;
}
} else {
std::cout << "No valid collection for HGCHEfront" << std::endl;
}
} else {
std::cout << "Cannot get valid HGCalGeometry Object for " << name
<< std::endl;
}

name = "HGCalHEScintillatorSensitive";
iSetup.get<IdealGeometryRecord>().get(name,geom);
if (geom.isValid()) {
edm::Handle<HGCHEDigiCollection> digis;
iEvent.getByLabel(edm::InputTag("mix","HGCDigisHEback"),digis);
if (digis.isValid()) {
std::cout << "HGCHEback with " << (*digis).size() << " elements"
<< std::endl;
for (unsigned int k=0; k < (*digis).size(); ++k) {
HGCHEDetId id = (*digis)[k].id();
GlobalPoint global = (*geom).getPosition(id);
HGCHEDetId idc = (HGCHEDetId)((*geom).getClosestCell(global));
std::cout << "HGCalDigiTester:ID " << id << " global (" << global.x()
<< ", " << global.y() << ", " << global.z() << ") new ID "
<< idc << std::endl;
}
} else {
std::cout << "No valid collection for HGCHEback" << std::endl;
}
} else {
std::cout << "Cannot get valid HGCalGeometry Object for " << name
<< std::endl;
}

}


//define this as a plug-in
DEFINE_FWK_MODULE(HGCalDigiTester);
120 changes: 120 additions & 0 deletions SimCalorimetry/HGCSimProducers/test/testHGCalDigi_cfg.py
@@ -0,0 +1,120 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process('SIMDIGI')

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2023HGCalMuonReco_cff')
process.load('Configuration.Geometry.GeometryExtended2023HGCalMuon_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedGauss_cfi')
process.load('GeneratorInterface.Core.genFilterSummary_cff')
process.load('Configuration.StandardSequences.SimIdeal_cff')
process.load('Configuration.StandardSequences.Digi_cff')
process.load('Configuration.StandardSequences.SimL1Emulator_cff')
process.load('Configuration.StandardSequences.DigiToRaw_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10)
)

# Input source
process.source = cms.Source("EmptySource")

process.options = cms.untracked.PSet(

)

# Production Info
process.configurationMetadata = cms.untracked.PSet(
version = cms.untracked.string('$Revision: 1.20 $'),
annotation = cms.untracked.string('SingleElectronPt10_cfi nevts:10'),
name = cms.untracked.string('Applications')
)

# Output definition

process.FEVTDEBUGHLToutput = cms.OutputModule("PoolOutputModule",
splitLevel = cms.untracked.int32(0),
eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands,
fileName = cms.untracked.string('file:junk.root'),
dataset = cms.untracked.PSet(
filterName = cms.untracked.string(''),
dataTier = cms.untracked.string('GEN-SIM-DIGI-RAW')
),
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('generation_step')
)
)

# Additional output definition

# Other statements
process.genstepfilter.triggerConditions=cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:upgradePLS3', '')

process.generator = cms.EDProducer("FlatRandomPtGunProducer",
PGunParameters = cms.PSet(
MaxPt = cms.double(10.01),
MinPt = cms.double(9.99),
PartID = cms.vint32(13),
MaxEta = cms.double(2.5),
MaxPhi = cms.double(3.14159265359),
MinEta = cms.double(-2.5),
MinPhi = cms.double(-3.14159265359)
),
Verbosity = cms.untracked.int32(0),
psethack = cms.string('single electron pt 10'),
AddAntiParticle = cms.bool(True),
firstRun = cms.untracked.uint32(1)
)

process.mix.digitizers = cms.PSet(process.theDigitizersValid)

process.DigiTester = cms.EDAnalyzer("HGCalDigiTester")

# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
process.simulation_step = cms.Path(process.psim)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.digitisation_step = cms.Path(process.pdigi_valid)
process.L1simulation_step = cms.Path(process.SimL1Emulator)
process.digi2raw_step = cms.Path(process.DigiToRaw)
process.digitest_step = cms.Path(process.DigiTester)

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.L1simulation_step,process.digi2raw_step,process.digitest_step)
# filter all path with the production filter sequence
for path in process.paths:
getattr(process,path)._seq = process.generator * getattr(process,path)._seq

# customisation of the process.

# Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.combinedCustoms
from SLHCUpgradeSimulations.Configuration.combinedCustoms import cust_2023HGCalMuon

#call to customisation function cust_2023HGCalMuon imported from SLHCUpgradeSimulations.Configuration.combinedCustoms
process = cust_2023HGCalMuon(process)

# End of customisation functions

process.g4SimHits.HGCSD.Verbosity = 1
process.mix.digitizers.hgceeDigitizer.useAllChannels = False
process.mix.digitizers.hgceeDigitizer.verbosity = 1
process.mix.digitizers.hgchefrontDigitizer.useAllChannels = False
process.mix.digitizers.hgchefrontDigitizer.verbosity = 1
process.mix.digitizers.hgchebackDigitizer.useAllChannels = False
process.mix.digitizers.hgchebackDigitizer.verbosity = 1


4 changes: 3 additions & 1 deletion SimG4CMS/Calo/interface/HGCNumberingScheme.h
Expand Up @@ -21,7 +21,8 @@ class HGCNumberingScheme : public CaloNumberingScheme {

enum HGCNumberingParameters { HGCCellSize };

HGCNumberingScheme(const DDCompactView & cpv, std::string& name, bool check);
HGCNumberingScheme(const DDCompactView & cpv, std::string& name, bool check,
int verbose);

virtual ~HGCNumberingScheme();

Expand Down Expand Up @@ -50,6 +51,7 @@ class HGCNumberingScheme : public CaloNumberingScheme {
HGCNumberingScheme();

bool check_;
int verbosity;
HGCalDDDConstants *hgcons;
};

Expand Down
2 changes: 1 addition & 1 deletion SimG4CMS/Calo/interface/HGCSD.h
Expand Up @@ -44,7 +44,7 @@ class HGCSD : public CaloSD {
int setTrackID(G4Step * step);

HGCNumberingScheme* numberingScheme;
G4int mumPDG, mupPDG;
G4int verbosity, mumPDG, mupPDG;
double eminHit;
ForwardSubdetector myFwdSubdet_;
};
Expand Down

0 comments on commit 6f5188a

Please sign in to comment.