From b3380821bc1a0a7db52404353ba9b5dd04a7f78c Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 12:10:17 -0700 Subject: [PATCH 01/71] add new processor for SimPart --- analysis/include/SimPartHistos.h | 43 +++++++++++ analysis/plotconfigs/mc/simPart.json | 19 +++++ analysis/src/SimPartHistos.cxx | 32 ++++++++ processors/config/simPartTuple_cfg.py | 63 +++++++++++++++ processors/include/SimPartProcessor.h | 107 ++++++++++++++++++++++++++ processors/src/SimPartProcessor.cxx | 84 ++++++++++++++++++++ 6 files changed, 348 insertions(+) create mode 100644 analysis/include/SimPartHistos.h create mode 100644 analysis/plotconfigs/mc/simPart.json create mode 100644 analysis/src/SimPartHistos.cxx create mode 100644 processors/config/simPartTuple_cfg.py create mode 100644 processors/include/SimPartProcessor.h create mode 100644 processors/src/SimPartProcessor.cxx diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h new file mode 100644 index 000000000..676928371 --- /dev/null +++ b/analysis/include/SimPartHistos.h @@ -0,0 +1,43 @@ +#ifndef SIMPARTHISTOS_H +#define SIMPARTHISTOS_H + +// ROOT +#include "TLorentzVector.h" + +// HPSTR +#include "HistoManager.h" +#include "MCParticle.h" +#include "MCTrackerHit.h" +#include "MCEcalHit.h" +#include +#include + +/** + * @brief description + * + * details + */ +class SimPartHistos : public HistoManager { + + public: + /** + * @brief Constructor + * + * @param inputName + */ + SimPartHistos(const std::string& inputName) : HistoManager(inputName) { m_name = inputName; }; + + /** + * @brief description + * + * @param MCParticles + * @param RecoTracks + * @param RecoTrackerClusters + * @param RecoEcalClusters + * @param weight + */ + void FillAcceptance(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight = 1.); + +}; + +#endif //SIMPARTHISTOS_H diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json new file mode 100644 index 000000000..18921de2d --- /dev/null +++ b/analysis/plotconfigs/mc/simPart.json @@ -0,0 +1,19 @@ +{ + "numMCparts_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Sim Particles", + "ytitle" : "Events" + }, + "ele_pxpz_pypz_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 500, + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "pos p_{x}", + "ytitle" : "pos p_{y}" + } +} diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx new file mode 100644 index 000000000..b3a2123fa --- /dev/null +++ b/analysis/src/SimPartHistos.cxx @@ -0,0 +1,32 @@ +#include "SimPartHistos.h" +#include + +void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight) { + int nParts = mcParts->size(); + Fill1DHisto("numMCparts_h", (float)nParts, weight); + + for (int i=0; iat(i); + int pdg = part->getPDG(); + int gen = part->getGenStatus(); + std::vector momentum_V = part->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + + if (gen != 1) + continue; + + if (pdg == -11) { + Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); + + + + } + + } +} + + + + diff --git a/processors/config/simPartTuple_cfg.py b/processors/config/simPartTuple_cfg.py new file mode 100644 index 000000000..769a125f2 --- /dev/null +++ b/processors/config/simPartTuple_cfg.py @@ -0,0 +1,63 @@ +import HpstrConf +import sys +import os +import baseConfig as base + + +base.parser.add_argument("-w", "--tracking", type=str, dest="tracking", + help="Which tracking to use to make plots", metavar="tracking", default="KF") +options = base.parser.parse_args() + + +print(options) + +# Use the input file to set the output file name +infile = options.inFilename +outfile = options.outFilename + +analysis = options.analysis + + +print('Input file: %s' % infile) +print('Output file: %s' % outfile) +print('Analysis : %s' % analysis) + +p = HpstrConf.Process() + +p.run_mode = 1 +p.skip_events = options.skip_events +p.max_events = options.nevents + +#p.max_events = 1000 + +# Library containing processors +p.add_library("libprocessors") + +############################### +# Processors # +############################### + +sim_part_ana = HpstrConf.Processor('sim_part', 'SimPartProcessor') + +############################### +# Processor Configuration # +############################### +#RecoHitAna +sim_part_ana.parameters["debug"] = 0 +sim_part_ana.parameters["anaName"] = "sim_part" +sim_part_ana.parameters["MCParticleColl"] = "MCParticle" +sim_part_ana.parameters["MCTrackerHitColl"] = "TrackerSimHits" +sim_part_ana.parameters["MCEcalHitColl"] = "EcalSimHits" +sim_part_ana.parameters["RecoTrackColl"] = "KalmanFullTracks" +sim_part_ana.parameters["RecoTrackerClusterColl"] = "SiClustersOnTrack" +sim_part_ana.parameters["RecoEcalClusterColl"] = "RecoEcalClusters" +sim_part_ana.parameters["analysis"] = analysis +sim_part_ana.parameters["histCfg"] = os.environ['HPSTR_BASE']+'/analysis/plotconfigs/mc/simPart.json' + +# Sequence which the processors will run. +p.sequence = [sim_part_ana] + +p.input_files = infile +p.output_files = [outfile] + +p.printProcess() diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h new file mode 100644 index 000000000..e2699a102 --- /dev/null +++ b/processors/include/SimPartProcessor.h @@ -0,0 +1,107 @@ +#ifndef __SIM_PARTPROCESSOR_H__ +#define __SIM_PARTPROCESSOR_H__ + +//HPSTR +#include "HpsEvent.h" +#include "Collections.h" +#include "MCParticle.h" +#include "MCTrackerHit.h" +#include "MCEcalHit.h" +#include "SimPartHistos.h" +#include "Track.h" +#include "TrackerHit.h" +#include "CalCluster.h" + +//ROOT +#include "Processor.h" +#include "TClonesArray.h" +#include "TBranch.h" +#include "TTree.h" +#include "TFile.h" + +class TTree; + +/** + * @brief Insert description here. + * more details + */ +class SimPartProcessor : public Processor { + + public: + /** + * @brief Constructor + * + * @param name + * @param process + */ + SimPartProcessor(const std::string& name, Process& process); + + ~SimPartProcessor(); + + /** + * @brief description + * + * @param ievent + * @return true + * @return false + */ + virtual bool process(IEvent* ievent); + + /** + * @brief description + * + * @param tree + */ + virtual void initialize(TTree* tree); + + /** + * @brief description + * + */ + virtual void finalize(); + + /** + * @brief description + * + * @param parameters + */ + virtual void configure(const ParameterSet& parameters); + + private: + + /** Containers to hold histogrammer info */ + SimPartHistos* histos{nullptr}; + std::string histCfgFilename_; //!< description + + /** \todo Change this to be held from HPSEvent */ + TTree* tree_; + TBranch* bMCParticles_{nullptr}; //!< description + TBranch* bMCTrackerHits_{nullptr}; //!< description + TBranch* bMCECalHits_{nullptr}; //!< description + TBranch* bRecoTracks_{nullptr}; //!< description + TBranch* bRecoTrackerClusters_{nullptr}; //!< description + TBranch* bRecoEcalClusters_{nullptr}; //!< description + + std::vector * MCParticles_{nullptr}; //!< description + std::vector * MCTrackerHits_{nullptr}; //!< description + std::vector * MCECalHits_{nullptr}; //!< description + std::vector * RecoTracks_{nullptr}; //!< description + std::vector * RecoTrackerClusters_{nullptr}; //!< description + std::vector * RecoEcalClusters_{nullptr}; //!< description + + std::string anaName_{"SimPartAna"}; //!< description + std::string MCParticleColl_{"MCParticle"}; //!< description + std::string MCTrackerHitColl_{"TrackerHits"}; //!< description + std::string MCEcalHitColl_{"EcalHits"}; //!< description + std::string RecoTrackColl_{"KalmanFullTracks"}; //!< description + std::string RecoTrackerClusterColl_{"SiClustersOnTrack"}; //!< description + std::string RecoEcalClusterColl_{"RecoEcalClusters"}; //!< description + + std::string analysis_{"sim_part"}; //!< description + + int debug_{0}; //!< Debug Level + +}; + + +#endif diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx new file mode 100644 index 000000000..0bb7ac2ec --- /dev/null +++ b/processors/src/SimPartProcessor.cxx @@ -0,0 +1,84 @@ +/** + * @file SimPartProcessor.cxx + * @brief SimPartProcessor used fill histograms to check acceptance of simulated particle source + * @author Abhisek Datta, University of California, Los Angeles + */ +#include "SimPartProcessor.h" +#include + +SimPartProcessor::SimPartProcessor(const std::string& name, Process& process) : Processor(name,process){} +//TODO CHECK THIS DESTRUCTOR +SimPartProcessor::~SimPartProcessor(){} + + +void SimPartProcessor::configure(const ParameterSet& parameters) { + std::cout << "Configuring SimPartProcessor" << std::endl; + try + { + debug_ = parameters.getInteger("debug"); + anaName_ = parameters.getString("anaName"); + MCParticleColl_ = parameters.getString("MCParticleColl"); + MCTrackerHitColl_ = parameters.getString("MCTrackerHitColl"); + MCEcalHitColl_ = parameters.getString("MCEcalHitColl"); + RecoTrackColl_ = parameters.getString("RecoTrackColl") + RecoTrackerClusterColl_ = parameters.getString("RecoTrackerClusterColl") + RecoEcalClusterColl_ = parameters.getString("RecoEcalClusterColl") + histCfgFilename_ = parameters.getString("histCfg"); + analysis_ = parameters.getString("analysis"); + } + catch (std::runtime_error& error) + { + std::cout << error.what() << std::endl; + } +} + +void SimPartProcessor::initialize(TTree* tree) { + tree_= tree; + // init histos + histos = new SimPartHistos(anaName_); + histos->loadHistoConfig(histCfgFilename_); + histos->DefineHistos(); + + // init TTree + tree_->SetBranchAddress(MCParticleColl_.c_str(), &MCParticles_, &bMCParticles_); + + if (tree_->FindBranch(MCTrackerHitColl_.c_str())) + tree_->SetBranchAddress(MCTrackerHitColl_.c_str(), &MCTrackerHits_, &bMCTrackerHits_); + else + std::cout<<"WARNING: No MC tracker hit collection"<FindBranch(MCEcalHitColl_.c_str())) + tree_->SetBranchAddress(MCEcalHitColl_.c_str(), &MCECalHits_, &bMCECalHits_); + else + std::cout<<"WARNING: No MC Ecal hit collection"<FindBranch(RecoTrackColl_.c_str())) + tree_->SetBranchAddress(RecoTrackColl_.c_str(), &RecoTracks_, &bRecoTracks_); + else + std::cout<<"WARNING: No Reco track collection"<FindBranch(RecoTrackerClusterColl_.c_str())) + tree_->SetBranchAddress(RecoTrackerClusterColl_.c_str(), &RecoTrackerClusters_, &bRecoTrackerClusters_); + else + std::cout<<"WARNING: No Reco tracker hit collection"<FindBranch(RecoEcalClusterColl_.c_str())) + tree_->SetBranchAddress(RecoEcalClusterColl_.c_str(), &RecoEcalClusters_, &bRecoEcalClusters_); + else + std::cout<<"WARNING: No Reco Ecal hit collection"<FillAcceptance(MCParticles_, RecoTracks_, RecoTrackerClusters_, RecoTrackerClusters_) + + return true; +} + +void SimPartProcessor::finalize() { + + histos->saveHistos(outF_, anaName_); + delete histos; + histos = nullptr; +} + +DECLARE_PROCESSOR(SimPartProcessor); From e3e9e414a3d1ab2abca30d298cd91b31ca8e8528 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 14:13:06 -0700 Subject: [PATCH 02/71] minor fixes, name change of config file --- analysis/include/SimPartHistos.h | 3 + analysis/plotconfigs/mc/simPart.json | 11 ++- analysis/src/SimPartHistos.cxx | 3 +- processors/config/simPartAna_cfg.py | 63 ++++++++++++ processors/config/simPartTuple_cfg.py | 137 +++++++++++++++++++------- processors/src/SimPartProcessor.cxx | 8 +- 6 files changed, 181 insertions(+), 44 deletions(-) create mode 100644 processors/config/simPartAna_cfg.py diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h index 676928371..f9946c222 100644 --- a/analysis/include/SimPartHistos.h +++ b/analysis/include/SimPartHistos.h @@ -9,6 +9,9 @@ #include "MCParticle.h" #include "MCTrackerHit.h" #include "MCEcalHit.h" +#include "Track.h" +#include "TrackerHit.h" +#include "CalCluster.h" #include #include diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 18921de2d..4466903c5 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -6,6 +6,13 @@ "xtitle" : "Number of Sim Particles", "ytitle" : "Events" }, + "particle_pdgid_h" : { + "bins" : 100, + "minX" : 50, + "maxX" : 55, + "xtitle" : "PDG ID of Sim Particles", + "ytitle" : "Events" + }, "ele_pxpz_pypz_hh" : { "binsX" : 2000, "minX" : -0.8, @@ -13,7 +20,7 @@ "binsY" : 500, "minY" : -0.2, "maxY" : 0.2, - "xtitle" : "pos p_{x}", - "ytitle" : "pos p_{y}" + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" } } diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index b3a2123fa..e007bc4b4 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -17,7 +17,8 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: if (gen != 1) continue; - if (pdg == -11) { + Fill1DHisto("particle_pdgid_h", pdg, weight); + if (pdg == 11) { Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py new file mode 100644 index 000000000..769a125f2 --- /dev/null +++ b/processors/config/simPartAna_cfg.py @@ -0,0 +1,63 @@ +import HpstrConf +import sys +import os +import baseConfig as base + + +base.parser.add_argument("-w", "--tracking", type=str, dest="tracking", + help="Which tracking to use to make plots", metavar="tracking", default="KF") +options = base.parser.parse_args() + + +print(options) + +# Use the input file to set the output file name +infile = options.inFilename +outfile = options.outFilename + +analysis = options.analysis + + +print('Input file: %s' % infile) +print('Output file: %s' % outfile) +print('Analysis : %s' % analysis) + +p = HpstrConf.Process() + +p.run_mode = 1 +p.skip_events = options.skip_events +p.max_events = options.nevents + +#p.max_events = 1000 + +# Library containing processors +p.add_library("libprocessors") + +############################### +# Processors # +############################### + +sim_part_ana = HpstrConf.Processor('sim_part', 'SimPartProcessor') + +############################### +# Processor Configuration # +############################### +#RecoHitAna +sim_part_ana.parameters["debug"] = 0 +sim_part_ana.parameters["anaName"] = "sim_part" +sim_part_ana.parameters["MCParticleColl"] = "MCParticle" +sim_part_ana.parameters["MCTrackerHitColl"] = "TrackerSimHits" +sim_part_ana.parameters["MCEcalHitColl"] = "EcalSimHits" +sim_part_ana.parameters["RecoTrackColl"] = "KalmanFullTracks" +sim_part_ana.parameters["RecoTrackerClusterColl"] = "SiClustersOnTrack" +sim_part_ana.parameters["RecoEcalClusterColl"] = "RecoEcalClusters" +sim_part_ana.parameters["analysis"] = analysis +sim_part_ana.parameters["histCfg"] = os.environ['HPSTR_BASE']+'/analysis/plotconfigs/mc/simPart.json' + +# Sequence which the processors will run. +p.sequence = [sim_part_ana] + +p.input_files = infile +p.output_files = [outfile] + +p.printProcess() diff --git a/processors/config/simPartTuple_cfg.py b/processors/config/simPartTuple_cfg.py index 769a125f2..05e87a646 100644 --- a/processors/config/simPartTuple_cfg.py +++ b/processors/config/simPartTuple_cfg.py @@ -1,63 +1,126 @@ import HpstrConf import sys -import os -import baseConfig as base +import baseConfig as base +from baseConfig import bfield -base.parser.add_argument("-w", "--tracking", type=str, dest="tracking", - help="Which tracking to use to make plots", metavar="tracking", default="KF") options = base.parser.parse_args() - -print(options) - # Use the input file to set the output file name -infile = options.inFilename -outfile = options.outFilename +lcio_file = options.inFilename +root_file = options.outFilename -analysis = options.analysis - - -print('Input file: %s' % infile) -print('Output file: %s' % outfile) -print('Analysis : %s' % analysis) +print('LCIO file: %s' % lcio_file) +print('Root file: %s' % root_file) p = HpstrConf.Process() -p.run_mode = 1 +# p.max_events = 1000 +p.run_mode = 0 p.skip_events = options.skip_events p.max_events = options.nevents -#p.max_events = 1000 - # Library containing processors p.add_library("libprocessors") ############################### # Processors # ############################### - -sim_part_ana = HpstrConf.Processor('sim_part', 'SimPartProcessor') +header = HpstrConf.Processor('header', 'EventProcessor') +track = HpstrConf.Processor('track', 'TrackingProcessor') +svthits = HpstrConf.Processor('svthits', 'Tracker2DHitProcessor') +rawsvt = HpstrConf.Processor('rawsvt', 'SvtRawDataProcessor') +mcthits = HpstrConf.Processor('mcthits', 'MCTrackerHitProcessor') +mcehits = HpstrConf.Processor('mcehits', 'MCEcalHitProcessor') +ecal = HpstrConf.Processor('ecal', 'ECalDataProcessor') +fsp = HpstrConf.Processor('fps', 'FinalStateParticleProcessor') +mcpart = HpstrConf.Processor('mcpart', 'MCParticleProcessor') ############################### # Processor Configuration # ############################### -#RecoHitAna -sim_part_ana.parameters["debug"] = 0 -sim_part_ana.parameters["anaName"] = "sim_part" -sim_part_ana.parameters["MCParticleColl"] = "MCParticle" -sim_part_ana.parameters["MCTrackerHitColl"] = "TrackerSimHits" -sim_part_ana.parameters["MCEcalHitColl"] = "EcalSimHits" -sim_part_ana.parameters["RecoTrackColl"] = "KalmanFullTracks" -sim_part_ana.parameters["RecoTrackerClusterColl"] = "SiClustersOnTrack" -sim_part_ana.parameters["RecoEcalClusterColl"] = "RecoEcalClusters" -sim_part_ana.parameters["analysis"] = analysis -sim_part_ana.parameters["histCfg"] = os.environ['HPSTR_BASE']+'/analysis/plotconfigs/mc/simPart.json' - -# Sequence which the processors will run. -p.sequence = [sim_part_ana] - -p.input_files = infile -p.output_files = [outfile] +# Event +header.parameters["debug"] = 0 +header.parameters["headCollRoot"] = "EventHeader" +header.parameters["trigCollLcio"] = "TriggerBank" +header.parameters["rfCollLcio"] = "RFHits" +header.parameters["vtpCollLcio"] = "VTPBank" +header.parameters["vtpCollRoot"] = "VTPBank" +header.parameters["tsCollLcio"] = "TSBank" +header.parameters["tsCollRoot"] = "TSBank" + +# SvtRawData +rawsvt.parameters["debug"] = 0 +rawsvt.parameters["hitCollLcio"] = 'SVTRawTrackerHits' +rawsvt.parameters["hitfitCollLcio"] = 'SVTFittedRawTrackerHits' +rawsvt.parameters["hitCollRoot"] = 'SVTRawTrackerHits' + +# Tracker2DHits +svthits.parameters["debug"] = 0 +svthits.parameters["hitCollLcio"] = 'StripClusterer_SiTrackerHitStrip1D' +svthits.parameters["hitCollRoot"] = 'SiClusters' +svthits.parameters["mcPartRelLcio"] = 'SVTTrueHitRelations' + +# Tracking +track.parameters["debug"] = 0 +track.parameters["trkCollLcio"] = 'KalmanFullTracks' +track.parameters["trkCollRoot"] = 'KalmanFullTracks' +track.parameters["kinkRelCollLcio"] = '' +track.parameters["trkRelCollLcio"] = 'KFTrackDataRelations' +track.parameters["trkhitCollRoot"] = 'SiClustersOnTrack' +track.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits' + +# Only for detail studies +# LT uncomment +track.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack_KF' + +# LT uncommented +# if (not options.isData): +# track.parameters["truthTrackCollLcio"] = 'KalmanFullTracksToTruthTrackRelations' +# track.parameters["truthTrackCollRoot"] = 'Truth_KFTracks' + +# LT check if we need the b field or not -- version of HPS java +# for Jess's files need to give it b-field + +track.parameters["bfield"] = bfield[str(options.year)] + +# ECalData +ecal.parameters["debug"] = 0 +ecal.parameters["hitCollLcio"] = 'EcalCalHits' +ecal.parameters["hitCollRoot"] = 'RecoEcalHits' +ecal.parameters["clusCollLcio"] = "EcalClustersCorr" +ecal.parameters["clusCollRoot"] = "RecoEcalClusters" + +#MCTrackerHits +mcthits.parameters["debug"] = 0 +mcthits.parameters["hitCollLcio"] = 'TrackerHits' +mcthits.parameters["hitCollRoot"] = 'TrackerSimHits' + +#MCEcalHits +mcehits.parameters["debug"] = 0 +mcehits.parameters["hitCollLcio"] = 'EcalHits' +mcehits.parameters["hitCollRoot"] = 'EcalSimHits' + +#FinalStateParticleProcessor +fsp.parameters["debug"] = 0 +fsp.parameters["fspCollLcio"] = "FinalStateParticles_KF" +fsp.parameters["fspCollRoot"] = "FinalStateParticles_KF" +fsp.parameters["kinkRelCollLcio"] = "" +fsp.parameters["trkRelCollLcio"] = "KFTrackDataRelations" +fsp.parameters["trkhitCollRoot"] = "fspOnTrackHits" +fsp.parameters["rawhitCollRoot"] = "fspOnTrackRawHits" +fsp.parameters["hitFitsCollLcio"] = "SVTFittedRawTrackerHits" + +# MCParticle +mcpart.parameters["debug"] = 0 +mcpart.parameters["mcPartCollLcio"] = 'MCParticle' +mcpart.parameters["mcPartCollRoot"] = 'MCParticle' + +sequence = [header, ecal, track, svthits, rawsvt, mcthits, mcehits, mcpart] + +p.sequence = sequence + +p.input_files = lcio_file +p.output_files = [root_file] p.printProcess() diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 0bb7ac2ec..d25ee7347 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -20,9 +20,9 @@ void SimPartProcessor::configure(const ParameterSet& parameters) { MCParticleColl_ = parameters.getString("MCParticleColl"); MCTrackerHitColl_ = parameters.getString("MCTrackerHitColl"); MCEcalHitColl_ = parameters.getString("MCEcalHitColl"); - RecoTrackColl_ = parameters.getString("RecoTrackColl") - RecoTrackerClusterColl_ = parameters.getString("RecoTrackerClusterColl") - RecoEcalClusterColl_ = parameters.getString("RecoEcalClusterColl") + RecoTrackColl_ = parameters.getString("RecoTrackColl"); + RecoTrackerClusterColl_ = parameters.getString("RecoTrackerClusterColl"); + RecoEcalClusterColl_ = parameters.getString("RecoEcalClusterColl"); histCfgFilename_ = parameters.getString("histCfg"); analysis_ = parameters.getString("analysis"); } @@ -69,7 +69,7 @@ void SimPartProcessor::initialize(TTree* tree) { bool SimPartProcessor::process(IEvent* ievent) { - histos->FillAcceptance(MCParticles_, RecoTracks_, RecoTrackerClusters_, RecoTrackerClusters_) + histos->FillAcceptance(MCParticles_, RecoTracks_, RecoTrackerClusters_, RecoEcalClusters_); return true; } From ee9da59815aeca070c25480a7afb5c0f63aeb26b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 14:20:53 -0700 Subject: [PATCH 03/71] bug fix --- analysis/src/SimPartHistos.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index e007bc4b4..f15a8c4bd 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -2,11 +2,11 @@ #include void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight) { - int nParts = mcParts->size(); + int nParts = MCParticles_->size(); Fill1DHisto("numMCparts_h", (float)nParts, weight); for (int i=0; iat(i); + MCParticle *part = MCParticles_->at(i); int pdg = part->getPDG(); int gen = part->getGenStatus(); std::vector momentum_V = part->getMomentum(); From 1da12ba1c59291ccb33710123066b307f66faa50 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 20:20:26 -0700 Subject: [PATCH 04/71] typo fix --- analysis/plotconfigs/mc/simPart.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 4466903c5..e9630c282 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -8,8 +8,8 @@ }, "particle_pdgid_h" : { "bins" : 100, - "minX" : 50, - "maxX" : 55, + "minX" : -50, + "maxX" : 50, "xtitle" : "PDG ID of Sim Particles", "ytitle" : "Events" }, From 158ce37b0d78da8c5ab80c044e2b02ec81543ee1 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 21:40:18 -0700 Subject: [PATCH 05/71] add more acceptance histograms --- analysis/plotconfigs/mc/simPart.json | 140 +++++++++++++++++++++++++++ analysis/src/SimPartHistos.cxx | 53 +++++++++- 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index e9630c282..9de56244c 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -22,5 +22,145 @@ "maxY" : 0.2, "xtitle" : "ele p_{x}/p_{z}", "ytitle" : "ele p_{y}/p_{z}" + }, + "ele_pxpz_pypz_noTrack_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 500, + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" + }, + "ele_pxpz_pypz_Track_noECal_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 500, + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" + }, + "ele_pxpz_pypz_noEcal_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 500, + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" + }, + "ele_pxpz_pypz_noTrack_ECal_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 500, + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" + }, + "track_phi0_tanlambda_minhits7_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits8_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits9_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits10_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits11_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits12_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits13_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "track_phi0_tanlambda_minhits14_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track tan#{lambda}}" + }, + "ecal_x_y_hh" : { + "binsX" : 2000, + "minX" : -340, + "maxX" : 420, + "binsY" : 500, + "minY" : -100, + "maxY" : 100, + "xtitle" : "Ecal cluster x", + "ytitle" : "Ecal cluster y" + }, + "ecal_x_y_noTrack_hh" : { + "binsX" : 2000, + "minX" : -340, + "maxX" : 420, + "binsY" : 500, + "minY" : -100, + "maxY" : 100, + "xtitle" : "Ecal cluster x", + "ytitle" : "Ecal cluster y" } } diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index f15a8c4bd..d85c9bda6 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -5,6 +5,9 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: int nParts = MCParticles_->size(); Fill1DHisto("numMCparts_h", (float)nParts, weight); + int nTracks = RecoTracks_->size(); + int nEcal_clusters = RecoEcalClusters_->size(); + for (int i=0; iat(i); int pdg = part->getPDG(); @@ -20,12 +23,60 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: Fill1DHisto("particle_pdgid_h", pdg, weight); if (pdg == 11) { Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); + if (nTracks == 0){ + Fill2DHisto("ele_pxpz_pypz_noTrack_hh", px/pz, py/pz, weight); + if (nEcal_clusters != 0) + Fill2DHisto("ele_pxpz_pypz_noTrack_ECal_hh", px/pz, py/pz, weight); + } + if (nEcal_clusters == 0){ + Fill2DHisto("ele_pxpz_pypz_noEcal_hh", px/pz, py/pz, weight); + if (nTracks != 0) + Fill2DHisto("ele_pxpz_pypz_Track_noECal_hh", px/pz, py/pz, weight); + } + } + } + for (int i=0; iat(i); + bool isTop = (track->getTanLambda() > 0.0); + bool isPos = (track->getOmega() < 0.0); + bool isKF = track->isKalmanTrack(); + int trkType = (int)isTop*2 + (int)isPos; + //int n2dhits_onTrack = !isKF ? track->getTrackerHitCount() * 2 : track->getTrackerHitCount(); + int n_hits = track->getTrackerHitCount(); + double phi0 = track->getPhi(); + double tan_lambda = track->getTanLambda(); + if (n_hits >= 7): + Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); + elif (n_hits >= 8): + Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); + elif (n_hits >= 9): + Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); + elif (n_hits >= 10): + Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); + elif (n_hits >= 11): + Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); + elif (n_hits >= 12): + Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); + elif (n_hits >= 13): + Fill2DHisto("track_phi0_tanlambda_minhits13_hh", phi0, tan_lambda, weight); + elif (n_hits >= 14): + Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); - } + } + + for (int i=0; iat(i); + std::vector position_V = ecal_cluster->getPosition(); + double cluster_x = position_V.at(0); + double cluster_y = position_V.at(1); + Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); + if (nTracks == 0) + Fill2DHisto("ecal_x_y_noTrack_hh", cluster_x, cluster_y, weight); } + } From 52354c0eda1514a29250c7920197d44407886b2d Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 21:45:19 -0700 Subject: [PATCH 06/71] bug fix --- analysis/src/SimPartHistos.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index d85c9bda6..a05af7800 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -47,21 +47,21 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: double phi0 = track->getPhi(); double tan_lambda = track->getTanLambda(); - if (n_hits >= 7): + if (n_hits >= 7) Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); - elif (n_hits >= 8): + else if (n_hits >= 8) Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); - elif (n_hits >= 9): + else if (n_hits >= 9) Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); - elif (n_hits >= 10): + else if (n_hits >= 10) Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); - elif (n_hits >= 11): + else if (n_hits >= 11) Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); - elif (n_hits >= 12): + else if (n_hits >= 12) Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); - elif (n_hits >= 13): + else if (n_hits >= 13) Fill2DHisto("track_phi0_tanlambda_minhits13_hh", phi0, tan_lambda, weight); - elif (n_hits >= 14): + else if (n_hits >= 14) Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); } From 6862fa78971e35649258ceb7bcabb40552b7b838 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 30 Sep 2023 22:05:13 -0700 Subject: [PATCH 07/71] bug fix --- analysis/src/SimPartHistos.cxx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index a05af7800..2552f76a4 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -47,22 +47,22 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: double phi0 = track->getPhi(); double tan_lambda = track->getTanLambda(); - if (n_hits >= 7) - Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); - else if (n_hits >= 8) - Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); - else if (n_hits >= 9) - Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); - else if (n_hits >= 10) - Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); - else if (n_hits >= 11) - Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); - else if (n_hits >= 12) - Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); + if (n_hits >= 14) + Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); else if (n_hits >= 13) Fill2DHisto("track_phi0_tanlambda_minhits13_hh", phi0, tan_lambda, weight); - else if (n_hits >= 14) - Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); + else if (n_hits >= 12) + Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); + else if (n_hits >= 11) + Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); + else if (n_hits >= 10) + Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); + else if (n_hits >= 9) + Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); + else if (n_hits >= 8) + Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); + else if (n_hits >= 7) + Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); } From d66e524db8c3383de7c7ac09b7ea8b812d63dfe8 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 19 Oct 2023 12:06:24 -0700 Subject: [PATCH 08/71] add plots of number of tracks, hits and clusters --- .DS_Store | Bin 0 -> 6148 bytes analysis/.DS_Store | Bin 0 -> 6148 bytes analysis/include/SimPartHistos.h | 3 ++- analysis/plotconfigs/.DS_Store | Bin 0 -> 6148 bytes analysis/plotconfigs/mc/simPart.json | 35 +++++++++++++++++++++++++++ analysis/src/SimPartHistos.cxx | 18 ++++++++++++++ processors/.DS_Store | Bin 0 -> 10244 bytes processors/src/SimPartProcessor.cxx | 1 + 8 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 analysis/.DS_Store create mode 100644 analysis/plotconfigs/.DS_Store create mode 100644 processors/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..89d290fdce73fdc5adf8a962ad7f99597e306c1e GIT binary patch literal 6148 zcmeHK!AiqG5S?wSZY)9%Djow~3${?D;w9Aj14i_qQWH}&7_%j54N?j@>JRxTevdP| zTd}5k6tz1r`(}4$66R&u%>V%FjDjXW4FEVQVadW_j*y?UASJz0L1gk7kB~wLsh_2T zLbO@N1@j+dO% z>_mvjpW2>(8uqhZZT(QhLobZ`iA)HCK89SJg>fLVju^#3Dsx@s;Fe|eYMbM6qi(m` zle#@_w)XeXZtYGc7T?(3IXLd!Mfb6IQdBbBbyC(ePT?7iLRAlL5=SDwK_BIGn8wTinuu%yejk!X3 zbl@Oc07UwYl!7+(5|m?WbTsA)(SyQNDxykdy2W5B9oKCg=V;6os&rtw`C$6ZOm`?u zz8#-$%WzV!Z literal 0 HcmV?d00001 diff --git a/analysis/.DS_Store b/analysis/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f513b600bad9192dfd751dfb3f03890e2fa641af GIT binary patch literal 6148 zcmeHK%}T>S5T3QMO)NqVDjow~3${?D;w8lT0!H+pQj;duV9b^#F^5vfQD4YM@p+v6 zDcIIrMe7dCev|o0n2+vm2LOnZ2OR(t0CZG_+7>R~2#YgakqzmoBNG0O90CaaA|3nj zO15$+1{4FojRCfI8xTPPLx|za{-r)f-u-bLrCGcEK{jgIX1$^7dQ-o1A8FxcUY4hh zH@RU?mz2i--1hvdC@co%&KXTIFG|7*FNlH=Q*N)LB%p;u^CU=ltt$e$VHg8*Z#r$a ztX^-{vZkHx$uZj9quI>RcMlFvF9uKXb3$JQi3HCaF5434@P@`xPcQByiD@#z2&-zs z7`vsAVb>IUe?SICkcyM*k9S_t+Y$pcNMQoQwdh#(vee=H*PyV90l9zlW>tdnD+Uw; z|CRxEK3J#>ZHc8oesti%M*u_(-CWRSvjnTLB-#>7ffzv{q7+e-5;fgfey E6Cz8 *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight = 1.); - + void FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight = 1.); + }; #endif //SIMPARTHISTOS_H diff --git a/analysis/plotconfigs/.DS_Store b/analysis/plotconfigs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d6b8c6fb2ee2ec0d0801141868ec860ffbfeed03 GIT binary patch literal 6148 zcmeH~K}*9h6vvZoYRV9LQ1KY>I&gz26ECICFJMIvDzmjii(MmYXAfi0qkbVjil4{# zl2n}TEFv$E{9p3kOPU{SNf=|?pT#}KT*jDyiptSgQE+&rt6_stInEKKDgyg0dP)=P z`|E<=-e41U7nS+b*YD4ZZugxxnyt0<4IxBZ+yoD*42rOr<$gH5!rr-3X;j-`bdik9 zk-K%GvLZ~f@l+=y@fbp`FOw`*rLSgLoa@}cIE3RkBX?&$?{?&1u;|EnuYYt1cK=|p zaK!fB{_)x9F`Z=U#h~OsT9-|$wY-9%ck&!evs7jG(63|b7*ZlY1c(3;AOfGKgJ=^B zB0vO)z&8STdz4U7J*$;beX)cFug~ajp<)3W-x8?Os%Nz_3LYrjq=K4MZl4(3q{Fzh zah}!6s7YsBuMG3pmFvd~*Q>+0)ZvVKMyVwNL|~af({x=t|4-p3v+|L@oI*V!Km`67 z0p1!0LmxI}&(?ufW34HfDZnT>}sd+OSB=*vsxL&S#VsZgVIGn L1EGcp`~rawcF#y6 literal 0 HcmV?d00001 diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 9de56244c..58a2a5ce9 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -13,6 +13,41 @@ "xtitle" : "PDG ID of Sim Particles", "ytitle" : "Events" }, + "numRecoTracks_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Reco Tracks", + "ytitle" : "Events" + }, + "numSimTrackerHits_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Sim Tracker Hits", + "ytitle" : "Events" + }, + "numRecoTrackerHits_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Reco Tracker Hits", + "ytitle" : "Events" + }, + "numSimEcalHits_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Sim Ecal Hits", + "ytitle" : "Events" + }, + "numRecoEcalHits_h" : { + "bins" : 60, + "minX" : -0.5, + "maxX" : 59.5, + "xtitle" : "Number of Reco Ecal Hits", + "ytitle" : "Events" + }, "ele_pxpz_pypz_hh" : { "binsX" : 2000, "minX" : -0.8, diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 2552f76a4..269582b24 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -6,6 +6,7 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: Fill1DHisto("numMCparts_h", (float)nParts, weight); int nTracks = RecoTracks_->size(); + int nTracker_clusters = RecoTrackerClusters_->size(); int nEcal_clusters = RecoEcalClusters_->size(); for (int i=0; i *MCParticles_, std:: } +void SimPartHistos::FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight){ + + int nSim_Tracker_hits = MCTrackerHit->size(); + int nSim_Ecal_hits = MCEcalHits_->size(); + int nReco_Tracks = RecoTracks_->size(); + int nReco_Tracker_clusters = RecoTrackerClusters_->size(); + int nReco_Ecal_clusters = RecoEcalClusters_->size(); + + Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); + Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); + Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); + Fill1DHisto("numRecoTrackerHits_h", (float)nReco_Tracker_clusters, weight); + Fill1DHisto("numRecoEcalHits_h", (float)nReco_Ecal_clusters, weight); + +} + + diff --git a/processors/.DS_Store b/processors/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..763d2417e4c54df00261035f352801c1237155ac GIT binary patch literal 10244 zcmeHMU2GIp6h3FRw0DLA(?SclS-Ma#2n7~e{z0~XAX=o*|MIi!?hNh7bf)ag?gF)@ zPXr?d6O|Z$9@U_R2NQ`VKBx~qp@{?$CGkaLj4x_p;)@TSJ9oB$1s=s}?oH;Nd(XY+ z-Z|g>&Q9)G0Km4qu^u1}0E`|k^=hi_QTRB2?kY;C;e$x_02Yj7ir#p}b~AU)mI{f0 zL_i`S5s(N-1ZDyP^v&jl%@$JD5&?;TL|_^L{`(N8hs$Irr-TfCI;aY+03<6&9TaNQ zJs_}&hcX$;DIo(>T2tH}Ff_&Rih;tM#^ZcC$z&*}gcRn0!W=N%8N(Y22D_78JeUrc z6jIg_0g1rf2=K6}ge4ozC=IW-+BNXm=eyZ8>HxFt7}hrW_uy9K$WPxp~L%0^1%jz*JRD>Gcy6 ziKh6LEt5_0iS;d8H&MG~KfN=KbSgUk2&r+;RJ?11Td$}sb|YQvb{pP$Vf!0 zN*>)Td8BHyqx}Qg(4dudogV9qnbPNZgwg{ zy4bRZS0^@Z+tu;dz600i%$=uewc3J#g5_Bm+w3b^hCe!#_Ohm9SkA~WVdnVOam&o9 zHIWNyuah1#uj};-7cG7$8ZDn)T4gYwu}VIaV22HQ$$hTDS2Ti= zXhU=bV~4oDJ!eua)Y{7EDpgOjUXNTBORUk>sk*23o}hyjrW>>trW zGW`j4pddUK${pIHtOlFZ!K^zrM*et0-5PCY`lswD-@7aA`TNIBhqmY5bv8t!LtNi# z7^Xo^EUI6qM<0)NG5s1F_D0h=bAOQtSJHPg791z(`AVIJ<-5~^y?ju&oPtGMrsEKl zW{t^};#2}qRh@sB7Q-@VfgR8dLtsD=&cn-a5#EH$a0Nbw&*3Y$24BMsxCKALFYpKa zg|n~<8LC)|^RW)=u@Rea4X(v)*p3~z8~0!r_F+E`;t(Fi5gf&*@C2U3GdO{h_za%K z3-|)Qh%ezA_!hp6m+&3@2tUKC_yvB6-{4LB4sYR4_$&T~zbg@?TA8EFRhBBtl+{W? zp~N09N-0E!MZZ)l&D6Rh=qW_Pq@8l~ULg|Oy+>>QS3~66Y916dweuI$Eoof2X2YiK z$!XpQrj^KbJ81)+-ofsGr@_&d6HG*p7V9G-o2Tvy31Ek zw~}Zsx{s`i#dL+DOLW(+i)ngZn^#d6!_MX{nx6L(=Nwh=qK z@JZ~(19%V*;So&XF-#LTZ5%@fi+Gy&`7|-~ES|&X@H{?`7x5K*6<@>G1E#(!I5y3^ zy(P{GiSLy&uh5foY}XkfJ!fkbeS#eN9NCbkNHcFsCjWOoMrA&gc^m-`a*+LBcpCar z=Ak%xSxW>Y0uljFillAcceptance(MCParticles_, RecoTracks_, RecoTrackerClusters_, RecoEcalClusters_); + histos->FillEfficiency(MCParticles_, RecoTracks_, MCTrackerHits_, MCECalHits_, RecoTrackerClusters_, RecoEcalClusters_); return true; } From 5ad2702951352959292bf886315e746df8fa86e8 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 19 Oct 2023 12:08:45 -0700 Subject: [PATCH 09/71] remove .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 3 +++ analysis/.DS_Store | Bin 6148 -> 0 bytes analysis/plotconfigs/.DS_Store | Bin 6148 -> 0 bytes processors/.DS_Store | Bin 10244 -> 0 bytes 5 files changed, 3 insertions(+) delete mode 100644 .DS_Store delete mode 100644 analysis/.DS_Store delete mode 100644 analysis/plotconfigs/.DS_Store delete mode 100644 processors/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 89d290fdce73fdc5adf8a962ad7f99597e306c1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!AiqG5S?wSZY)9%Djow~3${?D;w9Aj14i_qQWH}&7_%j54N?j@>JRxTevdP| zTd}5k6tz1r`(}4$66R&u%>V%FjDjXW4FEVQVadW_j*y?UASJz0L1gk7kB~wLsh_2T zLbO@N1@j+dO% z>_mvjpW2>(8uqhZZT(QhLobZ`iA)HCK89SJg>fLVju^#3Dsx@s;Fe|eYMbM6qi(m` zle#@_w)XeXZtYGc7T?(3IXLd!Mfb6IQdBbBbyC(ePT?7iLRAlL5=SDwK_BIGn8wTinuu%yejk!X3 zbl@Oc07UwYl!7+(5|m?WbTsA)(SyQNDxykdy2W5B9oKCg=V;6os&rtw`C$6ZOm`?u zz8#-$%WzV!Z diff --git a/.gitignore b/.gitignore index 7ab63d841..6593f57f4 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,9 @@ tramp .project .settings/ +# Mac files +.DS_Store + # Ignore build and install dirs build/ install/ diff --git a/analysis/.DS_Store b/analysis/.DS_Store deleted file mode 100644 index f513b600bad9192dfd751dfb3f03890e2fa641af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T3QMO)NqVDjow~3${?D;w8lT0!H+pQj;duV9b^#F^5vfQD4YM@p+v6 zDcIIrMe7dCev|o0n2+vm2LOnZ2OR(t0CZG_+7>R~2#YgakqzmoBNG0O90CaaA|3nj zO15$+1{4FojRCfI8xTPPLx|za{-r)f-u-bLrCGcEK{jgIX1$^7dQ-o1A8FxcUY4hh zH@RU?mz2i--1hvdC@co%&KXTIFG|7*FNlH=Q*N)LB%p;u^CU=ltt$e$VHg8*Z#r$a ztX^-{vZkHx$uZj9quI>RcMlFvF9uKXb3$JQi3HCaF5434@P@`xPcQByiD@#z2&-zs z7`vsAVb>IUe?SICkcyM*k9S_t+Y$pcNMQoQwdh#(vee=H*PyV90l9zlW>tdnD+Uw; z|CRxEK3J#>ZHc8oesti%M*u_(-CWRSvjnTLB-#>7ffzv{q7+e-5;fgfey E6Cz8I&gz26ECICFJMIvDzmjii(MmYXAfi0qkbVjil4{# zl2n}TEFv$E{9p3kOPU{SNf=|?pT#}KT*jDyiptSgQE+&rt6_stInEKKDgyg0dP)=P z`|E<=-e41U7nS+b*YD4ZZugxxnyt0<4IxBZ+yoD*42rOr<$gH5!rr-3X;j-`bdik9 zk-K%GvLZ~f@l+=y@fbp`FOw`*rLSgLoa@}cIE3RkBX?&$?{?&1u;|EnuYYt1cK=|p zaK!fB{_)x9F`Z=U#h~OsT9-|$wY-9%ck&!evs7jG(63|b7*ZlY1c(3;AOfGKgJ=^B zB0vO)z&8STdz4U7J*$;beX)cFug~ajp<)3W-x8?Os%Nz_3LYrjq=K4MZl4(3q{Fzh zah}!6s7YsBuMG3pmFvd~*Q>+0)ZvVKMyVwNL|~af({x=t|4-p3v+|L@oI*V!Km`67 z0p1!0LmxI}&(?ufW34HfDZnT>}sd+OSB=*vsxL&S#VsZgVIGn L1EGcp`~rawcF#y6 diff --git a/processors/.DS_Store b/processors/.DS_Store deleted file mode 100644 index 763d2417e4c54df00261035f352801c1237155ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10244 zcmeHMU2GIp6h3FRw0DLA(?SclS-Ma#2n7~e{z0~XAX=o*|MIi!?hNh7bf)ag?gF)@ zPXr?d6O|Z$9@U_R2NQ`VKBx~qp@{?$CGkaLj4x_p;)@TSJ9oB$1s=s}?oH;Nd(XY+ z-Z|g>&Q9)G0Km4qu^u1}0E`|k^=hi_QTRB2?kY;C;e$x_02Yj7ir#p}b~AU)mI{f0 zL_i`S5s(N-1ZDyP^v&jl%@$JD5&?;TL|_^L{`(N8hs$Irr-TfCI;aY+03<6&9TaNQ zJs_}&hcX$;DIo(>T2tH}Ff_&Rih;tM#^ZcC$z&*}gcRn0!W=N%8N(Y22D_78JeUrc z6jIg_0g1rf2=K6}ge4ozC=IW-+BNXm=eyZ8>HxFt7}hrW_uy9K$WPxp~L%0^1%jz*JRD>Gcy6 ziKh6LEt5_0iS;d8H&MG~KfN=KbSgUk2&r+;RJ?11Td$}sb|YQvb{pP$Vf!0 zN*>)Td8BHyqx}Qg(4dudogV9qnbPNZgwg{ zy4bRZS0^@Z+tu;dz600i%$=uewc3J#g5_Bm+w3b^hCe!#_Ohm9SkA~WVdnVOam&o9 zHIWNyuah1#uj};-7cG7$8ZDn)T4gYwu}VIaV22HQ$$hTDS2Ti= zXhU=bV~4oDJ!eua)Y{7EDpgOjUXNTBORUk>sk*23o}hyjrW>>trW zGW`j4pddUK${pIHtOlFZ!K^zrM*et0-5PCY`lswD-@7aA`TNIBhqmY5bv8t!LtNi# z7^Xo^EUI6qM<0)NG5s1F_D0h=bAOQtSJHPg791z(`AVIJ<-5~^y?ju&oPtGMrsEKl zW{t^};#2}qRh@sB7Q-@VfgR8dLtsD=&cn-a5#EH$a0Nbw&*3Y$24BMsxCKALFYpKa zg|n~<8LC)|^RW)=u@Rea4X(v)*p3~z8~0!r_F+E`;t(Fi5gf&*@C2U3GdO{h_za%K z3-|)Qh%ezA_!hp6m+&3@2tUKC_yvB6-{4LB4sYR4_$&T~zbg@?TA8EFRhBBtl+{W? zp~N09N-0E!MZZ)l&D6Rh=qW_Pq@8l~ULg|Oy+>>QS3~66Y916dweuI$Eoof2X2YiK z$!XpQrj^KbJ81)+-ofsGr@_&d6HG*p7V9G-o2Tvy31Ek zw~}Zsx{s`i#dL+DOLW(+i)ngZn^#d6!_MX{nx6L(=Nwh=qK z@JZ~(19%V*;So&XF-#LTZ5%@fi+Gy&`7|-~ES|&X@H{?`7x5K*6<@>G1E#(!I5y3^ zy(P{GiSLy&uh5foY}XkfJ!fkbeS#eN9NCbkNHcFsCjWOoMrA&gc^m-`a*+LBcpCar z=Ak%xSxW>Y0ulj Date: Thu, 19 Oct 2023 12:10:57 -0700 Subject: [PATCH 10/71] minor fix --- analysis/src/SimPartHistos.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 269582b24..277ee1a59 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -82,7 +82,7 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: void SimPartHistos::FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight){ - int nSim_Tracker_hits = MCTrackerHit->size(); + int nSim_Tracker_hits = MCTrackerHits->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); From 8f62f1682a6f4c05aa74654f3b480bbc3a5b13f5 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 19 Oct 2023 12:14:03 -0700 Subject: [PATCH 11/71] minor fix --- analysis/src/SimPartHistos.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 277ee1a59..95fe3ac87 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -82,7 +82,7 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: void SimPartHistos::FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight){ - int nSim_Tracker_hits = MCTrackerHits->size(); + int nSim_Tracker_hits = MCTrackerHits_->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); From 0c846334ade5d3100a3425917246e5b67129128d Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 19 Oct 2023 12:33:32 -0700 Subject: [PATCH 12/71] only plot number of tracks clusters for npart>0 --- analysis/plotconfigs/mc/simPart.json | 8 ++++---- analysis/src/SimPartHistos.cxx | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 58a2a5ce9..7c824c7f5 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -27,11 +27,11 @@ "xtitle" : "Number of Sim Tracker Hits", "ytitle" : "Events" }, - "numRecoTrackerHits_h" : { + "numRecoTrackerClusters_h" : { "bins" : 60, "minX" : -0.5, "maxX" : 59.5, - "xtitle" : "Number of Reco Tracker Hits", + "xtitle" : "Number of Reco Tracker Clusters", "ytitle" : "Events" }, "numSimEcalHits_h" : { @@ -41,11 +41,11 @@ "xtitle" : "Number of Sim Ecal Hits", "ytitle" : "Events" }, - "numRecoEcalHits_h" : { + "numRecoEcalClusters_h" : { "bins" : 60, "minX" : -0.5, "maxX" : 59.5, - "xtitle" : "Number of Reco Ecal Hits", + "xtitle" : "Number of Reco Ecal Clusters", "ytitle" : "Events" }, "ele_pxpz_pypz_hh" : { diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 95fe3ac87..e51e9c426 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -81,19 +81,20 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: } void SimPartHistos::FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight){ - + int nParts = MCParticles_->size(); int nSim_Tracker_hits = MCTrackerHits_->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); int nReco_Ecal_clusters = RecoEcalClusters_->size(); - Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); - Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); - Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); - Fill1DHisto("numRecoTrackerHits_h", (float)nReco_Tracker_clusters, weight); - Fill1DHisto("numRecoEcalHits_h", (float)nReco_Ecal_clusters, weight); - + if (nParts>0){ + Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); + Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); + Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); + Fill1DHisto("numRecoTrackerClusters_h", (float)nReco_Tracker_clusters, weight); + Fill1DHisto("numRecoEcalClusters_h", (float)nReco_Ecal_clusters, weight); + } } From 34e9d67b80c79f98714380e4427f789863648423 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 19 Oct 2023 13:59:42 -0700 Subject: [PATCH 13/71] minor fix --- analysis/src/SimPartHistos.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index e51e9c426..f990264ab 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -50,19 +50,19 @@ void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std:: if (n_hits >= 14) Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); - else if (n_hits >= 13) + if (n_hits >= 13) Fill2DHisto("track_phi0_tanlambda_minhits13_hh", phi0, tan_lambda, weight); - else if (n_hits >= 12) + if (n_hits >= 12) Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); - else if (n_hits >= 11) + if (n_hits >= 11) Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); - else if (n_hits >= 10) + if (n_hits >= 10) Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); - else if (n_hits >= 9) + if (n_hits >= 9) Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); - else if (n_hits >= 8) + if (n_hits >= 8) Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); - else if (n_hits >= 7) + if (n_hits >= 7) Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); } From 56e67bdb37a61de820d8fda2af0f9a70f6634cb4 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:38:32 -0700 Subject: [PATCH 14/71] add flattuple --- analysis/include/SimPartHistos.h | 7 +- analysis/plotconfigs/mc/simPart.json | 216 ++++++++---------- analysis/selections/simPart/Track_nhit10.json | 27 +++ analysis/selections/simPart/Track_nhit11.json | 27 +++ analysis/selections/simPart/Track_nhit12.json | 27 +++ analysis/selections/simPart/Track_nhit13.json | 27 +++ analysis/selections/simPart/Track_nhit14.json | 27 +++ analysis/selections/simPart/Track_nhit7.json | 27 +++ analysis/selections/simPart/Track_nhit8.json | 27 +++ analysis/selections/simPart/Track_nhit9.json | 27 +++ analysis/selections/simPart/Track_noEcal.json | 27 +++ analysis/selections/simPart/noEcal.json | 27 +++ analysis/selections/simPart/noTrack.json | 27 +++ analysis/selections/simPart/noTrack_Ecal.json | 27 +++ analysis/selections/simPart/simPartAna.json | 7 + analysis/src/SimPartHistos.cxx | 173 +++++++------- processors/config/simPartAna_cfg.py | 16 ++ processors/include/SimPartProcessor.h | 14 +- processors/src/SimPartProcessor.cxx | 213 ++++++++++++++++- 19 files changed, 755 insertions(+), 215 deletions(-) create mode 100644 analysis/selections/simPart/Track_nhit10.json create mode 100644 analysis/selections/simPart/Track_nhit11.json create mode 100644 analysis/selections/simPart/Track_nhit12.json create mode 100644 analysis/selections/simPart/Track_nhit13.json create mode 100644 analysis/selections/simPart/Track_nhit14.json create mode 100644 analysis/selections/simPart/Track_nhit7.json create mode 100644 analysis/selections/simPart/Track_nhit8.json create mode 100644 analysis/selections/simPart/Track_nhit9.json create mode 100644 analysis/selections/simPart/Track_noEcal.json create mode 100644 analysis/selections/simPart/noEcal.json create mode 100644 analysis/selections/simPart/noTrack.json create mode 100644 analysis/selections/simPart/noTrack_Ecal.json create mode 100644 analysis/selections/simPart/simPartAna.json diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h index aefba97db..0d3f3c74e 100644 --- a/analysis/include/SimPartHistos.h +++ b/analysis/include/SimPartHistos.h @@ -12,6 +12,7 @@ #include "Track.h" #include "TrackerHit.h" #include "CalCluster.h" +#include "FlatTupleMaker.h" #include #include @@ -39,9 +40,9 @@ class SimPartHistos : public HistoManager { * @param RecoEcalClusters * @param weight */ - void FillAcceptance(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight = 1.); - void FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight = 1.); - + void FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, float weight = 1.); + void FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight = 1.); + void FillRecoEcalCuster(CalCluster* cluster, FlatTupleMaker* tuples, float weight = 1.); }; #endif //SIMPARTHISTOS_H diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 7c824c7f5..62447353a 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -6,13 +6,6 @@ "xtitle" : "Number of Sim Particles", "ytitle" : "Events" }, - "particle_pdgid_h" : { - "bins" : 100, - "minX" : -50, - "maxX" : 50, - "xtitle" : "PDG ID of Sim Particles", - "ytitle" : "Events" - }, "numRecoTracks_h" : { "bins" : 60, "minX" : -0.5, @@ -48,117 +41,108 @@ "xtitle" : "Number of Reco Ecal Clusters", "ytitle" : "Events" }, - "ele_pxpz_pypz_hh" : { - "binsX" : 2000, - "minX" : -0.8, - "maxX" : 0.8, - "binsY" : 500, - "minY" : -0.2, - "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "particle_pdgid_h" : { + "bins" : 100, + "minX" : -50, + "maxX" : 50, + "xtitle" : "PDG ID of Sim Particles", + "ytitle" : "Events" }, - "ele_pxpz_pypz_noTrack_hh" : { - "binsX" : 2000, - "minX" : -0.8, - "maxX" : 0.8, - "binsY" : 500, - "minY" : -0.2, - "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "ele_px_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ele p_{x}", + "ytitle" : "Events" }, - "ele_pxpz_pypz_Track_noECal_hh" : { - "binsX" : 2000, - "minX" : -0.8, - "maxX" : 0.8, - "binsY" : 500, - "minY" : -0.2, - "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "ele_py_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ele p_{y}", + "ytitle" : "Events" }, - "ele_pxpz_pypz_noEcal_hh" : { - "binsX" : 2000, - "minX" : -0.8, - "maxX" : 0.8, - "binsY" : 500, - "minY" : -0.2, - "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "ele_pz_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ele p_{z}", + "ytitle" : "Events" }, - "ele_pxpz_pypz_noTrack_ECal_hh" : { - "binsX" : 2000, - "minX" : -0.8, - "maxX" : 0.8, - "binsY" : 500, - "minY" : -0.2, - "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "ele_p_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ele p", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits7_hh" : { - "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "ele_energy_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ele energy", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits8_hh" : { - "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "track_n_hits_h" : { + "bins" : 20, + "minX" : -0.5, + "maxX" : 19.5, + "xtitle" : "Track nr. of hits", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits9_hh" : { - "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "track_px_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "Track p_{x}", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits10_hh" : { - "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "track_py_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "Track p_{y}", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits11_hh" : { - "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "track_pz_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "Track p_{z}", + "ytitle" : "Events" + }, + "track_p_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "Track p", + "ytitle" : "Events" + }, + "ecal_n_hits_h" : { + "bins" : 20, + "minX" : -0.5, + "maxX" : 19.5, + "xtitle" : "ECal nr. of hits", + "ytitle" : "Events" + }, + "ecal_energy_h" : { + "bins" : 100, + "minX" : 0, + "maxX" : 10, + "xtitle" : "ECal energy", + "ytitle" : "Events" }, - "track_phi0_tanlambda_minhits12_hh" : { + "ele_pxpz_pypz_hh" : { "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, + "minX" : -0.8, + "maxX" : 0.8, "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "minY" : -0.2, + "maxY" : 0.2, + "xtitle" : "ele p_{x}/p_{z}", + "ytitle" : "ele p_{y}/p_{z}" }, - "track_phi0_tanlambda_minhits13_hh" : { + "track_phi0_tanlambda_hh" : { "binsX" : 2000, "minX" : -0.2, "maxX" : 0.3, @@ -168,27 +152,27 @@ "xtitle" : "Track #{phi}_{0}", "ytitle" : "Track tan#{lambda}}" }, - "track_phi0_tanlambda_minhits14_hh" : { + "track_x_y_hh" : { "binsX" : 2000, - "minX" : -0.2, - "maxX" : 0.3, + "minX" : -340, + "maxX" : 420, "binsY" : 500, - "minY" : -0.15, - "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "minY" : -100, + "maxY" : 100, + "xtitle" : "Track x", + "ytitle" : "Track y" }, - "ecal_x_y_hh" : { + "track_ecal_x_y_hh" : { "binsX" : 2000, "minX" : -340, "maxX" : 420, "binsY" : 500, "minY" : -100, "maxY" : 100, - "xtitle" : "Ecal cluster x", - "ytitle" : "Ecal cluster y" + "xtitle" : "Track (at ECal) x", + "ytitle" : "Track (at ECal) y" }, - "ecal_x_y_noTrack_hh" : { + "ecal_x_y_hh" : { "binsX" : 2000, "minX" : -340, "maxX" : 420, diff --git a/analysis/selections/simPart/Track_nhit10.json b/analysis/selections/simPart/Track_nhit10.json new file mode 100644 index 000000000..642198b44 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit10.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 10.0, + "id" : 0, + "info" : "N Reco Track Hits >= 10" + } +} diff --git a/analysis/selections/simPart/Track_nhit11.json b/analysis/selections/simPart/Track_nhit11.json new file mode 100644 index 000000000..b8157fa65 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit11.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 11.0, + "id" : 0, + "info" : "N Reco Track Hits >= 11" + } +} diff --git a/analysis/selections/simPart/Track_nhit12.json b/analysis/selections/simPart/Track_nhit12.json new file mode 100644 index 000000000..8d3c3df78 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit12.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 12.0, + "id" : 0, + "info" : "N Reco Track Hits >= 12" + } +} diff --git a/analysis/selections/simPart/Track_nhit13.json b/analysis/selections/simPart/Track_nhit13.json new file mode 100644 index 000000000..3ce5f67d4 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit13.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 13.0, + "id" : 0, + "info" : "N Reco Track Hits >= 13" + } +} diff --git a/analysis/selections/simPart/Track_nhit14.json b/analysis/selections/simPart/Track_nhit14.json new file mode 100644 index 000000000..dab51a0df --- /dev/null +++ b/analysis/selections/simPart/Track_nhit14.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 14.0, + "id" : 0, + "info" : "N Reco Track Hits >= 14" + } +} diff --git a/analysis/selections/simPart/Track_nhit7.json b/analysis/selections/simPart/Track_nhit7.json new file mode 100644 index 000000000..68f39abd2 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit7.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 7.0, + "id" : 0, + "info" : "N Reco Track Hits >= 7" + } +} diff --git a/analysis/selections/simPart/Track_nhit8.json b/analysis/selections/simPart/Track_nhit8.json new file mode 100644 index 000000000..e481e8357 --- /dev/null +++ b/analysis/selections/simPart/Track_nhit8.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 8.0, + "id" : 0, + "info" : "N Reco Track Hits >= 8" + } +} diff --git a/analysis/selections/simPart/Track_nhit9.json b/analysis/selections/simPart/Track_nhit9.json new file mode 100644 index 000000000..b4abd481e --- /dev/null +++ b/analysis/selections/simPart/Track_nhit9.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 9.0, + "id" : 0, + "info" : "N Reco Track Hits >= 9" + } +} diff --git a/analysis/selections/simPart/Track_noEcal.json b/analysis/selections/simPart/Track_noEcal.json new file mode 100644 index 000000000..b4b2046ce --- /dev/null +++ b/analysis/selections/simPart/Track_noEcal.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters <= 0" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/noEcal.json b/analysis/selections/simPart/noEcal.json new file mode 100644 index 000000000..8e5e70d90 --- /dev/null +++ b/analysis/selections/simPart/noEcal.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks >= 0" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters <= 0" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/noTrack.json b/analysis/selections/simPart/noTrack.json new file mode 100644 index 000000000..c749edd34 --- /dev/null +++ b/analysis/selections/simPart/noTrack.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks >= 0" + }, + "n_track_lt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks <= 0" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/noTrack_Ecal.json b/analysis/selections/simPart/noTrack_Ecal.json new file mode 100644 index 000000000..ec472cd0c --- /dev/null +++ b/analysis/selections/simPart/noTrack_Ecal.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks >= 0" + }, + "n_track_lt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks <= 0" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Ecal Clusters >= 1" + }, + "n_ecal_cluster_lt" : { + "cut" : 99999.0, + "id" : 0, + "info" : "N Ecal Clusters <= 99999" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/simPartAna.json b/analysis/selections/simPart/simPartAna.json new file mode 100644 index 000000000..4654066fc --- /dev/null +++ b/analysis/selections/simPart/simPartAna.json @@ -0,0 +1,7 @@ +{ + "n_simpart_gt" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles >= 1" + } +} diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index f990264ab..cf81bd40e 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -1,100 +1,93 @@ #include "SimPartHistos.h" #include -void SimPartHistos::FillAcceptance(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight) { - int nParts = MCParticles_->size(); - Fill1DHisto("numMCparts_h", (float)nParts, weight); - - int nTracks = RecoTracks_->size(); - int nTracker_clusters = RecoTrackerClusters_->size(); - int nEcal_clusters = RecoEcalClusters_->size(); - - for (int i=0; iat(i); - int pdg = part->getPDG(); - int gen = part->getGenStatus(); - std::vector momentum_V = part->getMomentum(); - double px = momentum_V.at(0); - double py = momentum_V.at(1); - double pz = momentum_V.at(2); - - if (gen != 1) - continue; - - Fill1DHisto("particle_pdgid_h", pdg, weight); - if (pdg == 11) { - Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); - if (nTracks == 0){ - Fill2DHisto("ele_pxpz_pypz_noTrack_hh", px/pz, py/pz, weight); - if (nEcal_clusters != 0) - Fill2DHisto("ele_pxpz_pypz_noTrack_ECal_hh", px/pz, py/pz, weight); - } - if (nEcal_clusters == 0){ - Fill2DHisto("ele_pxpz_pypz_noEcal_hh", px/pz, py/pz, weight); - if (nTracks != 0) - Fill2DHisto("ele_pxpz_pypz_Track_noECal_hh", px/pz, py/pz, weight); - } - } - } - - for (int i=0; iat(i); - bool isTop = (track->getTanLambda() > 0.0); - bool isPos = (track->getOmega() < 0.0); - bool isKF = track->isKalmanTrack(); - int trkType = (int)isTop*2 + (int)isPos; - //int n2dhits_onTrack = !isKF ? track->getTrackerHitCount() * 2 : track->getTrackerHitCount(); - int n_hits = track->getTrackerHitCount(); - double phi0 = track->getPhi(); - double tan_lambda = track->getTanLambda(); - - if (n_hits >= 14) - Fill2DHisto("track_phi0_tanlambda_minhits14_hh", phi0, tan_lambda, weight); - if (n_hits >= 13) - Fill2DHisto("track_phi0_tanlambda_minhits13_hh", phi0, tan_lambda, weight); - if (n_hits >= 12) - Fill2DHisto("track_phi0_tanlambda_minhits12_hh", phi0, tan_lambda, weight); - if (n_hits >= 11) - Fill2DHisto("track_phi0_tanlambda_minhits11_hh", phi0, tan_lambda, weight); - if (n_hits >= 10) - Fill2DHisto("track_phi0_tanlambda_minhits10_hh", phi0, tan_lambda, weight); - if (n_hits >= 9) - Fill2DHisto("track_phi0_tanlambda_minhits9_hh", phi0, tan_lambda, weight); - if (n_hits >= 8) - Fill2DHisto("track_phi0_tanlambda_minhits8_hh", phi0, tan_lambda, weight); - if (n_hits >= 7) - Fill2DHisto("track_phi0_tanlambda_minhits7_hh", phi0, tan_lambda, weight); - - } - - for (int i=0; iat(i); - std::vector position_V = ecal_cluster->getPosition(); - double cluster_x = position_V.at(0); - double cluster_y = position_V.at(1); - - Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); - if (nTracks == 0) - Fill2DHisto("ecal_x_y_noTrack_hh", cluster_x, cluster_y, weight); +void SimPartHistos::FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, float weight){ + int pdg = part->getPDG(); + std::vector momentum_V = part->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + double p = part->getP(); + double energy = part->getEnergy(); + + Fill1DHisto("particle_pdgid_h", pdg, weight); + tuples->addToVector("particle_pdgid", pdg); + if (pdg == 11) { + Fill1DHisto("ele_px_h", px, weight); + Fill1DHisto("ele_py_h", py, weight); + Fill1DHisto("ele_pz_h", pz, weight); + Fill1DHisto("ele_p_h", p, weight); + Fill1DHisto("ele_energy_h", energy, weight); + Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); + tuples->addToVector("ele_px", px); + tuples->addToVector("ele_py", py); + tuples->addToVector("ele_pz", pz); + tuples->addToVector("ele_p", p); + tuples->addToVector("ele_energy", energy); + tuples->addToVector("ele_pxpy", px/pz); + tuples->addToVector("ele_pypz", py/pz); } - } -void SimPartHistos::FillEfficiency(std::vector *MCParticles_, std::vector *RecoTracks_, std::vector *MCTrackerHits_, std::vector *MCEcalHits_, std::vector *RecoTrackerClusters_, std::vector *RecoEcalClusters_, float weight){ - int nParts = MCParticles_->size(); - int nSim_Tracker_hits = MCTrackerHits_->size(); - int nSim_Ecal_hits = MCEcalHits_->size(); - int nReco_Tracks = RecoTracks_->size(); - int nReco_Tracker_clusters = RecoTrackerClusters_->size(); - int nReco_Ecal_clusters = RecoEcalClusters_->size(); +void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight){ + bool isTop = (track->getTanLambda() > 0.0); + bool isPos = (track->getOmega() < 0.0); + bool isKF = track->isKalmanTrack(); + int trkType = (int)isTop*2 + (int)isPos; + //int n2dhits_onTrack = !isKF ? track->getTrackerHitCount() * 2 : track->getTrackerHitCount(); + int n_hits = track->getTrackerHitCount(); + double phi0 = track->getPhi(); + double tan_lambda = track->getTanLambda(); + + std::vector position_V = track->getPosition(); + double track_x = position_V.at(0); + double track_y = position_V.at(1); + std::vector position_ecal_V = track->getPositionAtEcal(); + double track_ecal_x = position_ecal_V.at(0); + double track_ecal_y = position_ecal_V.at(1); + + std::vector momentum_V = track->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + double p = track->getP(); + + Fill1DHisto("track_n_hits_h", n_hits, weight); + Fill1DHisto("track_px_h", px, weight); + Fill1DHisto("track_py_h", py, weight); + Fill1DHisto("track_pz_h", pz, weight); + Fill1DHisto("track_p_h", p, weight); + Fill2DHisto("track_phi0_tanlambda_hh", phi0, tan_lambda, weight); + Fill2DHisto("track_x_y_hh", track_x, track_y, weight); + Fill2DHisto("track_ecal_x_y_hh", track_ecal_x, track_ecal_y, weight); + + tuples->addToVector("track_n_hits", n_hits); + tuples->addToVector("track_px", px); + tuples->addToVector("track_py", py); + tuples->addToVector("track_pz", pz); + tuples->addToVector("track_p", p); + tuples->addToVector("track_phi0", phi0); + tuples->addToVector("track_tanlambda", tan_lambda); + tuples->addToVector("track_x", track_x); + tuples->addToVector("track_y", track_y); + tuples->addToVector("track_ecal_x", track_ecal_x); + tuples->addToVector("track_ecal_y", track_ecal_y); +} - if (nParts>0){ - Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); - Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); - Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); - Fill1DHisto("numRecoTrackerClusters_h", (float)nReco_Tracker_clusters, weight); - Fill1DHisto("numRecoEcalClusters_h", (float)nReco_Ecal_clusters, weight); - } +void SimPartHistos::FillRecoEcalCuster(CalCluster* cluster, FlatTupleMaker* tuples, float weight){ + std::vector position_V = ecal_cluster->getPosition(); + double cluster_x = position_V.at(0); + double cluster_y = position_V.at(1); + int n_hits = ecal_cluster->getNHits(); + double energy = ecal_cluster->getEnergy(); + + Fill1DHisto("ecal_n_hits_h", n_hits, weight); + Fill1DHisto("ecal_energy_h", energy, weight); + Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); + tuples->addToVector("ecal_n_hits", n_hits); + tuples->addToVector("ecal_energy", energy); + tuples->addToVector("ecal_x", cluster_x); + tuples->addToVector("ecal_y", cluster_y); } diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index 769a125f2..ba77131db 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -54,6 +54,22 @@ sim_part_ana.parameters["analysis"] = analysis sim_part_ana.parameters["histCfg"] = os.environ['HPSTR_BASE']+'/analysis/plotconfigs/mc/simPart.json' +sim_part_ana.parameters["selectionjson"] = os.environ['HPSTR_BASE']+'/analysis/selections/simPart/simPartAna.json' +RegionPath = os.environ['HPSTR_BASE']+"/analysis/selections/simPart/" +sim_part_ana.parameters["regionDefinitions"] = [RegionPath+'noTrack.json', + RegionPath+'noTrack_Ecal.json', + RegionPath+'noEcal.json', + RegionPath+'Track_noEcal.json', + RegionPath+'Track_nhit7.json', + RegionPath+'Track_nhit8.json', + RegionPath+'Track_nhit9.json', + RegionPath+'Track_nhit10.json', + RegionPath+'Track_nhit11.json', + RegionPath+'Track_nhit12.json', + RegionPath+'Track_nhit13.json', + RegionPath+'Track_nhit14.json' + ] + # Sequence which the processors will run. p.sequence = [sim_part_ana] diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index e2699a102..493c0b49e 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -11,6 +11,8 @@ #include "Track.h" #include "TrackerHit.h" #include "CalCluster.h" +#include "AnaHelpers.h" +#include "FlatTupleMaker.h" //ROOT #include "Processor.h" @@ -72,6 +74,7 @@ class SimPartProcessor : public Processor { /** Containers to hold histogrammer info */ SimPartHistos* histos{nullptr}; std::string histCfgFilename_; //!< description + FlatTupleMaker* tuples{nullptr}; /** \todo Change this to be held from HPSEvent */ TTree* tree_; @@ -96,9 +99,18 @@ class SimPartProcessor : public Processor { std::string RecoTrackColl_{"KalmanFullTracks"}; //!< description std::string RecoTrackerClusterColl_{"SiClustersOnTrack"}; //!< description std::string RecoEcalClusterColl_{"RecoEcalClusters"}; //!< description - std::string analysis_{"sim_part"}; //!< description + std::string selectionCfg_; + std::shared_ptr EventSelector_; //!< description + std::vector regions_; //!< description + std::vector regionSelections_; //!< description + std::map> reg_selectors_; //!< description + + std::map> reg_histos_; //!< description + typedef std::map>::iterator reg_it; //!< description + std::map> reg_tuples_; //!< description + int debug_{0}; //!< Debug Level }; diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 50302cdaf..557865b98 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -25,6 +25,8 @@ void SimPartProcessor::configure(const ParameterSet& parameters) { RecoEcalClusterColl_ = parameters.getString("RecoEcalClusterColl"); histCfgFilename_ = parameters.getString("histCfg"); analysis_ = parameters.getString("analysis"); + selectionCfg_ = parameters.getString("selectionjson",selectionCfg_); + regionSelections_ = parameters.getVString("regionDefinitions",regionSelections_); } catch (std::runtime_error& error) { @@ -38,6 +40,87 @@ void SimPartProcessor::initialize(TTree* tree) { histos = new SimPartHistos(anaName_); histos->loadHistoConfig(histCfgFilename_); histos->DefineHistos(); + tuples = new FlatTupleMaker(anaName_+"_tree"); + tuples->addVariable("numMCparts"); + tuples->addVariable("numRecoTracks"); + tuples->addVariable("numSimTrackerHits"); + tuples->addVariable("numRecoTrackerClusters"); + tuples->addVariable("numSimEcalHits"); + tuples->addVariable("numRecoEcalClusters"); + tuples->addVector("particle_pdgid"); + tuples->addVector("ele_px"); + tuples->addVector("ele_py"); + tuples->addVector("ele_pz"); + tuples->addVector("ele_p"); + tuples->addVector("ele_energy"); + tuples->addVector("ele_pxpy"); + tuples->addVector("ele_pypz"); + tuples->addVector("track_n_hits"); + tuples->addVector("track_px"); + tuples->addVector("track_py"); + tuples->addVector("track_pz"); + tuples->addVector("track_p"); + tuples->addVector("track_phi0"); + tuples->addVector("track_tanlambda"); + tuples->addVector("track_x"); + tuples->addVector("track_y"); + tuples->addVector("track_ecal_x"); + tuples->addVector("track_ecal_y"); + tuples->addVector("ecal_n_hits"); + tuples->addVector("ecal_energy"); + tuples->addVector("ecal_x"); + tuples->addVector("ecal_y"); + + if (!selectionCfg_.empty()) { + EventSelector_ = std::make_shared(name_+"_EventSelector",selectionCfg_); + EventSelector_->setDebug(debug_); + EventSelector_->LoadSelection(); + std::cout << "Event Selection Loaded" << std::endl; + } + for (unsigned int i_reg = 0; i_reg < regionSelections_.size(); i_reg++) { + std::string regname = AnaHelpers::getFileName(regionSelections_[i_reg],false); + std::cout << "Setting up region:: " << regname << std::endl; + reg_selectors_[regname] = std::make_shared(regname, regionSelections_[i_reg]); + reg_selectors_[regname]->setDebug(debug_); + reg_selectors_[regname]->LoadSelection(); + + reg_histos_[regname] = std::make_shared(regname); + reg_histos_[regname]->loadHistoConfig(histCfgFilename_); + reg_histos_[regname]->DefineHistos(); + + reg_tuples_[regname] = std::make_shared(anaName_+"_"+regname+"_tree"); + reg_histos_[regname]->addVariable("numMCparts"); + reg_histos_[regname]->addVariable("numRecoTracks"); + reg_histos_[regname]->addVariable("numSimTrackerHits"); + reg_histos_[regname]->addVariable("numRecoTrackerClusters"); + reg_histos_[regname]->addVariable("numSimEcalHits"); + reg_histos_[regname]->addVariable("numRecoEcalClusters"); + reg_histos_[regname]->addVector("particle_pdgid"); + reg_histos_[regname]->addVector("ele_px"); + reg_histos_[regname]->addVector("ele_py"); + reg_histos_[regname]->addVector("ele_pz"); + reg_histos_[regname]->addVector("ele_p"); + reg_histos_[regname]->addVector("ele_energy"); + reg_histos_[regname]->addVector("ele_pxpy"); + reg_histos_[regname]->addVector("ele_pypz"); + reg_histos_[regname]->addVector("track_n_hits"); + reg_histos_[regname]->addVector("track_px"); + reg_histos_[regname]->addVector("track_py"); + reg_histos_[regname]->addVector("track_pz"); + reg_histos_[regname]->addVector("track_p"); + reg_histos_[regname]->addVector("track_phi0"); + reg_histos_[regname]->addVector("track_tanlambda"); + reg_histos_[regname]->addVector("track_x"); + reg_histos_[regname]->addVector("track_y"); + reg_histos_[regname]->addVector("track_ecal_x"); + reg_histos_[regname]->addVector("track_ecal_y"); + reg_histos_[regname]->addVector("ecal_n_hits"); + reg_histos_[regname]->addVector("ecal_energy"); + reg_histos_[regname]->addVector("ecal_x"); + reg_histos_[regname]->addVector("ecal_y"); + + regions_.push_back(regname); + } // init TTree tree_->SetBranchAddress(MCParticleColl_.c_str(), &MCParticles_, &bMCParticles_); @@ -69,17 +152,137 @@ void SimPartProcessor::initialize(TTree* tree) { bool SimPartProcessor::process(IEvent* ievent) { - histos->FillAcceptance(MCParticles_, RecoTracks_, RecoTrackerClusters_, RecoEcalClusters_); - histos->FillEfficiency(MCParticles_, RecoTracks_, MCTrackerHits_, MCECalHits_, RecoTrackerClusters_, RecoEcalClusters_); + double weight = 1.0; + if (EventSelector_) EventSelector_->getCutFlowHisto()->Fill(0.,weight); + + int nParts = MCParticles_->size(); + int nSim_Tracker_hits = MCTrackerHits_->size(); + int nSim_Ecal_hits = MCEcalHits_->size(); + int nReco_Tracks = RecoTracks_->size(); + int nReco_Tracker_clusters = RecoTrackerClusters_->size(); + int nReco_Ecal_clusters = RecoEcalClusters_->size(); + + // Event Selection + if (EventSelector_ && !EventSelector_->passCutGt("n_simpart_gt", nParts, weight)) + continue; + + histos->Fill1DHisto("numMCparts_h", (float)nParts, weight); + histos->Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); + histos->Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); + histos->Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); + histos->Fill1DHisto("numRecoTrackerClusters_h", (float)nReco_Tracker_clusters, weight); + histos->Fill1DHisto("numRecoEcalClusters_h", (float)nReco_Ecal_clusters, weight); + tuples->setVariableValue("numMCparts", (float)nParts); + tuples->setVariableValue("numRecoTracks", (float)nReco_Tracks); + tuples->setVariableValue("numSimTrackerHits", (float)nSim_Tracker_hits); + tuples->setVariableValue("numSimEcalHits", (float)nSim_Ecal_hits); + tuples->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); + tuples->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); + + for (int i=0; iat(i); + int gen = part->getGenStatus(); + if (gen != 1) + continue; + histos->FillMCParticle(part, tuples); + } + + int min_n_Track_hits = 99999; + for (int i=0; iat(i); + int n_hits = track->getTrackerHitCount(); + if (n_hits < min_n_Track_hits) + min_n_Track_hits = n_hits; + histos->FillRecoTrack(track, tuples); + } + + for (int i=0; iat(i); + histos->FillRecoEcalCuster(ecal_cluster, tuples); + } + tuple->fill(); + + // Regions + for (auto region : regions_ ) { + reg_selectors_[region]->getCutFlowHisto()->Fill(0.,weight); + if(debug_) std::cout<<"Check for region "<passCutGt("n_track_gt", nReco_Tracks, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of Tracks Gt cut"<passCutLt("n_track_lt", nReco_Tracks, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of Tracks Lt cut"<passCutGt("n_ecal_cluster_gt", nReco_Ecal_clusters, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of ECal Clusters Gt cut"<passCutLt("n_ecal_cluster_lt", nReco_Ecal_clusters, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of ECal Clusters Lt cut"<passCutGt("n_track_hits_gt", min_n_Track_hits, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of Track Hits Gt cut"<Fill1DHisto("numMCparts_h", (float)nParts, weight); + reg_histos_[region]->Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); + reg_histos_[region]->Fill1DHisto("numSimTrackerHits_h", (float)nSim_Tracker_hits, weight); + reg_histos_[region]->Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); + reg_histos_[region]->Fill1DHisto("numRecoTrackerClusters_h", (float)nReco_Tracker_clusters, weight); + reg_histos_[region]->Fill1DHisto("numRecoEcalClusters_h", (float)nReco_Ecal_clusters, weight); + reg_tuples_[region]->setVariableValue("numMCparts", (float)nParts); + reg_tuples_[region]->setVariableValue("numRecoTracks", (float)nReco_Tracks); + reg_tuples_[region]->setVariableValue("numSimTrackerHits", (float)nSim_Tracker_hits); + reg_tuples_[region]->setVariableValue("numSimEcalHits", (float)nSim_Ecal_hits); + reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); + reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); + + for (int i=0; iat(i); + int gen = part->getGenStatus(); + if (gen != 1) + continue; + reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); + } + + for (int i=0; iat(i); + int n_hits = track->getTrackerHitCount(); + reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); + } + + for (int i=0; iat(i); + reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); + } + reg_tuples_[region]->fill(); + } + return true; } void SimPartProcessor::finalize() { - histos->saveHistos(outF_, anaName_); - delete histos; - histos = nullptr; + outF_->cd(); + histos->saveHistos(outF_, "presel"); + outF_->cd("presel"); + if (EventSelector_) + EventSelector_->getCutFlowHisto()->Write(); + tuples->writeTree(); + outF_->cd(); + + for (reg_it it = reg_histos_.begin(); it!=reg_histos_.end(); ++it) { + std::string dirName = it->first; + (it->second)->saveHistos(outF_,dirName); + outF_->cd(dirName.c_str()); + reg_selectors_[it->first]->getCutFlowHisto()->Scale(0.5); + reg_selectors_[it->first]->getCutFlowHisto()->Write(); + reg_tuples_[region]->writeTree(); + outF_->cd(); + } + outF_->Close(); } DECLARE_PROCESSOR(SimPartProcessor); From 7cab4c91e57b9b1657205bec290e2c04fc566e8b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:44:22 -0700 Subject: [PATCH 15/71] fix p for mc particle --- analysis/include/SimPartHistos.h | 1 + analysis/src/SimPartHistos.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h index 0d3f3c74e..7d2637ce3 100644 --- a/analysis/include/SimPartHistos.h +++ b/analysis/include/SimPartHistos.h @@ -15,6 +15,7 @@ #include "FlatTupleMaker.h" #include #include +#include /** * @brief description diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index cf81bd40e..30403a920 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -7,7 +7,7 @@ void SimPartHistos::FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, flo double px = momentum_V.at(0); double py = momentum_V.at(1); double pz = momentum_V.at(2); - double p = part->getP(); + double p = sqrt(px*px + py*py + pz*pz); double energy = part->getEnergy(); Fill1DHisto("particle_pdgid_h", pdg, weight); From f655e80794f4557c86f1273623f78350df8d420e Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:45:59 -0700 Subject: [PATCH 16/71] minor fix --- analysis/include/SimPartHistos.h | 2 +- analysis/src/SimPartHistos.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h index 7d2637ce3..461716187 100644 --- a/analysis/include/SimPartHistos.h +++ b/analysis/include/SimPartHistos.h @@ -43,7 +43,7 @@ class SimPartHistos : public HistoManager { */ void FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, float weight = 1.); void FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight = 1.); - void FillRecoEcalCuster(CalCluster* cluster, FlatTupleMaker* tuples, float weight = 1.); + void FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* tuples, float weight = 1.); }; #endif //SIMPARTHISTOS_H diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 30403a920..fa580c1d9 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -74,7 +74,7 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we tuples->addToVector("track_ecal_y", track_ecal_y); } -void SimPartHistos::FillRecoEcalCuster(CalCluster* cluster, FlatTupleMaker* tuples, float weight){ +void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* tuples, float weight){ std::vector position_V = ecal_cluster->getPosition(); double cluster_x = position_V.at(0); double cluster_y = position_V.at(1); From 4ab1760df66ff60b5a012c05d067f1e87ace3b42 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:49:32 -0700 Subject: [PATCH 17/71] minor fix --- processors/include/SimPartProcessor.h | 1 + processors/src/SimPartProcessor.cxx | 58 +++++++++++++-------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index 493c0b49e..caa1c0bbd 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -12,6 +12,7 @@ #include "TrackerHit.h" #include "CalCluster.h" #include "AnaHelpers.h" +#include "BaseSelector.h" #include "FlatTupleMaker.h" //ROOT diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 557865b98..83aae1e4b 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -89,35 +89,35 @@ void SimPartProcessor::initialize(TTree* tree) { reg_histos_[regname]->DefineHistos(); reg_tuples_[regname] = std::make_shared(anaName_+"_"+regname+"_tree"); - reg_histos_[regname]->addVariable("numMCparts"); - reg_histos_[regname]->addVariable("numRecoTracks"); - reg_histos_[regname]->addVariable("numSimTrackerHits"); - reg_histos_[regname]->addVariable("numRecoTrackerClusters"); - reg_histos_[regname]->addVariable("numSimEcalHits"); - reg_histos_[regname]->addVariable("numRecoEcalClusters"); - reg_histos_[regname]->addVector("particle_pdgid"); - reg_histos_[regname]->addVector("ele_px"); - reg_histos_[regname]->addVector("ele_py"); - reg_histos_[regname]->addVector("ele_pz"); - reg_histos_[regname]->addVector("ele_p"); - reg_histos_[regname]->addVector("ele_energy"); - reg_histos_[regname]->addVector("ele_pxpy"); - reg_histos_[regname]->addVector("ele_pypz"); - reg_histos_[regname]->addVector("track_n_hits"); - reg_histos_[regname]->addVector("track_px"); - reg_histos_[regname]->addVector("track_py"); - reg_histos_[regname]->addVector("track_pz"); - reg_histos_[regname]->addVector("track_p"); - reg_histos_[regname]->addVector("track_phi0"); - reg_histos_[regname]->addVector("track_tanlambda"); - reg_histos_[regname]->addVector("track_x"); - reg_histos_[regname]->addVector("track_y"); - reg_histos_[regname]->addVector("track_ecal_x"); - reg_histos_[regname]->addVector("track_ecal_y"); - reg_histos_[regname]->addVector("ecal_n_hits"); - reg_histos_[regname]->addVector("ecal_energy"); - reg_histos_[regname]->addVector("ecal_x"); - reg_histos_[regname]->addVector("ecal_y"); + reg_tuples_[regname]->addVariable("numMCparts"); + reg_tuples_[regname]->addVariable("numRecoTracks"); + reg_tuples_[regname]->addVariable("numSimTrackerHits"); + reg_tuples_[regname]->addVariable("numRecoTrackerClusters"); + reg_tuples_[regname]->addVariable("numSimEcalHits"); + reg_tuples_[regname]->addVariable("numRecoEcalClusters"); + reg_tuples_[regname]->addVector("particle_pdgid"); + reg_tuples_[regname]->addVector("ele_px"); + reg_tuples_[regname]->addVector("ele_py"); + reg_tuples_[regname]->addVector("ele_pz"); + reg_tuples_[regname]->addVector("ele_p"); + reg_tuples_[regname]->addVector("ele_energy"); + reg_tuples_[regname]->addVector("ele_pxpy"); + reg_tuples_[regname]->addVector("ele_pypz"); + reg_tuples_[regname]->addVector("track_n_hits"); + reg_tuples_[regname]->addVector("track_px"); + reg_tuples_[regname]->addVector("track_py"); + reg_tuples_[regname]->addVector("track_pz"); + reg_tuples_[regname]->addVector("track_p"); + reg_tuples_[regname]->addVector("track_phi0"); + reg_tuples_[regname]->addVector("track_tanlambda"); + reg_tuples_[regname]->addVector("track_x"); + reg_tuples_[regname]->addVector("track_y"); + reg_tuples_[regname]->addVector("track_ecal_x"); + reg_tuples_[regname]->addVector("track_ecal_y"); + reg_tuples_[regname]->addVector("ecal_n_hits"); + reg_tuples_[regname]->addVector("ecal_energy"); + reg_tuples_[regname]->addVector("ecal_x"); + reg_tuples_[regname]->addVector("ecal_y"); regions_.push_back(regname); } From 810010fd1429263b7a546ea72be0da60c0a3e68d Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:57:32 -0700 Subject: [PATCH 18/71] minor fix --- processors/include/SimPartProcessor.h | 7 ++++--- processors/src/SimPartProcessor.cxx | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index caa1c0bbd..5e821791e 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -81,14 +81,14 @@ class SimPartProcessor : public Processor { TTree* tree_; TBranch* bMCParticles_{nullptr}; //!< description TBranch* bMCTrackerHits_{nullptr}; //!< description - TBranch* bMCECalHits_{nullptr}; //!< description + TBranch* bMCEcalHits_{nullptr}; //!< description TBranch* bRecoTracks_{nullptr}; //!< description TBranch* bRecoTrackerClusters_{nullptr}; //!< description TBranch* bRecoEcalClusters_{nullptr}; //!< description std::vector * MCParticles_{nullptr}; //!< description std::vector * MCTrackerHits_{nullptr}; //!< description - std::vector * MCECalHits_{nullptr}; //!< description + std::vector * MCEcalHits_{nullptr}; //!< description std::vector * RecoTracks_{nullptr}; //!< description std::vector * RecoTrackerClusters_{nullptr}; //!< description std::vector * RecoEcalClusters_{nullptr}; //!< description @@ -110,7 +110,8 @@ class SimPartProcessor : public Processor { std::map> reg_histos_; //!< description typedef std::map>::iterator reg_it; //!< description - std::map> reg_tuples_; //!< description + //std::map> reg_tuples_; //!< description + std::map reg_tuples_; //!< description int debug_{0}; //!< Debug Level diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 83aae1e4b..79365f5d9 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -88,7 +88,8 @@ void SimPartProcessor::initialize(TTree* tree) { reg_histos_[regname]->loadHistoConfig(histCfgFilename_); reg_histos_[regname]->DefineHistos(); - reg_tuples_[regname] = std::make_shared(anaName_+"_"+regname+"_tree"); + //reg_tuples_[regname] = std::make_shared(anaName_+"_"+regname+"_tree"); + reg_tuples_[regname] = new FlatTupleMaker(anaName_+"_"+regname+"_tree"); reg_tuples_[regname]->addVariable("numMCparts"); reg_tuples_[regname]->addVariable("numRecoTracks"); reg_tuples_[regname]->addVariable("numSimTrackerHits"); @@ -130,7 +131,7 @@ void SimPartProcessor::initialize(TTree* tree) { else std::cout<<"WARNING: No MC tracker hit collection"<FindBranch(MCEcalHitColl_.c_str())) - tree_->SetBranchAddress(MCEcalHitColl_.c_str(), &MCECalHits_, &bMCECalHits_); + tree_->SetBranchAddress(MCEcalHitColl_.c_str(), &MCEcalHits_, &bMCEcalHits_); else std::cout<<"WARNING: No MC Ecal hit collection"<passCutGt("n_simpart_gt", nParts, weight)) - continue; + return true; histos->Fill1DHisto("numMCparts_h", (float)nParts, weight); histos->Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); @@ -201,7 +202,7 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->FillRecoEcalCuster(ecal_cluster, tuples); } - tuple->fill(); + tuples->fill(); // Regions for (auto region : regions_ ) { From 7d560e007a522fe7621260ec1aacf870920c8467 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 13:59:19 -0700 Subject: [PATCH 19/71] minor fix --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 79365f5d9..3bb4b503a 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -280,7 +280,7 @@ void SimPartProcessor::finalize() { outF_->cd(dirName.c_str()); reg_selectors_[it->first]->getCutFlowHisto()->Scale(0.5); reg_selectors_[it->first]->getCutFlowHisto()->Write(); - reg_tuples_[region]->writeTree(); + reg_tuples_[it->first]->writeTree(); outF_->cd(); } outF_->Close(); From 9209411d5afe209aebe86968597e327807fdc1eb Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 20 Oct 2023 14:09:41 -0700 Subject: [PATCH 20/71] minor fix --- analysis/plotconfigs/mc/simPart.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 62447353a..dec2506a9 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -49,15 +49,15 @@ "ytitle" : "Events" }, "ele_px_h" : { - "bins" : 100, - "minX" : 0, + "bins" : 200, + "minX" : -10, "maxX" : 10, "xtitle" : "ele p_{x}", "ytitle" : "Events" }, "ele_py_h" : { - "bins" : 100, - "minX" : 0, + "bins" : 200, + "minX" : -10, "maxX" : 10, "xtitle" : "ele p_{y}", "ytitle" : "Events" @@ -91,15 +91,15 @@ "ytitle" : "Events" }, "track_px_h" : { - "bins" : 100, - "minX" : 0, + "bins" : 200, + "minX" : -10, "maxX" : 10, "xtitle" : "Track p_{x}", "ytitle" : "Events" }, "track_py_h" : { - "bins" : 100, - "minX" : 0, + "bins" : 200, + "minX" : -10, "maxX" : 10, "xtitle" : "Track p_{y}", "ytitle" : "Events" From b1f284dd2cf19bc4394112735a0d203d32a3afc8 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 25 Oct 2023 23:58:38 -0700 Subject: [PATCH 21/71] add additional plots and variables --- analysis/plotconfigs/mc/simPart.json | 88 +++++++++++-- analysis/selections/simPart/1Sim_1Track.json | 12 ++ analysis/selections/simPart/1Track_1Ecal.json | 12 ++ .../selections/simPart/1Track_neg_Omega.json | 12 ++ .../selections/simPart/1Track_pos_Omega.json | 27 ++++ analysis/selections/simPart/Ecal.json | 7 + analysis/selections/simPart/Track.json | 7 + analysis/selections/simPart/Track_Ecal.json | 27 ++++ analysis/selections/simPart/Track_nhit10.json | 17 +-- analysis/selections/simPart/Track_nhit11.json | 17 +-- analysis/selections/simPart/Track_nhit12.json | 17 +-- analysis/selections/simPart/Track_nhit13.json | 17 +-- analysis/selections/simPart/Track_nhit14.json | 17 +-- analysis/selections/simPart/Track_nhit7.json | 17 +-- analysis/selections/simPart/Track_nhit8.json | 17 +-- analysis/selections/simPart/Track_nhit9.json | 17 +-- analysis/selections/simPart/Track_noEcal.json | 21 +-- analysis/selections/simPart/noEcal.json | 24 +--- analysis/selections/simPart/noTrack.json | 24 +--- analysis/selections/simPart/noTrack_Ecal.json | 21 +-- .../selections/simPart/noTrack_noEcal.json | 12 ++ analysis/selections/simPart/simPartAna.json | 5 + analysis/src/SimPartHistos.cxx | 41 +++--- processors/config/simPartAna_cfg.py | 10 +- processors/src/SimPartProcessor.cxx | 123 +++++++++++++++--- 25 files changed, 348 insertions(+), 261 deletions(-) create mode 100644 analysis/selections/simPart/1Sim_1Track.json create mode 100644 analysis/selections/simPart/1Track_1Ecal.json create mode 100644 analysis/selections/simPart/1Track_neg_Omega.json create mode 100644 analysis/selections/simPart/1Track_pos_Omega.json create mode 100644 analysis/selections/simPart/Ecal.json create mode 100644 analysis/selections/simPart/Track.json create mode 100644 analysis/selections/simPart/Track_Ecal.json create mode 100644 analysis/selections/simPart/noTrack_noEcal.json diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index dec2506a9..ce950b5e1 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -41,46 +41,46 @@ "xtitle" : "Number of Reco Ecal Clusters", "ytitle" : "Events" }, - "particle_pdgid_h" : { + "sim_pdgid_h" : { "bins" : 100, "minX" : -50, "maxX" : 50, "xtitle" : "PDG ID of Sim Particles", "ytitle" : "Events" }, - "ele_px_h" : { + "sim_px_h" : { "bins" : 200, "minX" : -10, "maxX" : 10, - "xtitle" : "ele p_{x}", + "xtitle" : "sim p_{x}", "ytitle" : "Events" }, - "ele_py_h" : { + "sim_py_h" : { "bins" : 200, "minX" : -10, "maxX" : 10, - "xtitle" : "ele p_{y}", + "xtitle" : "sim p_{y}", "ytitle" : "Events" }, - "ele_pz_h" : { + "sim_pz_h" : { "bins" : 100, "minX" : 0, "maxX" : 10, - "xtitle" : "ele p_{z}", + "xtitle" : "sim p_{z}", "ytitle" : "Events" }, - "ele_p_h" : { + "sim_p_h" : { "bins" : 100, "minX" : 0, "maxX" : 10, - "xtitle" : "ele p", + "xtitle" : "sim p", "ytitle" : "Events" }, - "ele_energy_h" : { + "sim_energy_h" : { "bins" : 100, "minX" : 0, "maxX" : 10, - "xtitle" : "ele energy", + "xtitle" : "sim energy", "ytitle" : "Events" }, "track_n_hits_h" : { @@ -132,15 +132,55 @@ "xtitle" : "ECal energy", "ytitle" : "Events" }, - "ele_pxpz_pypz_hh" : { + "sim_pxpz_pypz_hh" : { "binsX" : 2000, "minX" : -0.8, "maxX" : 0.8, "binsY" : 500, "minY" : -0.2, "maxY" : 0.2, - "xtitle" : "ele p_{x}/p_{z}", - "ytitle" : "ele p_{y}/p_{z}" + "xtitle" : "sim p_{x}/p_{z}", + "ytitle" : "sim p_{y}/p_{z}" + }, + "sim_pxpz_p_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "sim p_{x}/p_{z}", + "ytitle" : "sim p" + }, + "sim_pxpz_energy_hh" : { + "binsX" : 2000, + "minX" : -0.8, + "maxX" : 0.8, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "sim p_{x}/p_{z}", + "ytitle" : "sim energy" + }, + "track_sim_p_sim_p_hh" : { + "binsX" : 100, + "minX" : 0, + "maxX" : 1, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "track p / sim p", + "ytitle" : "sim p" + }, + "track_phi0_p_hh" : { + "binsX" : 2000, + "minX" : -0.2, + "maxX" : 0.3, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Track p" }, "track_phi0_tanlambda_hh" : { "binsX" : 2000, @@ -152,6 +192,16 @@ "xtitle" : "Track #{phi}_{0}", "ytitle" : "Track tan#{lambda}}" }, + "track_z0_tanlambda_hh" : { + "binsX" : 2000, + "minX" : -100, + "maxX" : 100, + "binsY" : 500, + "minY" : -0.15, + "maxY" : 0.15, + "xtitle" : "Track #z_{0}", + "ytitle" : "Track tan#{lambda}}" + }, "track_x_y_hh" : { "binsX" : 2000, "minX" : -340, @@ -181,5 +231,15 @@ "maxY" : 100, "xtitle" : "Ecal cluster x", "ytitle" : "Ecal cluster y" + }, + "track_ecal_x_track_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at ECal) x - Ecal x", + "ytitle" : "Track p" } } diff --git a/analysis/selections/simPart/1Sim_1Track.json b/analysis/selections/simPart/1Sim_1Track.json new file mode 100644 index 000000000..b4c38ce9e --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track.json @@ -0,0 +1,12 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1, + "id" : 1, + "info" : "N Tracks == 1" + } +} diff --git a/analysis/selections/simPart/1Track_1Ecal.json b/analysis/selections/simPart/1Track_1Ecal.json new file mode 100644 index 000000000..1b6f99e21 --- /dev/null +++ b/analysis/selections/simPart/1Track_1Ecal.json @@ -0,0 +1,12 @@ +{ + "n_track_eq" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters == 1" + } +} diff --git a/analysis/selections/simPart/1Track_neg_Omega.json b/analysis/selections/simPart/1Track_neg_Omega.json new file mode 100644 index 000000000..155a4c65d --- /dev/null +++ b/analysis/selections/simPart/1Track_neg_Omega.json @@ -0,0 +1,12 @@ +{ + "n_track_eq" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks == 1" + }, + "track_omega_lt" : { + "cut" : 0.0, + "id" : 1, + "info" : "N Ecal Clusters <= 0" + } +} diff --git a/analysis/selections/simPart/1Track_pos_Omega.json b/analysis/selections/simPart/1Track_pos_Omega.json new file mode 100644 index 000000000..4764c0790 --- /dev/null +++ b/analysis/selections/simPart/1Track_pos_Omega.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks >= 0" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 1, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 2, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 0.0, + "id" : 3, + "info" : "N Ecal Clusters <= 0" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/Ecal.json b/analysis/selections/simPart/Ecal.json new file mode 100644 index 000000000..15b922127 --- /dev/null +++ b/analysis/selections/simPart/Ecal.json @@ -0,0 +1,7 @@ +{ + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Ecal Clusters >= 1" + } +} diff --git a/analysis/selections/simPart/Track.json b/analysis/selections/simPart/Track.json new file mode 100644 index 000000000..1bc604384 --- /dev/null +++ b/analysis/selections/simPart/Track.json @@ -0,0 +1,7 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + } +} diff --git a/analysis/selections/simPart/Track_Ecal.json b/analysis/selections/simPart/Track_Ecal.json new file mode 100644 index 000000000..4764c0790 --- /dev/null +++ b/analysis/selections/simPart/Track_Ecal.json @@ -0,0 +1,27 @@ +{ + "n_track_gt" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks >= 0" + }, + "n_track_lt" : { + "cut" : 99999.0, + "id" : 1, + "info" : "N Tracks <= 99999" + }, + "n_ecal_cluster_gt" : { + "cut" : 0.0, + "id" : 2, + "info" : "N Ecal Clusters >= 0" + }, + "n_ecal_cluster_lt" : { + "cut" : 0.0, + "id" : 3, + "info" : "N Ecal Clusters <= 0" + }, + "n_track_hits_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "N Reco Track Hits >= 0" + } +} diff --git a/analysis/selections/simPart/Track_nhit10.json b/analysis/selections/simPart/Track_nhit10.json index 642198b44..d31ad7197 100644 --- a/analysis/selections/simPart/Track_nhit10.json +++ b/analysis/selections/simPart/Track_nhit10.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 10.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 10" } } diff --git a/analysis/selections/simPart/Track_nhit11.json b/analysis/selections/simPart/Track_nhit11.json index b8157fa65..1142136a7 100644 --- a/analysis/selections/simPart/Track_nhit11.json +++ b/analysis/selections/simPart/Track_nhit11.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 11.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 11" } } diff --git a/analysis/selections/simPart/Track_nhit12.json b/analysis/selections/simPart/Track_nhit12.json index 8d3c3df78..fca2ecd97 100644 --- a/analysis/selections/simPart/Track_nhit12.json +++ b/analysis/selections/simPart/Track_nhit12.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 12.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 12" } } diff --git a/analysis/selections/simPart/Track_nhit13.json b/analysis/selections/simPart/Track_nhit13.json index 3ce5f67d4..968a0cd38 100644 --- a/analysis/selections/simPart/Track_nhit13.json +++ b/analysis/selections/simPart/Track_nhit13.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 13.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 13" } } diff --git a/analysis/selections/simPart/Track_nhit14.json b/analysis/selections/simPart/Track_nhit14.json index dab51a0df..f621515b9 100644 --- a/analysis/selections/simPart/Track_nhit14.json +++ b/analysis/selections/simPart/Track_nhit14.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 14.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 14" } } diff --git a/analysis/selections/simPart/Track_nhit7.json b/analysis/selections/simPart/Track_nhit7.json index 68f39abd2..d7b7ed41d 100644 --- a/analysis/selections/simPart/Track_nhit7.json +++ b/analysis/selections/simPart/Track_nhit7.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 7.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 7" } } diff --git a/analysis/selections/simPart/Track_nhit8.json b/analysis/selections/simPart/Track_nhit8.json index e481e8357..3714b7376 100644 --- a/analysis/selections/simPart/Track_nhit8.json +++ b/analysis/selections/simPart/Track_nhit8.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 8.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 8" } } diff --git a/analysis/selections/simPart/Track_nhit9.json b/analysis/selections/simPart/Track_nhit9.json index b4abd481e..c691a7038 100644 --- a/analysis/selections/simPart/Track_nhit9.json +++ b/analysis/selections/simPart/Track_nhit9.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, "n_track_hits_gt" : { "cut" : 9.0, - "id" : 0, + "id" : 1, "info" : "N Reco Track Hits >= 9" } } diff --git a/analysis/selections/simPart/Track_noEcal.json b/analysis/selections/simPart/Track_noEcal.json index b4b2046ce..3be6adfff 100644 --- a/analysis/selections/simPart/Track_noEcal.json +++ b/analysis/selections/simPart/Track_noEcal.json @@ -4,24 +4,9 @@ "id" : 0, "info" : "N Tracks >= 1" }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { + "n_ecal_cluster_eq" : { "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters <= 0" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Reco Track Hits >= 0" + "id" : 1, + "info" : "N Ecal Clusters == 0" } } diff --git a/analysis/selections/simPart/noEcal.json b/analysis/selections/simPart/noEcal.json index 8e5e70d90..aa127c4f0 100644 --- a/analysis/selections/simPart/noEcal.json +++ b/analysis/selections/simPart/noEcal.json @@ -1,27 +1,7 @@ { - "n_track_gt" : { + "n_ecal_cluster_eq" : { "cut" : 0.0, "id" : 0, - "info" : "N Tracks >= 0" - }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Tracks <= 99999" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters <= 0" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Reco Track Hits >= 0" + "info" : "N Ecal Clusters == 0" } } diff --git a/analysis/selections/simPart/noTrack.json b/analysis/selections/simPart/noTrack.json index c749edd34..a56537bec 100644 --- a/analysis/selections/simPart/noTrack.json +++ b/analysis/selections/simPart/noTrack.json @@ -1,27 +1,7 @@ { - "n_track_gt" : { + "n_track_eq" : { "cut" : 0.0, "id" : 0, - "info" : "N Tracks >= 0" - }, - "n_track_lt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Tracks <= 0" - }, - "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Reco Track Hits >= 0" + "info" : "N Tracks == 0" } } diff --git a/analysis/selections/simPart/noTrack_Ecal.json b/analysis/selections/simPart/noTrack_Ecal.json index ec472cd0c..cd9c58d32 100644 --- a/analysis/selections/simPart/noTrack_Ecal.json +++ b/analysis/selections/simPart/noTrack_Ecal.json @@ -1,27 +1,12 @@ { - "n_track_gt" : { + "n_track_eq" : { "cut" : 0.0, "id" : 0, - "info" : "N Tracks >= 0" - }, - "n_track_lt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Tracks <= 0" + "info" : "N Tracks == 0" }, "n_ecal_cluster_gt" : { "cut" : 1.0, - "id" : 0, + "id" : 1, "info" : "N Ecal Clusters >= 1" - }, - "n_ecal_cluster_lt" : { - "cut" : 99999.0, - "id" : 0, - "info" : "N Ecal Clusters <= 99999" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 0, - "info" : "N Reco Track Hits >= 0" } } diff --git a/analysis/selections/simPart/noTrack_noEcal.json b/analysis/selections/simPart/noTrack_noEcal.json new file mode 100644 index 000000000..8fab98fde --- /dev/null +++ b/analysis/selections/simPart/noTrack_noEcal.json @@ -0,0 +1,12 @@ +{ + "n_track_eq" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks == 0" + }, + "n_ecal_cluster_eq" : { + "cut" : 0.0, + "id" : 1, + "info" : "N Ecal Clusters == 0" + } +} diff --git a/analysis/selections/simPart/simPartAna.json b/analysis/selections/simPart/simPartAna.json index 4654066fc..57ee02e6b 100644 --- a/analysis/selections/simPart/simPartAna.json +++ b/analysis/selections/simPart/simPartAna.json @@ -3,5 +3,10 @@ "cut" : 1, "id" : 0, "info" : "N Sim Particles >= 1" + }, + "n_simpart_lt" : { + "cut" : 0, + "id" : 1, + "info" : "N Sim Particles <= 0" } } diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index fa580c1d9..6a62a961a 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -10,23 +10,23 @@ void SimPartHistos::FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, flo double p = sqrt(px*px + py*py + pz*pz); double energy = part->getEnergy(); - Fill1DHisto("particle_pdgid_h", pdg, weight); + Fill1DHisto("sim_pdgid_h", pdg, weight); + Fill1DHisto("sim_px_h", px, weight); + Fill1DHisto("sim_py_h", py, weight); + Fill1DHisto("sim_pz_h", pz, weight); + Fill1DHisto("sim_p_h", p, weight); + Fill1DHisto("sim_energy_h", energy, weight); + Fill2DHisto("sim_pxpz_pypz_hh", px/pz, py/pz, weight); + Fill2DHisto("sim_pxpz_p_hh", px/pz, p, weight); + Fill2DHisto("sim_pxpz_energy_hh", px/pz, energy, weight); tuples->addToVector("particle_pdgid", pdg); - if (pdg == 11) { - Fill1DHisto("ele_px_h", px, weight); - Fill1DHisto("ele_py_h", py, weight); - Fill1DHisto("ele_pz_h", pz, weight); - Fill1DHisto("ele_p_h", p, weight); - Fill1DHisto("ele_energy_h", energy, weight); - Fill2DHisto("ele_pxpz_pypz_hh", px/pz, py/pz, weight); - tuples->addToVector("ele_px", px); - tuples->addToVector("ele_py", py); - tuples->addToVector("ele_pz", pz); - tuples->addToVector("ele_p", p); - tuples->addToVector("ele_energy", energy); - tuples->addToVector("ele_pxpy", px/pz); - tuples->addToVector("ele_pypz", py/pz); - } + tuples->addToVector("sim_px", px); + tuples->addToVector("sim_py", py); + tuples->addToVector("sim_pz", pz); + tuples->addToVector("sim_p", p); + tuples->addToVector("sim_energy", energy); + tuples->addToVector("sim_pxpz", px/pz); + tuples->addToVector("sim_pypz", py/pz); } void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight){ @@ -38,6 +38,9 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we int n_hits = track->getTrackerHitCount(); double phi0 = track->getPhi(); double tan_lambda = track->getTanLambda(); + double d0 = track->getD0(); + double z0 = track->getZ0(); + double omega = track->getOmega(); std::vector position_V = track->getPosition(); double track_x = position_V.at(0); @@ -57,7 +60,9 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we Fill1DHisto("track_py_h", py, weight); Fill1DHisto("track_pz_h", pz, weight); Fill1DHisto("track_p_h", p, weight); + Fill2DHisto("track_phi0_p_hh", phi0, p, weight); Fill2DHisto("track_phi0_tanlambda_hh", phi0, tan_lambda, weight); + Fill2DHisto("track_z0_tanlambda_hh", z0, tan_lambda, weight); Fill2DHisto("track_x_y_hh", track_x, track_y, weight); Fill2DHisto("track_ecal_x_y_hh", track_ecal_x, track_ecal_y, weight); @@ -68,6 +73,9 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we tuples->addToVector("track_p", p); tuples->addToVector("track_phi0", phi0); tuples->addToVector("track_tanlambda", tan_lambda); + tuples->addToVector("track_d0", d0); + tuples->addToVector("track_z0", z0); + tuples->addToVector("track_omega", omega); tuples->addToVector("track_x", track_x); tuples->addToVector("track_y", track_y); tuples->addToVector("track_ecal_x", track_ecal_x); @@ -93,4 +101,3 @@ void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* - diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index ba77131db..e9d5768de 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -56,10 +56,18 @@ sim_part_ana.parameters["selectionjson"] = os.environ['HPSTR_BASE']+'/analysis/selections/simPart/simPartAna.json' RegionPath = os.environ['HPSTR_BASE']+"/analysis/selections/simPart/" -sim_part_ana.parameters["regionDefinitions"] = [RegionPath+'noTrack.json', +sim_part_ana.parameters["regionDefinitions"] = [RegionPath+'1Sim_1Track.json', + RegionPath+'Track.json', + RegionPath+'Ecal.json', + RegionPath+'1Track_1Ecal.json', + RegionPath+'Track_Ecal.json', + RegionPath+'noTrack.json', RegionPath+'noTrack_Ecal.json', RegionPath+'noEcal.json', RegionPath+'Track_noEcal.json', + RegionPath+'noTrack_noEcal.json', + RegionPath+'1Track_pos_Omega.json', + RegionPath+'1Track_neg_Omega.json', RegionPath+'Track_nhit7.json', RegionPath+'Track_nhit8.json', RegionPath+'Track_nhit9.json', diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 3bb4b503a..5d9c4b06e 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -47,14 +47,14 @@ void SimPartProcessor::initialize(TTree* tree) { tuples->addVariable("numRecoTrackerClusters"); tuples->addVariable("numSimEcalHits"); tuples->addVariable("numRecoEcalClusters"); - tuples->addVector("particle_pdgid"); - tuples->addVector("ele_px"); - tuples->addVector("ele_py"); - tuples->addVector("ele_pz"); - tuples->addVector("ele_p"); - tuples->addVector("ele_energy"); - tuples->addVector("ele_pxpy"); - tuples->addVector("ele_pypz"); + tuples->addVector("sim_pdgid"); + tuples->addVector("sim_px"); + tuples->addVector("sim_py"); + tuples->addVector("sim_pz"); + tuples->addVector("sim_p"); + tuples->addVector("sim_energy"); + tuples->addVector("sim_pxpz"); + tuples->addVector("sim_pypz"); tuples->addVector("track_n_hits"); tuples->addVector("track_px"); tuples->addVector("track_py"); @@ -62,6 +62,9 @@ void SimPartProcessor::initialize(TTree* tree) { tuples->addVector("track_p"); tuples->addVector("track_phi0"); tuples->addVector("track_tanlambda"); + tuples->addVector("track_d0"); + tuples->addVector("track_z0"); + tuples->addVector("track_omega"); tuples->addVector("track_x"); tuples->addVector("track_y"); tuples->addVector("track_ecal_x"); @@ -96,14 +99,14 @@ void SimPartProcessor::initialize(TTree* tree) { reg_tuples_[regname]->addVariable("numRecoTrackerClusters"); reg_tuples_[regname]->addVariable("numSimEcalHits"); reg_tuples_[regname]->addVariable("numRecoEcalClusters"); - reg_tuples_[regname]->addVector("particle_pdgid"); - reg_tuples_[regname]->addVector("ele_px"); - reg_tuples_[regname]->addVector("ele_py"); - reg_tuples_[regname]->addVector("ele_pz"); - reg_tuples_[regname]->addVector("ele_p"); - reg_tuples_[regname]->addVector("ele_energy"); - reg_tuples_[regname]->addVector("ele_pxpy"); - reg_tuples_[regname]->addVector("ele_pypz"); + reg_tuples_[regname]->addVector("sim_pdgid"); + reg_tuples_[regname]->addVector("sim_px"); + reg_tuples_[regname]->addVector("sim_py"); + reg_tuples_[regname]->addVector("sim_pz"); + reg_tuples_[regname]->addVector("sim_p"); + reg_tuples_[regname]->addVector("sim_energy"); + reg_tuples_[regname]->addVector("sim_pxpz"); + reg_tuples_[regname]->addVector("sim_pypz"); reg_tuples_[regname]->addVector("track_n_hits"); reg_tuples_[regname]->addVector("track_px"); reg_tuples_[regname]->addVector("track_py"); @@ -111,6 +114,9 @@ void SimPartProcessor::initialize(TTree* tree) { reg_tuples_[regname]->addVector("track_p"); reg_tuples_[regname]->addVector("track_phi0"); reg_tuples_[regname]->addVector("track_tanlambda"); + reg_tuples_[regname]->addVector("track_d0"); + reg_tuples_[regname]->addVector("track_z0"); + reg_tuples_[regname]->addVector("track_omega"); reg_tuples_[regname]->addVector("track_x"); reg_tuples_[regname]->addVector("track_y"); reg_tuples_[regname]->addVector("track_ecal_x"); @@ -166,6 +172,8 @@ bool SimPartProcessor::process(IEvent* ievent) { // Event Selection if (EventSelector_ && !EventSelector_->passCutGt("n_simpart_gt", nParts, weight)) return true; + //if (EventSelector_ && !EventSelector_->passCutLt("n_simpart_lt", nParts, weight)) + // return true; histos->Fill1DHisto("numMCparts_h", (float)nParts, weight); histos->Fill1DHisto("numRecoTracks_h", (float)nReco_Tracks, weight); @@ -180,48 +188,91 @@ bool SimPartProcessor::process(IEvent* ievent) { tuples->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); tuples->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); + double sim_max_p = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); if (gen != 1) continue; histos->FillMCParticle(part, tuples); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + double p = sqrt(px*px + py*py + pz*pz); + if (p > sim_max_p){ + sim_max_p = p; + } } int min_n_Track_hits = 99999; + double track_omega = -99999; + double track_max_p_ecal_x = -99999; for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); if (n_hits < min_n_Track_hits) min_n_Track_hits = n_hits; histos->FillRecoTrack(track, tuples); + track_omega = track->getOmega(); + double p = track->getP(); + if (p > track_max_p){ + track_max_p = p; + track_max_p_ecal_x = track->getPositionAtEcal().at(0); + } } + if (nReco_Tracks > 1) + track_omega = -99999; + double ecal_max_energy = -99999; + double ecal_max_p_x = -99999; for (int i=0; iat(i); histos->FillRecoEcalCuster(ecal_cluster, tuples); + double energy = ecal_cluster->getEnergy(); + if (energy > ecal_max_energy){ + ecal_max_energy = energy; + ecal_max_p_x = ecal_cluster->getPositionAtEcal().at(0) + } } + Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + tuples->fill(); // Regions for (auto region : regions_ ) { reg_selectors_[region]->getCutFlowHisto()->Fill(0.,weight); - if(debug_) std::cout<<"Check for region "<passCutEq("n_sim_eq", nParts, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of Sim Particles Eq cut"<passCutEq("n_track_eq", nReco_Tracks, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of Tracks Eq cut"<passCutGt("n_track_gt", nReco_Tracks, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of Tracks Gt cut"<passCutLt("n_track_lt", nReco_Tracks, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of Tracks Lt cut"<passCutEq("n_ecal_cluster_eq", nReco_Ecal_clusters, weight) ) continue; + if(debug_) std::cout<<"Pass Nr. of ECal Clusters Eq cut"<passCutGt("n_ecal_cluster_gt", nReco_Ecal_clusters, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of ECal Clusters Gt cut"<passCutLt("n_ecal_cluster_lt", nReco_Ecal_clusters, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of ECal Clusters Lt cut"<passCutGt("track_omega_gt", track_omega, weight) ) continue; + if(debug_) std::cout<<"Pass Track Omega Gt cut"<passCutLt("track_omega_lt", track_omega, weight) ) continue; + if(debug_) std::cout<<"Pass Track Omega Lt cut"<passCutGt("n_track_hits_gt", min_n_Track_hits, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of Track Hits Gt cut"<setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); + double sim_max_p = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); if (gen != 1) continue; - reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); + histos->FillMCParticle(part, tuples); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + double p = sqrt(px*px + py*py + pz*pz); + if (p > sim_max_p){ + sim_max_p = p; + } } + int min_n_Track_hits = 99999; + double track_omega = -99999; + double track_max_p_ecal_x = -99999; for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); - reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); + if (n_hits < min_n_Track_hits) + min_n_Track_hits = n_hits; + histos->FillRecoTrack(track, tuples); + track_omega = track->getOmega(); + double p = track->getP(); + if (p > track_max_p){ + track_max_p = p; + track_max_p_ecal_x = track->getPositionAtEcal().at(0); + } } + if (nReco_Tracks > 1) + track_omega = -99999; + double ecal_max_energy = -99999; + double ecal_max_p_x = -99999; for (int i=0; iat(i); - reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); + histos->FillRecoEcalCuster(ecal_cluster, tuples); + double energy = ecal_cluster->getEnergy(); + if (energy > ecal_max_energy){ + ecal_max_energy = energy; + ecal_max_p_x = ecal_cluster->getPositionAtEcal().at(0) + } } - reg_tuples_[region]->fill(); + + Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); } return true; From f7c9524cce9812b5a1d7e88bf81bbf3e886f246e Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 27 Oct 2023 23:57:18 -0700 Subject: [PATCH 22/71] bug fixes --- processors/src/SimPartProcessor.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 5d9c4b06e..2522e3852 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -195,6 +195,7 @@ bool SimPartProcessor::process(IEvent* ievent) { if (gen != 1) continue; histos->FillMCParticle(part, tuples); + std::vector momentum_V = part->getMomentum(); double px = momentum_V.at(0); double py = momentum_V.at(1); double pz = momentum_V.at(2); @@ -207,6 +208,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int min_n_Track_hits = 99999; double track_omega = -99999; double track_max_p_ecal_x = -99999; + double track_max_p = -99999; for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); @@ -231,12 +233,12 @@ bool SimPartProcessor::process(IEvent* ievent) { double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; - ecal_max_p_x = ecal_cluster->getPositionAtEcal().at(0) + ecal_max_p_x = ecal_cluster->getPosition().at(0) } } - Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); - Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); tuples->fill(); @@ -298,6 +300,7 @@ bool SimPartProcessor::process(IEvent* ievent) { if (gen != 1) continue; histos->FillMCParticle(part, tuples); + std::vector momentum_V = part->getMomentum(); double px = momentum_V.at(0); double py = momentum_V.at(1); double pz = momentum_V.at(2); @@ -334,12 +337,12 @@ bool SimPartProcessor::process(IEvent* ievent) { double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; - ecal_max_p_x = ecal_cluster->getPositionAtEcal().at(0) + ecal_max_p_x = ecal_cluster->getPosition().at(0) } } - Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); - Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); } return true; From e0e792da8f973c2bc9016a91ec727f23a503c2fd Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 28 Oct 2023 00:04:27 -0700 Subject: [PATCH 23/71] bug fixes --- processors/src/SimPartProcessor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 2522e3852..95df08a3a 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -233,7 +233,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; - ecal_max_p_x = ecal_cluster->getPosition().at(0) + ecal_max_p_x = ecal_cluster->getPosition().at(0); } } @@ -337,7 +337,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; - ecal_max_p_x = ecal_cluster->getPosition().at(0) + ecal_max_p_x = ecal_cluster->getPosition().at(0); } } From ebbaa13cde44f9c81b2db625e8232225e7c42182 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 28 Oct 2023 10:24:22 -0700 Subject: [PATCH 24/71] fix selections and histos --- .../selections/simPart/1Track_pos_Omega.json | 25 ++++--------------- analysis/selections/simPart/Track_Ecal.json | 25 ++++--------------- processors/src/SimPartProcessor.cxx | 10 ++++---- 3 files changed, 15 insertions(+), 45 deletions(-) diff --git a/analysis/selections/simPart/1Track_pos_Omega.json b/analysis/selections/simPart/1Track_pos_Omega.json index 4764c0790..0284b549c 100644 --- a/analysis/selections/simPart/1Track_pos_Omega.json +++ b/analysis/selections/simPart/1Track_pos_Omega.json @@ -1,27 +1,12 @@ { - "n_track_gt" : { - "cut" : 0.0, + "n_track_eq" : { + "cut" : 1.0, "id" : 0, - "info" : "N Tracks >= 0" - }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 1, - "info" : "N Tracks <= 99999" + "info" : "N Tracks == 1" }, - "n_ecal_cluster_gt" : { + "track_omega_gt" : { "cut" : 0.0, - "id" : 2, + "id" : 1, "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 0.0, - "id" : 3, - "info" : "N Ecal Clusters <= 0" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 4, - "info" : "N Reco Track Hits >= 0" } } diff --git a/analysis/selections/simPart/Track_Ecal.json b/analysis/selections/simPart/Track_Ecal.json index 4764c0790..58e31a8aa 100644 --- a/analysis/selections/simPart/Track_Ecal.json +++ b/analysis/selections/simPart/Track_Ecal.json @@ -1,27 +1,12 @@ { "n_track_gt" : { - "cut" : 0.0, + "cut" : 1.0, "id" : 0, - "info" : "N Tracks >= 0" - }, - "n_track_lt" : { - "cut" : 99999.0, - "id" : 1, - "info" : "N Tracks <= 99999" + "info" : "N Tracks >= 1" }, "n_ecal_cluster_gt" : { - "cut" : 0.0, - "id" : 2, - "info" : "N Ecal Clusters >= 0" - }, - "n_ecal_cluster_lt" : { - "cut" : 0.0, - "id" : 3, - "info" : "N Ecal Clusters <= 0" - }, - "n_track_hits_gt" : { - "cut" : 0.0, - "id" : 4, - "info" : "N Reco Track Hits >= 0" + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" } } diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 95df08a3a..6318b79c7 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -299,7 +299,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int gen = part->getGenStatus(); if (gen != 1) continue; - histos->FillMCParticle(part, tuples); + reg_histos_[region]->FillMCParticle(part, tuples); std::vector momentum_V = part->getMomentum(); double px = momentum_V.at(0); double py = momentum_V.at(1); @@ -318,7 +318,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int n_hits = track->getTrackerHitCount(); if (n_hits < min_n_Track_hits) min_n_Track_hits = n_hits; - histos->FillRecoTrack(track, tuples); + reg_histos_[region]->FillRecoTrack(track, tuples); track_omega = track->getOmega(); double p = track->getP(); if (p > track_max_p){ @@ -333,7 +333,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x = -99999; for (int i=0; iat(i); - histos->FillRecoEcalCuster(ecal_cluster, tuples); + hisreg_histos_[region]tos->FillRecoEcalCuster(ecal_cluster, tuples); double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; @@ -341,8 +341,8 @@ bool SimPartProcessor::process(IEvent* ievent) { } } - histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); - histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); } return true; From 7b05500da91de99ba5518c33e20aa00d22cf4791 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 28 Oct 2023 10:26:54 -0700 Subject: [PATCH 25/71] minor fiz --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 6318b79c7..65ba315ba 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -333,7 +333,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x = -99999; for (int i=0; iat(i); - hisreg_histos_[region]tos->FillRecoEcalCuster(ecal_cluster, tuples); + reg_histos_[region]tos->FillRecoEcalCuster(ecal_cluster, tuples); double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; From 8f9a16d8d8005ef2cd56ea4ebe21e720b6e59b63 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 28 Oct 2023 10:28:26 -0700 Subject: [PATCH 26/71] minor fiz --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 65ba315ba..700a4971b 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -333,7 +333,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x = -99999; for (int i=0; iat(i); - reg_histos_[region]tos->FillRecoEcalCuster(ecal_cluster, tuples); + reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, tuples); double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy){ ecal_max_energy = energy; From 14dfb6f3ef20ce718febfbfc2d0d796bd648351a Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 6 Nov 2023 16:14:15 -0800 Subject: [PATCH 27/71] some plot bug fixes, add mctrackerhit at ecal to ntuple --- analysis/plotconfigs/mc/simPart.json | 97 +++++++++++++++++-- .../selections/simPart/1Sim_1Track_1Ecal.json | 17 ++++ analysis/src/SimPartHistos.cxx | 17 +++- event/include/MCTrackerHit.h | 9 ++ processors/config/simPartAna_cfg.py | 2 + processors/config/simPartTuple_cfg.py | 8 +- processors/include/SimPartProcessor.h | 7 +- processors/src/MCTrackerHitProcessor.cxx | 6 +- processors/src/SimPartProcessor.cxx | 62 ++++++------ 9 files changed, 176 insertions(+), 49 deletions(-) create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal.json diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index ce950b5e1..d876a224c 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -76,6 +76,20 @@ "xtitle" : "sim p", "ytitle" : "Events" }, + "sim_pxpz_h" : { + "bins" : 2000, + "min" : -0.8, + "max" : 0.8, + "xtitle" : "sim p_{x}/p_{z}", + "ytitle" : "Events" + }, + "sim_pypz_h" : { + "bins" : 500, + "min" : -0.2, + "max" : 0.2, + "xtitle" : "sim p_{y}/p_{z}", + "ytitle" : "Events" + }, "sim_energy_h" : { "bins" : 100, "minX" : 0, @@ -118,6 +132,55 @@ "xtitle" : "Track p", "ytitle" : "Events" }, + "track_phi0_h" : { + "bins" : 2000, + "min" : -0.2, + "max" : 0.3, + "xtitle" : "Track #{phi}_{0}", + "ytitle" : "Events" + }, + "track_tanlambda_h" : { + "bins" : 500, + "min" : -0.15, + "max" : 0.15, + "xtitle" : "Track tan#{lambda}}", + "ytitle" : "Events" + }, + "track_d0_h" : { + "bins" : 2000, + "min" : -100, + "max" : 100, + "xtitle" : "Track d_{0}", + "ytitle" : "Events" + }, + "track_z0_h" : { + "bins" : 2000, + "min" : -100, + "max" : 100, + "xtitle" : "Track z_{0}", + "ytitle" : "Events" + }, + "track_omega_h" : { + "bins" : 100, + "minX" : -10, + "maxX" : 10, + "xtitle" : "Track #{Omega}", + "ytitle" : "Events" + }, + "track_ecal_x_h" : { + "bins" : 2000, + "min" : -340, + "max" : 420, + "xtitle" : "Track ECal Position x", + "ytitle" : "Events" + }, + "track_ecal_y_h" : { + "bins" : 500, + "min" : -100, + "max" : 100, + "xtitle" : "Track ECal Position y", + "ytitle" : "Events" + }, "ecal_n_hits_h" : { "bins" : 20, "minX" : -0.5, @@ -132,6 +195,20 @@ "xtitle" : "ECal energy", "ytitle" : "Events" }, + "ecal_x_h" : { + "bins" : 2000, + "min" : -340, + "max" : 420, + "xtitle" : "Ecal cluster x", + "ytitle" : "Events" + }, + "ecal_y_h" : { + "bins" : 500, + "min" : -100, + "max" : 100, + "xtitle" : "Ecal cluster y", + "ytitle" : "Events" + }, "sim_pxpz_pypz_hh" : { "binsX" : 2000, "minX" : -0.8, @@ -202,16 +279,6 @@ "xtitle" : "Track #z_{0}", "ytitle" : "Track tan#{lambda}}" }, - "track_x_y_hh" : { - "binsX" : 2000, - "minX" : -340, - "maxX" : 420, - "binsY" : 500, - "minY" : -100, - "maxY" : 100, - "xtitle" : "Track x", - "ytitle" : "Track y" - }, "track_ecal_x_y_hh" : { "binsX" : 2000, "minX" : -340, @@ -241,5 +308,15 @@ "maxY" : 10, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "Track p" + }, + "track_ecal_x_sim_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at ECal) x - Ecal x", + "ytitle" : "sim p" } } diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal.json b/analysis/selections/simPart/1Sim_1Track_1Ecal.json new file mode 100644 index 000000000..1ac335a83 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal.json @@ -0,0 +1,17 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters == 1" + } +} diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 6a62a961a..caf592e0c 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -15,6 +15,8 @@ void SimPartHistos::FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, flo Fill1DHisto("sim_py_h", py, weight); Fill1DHisto("sim_pz_h", pz, weight); Fill1DHisto("sim_p_h", p, weight); + Fill1DHisto("sim_pxpz_h", px/pz, weight); + Fill1DHisto("sim_pypz_h", py/pz, weight); Fill1DHisto("sim_energy_h", energy, weight); Fill2DHisto("sim_pxpz_pypz_hh", px/pz, py/pz, weight); Fill2DHisto("sim_pxpz_p_hh", px/pz, p, weight); @@ -60,10 +62,17 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we Fill1DHisto("track_py_h", py, weight); Fill1DHisto("track_pz_h", pz, weight); Fill1DHisto("track_p_h", p, weight); + Fill1DHisto("track_phi0", phi0, weight); + Fill1DHisto("track_tanlambda", tan_lambda, weight); + Fill1DHisto("track_d0", d0, weight); + Fill1DHisto("track_z0", z0, weight); + Fill1DHisto("track_omega", omega, weight); + Fill1DHisto("track_ecal_x", track_ecal_x, weight); + Fill1DHisto("track_ecal_y", track_ecal_y, weight); Fill2DHisto("track_phi0_p_hh", phi0, p, weight); Fill2DHisto("track_phi0_tanlambda_hh", phi0, tan_lambda, weight); Fill2DHisto("track_z0_tanlambda_hh", z0, tan_lambda, weight); - Fill2DHisto("track_x_y_hh", track_x, track_y, weight); + //Fill2DHisto("track_x_y_hh", track_x, track_y, weight); Fill2DHisto("track_ecal_x_y_hh", track_ecal_x, track_ecal_y, weight); tuples->addToVector("track_n_hits", n_hits); @@ -76,8 +85,8 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we tuples->addToVector("track_d0", d0); tuples->addToVector("track_z0", z0); tuples->addToVector("track_omega", omega); - tuples->addToVector("track_x", track_x); - tuples->addToVector("track_y", track_y); + //tuples->addToVector("track_x", track_x); + //tuples->addToVector("track_y", track_y); tuples->addToVector("track_ecal_x", track_ecal_x); tuples->addToVector("track_ecal_y", track_ecal_y); } @@ -91,6 +100,8 @@ void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* Fill1DHisto("ecal_n_hits_h", n_hits, weight); Fill1DHisto("ecal_energy_h", energy, weight); + Fill1DHisto("ecal_x", cluster_x, weight); + Fill1DHisto("ecal_y", cluster_y, weight); Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); tuples->addToVector("ecal_n_hits", n_hits); tuples->addToVector("ecal_energy", energy); diff --git a/event/include/MCTrackerHit.h b/event/include/MCTrackerHit.h index f673d96a1..a0880e5fd 100644 --- a/event/include/MCTrackerHit.h +++ b/event/include/MCTrackerHit.h @@ -88,6 +88,12 @@ class MCTrackerHit : public TObject { //** @return the pdg id of particle that made the hit */ int getPDG() const {return pdg_;}; + //** set the lcio id of particle that made the hit */ + void setPartID(const int id) {partID_ = id;}; + + //** @return the lcio id of particle that made the hit */ + int getPartID() const {return partID_;}; + ClassDef(MCTrackerHit, 1); private: @@ -116,6 +122,9 @@ class MCTrackerHit : public TObject { /** pdg id of particle that made the hit */ int pdg_{-999}; + /** lcio id of particle that made the hit */ + int partID_{-999}; + }; // MCTrackerHit #endif // _MCTRACKER_HIT_H_ diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index e9d5768de..5f0fcdee6 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -47,6 +47,7 @@ sim_part_ana.parameters["anaName"] = "sim_part" sim_part_ana.parameters["MCParticleColl"] = "MCParticle" sim_part_ana.parameters["MCTrackerHitColl"] = "TrackerSimHits" +sim_part_ana.parameters["MCTrackerHitECalColl"] = "TrackerSimHitsECal" sim_part_ana.parameters["MCEcalHitColl"] = "EcalSimHits" sim_part_ana.parameters["RecoTrackColl"] = "KalmanFullTracks" sim_part_ana.parameters["RecoTrackerClusterColl"] = "SiClustersOnTrack" @@ -60,6 +61,7 @@ RegionPath+'Track.json', RegionPath+'Ecal.json', RegionPath+'1Track_1Ecal.json', + RegionPath+'1Sim_1Track_1Ecal.json', RegionPath+'Track_Ecal.json', RegionPath+'noTrack.json', RegionPath+'noTrack_Ecal.json', diff --git a/processors/config/simPartTuple_cfg.py b/processors/config/simPartTuple_cfg.py index 05e87a646..3ba5af91a 100644 --- a/processors/config/simPartTuple_cfg.py +++ b/processors/config/simPartTuple_cfg.py @@ -31,6 +31,7 @@ svthits = HpstrConf.Processor('svthits', 'Tracker2DHitProcessor') rawsvt = HpstrConf.Processor('rawsvt', 'SvtRawDataProcessor') mcthits = HpstrConf.Processor('mcthits', 'MCTrackerHitProcessor') +mcthits_ecal = HpstrConf.Processor('mcthits_ecal', 'MCTrackerHitProcessor') mcehits = HpstrConf.Processor('mcehits', 'MCEcalHitProcessor') ecal = HpstrConf.Processor('ecal', 'ECalDataProcessor') fsp = HpstrConf.Processor('fps', 'FinalStateParticleProcessor') @@ -96,6 +97,11 @@ mcthits.parameters["hitCollLcio"] = 'TrackerHits' mcthits.parameters["hitCollRoot"] = 'TrackerSimHits' +#MCTrackerHits at Ecal +mcthits_ecal.parameters["debug"] = 0 +mcthits_ecal.parameters["hitCollLcio"] = 'TrackerHitsECal' +mcthits_ecal.parameters["hitCollRoot"] = 'TrackerSimHitsECal' + #MCEcalHits mcehits.parameters["debug"] = 0 mcehits.parameters["hitCollLcio"] = 'EcalHits' @@ -116,7 +122,7 @@ mcpart.parameters["mcPartCollLcio"] = 'MCParticle' mcpart.parameters["mcPartCollRoot"] = 'MCParticle' -sequence = [header, ecal, track, svthits, rawsvt, mcthits, mcehits, mcpart] +sequence = [header, ecal, track, svthits, rawsvt, mcthits, mcthits_ecal, mcehits, mcpart] p.sequence = sequence diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index 5e821791e..594c7d116 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -81,6 +81,7 @@ class SimPartProcessor : public Processor { TTree* tree_; TBranch* bMCParticles_{nullptr}; //!< description TBranch* bMCTrackerHits_{nullptr}; //!< description + TBranch* bMCTrackerHitsECal_{nullptr}; //!< description TBranch* bMCEcalHits_{nullptr}; //!< description TBranch* bRecoTracks_{nullptr}; //!< description TBranch* bRecoTrackerClusters_{nullptr}; //!< description @@ -88,6 +89,7 @@ class SimPartProcessor : public Processor { std::vector * MCParticles_{nullptr}; //!< description std::vector * MCTrackerHits_{nullptr}; //!< description + std::vector * MCTrackerHitsECal_{nullptr}; //!< description std::vector * MCEcalHits_{nullptr}; //!< description std::vector * RecoTracks_{nullptr}; //!< description std::vector * RecoTrackerClusters_{nullptr}; //!< description @@ -95,8 +97,9 @@ class SimPartProcessor : public Processor { std::string anaName_{"SimPartAna"}; //!< description std::string MCParticleColl_{"MCParticle"}; //!< description - std::string MCTrackerHitColl_{"TrackerHits"}; //!< description - std::string MCEcalHitColl_{"EcalHits"}; //!< description + std::string MCTrackerHitColl_{"TrackerSimHits"}; //!< description + std::string MCTrackerHitECalColl_{"TrackerSimHitsECal"}; //!< description + std::string MCEcalHitColl_{"EcalSimHits"}; //!< description std::string RecoTrackColl_{"KalmanFullTracks"}; //!< description std::string RecoTrackerClusterColl_{"SiClustersOnTrack"}; //!< description std::string RecoEcalClusterColl_{"RecoEcalClusters"}; //!< description diff --git a/processors/src/MCTrackerHitProcessor.cxx b/processors/src/MCTrackerHitProcessor.cxx index ff5951814..372a23947 100644 --- a/processors/src/MCTrackerHitProcessor.cxx +++ b/processors/src/MCTrackerHitProcessor.cxx @@ -82,9 +82,11 @@ bool MCTrackerHitProcessor::process(IEvent* ievent) { mc_tracker_hit->setEdep(lcio_mcTracker_hit->getEDep()); // Set the pdg of particle generating the hit - if(lcio_mcTracker_hit->getMCParticle()) + if(lcio_mcTracker_hit->getMCParticle()){ mc_tracker_hit->setPDG(lcio_mcTracker_hit->getMCParticle()->getPDG()); - + mc_tracker_hit->setPartID(lcio_mcTracker_hit->getMCParticle()->id()); + } + // Set the time of the hit mc_tracker_hit->setTime(lcio_mcTracker_hit->getTime()); diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 700a4971b..73e4af189 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -19,6 +19,7 @@ void SimPartProcessor::configure(const ParameterSet& parameters) { anaName_ = parameters.getString("anaName"); MCParticleColl_ = parameters.getString("MCParticleColl"); MCTrackerHitColl_ = parameters.getString("MCTrackerHitColl"); + MCTrackerHitECalColl_ = parameters.getString("MCTrackerHitECalColl"); MCEcalHitColl_ = parameters.getString("MCEcalHitColl"); RecoTrackColl_ = parameters.getString("RecoTrackColl"); RecoTrackerClusterColl_ = parameters.getString("RecoTrackerClusterColl"); @@ -65,8 +66,8 @@ void SimPartProcessor::initialize(TTree* tree) { tuples->addVector("track_d0"); tuples->addVector("track_z0"); tuples->addVector("track_omega"); - tuples->addVector("track_x"); - tuples->addVector("track_y"); + //tuples->addVector("track_x"); + //tuples->addVector("track_y"); tuples->addVector("track_ecal_x"); tuples->addVector("track_ecal_y"); tuples->addVector("ecal_n_hits"); @@ -117,8 +118,8 @@ void SimPartProcessor::initialize(TTree* tree) { reg_tuples_[regname]->addVector("track_d0"); reg_tuples_[regname]->addVector("track_z0"); reg_tuples_[regname]->addVector("track_omega"); - reg_tuples_[regname]->addVector("track_x"); - reg_tuples_[regname]->addVector("track_y"); + //reg_tuples_[regname]->addVector("track_x"); + //reg_tuples_[regname]->addVector("track_y"); reg_tuples_[regname]->addVector("track_ecal_x"); reg_tuples_[regname]->addVector("track_ecal_y"); reg_tuples_[regname]->addVector("ecal_n_hits"); @@ -136,6 +137,12 @@ void SimPartProcessor::initialize(TTree* tree) { tree_->SetBranchAddress(MCTrackerHitColl_.c_str(), &MCTrackerHits_, &bMCTrackerHits_); else std::cout<<"WARNING: No MC tracker hit collection"<FindBranch(MCTrackerHitECalColl_.c_str())) + tree_->SetBranchAddress(MCTrackerHitECalColl_.c_str(), &MCTrackerHitsECal_, &bMCTrackerHitsECal_); + else + std::cout<<"WARNING: No MC tracker hit collection"<FindBranch(MCEcalHitColl_.c_str())) tree_->SetBranchAddress(MCEcalHitColl_.c_str(), &MCEcalHits_, &bMCEcalHits_); else @@ -215,15 +222,13 @@ bool SimPartProcessor::process(IEvent* ievent) { if (n_hits < min_n_Track_hits) min_n_Track_hits = n_hits; histos->FillRecoTrack(track, tuples); - track_omega = track->getOmega(); double p = track->getP(); if (p > track_max_p){ track_max_p = p; track_max_p_ecal_x = track->getPositionAtEcal().at(0); + track_omega = track->getOmega(); } } - if (nReco_Tracks > 1) - track_omega = -99999; double ecal_max_energy = -99999; double ecal_max_p_x = -99999; @@ -239,8 +244,7 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); - - tuples->fill(); + histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); // Regions for (auto region : regions_ ) { @@ -293,7 +297,7 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); - double sim_max_p = -99999; + double sim_max_p_region = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -305,45 +309,41 @@ bool SimPartProcessor::process(IEvent* ievent) { double py = momentum_V.at(1); double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); - if (p > sim_max_p){ - sim_max_p = p; + if (p > sim_max_p_region){ + sim_max_p_region = p; } } - int min_n_Track_hits = 99999; - double track_omega = -99999; - double track_max_p_ecal_x = -99999; + double track_max_p_ecal_x_region = -99999; + double track_max_p_region = -99999; for (int i=0; iat(i); - int n_hits = track->getTrackerHitCount(); - if (n_hits < min_n_Track_hits) - min_n_Track_hits = n_hits; reg_histos_[region]->FillRecoTrack(track, tuples); - track_omega = track->getOmega(); double p = track->getP(); - if (p > track_max_p){ - track_max_p = p; - track_max_p_ecal_x = track->getPositionAtEcal().at(0); + if (p > track_max_p_region){ + track_max_p_region = p; + track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); } } - if (nReco_Tracks > 1) - track_omega = -99999; - double ecal_max_energy = -99999; - double ecal_max_p_x = -99999; + double ecal_max_energy_region = -99999; + double ecal_max_p_x_region = -99999; for (int i=0; iat(i); reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, tuples); double energy = ecal_cluster->getEnergy(); - if (energy > ecal_max_energy){ - ecal_max_energy = energy; - ecal_max_p_x = ecal_cluster->getPosition().at(0); + if (energy > ecal_max_energy_region){ + ecal_max_energy_region = energy; + ecal_max_p_x_region = ecal_cluster->getPosition().at(0); } } - reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); } + + tuples->fill(); return true; } From f5cf1e9d890f265a7c99235e5395c80f5239ac9a Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 18:25:29 -0800 Subject: [PATCH 28/71] add plotting stuff and sim part at ecal --- analysis/plotconfigs/mc/simPart.json | 110 ++++++++++++++++++++++----- processors/src/SimPartProcessor.cxx | 35 +++++++++ 2 files changed, 125 insertions(+), 20 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index d876a224c..805375d82 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -78,15 +78,15 @@ }, "sim_pxpz_h" : { "bins" : 2000, - "min" : -0.8, - "max" : 0.8, + "minX" : -0.8, + "maxX" : 0.8, "xtitle" : "sim p_{x}/p_{z}", "ytitle" : "Events" }, "sim_pypz_h" : { "bins" : 500, - "min" : -0.2, - "max" : 0.2, + "minX" : -0.2, + "maxX" : 0.2, "xtitle" : "sim p_{y}/p_{z}", "ytitle" : "Events" }, @@ -134,29 +134,29 @@ }, "track_phi0_h" : { "bins" : 2000, - "min" : -0.2, - "max" : 0.3, + "minX" : -0.2, + "maxX" : 0.3, "xtitle" : "Track #{phi}_{0}", "ytitle" : "Events" }, "track_tanlambda_h" : { "bins" : 500, - "min" : -0.15, - "max" : 0.15, + "minX" : -0.15, + "maxX" : 0.15, "xtitle" : "Track tan#{lambda}}", "ytitle" : "Events" }, "track_d0_h" : { "bins" : 2000, - "min" : -100, - "max" : 100, + "minX" : -100, + "maxX" : 100, "xtitle" : "Track d_{0}", "ytitle" : "Events" }, "track_z0_h" : { "bins" : 2000, - "min" : -100, - "max" : 100, + "minX" : -100, + "maxX" : 100, "xtitle" : "Track z_{0}", "ytitle" : "Events" }, @@ -169,15 +169,15 @@ }, "track_ecal_x_h" : { "bins" : 2000, - "min" : -340, - "max" : 420, + "minX" : -340, + "maxX" : 420, "xtitle" : "Track ECal Position x", "ytitle" : "Events" }, "track_ecal_y_h" : { "bins" : 500, - "min" : -100, - "max" : 100, + "minX" : -100, + "maxX" : 100, "xtitle" : "Track ECal Position y", "ytitle" : "Events" }, @@ -197,15 +197,15 @@ }, "ecal_x_h" : { "bins" : 2000, - "min" : -340, - "max" : 420, + "minX" : -340, + "maxX" : 420, "xtitle" : "Ecal cluster x", "ytitle" : "Events" }, "ecal_y_h" : { "bins" : 500, - "min" : -100, - "max" : 100, + "minX" : -100, + "maxX" : 100, "xtitle" : "Ecal cluster y", "ytitle" : "Events" }, @@ -318,5 +318,75 @@ "maxY" : 10, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "sim p" + }, + "track_ecal_x_ecal_energy_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at ECal) x - Ecal x", + "ytitle" : "Ecal energy" + }, + "sim_track_x_track_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "ytitle" : "Track p" + }, + "sim_track_x_sim_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "ytitle" : "sim p" + }, + "sim_track_x_ecal_energy_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "ytitle" : "Ecal energy" + }, + "sim_ecal_x_track_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Ecal x", + "ytitle" : "Track p" + }, + "sim_ecal_x_sim_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Ecal x", + "ytitle" : "sim p" + }, + "sim_ecal_x_ecal_energy_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 100, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Sim x (at ECal) - Ecal x", + "ytitle" : "Ecal energy" } } diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 73e4af189..b69b40525 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -171,6 +171,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int nParts = MCParticles_->size(); int nSim_Tracker_hits = MCTrackerHits_->size(); + int nSim_Tracker_hits_Ecal = MCTrackerHitsEcal_->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); @@ -242,9 +243,43 @@ bool SimPartProcessor::process(IEvent* ievent) { } } + double mc_tracker_hit_ecal_max_p = -99999; + double mc_tracker_hit_ecal_max_p_x = -99999; + for (int i=0; iat(i); + int track_id = mc_tracker_hit_ecal->getPartID(); + double sim_p = -99999; + for (int j=0; jat(j); + int gen = part->getGenStatus(); + if (gen != 1) + continue; + int sim_id = part->getID(); + std::vector momentum_V = part->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + if (sim_id == track_id){ + sim_p = sqrt(px*px + py*py + pz*pz); + break; + } + } + if (sim_p > mc_tracker_hit_ecal_max_p){ + mc_tracker_hit_ecal_max_p = sim_p; + mc_tracker_hit_ecal_max_p_x = mc_tracker_hit_ecal->getPosition().at(0); + } + } + histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); + histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), track_max_p, weight); + histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), sim_max_p, weight); + histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), ecal_max_energy, weight); + histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), ecal_max_energy, weight); // Regions for (auto region : regions_ ) { From 2ec7f5ef1a8e089f1f6c8aec78995a5b79fc0b7e Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 18:28:26 -0800 Subject: [PATCH 29/71] bug fix --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index b69b40525..8331e1106 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -171,7 +171,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int nParts = MCParticles_->size(); int nSim_Tracker_hits = MCTrackerHits_->size(); - int nSim_Tracker_hits_Ecal = MCTrackerHitsEcal_->size(); + int nSim_Tracker_hits_Ecal = MCTrackerHitsECal_->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); From 98022cc7490a7eba77e465b2f0169aa38c7e997b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 18:31:08 -0800 Subject: [PATCH 30/71] bug fix --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 8331e1106..704c46b01 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -246,7 +246,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double mc_tracker_hit_ecal_max_p = -99999; double mc_tracker_hit_ecal_max_p_x = -99999; for (int i=0; iat(i); + MCTrackerHit *mc_tracker_hit_ecal = MCTrackerHitsECal_->at(i); int track_id = mc_tracker_hit_ecal->getPartID(); double sim_p = -99999; for (int j=0; j Date: Tue, 7 Nov 2023 20:16:13 -0800 Subject: [PATCH 31/71] further plot fixes --- analysis/plotconfigs/mc/simPart.json | 230 +++++++++++-------- analysis/selections/simPart/Sim_p_ge1.json | 7 + analysis/selections/simPart/Sim_p_le1.json | 7 + analysis/selections/simPart/Track_p_ge4.json | 7 + analysis/src/SimPartHistos.cxx | 12 + processors/config/simPartAna_cfg.py | 3 + processors/src/SimPartProcessor.cxx | 51 +++- 7 files changed, 212 insertions(+), 105 deletions(-) create mode 100644 analysis/selections/simPart/Sim_p_ge1.json create mode 100644 analysis/selections/simPart/Sim_p_le1.json create mode 100644 analysis/selections/simPart/Track_p_ge4.json diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 805375d82..dbf1c5e2b 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -1,15 +1,15 @@ { "numMCparts_h" : { - "bins" : 60, + "bins" : 50, "minX" : -0.5, - "maxX" : 59.5, + "maxX" : 49.5, "xtitle" : "Number of Sim Particles", "ytitle" : "Events" }, "numRecoTracks_h" : { - "bins" : 60, + "bins" : 10, "minX" : -0.5, - "maxX" : 59.5, + "maxX" : 9.5, "xtitle" : "Number of Reco Tracks", "ytitle" : "Events" }, @@ -21,77 +21,77 @@ "ytitle" : "Events" }, "numRecoTrackerClusters_h" : { - "bins" : 60, + "bins" : 30, "minX" : -0.5, - "maxX" : 59.5, + "maxX" : 29.5, "xtitle" : "Number of Reco Tracker Clusters", "ytitle" : "Events" }, "numSimEcalHits_h" : { - "bins" : 60, + "bins" : 20, "minX" : -0.5, - "maxX" : 59.5, + "maxX" : 19.5, "xtitle" : "Number of Sim Ecal Hits", "ytitle" : "Events" }, "numRecoEcalClusters_h" : { - "bins" : 60, + "bins" : 10, "minX" : -0.5, - "maxX" : 59.5, + "maxX" : 9.5, "xtitle" : "Number of Reco Ecal Clusters", "ytitle" : "Events" }, "sim_pdgid_h" : { - "bins" : 100, - "minX" : -50, - "maxX" : 50, + "bins" : 60, + "minX" : -30, + "maxX" : 30, "xtitle" : "PDG ID of Sim Particles", "ytitle" : "Events" }, "sim_px_h" : { - "bins" : 200, - "minX" : -10, - "maxX" : 10, + "bins" : 60, + "minX" : -6, + "maxX" : 6, "xtitle" : "sim p_{x}", "ytitle" : "Events" }, "sim_py_h" : { - "bins" : 200, - "minX" : -10, - "maxX" : 10, + "bins" : 60, + "minX" : -6, + "maxX" : 6, "xtitle" : "sim p_{y}", "ytitle" : "Events" }, "sim_pz_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "sim p_{z}", "ytitle" : "Events" }, "sim_p_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "sim p", "ytitle" : "Events" }, "sim_pxpz_h" : { - "bins" : 2000, + "bins" : 200, "minX" : -0.8, "maxX" : 0.8, "xtitle" : "sim p_{x}/p_{z}", "ytitle" : "Events" }, "sim_pypz_h" : { - "bins" : 500, + "bins" : 50, "minX" : -0.2, "maxX" : 0.2, "xtitle" : "sim p_{y}/p_{z}", "ytitle" : "Events" }, "sim_energy_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "sim energy", @@ -105,82 +105,89 @@ "ytitle" : "Events" }, "track_px_h" : { - "bins" : 200, - "minX" : -10, - "maxX" : 10, + "bins" : 60, + "minX" : -6, + "maxX" : 6, "xtitle" : "Track p_{x}", "ytitle" : "Events" }, "track_py_h" : { - "bins" : 200, - "minX" : -10, - "maxX" : 10, + "bins" : 60, + "minX" : -6, + "maxX" : 6, "xtitle" : "Track p_{y}", "ytitle" : "Events" }, "track_pz_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "Track p_{z}", "ytitle" : "Events" }, "track_p_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "Track p", "ytitle" : "Events" }, "track_phi0_h" : { - "bins" : 2000, + "bins" : 200, "minX" : -0.2, - "maxX" : 0.3, - "xtitle" : "Track #{phi}_{0}", + "maxX" : 0.5, + "xtitle" : "Track #phi_{0}", "ytitle" : "Events" }, "track_tanlambda_h" : { - "bins" : 500, + "bins" : 50, "minX" : -0.15, "maxX" : 0.15, - "xtitle" : "Track tan#{lambda}}", + "xtitle" : "Track tan#lambda}", "ytitle" : "Events" }, "track_d0_h" : { - "bins" : 2000, - "minX" : -100, - "maxX" : 100, + "bins" : 40, + "minX" : -20, + "maxX" : 20, "xtitle" : "Track d_{0}", "ytitle" : "Events" }, "track_z0_h" : { - "bins" : 2000, - "minX" : -100, - "maxX" : 100, + "bins" : 40, + "minX" : -20, + "maxX" : 20, "xtitle" : "Track z_{0}", "ytitle" : "Events" }, "track_omega_h" : { - "bins" : 100, - "minX" : -10, - "maxX" : 10, - "xtitle" : "Track #{Omega}", + "bins" : 30, + "minX" : -0.003, + "maxX" : 0.003, + "xtitle" : "Track #Omega", "ytitle" : "Events" }, "track_ecal_x_h" : { - "bins" : 2000, - "minX" : -340, - "maxX" : 420, + "bins" : 100, + "minX" : -500, + "maxX" : 400, "xtitle" : "Track ECal Position x", "ytitle" : "Events" }, "track_ecal_y_h" : { - "bins" : 500, - "minX" : -100, - "maxX" : 100, + "bins" : 50, + "minX" : -150, + "maxX" : 150, "xtitle" : "Track ECal Position y", "ytitle" : "Events" }, + "track_hit_layer_h" : { + "bins" : 14, + "minX" : 0.5, + "maxX" : 14.5, + "xtitle" : "Track Hit Layer", + "ytitle" : "Events" + }, "ecal_n_hits_h" : { "bins" : 20, "minX" : -0.5, @@ -189,201 +196,222 @@ "ytitle" : "Events" }, "ecal_energy_h" : { - "bins" : 100, + "bins" : 50, "minX" : 0, "maxX" : 10, "xtitle" : "ECal energy", "ytitle" : "Events" }, "ecal_x_h" : { - "bins" : 2000, + "bins" : 200, "minX" : -340, "maxX" : 420, "xtitle" : "Ecal cluster x", "ytitle" : "Events" }, "ecal_y_h" : { - "bins" : 500, + "bins" : 50, "minX" : -100, "maxX" : 100, "xtitle" : "Ecal cluster y", "ytitle" : "Events" }, + "track_ecal_x_diff_h" : { + "bins" : 100, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Track (at ECal) x - Ecal x", + "ytitle" : "Events" + }, + "sim_track_x_diff_h" : { + "bins" : 100, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Sim x (at ECal) x - Track x", + "ytitle" : "Events" + }, + "sim_ecal_x_diff_h" : { + "bins" : 100, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Sim x (at ECal) x - Ecal x", + "ytitle" : "Events" + }, "sim_pxpz_pypz_hh" : { - "binsX" : 2000, + "binsX" : 200, "minX" : -0.8, "maxX" : 0.8, - "binsY" : 500, + "binsY" : 50, "minY" : -0.2, "maxY" : 0.2, "xtitle" : "sim p_{x}/p_{z}", "ytitle" : "sim p_{y}/p_{z}" }, "sim_pxpz_p_hh" : { - "binsX" : 2000, + "binsX" : 100, "minX" : -0.8, "maxX" : 0.8, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "sim p_{x}/p_{z}", "ytitle" : "sim p" }, "sim_pxpz_energy_hh" : { - "binsX" : 2000, + "binsX" : 100, "minX" : -0.8, "maxX" : 0.8, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "sim p_{x}/p_{z}", "ytitle" : "sim energy" }, "track_sim_p_sim_p_hh" : { - "binsX" : 100, + "binsX" : 20, "minX" : 0, - "maxX" : 1, - "binsY" : 100, + "maxX" : 2, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "track p / sim p", "ytitle" : "sim p" }, "track_phi0_p_hh" : { - "binsX" : 2000, + "binsX" : 100, "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 100, + "maxX" : 0.5, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Track #{phi}_{0}", "ytitle" : "Track p" }, "track_phi0_tanlambda_hh" : { - "binsX" : 2000, + "binsX" : 100, "minX" : -0.2, - "maxX" : 0.3, - "binsY" : 500, + "maxX" : 0.5, + "binsY" : 20, "minY" : -0.15, "maxY" : 0.15, "xtitle" : "Track #{phi}_{0}", "ytitle" : "Track tan#{lambda}}" }, "track_z0_tanlambda_hh" : { - "binsX" : 2000, - "minX" : -100, - "maxX" : 100, - "binsY" : 500, + "binsX" : 10, + "minX" : -20, + "maxX" : 20, + "binsY" : 20, "minY" : -0.15, "maxY" : 0.15, "xtitle" : "Track #z_{0}", "ytitle" : "Track tan#{lambda}}" }, "track_ecal_x_y_hh" : { - "binsX" : 2000, - "minX" : -340, - "maxX" : 420, - "binsY" : 500, - "minY" : -100, - "maxY" : 100, + "binsX" : 100, + "minX" : -50, + "maxX" : 400, + "binsY" : 50, + "minY" : -150, + "maxY" : 150, "xtitle" : "Track (at ECal) x", "ytitle" : "Track (at ECal) y" }, "ecal_x_y_hh" : { - "binsX" : 2000, + "binsX" : 100, "minX" : -340, "maxX" : 420, - "binsY" : 500, + "binsY" : 50, "minY" : -100, "maxY" : 100, "xtitle" : "Ecal cluster x", "ytitle" : "Ecal cluster y" }, "track_ecal_x_track_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "Track p" }, "track_ecal_x_sim_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "sim p" }, "track_ecal_x_ecal_energy_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "Ecal energy" }, "sim_track_x_track_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Track (at ECal) x", "ytitle" : "Track p" }, "sim_track_x_sim_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Track (at ECal) x", "ytitle" : "sim p" }, "sim_track_x_ecal_energy_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Track (at ECal) x", "ytitle" : "Ecal energy" }, "sim_ecal_x_track_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Ecal x", "ytitle" : "Track p" }, "sim_ecal_x_sim_p_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Ecal x", "ytitle" : "sim p" }, "sim_ecal_x_ecal_energy_hh" : { - "binsX" : 1000, + "binsX" : 100, "minX" : -100, "maxX" : 100, - "binsY" : 100, + "binsY" : 20, "minY" : 0, "maxY" : 10, "xtitle" : "Sim x (at ECal) - Ecal x", diff --git a/analysis/selections/simPart/Sim_p_ge1.json b/analysis/selections/simPart/Sim_p_ge1.json new file mode 100644 index 000000000..83c0871f7 --- /dev/null +++ b/analysis/selections/simPart/Sim_p_ge1.json @@ -0,0 +1,7 @@ +{ + "sim_p_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "Sim pT >= 1" + } +} diff --git a/analysis/selections/simPart/Sim_p_le1.json b/analysis/selections/simPart/Sim_p_le1.json new file mode 100644 index 000000000..397cc40cf --- /dev/null +++ b/analysis/selections/simPart/Sim_p_le1.json @@ -0,0 +1,7 @@ +{ + "sim_p_lt" : { + "cut" : 1.0, + "id" : 0, + "info" : "Sim pT <= 1" + } +} diff --git a/analysis/selections/simPart/Track_p_ge4.json b/analysis/selections/simPart/Track_p_ge4.json new file mode 100644 index 000000000..9a2edc6e9 --- /dev/null +++ b/analysis/selections/simPart/Track_p_ge4.json @@ -0,0 +1,7 @@ +{ + "track_p_gt" : { + "cut" : 4.0, + "id" : 0, + "info" : "Tracks pT >= 4" + } +} diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index caf592e0c..1ae18c26f 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -57,6 +57,13 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we double pz = momentum_V.at(2); double p = track->getP(); + std::vector hit_layers; + for (int ihit = 0; ihitgetSvtHits().GetEntries(); ++ihit) { + TrackerHit* hit = (TrackerHit*) track->getSvtHits().At(ihit); + int layer = hit->getLayer(); + hit_layers.push_back(layer); + } + Fill1DHisto("track_n_hits_h", n_hits, weight); Fill1DHisto("track_px_h", px, weight); Fill1DHisto("track_py_h", py, weight); @@ -89,6 +96,11 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we //tuples->addToVector("track_y", track_y); tuples->addToVector("track_ecal_x", track_ecal_x); tuples->addToVector("track_ecal_y", track_ecal_y); + + for (int i=0; iaddToVector("track_hit_layrer", hit_layers[i]); + } } void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* tuples, float weight){ diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index 5f0fcdee6..c81de9122 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -78,6 +78,9 @@ RegionPath+'Track_nhit12.json', RegionPath+'Track_nhit13.json', RegionPath+'Track_nhit14.json' + RegionPath+'Track_p_ge4.json', + RegionPath+'Sim_p_ge1.json', + RegionPath+'Sim_p_le1.json' ] # Sequence which the processors will run. diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 704c46b01..c3ecc8cd2 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -70,6 +70,7 @@ void SimPartProcessor::initialize(TTree* tree) { //tuples->addVector("track_y"); tuples->addVector("track_ecal_x"); tuples->addVector("track_ecal_y"); + tuples->addVector("track_hit_layer"); tuples->addVector("ecal_n_hits"); tuples->addVector("ecal_energy"); tuples->addVector("ecal_x"); @@ -122,6 +123,7 @@ void SimPartProcessor::initialize(TTree* tree) { //reg_tuples_[regname]->addVector("track_y"); reg_tuples_[regname]->addVector("track_ecal_x"); reg_tuples_[regname]->addVector("track_ecal_y"); + reg_tuples_[regname]->addVector("track_hit_layrer"); reg_tuples_[regname]->addVector("ecal_n_hits"); reg_tuples_[regname]->addVector("ecal_energy"); reg_tuples_[regname]->addVector("ecal_x"); @@ -197,6 +199,7 @@ bool SimPartProcessor::process(IEvent* ievent) { tuples->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p = -99999; + std::vector sim_p_list; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -208,6 +211,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double py = momentum_V.at(1); double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); + sim_p_list.push_back(p); if (p > sim_max_p){ sim_max_p = p; } @@ -217,6 +221,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double track_omega = -99999; double track_max_p_ecal_x = -99999; double track_max_p = -99999; + std::vector track_p_list; for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); @@ -224,6 +229,7 @@ bool SimPartProcessor::process(IEvent* ievent) { min_n_Track_hits = n_hits; histos->FillRecoTrack(track, tuples); double p = track->getP(); + track_p_list.push_back(p); if (p > track_max_p){ track_max_p = p; track_max_p_ecal_x = track->getPositionAtEcal().at(0); @@ -271,6 +277,11 @@ bool SimPartProcessor::process(IEvent* ievent) { } histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + + histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); + histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), weight); + histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), weight); + histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); @@ -281,6 +292,8 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), sim_max_p, weight); histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), ecal_max_energy, weight); + tuples->fill(); + // Regions for (auto region : regions_ ) { reg_selectors_[region]->getCutFlowHisto()->Fill(0.,weight); @@ -317,6 +330,36 @@ bool SimPartProcessor::process(IEvent* ievent) { if ( !reg_selectors_[region]->passCutGt("n_track_hits_gt", min_n_Track_hits, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of Track Hits Gt cut"<passCutGt("track_p_gt", track_p_list[i], weight) ){ + track_p_fail = 1; + break; + } + } + if (track_p_fail) continue; + if(debug_) std::cout<<"Pass Track pT Gt cut"<passCutGt("sim_p_gt", sim_p_list[i], weight) ){ + sim_p_fail = 1; + break; + } + } + if (sim_p_fail) continue; + if(debug_) std::cout<<"Pass Sim pT Gt cut"<passCutLt("sim_p_lt", sim_p_list[i], weight) ){ + sim_p_fail = 1; + break; + } + } + if (sim_p_fail) continue; + if(debug_) std::cout<<"Pass Sim pT Lt cut"<Fill1DHisto("numMCparts_h", (float)nParts, weight); @@ -338,7 +381,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int gen = part->getGenStatus(); if (gen != 1) continue; - reg_histos_[region]->FillMCParticle(part, tuples); + reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); std::vector momentum_V = part->getMomentum(); double px = momentum_V.at(0); double py = momentum_V.at(1); @@ -353,7 +396,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double track_max_p_region = -99999; for (int i=0; iat(i); - reg_histos_[region]->FillRecoTrack(track, tuples); + reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); double p = track->getP(); if (p > track_max_p_region){ track_max_p_region = p; @@ -365,7 +408,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x_region = -99999; for (int i=0; iat(i); - reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, tuples); + reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy_region){ ecal_max_energy_region = energy; @@ -378,7 +421,7 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); } - tuples->fill(); + reg_tuples_[region]->fill(); return true; } From 621273be93bb414fbd8d58df363d8324f5b18312 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 20:20:22 -0800 Subject: [PATCH 32/71] bug fix --- processors/src/SimPartProcessor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index c3ecc8cd2..44319564c 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -419,9 +419,9 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - } - reg_tuples_[region]->fill(); + reg_tuples_[region]->fill(); + } return true; } From b068be33446546e062ede7da17142594132854dd Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 20:33:16 -0800 Subject: [PATCH 33/71] bug fix --- processors/config/simPartAna_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index c81de9122..ea57284af 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -77,7 +77,7 @@ RegionPath+'Track_nhit11.json', RegionPath+'Track_nhit12.json', RegionPath+'Track_nhit13.json', - RegionPath+'Track_nhit14.json' + RegionPath+'Track_nhit14.json', RegionPath+'Track_p_ge4.json', RegionPath+'Sim_p_ge1.json', RegionPath+'Sim_p_le1.json' From 9b509f6e8164453fc0b6c790d53e551a1993cce5 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 21:47:59 -0800 Subject: [PATCH 34/71] bug fix --- processors/src/SimPartProcessor.cxx | 61 ++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 44319564c..d5c64f89c 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -376,6 +376,7 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p_region = -99999; + std::vector sim_p_list_region; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -387,20 +388,29 @@ bool SimPartProcessor::process(IEvent* ievent) { double py = momentum_V.at(1); double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); + sim_p_list_region.push_back(p); if (p > sim_max_p_region){ sim_max_p_region = p; } } + int min_n_Track_hits_region = 99999; + double track_omega_region = -99999; double track_max_p_ecal_x_region = -99999; double track_max_p_region = -99999; + std::vector track_p_list_region; for (int i=0; iat(i); + int n_hits = track->getTrackerHitCount(); + if (n_hits < min_n_Track_hits_region) + min_n_Track_hits_region = n_hits; reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); double p = track->getP(); + track_p_list_region.push_back(p); if (p > track_max_p_region){ track_max_p_region = p; track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); + track_omega_region = track->getOmega(); } } @@ -408,17 +418,56 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x_region = -99999; for (int i=0; iat(i); - reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); - double energy = ecal_cluster->getEnergy(); - if (energy > ecal_max_energy_region){ - ecal_max_energy_region = energy; - ecal_max_p_x_region = ecal_cluster->getPosition().at(0); - } + reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); + double energy = ecal_cluster->getEnergy(); + if (energy > ecal_max_energy_region){ + ecal_max_energy_region = energy; + ecal_max_p_x_region = ecal_cluster->getPosition().at(0); + } + } + + double mc_tracker_hit_ecal_max_p_region = -99999; + double mc_tracker_hit_ecal_max_p_x_region = -99999; + for (int i=0; iat(i); + int track_id = mc_tracker_hit_ecal->getPartID(); + double sim_p = -99999; + for (int j=0; jat(j); + int gen = part->getGenStatus(); + if (gen != 1) + continue; + int sim_id = part->getID(); + std::vector momentum_V = part->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + if (sim_id == track_id){ + sim_p = sqrt(px*px + py*py + pz*pz); + break; + } + } + if (sim_p > mc_tracker_hit_ecal_max_p_region){ + mc_tracker_hit_ecal_max_p_region = sim_p; + mc_tracker_hit_ecal_max_p_x_region = mc_tracker_hit_ecal->getPosition().at(0); + } } reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); + + reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); + reg_histos_[region]->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), weight); + reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); reg_tuples_[region]->fill(); } From 738ead14bf88e479923764824ec48796e8297a94 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 7 Nov 2023 22:30:33 -0800 Subject: [PATCH 35/71] bug fix --- processors/src/SimPartProcessor.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index d5c64f89c..0b17db6e8 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -200,6 +200,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double sim_max_p = -99999; std::vector sim_p_list; + sim_p_list.clear(); for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -222,6 +223,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double track_max_p_ecal_x = -99999; double track_max_p = -99999; std::vector track_p_list; + track_p_list.clear(); for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); @@ -376,7 +378,6 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p_region = -99999; - std::vector sim_p_list_region; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -388,7 +389,6 @@ bool SimPartProcessor::process(IEvent* ievent) { double py = momentum_V.at(1); double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); - sim_p_list_region.push_back(p); if (p > sim_max_p_region){ sim_max_p_region = p; } @@ -398,7 +398,6 @@ bool SimPartProcessor::process(IEvent* ievent) { double track_omega_region = -99999; double track_max_p_ecal_x_region = -99999; double track_max_p_region = -99999; - std::vector track_p_list_region; for (int i=0; iat(i); int n_hits = track->getTrackerHitCount(); @@ -406,7 +405,6 @@ bool SimPartProcessor::process(IEvent* ievent) { min_n_Track_hits_region = n_hits; reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); double p = track->getP(); - track_p_list_region.push_back(p); if (p > track_max_p_region){ track_max_p_region = p; track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); From 7032b8c5d1000914a94d1182cb612c6632000de1 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 8 Nov 2023 10:52:49 -0800 Subject: [PATCH 36/71] bug fix --- analysis/plotconfigs/mc/simPart.json | 32 ++++++++++++++-------------- analysis/src/SimPartHistos.cxx | 20 ++++++++--------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index dbf1c5e2b..66915460c 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -143,7 +143,7 @@ "bins" : 50, "minX" : -0.15, "maxX" : 0.15, - "xtitle" : "Track tan#lambda}", + "xtitle" : "Track tan#lambda", "ytitle" : "Events" }, "track_d0_h" : { @@ -284,7 +284,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Track #{phi}_{0}", + "xtitle" : "Track #phi_{0}", "ytitle" : "Track p" }, "track_phi0_tanlambda_hh" : { @@ -294,8 +294,8 @@ "binsY" : 20, "minY" : -0.15, "maxY" : 0.15, - "xtitle" : "Track #{phi}_{0}", - "ytitle" : "Track tan#{lambda}}" + "xtitle" : "Track #phi_{0}", + "ytitle" : "Track tan#lambda" }, "track_z0_tanlambda_hh" : { "binsX" : 10, @@ -304,12 +304,12 @@ "binsY" : 20, "minY" : -0.15, "maxY" : 0.15, - "xtitle" : "Track #z_{0}", - "ytitle" : "Track tan#{lambda}}" + "xtitle" : "Track z_{0}", + "ytitle" : "Track tan#lambda" }, "track_ecal_x_y_hh" : { "binsX" : 100, - "minX" : -50, + "minX" : -500, "maxX" : 400, "binsY" : 50, "minY" : -150, @@ -328,7 +328,7 @@ "ytitle" : "Ecal cluster y" }, "track_ecal_x_track_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -338,7 +338,7 @@ "ytitle" : "Track p" }, "track_ecal_x_sim_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -348,7 +348,7 @@ "ytitle" : "sim p" }, "track_ecal_x_ecal_energy_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -358,7 +358,7 @@ "ytitle" : "Ecal energy" }, "sim_track_x_track_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -368,7 +368,7 @@ "ytitle" : "Track p" }, "sim_track_x_sim_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -378,7 +378,7 @@ "ytitle" : "sim p" }, "sim_track_x_ecal_energy_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -388,7 +388,7 @@ "ytitle" : "Ecal energy" }, "sim_ecal_x_track_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -398,7 +398,7 @@ "ytitle" : "Track p" }, "sim_ecal_x_sim_p_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, @@ -408,7 +408,7 @@ "ytitle" : "sim p" }, "sim_ecal_x_ecal_energy_hh" : { - "binsX" : 100, + "binsX" : 1000, "minX" : -100, "maxX" : 100, "binsY" : 20, diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 1ae18c26f..0ff837668 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -69,13 +69,13 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we Fill1DHisto("track_py_h", py, weight); Fill1DHisto("track_pz_h", pz, weight); Fill1DHisto("track_p_h", p, weight); - Fill1DHisto("track_phi0", phi0, weight); - Fill1DHisto("track_tanlambda", tan_lambda, weight); - Fill1DHisto("track_d0", d0, weight); - Fill1DHisto("track_z0", z0, weight); - Fill1DHisto("track_omega", omega, weight); - Fill1DHisto("track_ecal_x", track_ecal_x, weight); - Fill1DHisto("track_ecal_y", track_ecal_y, weight); + Fill1DHisto("track_phi0_h", phi0, weight); + Fill1DHisto("track_tanlambda_h", tan_lambda, weight); + Fill1DHisto("track_d0_h", d0, weight); + Fill1DHisto("track_z0_h", z0, weight); + Fill1DHisto("track_omega_h", omega, weight); + Fill1DHisto("track_ecal_x_h", track_ecal_x, weight); + Fill1DHisto("track_ecal_y_h", track_ecal_y, weight); Fill2DHisto("track_phi0_p_hh", phi0, p, weight); Fill2DHisto("track_phi0_tanlambda_hh", phi0, tan_lambda, weight); Fill2DHisto("track_z0_tanlambda_hh", z0, tan_lambda, weight); @@ -99,7 +99,7 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we for (int i=0; iaddToVector("track_hit_layrer", hit_layers[i]); + tuples->addToVector("track_hit_layer", hit_layers[i]); } } @@ -112,8 +112,8 @@ void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* Fill1DHisto("ecal_n_hits_h", n_hits, weight); Fill1DHisto("ecal_energy_h", energy, weight); - Fill1DHisto("ecal_x", cluster_x, weight); - Fill1DHisto("ecal_y", cluster_y, weight); + Fill1DHisto("ecal_x_h", cluster_x, weight); + Fill1DHisto("ecal_y_h", cluster_y, weight); Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); tuples->addToVector("ecal_n_hits", n_hits); tuples->addToVector("ecal_energy", energy); From e382c30b97318c453aaf7810d4692addb5b65c77 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 8 Nov 2023 11:56:11 -0800 Subject: [PATCH 37/71] bug fix --- analysis/plotconfigs/mc/simPart.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 66915460c..4a7372b89 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -217,21 +217,21 @@ "ytitle" : "Events" }, "track_ecal_x_diff_h" : { - "bins" : 100, + "bins" : 1000, "minX" : -100, "maxX" : 100, "xtitle" : "Track (at ECal) x - Ecal x", "ytitle" : "Events" }, "sim_track_x_diff_h" : { - "bins" : 100, + "bins" : 1000, "minX" : -100, "maxX" : 100, "xtitle" : "Sim x (at ECal) x - Track x", "ytitle" : "Events" }, "sim_ecal_x_diff_h" : { - "bins" : 100, + "bins" : 1000, "minX" : -100, "maxX" : 100, "xtitle" : "Sim x (at ECal) x - Ecal x", From c11083035edd6b8feaa1f18197da40817d677e9c Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 10 Nov 2023 09:55:25 -0600 Subject: [PATCH 38/71] bug fix --- analysis/include/SimPartHistos.h | 6 +- analysis/src/SimPartHistos.cxx | 61 +++++++++-------- processors/include/SimPartProcessor.h | 2 +- processors/src/SimPartProcessor.cxx | 97 ++++++++++++++++----------- 4 files changed, 94 insertions(+), 72 deletions(-) diff --git a/analysis/include/SimPartHistos.h b/analysis/include/SimPartHistos.h index 461716187..47a8dc5d4 100644 --- a/analysis/include/SimPartHistos.h +++ b/analysis/include/SimPartHistos.h @@ -41,9 +41,9 @@ class SimPartHistos : public HistoManager { * @param RecoEcalClusters * @param weight */ - void FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, float weight = 1.); - void FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight = 1.); - void FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* tuples, float weight = 1.); + void FillMCParticle(MCParticle* part, FlatTupleMaker* tuples = nullptr, float weight = 1.); + void FillRecoTrack(Track* track, FlatTupleMaker* tuples = nullptr, float weight = 1.); + void FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* tuples = nullptr, float weight = 1.); }; #endif //SIMPARTHISTOS_H diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index 0ff837668..febf89321 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -21,14 +21,16 @@ void SimPartHistos::FillMCParticle(MCParticle* part, FlatTupleMaker* tuples, flo Fill2DHisto("sim_pxpz_pypz_hh", px/pz, py/pz, weight); Fill2DHisto("sim_pxpz_p_hh", px/pz, p, weight); Fill2DHisto("sim_pxpz_energy_hh", px/pz, energy, weight); - tuples->addToVector("particle_pdgid", pdg); - tuples->addToVector("sim_px", px); - tuples->addToVector("sim_py", py); - tuples->addToVector("sim_pz", pz); - tuples->addToVector("sim_p", p); - tuples->addToVector("sim_energy", energy); - tuples->addToVector("sim_pxpz", px/pz); - tuples->addToVector("sim_pypz", py/pz); + if (tuples != nullptr){ + tuples->addToVector("particle_pdgid", pdg); + tuples->addToVector("sim_px", px); + tuples->addToVector("sim_py", py); + tuples->addToVector("sim_pz", pz); + tuples->addToVector("sim_p", p); + tuples->addToVector("sim_energy", energy); + tuples->addToVector("sim_pxpz", px/pz); + tuples->addToVector("sim_pypz", py/pz); + } } void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float weight){ @@ -82,24 +84,27 @@ void SimPartHistos::FillRecoTrack(Track* track, FlatTupleMaker* tuples, float we //Fill2DHisto("track_x_y_hh", track_x, track_y, weight); Fill2DHisto("track_ecal_x_y_hh", track_ecal_x, track_ecal_y, weight); - tuples->addToVector("track_n_hits", n_hits); - tuples->addToVector("track_px", px); - tuples->addToVector("track_py", py); - tuples->addToVector("track_pz", pz); - tuples->addToVector("track_p", p); - tuples->addToVector("track_phi0", phi0); - tuples->addToVector("track_tanlambda", tan_lambda); - tuples->addToVector("track_d0", d0); - tuples->addToVector("track_z0", z0); - tuples->addToVector("track_omega", omega); - //tuples->addToVector("track_x", track_x); - //tuples->addToVector("track_y", track_y); - tuples->addToVector("track_ecal_x", track_ecal_x); - tuples->addToVector("track_ecal_y", track_ecal_y); + if (tuples != nullptr){ + tuples->addToVector("track_n_hits", n_hits); + tuples->addToVector("track_px", px); + tuples->addToVector("track_py", py); + tuples->addToVector("track_pz", pz); + tuples->addToVector("track_p", p); + tuples->addToVector("track_phi0", phi0); + tuples->addToVector("track_tanlambda", tan_lambda); + tuples->addToVector("track_d0", d0); + tuples->addToVector("track_z0", z0); + tuples->addToVector("track_omega", omega); + //tuples->addToVector("track_x", track_x); + //tuples->addToVector("track_y", track_y); + tuples->addToVector("track_ecal_x", track_ecal_x); + tuples->addToVector("track_ecal_y", track_ecal_y); + } for (int i=0; iaddToVector("track_hit_layer", hit_layers[i]); + if (tuples != nullptr) + tuples->addToVector("track_hit_layer", hit_layers[i]); } } @@ -115,10 +120,12 @@ void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* Fill1DHisto("ecal_x_h", cluster_x, weight); Fill1DHisto("ecal_y_h", cluster_y, weight); Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight); - tuples->addToVector("ecal_n_hits", n_hits); - tuples->addToVector("ecal_energy", energy); - tuples->addToVector("ecal_x", cluster_x); - tuples->addToVector("ecal_y", cluster_y); + if (tuples != nullptr){ + tuples->addToVector("ecal_n_hits", n_hits); + tuples->addToVector("ecal_energy", energy); + tuples->addToVector("ecal_x", cluster_x); + tuples->addToVector("ecal_y", cluster_y); + } } diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index 594c7d116..753c1f1fb 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -114,7 +114,7 @@ class SimPartProcessor : public Processor { std::map> reg_histos_; //!< description typedef std::map>::iterator reg_it; //!< description //std::map> reg_tuples_; //!< description - std::map reg_tuples_; //!< description + //std::map reg_tuples_; //!< description int debug_{0}; //!< Debug Level diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 0b17db6e8..82b907445 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -94,6 +94,7 @@ void SimPartProcessor::initialize(TTree* tree) { reg_histos_[regname]->DefineHistos(); //reg_tuples_[regname] = std::make_shared(anaName_+"_"+regname+"_tree"); + /* reg_tuples_[regname] = new FlatTupleMaker(anaName_+"_"+regname+"_tree"); reg_tuples_[regname]->addVariable("numMCparts"); reg_tuples_[regname]->addVariable("numRecoTracks"); @@ -128,6 +129,7 @@ void SimPartProcessor::initialize(TTree* tree) { reg_tuples_[regname]->addVector("ecal_energy"); reg_tuples_[regname]->addVector("ecal_x"); reg_tuples_[regname]->addVector("ecal_y"); + */ regions_.push_back(regname); } @@ -278,21 +280,26 @@ bool SimPartProcessor::process(IEvent* ievent) { } } - histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); - - histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); - histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), weight); - histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), weight); - - histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); - histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); - histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); - histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), track_max_p, weight); - histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), sim_max_p, weight); - histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), ecal_max_energy, weight); - histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), track_max_p, weight); - histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), sim_max_p, weight); - histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), ecal_max_energy, weight); + if (track_max_p != -99999 && sim_max_p != -99999) + histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + if (track_max_p_ecal_x != -99999 && ecal_max_p_x != 99999){ + histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); + histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); + } + if (mc_tracker_hit_ecal_max_p_x != -99999 && track_max_p_ecal_x != 99999){ + histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), weight); + histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), track_max_p, weight); + histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), sim_max_p, weight); + histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), ecal_max_energy, weight); + } + if (mc_tracker_hit_ecal_max_p_x != -99999 && ecal_max_p_x != 99999){ + histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), weight); + histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), ecal_max_energy, weight); + } tuples->fill(); @@ -370,12 +377,12 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill1DHisto("numSimEcalHits_h", (float)nSim_Ecal_hits, weight); reg_histos_[region]->Fill1DHisto("numRecoTrackerClusters_h", (float)nReco_Tracker_clusters, weight); reg_histos_[region]->Fill1DHisto("numRecoEcalClusters_h", (float)nReco_Ecal_clusters, weight); - reg_tuples_[region]->setVariableValue("numMCparts", (float)nParts); - reg_tuples_[region]->setVariableValue("numRecoTracks", (float)nReco_Tracks); - reg_tuples_[region]->setVariableValue("numSimTrackerHits", (float)nSim_Tracker_hits); - reg_tuples_[region]->setVariableValue("numSimEcalHits", (float)nSim_Ecal_hits); - reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); - reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); + //reg_tuples_[region]->setVariableValue("numMCparts", (float)nParts); + //reg_tuples_[region]->setVariableValue("numRecoTracks", (float)nReco_Tracks); + //reg_tuples_[region]->setVariableValue("numSimTrackerHits", (float)nSim_Tracker_hits); + //reg_tuples_[region]->setVariableValue("numSimEcalHits", (float)nSim_Ecal_hits); + //reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); + //reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p_region = -99999; for (int i=0; igetGenStatus(); if (gen != 1) continue; - reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); + //reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); + reg_histos_[region]->FillMCParticle(part); std::vector momentum_V = part->getMomentum(); double px = momentum_V.at(0); double py = momentum_V.at(1); @@ -403,7 +411,8 @@ bool SimPartProcessor::process(IEvent* ievent) { int n_hits = track->getTrackerHitCount(); if (n_hits < min_n_Track_hits_region) min_n_Track_hits_region = n_hits; - reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); + //reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); + reg_histos_[region]->FillRecoTrack(track); double p = track->getP(); if (p > track_max_p_region){ track_max_p_region = p; @@ -416,7 +425,8 @@ bool SimPartProcessor::process(IEvent* ievent) { double ecal_max_p_x_region = -99999; for (int i=0; iat(i); - reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); + //reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); + reg_histos_[region]->FillRecoEcalCuster(ecal_cluster); double energy = ecal_cluster->getEnergy(); if (energy > ecal_max_energy_region){ ecal_max_energy_region = energy; @@ -451,23 +461,28 @@ bool SimPartProcessor::process(IEvent* ievent) { } } - reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); - - reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); - reg_histos_[region]->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), weight); - reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); - - reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), ecal_max_energy_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + if (track_max_p != -99999 && sim_max_p != -99999) + histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); + if (track_max_p_ecal_x_region != -99999 && ecal_max_p_x_region != 99999){ + histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); + histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); + histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + } + if (mc_tracker_hit_ecal_max_p_x_region != -99999 && track_max_p_ecal_x_region != 99999){ + histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), weight); + histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), track_max_p_region, weight); + histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), sim_max_p_region, weight); + histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), ecal_max_energy_region, weight); + } + if (mc_tracker_hit_ecal_max_p_x_region != -99999 && ecal_max_p_x_region != 99999){ + histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); + histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); + histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + } - reg_tuples_[region]->fill(); + //reg_tuples_[region]->fill(); } return true; @@ -489,7 +504,7 @@ void SimPartProcessor::finalize() { outF_->cd(dirName.c_str()); reg_selectors_[it->first]->getCutFlowHisto()->Scale(0.5); reg_selectors_[it->first]->getCutFlowHisto()->Write(); - reg_tuples_[it->first]->writeTree(); + //reg_tuples_[it->first]->writeTree(); outF_->cd(); } outF_->Close(); From ec02d901267ac36788096c44f182d49883968303 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 11 Nov 2023 14:41:10 -0600 Subject: [PATCH 39/71] plot updates --- analysis/plotconfigs/mc/simPart.json | 48 +++++++++---------- analysis/selections/simPart/Sim_p_ge1.json | 7 --- analysis/selections/simPart/Sim_p_le1.json | 7 --- .../simPart/Track_Ecal_Sim_p_ge1.json | 17 +++++++ .../simPart/Track_Ecal_Sim_p_le1.json | 17 +++++++ .../simPart/Track_Ecal_Track_p_ge4.json | 17 +++++++ analysis/selections/simPart/Track_p_ge4.json | 7 --- processors/config/simPartAna_cfg.py | 6 +-- processors/src/SimPartProcessor.cxx | 16 +++---- 9 files changed, 86 insertions(+), 56 deletions(-) delete mode 100644 analysis/selections/simPart/Sim_p_ge1.json delete mode 100644 analysis/selections/simPart/Sim_p_le1.json create mode 100644 analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json create mode 100644 analysis/selections/simPart/Track_Ecal_Sim_p_le1.json create mode 100644 analysis/selections/simPart/Track_Ecal_Track_p_ge4.json delete mode 100644 analysis/selections/simPart/Track_p_ge4.json diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 4a7372b89..1ea619f4d 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -134,15 +134,15 @@ }, "track_phi0_h" : { "bins" : 200, - "minX" : -0.2, - "maxX" : 0.5, + "minX" : -0.8, + "maxX" : 0.8, "xtitle" : "Track #phi_{0}", "ytitle" : "Events" }, "track_tanlambda_h" : { "bins" : 50, - "minX" : -0.15, - "maxX" : 0.15, + "minX" : -0.2, + "maxX" : 0.2, "xtitle" : "Track tan#lambda", "ytitle" : "Events" }, @@ -169,15 +169,15 @@ }, "track_ecal_x_h" : { "bins" : 100, - "minX" : -500, - "maxX" : 400, + "minX" : -600, + "maxX" : 600, "xtitle" : "Track ECal Position x", "ytitle" : "Events" }, "track_ecal_y_h" : { "bins" : 50, - "minX" : -150, - "maxX" : 150, + "minX" : -200, + "maxX" : 200, "xtitle" : "Track ECal Position y", "ytitle" : "Events" }, @@ -268,7 +268,7 @@ "ytitle" : "sim energy" }, "track_sim_p_sim_p_hh" : { - "binsX" : 20, + "binsX" : 100, "minX" : 0, "maxX" : 2, "binsY" : 20, @@ -279,8 +279,8 @@ }, "track_phi0_p_hh" : { "binsX" : 100, - "minX" : -0.2, - "maxX" : 0.5, + "minX" : -0.8, + "maxX" : 0.8, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -289,11 +289,11 @@ }, "track_phi0_tanlambda_hh" : { "binsX" : 100, - "minX" : -0.2, - "maxX" : 0.5, + "minX" : -0.8, + "maxX" : 0.8, "binsY" : 20, - "minY" : -0.15, - "maxY" : 0.15, + "minY" : -0.2, + "maxY" : 0.2, "xtitle" : "Track #phi_{0}", "ytitle" : "Track tan#lambda" }, @@ -302,18 +302,18 @@ "minX" : -20, "maxX" : 20, "binsY" : 20, - "minY" : -0.15, - "maxY" : 0.15, + "minY" : -0.2, + "maxY" : 0.8, "xtitle" : "Track z_{0}", "ytitle" : "Track tan#lambda" }, "track_ecal_x_y_hh" : { "binsX" : 100, - "minX" : -500, - "maxX" : 400, + "minX" : -600, + "maxX" : 600, "binsY" : 50, - "minY" : -150, - "maxY" : 150, + "minY" : -200, + "maxY" : 200, "xtitle" : "Track (at ECal) x", "ytitle" : "Track (at ECal) y" }, @@ -364,7 +364,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "xtitle" : "Track (at ECal) x - Sim x (at ECal)", "ytitle" : "Track p" }, "sim_track_x_sim_p_hh" : { @@ -374,7 +374,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "xtitle" : "Track (at ECal) x - Sim x (at ECal)", "ytitle" : "sim p" }, "sim_track_x_ecal_energy_hh" : { @@ -384,7 +384,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Track (at ECal) x", + "xtitle" : "Track (at ECal) x - Sim x (at ECal)", "ytitle" : "Ecal energy" }, "sim_ecal_x_track_p_hh" : { diff --git a/analysis/selections/simPart/Sim_p_ge1.json b/analysis/selections/simPart/Sim_p_ge1.json deleted file mode 100644 index 83c0871f7..000000000 --- a/analysis/selections/simPart/Sim_p_ge1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sim_p_gt" : { - "cut" : 1.0, - "id" : 0, - "info" : "Sim pT >= 1" - } -} diff --git a/analysis/selections/simPart/Sim_p_le1.json b/analysis/selections/simPart/Sim_p_le1.json deleted file mode 100644 index 397cc40cf..000000000 --- a/analysis/selections/simPart/Sim_p_le1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sim_p_lt" : { - "cut" : 1.0, - "id" : 0, - "info" : "Sim pT <= 1" - } -} diff --git a/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json b/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json new file mode 100644 index 000000000..f0af7c531 --- /dev/null +++ b/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json @@ -0,0 +1,17 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" + }, + "sim_p_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "Sim pT >= 1" + } +} diff --git a/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json b/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json new file mode 100644 index 000000000..aa3d291ad --- /dev/null +++ b/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json @@ -0,0 +1,17 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" + }, + "sim_p_lt" : { + "cut" : 1.0, + "id" : 0, + "info" : "Sim pT <= 1" + } +} diff --git a/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json b/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json new file mode 100644 index 000000000..b56a7abf2 --- /dev/null +++ b/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json @@ -0,0 +1,17 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" + }, + "track_p_gt" : { + "cut" : 4.0, + "id" : 0, + "info" : "Tracks pT >= 4" + } +} diff --git a/analysis/selections/simPart/Track_p_ge4.json b/analysis/selections/simPart/Track_p_ge4.json deleted file mode 100644 index 9a2edc6e9..000000000 --- a/analysis/selections/simPart/Track_p_ge4.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "track_p_gt" : { - "cut" : 4.0, - "id" : 0, - "info" : "Tracks pT >= 4" - } -} diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index ea57284af..02c5583a0 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -78,9 +78,9 @@ RegionPath+'Track_nhit12.json', RegionPath+'Track_nhit13.json', RegionPath+'Track_nhit14.json', - RegionPath+'Track_p_ge4.json', - RegionPath+'Sim_p_ge1.json', - RegionPath+'Sim_p_le1.json' + RegionPath+'Track_Ecal_Track_p_ge4.json', + RegionPath+'Track_Ecal_Sim_p_ge1.json', + RegionPath+'Track_Ecal_Sim_p_le1.json' ] # Sequence which the processors will run. diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 82b907445..1aaa8e417 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -289,10 +289,10 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); } if (mc_tracker_hit_ecal_max_p_x != -99999 && track_max_p_ecal_x != 99999){ - histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), weight); - histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), track_max_p, weight); - histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), sim_max_p, weight); - histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-track_max_p_ecal_x), ecal_max_energy, weight); + histos->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), weight); + histos->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); } if (mc_tracker_hit_ecal_max_p_x != -99999 && ecal_max_p_x != 99999){ histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), weight); @@ -470,10 +470,10 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); } if (mc_tracker_hit_ecal_max_p_x_region != -99999 && track_max_p_ecal_x_region != 99999){ - histos->Fill1DHisto("sim_track_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), weight); - histos->Fill2DHisto("sim_track_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), track_max_p_region, weight); - histos->Fill2DHisto("sim_track_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), sim_max_p_region, weight); - histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-track_max_p_ecal_x_region), ecal_max_energy_region, weight); + histos->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); + histos->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); + histos->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); + histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); } if (mc_tracker_hit_ecal_max_p_x_region != -99999 && ecal_max_p_x_region != 99999){ histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); From f2056e08f73082d09a93480898b67313379e489e Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 11 Nov 2023 21:20:03 -0600 Subject: [PATCH 40/71] plot updates --- analysis/plotconfigs/mc/simPart.json | 2 +- processors/src/SimPartProcessor.cxx | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 1ea619f4d..a1c145593 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -303,7 +303,7 @@ "maxX" : 20, "binsY" : 20, "minY" : -0.2, - "maxY" : 0.8, + "maxY" : 0.2, "xtitle" : "Track z_{0}", "ytitle" : "Track tan#lambda" }, diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 1aaa8e417..9ecc71e53 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -461,25 +461,25 @@ bool SimPartProcessor::process(IEvent* ievent) { } } - if (track_max_p != -99999 && sim_max_p != -99999) - histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); + if (track_max_p_region != -99999 && sim_max_p_region != -99999) + reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); if (track_max_p_ecal_x_region != -99999 && ecal_max_p_x_region != 99999){ - histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); - histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); - histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); } if (mc_tracker_hit_ecal_max_p_x_region != -99999 && track_max_p_ecal_x_region != 99999){ - histos->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); - histos->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); - histos->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); - histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); } if (mc_tracker_hit_ecal_max_p_x_region != -99999 && ecal_max_p_x_region != 99999){ - histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); - histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); - histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); } //reg_tuples_[region]->fill(); From 07c8a95141968441635d6e36821654b17e310619 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 13 Nov 2023 01:05:24 -0600 Subject: [PATCH 41/71] add plots and regions --- analysis/plotconfigs/mc/simPart.json | 68 ++++++++++++++-- analysis/selections/simPart/Track_bottom.json | 12 +++ .../simPart/Track_noEcal_lowtanlambda.json | 22 ++++++ analysis/selections/simPart/Track_top.json | 12 +++ .../simPart/noTrack_Ecal_bottom.json | 17 ++++ .../selections/simPart/noTrack_Ecal_top.json | 17 ++++ processors/config/simPartAna_cfg.py | 7 +- processors/src/SimPartProcessor.cxx | 77 +++++++++++++++++-- 8 files changed, 216 insertions(+), 16 deletions(-) create mode 100644 analysis/selections/simPart/Track_bottom.json create mode 100644 analysis/selections/simPart/Track_noEcal_lowtanlambda.json create mode 100644 analysis/selections/simPart/Track_top.json create mode 100644 analysis/selections/simPart/noTrack_Ecal_bottom.json create mode 100644 analysis/selections/simPart/noTrack_Ecal_top.json diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index a1c145593..c649c02c9 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -237,6 +237,20 @@ "xtitle" : "Sim x (at ECal) x - Ecal x", "ytitle" : "Events" }, + "track_phi0_simpxpz_h" : { + "bins" : 100, + "minX" : -2, + "maxX" : 2, + "xtitle" : "Track #phi_{0} / Sim p_{x}/p_{z}", + "ytitle" : "Events" + }, + "track_tanlambda_simpypz_h" : { + "bins" : 100, + "minX" : -2, + "maxX" : 2, + "xtitle" : "Track tan#lambda / Sim p_{y}/p_{z}", + "ytitle" : "Events" + }, "sim_pxpz_pypz_hh" : { "binsX" : 200, "minX" : -0.8, @@ -278,7 +292,7 @@ "ytitle" : "sim p" }, "track_phi0_p_hh" : { - "binsX" : 100, + "binsX" : 200, "minX" : -0.8, "maxX" : 0.8, "binsY" : 20, @@ -288,10 +302,10 @@ "ytitle" : "Track p" }, "track_phi0_tanlambda_hh" : { - "binsX" : 100, + "binsX" : 200, "minX" : -0.8, "maxX" : 0.8, - "binsY" : 20, + "binsY" : 50, "minY" : -0.2, "maxY" : 0.2, "xtitle" : "Track #phi_{0}", @@ -301,7 +315,7 @@ "binsX" : 10, "minX" : -20, "maxX" : 20, - "binsY" : 20, + "binsY" : 50, "minY" : -0.2, "maxY" : 0.2, "xtitle" : "Track z_{0}", @@ -394,7 +408,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Ecal x", + "xtitle" : "Ecal x - Sim x (at ECal)", "ytitle" : "Track p" }, "sim_ecal_x_sim_p_hh" : { @@ -404,7 +418,7 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Ecal x", + "xtitle" : "Ecal x - Sim x (at ECal)", "ytitle" : "sim p" }, "sim_ecal_x_ecal_energy_hh" : { @@ -414,7 +428,47 @@ "binsY" : 20, "minY" : 0, "maxY" : 10, - "xtitle" : "Sim x (at ECal) - Ecal x", + "xtitle" : "Ecal x - Sim x (at ECal)", "ytitle" : "Ecal energy" + }, + "track_tanlambda_simpypz_phi0_simpxpz_hh" : { + "binsX" : 100, + "minX" : -2, + "maxX" : 2, + "binsY" : 100, + "minY" : -2, + "maxY" : 2, + "xtitle" : "Track #phi_{0} / Sim p_{x}/p_{z}", + "ytitle" : "Track tan#lambda / Sim p_{y}/p_{z}" + }, + "track_phi0_simpxpz_sim_p_hh" : { + "bins" : 100, + "minX" : -2, + "maxX" : 2, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track #phi_{0} / Sim p_{x}/p_{z}", + "ytitle" : "Sim p" + }, + "track_tanlambda_simpypz_sim_p_hh" : { + "bins" : 100, + "minX" : -2, + "maxX" : 2, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track tan#lambda / Sim p_{y}/p_{z}", + "ytitle" : "Sim p" + }, + "track_ecal_x_ecal_x_hh" : { + "binsX" : 100, + "minX" : -600, + "maxX" : 600, + "binsY" : 1000, + "minY" : -100, + "maxY" : 100, + "xtitle" : "ECal x", + "ytitle" : "Track (at ECal) x - Ecal x" } } diff --git a/analysis/selections/simPart/Track_bottom.json b/analysis/selections/simPart/Track_bottom.json new file mode 100644 index 000000000..23dd2c9eb --- /dev/null +++ b/analysis/selections/simPart/Track_bottom.json @@ -0,0 +1,12 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "sim_pypz_lt" : { + "cut" : 0.0, + "id" : 1, + "info" : "Sim py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/Track_noEcal_lowtanlambda.json b/analysis/selections/simPart/Track_noEcal_lowtanlambda.json new file mode 100644 index 000000000..b41f4c3f8 --- /dev/null +++ b/analysis/selections/simPart/Track_noEcal_lowtanlambda.json @@ -0,0 +1,22 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 0.0, + "id" : 1, + "info" : "N Ecal Clusters == 0" + }, + "sim_pypz_lt" : { + "cut" : 0.06, + "id" : 2, + "info" : "Sim py/pz <= 0.06" + }, + "sim_pypz_gt" : { + "cut" : -0.06, + "id" : 3, + "info" : "Sim py/pz >= -0.06" + } +} diff --git a/analysis/selections/simPart/Track_top.json b/analysis/selections/simPart/Track_top.json new file mode 100644 index 000000000..13bdd9295 --- /dev/null +++ b/analysis/selections/simPart/Track_top.json @@ -0,0 +1,12 @@ +{ + "n_track_gt" : { + "cut" : 1.0, + "id" : 0, + "info" : "N Tracks >= 1" + }, + "sim_pypz_gt" : { + "cut" : 0.0, + "id" : 1, + "info" : "Sim py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/noTrack_Ecal_bottom.json b/analysis/selections/simPart/noTrack_Ecal_bottom.json new file mode 100644 index 000000000..a16cacb06 --- /dev/null +++ b/analysis/selections/simPart/noTrack_Ecal_bottom.json @@ -0,0 +1,17 @@ +{ + "n_track_eq" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks == 0" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" + }, + "sim_pypz_lt" : { + "cut" : 0.0, + "id" : 2, + "info" : "Sim py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/noTrack_Ecal_top.json b/analysis/selections/simPart/noTrack_Ecal_top.json new file mode 100644 index 000000000..6b5d99047 --- /dev/null +++ b/analysis/selections/simPart/noTrack_Ecal_top.json @@ -0,0 +1,17 @@ +{ + "n_track_eq" : { + "cut" : 0.0, + "id" : 0, + "info" : "N Tracks == 0" + }, + "n_ecal_cluster_gt" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Ecal Clusters >= 1" + }, + "sim_pypz_gt" : { + "cut" : 0.0, + "id" : 2, + "info" : "Sim py/pz >= 0.0" + } +} diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index 02c5583a0..7b5512563 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -80,7 +80,12 @@ RegionPath+'Track_nhit14.json', RegionPath+'Track_Ecal_Track_p_ge4.json', RegionPath+'Track_Ecal_Sim_p_ge1.json', - RegionPath+'Track_Ecal_Sim_p_le1.json' + RegionPath+'Track_Ecal_Sim_p_le1.json', + RegionPath+'Track_noEcal_lowtanlambda.json', + RegionPath+'Track_top.json', + RegionPath+'Track_bottom.json', + RegionPath+'noTrack_Ecal_top.json', + RegionPath+'noTrack_Ecal_bottom.json' ] # Sequence which the processors will run. diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 9ecc71e53..a8bcfff06 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -201,8 +201,12 @@ bool SimPartProcessor::process(IEvent* ievent) { tuples->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p = -99999; + double sim_pxpz = -99999; + double sim_pypz = -99999; std::vector sim_p_list; + std::vector sim_pypz_list; sim_p_list.clear(); + sim_pypz_list.clear(); for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -215,13 +219,18 @@ bool SimPartProcessor::process(IEvent* ievent) { double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); sim_p_list.push_back(p); + sim_pypz_list.push_back(py/pz); if (p > sim_max_p){ sim_max_p = p; + sim_pxpz = px/pz; + sim_pypz = py/pz; } } int min_n_Track_hits = 99999; double track_omega = -99999; + double track_phi0 = -99999; + double track_tanlamda = -99999; double track_max_p_ecal_x = -99999; double track_max_p = -99999; std::vector track_p_list; @@ -238,6 +247,8 @@ bool SimPartProcessor::process(IEvent* ievent) { track_max_p = p; track_max_p_ecal_x = track->getPositionAtEcal().at(0); track_omega = track->getOmega(); + track_phi0 = track->getPhi(); + track_tanlamda = track->getTanLambda(); } } @@ -282,11 +293,23 @@ bool SimPartProcessor::process(IEvent* ievent) { if (track_max_p != -99999 && sim_max_p != -99999) histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + + if (sim_pxpz != -99999 && track_phi0 != -99999){ + histos->Fill1DHisto("track_phi0_simpxpz_h", (track_phi0/sim_pxpz), weight); + histos->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0/sim_pxpz), sim_max_p, weight); + } + if (sim_pypz != -99999 && track_tanlamda != -99999){ + histos->Fill1DHisto("track_phi0_simpxpz_h", (track_tanlamda/sim_pypz), weight); + histos->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); + } + if (sim_pxpz != -99999 && track_phi0 != -99999 && sim_pypz != -99999 && track_tanlamda != -99999) + histos->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); if (track_max_p_ecal_x != -99999 && ecal_max_p_x != 99999){ histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); histos->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); histos->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); + histos->Fill2DHisto("track_ecal_x_ecal_x_hh", ecal_max_p_x, (track_max_p_ecal_x-ecal_max_p_x), weight); } if (mc_tracker_hit_ecal_max_p_x != -99999 && track_max_p_ecal_x != 99999){ histos->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), weight); @@ -295,10 +318,10 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); } if (mc_tracker_hit_ecal_max_p_x != -99999 && ecal_max_p_x != 99999){ - histos->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), weight); - histos->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), track_max_p, weight); - histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), sim_max_p, weight); - histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x-ecal_max_p_x), ecal_max_energy, weight); + histos->Fill1DHisto("sim_ecal_x_diff_h", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), weight); + histos->Fill2DHisto("sim_ecal_x_track_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), track_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); + histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (-ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); } tuples->fill(); @@ -368,6 +391,25 @@ bool SimPartProcessor::process(IEvent* ievent) { } if (sim_p_fail) continue; if(debug_) std::cout<<"Pass Sim pT Lt cut"<passCutLt("sim_pypz_gt", sim_pypz_list[i], weight) ){ + sim_pypz_fail = 1; + break; + } + } + if (sim_pypz_fail) continue; + if(debug_) std::cout<<"Pass Sim py/pz Gt cut"<passCutLt("sim_pypz_lt", sim_pypz_list[i], weight) ){ + sim_pypz_fail = 1; + break; + } + } + if (sim_pypz_fail) continue; + if(debug_) std::cout<<"Pass Sim py/pz Lt cut"<setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); double sim_max_p_region = -99999; + double sim_pxpz_region = -99999; + double sim_pypz_region = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -399,10 +443,14 @@ bool SimPartProcessor::process(IEvent* ievent) { double p = sqrt(px*px + py*py + pz*pz); if (p > sim_max_p_region){ sim_max_p_region = p; + sim_pxpz_region = px/pz; + sim_pypz_region = py/pz; } } int min_n_Track_hits_region = 99999; + double track_phi0_region = -99999; + double track_tanlamda_region = -99999; double track_omega_region = -99999; double track_max_p_ecal_x_region = -99999; double track_max_p_region = -99999; @@ -418,6 +466,8 @@ bool SimPartProcessor::process(IEvent* ievent) { track_max_p_region = p; track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); track_omega_region = track->getOmega(); + track_phi0_region = track->getPhi(); + track_tanlamda_region = track->getTanLambda(); } } @@ -463,6 +513,16 @@ bool SimPartProcessor::process(IEvent* ievent) { if (track_max_p_region != -99999 && sim_max_p_region != -99999) reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); + if (sim_pxpz_region != -99999 && track_phi0_region != -99999){ + reg_histos_[region]->Fill1DHisto("track_phi0_simpxpz_h", (track_phi0_region/sim_pxpz_region), weight); + reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0_region/sim_pxpz_region), sim_max_p_region, weight); + } + if (sim_pypz_region != -99999 && track_tanlamda_region != -99999){ + reg_histos_[region]->Fill1DHisto("track_tanlambda_simpypz_h", (track_tanlamda_region/sim_pypz_region), weight); + reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_sim_p_hh", (track_tanlamda_region/sim_pypz_region), sim_max_p_region, weight); + } + if (sim_pxpz_region != -99999 && track_phi0_region != -99999 && sim_pypz_region != -99999 && track_tanlamda_region != -99999) + reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0_region/sim_pxpz_region), (track_tanlamda_region/sim_pypz_region), weight); if (track_max_p_ecal_x_region != -99999 && ecal_max_p_x_region != 99999){ reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); @@ -474,12 +534,13 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_x_hh", ecal_max_p_x_region, (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); } if (mc_tracker_hit_ecal_max_p_x_region != -99999 && ecal_max_p_x_region != 99999){ - reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (mc_tracker_hit_ecal_max_p_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); + reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); } //reg_tuples_[region]->fill(); From 1eacf4afa83f8369abf60d088eec50894ee4f497 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 13 Nov 2023 01:12:55 -0600 Subject: [PATCH 42/71] add plots and regions --- processors/src/SimPartProcessor.cxx | 108 ++++++++++++++++++---------- 1 file changed, 71 insertions(+), 37 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index a8bcfff06..9fa9d59b7 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -426,9 +426,9 @@ bool SimPartProcessor::process(IEvent* ievent) { //reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); //reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); - double sim_max_p_region = -99999; - double sim_pxpz_region = -99999; - double sim_pypz_region = -99999; + //double sim_max_p_region = -99999; + //double sim_pxpz_region = -99999; + //double sim_pypz_region = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -436,54 +436,55 @@ bool SimPartProcessor::process(IEvent* ievent) { continue; //reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); reg_histos_[region]->FillMCParticle(part); - std::vector momentum_V = part->getMomentum(); - double px = momentum_V.at(0); - double py = momentum_V.at(1); - double pz = momentum_V.at(2); - double p = sqrt(px*px + py*py + pz*pz); - if (p > sim_max_p_region){ - sim_max_p_region = p; - sim_pxpz_region = px/pz; - sim_pypz_region = py/pz; - } + //std::vector momentum_V = part->getMomentum(); + //double px = momentum_V.at(0); + //double py = momentum_V.at(1); + //double pz = momentum_V.at(2); + //double p = sqrt(px*px + py*py + pz*pz); + //if (p > sim_max_p_region){ + // sim_max_p_region = p; + // sim_pxpz_region = px/pz; + // sim_pypz_region = py/pz; + //} } - int min_n_Track_hits_region = 99999; - double track_phi0_region = -99999; - double track_tanlamda_region = -99999; - double track_omega_region = -99999; - double track_max_p_ecal_x_region = -99999; - double track_max_p_region = -99999; + //int min_n_Track_hits_region = 99999; + //double track_phi0_region = -99999; + //double track_tanlamda_region = -99999; + //double track_omega_region = -99999; + //double track_max_p_ecal_x_region = -99999; + //double track_max_p_region = -99999; for (int i=0; iat(i); - int n_hits = track->getTrackerHitCount(); - if (n_hits < min_n_Track_hits_region) - min_n_Track_hits_region = n_hits; + //int n_hits = track->getTrackerHitCount(); + //if (n_hits < min_n_Track_hits_region) + // min_n_Track_hits_region = n_hits; //reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); reg_histos_[region]->FillRecoTrack(track); - double p = track->getP(); - if (p > track_max_p_region){ - track_max_p_region = p; - track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); - track_omega_region = track->getOmega(); - track_phi0_region = track->getPhi(); - track_tanlamda_region = track->getTanLambda(); - } + //double p = track->getP(); + //if (p > track_max_p_region){ + // track_max_p_region = p; + // track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); + // track_omega_region = track->getOmega(); + // track_phi0_region = track->getPhi(); + // track_tanlamda_region = track->getTanLambda(); + //} } - double ecal_max_energy_region = -99999; - double ecal_max_p_x_region = -99999; + //double ecal_max_energy_region = -99999; + //double ecal_max_p_x_region = -99999; for (int i=0; iat(i); //reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); reg_histos_[region]->FillRecoEcalCuster(ecal_cluster); - double energy = ecal_cluster->getEnergy(); - if (energy > ecal_max_energy_region){ - ecal_max_energy_region = energy; - ecal_max_p_x_region = ecal_cluster->getPosition().at(0); - } + //double energy = ecal_cluster->getEnergy(); + //if (energy > ecal_max_energy_region){ + // ecal_max_energy_region = energy; + // ecal_max_p_x_region = ecal_cluster->getPosition().at(0); + //} } + /* double mc_tracker_hit_ecal_max_p_region = -99999; double mc_tracker_hit_ecal_max_p_x_region = -99999; for (int i=0; iFill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); } + */ + + if (track_max_p != -99999 && sim_max_p != -99999) + reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); + + if (sim_pxpz != -99999 && track_phi0 != -99999){ + reg_histos_[region]->Fill1DHisto("track_phi0_simpxpz_h", (track_phi0/sim_pxpz), weight); + reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0/sim_pxpz), sim_max_p, weight); + } + if (sim_pypz != -99999 && track_tanlamda != -99999){ + reg_histos_[region]->Fill1DHisto("track_phi0_simpxpz_h", (track_tanlamda/sim_pypz), weight); + reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); + } + if (sim_pxpz != -99999 && track_phi0 != -99999 && sim_pypz != -99999 && track_tanlamda != -99999) + reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); + if (track_max_p_ecal_x != -99999 && ecal_max_p_x != 99999){ + reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x-ecal_max_p_x), sim_max_p, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x-ecal_max_p_x), ecal_max_energy, weight); + reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_x_hh", ecal_max_p_x, (track_max_p_ecal_x-ecal_max_p_x), weight); + } + if (mc_tracker_hit_ecal_max_p_x != -99999 && track_max_p_ecal_x != 99999){ + reg_histos_[region]->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), track_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); + } + if (mc_tracker_hit_ecal_max_p_x != -99999 && ecal_max_p_x != 99999){ + reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), track_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (-ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); //reg_tuples_[region]->fill(); } From 1a284a121da3b21764897afbbc7c044547c9cc81 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 13 Nov 2023 01:18:05 -0600 Subject: [PATCH 43/71] add plots and regions --- processors/src/SimPartProcessor.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 9fa9d59b7..c4530ba71 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -401,7 +401,7 @@ bool SimPartProcessor::process(IEvent* ievent) { if (sim_pypz_fail) continue; if(debug_) std::cout<<"Pass Sim py/pz Gt cut"<passCutLt("sim_pypz_lt", sim_pypz_list[i], weight) ){ sim_pypz_fail = 1; @@ -576,7 +576,8 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), track_max_p, weight); reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (-ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); - + } + //reg_tuples_[region]->fill(); } From bb9fb74105ce018033916ea5ca162a9d5c65b9f1 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 13 Nov 2023 01:24:24 -0600 Subject: [PATCH 44/71] add plots and regions --- analysis/plotconfigs/mc/simPart.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index c649c02c9..8cf8ab713 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -442,7 +442,7 @@ "ytitle" : "Track tan#lambda / Sim p_{y}/p_{z}" }, "track_phi0_simpxpz_sim_p_hh" : { - "bins" : 100, + "binsX" : 100, "minX" : -2, "maxX" : 2, "binsY" : 20, @@ -452,7 +452,7 @@ "ytitle" : "Sim p" }, "track_tanlambda_simpypz_sim_p_hh" : { - "bins" : 100, + "binsX" : 100, "minX" : -2, "maxX" : 2, "binsY" : 20, From 45df8d766b748e51aa355f26e3b4d94f1a0b6e7a Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 13 Nov 2023 22:16:46 -0600 Subject: [PATCH 45/71] add plots and regions --- processors/src/SimPartProcessor.cxx | 99 ----------------------------- 1 file changed, 99 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index c4530ba71..e01676a3e 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -426,9 +426,6 @@ bool SimPartProcessor::process(IEvent* ievent) { //reg_tuples_[region]->setVariableValue("numRecoTrackerClusters", (float)nReco_Tracker_clusters); //reg_tuples_[region]->setVariableValue("numRecoEcalClusters", (float)nReco_Ecal_clusters); - //double sim_max_p_region = -99999; - //double sim_pxpz_region = -99999; - //double sim_pypz_region = -99999; for (int i=0; iat(i); int gen = part->getGenStatus(); @@ -436,115 +433,19 @@ bool SimPartProcessor::process(IEvent* ievent) { continue; //reg_histos_[region]->FillMCParticle(part, reg_tuples_[region]); reg_histos_[region]->FillMCParticle(part); - //std::vector momentum_V = part->getMomentum(); - //double px = momentum_V.at(0); - //double py = momentum_V.at(1); - //double pz = momentum_V.at(2); - //double p = sqrt(px*px + py*py + pz*pz); - //if (p > sim_max_p_region){ - // sim_max_p_region = p; - // sim_pxpz_region = px/pz; - // sim_pypz_region = py/pz; - //} } - //int min_n_Track_hits_region = 99999; - //double track_phi0_region = -99999; - //double track_tanlamda_region = -99999; - //double track_omega_region = -99999; - //double track_max_p_ecal_x_region = -99999; - //double track_max_p_region = -99999; for (int i=0; iat(i); - //int n_hits = track->getTrackerHitCount(); - //if (n_hits < min_n_Track_hits_region) - // min_n_Track_hits_region = n_hits; - //reg_histos_[region]->FillRecoTrack(track, reg_tuples_[region]); reg_histos_[region]->FillRecoTrack(track); - //double p = track->getP(); - //if (p > track_max_p_region){ - // track_max_p_region = p; - // track_max_p_ecal_x_region = track->getPositionAtEcal().at(0); - // track_omega_region = track->getOmega(); - // track_phi0_region = track->getPhi(); - // track_tanlamda_region = track->getTanLambda(); - //} } - //double ecal_max_energy_region = -99999; - //double ecal_max_p_x_region = -99999; for (int i=0; iat(i); //reg_histos_[region]->FillRecoEcalCuster(ecal_cluster, reg_tuples_[region]); reg_histos_[region]->FillRecoEcalCuster(ecal_cluster); - //double energy = ecal_cluster->getEnergy(); - //if (energy > ecal_max_energy_region){ - // ecal_max_energy_region = energy; - // ecal_max_p_x_region = ecal_cluster->getPosition().at(0); - //} } - /* - double mc_tracker_hit_ecal_max_p_region = -99999; - double mc_tracker_hit_ecal_max_p_x_region = -99999; - for (int i=0; iat(i); - int track_id = mc_tracker_hit_ecal->getPartID(); - double sim_p = -99999; - for (int j=0; jat(j); - int gen = part->getGenStatus(); - if (gen != 1) - continue; - int sim_id = part->getID(); - std::vector momentum_V = part->getMomentum(); - double px = momentum_V.at(0); - double py = momentum_V.at(1); - double pz = momentum_V.at(2); - if (sim_id == track_id){ - sim_p = sqrt(px*px + py*py + pz*pz); - break; - } - } - if (sim_p > mc_tracker_hit_ecal_max_p_region){ - mc_tracker_hit_ecal_max_p_region = sim_p; - mc_tracker_hit_ecal_max_p_x_region = mc_tracker_hit_ecal->getPosition().at(0); - } - } - - if (track_max_p_region != -99999 && sim_max_p_region != -99999) - reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p_region/sim_max_p_region, sim_max_p_region, weight); - if (sim_pxpz_region != -99999 && track_phi0_region != -99999){ - reg_histos_[region]->Fill1DHisto("track_phi0_simpxpz_h", (track_phi0_region/sim_pxpz_region), weight); - reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0_region/sim_pxpz_region), sim_max_p_region, weight); - } - if (sim_pypz_region != -99999 && track_tanlamda_region != -99999){ - reg_histos_[region]->Fill1DHisto("track_tanlambda_simpypz_h", (track_tanlamda_region/sim_pypz_region), weight); - reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_sim_p_hh", (track_tanlamda_region/sim_pypz_region), sim_max_p_region, weight); - } - if (sim_pxpz_region != -99999 && track_phi0_region != -99999 && sim_pypz_region != -99999 && track_tanlamda_region != -99999) - reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0_region/sim_pxpz_region), (track_tanlamda_region/sim_pypz_region), weight); - if (track_max_p_ecal_x_region != -99999 && ecal_max_p_x_region != 99999){ - reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_sim_p_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_energy_hh", (track_max_p_ecal_x_region-ecal_max_p_x_region), ecal_max_energy_region, weight); - } - if (mc_tracker_hit_ecal_max_p_x_region != -99999 && track_max_p_ecal_x_region != 99999){ - reg_histos_[region]->Fill1DHisto("sim_track_x_diff_h", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_track_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_sim_p_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_track_x_ecal_energy_hh", (track_max_p_ecal_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); - reg_histos_[region]->Fill2DHisto("track_ecal_x_ecal_x_hh", ecal_max_p_x_region, (track_max_p_ecal_x_region-ecal_max_p_x_region), weight); - } - if (mc_tracker_hit_ecal_max_p_x_region != -99999 && ecal_max_p_x_region != 99999){ - reg_histos_[region]->Fill1DHisto("sim_ecal_x_diff_h", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_track_p_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), track_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), sim_max_p_region, weight); - reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (ecal_max_p_x_region-mc_tracker_hit_ecal_max_p_x_region), ecal_max_energy_region, weight); - } - */ - if (track_max_p != -99999 && sim_max_p != -99999) reg_histos_[region]->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); From 650dd3f952c1901f28698cc3bbf05280241ba1c2 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 14 Nov 2023 00:44:54 -0600 Subject: [PATCH 46/71] add plots and regions --- analysis/plotconfigs/mc/simPart.json | 26 +++++++++++++------------- processors/src/SimPartProcessor.cxx | 15 ++++++++------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 8cf8ab713..6b1d3f3d7 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -238,15 +238,15 @@ "ytitle" : "Events" }, "track_phi0_simpxpz_h" : { - "bins" : 100, - "minX" : -2, + "bins" : 50, + "minX" : 0, "maxX" : 2, "xtitle" : "Track #phi_{0} / Sim p_{x}/p_{z}", "ytitle" : "Events" }, "track_tanlambda_simpypz_h" : { - "bins" : 100, - "minX" : -2, + "bins" : 50, + "minX" : 0, "maxX" : 2, "xtitle" : "Track tan#lambda / Sim p_{y}/p_{z}", "ytitle" : "Events" @@ -431,19 +431,19 @@ "xtitle" : "Ecal x - Sim x (at ECal)", "ytitle" : "Ecal energy" }, - "track_tanlambda_simpypz_phi0_simpxpz_hh" : { - "binsX" : 100, - "minX" : -2, + "track_phi0_simpxpz_tanlambda_simpypz_hh" : { + "binsX" : 50, + "minX" : 0, "maxX" : 2, - "binsY" : 100, - "minY" : -2, + "binsY" : 50, + "minY" : 0, "maxY" : 2, "xtitle" : "Track #phi_{0} / Sim p_{x}/p_{z}", "ytitle" : "Track tan#lambda / Sim p_{y}/p_{z}" }, "track_phi0_simpxpz_sim_p_hh" : { - "binsX" : 100, - "minX" : -2, + "binsX" : 50, + "minX" : 0, "maxX" : 2, "binsY" : 20, "minY" : 0, @@ -452,8 +452,8 @@ "ytitle" : "Sim p" }, "track_tanlambda_simpypz_sim_p_hh" : { - "binsX" : 100, - "minX" : -2, + "binsX" : 50, + "minX" : 0, "maxX" : 2, "binsY" : 20, "minY" : 0, diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index e01676a3e..66ca962ec 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -299,11 +299,11 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0/sim_pxpz), sim_max_p, weight); } if (sim_pypz != -99999 && track_tanlamda != -99999){ - histos->Fill1DHisto("track_phi0_simpxpz_h", (track_tanlamda/sim_pypz), weight); - histos->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); + histos->Fill1DHisto("track_tanlambda_simpypz_h", (track_tanlamda/sim_pypz), weight); + histos->Fill2DHisto("track_tanlambda_simpypz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); } if (sim_pxpz != -99999 && track_phi0 != -99999 && sim_pypz != -99999 && track_tanlamda != -99999) - histos->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); + histos->Fill2DHisto("track_phi0_simpxpz_tanlambda_simpypz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); if (track_max_p_ecal_x != -99999 && ecal_max_p_x != 99999){ histos->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); histos->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); @@ -391,9 +391,10 @@ bool SimPartProcessor::process(IEvent* ievent) { } if (sim_p_fail) continue; if(debug_) std::cout<<"Pass Sim pT Lt cut"<passCutLt("sim_pypz_gt", sim_pypz_list[i], weight) ){ + if ( !reg_selectors_[region]->passCutGt("sim_pypz_gt", sim_pypz_list[i], weight) ){ sim_pypz_fail = 1; break; } @@ -454,11 +455,11 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_phi0/sim_pxpz), sim_max_p, weight); } if (sim_pypz != -99999 && track_tanlamda != -99999){ - reg_histos_[region]->Fill1DHisto("track_phi0_simpxpz_h", (track_tanlamda/sim_pypz), weight); - reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); + reg_histos_[region]->Fill1DHisto("track_tanlambda_simpypz_h", (track_tanlamda/sim_pypz), weight); + reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_sim_p_hh", (track_tanlamda/sim_pypz), sim_max_p, weight); } if (sim_pxpz != -99999 && track_phi0 != -99999 && sim_pypz != -99999 && track_tanlamda != -99999) - reg_histos_[region]->Fill2DHisto("track_tanlambda_simpypz_phi0_simpxpz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); + reg_histos_[region]->Fill2DHisto("track_phi0_simpxpz_tanlambda_simpypz_hh", (track_phi0/sim_pxpz), (track_tanlamda/sim_pypz), weight); if (track_max_p_ecal_x != -99999 && ecal_max_p_x != 99999){ reg_histos_[region]->Fill1DHisto("track_ecal_x_diff_h", (track_max_p_ecal_x-ecal_max_p_x), weight); reg_histos_[region]->Fill2DHisto("track_ecal_x_track_p_hh", (track_max_p_ecal_x-ecal_max_p_x), track_max_p, weight); From 831c67fc3e15abe0df37ccb074c1797a99622d69 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 6 Mar 2024 11:02:24 -0800 Subject: [PATCH 47/71] Add Track state at last hit --- processors/config/simPartTuple_cfg.py | 13 ++++++++++++- processors/src/utilities.cxx | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/processors/config/simPartTuple_cfg.py b/processors/config/simPartTuple_cfg.py index 3ba5af91a..f9e7f2593 100644 --- a/processors/config/simPartTuple_cfg.py +++ b/processors/config/simPartTuple_cfg.py @@ -28,6 +28,7 @@ ############################### header = HpstrConf.Processor('header', 'EventProcessor') track = HpstrConf.Processor('track', 'TrackingProcessor') +track_atlasthit = HpstrConf.Processor('track_atlasthit', 'TrackingProcessor') svthits = HpstrConf.Processor('svthits', 'Tracker2DHitProcessor') rawsvt = HpstrConf.Processor('rawsvt', 'SvtRawDataProcessor') mcthits = HpstrConf.Processor('mcthits', 'MCTrackerHitProcessor') @@ -71,6 +72,16 @@ track.parameters["trkhitCollRoot"] = 'SiClustersOnTrack' track.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits' +# Tracking at Last Hit +track_atlasthit.parameters["debug"] = 0 +track_atlasthit.parameters["trkCollLcio"] = 'KalmanFullTracks' +track_atlasthit.parameters["trkCollRoot"] = 'KalmanFullTracks_AtLastHit' +track_atlasthit.parameters["kinkRelCollLcio"] = '' +track_atlasthit.parameters["trkRelCollLcio"] = 'KFTrackDataRelations' +track_atlasthit.parameters["trkhitCollRoot"] = 'SiClustersOnTrack_AtLastHit' +track_atlasthit.parameters["hitFitsCollLcio"] = 'SVTFittedRawTrackerHits' +track_atlasthit.parameters["trackStateLocation"] = 'AtLastHit' + # Only for detail studies # LT uncomment track.parameters["rawhitCollRoot"] = 'SVTRawHitsOnTrack_KF' @@ -122,7 +133,7 @@ mcpart.parameters["mcPartCollLcio"] = 'MCParticle' mcpart.parameters["mcPartCollRoot"] = 'MCParticle' -sequence = [header, ecal, track, svthits, rawsvt, mcthits, mcthits_ecal, mcehits, mcpart] +sequence = [header, ecal, track, track_atlasthit, svthits, rawsvt, mcthits, mcthits_ecal, mcehits, mcpart] p.sequence = sequence diff --git a/processors/src/utilities.cxx b/processors/src/utilities.cxx index 08d0f1e56..aea5ae55e 100644 --- a/processors/src/utilities.cxx +++ b/processors/src/utilities.cxx @@ -166,7 +166,8 @@ Track* utils::buildTrack(EVENT::Track* lc_track, //TrackState Location map std::map trackstateLocationMap_ = { {"", EVENT::TrackState::AtIP}, - {"AtTarget", EVENT::TrackState::LastLocation} + {"AtTarget", EVENT::TrackState::LastLocation}, + {"AtLastHit", EVENT::TrackState::AtLastHit} }; int loc; From 7ed6165628fe5cd3cde3152a618118b3957ab1ed Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 11 Mar 2024 15:34:38 -0700 Subject: [PATCH 48/71] track - sim parameters at last hit --- analysis/plotconfigs/mc/simPart.json | 86 ++++++++++++++++++++- processors/config/simPartAna_cfg.py | 1 + processors/include/SimPartProcessor.h | 3 + processors/src/SimPartProcessor.cxx | 106 ++++++++++++++++++++++++++ 4 files changed, 194 insertions(+), 2 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 6b1d3f3d7..a8369a787 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -227,14 +227,66 @@ "bins" : 1000, "minX" : -100, "maxX" : 100, - "xtitle" : "Sim x (at ECal) x - Track x", + "xtitle" : "Track x - Sim x (at ECal)", + "ytitle" : "Events" + }, + + + "sim_track_atlasthit_x_diff_h" : { + "bins" : 1000, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Track x (at At Last Hit) - Sim x (at At Last Hit)", + "ytitle" : "Events" + }, + "sim_track_atlasthit_y_diff_h" : { + "bins" : 1000, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Track y (at At Last Hit) - Sim y (at At Last Hit)", + "ytitle" : "Events" + }, + "sim_track_atlasthit_z_diff_h" : { + "bins" : 1000, + "minX" : -100, + "maxX" : 100, + "xtitle" : "Track z (at At Last Hit) - Sim z (at At Last Hit)", + "ytitle" : "Events" + }, + "sim_track_atlasthit_p_diff_h" : { + "bins" : 100, + "minX" : -5, + "maxX" : 5, + "xtitle" : "Track p (at At Last Hit) - Sim p (at At Last Hit)", + "ytitle" : "Events" + }, + + "sim_track_atlasthit_px_diff_h" : { + "bins" : 100, + "minX" : -5, + "maxX" : 5, + "xtitle" : "Track px (at At Last Hit) - Sim px (at At Last Hit)", + "ytitle" : "Events" + }, + "sim_track_atlasthit_py_diff_h" : { + "bins" : 100, + "minX" : -5, + "maxX" : 5, + "xtitle" : "Track py (at At Last Hit) - Sim py (at At Last Hit)", + "ytitle" : "Events" + }, + "sim_track_atlasthit_pz_diff_h" : { + "bins" : 100, + "minX" : -5, + "maxX" : 5, + "xtitle" : "Track pz (at At Last Hit) - Sim pz (at At Last Hit)", "ytitle" : "Events" }, "sim_ecal_x_diff_h" : { "bins" : 1000, "minX" : -100, "maxX" : 100, - "xtitle" : "Sim x (at ECal) x - Ecal x", + "xtitle" : "Ecal x - Sim x (at ECal) x", "ytitle" : "Events" }, "track_phi0_simpxpz_h" : { @@ -401,6 +453,36 @@ "xtitle" : "Track (at ECal) x - Sim x (at ECal)", "ytitle" : "Ecal energy" }, + "sim_track_atlasthit_x_track_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) x - Sim x (at Last Hit)", + "ytitle" : "Track p" + }, + "sim_track_atlasthit_x_sim_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) x - Sim x (at Last Hit)", + "ytitle" : "sim p" + }, + "sim_track_atlasthit_x_ecal_energy_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) x - Sim x (at Last Hit)", + "ytitle" : "Ecal energy" + }, "sim_ecal_x_track_p_hh" : { "binsX" : 1000, "minX" : -100, diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index 7b5512563..eb9bbc061 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -50,6 +50,7 @@ sim_part_ana.parameters["MCTrackerHitECalColl"] = "TrackerSimHitsECal" sim_part_ana.parameters["MCEcalHitColl"] = "EcalSimHits" sim_part_ana.parameters["RecoTrackColl"] = "KalmanFullTracks" +sim_part_ana.parameters["RecoTrackColl_AtLastHit"] = "KalmanFullTracks_AtLastHit" sim_part_ana.parameters["RecoTrackerClusterColl"] = "SiClustersOnTrack" sim_part_ana.parameters["RecoEcalClusterColl"] = "RecoEcalClusters" sim_part_ana.parameters["analysis"] = analysis diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartProcessor.h index 753c1f1fb..a77724d17 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartProcessor.h @@ -84,6 +84,7 @@ class SimPartProcessor : public Processor { TBranch* bMCTrackerHitsECal_{nullptr}; //!< description TBranch* bMCEcalHits_{nullptr}; //!< description TBranch* bRecoTracks_{nullptr}; //!< description + TBranch* bRecoTracks_atlasthit_{nullptr}; //!< description TBranch* bRecoTrackerClusters_{nullptr}; //!< description TBranch* bRecoEcalClusters_{nullptr}; //!< description @@ -92,6 +93,7 @@ class SimPartProcessor : public Processor { std::vector * MCTrackerHitsECal_{nullptr}; //!< description std::vector * MCEcalHits_{nullptr}; //!< description std::vector * RecoTracks_{nullptr}; //!< description + std::vector * RecoTracks_atlasthit_{nullptr}; //!< description std::vector * RecoTrackerClusters_{nullptr}; //!< description std::vector * RecoEcalClusters_{nullptr}; //!< description @@ -101,6 +103,7 @@ class SimPartProcessor : public Processor { std::string MCTrackerHitECalColl_{"TrackerSimHitsECal"}; //!< description std::string MCEcalHitColl_{"EcalSimHits"}; //!< description std::string RecoTrackColl_{"KalmanFullTracks"}; //!< description + std::string RecoTrackColl_atlasthit_{"KalmanFullTracks_AtLastHit"}; //!< description std::string RecoTrackerClusterColl_{"SiClustersOnTrack"}; //!< description std::string RecoEcalClusterColl_{"RecoEcalClusters"}; //!< description std::string analysis_{"sim_part"}; //!< description diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 66ca962ec..cb25b3732 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -22,6 +22,7 @@ void SimPartProcessor::configure(const ParameterSet& parameters) { MCTrackerHitECalColl_ = parameters.getString("MCTrackerHitECalColl"); MCEcalHitColl_ = parameters.getString("MCEcalHitColl"); RecoTrackColl_ = parameters.getString("RecoTrackColl"); + RecoTrackColl_atlasthit_ = parameters.getString("RecoTrackColl_AtLastHit"); RecoTrackerClusterColl_ = parameters.getString("RecoTrackerClusterColl"); RecoEcalClusterColl_ = parameters.getString("RecoEcalClusterColl"); histCfgFilename_ = parameters.getString("histCfg"); @@ -157,6 +158,11 @@ void SimPartProcessor::initialize(TTree* tree) { else std::cout<<"WARNING: No Reco track collection"<FindBranch(RecoTrackColl_atlasthit_.c_str())) + tree_->SetBranchAddress(RecoTrackColl_atlasthit_.c_str(), &RecoTracks_atlasthit_, &bRecoTracks_atlasthit_); + else + std::cout<<"WARNING: No Reco track at last hit collection"<FindBranch(RecoTrackerClusterColl_.c_str())) tree_->SetBranchAddress(RecoTrackerClusterColl_.c_str(), &RecoTrackerClusters_, &bRecoTrackerClusters_); else @@ -178,6 +184,7 @@ bool SimPartProcessor::process(IEvent* ievent) { int nSim_Tracker_hits_Ecal = MCTrackerHitsECal_->size(); int nSim_Ecal_hits = MCEcalHits_->size(); int nReco_Tracks = RecoTracks_->size(); + int nReco_Tracks_atlasthit = RecoTracks_atlasthit_->size(); int nReco_Tracker_clusters = RecoTrackerClusters_->size(); int nReco_Ecal_clusters = RecoEcalClusters_->size(); @@ -291,6 +298,77 @@ bool SimPartProcessor::process(IEvent* ievent) { } } + double track_atlasthit_max_p_x = -99999; + double track_atlasthit_max_p_y = -99999; + double track_atlasthit_max_p_z = -99999; + double track_atlasthit_max_p = -99999; + double track_atlasthit_max_p_px = -99999; + double track_atlasthit_max_p_py = -99999; + double track_atlasthit_max_p_pz = -99999; + for (int i=0; iat(i); + double p = track_atlasthit->getP(); + if (p > track_atlasthit_max_p){ + track_atlasthit_max_p = p; + track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); + track_atlasthit_max_p_y = track_atlasthit->getPosition().at(1); + track_atlasthit_max_p_z = track_atlasthit->getPosition().at(2); + track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(0); + track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(1); + track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(2); + } + } + + double mc_tracker_hit_atlasthit_max_p_x = -99999; + double mc_tracker_hit_atlasthit_max_p_y = -99999; + double mc_tracker_hit_atlasthit_max_p_z = -99999; + double mc_tracker_hit_atlasthit_max_p = -99999; + double mc_tracker_hit_atlasthit_max_p_px = -99999; + double mc_tracker_hit_atlasthit_max_p_py = -99999; + double mc_tracker_hit_atlasthit_max_p_pz = -99999; + int last_layer = 0; + for (int i=0; iat(i); + int track_layer = mc_tracker_hit_atlasthit->getLayer(); + int track_id = mc_tracker_hit_atlasthit->getPartID(); + double sim_p = -99999; + double sim_px = -99999; + double sim_py = -99999; + double sim_pz = -99999; + for (int j=0; jat(j); + int gen = part_atlasthit->getGenStatus(); + if (gen != 1) + continue; + int sim_id = part_atlasthit->getID(); + std::vector momentum_V = part_atlasthit->getMomentum(); + double px = momentum_V.at(0); + double py = momentum_V.at(1); + double pz = momentum_V.at(2); + if (sim_id == track_id){ + sim_p = sqrt(px*px + py*py + pz*pz); + sim_px = px; + sim_py = py; + sim_pz = pz; + break; + } + } + if (track_layer < last_layer) + continue; + elif (track_layer == last_layer){ + if (sim_p <= mc_tracker_hit_atlasthit_max_p) + continue; + } + last_layer = track_layer; + mc_tracker_hit_atlasthit_max_p = sim_p; + mc_tracker_hit_atlasthit_max_p_px = sim_px; + mc_tracker_hit_atlasthit_max_p_py = sim_py; + mc_tracker_hit_atlasthit_max_p_pz = sim_pz; + mc_tracker_hit_atlasthit_max_p_x = mc_tracker_hit_atlasthit->getPosition().at(0); + mc_tracker_hit_atlasthit_max_p_y = mc_tracker_hit_atlasthit->getPosition().at(1); + mc_tracker_hit_atlasthit_max_p_z = mc_tracker_hit_atlasthit->getPosition().at(2); + } + if (track_max_p != -99999 && sim_max_p != -99999) histos->Fill2DHisto("track_sim_p_sim_p_hh", track_max_p/sim_max_p, sim_max_p, weight); @@ -323,6 +401,20 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); histos->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (-ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); } + if (mc_tracker_hit_atlasthit_max_p_x != -99999 && track_atlasthit_max_p_x != -99999){ + histos->Fill1DHisto("sim_track_atlasthit_x_diff_h", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), weight); + histos->Fill1DHisto("sim_track_atlasthit_y_diff_h", (track_atlasthit_max_p_y-mc_tracker_hit_atlasthit_max_p_y), weight); + histos->Fill1DHisto("sim_track_atlasthit_z_diff_h", (track_atlasthit_max_p_z-mc_tracker_hit_atlasthit_max_p_z), weight); + + histos->Fill1DHisto("sim_track_atlasthit_p_diff_h", (track_atlasthit_max_p-mc_tracker_hit_atlasthit_max_p), weight); + histos->Fill1DHisto("sim_track_atlasthit_px_diff_h", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), weight); + histos->Fill1DHisto("sim_track_atlasthit_py_diff_h", (track_atlasthit_max_p_py-mc_tracker_hit_atlasthit_max_p_py), weight); + histos->Fill1DHisto("sim_track_atlasthit_pz_diff_h", (track_atlasthit_max_p_pz-mc_tracker_hit_atlasthit_max_p_pz), weight); + + histos->Fill2DHisto("sim_track_atlasthit_x_track_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), track_atlasthit_max_p, weight); + histos->Fill2DHisto("sim_track_atlasthit_x_sim_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), mc_tracker_hit_atlasthit_max_p, weight); + histos->Fill2DHisto("sim_track_atlasthit_x_ecal_energy_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), ecal_max_energy, weight); + } tuples->fill(); @@ -479,6 +571,20 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("sim_ecal_x_sim_p_hh", (ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), sim_max_p, weight); reg_histos_[region]->Fill2DHisto("sim_ecal_x_ecal_energy_hh", (-ecal_max_p_x-mc_tracker_hit_ecal_max_p_x), ecal_max_energy, weight); } + if (mc_tracker_hit_atlasthit_max_p_x != -99999 && track_atlasthit_max_p_x != -99999){ + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_x_diff_h", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), weight); + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_y_diff_h", (track_atlasthit_max_p_y-mc_tracker_hit_atlasthit_max_p_y), weight); + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_z_diff_h", (track_atlasthit_max_p_z-mc_tracker_hit_atlasthit_max_p_z), weight); + + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_p_diff_h", (track_atlasthit_max_p-mc_tracker_hit_atlasthit_max_p), weight); + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_px_diff_h", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), weight); + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_py_diff_h", (track_atlasthit_max_p_py-mc_tracker_hit_atlasthit_max_p_py), weight); + reg_histos_[region]->Fill1DHisto("sim_track_atlasthit_pz_diff_h", (track_atlasthit_max_p_pz-mc_tracker_hit_atlasthit_max_p_pz), weight); + + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_track_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), track_atlasthit_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_sim_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), mc_tracker_hit_atlasthit_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_ecal_energy_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), ecal_max_energy, weight); + } //reg_tuples_[region]->fill(); } From 6010362a76351aa742b397d43556237e31ccc8ab Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 11 Mar 2024 15:39:09 -0700 Subject: [PATCH 49/71] typo fix --- processors/src/SimPartProcessor.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index cb25b3732..23c5bdad3 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -355,7 +355,7 @@ bool SimPartProcessor::process(IEvent* ievent) { } if (track_layer < last_layer) continue; - elif (track_layer == last_layer){ + else if (track_layer == last_layer){ if (sim_p <= mc_tracker_hit_atlasthit_max_p) continue; } From 5ef353f5facebfd7bb57d47a44446e76b063dc39 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 12 Mar 2024 19:01:42 -0700 Subject: [PATCH 50/71] add MCTracker hit momentum --- event/include/MCTrackerHit.h | 31 ++++++++++++++++++++++-- event/src/MCTrackerHit.cxx | 6 +++++ processors/src/MCTrackerHitProcessor.cxx | 7 ++++++ processors/src/SimPartProcessor.cxx | 29 +++------------------- 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/event/include/MCTrackerHit.h b/event/include/MCTrackerHit.h index a0880e5fd..757924486 100644 --- a/event/include/MCTrackerHit.h +++ b/event/include/MCTrackerHit.h @@ -50,6 +50,24 @@ class MCTrackerHit : public TObject { /** @return the global X coordinate of the hit */ double getGlobalZ() const {return z_;} + + /** + * Set the hit momentum. + * + * @param momentum The hit momentum. + */ + void setMomentum(const double* momentum); + + /** @return The hit momentum. */ + std::vector getMomentum() const { return {px_, py_, pz_}; }; + + /** + * @return momentum magnitude + */ + + double getP(){return sqrt(px_*px_ + py_*py_ + pz_*pz_);}; + + double getPt() {return sqrt(px_*px_ + pz_*pz_);} /** * Set the hit time. @@ -101,12 +119,21 @@ class MCTrackerHit : public TObject { /** The x position of the hit. */ double x_{-999}; - /** The x position of the hit. */ + /** The y position of the hit. */ double y_{-999}; - /** The x position of the hit. */ + /** The z position of the hit. */ double z_{-999}; + /** The px momentum of the hit. */ + double px_{-999}; + + /** The y momentum of the hit. */ + double py_{-999}; + + /** The z momentum of the hit. */ + double pz_{-999}; + /** The hit time. */ double time_{-999}; diff --git a/event/src/MCTrackerHit.cxx b/event/src/MCTrackerHit.cxx index 2726a4d2f..0a0427a61 100644 --- a/event/src/MCTrackerHit.cxx +++ b/event/src/MCTrackerHit.cxx @@ -38,3 +38,9 @@ void MCTrackerHit::setPosition(const double* position, bool rotate) { z_ = position[2]; } } + +void MCTrackerHit::setMomentum(const double* momentum) { + px_ = momentum[0]; + py_ = momentum[1]; + pz_ = momentum[2]; +} diff --git a/processors/src/MCTrackerHitProcessor.cxx b/processors/src/MCTrackerHitProcessor.cxx index 372a23947..cd371794f 100644 --- a/processors/src/MCTrackerHitProcessor.cxx +++ b/processors/src/MCTrackerHitProcessor.cxx @@ -78,6 +78,13 @@ bool MCTrackerHitProcessor::process(IEvent* ievent) { hitPos[2] = lcio_mcTracker_hit->getPosition()[2]; mc_tracker_hit->setPosition(hitPos); + // Set the momentum of the particle for this hit + double hitMomentum[3]; + hitMomentum[0] = lcio_mcTracker_hit->getMomentum()[0]; + hitMomentum[1] = lcio_mcTracker_hit->getMomentum()[1]; + hitMomentum[2] = lcio_mcTracker_hit->getMomentum()[2]; + mc_tracker_hit->setMomentum(hitMomentum); + // Set the energy deposit of the hit mc_tracker_hit->setEdep(lcio_mcTracker_hit->getEDep()); diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 23c5bdad3..d4f575ccc 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -331,28 +331,7 @@ bool SimPartProcessor::process(IEvent* ievent) { MCTrackerHit *mc_tracker_hit_atlasthit = MCTrackerHits_->at(i); int track_layer = mc_tracker_hit_atlasthit->getLayer(); int track_id = mc_tracker_hit_atlasthit->getPartID(); - double sim_p = -99999; - double sim_px = -99999; - double sim_py = -99999; - double sim_pz = -99999; - for (int j=0; jat(j); - int gen = part_atlasthit->getGenStatus(); - if (gen != 1) - continue; - int sim_id = part_atlasthit->getID(); - std::vector momentum_V = part_atlasthit->getMomentum(); - double px = momentum_V.at(0); - double py = momentum_V.at(1); - double pz = momentum_V.at(2); - if (sim_id == track_id){ - sim_p = sqrt(px*px + py*py + pz*pz); - sim_px = px; - sim_py = py; - sim_pz = pz; - break; - } - } + double sim_p = mc_tracker_hit_atlasthit->getP(); if (track_layer < last_layer) continue; else if (track_layer == last_layer){ @@ -361,9 +340,9 @@ bool SimPartProcessor::process(IEvent* ievent) { } last_layer = track_layer; mc_tracker_hit_atlasthit_max_p = sim_p; - mc_tracker_hit_atlasthit_max_p_px = sim_px; - mc_tracker_hit_atlasthit_max_p_py = sim_py; - mc_tracker_hit_atlasthit_max_p_pz = sim_pz; + mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); + mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); + mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); mc_tracker_hit_atlasthit_max_p_x = mc_tracker_hit_atlasthit->getPosition().at(0); mc_tracker_hit_atlasthit_max_p_y = mc_tracker_hit_atlasthit->getPosition().at(1); mc_tracker_hit_atlasthit_max_p_z = mc_tracker_hit_atlasthit->getPosition().at(2); From c2f6f71f664866464c5cb498bbd2408a5bbc223b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 12 Mar 2024 20:53:16 -0700 Subject: [PATCH 51/71] regions based on last layer of hit on track --- .../selections/simPart/1Sim_1Track_1Ecal.json | 4 +- ...Track_1Ecal_Track_last_layer_0_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_0_top.json | 27 ++++++++ ...rack_1Ecal_Track_last_layer_10_bottom.json | 27 ++++++++ ..._1Track_1Ecal_Track_last_layer_10_top.json | 27 ++++++++ ...rack_1Ecal_Track_last_layer_11_bottom.json | 27 ++++++++ ..._1Track_1Ecal_Track_last_layer_11_top.json | 27 ++++++++ ...rack_1Ecal_Track_last_layer_12_bottom.json | 27 ++++++++ ..._1Track_1Ecal_Track_last_layer_12_top.json | 27 ++++++++ ...rack_1Ecal_Track_last_layer_13_bottom.json | 27 ++++++++ ..._1Track_1Ecal_Track_last_layer_13_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_1_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_1_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_2_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_2_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_3_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_3_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_4_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_4_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_5_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_5_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_6_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_6_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_7_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_7_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_8_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_8_top.json | 27 ++++++++ ...Track_1Ecal_Track_last_layer_9_bottom.json | 27 ++++++++ ...m_1Track_1Ecal_Track_last_layer_9_top.json | 27 ++++++++ .../simPart/Track_Ecal_Sim_p_ge1.json | 2 +- .../simPart/Track_Ecal_Sim_p_le1.json | 2 +- .../simPart/Track_Ecal_Track_p_ge4.json | 2 +- processors/src/SimPartProcessor.cxx | 63 +++++++++++++------ 33 files changed, 806 insertions(+), 23 deletions(-) create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_top.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_bottom.json create mode 100644 analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_top.json diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal.json b/analysis/selections/simPart/1Sim_1Track_1Ecal.json index 1ac335a83..bada1eeca 100644 --- a/analysis/selections/simPart/1Sim_1Track_1Ecal.json +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal.json @@ -6,12 +6,12 @@ }, "n_track_eq" : { "cut" : 1.0, - "id" : 0, + "id" : 1, "info" : "N Tracks == 1" }, "n_ecal_cluster_eq" : { "cut" : 1.0, - "id" : 1, + "id" : 2, "info" : "N Ecal Clusters == 1" } } diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_bottom.json new file mode 100644 index 000000000..62c74cf0e --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 0, + "id" : 3, + "info" : "Track Last Layer == 0" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_top.json new file mode 100644 index 000000000..7eee8e3a6 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_0_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 0, + "id" : 3, + "info" : "Track Last Layer == 0" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_bottom.json new file mode 100644 index 000000000..300833032 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 10, + "id" : 3, + "info" : "Track Last Layer == 10" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_top.json new file mode 100644 index 000000000..d4fe7d603 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_10_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 10, + "id" : 3, + "info" : "Track Last Layer == 10" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_bottom.json new file mode 100644 index 000000000..edd321b7b --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 11, + "id" : 3, + "info" : "Track Last Layer == 11" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_top.json new file mode 100644 index 000000000..bb57052e8 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_11_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 11, + "id" : 3, + "info" : "Track Last Layer == 11" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_bottom.json new file mode 100644 index 000000000..67e989139 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 12, + "id" : 3, + "info" : "Track Last Layer == 12" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_top.json new file mode 100644 index 000000000..59182daf4 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_12_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 12, + "id" : 3, + "info" : "Track Last Layer == 12" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_bottom.json new file mode 100644 index 000000000..395b16d1b --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 13, + "id" : 3, + "info" : "Track Last Layer == 13" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_top.json new file mode 100644 index 000000000..621c81eca --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_13_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 13, + "id" : 3, + "info" : "Track Last Layer == 13" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_bottom.json new file mode 100644 index 000000000..593c155df --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 1, + "id" : 3, + "info" : "Track Last Layer == 1" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_top.json new file mode 100644 index 000000000..f9577abba --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_1_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 1, + "id" : 3, + "info" : "Track Last Layer == 1" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_bottom.json new file mode 100644 index 000000000..4fbb3921b --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 2, + "id" : 3, + "info" : "Track Last Layer == 2" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_top.json new file mode 100644 index 000000000..c95b193d5 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_2_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 2, + "id" : 3, + "info" : "Track Last Layer == 2" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_bottom.json new file mode 100644 index 000000000..c2556e5dc --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 3, + "id" : 3, + "info" : "Track Last Layer == 3" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_top.json new file mode 100644 index 000000000..0d16abc44 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_3_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 3, + "id" : 3, + "info" : "Track Last Layer == 3" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_bottom.json new file mode 100644 index 000000000..32d612293 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 4, + "id" : 3, + "info" : "Track Last Layer == 4" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_top.json new file mode 100644 index 000000000..6415c8033 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_4_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 4, + "id" : 3, + "info" : "Track Last Layer == 4" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_bottom.json new file mode 100644 index 000000000..75e680d55 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 5, + "id" : 3, + "info" : "Track Last Layer == 5" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_top.json new file mode 100644 index 000000000..fe2e060b9 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_5_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 5, + "id" : 3, + "info" : "Track Last Layer == 5" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_bottom.json new file mode 100644 index 000000000..712774c87 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 6, + "id" : 3, + "info" : "Track Last Layer == 6" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_top.json new file mode 100644 index 000000000..efbf0d61b --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_6_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 6, + "id" : 3, + "info" : "Track Last Layer == 6" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_bottom.json new file mode 100644 index 000000000..fbf09ac65 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 7, + "id" : 3, + "info" : "Track Last Layer == 7" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_top.json new file mode 100644 index 000000000..5812c486c --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_7_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 7, + "id" : 3, + "info" : "Track Last Layer == 7" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_bottom.json new file mode 100644 index 000000000..def318ffc --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 8, + "id" : 3, + "info" : "Track Last Layer == 8" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_top.json new file mode 100644 index 000000000..81b1586b1 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_8_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 8, + "id" : 3, + "info" : "Track Last Layer == 8" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_bottom.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_bottom.json new file mode 100644 index 000000000..83083488f --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_bottom.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 9, + "id" : 3, + "info" : "Track Last Layer == 9" + }, + "track_pypz_lt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz <= 0.0" + } +} diff --git a/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_top.json b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_top.json new file mode 100644 index 000000000..bfdd51e23 --- /dev/null +++ b/analysis/selections/simPart/1Sim_1Track_1Ecal_Track_last_layer_9_top.json @@ -0,0 +1,27 @@ +{ + "n_sim_eq" : { + "cut" : 1, + "id" : 0, + "info" : "N Sim Particles == 1" + }, + "n_track_eq" : { + "cut" : 1.0, + "id" : 1, + "info" : "N Tracks == 1" + }, + "n_ecal_cluster_eq" : { + "cut" : 1.0, + "id" : 2, + "info" : "N Ecal Clusters == 1" + }, + "track_last_layer_eq" : { + "cut" : 9, + "id" : 3, + "info" : "Track Last Layer == 9" + }, + "track_pypz_gt" : { + "cut" : 0.0, + "id" : 4, + "info" : "Track py/pz >= 0.0" + } +} diff --git a/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json b/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json index f0af7c531..09f10f877 100644 --- a/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json +++ b/analysis/selections/simPart/Track_Ecal_Sim_p_ge1.json @@ -11,7 +11,7 @@ }, "sim_p_gt" : { "cut" : 1.0, - "id" : 0, + "id" : 2, "info" : "Sim pT >= 1" } } diff --git a/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json b/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json index aa3d291ad..18aeffb99 100644 --- a/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json +++ b/analysis/selections/simPart/Track_Ecal_Sim_p_le1.json @@ -11,7 +11,7 @@ }, "sim_p_lt" : { "cut" : 1.0, - "id" : 0, + "id" : 2, "info" : "Sim pT <= 1" } } diff --git a/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json b/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json index b56a7abf2..a2dc695e7 100644 --- a/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json +++ b/analysis/selections/simPart/Track_Ecal_Track_p_ge4.json @@ -11,7 +11,7 @@ }, "track_p_gt" : { "cut" : 4.0, - "id" : 0, + "id" : 2, "info" : "Tracks pT >= 4" } } diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index d4f575ccc..9f27df520 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -5,6 +5,7 @@ */ #include "SimPartProcessor.h" #include +#include SimPartProcessor::SimPartProcessor(const std::string& name, Process& process) : Processor(name,process){} //TODO CHECK THIS DESTRUCTOR @@ -305,17 +306,23 @@ bool SimPartProcessor::process(IEvent* ievent) { double track_atlasthit_max_p_px = -99999; double track_atlasthit_max_p_py = -99999; double track_atlasthit_max_p_pz = -99999; + int track_atlasthit_last_layer = -99999; + std::vector track_atlasthit_pypz_list; + track_atlasthit_pypz_list.clear(); for (int i=0; iat(i); - double p = track_atlasthit->getP(); - if (p > track_atlasthit_max_p){ - track_atlasthit_max_p = p; + double track_p = track_atlasthit->getP(); + track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); + if (track_p > track_atlasthit_max_p){ + track_atlasthit_max_p = track_p; track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); track_atlasthit_max_p_y = track_atlasthit->getPosition().at(1); track_atlasthit_max_p_z = track_atlasthit->getPosition().at(2); track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(0); track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(1); track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(2); + std::vector layer_list = track_atlasthit->getHitLayers(); + track_atlasthit_last_layer = std::max_element(layer_list.begin(), layer_list.end()); } } @@ -326,26 +333,22 @@ bool SimPartProcessor::process(IEvent* ievent) { double mc_tracker_hit_atlasthit_max_p_px = -99999; double mc_tracker_hit_atlasthit_max_p_py = -99999; double mc_tracker_hit_atlasthit_max_p_pz = -99999; - int last_layer = 0; for (int i=0; iat(i); int track_layer = mc_tracker_hit_atlasthit->getLayer(); int track_id = mc_tracker_hit_atlasthit->getPartID(); - double sim_p = mc_tracker_hit_atlasthit->getP(); - if (track_layer < last_layer) + double mc_track_p = mc_tracker_hit_atlasthit->getP(); + if (track_layer != track_atlasthit_last_layer) continue; - else if (track_layer == last_layer){ - if (sim_p <= mc_tracker_hit_atlasthit_max_p) - continue; + if (mc_track_p > mc_tracker_hit_atlasthit_max_p){ + mc_tracker_hit_atlasthit_max_p = sim_p; + mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); + mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); + mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); + mc_tracker_hit_atlasthit_max_p_x = mc_tracker_hit_atlasthit->getPosition().at(0); + mc_tracker_hit_atlasthit_max_p_y = mc_tracker_hit_atlasthit->getPosition().at(1); + mc_tracker_hit_atlasthit_max_p_z = mc_tracker_hit_atlasthit->getPosition().at(2); } - last_layer = track_layer; - mc_tracker_hit_atlasthit_max_p = sim_p; - mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); - mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); - mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); - mc_tracker_hit_atlasthit_max_p_x = mc_tracker_hit_atlasthit->getPosition().at(0); - mc_tracker_hit_atlasthit_max_p_y = mc_tracker_hit_atlasthit->getPosition().at(1); - mc_tracker_hit_atlasthit_max_p_z = mc_tracker_hit_atlasthit->getPosition().at(2); } if (track_max_p != -99999 && sim_max_p != -99999) @@ -400,7 +403,7 @@ bool SimPartProcessor::process(IEvent* ievent) { // Regions for (auto region : regions_ ) { reg_selectors_[region]->getCutFlowHisto()->Fill(0.,weight); - if(debug_) std::cout<<"Check for region "<passCutEq("n_sim_eq", nParts, weight) ) continue; @@ -433,6 +436,9 @@ bool SimPartProcessor::process(IEvent* ievent) { if ( !reg_selectors_[region]->passCutGt("n_track_hits_gt", min_n_Track_hits, weight) ) continue; if(debug_) std::cout<<"Pass Nr. of Track Hits Gt cut"<passCutEq("track_last_layer_eq", track_atlasthit_last_layer, weight) ) continue; + if(debug_) std::cout<<"Pass Track Last Layer of Hit Eq cut"<passCutGt("track_p_gt", track_p_list[i], weight) ){ @@ -483,6 +489,27 @@ bool SimPartProcessor::process(IEvent* ievent) { if (sim_pypz_fail) continue; if(debug_) std::cout<<"Pass Sim py/pz Lt cut"<passCutGt("track_pypz_gt", track_atlasthit_pypz_list[i], weight) ){ + track_atlasthit_pypz_fail = 1; + break; + } + } + if (track_atlasthit_pypz_fail) continue; + if(debug_) std::cout<<"Pass Track at Last Hit py/pz Gt cut"<passCutLt("track_pypz_lt", track_atlasthit_pypz_list[i], weight) ){ + track_atlasthit_pypz_fail = 1; + break; + } + } + if (track_atlasthit_pypz_fail) continue; + if(debug_) std::cout<<"Pass Track at Last Hit py/pz Lt cut"<Fill1DHisto("numMCparts_h", (float)nParts, weight); From 6d4d9ff9838e426ab057164e579271cf9854e570 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 12 Mar 2024 20:56:41 -0700 Subject: [PATCH 52/71] regions based on last layer of hit on track --- processors/config/simPartAna_cfg.py | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index eb9bbc061..072d896e5 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -86,7 +86,35 @@ RegionPath+'Track_top.json', RegionPath+'Track_bottom.json', RegionPath+'noTrack_Ecal_top.json', - RegionPath+'noTrack_Ecal_bottom.json' + RegionPath+'noTrack_Ecal_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_0_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_1_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_2_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_3_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_4_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_5_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_6_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_7_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_8_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_9_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_10_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_11_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_12_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_13_top.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_0_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_1_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_2_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_3_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_4_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_5_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_6_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_7_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_8_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_9_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_10_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_11_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_12_bottom.json', + RegionPath+'1Sim_1Track_1Ecal_Track_last_layer_13_bottom.json' ] # Sequence which the processors will run. From c3f5287c4f72fdf9d1cca6a9e628a81f95557f83 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Tue, 12 Mar 2024 21:02:11 -0700 Subject: [PATCH 53/71] bug fixes --- processors/src/SimPartProcessor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 9f27df520..9ca5b8730 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -322,7 +322,7 @@ bool SimPartProcessor::process(IEvent* ievent) { track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(1); track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(2); std::vector layer_list = track_atlasthit->getHitLayers(); - track_atlasthit_last_layer = std::max_element(layer_list.begin(), layer_list.end()); + track_atlasthit_last_layer = *(std::max_element(layer_list.begin(), layer_list.end())); } } @@ -341,7 +341,7 @@ bool SimPartProcessor::process(IEvent* ievent) { if (track_layer != track_atlasthit_last_layer) continue; if (mc_track_p > mc_tracker_hit_atlasthit_max_p){ - mc_tracker_hit_atlasthit_max_p = sim_p; + mc_tracker_hit_atlasthit_max_p = mc_track_p; mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); From e8d193e30bb8bd1fb97a0d6d48e680512863db8b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 14 Mar 2024 16:53:27 -0700 Subject: [PATCH 54/71] add bfield for lasthit track state --- processors/src/utilities.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/processors/src/utilities.cxx b/processors/src/utilities.cxx index e5b3db470..48662043e 100644 --- a/processors/src/utilities.cxx +++ b/processors/src/utilities.cxx @@ -328,6 +328,8 @@ Track* utils::buildTrack(EVENT::Track* lc_track, } if (loc == trackstateLocationMap_["AtCalorimeter"]) bfieldY = track_datum->getFloatVal(6); + if (loc == trackstateLocationMap_["AtLastHit"]) + bfieldY = track_datum->getFloatVal(8); //Bfield needs factor of -1, not sure why... <-TODO investigate track->setMomentum(-bfieldY); } From 49520a5cda06fa023403408521b34538536d8a1f Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 15 Mar 2024 00:42:52 -0700 Subject: [PATCH 55/71] add bfield for lasthit track state --- processors/src/utilities.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processors/src/utilities.cxx b/processors/src/utilities.cxx index 48662043e..4d384d751 100644 --- a/processors/src/utilities.cxx +++ b/processors/src/utilities.cxx @@ -297,7 +297,7 @@ Track* utils::buildTrack(EVENT::Track* lc_track, // Check that the TrackData data structure is correct. If it's // not, throw a runtime exception. - if (track_datum->getNDouble() > 14 || track_datum->getNFloat() > 7 || track_datum->getNInt() != 1) { + if (track_datum->getNDouble() > 14 || track_datum->getNFloat() > 9 || track_datum->getNInt() != 1) { throw std::runtime_error("[ TrackingProcessor ]: The collection " + std::string(Collections::TRACK_DATA) + " has the wrong structure."); From 10788b78f853a247251a81f1bb19c34eb82febcb Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 16 Mar 2024 00:31:23 -0700 Subject: [PATCH 56/71] minor check --- processors/src/SimPartProcessor.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 9ca5b8730..26b6fb324 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -227,7 +227,10 @@ bool SimPartProcessor::process(IEvent* ievent) { double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); sim_p_list.push_back(p); - sim_pypz_list.push_back(py/pz); + if (pz!=0) + sim_pypz_list.push_back(py/pz); + else + sim_pypz_list.push_back(0); if (p > sim_max_p){ sim_max_p = p; sim_pxpz = px/pz; @@ -312,7 +315,10 @@ bool SimPartProcessor::process(IEvent* ievent) { for (int i=0; iat(i); double track_p = track_atlasthit->getP(); - track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); + if (track_atlasthit->getMomentum().at(2)) != 0 + track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); + else + track_atlasthit_pypz_list.push_back(0); if (track_p > track_atlasthit_max_p){ track_atlasthit_max_p = track_p; track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); From 0522216d15e328170186a05d3093061325603794 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 16 Mar 2024 00:39:53 -0700 Subject: [PATCH 57/71] minor check --- processors/src/SimPartProcessor.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 26b6fb324..f52897a58 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -227,7 +227,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); sim_p_list.push_back(p); - if (pz!=0) + if (pz != 0) sim_pypz_list.push_back(py/pz); else sim_pypz_list.push_back(0); @@ -315,7 +315,7 @@ bool SimPartProcessor::process(IEvent* ievent) { for (int i=0; iat(i); double track_p = track_atlasthit->getP(); - if (track_atlasthit->getMomentum().at(2)) != 0 + if (track_atlasthit->getMomentum().at(2) != 0) track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); else track_atlasthit_pypz_list.push_back(0); From dc2e4320500bef9bd1dbc22706c0c90fc0f4d73d Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 18 Mar 2024 17:10:05 -0700 Subject: [PATCH 58/71] update index for bfield --- processors/src/SimPartProcessor.cxx | 10 ++-------- processors/src/utilities.cxx | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index f52897a58..9ca5b8730 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -227,10 +227,7 @@ bool SimPartProcessor::process(IEvent* ievent) { double pz = momentum_V.at(2); double p = sqrt(px*px + py*py + pz*pz); sim_p_list.push_back(p); - if (pz != 0) - sim_pypz_list.push_back(py/pz); - else - sim_pypz_list.push_back(0); + sim_pypz_list.push_back(py/pz); if (p > sim_max_p){ sim_max_p = p; sim_pxpz = px/pz; @@ -315,10 +312,7 @@ bool SimPartProcessor::process(IEvent* ievent) { for (int i=0; iat(i); double track_p = track_atlasthit->getP(); - if (track_atlasthit->getMomentum().at(2) != 0) - track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); - else - track_atlasthit_pypz_list.push_back(0); + track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); if (track_p > track_atlasthit_max_p){ track_atlasthit_max_p = track_p; track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); diff --git a/processors/src/utilities.cxx b/processors/src/utilities.cxx index 4d384d751..850d00aa5 100644 --- a/processors/src/utilities.cxx +++ b/processors/src/utilities.cxx @@ -329,7 +329,7 @@ Track* utils::buildTrack(EVENT::Track* lc_track, if (loc == trackstateLocationMap_["AtCalorimeter"]) bfieldY = track_datum->getFloatVal(6); if (loc == trackstateLocationMap_["AtLastHit"]) - bfieldY = track_datum->getFloatVal(8); + bfieldY = track_datum->getFloatVal(7); //Bfield needs factor of -1, not sure why... <-TODO investigate track->setMomentum(-bfieldY); } From 81222220d37bd9f903d7d7c33fd4d68b4caecc40 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 18 Mar 2024 23:03:07 -0700 Subject: [PATCH 59/71] add track hit layer in TrackerProcessor --- processors/src/TrackingProcessor.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/processors/src/TrackingProcessor.cxx b/processors/src/TrackingProcessor.cxx index 146712391..ed82857b3 100644 --- a/processors/src/TrackingProcessor.cxx +++ b/processors/src/TrackingProcessor.cxx @@ -206,6 +206,8 @@ bool TrackingProcessor::process(IEvent* ievent) { // Add a reference to the hit track->addHit(tracker_hit); hits_.push_back(tracker_hit); + int hitLayer = tracker_hit->getLayer(); + track->addHitLayer(hitLayer); //Get shared Hits information for (int jtrack = itrack+1; jtrack < tracks->getNumberOfElements(); ++jtrack) { From 07d914f7965209b18b705659b29bb12cf12a06d6 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 21 Mar 2024 22:29:21 -0700 Subject: [PATCH 60/71] minor typo --- analysis/plotconfigs/mc/simPart.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index a8369a787..b775f1c51 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -230,8 +230,6 @@ "xtitle" : "Track x - Sim x (at ECal)", "ytitle" : "Events" }, - - "sim_track_atlasthit_x_diff_h" : { "bins" : 1000, "minX" : -100, From 3120ea935f68029c5a1b25de17022d374bf5903f Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Thu, 21 Mar 2024 22:31:05 -0700 Subject: [PATCH 61/71] minor typo --- analysis/plotconfigs/mc/simPart.json | 1 - 1 file changed, 1 deletion(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index b775f1c51..6bbb40a8b 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -258,7 +258,6 @@ "xtitle" : "Track p (at At Last Hit) - Sim p (at At Last Hit)", "ytitle" : "Events" }, - "sim_track_atlasthit_px_diff_h" : { "bins" : 100, "minX" : -5, From 5329eb44aaf74959e7723224f7b3f763c32b1b71 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 22 Mar 2024 22:58:48 -0700 Subject: [PATCH 62/71] track state position fix --- processors/src/SimPartProcessor.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 9ca5b8730..0e7da9dee 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -318,9 +318,9 @@ bool SimPartProcessor::process(IEvent* ievent) { track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); track_atlasthit_max_p_y = track_atlasthit->getPosition().at(1); track_atlasthit_max_p_z = track_atlasthit->getPosition().at(2); - track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(0); - track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(1); - track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(2); + track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(2); + track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(0); + track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(1); std::vector layer_list = track_atlasthit->getHitLayers(); track_atlasthit_last_layer = *(std::max_element(layer_list.begin(), layer_list.end())); } @@ -338,16 +338,16 @@ bool SimPartProcessor::process(IEvent* ievent) { int track_layer = mc_tracker_hit_atlasthit->getLayer(); int track_id = mc_tracker_hit_atlasthit->getPartID(); double mc_track_p = mc_tracker_hit_atlasthit->getP(); - if (track_layer != track_atlasthit_last_layer) + if (track_layer != (track_atlasthit_last_layer+1)) continue; if (mc_track_p > mc_tracker_hit_atlasthit_max_p){ mc_tracker_hit_atlasthit_max_p = mc_track_p; - mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); - mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); - mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); mc_tracker_hit_atlasthit_max_p_x = mc_tracker_hit_atlasthit->getPosition().at(0); mc_tracker_hit_atlasthit_max_p_y = mc_tracker_hit_atlasthit->getPosition().at(1); mc_tracker_hit_atlasthit_max_p_z = mc_tracker_hit_atlasthit->getPosition().at(2); + mc_tracker_hit_atlasthit_max_p_px = mc_tracker_hit_atlasthit->getMomentum().at(0); + mc_tracker_hit_atlasthit_max_p_py = mc_tracker_hit_atlasthit->getMomentum().at(1); + mc_tracker_hit_atlasthit_max_p_pz = mc_tracker_hit_atlasthit->getMomentum().at(2); } } From c9df448a024f531ae2b673bf8c6620dab5be063b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 23 Mar 2024 14:27:14 -0700 Subject: [PATCH 63/71] track state position fix --- processors/src/SimPartProcessor.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 0e7da9dee..4d5adeaa2 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -315,12 +315,12 @@ bool SimPartProcessor::process(IEvent* ievent) { track_atlasthit_pypz_list.push_back(track_atlasthit->getMomentum().at(1)/track_atlasthit->getMomentum().at(2)); if (track_p > track_atlasthit_max_p){ track_atlasthit_max_p = track_p; - track_atlasthit_max_p_x = track_atlasthit->getPosition().at(0); - track_atlasthit_max_p_y = track_atlasthit->getPosition().at(1); - track_atlasthit_max_p_z = track_atlasthit->getPosition().at(2); - track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(2); - track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(0); - track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(1); + track_atlasthit_max_p_x = track_atlasthit->getPosition().at(2); + track_atlasthit_max_p_y = track_atlasthit->getPosition().at(0); + track_atlasthit_max_p_z = track_atlasthit->getPosition().at(1); + track_atlasthit_max_p_px = track_atlasthit->getMomentum().at(0); + track_atlasthit_max_p_py = track_atlasthit->getMomentum().at(1); + track_atlasthit_max_p_pz = track_atlasthit->getMomentum().at(2); std::vector layer_list = track_atlasthit->getHitLayers(); track_atlasthit_last_layer = *(std::max_element(layer_list.begin(), layer_list.end())); } From 7542eb9bdce2c643ae86a8bbbefe6061b2084440 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sat, 23 Mar 2024 20:53:08 -0700 Subject: [PATCH 64/71] add plot of px residual vs p --- analysis/plotconfigs/mc/simPart.json | 30 ++++++++++++++++++++++++++++ processors/src/SimPartProcessor.cxx | 8 ++++++++ 2 files changed, 38 insertions(+) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 6bbb40a8b..102b2bba6 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -480,6 +480,36 @@ "xtitle" : "Track (at Last Hit) x - Sim x (at Last Hit)", "ytitle" : "Ecal energy" }, + "sim_track_atlasthit_px_track_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) px - Sim px (at Last Hit)", + "ytitle" : "Track p" + }, + "sim_track_atlasthit_px_sim_p_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) px - Sim px (at Last Hit)", + "ytitle" : "sim p" + }, + "sim_track_atlasthit_px_ecal_energy_hh" : { + "binsX" : 1000, + "minX" : -100, + "maxX" : 100, + "binsY" : 20, + "minY" : 0, + "maxY" : 10, + "xtitle" : "Track (at Last Hit) px - Sim px (at Last Hit)", + "ytitle" : "Ecal energy" + }, "sim_ecal_x_track_p_hh" : { "binsX" : 1000, "minX" : -100, diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartProcessor.cxx index 4d5adeaa2..3a7dc3bce 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartProcessor.cxx @@ -396,6 +396,10 @@ bool SimPartProcessor::process(IEvent* ievent) { histos->Fill2DHisto("sim_track_atlasthit_x_track_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), track_atlasthit_max_p, weight); histos->Fill2DHisto("sim_track_atlasthit_x_sim_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), mc_tracker_hit_atlasthit_max_p, weight); histos->Fill2DHisto("sim_track_atlasthit_x_ecal_energy_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), ecal_max_energy, weight); + + histos->Fill2DHisto("sim_track_atlasthit_px_track_p_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), track_atlasthit_max_p, weight); + histos->Fill2DHisto("sim_track_atlasthit_px_sim_p_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), mc_tracker_hit_atlasthit_max_p, weight); + histos->Fill2DHisto("sim_track_atlasthit_px_ecal_energy_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), ecal_max_energy, weight); } tuples->fill(); @@ -590,6 +594,10 @@ bool SimPartProcessor::process(IEvent* ievent) { reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_track_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), track_atlasthit_max_p, weight); reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_sim_p_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), mc_tracker_hit_atlasthit_max_p, weight); reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_x_ecal_energy_hh", (track_atlasthit_max_p_x-mc_tracker_hit_atlasthit_max_p_x), ecal_max_energy, weight); + + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_px_track_p_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), track_atlasthit_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_px_sim_p_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), mc_tracker_hit_atlasthit_max_p, weight); + reg_histos_[region]->Fill2DHisto("sim_track_atlasthit_px_ecal_energy_hh", (track_atlasthit_max_p_px-mc_tracker_hit_atlasthit_max_p_px), ecal_max_energy, weight); } //reg_tuples_[region]->fill(); From 43571e862e0cc9d382358e22d6e6cec87e1f6dc0 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sun, 24 Mar 2024 06:26:35 -0700 Subject: [PATCH 65/71] add plot of px residual vs p --- analysis/plotconfigs/mc/simPart.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 102b2bba6..cd999b3a2 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -481,9 +481,9 @@ "ytitle" : "Ecal energy" }, "sim_track_atlasthit_px_track_p_hh" : { - "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "binsX" : 100, + "minX" : -5, + "maxX" : 5, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -491,9 +491,9 @@ "ytitle" : "Track p" }, "sim_track_atlasthit_px_sim_p_hh" : { - "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "binsX" : 100, + "minX" : -5, + "maxX" : 5, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -501,9 +501,9 @@ "ytitle" : "sim p" }, "sim_track_atlasthit_px_ecal_energy_hh" : { - "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "binsX" : 100, + "minX" : -5, + "maxX" : 5, "binsY" : 20, "minY" : 0, "maxY" : 10, From 9afcdebbb703dd8d5f454ae93f49cc5b53b0422d Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Sun, 24 Mar 2024 21:41:15 -0400 Subject: [PATCH 66/71] update binning --- analysis/plotconfigs/mc/simPart.json | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index cd999b3a2..6b1f6ce43 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -232,50 +232,50 @@ }, "sim_track_atlasthit_x_diff_h" : { "bins" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "xtitle" : "Track x (at At Last Hit) - Sim x (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_y_diff_h" : { "bins" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "xtitle" : "Track y (at At Last Hit) - Sim y (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_z_diff_h" : { "bins" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "xtitle" : "Track z (at At Last Hit) - Sim z (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_p_diff_h" : { "bins" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "xtitle" : "Track p (at At Last Hit) - Sim p (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_px_diff_h" : { "bins" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "xtitle" : "Track px (at At Last Hit) - Sim px (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_py_diff_h" : { "bins" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "xtitle" : "Track py (at At Last Hit) - Sim py (at At Last Hit)", "ytitle" : "Events" }, "sim_track_atlasthit_pz_diff_h" : { "bins" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "xtitle" : "Track pz (at At Last Hit) - Sim pz (at At Last Hit)", "ytitle" : "Events" }, @@ -452,8 +452,8 @@ }, "sim_track_atlasthit_x_track_p_hh" : { "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -462,8 +462,8 @@ }, "sim_track_atlasthit_x_sim_p_hh" : { "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -472,8 +472,8 @@ }, "sim_track_atlasthit_x_ecal_energy_hh" : { "binsX" : 1000, - "minX" : -100, - "maxX" : 100, + "minX" : -20, + "maxX" : 20, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -482,8 +482,8 @@ }, "sim_track_atlasthit_px_track_p_hh" : { "binsX" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -492,8 +492,8 @@ }, "sim_track_atlasthit_px_sim_p_hh" : { "binsX" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "binsY" : 20, "minY" : 0, "maxY" : 10, @@ -502,8 +502,8 @@ }, "sim_track_atlasthit_px_ecal_energy_hh" : { "binsX" : 100, - "minX" : -5, - "maxX" : 5, + "minX" : -1, + "maxX" : 1, "binsY" : 20, "minY" : 0, "maxY" : 10, From e7ac8d115a900822c6c9c5284f5be00cbd0d4b78 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 15 May 2024 16:35:16 -0700 Subject: [PATCH 67/71] fix conflicts --- event/include/MCTrackerHit.h | 15 ++++++--------- event/src/MCTrackerHit.cxx | 6 ------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/event/include/MCTrackerHit.h b/event/include/MCTrackerHit.h index a9e1637e8..63137b241 100644 --- a/event/include/MCTrackerHit.h +++ b/event/include/MCTrackerHit.h @@ -37,13 +37,10 @@ class MCTrackerHit : public TObject { * * @param position The hit position. */ - void setPosition(const double* position, bool rotate = false); - - /** @return The hit position. */ - std::vector getPosition() const { return {x_, y_, z_}; }; - - void setMomentum(const float* momentum, bool rotate = false); - std::vector getMomentum() const { return {px_, py_, pz_}; }; + void setPosition(const double* position, bool rotate = false); + + /** @return The hit position. */ + std::vector getPosition() const { return {x_, y_, z_}; }; /** @return the global X coordinate of the hit */ double getGlobalX() const {return x_;} @@ -59,10 +56,10 @@ class MCTrackerHit : public TObject { * * @param momentum The hit momentum. */ - void setMomentum(const double* momentum); + void setMomentum(const float* momentum, bool rotate = false); /** @return The hit momentum. */ - std::vector getMomentum() const { return {px_, py_, pz_}; }; + std::vector getMomentum() const { return {px_, py_, pz_}; }; /** * @return momentum magnitude diff --git a/event/src/MCTrackerHit.cxx b/event/src/MCTrackerHit.cxx index e895b2f38..d6a158481 100644 --- a/event/src/MCTrackerHit.cxx +++ b/event/src/MCTrackerHit.cxx @@ -57,9 +57,3 @@ void MCTrackerHit::setPosition(const double* position, bool rotate) { z_ = position[2]; } } - -void MCTrackerHit::setMomentum(const double* momentum) { - px_ = momentum[0]; - py_ = momentum[1]; - pz_ = momentum[2]; -} From 2baeb97f66299c6da23705519de9b6e049e6cd3e Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 15 May 2024 17:20:39 -0700 Subject: [PATCH 68/71] change name from SimPartProcessor to SimPartAnaProcessor --- processors/config/simPartAna_cfg.py | 2 +- ...mPartProcessor.h => SimPartAnaProcessor.h} | 10 ++++----- ...tProcessor.cxx => SimPartAnaProcessor.cxx} | 22 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) rename processors/include/{SimPartProcessor.h => SimPartAnaProcessor.h} (94%) rename processors/src/{SimPartProcessor.cxx => SimPartAnaProcessor.cxx} (98%) diff --git a/processors/config/simPartAna_cfg.py b/processors/config/simPartAna_cfg.py index 072d896e5..5091a8082 100644 --- a/processors/config/simPartAna_cfg.py +++ b/processors/config/simPartAna_cfg.py @@ -37,7 +37,7 @@ # Processors # ############################### -sim_part_ana = HpstrConf.Processor('sim_part', 'SimPartProcessor') +sim_part_ana = HpstrConf.Processor('sim_part', 'SimPartAnaProcessor') ############################### # Processor Configuration # diff --git a/processors/include/SimPartProcessor.h b/processors/include/SimPartAnaProcessor.h similarity index 94% rename from processors/include/SimPartProcessor.h rename to processors/include/SimPartAnaProcessor.h index a77724d17..41a340324 100644 --- a/processors/include/SimPartProcessor.h +++ b/processors/include/SimPartAnaProcessor.h @@ -1,5 +1,5 @@ -#ifndef __SIM_PARTPROCESSOR_H__ -#define __SIM_PARTPROCESSOR_H__ +#ifndef __SIM_PARTANAPROCESSOR_H__ +#define __SIM_PARTANAPROCESSOR_H__ //HPSTR #include "HpsEvent.h" @@ -28,7 +28,7 @@ class TTree; * @brief Insert description here. * more details */ -class SimPartProcessor : public Processor { +class SimPartAnaProcessor : public Processor { public: /** @@ -37,9 +37,9 @@ class SimPartProcessor : public Processor { * @param name * @param process */ - SimPartProcessor(const std::string& name, Process& process); + SimPartAnaProcessor(const std::string& name, Process& process); - ~SimPartProcessor(); + ~SimPartAnaProcessor(); /** * @brief description diff --git a/processors/src/SimPartProcessor.cxx b/processors/src/SimPartAnaProcessor.cxx similarity index 98% rename from processors/src/SimPartProcessor.cxx rename to processors/src/SimPartAnaProcessor.cxx index 3a7dc3bce..03460a8a1 100644 --- a/processors/src/SimPartProcessor.cxx +++ b/processors/src/SimPartAnaProcessor.cxx @@ -1,19 +1,19 @@ /** - * @file SimPartProcessor.cxx - * @brief SimPartProcessor used fill histograms to check acceptance of simulated particle source + * @file SimPartAnaProcessor.cxx + * @brief SimPartAnaProcessor used fill histograms to check acceptance of simulated particle source * @author Abhisek Datta, University of California, Los Angeles */ -#include "SimPartProcessor.h" +#include "SimPartAnaProcessor.h" #include #include -SimPartProcessor::SimPartProcessor(const std::string& name, Process& process) : Processor(name,process){} +SimPartAnaProcessor::SimPartAnaProcessor(const std::string& name, Process& process) : Processor(name,process){} //TODO CHECK THIS DESTRUCTOR -SimPartProcessor::~SimPartProcessor(){} +SimPartAnaProcessor::~SimPartAnaProcessor(){} -void SimPartProcessor::configure(const ParameterSet& parameters) { - std::cout << "Configuring SimPartProcessor" << std::endl; +void SimPartAnaProcessor::configure(const ParameterSet& parameters) { + std::cout << "Configuring SimPartAnaProcessor" << std::endl; try { debug_ = parameters.getInteger("debug"); @@ -37,7 +37,7 @@ void SimPartProcessor::configure(const ParameterSet& parameters) { } } -void SimPartProcessor::initialize(TTree* tree) { +void SimPartAnaProcessor::initialize(TTree* tree) { tree_= tree; // init histos histos = new SimPartHistos(anaName_); @@ -175,7 +175,7 @@ void SimPartProcessor::initialize(TTree* tree) { std::cout<<"WARNING: No Reco Ecal hit collection"<getCutFlowHisto()->Fill(0.,weight); @@ -606,7 +606,7 @@ bool SimPartProcessor::process(IEvent* ievent) { return true; } -void SimPartProcessor::finalize() { +void SimPartAnaProcessor::finalize() { outF_->cd(); histos->saveHistos(outF_, "presel"); @@ -628,4 +628,4 @@ void SimPartProcessor::finalize() { outF_->Close(); } -DECLARE_PROCESSOR(SimPartProcessor); +DECLARE_PROCESSOR(SimPartAnaProcessor); From 8ef53831a55ffc374551d5f5af89761e99f74a08 Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Wed, 15 May 2024 17:24:17 -0700 Subject: [PATCH 69/71] fix data types --- event/include/MCTrackerHit.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/event/include/MCTrackerHit.h b/event/include/MCTrackerHit.h index 63137b241..9c229a6ab 100644 --- a/event/include/MCTrackerHit.h +++ b/event/include/MCTrackerHit.h @@ -126,13 +126,13 @@ class MCTrackerHit : public TObject { double z_{-999}; /** The px momentum of the hit. */ - double px_{-999}; + float px_{-999}; /** The y momentum of the hit. */ - double py_{-999}; + float py_{-999}; /** The z momentum of the hit. */ - double pz_{-999}; + float pz_{-999}; /** The hit time. */ double time_{-999}; From bd5f88f503f58c0b34b0e98c1cfeaa45c3720bfd Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Fri, 28 Jun 2024 16:28:46 +0200 Subject: [PATCH 70/71] add ecal energy zoom in plot --- analysis/plotconfigs/mc/simPart.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/analysis/plotconfigs/mc/simPart.json b/analysis/plotconfigs/mc/simPart.json index 6b1f6ce43..6044399bd 100644 --- a/analysis/plotconfigs/mc/simPart.json +++ b/analysis/plotconfigs/mc/simPart.json @@ -202,6 +202,13 @@ "xtitle" : "ECal energy", "ytitle" : "Events" }, + "ecal_energy_zoom_h" : { + "bins" : 50, + "minX" : 0, + "maxX" : 2, + "xtitle" : "ECal energy", + "ytitle" : "Events" + }, "ecal_x_h" : { "bins" : 200, "minX" : -340, From a250b8a142e086cc76b645ac3b4c7c855c833e8b Mon Sep 17 00:00:00 2001 From: Abhisek Datta Date: Mon, 8 Jul 2024 23:16:17 -0700 Subject: [PATCH 71/71] update zoom plot ecal energy --- analysis/src/SimPartHistos.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/analysis/src/SimPartHistos.cxx b/analysis/src/SimPartHistos.cxx index febf89321..28ddffa16 100644 --- a/analysis/src/SimPartHistos.cxx +++ b/analysis/src/SimPartHistos.cxx @@ -117,6 +117,7 @@ void SimPartHistos::FillRecoEcalCuster(CalCluster* ecal_cluster, FlatTupleMaker* Fill1DHisto("ecal_n_hits_h", n_hits, weight); Fill1DHisto("ecal_energy_h", energy, weight); + Fill1DHisto("ecal_energy_zoom_h", energy, weight); Fill1DHisto("ecal_x_h", cluster_x, weight); Fill1DHisto("ecal_y_h", cluster_y, weight); Fill2DHisto("ecal_x_y_hh", cluster_x, cluster_y, weight);