Skip to content

Commit

Permalink
Merge pull request cms-sw#25072 from vargasa/MatBdgOtherFix
Browse files Browse the repository at this point in the history
Validation/Geometry: Tracker/HGCal Material Budget 'Other' Category fix
  • Loading branch information
cmsbuild authored Nov 9, 2018
2 parents a3ad3b0 + 84d9708 commit a7a7523
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 47 deletions.
91 changes: 55 additions & 36 deletions Validation/Geometry/src/MaterialBudgetData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,40 +216,63 @@ void MaterialBudgetData::dataPerStep( const G4Step* aStep )

// FIXME: Both volume ID and material ID are zeros, so this part is not executed leaving all
// values as zeros.
if(!myMaterialBudgetCategorizer->x0fraction(materialName).empty() && (!isHGCal))
{
theSupportFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[0];
theSensitiveFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[1];
theCablesFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[2];
theCoolingFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[3];
theElectronicsFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[4];
theOtherFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[5];
theAirFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[6];

if(theOtherFractionMB!=0)
edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName
<< " in volume " << volumeName;

theSupportFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[0];
theSensitiveFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[1];
theCablesFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[2];
theCoolingFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[3];
theElectronicsFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[4];
theOtherFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[5];
theAirFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[6];
if (!isHGCal){

if(theOtherFractionIL!=0)
edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName
<< " in volume " << volumeName;
}
else
{
theOtherFractionMB = 1;
theOtherFractionIL = 1;
}
if( (!myMaterialBudgetCategorizer->HGCalx0fraction(materialName).empty()) && (isHGCal) )
{
bool isCtgOk = !myMaterialBudgetCategorizer->x0fraction(materialName).empty()
&& !myMaterialBudgetCategorizer->l0fraction(materialName).empty()
&& (myMaterialBudgetCategorizer->x0fraction(materialName).size() == 7) /*7 Categories*/
&& (myMaterialBudgetCategorizer->l0fraction(materialName).size() == 7);

if(!isCtgOk)
{
theOtherFractionMB = 1;
theOtherFractionIL = 1;

edm::LogWarning("MaterialBudget")
<< "MaterialBudgetData: Material forced to 'Other': " << materialName
<< " in volume " << volumeName << ". Check Categorization.";

}
else
{
theSupportFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[0];
theSensitiveFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[1];
theCablesFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[2];
theCoolingFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[3];
theElectronicsFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[4];
theOtherFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[5];
theAirFractionMB = myMaterialBudgetCategorizer->x0fraction(materialName)[6];

if(theOtherFractionMB!=0)
edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName
<< " in volume " << volumeName;

theSupportFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[0];
theSensitiveFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[1];
theCablesFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[2];
theCoolingFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[3];
theElectronicsFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[4];
theOtherFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[5];
theAirFractionIL = myMaterialBudgetCategorizer->l0fraction(materialName)[6];

if(theOtherFractionIL!=0)
edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category: " << materialName
<< " in volume " << volumeName;
}
} else { // isHGCal

bool isHGCalx0fractionEmpty = myMaterialBudgetCategorizer->HGCalx0fraction(materialName).empty();
bool isHGCall0fractionEmpty = myMaterialBudgetCategorizer->HGCall0fraction(materialName).empty();

if( isHGCalx0fractionEmpty && isHGCall0fractionEmpty ) {
theOtherFractionMB = 1;
theOtherFractionIL = 1;

edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material forced to 'Other': " << materialName
<< " in volume " << volumeName;
} else{

theAirFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[0];
theCablesFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[1];
theCopperFractionMB = myMaterialBudgetCategorizer->HGCalx0fraction(materialName)[2];
Expand Down Expand Up @@ -282,11 +305,7 @@ void MaterialBudgetData::dataPerStep( const G4Step* aStep )
edm::LogWarning("MaterialBudget") << "MaterialBudgetData: Material found with no category " << materialName
<< " in volume " << volumeName << std::endl;
}
else
{
theOtherFractionMB = 1;
theOtherFractionIL = 1;
}
}

float dmb = steplen/radlen;
float dil = steplen/intlen;
Expand Down
20 changes: 10 additions & 10 deletions Validation/Geometry/src/MaterialBudgetTrackerHistos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ void MaterialBudgetTrackerHistos::book()
float rMax = 1400.;

// total X0
hmgr->addHistoProf1( new TProfile("10", "MB prof Eta;#eta;x/X_{0} ", 250, -5., 5. ) );
hmgr->addHistoProf1( new TProfile("10", "MB prof Eta [Total];#eta;x/X_{0} ", 250, -5., 5. ) );
hmgr->addHisto1( new TH1F("11", "Eta " , 501, -5., 5. ) );
hmgr->addHistoProf1( new TProfile("20", "MB prof Phi;#varphi [rad];x/X_{0} ", 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf1( new TProfile("20", "MB prof Phi [Total];#varphi [rad];x/X_{0} ", 180, -3.1416, 3.1416 ) );
hmgr->addHisto1( new TH1F("21", "Phi " , 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf2( new TProfile2D("30", "MB prof Eta Phi;#eta;#varphi;x/X_{0} ", 250, -5., 5., 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf2( new TProfile2D("30", "MB prof Eta Phi [Total];#eta;#varphi;x/X_{0} ", 250, -5., 5., 180, -3.1416, 3.1416 ) );
hmgr->addHisto2( new TH2F("31", "Eta vs Phi " , 501, -5., 5., 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf1( new TProfile("40", "MB prof R;R [mm];x/X_{0} ", 200, 0., 2000. ) );
hmgr->addHistoProf1( new TProfile("40", "MB prof R [Total];R [mm];x/X_{0} ", 200, 0., 2000. ) );
hmgr->addHisto1( new TH1F("41", "R " , 200, 0., 2000. ) );
hmgr->addHistoProf2( new TProfile2D("50", "MB prof sum R z;z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHistoProf2( new TProfile2D("50", "MB prof sum R z [Total];z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("999", "Tot track length for MB", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("51", "R vs z " , nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("60", "MB prof local R z;z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
Expand Down Expand Up @@ -138,17 +138,17 @@ void MaterialBudgetTrackerHistos::book()
//

// total Lambda0
hmgr->addHistoProf1( new TProfile("1010", "MB prof Eta;#eta;#lambda/#lambda_{0} ", 250, -5., 5. ) );
hmgr->addHistoProf1( new TProfile("1010", "MB prof Eta [Total];#eta;#lambda/#lambda_{0} ", 250, -5., 5. ) );
hmgr->addHisto1( new TH1F("1011", "Eta " , 501, -5., 5. ) );
hmgr->addHistoProf1( new TProfile("1020", "MB prof Phi;#varphi [rad];#lambda/#lambda_{0} ", 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf1( new TProfile("1020", "MB prof Phi [Total];#varphi [rad];#lambda/#lambda_{0} ", 180, -3.1416, 3.1416 ) );
hmgr->addHisto1( new TH1F("1021", "Phi " , 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf2( new TProfile2D("1030", "MB prof Eta Phi;#eta;#varphi;#lambda/#lambda_{0} ", 250, -5., 5., 180, -3.1416, 3.1416 ) );
hmgr->addHistoProf2( new TProfile2D("1030", "MB prof Eta Phi [Total];#eta;#varphi;#lambda/#lambda_{0} ", 250, -5., 5., 180, -3.1416, 3.1416 ) );
hmgr->addHisto2( new TH2F("1031", "Eta vs Phi " , 501, -5., 5., 180, -3.1416, 3.1416 ) );

// rr
hmgr->addHistoProf1( new TProfile("1040", "MB prof R;R [mm];#lambda/#lambda_{0} ", 200, 0., 2000. ) );
hmgr->addHistoProf1( new TProfile("1040", "MB prof R [Total];R [mm];#lambda/#lambda_{0} ", 200, 0., 2000. ) );
hmgr->addHisto1( new TH1F("1041", "R " , 200, 0., 2000. ) );
hmgr->addHistoProf2( new TProfile2D("1050", "MB prof sum R z;z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHistoProf2( new TProfile2D("1050", "MB prof sum R z [Total];z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("1999", "Tot track length for l0", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("1051", "R vs z " , nzbin, zMin, zMax, nrbin, rMin, rMax ) );
hmgr->addHisto2( new TH2F("1060", "MB prof local R z;z [mm];R [mm];x/X_{0} ", nzbin, zMin, zMax, nrbin, rMin, rMax ) );
Expand Down
13 changes: 13 additions & 0 deletions Validation/Geometry/test/runP_Tracker_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@

from Validation.Geometry.plot_utils import _LABELS2COMPS

process.load("FWCore.MessageLogger.MessageLogger_cfi")

process.MessageLogger = cms.Service(
"MessageLogger",
destinations = cms.untracked.vstring('info'),
categories = cms.untracked.vstring('logMsg'),
info = cms.untracked.PSet(
threshold = cms.untracked.string("INFO"),
logMsg = cms.untracked.PSet(limit = cms.untracked.int32(1000))
)
)


_ALLOWED_LABELS = _LABELS2COMPS.keys()

options = VarParsing('analysis')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# cmsRun single_neutrino_cfg.py nEvents=1000

import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing

process = cms.Process("TestProcess")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
Expand All @@ -11,8 +14,19 @@

process.load("Configuration.EventContent.EventContent_cff")

options = VarParsing('analysis')

options.register('nEvents',
10000,
VarParsing.multiplicity.singleton,
VarParsing.varType.int,
"Maximum number of events"
)

options.parseArguments()

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10000)
input = cms.untracked.int32(options.nEvents)
)

process.load("IOMC.RandomEngine.IOMC_cff")
Expand Down

0 comments on commit a7a7523

Please sign in to comment.