From 52ea00f33970adcd916b109a957c47f532deb2e8 Mon Sep 17 00:00:00 2001 From: Savannah Rose Shively <sshively@lxplus758.cern.ch> Date: Thu, 20 Oct 2022 16:07:41 +0200 Subject: [PATCH] update trig to veto --- .../src/TrackerEfficiencyAlg.cxx | 141 +++++++----------- .../src/TrackerEfficiencyAlg.h | 32 ++-- .../NtupleDumper/python/NtupleDumperConfig.py | 17 ++- 3 files changed, 86 insertions(+), 104 deletions(-) diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx index 57a2705e..bf680b41 100644 --- a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx +++ b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.cxx @@ -41,9 +41,9 @@ StatusCode TrackerEfficiencyAlg::initialize() { ATH_CHECK( m_clusterContainerKey.initialize() ); ATH_CHECK( m_waveformPreshowerHitContainerKey.initialize() ); ATH_CHECK( m_waveformCaloHitContainerKey.initialize() ); - ATH_CHECK( m_waveformTriggerHitContainerKey.initialize() ); + ATH_CHECK( m_waveformVetoHitContainerKey.initialize() ); ATH_CHECK(detStore()->retrieve(m_idHelper, "FaserSCT_ID")); - ATH_CHECK(m_spacePointContainerKey.initialize()); + ATH_CHECK(m_spacePointContainerKey.initialize()); //Deion code ATH_CHECK(m_clusterContainer.initialize()); @@ -54,12 +54,12 @@ StatusCode TrackerEfficiencyAlg::initialize() { //Raw Integral m_tree->Branch("presh_rawintegral", &m_presh_rawintegral, "presh_rawintegral/F"); m_tree->Branch("calo_rawintegral", &m_calo_rawintegral, "calo_rawintegral/F"); - m_tree->Branch("trig_rawintegral", &m_trig_rawintegral, "trig_rawintegral/F"); + m_tree->Branch("veto_rawintegral", &m_veto_rawintegral, "veto_rawintegral/F"); m_tree->Branch("presh_integral", &m_presh_integral, "presh_integral/F"); m_tree->Branch("calo_integral", &m_calo_integral, "calo_integral/F"); m_tree->Branch("calo_integral_norm", &m_calo_integral_norm, "calo_integral_norm/F"); - m_tree->Branch("trig_integral", &m_trig_integral, "trig_integral/F"); + m_tree->Branch("veto_integral", &m_veto_integral, "veto_integral/F"); //Preshower Counts m_tree->Branch("presh_wfhit_count", &m_presh_wfhit_count, "presh_wfhit_count/I"); @@ -75,10 +75,10 @@ StatusCode TrackerEfficiencyAlg::initialize() { m_tree->Branch("calo_counts_ch4", &m_calo_counts_ch4, "calo_counts_ch4/I"); m_tree->Branch("calo_counts_ch5", &m_calo_counts_ch5, "calo_counts_ch5/I"); - //Trigger Counts - m_tree->Branch("trig_wfhit_count", &m_trig_wfhit_count, "trig_wfhit_count/I"); - m_tree->Branch("trig_counts_ch8", &m_trig_counts_ch8, "trig_counts_ch8/I"); - m_tree->Branch("trig_counts_ch9", &m_trig_counts_ch9, "trig_counts_ch9/I"); + //Veto Counts + m_tree->Branch("veto_wfhit_count", &m_veto_wfhit_count, "veto_wfhit_count/I"); + m_tree->Branch("veto_counts_ch8", &m_veto_counts_ch8, "veto_counts_ch8/I"); + m_tree->Branch("veto_counts_ch9", &m_veto_counts_ch9, "veto_counts_ch9/I"); //More general counts m_tree->Branch("track_counts", &m_track_counts, "track_counts/I"); @@ -89,18 +89,18 @@ StatusCode TrackerEfficiencyAlg::initialize() { //Counting how many channels are active m_tree->Branch("presh_max_channel", &m_presh_max_channel, "presh_max_channel/I"); m_tree->Branch("calo_max_channel", &m_calo_max_channel, "calo_max_channel/I"); - m_tree->Branch("trig_max_channel", &m_trig_max_channel, "trig_max_channel/I"); + m_tree->Branch("veto_max_channel", &m_veto_max_channel, "veto_max_channel/I"); m_tree->Branch("calo_sumintegral", &m_calo_sumintegral, "calo_sumintegral/I"); //Checking that all channels are active m_tree->Branch("presh_check", &m_presh_check, "presh_check/I"); m_tree->Branch("calo_check", &m_calo_check, "calo_check/I"); - m_tree->Branch("trig_check", &m_trig_check, "trig_check/I"); + m_tree->Branch("veto_check", &m_veto_check, "veto_check/I"); m_tree->Branch("presh_alpha", &m_presh_alpha, "presh_alpha/F"); m_tree->Branch("calo_alpha", &m_calo_alpha, "calo_alpha/F"); - m_tree->Branch("trig_alpha", &m_trig_alpha, "trig_alpha/F"); + m_tree->Branch("veto_alpha", &m_veto_alpha, "veto_alpha/F"); //Tracker data m_tree->Branch("x", &m_x, "x/F"); @@ -144,13 +144,13 @@ StatusCode TrackerEfficiencyAlg::initialize() { m_tree->Branch("calo_baseline_mean2", &m_calo_baseline_mean2, "calo_baseline_mean2/F"); m_tree->Branch("calo_baseline_rms2", &m_calo_baseline_rms2, "calo_baseline_rms2/F"); - m_tree->Branch("trig_width", &m_trig_width, "trig_width/F"); - m_tree->Branch("trig_localtime", &m_trig_localtime, "trig_localtime/F"); - m_tree->Branch("trig_peak", &m_trig_peak, "trig_peak/F"); - m_tree->Branch("trig_bcid_time", &m_trig_bcid_time, "trig_bcid_time/F"); - m_tree->Branch("trig_raw_peak", &m_trig_raw_peak, "trig_raw_peak/F"); - m_tree->Branch("trig_baseline_mean", &m_trig_baseline_mean, "trig_baseline_mean/F"); - m_tree->Branch("trig_baseline_rms", &m_trig_baseline_rms, "trig_baseline_rms/F"); + m_tree->Branch("veto_width", &m_veto_width, "veto_width/F"); + m_tree->Branch("veto_localtime", &m_veto_localtime, "veto_localtime/F"); + m_tree->Branch("veto_peak", &m_veto_peak, "veto_peak/F"); + m_tree->Branch("veto_bcid_time", &m_veto_bcid_time, "veto_bcid_time/F"); + m_tree->Branch("veto_raw_peak", &m_veto_raw_peak, "veto_raw_peak/F"); + m_tree->Branch("veto_baseline_mean", &m_veto_baseline_mean, "veto_baseline_mean/F"); + m_tree->Branch("veto_baseline_rms", &m_veto_baseline_rms, "veto_baseline_rms/F"); //cluster @@ -173,7 +173,7 @@ StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const SG::ReadHandle<Tracker::FaserSCT_ClusterContainer> SCT_ClusterContainer {m_clusterContainerKey, ctx}; SG::ReadHandle<xAOD::WaveformHitContainer> waveformPreshowerHitContainer {m_waveformPreshowerHitContainerKey, ctx}; SG::ReadHandle<xAOD::WaveformHitContainer> waveformCaloHitContainer {m_waveformCaloHitContainerKey, ctx}; - SG::ReadHandle<xAOD::WaveformHitContainer> waveformTriggerHitContainer {m_waveformTriggerHitContainerKey, ctx}; + SG::ReadHandle<xAOD::WaveformHitContainer> waveformVetoHitContainer {m_waveformVetoHitContainerKey, ctx}; //SG::ReadHandleKey<FaserSCT_SpacePointContainer> spacePointContainer {m_Sct_spcontainerKey, ctx}; if (!waveformPreshowerHitContainer.isValid()){ @@ -184,8 +184,9 @@ StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const ATH_MSG_ERROR("Could not read " << waveformCaloHitContainer.name()); return StatusCode::FAILURE; } - if (!waveformTriggerHitContainer.isValid()){ - ATH_MSG_ERROR("Could not read " << waveformTriggerHitContainer.name()); + + if (!waveformVetoHitContainer.isValid()){ + ATH_MSG_ERROR("Could not read " << waveformVetoHitContainer.name()); return StatusCode::FAILURE; } @@ -333,45 +334,52 @@ StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const } m_calo_check=calo_check[0]+calo_check[1]+calo_check[2]+calo_check[3]+calo_check[4]+calo_check[5]; - //ANALYSE TRIGGER EVENTS - m_trig_wfhit_count=0; - m_trig_counts_ch8=0; - m_trig_counts_ch9=0; - int trig_check[2] = {0,0}; - float trig_maxintegral=0; - m_trig_max_channel=-1; - - for (const xAOD::WaveformHit* hit : *waveformTriggerHitContainer) + //ANALYSE Veto EVENTS + + m_veto_wfhit_count=0; + m_veto_counts_ch8=0; + m_veto_counts_ch9=0; + int veto_check[2] = {0,0}; + float veto_maxintegral=0; + m_veto_max_channel=-1; + + for (const xAOD::WaveformHit* hit : *waveformVetoHitContainer) { - if (abs(trig_maxintegral) <abs(hit->integral())){ + if (abs(veto_maxintegral) <abs(hit->integral())){ const Identifier id = hit->identify(); - m_trig_rawintegral = hit->raw_integral(); - m_trig_integral = hit->integral(); - trig_maxintegral = hit->integral(); - m_trig_alpha = hit->alpha(); - - m_trig_localtime = hit->localtime(); - m_trig_width = hit->width(); - m_trig_peak = hit->peak(); - m_trig_bcid_time = hit->bcid_time(); - m_trig_raw_peak = hit->raw_peak(); - m_trig_baseline_mean = hit->baseline_mean(); - m_trig_baseline_rms = hit->baseline_rms(); - m_trig_max_channel=hit->channel(); + m_veto_rawintegral = hit->raw_integral(); + m_veto_integral = hit->integral(); + veto_maxintegral = hit->integral(); + m_veto_alpha = hit->alpha(); + + m_veto_localtime = hit->localtime(); + m_veto_width = hit->width(); + m_veto_peak = hit->peak(); + m_veto_bcid_time = hit->bcid_time(); + m_veto_raw_peak = hit->raw_peak(); + m_veto_baseline_mean = hit->baseline_mean(); + m_veto_baseline_rms = hit->baseline_rms(); + m_veto_max_channel=hit->channel(); } - m_trig_wfhit_count++; + m_veto_wfhit_count++; switch(hit->channel()){ - case 8: m_trig_counts_ch8++; trig_check[0]=1; break; - case 9: m_trig_counts_ch9++; trig_check[1]=1; break; + case 8: m_veto_counts_ch8++; veto_check[0]=1; break; + case 9: m_veto_counts_ch9++; veto_check[1]=1; break; } } - m_trig_check=trig_check[0]+trig_check[1]; + m_veto_check=veto_check[0]+veto_check[1]; Amg::Vector3D pos; Amg::Vector3D dir; + m_x=-1; + m_y=-1; + m_z=-1; + m_px=-1; + m_py=-1; + m_pz=-1; m_track_counts=0; @@ -426,41 +434,7 @@ StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const //deion SG::ReadHandle<Tracker::FaserSCT_ClusterContainer> clusterContainer { m_clusterContainer, ctx }; ATH_CHECK(clusterContainer.isValid()); -/* - for (auto collection : *clusterContainer) - { - Identifier id = collection->identify(); - //int station = m_sctHelper->station(id); - int clusters = (int) collection->size(); - //std::cout <<station <<'\n'; - m_stationClusters+=clusters; - for (auto cluster : *collection) { - if (cluster == nullptr) continue; - auto clusterID = cluster->identify(); - m_clusterIds.push_back(clusterID); - int layer = m_sctHelper->layer(id); - auto pos = cluster->globalPosition(); - - //m_layerclusters={layer,x,y,z,onTrack} - m_layerclusters[0].push_back(layer); - m_layerclusters[1].push_back(pos.x()); - m_layerclusters[2].push_back(pos.y()); - m_layerclusters[3].push_back(pos.z()); - - if(std::find(m_trackClusterIds.begin(), m_trackClusterIds.end(), clusterID) != m_trackClusterIds.end()) { - m_layerclusters[4].push_back(1); //Cluster is on track - } else { - m_layerclusters[4].push_back(0); //Cluster is not on track - } - } - } -*/ - - m_layerspacepoints[0].clear(); - m_layerspacepoints[1].clear(); - m_layerspacepoints[2].clear(); - m_layerspacepoints[3].clear(); - m_layerspacepoints[4].clear(); + for (int i=0; i<5; i++) {m_layerspacepoints[i].clear();} SG::ReadHandle<FaserSCT_SpacePointContainer> spacePointContainer {m_spacePointContainerKey, ctx}; ATH_CHECK(spacePointContainer.isValid()); for (const FaserSCT_SpacePointCollection* spacePointCollection : *spacePointContainer) { @@ -492,7 +466,6 @@ StatusCode TrackerEfficiencyAlg::execute(const EventContext& ctx) const } else { m_layerspacepoints[4].push_back(0); //Cluster is not on track } - //m_layerspacepoints[4].push_back(-1); } } diff --git a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h index 20722019..82e5ca0e 100644 --- a/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h +++ b/Control/CalypsoExample/TrackerEfficiencyExample/src/TrackerEfficiencyAlg.h @@ -65,7 +65,7 @@ class TrackerEfficiencyAlg : public AthReentrantAlgorithm, AthHistogramming SG::ReadHandleKey<Tracker::FaserSCT_ClusterContainer> m_clusterContainerKey {this, "FaserSCT_ClusterContainer", "SCT_ClusterContainer"}; SG::ReadHandleKey<xAOD::WaveformHitContainer> m_waveformPreshowerHitContainerKey {this, "WaveformHitContainerKey", "PreshowerWaveformHits"}; SG::ReadHandleKey<xAOD::WaveformHitContainer> m_waveformCaloHitContainerKey {this, "WaveformHitContainerKey", "CaloWaveformHits"}; - SG::ReadHandleKey<xAOD::WaveformHitContainer> m_waveformTriggerHitContainerKey {this, "WaveformHitContainerKey", "TriggerWaveformHits"}; + SG::ReadHandleKey<xAOD::WaveformHitContainer> m_waveformVetoHitContainerKey {this, "WaveformHitContainerKey", "VetoWaveformHits"}; //SG::ReadHandleKey<FaserSCT_SpacePointContainer> m_Sct_spcontainerKey{this, "SpacePointsSCTName", "SCT_SpacePointContainer"}; SG::ReadHandleKey<FaserSCT_SpacePointContainer> m_spacePointContainerKey { this, "SpacePoints", "SCT_SpacePointContainer", "space point container"}; @@ -114,29 +114,29 @@ class TrackerEfficiencyAlg : public AthReentrantAlgorithm, AthHistogramming mutable int m_calo_counts_ch5=0; - mutable int m_trig_wfhit_count=0; - mutable int m_trig_counts_ch8=0; - mutable int m_trig_counts_ch9=0; + mutable int m_veto_wfhit_count=0; + mutable int m_veto_counts_ch8=0; + mutable int m_veto_counts_ch9=0; mutable int m_track_counts=0; mutable float m_presh_rawintegral; - mutable float m_trig_rawintegral; + mutable float m_veto_rawintegral; mutable float m_presh_integral; - mutable float m_trig_integral; + mutable float m_veto_integral; mutable float m_presh_alpha; - mutable float m_trig_alpha; + mutable float m_veto_alpha; //counts how many times a channel number appears. mutable int m_presh_max_channel=0; - mutable int m_trig_max_channel =0; + mutable int m_veto_max_channel =0; //checks for an event in each channel mutable int m_presh_check; mutable int m_calo_check; - mutable int m_trig_check; + mutable int m_veto_check; mutable float m_presh_localtime; mutable float m_presh_width; @@ -174,13 +174,13 @@ class TrackerEfficiencyAlg : public AthReentrantAlgorithm, AthHistogramming mutable float m_calo_sumintegral2=0; mutable float m_calo_alpha2; - mutable float m_trig_localtime; - mutable float m_trig_width; - mutable float m_trig_peak; - mutable float m_trig_bcid_time; - mutable float m_trig_raw_peak; - mutable float m_trig_baseline_mean; - mutable float m_trig_baseline_rms; + mutable float m_veto_localtime; + mutable float m_veto_width; + mutable float m_veto_peak; + mutable float m_veto_bcid_time; + mutable float m_veto_raw_peak; + mutable float m_veto_baseline_mean; + mutable float m_veto_baseline_rms; //deion mutable unsigned int m_stationClusters; diff --git a/PhysicsAnalysis/NtupleDumper/python/NtupleDumperConfig.py b/PhysicsAnalysis/NtupleDumper/python/NtupleDumperConfig.py index 5bc52c41..c8321d4f 100644 --- a/PhysicsAnalysis/NtupleDumper/python/NtupleDumperConfig.py +++ b/PhysicsAnalysis/NtupleDumper/python/NtupleDumperConfig.py @@ -6,6 +6,15 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg +from argparse import ArgumentParser + +parser=ArgumentParser(description="EventLooper") +parser.add_argument("-f","--file",type=str) +parser.add_argument("-m","--maxevents",type=int,default=1000) +opts=parser.parse_args() + + + def NtupleDumperAlgCfg(flags, **kwargs): # Initialize GeoModel from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg @@ -46,11 +55,11 @@ if __name__ == "__main__": Configurable.configurableRun3Behavior = True # Configure - ConfigFlags.Input.Files = [ - '/eos/experiment/faser/rec/2022/p0008//008119/Faser-Physics-008119-00168-p0008-xAOD.root', - + # inp = '/eos/experiment/faser/rec/2022/p0008//008119/Faser-Physics-008119-00168-p0008-xAOD.root' + inp = opts.file + name = inp.split('-xAOD')[0] + ConfigFlags.Input.Files = [inp] - ] ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" # Always needed; must match FaserVersionS ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now ConfigFlags.Input.ProjectName = "data21" # Needed to bypass autoconfig -- GitLab