Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Proto2ShowerCalibFit.m File Reference

Go to the source code of this file.

Functions

 fprintf ('processing%s\n', filename)
 
 disp (size(data))
 
 fprintf ('processing%s-%.0f GeV @%d\n', filename, energy(j), N_Runs)
 
 DataSet (N_Runs).FileID
 
end end DrawDataSet (DataSet, InitConst, 'Inputs')
 
 SaveCanvas ([DataFolder 'EnergyCalibFIt'], gcf)
 
 figure ('name',['DrawDataSet_EnergyFraction'],'PaperPositionMode','auto',... 'position',[100, 0, 1800, 1000])
 
 imagesc (0:7, 0:7, MeanFraction)
 
colorbar set (gca,'YDir','normal') title(sprintf('%s
 
colorbar DataSet (i).FileID
 
 xlabel ('Column ID')
 
 ylabel ('Row ID')
 
 subplot (1, 3, 1)
 
 title (sprintf('Sum all data'))
 
 subplot (1, 3, 2)
 
 hist (reshape(MeanFraction, size(MeanFraction, 1)*size(MeanFraction, 2), 1), 100)
 
 title ('fraction of shower energy carried by each tower')
 
 xlabel ('MeanFraction')
 
 subplot (1, 3, 3)
 
 imagesc (0:7, 0:7, reshape(low_tower_IDs, 8, 8))
 
 title (sprintf('Low hit towers'))
 
 data_selection (InitConst_RunScale, 10)
 
 disp (object_function(InitConst_RunScale))
 
 disp (object_function(InitConst_RunScale, 2))
 
 disp (object_function(InitConst_RunScale, 1))
 
 data_selection (x, 8)
 
 disp (object_function(x))
 
 data_selection (x, 4)
 
 data_selection (x, 2)
 
 plot (calib_const)
 
 title (sprintf('Calibration constant'))
 
 xlabel ('Col *8+Row')
 
 ylabel ('Calibration New/Old')
 
 imagesc (0:7, 0:7, reshape(calib_const, 8, 8))
 
 plot (E_scale)
 
 title (sprintf('Energy scale constant, mean=%.1f', mean(E_scale)))
 
 xlabel ('Run ID')
 
 ylabel ('Energy scale New/Old')
 
 DrawDataSet (DataSet, calib_const,'Optimized')
 
 dlmwrite (filename,[total_E calib_total_E])
 
end save ([DataFolder 'fit.mat'])
 
 save ('goodfit.mat')
 
 reshape (calib_const_row, 1, 64)
 
 fprintf (fileID,'%d-%d\n',)
 
 fprintf (fileID,'%d\t%d\t%f\n', A)
 
 fclose (fileID)
 

Variables

clear all close all global Ndata = 64
 
global DataSet =struct('FileID',{},'E',{},'DE',{},'data',{}, 'accept',{})
 
global low_tower_IDs =reshape( MeanFraction<0.004, 1, Ndata)
 
 DataFolder = 'E:/tmp/ShowerCalib/'
 
 FileID = {'Rot45','THP','UIUC18','UpTilt5', 'ShowerDepth'}
 
 FileList = FileID
 
 sim_const = 3/100
 
 sim_stat = 12/100
 
 InitConst = [ones(1, 64) ]
 
 zero_sup = -1000
 
zero suppression disabled for i
 
end N_Runs = size(RunList, 2)
 
 data = textread(filename)
 
 energys = data(:,1)
 
 energy = unique(energys)
 
for j
 
 total_E = sum( DataSet(N_Runs).data* InitConst', 2)
 
 SumFraction = []
 
 Fraction = DataSet(i).data ./ total_E
 
 MeanFraction = mean(Fraction, 1)
 
colorbar E = %.1f GeV'
 Modifier of energy of the particle, fP[6].
 
return InitConst_RunScale = [InitConst ones(1, N_Runs)]
 
 x = InitConst_RunScale
 
 options = optimset('Display','iter','TolX',1, 'MaxFunEvals', 100000,'MaxIter',40000,'PlotFcns',@optimplotfval )
 
 calib_const = x(1:Ndata)
 
 E_scale = x((Ndata+1):(Ndata + N_Runs))
 
colorbar New Old
 
 calib_total_E = sum( DataSet(i).data* calib_const', 2)
 
 A = [reshape(calib_const_col,1,64)
 
 fileID = fopen([DataFolder 'ShowerCalibFit_CablibConst.dat'],'w')
 

Function Documentation

data_selection ( InitConst_RunScale  ,
10   
)
data_selection ( x  ,
 
)
data_selection ( x  ,
 
)
data_selection ( x  ,
 
)
DataSet ( N_Runs  )
colorbar DataSet ( i  )
disp ( size(data )
disp ( object_function(InitConst_RunScale )
disp ( object_function(InitConst_RunScale, 2)  )
disp ( object_function(InitConst_RunScale, 1)  )
disp ( object_function(x )
dlmwrite ( filename  )
end end DrawDataSet ( DataSet  ,
InitConst  ,
'Inputs'   
)
DrawDataSet ( DataSet  ,
calib_const  ,
'Optimized'   
)
fclose ( fileID  )
figure ( 'name ,
'PaperPositionMode ,
'auto ,
... 'position  
)
fprintf ( 'processing%s\n ,
filename   
)
fprintf ( 'processing%s-%.0f GeV @%d\n'  ,
filename  ,
energy(j ,
N_Runs   
)
fprintf ( fileID  ,
'%d-%d\n  
)
fprintf ( fileID  ,
'%d\t%d\t%f\n ,
A   
)
hist ( reshape(MeanFraction, size(MeanFraction, 1)*size(MeanFraction, 2), 1)  ,
100   
)
imagesc ( 0:7  ,
0:7  ,
MeanFraction   
)
imagesc ( 0:7  ,
0:7  ,
reshape(low_tower_IDs, 8, 8)   
)
imagesc ( 0:7  ,
0:7  ,
reshape(calib_const, 8, 8)   
)
plot ( calib_const  )
plot ( E_scale  )
reshape ( calib_const_row  ,
,
64   
)
end save ( )
save ( 'goodfit.mat'  )
SaveCanvas ( gcf  )
set ( gca  ,
'YDir'  ,
'normal'   
)
subplot ( ,
,
 
)
subplot ( ,
,
 
)
subplot ( ,
,
 
)
title ( sprintf('Sum all data')  )
title ( 'fraction of shower energy carried by each tower )
title ( sprintf('Low hit towers')  )
title ( sprintf('Calibration constant')  )
title ( sprintf('Energy scale constant, mean=%.1f', mean(E_scale))  )
xlabel ( 'Column ID'  )
xlabel ( 'MeanFraction )
xlabel ( 'Col *8+Row'  )
xlabel ( 'Run ID'  )
ylabel ( 'Row ID'  )
ylabel ( 'Calibration New/Old )
ylabel ( 'Energy scale New/Old )

Variable Documentation

Definition at line 254 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 254 of file Proto2ShowerCalibFit.m

Referenced by KFParticleBase::AddDaughterWithEnergyFit(), KFParticleBaseSIMD::AddDaughterWithEnergyFit(), KFParticleBase::AddDaughterWithEnergyFitMC(), KFParticleBaseSIMD::AddDaughterWithEnergyFitMC(), Martini::areaQ(), BOOST_AUTO_TEST_CASE(), genfit::calcAverageState(), CBcalc(), CBcalc_exp(), CBcalc_LL(), CBFunction(), CBFunction_withBG(), compareMatrices(), PHG4HcalDetector::ConstructMe(), Distribution2Efficiency(), ICGlauber::eProfile(), Acts::estimateTrackParamsFromSeed(), ExtractRejCurve(), Acts::SeedFinder< external_spacepoint_t, platform_t >::filterCandidates(), Acts::SeedFinderOrthogonal< external_spacepoint_t >::filterCandidates(), Acts::SingleSeedVertexFinder< spacepoint_t >::findClosestPointFromPlanes(), Acts::SingleSeedVertexFinder< spacepoint_t >::findClosestPointFromRays(), Acts::RiddersPropagator< propagator_t >::fitLinear(), fullMaterial(), GaussLegendre_getWeight(), get_parametrization_F2(), ALICEKF::GetLineClusterResiduals(), Martini::getMomentumTransfer(), Acts::AnnulusBounds::inside(), Acts::ConeSurface::intersectionSolver(), is_nucleus(), Rossegger::Kimu(), layerMaterial(), Rossegger::Limu(), PHTruthClustering::line_circle_intersection(), SvtxTruthEval::line_circle_intersection(), main(), EMMaximization::Move(), Acts::Sycl::detail::TripletSearch::operator()(), PHTpcClusterMover::process_event(), PHMicromegasTpcTrackMatching::process_event(), BDiJetModule::process_event(), TpcClusterMover::processTrack(), Acts::Legacy::AtlasSeedFinder< SpacePoint >::production3Sp(), PHSimpleKFProp::RemoveBadClusters(), genfit::MplTrackRep::RKPropagate(), genfit::RKTrackRep::RKPropagate(), genfit::RKTrackRep::RKutta(), LaplaceSolution::Rnk(), Acts::SeedFinderFTF< external_spacepoint_t >::runGNN_TrackFinder(), trento::Collider::sample_impact_param(), SandB_CBFunction(), ICGlauber::setIC(), KFParticleBase::SetProductionVertex(), KFParticleBaseSIMD::SetProductionVertex(), MvtxStandaloneTracking::SolveGLS(), Acts::AtlasStepper::State::State(), Acts::AtlasStepper::step(), KFParticleBase::SubtractDaughter(), KFParticleBaseSIMD::SubtractDaughter(), TEST_CASE(), Acts::AtlasStepper::transportCovarianceToBound(), Acts::AtlasStepper::transportCovarianceToCurvilinear(), TripleCBFunction(), TrigFTF_GNN_TrackingFilter< external_spacepoint_t >::update(), Acts::AtlasStepper::update(), Acts::TrigFTF_GNN_Layer< external_spacepoint_t >::verifyBin(), while(), and ActsExamples::RootMaterialWriter::writeMaterial().

calib_const = x(1:Ndata)

Definition at line 195 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 195 of file Proto2ShowerCalibFit.m

calib_total_E = sum( DataSet(i).data* calib_const', 2)

Definition at line 242 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 242 of file Proto2ShowerCalibFit.m

data = textread(filename)

Definition at line 46 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 46 of file Proto2ShowerCalibFit.m

DataFolder = 'E:/tmp/ShowerCalib/'

Definition at line 11 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 11 of file Proto2ShowerCalibFit.m

Readin global DataSet DataSet =struct('FileID',{},'E',{},'DE',{},'data',{}, 'accept',{})

Definition at line 6 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 6 of file Proto2ShowerCalibFit.m

float_v & E = %.1f GeV'

Modifier of energy of the particle, fP[6].

Definition at line 103 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 103 of file Proto2ShowerCalibFit.m

Referenced by ClusterSequence::_bj_set_jetinfo(), ClusterSequence::_CP2DChan_cluster(), TilingExtent::_determine_rapidity_extent(), PseudoJet::_set_rap_phi(), ana_starlight(), PseudoJet::boost(), BOOST_AUTO_TEST_CASE(), Fatras::Test::BOOST_DATA_TEST_CASE(), Fluid::calcTotals(), genfit::DAF::calcWeights(), genfit::Track::checkConsistency(), Fun4AllOscarInputManager::ConvertFromOscar(), Fun4AllHepMCInputManager::ConvertFromOscar(), create_pythia_dummy(), genfit::MaterialEffects::dEdxBetheBloch(), genfit::MaterialEffects::dEdxBrems(), Queue< int >::Dequeue(), draw_G4_bjet_truth_tagging(), draw_G4_dibjet_truth_tagging(), genfit::MaterialEffects::drawdEdx(), DrawEMCalTower_LineShape(), DrawEMCalTower_Resolution(), DrawPrototype2EMCalTower_Resolution(), DrawPrototype2EMCalTower_ResolutionRecalib(), genfit::MaterialEffects::effects(), EGEM_FastSim_Reco(), genfit::RKTrackRep::estimateStep(), FastSim_Reco_EIC(), FGEM_FastSim_Reco(), genfit::TGeoMaterialInterface::findNextBoundary(), Acts::FullBilloirVertexFitter< input_track_t, linearizer_t >::fit(), Fun4All_TestBeam(), GenHadron::GenHadron(), PHG4GDMLWriteDefine::GetAngles(), ABlob::GetPHI(), ActsFatras::detail::GeneralMixture::getSemigauss(), Fatras::GeneralMixture::getSemigauss(), AnnularFieldSim::GetStepDistortion(), hijfst_(), genfit::tools::invertMatrix(), RandomConeAna::jets_to_pseudojets(), LBT::LBT0(), LineShapeCompare(), LineShapeCompare_Electron(), Jetscape::PartonShower::load_edge_info_handler(), CaloCalibEmc_Pi0::Loop(), CaloCalibEmc_Pi0::Loop_for_eta_slices(), main(), genfit::EventDisplay::makeGui(), NoiseSimulator(), RawClusterBuilderTopo::process_event(), DetermineTowerBackground::process_event(), readDigitalCurrents::process_event(), genfit::KalmanFitter::processTrackPoint(), RecalibratorMakeOnePlot(), RejectionCompare(), genfit::RKTrackRep::RKutta(), Matter::rotate(), LBT::rotate(), CaloTriggerInfov1::set_best2_EMCal_4x4_E(), CaloTriggerInfov1::set_best_EMCal_2x2_E(), CaloTriggerInfov1::set_best_EMCal_4x4_E(), CaloTriggerInfov1::set_best_FullCalo_0p2x0p2_E(), CaloTriggerInfov1::set_best_FullCalo_0p4x0p4_E(), CaloTriggerInfov1::set_best_FullCalo_0p6x0p6_E(), CaloTriggerInfov1::set_best_FullCalo_0p8x0p8_E(), CaloTriggerInfov1::set_best_FullCalo_1p0x1p0_E(), genfit::DAF::setAnnealingScheme(), genfit::MeasurementOnPlane::setWeight(), genfit::MaterialEffects::stepper(), genfit::DetPlane::straightLineToPlane(), TEST(), TrackCaloDist(), PseudoJet::unboost(), and PHG4ZDCSteppingAction::UserSteppingAction().

E_scale = x((Ndata+1):(Ndata + N_Runs))

Definition at line 196 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 196 of file Proto2ShowerCalibFit.m

energy = unique(energys)

Definition at line 50 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 50 of file Proto2ShowerCalibFit.m

Referenced by SvtxClusterEval::best_cluster_from(), CaloRawClusterEval::best_cluster_from(), SvtxHitEval::best_hit_from(), JetRecoEval::best_jet_from(), CaloRawTowerEval::best_tower_from(), CalculateSigmaDca(), calculateWeights(), InttClusterizer::ClusterLadderCellsRaw(), MvtxClusterizer::ClusterMvtx(), Acts::computeEnergyLossRadiative(), TreeMaker::CopyAndMakeClusters(), BEmcRec::CorrectEnergy(), Acts::deriveEnergyLossRadiativeQOverP(), Matter::DoEnergyLoss(), DrawCalibratedE_Plot(), dvcs_plot(), eic_sphenix_test_smearing(), ActsExamples::HepMC3Particle::energy(), EMCalCalib::eval_photon_proj(), EMCalAna::eval_trk_proj(), QAG4SimulationCalorimeterSum::eval_trk_proj(), MinimumBiasClassifier::FillMinimumBiasInfo(), Proto4ShowerCalib::find_energy(), Proto4SampleFrac::find_max(), Proto4ShowerCalib::find_max(), Proto2ShowerCalib::find_max(), Proto3ShowerCalib::find_max(), Proto4TowerCalib::find_max(), ExampleAnalysisModule::find_max(), SvtxHitEval::get_energy_contribution(), SvtxClusterEval::get_energy_contribution(), CaloRawClusterEval::get_energy_contribution(), CaloRawTowerEval::get_energy_contribution(), JetRecoEval::get_energy_contribution(), STACalorimeterCharacterization::get_ordered_clusters(), STACalorimeterCharacterization::get_ordered_towers(), TreeMaker::GetClusters(), EmcCluster::GetECore(), GetEvalHisto(), GetQAHisto(), SColdQcdCorrelatorAnalysis::SCorrelatorUtilities::GetSumFinalStateParEne(), KFParticleBase::Initialize(), KFParticleBaseSIMD::Initialize(), Jet_reso(), Jet_reso_Iso(), JetReso(), LineShapeCompare(), LineShapeCompare_Electron(), Load_CurveSet(), Load_SF(), JetRecoEval::max_truth_jet_by_energy(), plotQA_cosmic_TowerCalib(), printLine(), BbcCheck::process_emcal(), G4TowerNtuple::process_event(), TowerTiming::process_event(), PJTranslator::process_event(), pi0ClusterAna::process_event(), singlePhotonClusterAna::process_event(), caloTreeGen::process_event(), pythiaEMCalAna::process_event(), hcal_towerid::process_event(), PHFlowJetMaker::process_event(), towerid::process_event(), PHTpcCentralMembraneClusterizer::process_event(), QAG4SimulationCalorimeter::process_event_Tower(), EMCalAna::process_event_Tower(), EMCalCalib::process_event_Tower(), CaloWaveFormSim::process_g4hits(), BbcCheck::process_ihcal(), BbcCheck::process_ohcal(), HCalCalibTree::process_towers(), pi0EtaByEta::process_towers(), RawTowerv1::RawTowerv1(), ActsExamples::EDM4hepUtil::readSimHit(), RejectionCompare(), ThermalPartonSampler::sample_2p1d(), ThermalPartonSampler::sample_3p1d(), ThermalPartonSampler::samplebrick(), TowerInfov1::set_energy(), RawClusterv1::set_energy(), KFParticleBase::SetNonlinearMassConstraint(), KFParticleBaseSIMD::SetNonlinearMassConstraint(), RawTowerDigitizer::simple_photon_digitization(), and RawTowerDigitizer::sipm_photon_digitization().

energys = data(:,1)

Definition at line 49 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 49 of file Proto2ShowerCalibFit.m

FileID = {'Rot45','THP','UIUC18','UpTilt5', 'ShowerDepth'}

Definition at line 13 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 13 of file Proto2ShowerCalibFit.m

fileID = fopen([DataFolder 'ShowerCalibFit_CablibConst.dat'],'w')

Definition at line 256 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 256 of file Proto2ShowerCalibFit.m

Definition at line 15 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 15 of file Proto2ShowerCalibFit.m

Referenced by MergeFiles().

Fraction = DataSet(i).data ./ total_E

Definition at line 93 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 93 of file Proto2ShowerCalibFit.m

Save out for i
Initial value:
= 1:size(FileList,2)
FileList{i} = [DataFolder FileList{i} '.lst_EMCalCalib.root.dat']

Definition at line 26 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 26 of file Proto2ShowerCalibFit.m

InitConst = [ones(1, 64) ]

Definition at line 20 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 20 of file Proto2ShowerCalibFit.m

InitConst_RunScale = [InitConst ones(1, N_Runs)]

Definition at line 150 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 150 of file Proto2ShowerCalibFit.m

for j
Initial value:
=1:size(energy, 1)

Definition at line 55 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 55 of file Proto2ShowerCalibFit.m

low_tower_IDs =reshape( MeanFraction<0.004, 1, Ndata)

Definition at line 7 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 7 of file Proto2ShowerCalibFit.m

MeanFraction = mean(Fraction, 1)

Definition at line 94 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 94 of file Proto2ShowerCalibFit.m

N_Runs = size(RunList, 2)

Definition at line 34 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 34 of file Proto2ShowerCalibFit.m

Ndata = 64

Definition at line 5 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 5 of file Proto2ShowerCalibFit.m

colorbar New Old

Definition at line 216 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 216 of file Proto2ShowerCalibFit.m

Referenced by CompareOldVsNewPlots().

options = optimset('Display','iter','TolX',1, 'MaxFunEvals', 100000,'MaxIter',40000,'PlotFcns',@optimplotfval )

Definition at line 163 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 163 of file Proto2ShowerCalibFit.m

sim_const = 3/100

Definition at line 17 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 17 of file Proto2ShowerCalibFit.m

sim_stat = 12/100

Definition at line 18 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 18 of file Proto2ShowerCalibFit.m

SumFraction = []

Definition at line 88 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 88 of file Proto2ShowerCalibFit.m

total_E = sum( DataSet(N_Runs).data* InitConst', 2)

Definition at line 67 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 67 of file Proto2ShowerCalibFit.m

Definition at line 161 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 161 of file Proto2ShowerCalibFit.m

zero_sup = -1000

Definition at line 22 of file Proto2ShowerCalibFit.m.

View newest version in sPHENIX GitHub at line 22 of file Proto2ShowerCalibFit.m