diff --git a/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx b/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx index 70b81b2c1ba4509a44ecd523dbed6b210bacd572..932e66263d9aeb83c5f099a710f77ae225e19913 100644 --- a/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx +++ b/Calorimeter/CaloDigiAlgs/src/CaloWaveformDigiAlg.cxx @@ -105,6 +105,21 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const { } + // This is a bit of a hack to make sure all waveforms have + // at least baseline entries. Should really add this to the + // logic above + for (const auto& w : waveforms) { + if (w.second.size() > 0) continue; + + // Waveform was empty, fill with baseline + int channel = m_mappingTool->getChannelMapping(w.first); + ATH_MSG_DEBUG("Writing baseline into empty waveform in channel "<< channel); + for (const auto& tk : m_timekernel) { + int baseline = m_digiTool->generate_baseline(m_base_mean, m_base_rms); + waveforms[w.first].push_back(baseline); + } + } + //m_chrono->chronoStop("Digit"); //m_chrono->chronoStart("Write"); diff --git a/Control/CalypsoExample/Digitization/scripts/faserMDC_digi.py b/Control/CalypsoExample/Digitization/scripts/faserMDC_digi.py index 805fd649b24c1fdc1e46c4853f7aa672eedf33ba..be31e19994c9e93391f12228f80ca1096c222d51 100755 --- a/Control/CalypsoExample/Digitization/scripts/faserMDC_digi.py +++ b/Control/CalypsoExample/Digitization/scripts/faserMDC_digi.py @@ -75,7 +75,7 @@ elif runtype == "TestBeamMC" : # New TI12 geometry (ugh) elif runtype == "TI12MC": - ConfigFlags.GeoModel.FaserVersion = "FASERNU-02" + ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" else: diff --git a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py index abc7ae67eff82e08286cb4be4534781c0d51d945..fe827c0fdea36cd271a579c29a2f7b47776a7bf5 100755 --- a/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py +++ b/Control/CalypsoExample/Generation/scripts/faserMDC_particlegun.py @@ -68,10 +68,12 @@ if __name__ == '__main__': ConfigFlags.addFlag("Sim.Gun",{"Generator" : "SingleParticle"}) # Property bag for particle gun keyword:argument pairs ConfigFlags.addFlag("Sim.Beam.xangle", 0) # Potential beam crossing angles ConfigFlags.addFlag("Sim.Beam.yangle", 0) + ConfigFlags.addFlag("Sim.Beam.xshift", 0) # Potential beam shift + ConfigFlags.addFlag("Sim.Beam.yshift", 0) - ConfigFlags.GeoModel.FaserVersion = "FASERNU-02" # Geometry set-up - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" # Conditions set-up - ConfigFlags.addFlag("Input.InitialTimeStamp", 0) # To avoid autoconfig + ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" # Geometry set-up + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" # Conditions set-up + ConfigFlags.addFlag("Input.InitialTimeStamp", 0) # To avoid autoconfig ConfigFlags.GeoModel.Align.Dynamic = False # @@ -109,7 +111,7 @@ if __name__ == '__main__': # # MDC geometry configuration # - detectors = ['Veto', 'Preshower', 'FaserSCT', 'Ecal', 'Trigger', 'Dipole', 'Emulsion'] + detectors = ['Veto', 'VetoNu', 'Preshower', 'FaserSCT', 'Ecal', 'Trigger', 'Dipole', 'Emulsion'] # # Setup detector flags # @@ -146,12 +148,18 @@ if __name__ == '__main__': # Shift LOS # - if ConfigFlags.Sim.Beam.xangle or ConfigFlags.Sim.Beam.yangle: + if (ConfigFlags.Sim.Beam.xangle or ConfigFlags.Sim.Beam.yangle or + ConfigFlags.Sim.Beam.xshift or ConfigFlags.Sim.Beam.yshift): + MCEventKey = "BeamTruthEventShifted" import McParticleEvent.Pythonizations from GeneratorUtils.ShiftLOSConfig import ShiftLOSCfg cfg.merge(ShiftLOSCfg(ConfigFlags, OutputMCEventKey = MCEventKey, - xcross = ConfigFlags.Sim.Beam.xangle, ycross = ConfigFlags.Sim.Beam.yangle)) + xcross = ConfigFlags.Sim.Beam.xangle, + ycross = ConfigFlags.Sim.Beam.yangle, + xshift = ConfigFlags.Sim.Beam.xshift, + yshift = ConfigFlags.Sim.Beam.yshift)) + else: MCEventKey = "BeamTruthEvent" diff --git a/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorFactory.cxx b/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorFactory.cxx index c2dcc9b2201c4441f0ec5fbe92fccb4177dd5d74..da787acdfc58391b7cd3f68b00b7aae5f1055a91 100644 --- a/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorFactory.cxx +++ b/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorFactory.cxx @@ -62,20 +62,20 @@ void TrenchDetectorFactory::create(GeoPhysVol *world) std::string resolvedFile = PathResolver::find_file(gdmlFile, "XMLPATH", PathResolver::RecursiveSearch); auto store = XMLHandlerStore::GetHandlerStore(); - for (auto p : *store) - { - delete p.second; - } + // for (auto p : *store) + // { + // delete p.second; + // } store->clear(); GDMLController controller {"TrenchGDMLController"}; - std::cout << "creating parser" << std::endl; + // std::cout << "creating parser" << std::endl; XercesParser xercesParser; - std::cout << "parsing " << resolvedFile << std::endl; + // std::cout << "parsing " << resolvedFile << std::endl; xercesParser.ParseFileAndNavigate(resolvedFile); - std::cout << "done parsing " << resolvedFile << std::endl; + // std::cout << "done parsing " << resolvedFile << std::endl; const GeoLogVol* trenchLog = controller.retrieveLogicalVolume("Trench").first; GeoPhysVol* trenchPhys = new GeoPhysVol(trenchLog); diff --git a/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorTool.cxx b/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorTool.cxx index cfd2b94f43cc4fc0202b1e8af1ddee7a98700564..c036496ea42cef602db10a0190367d97ff25e3a3 100644 --- a/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorTool.cxx +++ b/FaserGeometryCommon/TrenchGeoModel/src/TrenchDetectorTool.cxx @@ -45,13 +45,11 @@ StatusCode TrenchDetectorTool::create() } DecodeFaserVersionKey versionKey(geoDbTag,"Trench"); - IRDBRecordset_ptr switchSet - = raccess->getRecordsetPtr("TrenchSwitches", versionKey.tag(), versionKey.node(),"FASERDD"); - const IRDBRecord *switches = (*switchSet)[0]; - msg(MSG::DEBUG) << "Retrieved TrenchSwitches" << endmsg; + // IRDBRecordset_ptr switchSet + // = raccess->getRecordsetPtr("TrenchSwitches", versionKey.tag(), versionKey.node(),"FASERDD"); + // const IRDBRecord *switches = (*switchSet)[0]; + // msg(MSG::DEBUG) << "Retrieved TrenchSwitches" << endmsg; - -// std::string trenchVersion = geoDbTag->trenchVersion(); std::string trenchVersion = versionKey.tag(); msg(MSG::INFO) << "Building Trench geometry version " << trenchVersion << endmsg; if(trenchVersion.empty()) { diff --git a/Generators/GeneratorUtils/python/ShiftLOS.py b/Generators/GeneratorUtils/python/ShiftLOS.py index d7e8f21d0c8fbe67346a9e435239e9858515510b..fb6180b4787e94ebe86d6833ed8c70c6f05cf8c4 100644 --- a/Generators/GeneratorUtils/python/ShiftLOS.py +++ b/Generators/GeneratorUtils/python/ShiftLOS.py @@ -11,19 +11,21 @@ except ImportError: from AthenaPython.PyAthena import HepMC as HepMC class ShiftLOS(PyAthena.Alg): - def __init__(self, name="ShiftLOS", InputMCEventKey="BeamTruthEvent", OutputMCEventKey="BeamTruthEventShifted", xcross = 0, ycross = 0): + def __init__(self, name="ShiftLOS", InputMCEventKey="BeamTruthEvent", OutputMCEventKey="BeamTruthEventShifted", xcross = 0, ycross = 0, xshift = 0, yshift = 0): super(ShiftLOS,self).__init__(name=name) self.InputMCEventKey = InputMCEventKey self.OutputMCEventKey = OutputMCEventKey self.xcross = xcross * 1e-6 self.ycross = ycross * 1e-6 - self.distance = 480*m # Assumes 480m is 0 of FASER coordinate system + self.xshift = xshift + self.yshift = yshift + self.distance = 480 * m # Assumes 480m is 0 of FASER coordinate system return def shift_vertices(self, evt): - # Don't need to shift if at IP - if not self.distance: + # Don't need to shift if at IP unless request explicit shift + if not self.distance and not self.xshift and not self.yshift: return evt # Loop over all vertices @@ -38,10 +40,17 @@ class ShiftLOS(PyAthena.Alg): # Shift x or y by appropriate crossing angle if self.xcross: x += dz * self.xcross - self.msg.debug(f"Shifting x by {self.xcross} over {dz}: {pos.x()} -> {x} ") + self.msg.debug(f"Shifting x by {self.xcross} urad over {dz}: {pos.x()} -> {x} ") elif self.ycross: y += dz * self.ycross - self.msg.debug(f"Shifting y by {self.ycross} over {dz}: {pos.y()} -> {y} ") + self.msg.debug(f"Shifting y by {self.ycross} urad over {dz}: {pos.y()} -> {y} ") + + if self.xshift: + x += self.xshift + self.msg.debug(f"Shifting x by {self.xshift} mm: {pos.x()} -> {x} ") + elif self.yshift: + y += self.yshift + self.msg.debug(f"Shifting x by {self.yshift} mm: {pos.y()} -> {y} ") v.set_position(HepMC.FourVector(x, y, z, pos.t())) @@ -50,6 +59,9 @@ class ShiftLOS(PyAthena.Alg): def boost_particles(self, evt): + if self.xcross == self.ycross == 0: + return evt + pxsum, pysum = 0,0 pxsum_orig, pysum_orig = 0,0 @@ -79,9 +91,7 @@ class ShiftLOS(PyAthena.Alg): def execute(self): self.msg.debug(f"Exectuing {self.getName()}") - print (self.xcross, self.ycross) - - if not self.xcross and not self.ycross: + if not self.xcross and not self.ycross and not self.xshift and not self.yshift: return StatusCode.Success self.msg.debug(f"Reading {self.InputMCEventKey}") @@ -116,6 +126,8 @@ if __name__ == "__main__": parser.add_argument("--OutputMCEventKey", "-o", default = "BeamTruthEventShifted", help = "Name of Output MC collection") parser.add_argument("--xcross", "-x", default = 0, type = float, help = "Crossing angle of LHC beam in x [urad]") parser.add_argument("--ycross", "-y", default = 0, type = float, help = "Crossing angle of LHC beam in y [urad]") + parser.add_argument("--xshift", default = 0, type = float, help = "Shift of LHC beam in x [mm]") + parser.add_argument("--yshift", default = 0, type = float, help = "Shift of LHC beam in y [mm]") parser.add_argument("--nevents", "-n", default = -1, type = int, help = "Number of events to process") args = parser.parse_args() @@ -150,7 +162,8 @@ if __name__ == "__main__": from AthenaConfiguration.ComponentFactory import CompFactory acc = ComponentAccumulator() - alg = ShiftLOS("ShiftLOS", InputMCEventKey=args.InputMCEventKey, OutputMCEventKey=args.OutputMCEventKey, xcross = args.xcross, ycross = args.ycross) + alg = ShiftLOS("ShiftLOS", InputMCEventKey=args.InputMCEventKey, OutputMCEventKey=args.OutputMCEventKey, + xcross = args.xcross, ycross = args.ycross, xshift = args.xshift, yshift = args.yshift) alg.OutputLevel = INFO acc.addEventAlgo(alg) cfg.merge(acc) diff --git a/Generators/GeneratorUtils/python/ShiftLOSConfig.py b/Generators/GeneratorUtils/python/ShiftLOSConfig.py index 9683df1f8b3a2b4ee7f831533415315b2972cfda..4d7f02d59d93591aa6c0e26156ce9a07e10e445d 100644 --- a/Generators/GeneratorUtils/python/ShiftLOSConfig.py +++ b/Generators/GeneratorUtils/python/ShiftLOSConfig.py @@ -4,7 +4,7 @@ # import sys from AthenaConfiguration.MainServicesConfig import AthSequencer -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator, ConfigurationError from AthenaConfiguration.ComponentFactory import CompFactory from GeneratorUtils.ShiftLOS import ShiftLOS @@ -18,7 +18,15 @@ def ShiftLOSCfg(ConfigFlags, **kwargs) : shift.InputMCEventKey = kwargs.setdefault("InputMCEventKey", "BeamTruthEvent") shift.OutputMCEventKey = kwargs.setdefault("OutputMCEventKey", "BeamTruthEventShifted") shift.xcross = kwargs.setdefault("xcross", 0) - shift.ycross = kwargs.setdefault("ycross", 0) - cfg.addEventAlgo(shift, sequenceName = "AthBeginSeq", primary = True) # to run *before* G4 + shift.ycross = kwargs.setdefault("ycross", 0) + shift.xshift = kwargs.setdefault("xshift", 0) + shift.yshift = kwargs.setdefault("yshift", 0) + try: + # Run for PG + cfg.addEventAlgo(shift, sequenceName = "AthBeginSeq", primary = True) # to run *before* G4 + except ConfigurationError: + # Run for pool or hepmc + cfg.addEventAlgo(shift, sequenceName = "AthAlgSeq", primary = True) # to run *before* G4 + return cfg diff --git a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py index 8ea29b33709b195e9bfb56d9dd8e1ed03608e590..ddf3074618aff121e704b2214309a14952436837 100644 --- a/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py +++ b/Scintillator/ScintDigiAlgs/python/ScintDigiAlgsConfig.py @@ -15,12 +15,14 @@ dict_CB_param = {} dict_CB_param["Trigger"]=dict(CB_alpha=-0.38, CB_n=25, CB_mean=815, CB_sigma=7.7, CB_norm = 500 ) dict_CB_param["Timing"]=dict(CB_alpha=-0.32, CB_n=65, CB_mean=846, CB_sigma=5.3, CB_norm = 500) # copy from Preshower; Timing was not in TestBeam dict_CB_param["Veto"]=dict(CB_alpha=-0.38, CB_n=25, CB_mean=815, CB_sigma=7.7, CB_norm = 1000) # copy from Trigger; Veto was not in TestBeam, but in sim "Veto" is the TestBeam Trigger component +dict_CB_param["VetoNu"]=dict(CB_alpha=-0.38, CB_n=25, CB_mean=815, CB_sigma=7.7, CB_norm = 1000) # copy from Trigger; Veto was not in TestBeam, but in sim "Veto" is the TestBeam Trigger component dict_CB_param["Preshower"]=dict(CB_alpha=-0.32, CB_n=65, CB_mean=846, CB_sigma=5.3, CB_norm = 500) dict_baseline_params = { "Trigger" : {"mean" : 15000, "rms" : 3}, "Timing" : {"mean" : 15000, "rms" : 3}, "Veto" : {"mean" : 15000, "rms" : 3}, + "VetoNu" : {"mean" : 15000, "rms" : 3}, "Preshower" : {"mean" : 15000, "rms" : 3}, } @@ -35,6 +37,7 @@ def ScintWaveformDigitizationCfg(flags): if "TB" not in flags.GeoModel.FaserVersion: acc.merge(ScintWaveformDigiCfg(flags, "TimingWaveformDigiAlg", "Trigger")) acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto")) + acc.merge(ScintWaveformDigiCfg(flags, "VetoNuWaveformDigiAlg", "VetoNu")) acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower")) acc.merge(ScintWaveformDigitizationOutputCfg(flags)) acc.merge(WaveformCableMappingCfg(flags)) diff --git a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx index 5ad0fe1ed286c4a310895c327f4739d05ba3a05a..1a528ca5d128736607a3e0061d19a680846e6b02 100644 --- a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx +++ b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.cxx @@ -27,6 +27,7 @@ ScintWaveformDigiAlg::initialize() { // Set up helpers ATH_CHECK(detStore()->retrieve(m_vetoID, "VetoID")); + ATH_CHECK(detStore()->retrieve(m_vetoNuID, "VetoNuID")); ATH_CHECK(detStore()->retrieve(m_triggerID, "TriggerID")); ATH_CHECK(detStore()->retrieve(m_preshowerID, "PreshowerID")); @@ -81,6 +82,8 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const { auto first = *scintHitHandle->begin(); if (first.isVeto()) { waveforms = m_digiTool->create_waveform_map(m_vetoID); + } else if (first.isVetoNu()) { + waveforms = m_digiTool->create_waveform_map(m_vetoNuID); } else if (first.isTrigger()) { waveforms = m_digiTool->create_waveform_map(m_triggerID); } else if (first.isPreshower()) { @@ -88,12 +91,34 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const { } // Loop over time samples + // Should really do sums first, as repeating these in the loop is a waste for (const auto& tk : m_timekernel) { - std::map<unsigned int, float> counts; + std::map<Identifier, float> counts; // Convolve hit energy with evaluated kernel and sum for each hit id (i.e. channel) + Identifier id; for (const auto& hit : *scintHitHandle) { - counts[hit.identify()] += tk * hit.energyLoss(); + + // Special handling for trigger scintillator + if (first.isTrigger()) { + // Hits are created per plate + // Need to split between 2 PMTs + + // Identifier from hit is plate ID + Identifier plate_id = m_triggerID->plate_id(hit.getIdentifier()); + + // Need to do something better here, but for now just fill both + id = m_triggerID->pmt_id(plate_id, 0); // ID for PMT 0 + counts[id] += tk * hit.energyLoss(); + id = m_triggerID->pmt_id(plate_id, 1); // ID for PMT 1 + counts[id] += tk * hit.energyLoss(); + + } else { + // All others have only 1 PMT + // Use detector id (not hit id) throughout + id = hit.getIdentifier(); + counts[id] += tk * hit.energyLoss(); + } } // Subtract count from basleine and add result to correct waveform vector @@ -108,19 +133,41 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const { } // Convert hit id to Identifier and store - Identifier id = ScintHitIdHelper::GetHelper()->getIdentifier(c.first); + id = c.first; waveforms[id].push_back(value); } } + // This is a bit of a hack to make sure all waveforms have + // at least baseline entries. Should really add this to the + // logic above + for (const auto& w : waveforms) { + if (w.second.size() > 0) continue; + + // Waveform was empty, fill with baseline + int channel = m_mappingTool->getChannelMapping(w.first); + ATH_MSG_DEBUG("Writing baseline into empty waveform in channel "<< channel); + for (const auto& tk : m_timekernel) { + int baseline = m_digiTool->generate_baseline(m_base_mean, m_base_rms); + waveforms[w.first].push_back(baseline); + } + } + // Loop over wavefrom vectors to make and store raw waveform unsigned int nsamples = m_digiTool->nsamples(); for (const auto& w : waveforms) { RawWaveform* wfm = new RawWaveform(); wfm->setWaveform(0, w.second); wfm->setIdentifier(w.first); - wfm->setChannel(m_mappingTool->getChannelMapping(w.first)); wfm->setSamples(nsamples); + // Only save this waveform if channel mapping is valid + // This will avoid making a waveform for the missing veto counter + int channel = m_mappingTool->getChannelMapping(w.first); + if (channel < 0) { + ATH_MSG_DEBUG("Skipping waveform with unknown channel!"); + continue; + } + wfm->setChannel(channel); waveformContainerHandle->push_back(wfm); } diff --git a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.h b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.h index 363218f9c249bdbffac7e58b5331958d4cedbc94..528325621b279bdc3f570c6e5ade93fe549b6c12 100644 --- a/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.h +++ b/Scintillator/ScintDigiAlgs/src/ScintWaveformDigiAlg.h @@ -22,6 +22,7 @@ //Helpers #include "ScintIdentifier/VetoID.h" +#include "ScintIdentifier/VetoNuID.h" #include "ScintIdentifier/TriggerID.h" #include "ScintIdentifier/PreshowerID.h" #include "ScintSimEvent/ScintHitIdHelper.h" @@ -84,6 +85,7 @@ class ScintWaveformDigiAlg : public AthReentrantAlgorithm { /// Detector ID helpers const VetoID* m_vetoID{nullptr}; + const VetoNuID* m_vetoNuID{nullptr}; const TriggerID* m_triggerID{nullptr}; const PreshowerID* m_preshowerID{nullptr}; diff --git a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py index 0caf7f3fe8083eacf42ce9e5a720637a36509899..156f20d22770b1aef4a0daf8ea117833e1b2cdef 100644 --- a/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py +++ b/Simulation/G4Faser/G4FaserAlg/test/G4FaserAlgConfigNew_Test.py @@ -44,7 +44,9 @@ if __name__ == '__main__': ConfigFlags.Sim.IncludeParentsInG4Event = True # Controls whether BeamTruthEvent is written to output HITS file ConfigFlags.addFlag("Sim.Gun",{"Generator" : "SingleParticle"}) # Property bag for particle gun keyword:argument pairs ConfigFlags.addFlag("Sim.Beam.xangle", 0) # Potential beam crossing angles - ConfigFlags.addFlag("Sim.Beam.yangle", 0) + ConfigFlags.addFlag("Sim.Beam.yangle", 0) + ConfigFlags.addFlag("Sim.Beam.xshift", 0) # Potential beam shift + ConfigFlags.addFlag("Sim.Beam.yshift", 0) ConfigFlags.GeoModel.FaserVersion = "FASERNU-03" # Geometry set-up ConfigFlags.IOVDb.GlobalTag = "OFLCOND-FASER-02" # Conditions set-up @@ -133,12 +135,15 @@ if __name__ == '__main__': # Shift LOS # - if ConfigFlags.Sim.Beam.xangle or ConfigFlags.Sim.Beam.yangle: + if (ConfigFlags.Sim.Beam.xangle or ConfigFlags.Sim.Beam.yangle or + ConfigFlags.Sim.Beam.xshift or ConfigFlags.Sim.Beam.yshift): + MCEventKey = "BeamTruthEventShifted" import McParticleEvent.Pythonizations from GeneratorUtils.ShiftLOSConfig import ShiftLOSCfg cfg.merge(ShiftLOSCfg(ConfigFlags, OutputMCEventKey = MCEventKey, - xcross = ConfigFlags.Sim.Beam.xangle, ycross = ConfigFlags.Sim.Beam.yangle)) + xcross = ConfigFlags.Sim.Beam.xangle, ycross = ConfigFlags.Sim.Beam.yangle, + xshift = ConfigFlags.Sim.Beam.xshift, yshift = ConfigFlags.Sim.Beam.yshift)) else: MCEventKey = "BeamTruthEvent" diff --git a/Tracker/TrackerRecAlgs/TrackSeedPerformanceWriter/src/TrackSeedPerformanceWriter.cxx b/Tracker/TrackerRecAlgs/TrackSeedPerformanceWriter/src/TrackSeedPerformanceWriter.cxx index 9c43a4e2a1bffc98af9c2fdd49385ddfaac0f2f9..cc0df45c1115acf86eab441652e420953aef8280 100644 --- a/Tracker/TrackerRecAlgs/TrackSeedPerformanceWriter/src/TrackSeedPerformanceWriter.cxx +++ b/Tracker/TrackerRecAlgs/TrackSeedPerformanceWriter/src/TrackSeedPerformanceWriter.cxx @@ -8,7 +8,7 @@ namespace Tracker { TrackSeedPerformanceWriter::TrackSeedPerformanceWriter(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator), AthHistogramming(name), - m_idHelper(nullptr), m_histSvc("THistSvc/THistSvc", name) {} + m_histSvc("THistSvc/THistSvc", name), m_idHelper(nullptr){} StatusCode TrackSeedPerformanceWriter::initialize() { diff --git a/Tracker/TrackerRecAlgs/TrackerData/src/TrackerSegmentFitDataAlg.cxx b/Tracker/TrackerRecAlgs/TrackerData/src/TrackerSegmentFitDataAlg.cxx index 92545f3202a58880bbfb6ec6cfa55e3a0bc4396f..d6666a34b3ffddd84d8f215ff5f895439862504b 100644 --- a/Tracker/TrackerRecAlgs/TrackerData/src/TrackerSegmentFitDataAlg.cxx +++ b/Tracker/TrackerRecAlgs/TrackerData/src/TrackerSegmentFitDataAlg.cxx @@ -13,7 +13,7 @@ namespace Tracker { TrackerSegmentFitDataAlg::TrackerSegmentFitDataAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator), AthHistogramming(name), - m_detMgr(nullptr), m_idHelper(nullptr), m_histSvc("THistSvc/THistSvc", name) {} + m_histSvc("THistSvc/THistSvc", name), m_detMgr(nullptr), m_idHelper(nullptr) {} StatusCode TrackerSegmentFitDataAlg::initialize() { diff --git a/Tracker/TrackerRecAlgs/TrackerData/src/TrackerTruthDataAlg.cxx b/Tracker/TrackerRecAlgs/TrackerData/src/TrackerTruthDataAlg.cxx index 188f8afb930a7c8006561076d582e2b685da4692..0f3c8afe610ce69417d5acb2b1b0680b7f7c5ffc 100644 --- a/Tracker/TrackerRecAlgs/TrackerData/src/TrackerTruthDataAlg.cxx +++ b/Tracker/TrackerRecAlgs/TrackerData/src/TrackerTruthDataAlg.cxx @@ -11,7 +11,7 @@ namespace Tracker { TrackerTruthDataAlg::TrackerTruthDataAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator), AthHistogramming(name), - m_sct(nullptr), m_sID(nullptr), m_histSvc("THistSvc/THistSvc", name) {} + m_histSvc("THistSvc/THistSvc", name), m_sct(nullptr), m_sID(nullptr) {} StatusCode TrackerTruthDataAlg::initialize() { diff --git a/Tracker/TrackerRecAlgs/TrackerSegmentFit/src/SegmentFitAlg.h b/Tracker/TrackerRecAlgs/TrackerSegmentFit/src/SegmentFitAlg.h index 757eb1a22752acbe72e0da7a0c6c7a89878bf76a..bce869119f8a4927ddc272d885aa3cffe6c46ea1 100644 --- a/Tracker/TrackerRecAlgs/TrackerSegmentFit/src/SegmentFitAlg.h +++ b/Tracker/TrackerRecAlgs/TrackerSegmentFit/src/SegmentFitAlg.h @@ -415,7 +415,7 @@ class SegmentFitAlg : public AthReentrantAlgorithm DoubleProperty m_tanThetaCut { this, "TanThetaCut", 0.0, "Maximum accepted tangent of track angle from beam axis; 0 means no cut."}; DoubleProperty m_reducedChi2Cut { this, "ReducedChi2Cut", 10.0, "Maximum accepted chi^2 per degree of freedom for final fits; 0 means no cut." }; DoubleProperty m_sharedHitFraction { this, "SharedHitFraction", -1., "Fraction of hits which are allowed to be shared between two fits." }; - IntegerProperty m_minClustersPerFit { this, "MinClustersPerFit", 4, "Minimum number of clusters a fit has to have." }; + UnsignedIntegerProperty m_minClustersPerFit { this, "MinClustersPerFit", 4, "Minimum number of clusters a fit has to have." }; mutable std::atomic<int> m_numberOfEvents{0}; mutable std::atomic<int> m_numberExcessOccupancy{0}; diff --git a/Tracker/TrackerRecAlgs/TrackerTruth/src/TrackerTruthAlg.cxx b/Tracker/TrackerRecAlgs/TrackerTruth/src/TrackerTruthAlg.cxx index cc600bad74f6e16341757becc305ea0343416889..84249c0cc4e2bde1dd54bf7192f0fbc67295c189 100644 --- a/Tracker/TrackerRecAlgs/TrackerTruth/src/TrackerTruthAlg.cxx +++ b/Tracker/TrackerRecAlgs/TrackerTruth/src/TrackerTruthAlg.cxx @@ -10,7 +10,7 @@ namespace Tracker { TrackerTruthAlg::TrackerTruthAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator), AthHistogramming(name), - m_sct(nullptr), m_sID(nullptr), m_histSvc("THistSvc/THistSvc", name) {} + m_histSvc("THistSvc/THistSvc", name), m_sct(nullptr), m_sID(nullptr) {} StatusCode TrackerTruthAlg::initialize() { diff --git a/Tracker/TrackerRecAlgs/TruthSeededTrackFinder/src/TruthSeededTrackFinder.cxx b/Tracker/TrackerRecAlgs/TruthSeededTrackFinder/src/TruthSeededTrackFinder.cxx index c88414a505231ab1fee984801da34f83982394ce..f0a7b64cd20c02d0e13a5357b9fe3f05f36f6f5a 100755 --- a/Tracker/TrackerRecAlgs/TruthSeededTrackFinder/src/TruthSeededTrackFinder.cxx +++ b/Tracker/TrackerRecAlgs/TruthSeededTrackFinder/src/TruthSeededTrackFinder.cxx @@ -312,11 +312,11 @@ namespace Tracker // depositPair.first->print(std::cout); // std::cout<<"!!!!!!!!!!! pdg id = "<<depositPair.first->pdg_id()<<std::endl; if (depositPair.first->pdg_id() == -13) { - HepMC::FourVector pv = depositPair.first->production_vertex()->position(); - HepMC::FourVector ev = depositPair.first->end_vertex()->position (); + // HepMC::FourVector pv = depositPair.first->production_vertex()->position(); + // HepMC::FourVector ev = depositPair.first->end_vertex()->position (); truthmom = depositPair.first->momentum(); -// std::cout<<"!!!!!!!!!!! production_vertex: ( "<<pv.x()<<", "<<pv.y()<<", "<<pv.z()<<" ) "<<std::endl; -// std::cout<<"!!!!!!!!!!! end_vertex: ( "<<ev.x()<<", "<<ev.y()<<", "<<ev.z()<<" ) "<<std::endl; + // std::cout<<"!!!!!!!!!!! production_vertex: ( "<<pv.x()<<", "<<pv.y()<<", "<<pv.z()<<" ) "<<std::endl; + // std::cout<<"!!!!!!!!!!! end_vertex: ( "<<ev.x()<<", "<<ev.y()<<", "<<ev.z()<<" ) "<<std::endl; } //!!!!!!!!!!!!!!!!!!!!!!!! if( depositPair.second > highestDep) @@ -338,14 +338,14 @@ namespace Tracker for (auto daughter : primary->particles_out()) { // TODO: Check that daughter->production_vertex() and daughter->end_vertex() exist, and bracket the point you're interested in - if (daughter->barcode() % 1000000 == primary->barcode()) { + if (daughter->barcode() % 1000000 == primary->barcode()) { ATH_MSG_DEBUG(" daughter barcode: " << daughter->barcode() << " with energy " << daughter->momentum().e() << " px = " << daughter->momentum().px() << " py = " << daughter->momentum().py() << " pz = " << daughter->momentum().pz() ); - if (daughter->production_vertex() != nullptr && daughter->end_vertex() != nullptr) { - HepMC::FourVector pv = daughter->production_vertex()->position(); - HepMC::FourVector ev = daughter->end_vertex()->position (); -// std::cout<<"!!!!!!!!!!! production_vertex: ( "<<pv.x()<<", "<<pv.y()<<", "<<pv.z()<<" ) "<<std::endl; -// std::cout<<"!!!!!!!!!!! end_vertex: ( "<<ev.x()<<", "<<ev.y()<<", "<<ev.z()<<" ) "<<std::endl; - } + // if (daughter->production_vertex() != nullptr && daughter->end_vertex() != nullptr) { + // HepMC::FourVector pv = daughter->production_vertex()->position(); + // HepMC::FourVector ev = daughter->end_vertex()->position (); + // std::cout<<"!!!!!!!!!!! production_vertex: ( "<<pv.x()<<", "<<pv.y()<<", "<<pv.z()<<" ) "<<std::endl; + // std::cout<<"!!!!!!!!!!! end_vertex: ( "<<ev.x()<<", "<<ev.y()<<", "<<ev.z()<<" ) "<<std::endl; + // } } } } @@ -533,11 +533,11 @@ namespace Tracker // std::cout<<"!!!!!!!!!!! direct2 = ("<<direct2.x()<<", "<<direct2.y()<<", "<<direct2.z()<<") "<<std::endl; // the vector pointing from the center of circle to the particle at layer 2 in Y-Z plane double R1_z = charge * direct1.y() / std::sqrt(direct1.y()*direct1.y() + direct1.z()*direct1.z()); - double R1_y = -charge * direct1.z() / std::sqrt(direct1.y()*direct1.y() + direct1.z()*direct1.z()); + // double R1_y = -charge * direct1.z() / std::sqrt(direct1.y()*direct1.y() + direct1.z()*direct1.z()); // std::cout<<"!!!!!!!!!!! (R1_y, R1_z) = ("<<R1_y<<", "<<R1_z<<") "<<std::endl; // the vector pointing from the center of circle to the particle at layer 3 in Y-Z plane double R2_z = charge * direct2.y() / std::sqrt(direct2.y()*direct2.y() + direct2.z()*direct2.z()); - double R2_y = -charge * direct2.z() / std::sqrt(direct2.y()*direct2.y() + direct2.z()*direct2.z()); + // double R2_y = -charge * direct2.z() / std::sqrt(direct2.y()*direct2.y() + direct2.z()*direct2.z()); // std::cout<<"!!!!!!!!!!! (R2_y, R2_z) = ("<<R2_y<<", "<<R2_z<<") "<<std::endl; // the norm of radius double R = (pos2_0.z() - pos1_2.z()) / (R2_z - R1_z); @@ -549,7 +549,7 @@ namespace Tracker double p_x = direct1.x() * p_z / direct1.z(); // total momentum at the layer 0 const Acts::Vector3 mom(p_x, p_y, p_z); - double p = mom.norm(); + // double p = mom.norm(); // std::cout<<"!!!!!!!!!!! InitTrack momentum on layer 0: ( "<<mom.x()*1000<<", "<<mom.y()*1000<<", "<<mom.z()*1000<<", "<<p*1000<<") "<<std::endl; // std::cout<<"!!!!!!!!!!! truth momentum: ( "<<truthmom.px()<<", "<<truthmom.py()<<", "<<truthmom.pz()<<", "<<truthmom.m()<<" ) "<<std::endl; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/ActsTrackSeedTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/ActsTrackSeedTool.cxx index 4d90b6c7c619ec160bee114123066c7c25aa30a3..013e242db7572fc4a92875cd8a6188ed45bc5171 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/ActsTrackSeedTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/ActsTrackSeedTool.cxx @@ -121,7 +121,7 @@ StatusCode ActsTrackSeedTool::finalize() { Acts::CurvilinearTrackParameters ActsTrackSeedTool::get_params( const Acts::GeometryContext& gctx, const Amg::Vector3D& pos1, const Amg::Vector3D& pos2, const Amg::Vector3D& pos3, - const Acts::BoundSymMatrix& cov, double origin) { + const Acts::BoundSymMatrix& cov, double /*origin*/) { const auto surface = Acts::Surface::makeShared<Acts::PlaneSurface>( Acts::Vector3 {0, 0, pos1.z()}, Acts::Vector3{0, 0, -1}); boost::container::small_vector<const Amg::Vector3D*, 3> spacepoints {}; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/CKF2.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/CKF2.cxx index 355e4a930024de1239d222e24fddf1f7560b6feb..68aceccd626edab5d1e0316a1364055cb061d160 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/CKF2.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/CKF2.cxx @@ -277,7 +277,7 @@ StatusCode CKF2::execute() { ATH_MSG_DEBUG(" position: " << params.position(geoctx).transpose()); ATH_MSG_DEBUG(" momentum: " << params.momentum().transpose()); ATH_MSG_DEBUG(" charge: " << params.charge()); - double charge = params.charge(); + // double charge = params.charge(); std::unique_ptr<Trk::Track> track = makeTrack(geoctx, traj); if (track) { // outputTracks->push_back(std::move(track)); diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/KalmanFitterTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/KalmanFitterTool.cxx index 686047ae7232deb09ca207f6599666f0bd022aa3..7e97a82dfc1bc93e95714c9bf00fcdbc75d405c7 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/KalmanFitterTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/KalmanFitterTool.cxx @@ -40,7 +40,7 @@ StatusCode KalmanFitterTool::finalize() { std::unique_ptr<Trk::Track> KalmanFitterTool::fit(const EventContext &ctx, const Trk::Track &inputTrack, - std::vector<FaserActsRecMultiTrajectory> &trajectories, + std::vector<FaserActsRecMultiTrajectory> & /*trajectories*/, const Acts::BoundVector& inputVector = Acts::BoundVector::Zero()) const { std::unique_ptr<Trk::Track> newTrack = nullptr; std::vector<FaserActsRecMultiTrajectory> myTrajectories; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/RootTrajectorySummaryWriterTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/RootTrajectorySummaryWriterTool.cxx index bb916b9bfefeaf47c013b29122c12eb48f17abf7..cb19d4dd9dbdce58901a7f1a002a7f3e1a986c9e 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/RootTrajectorySummaryWriterTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/RootTrajectorySummaryWriterTool.cxx @@ -248,7 +248,7 @@ StatusCode RootTrajectorySummaryWriterTool::write( continue; } // Get the truth particle info at vertex - const HepMC::GenVertex* vertex = particle->production_vertex(); + // const HepMC::GenVertex* vertex = particle->production_vertex(); t_p = truthParameters->momentum().mag(); t_charge = truthParameters->charge(); t_time = truthParameters->time(); diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/ThreeStationTrackSeedTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/ThreeStationTrackSeedTool.cxx index 8c6eb8c0328b0ca194cb06083cc3c019cdbc0fd7..020c19b9cf4dfcfc1b8a5641d5e6c3765733161d 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/ThreeStationTrackSeedTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/ThreeStationTrackSeedTool.cxx @@ -63,7 +63,7 @@ StatusCode ThreeStationTrackSeedTool::run() { std::map<int, std::vector<Tracklet>> station_tracklet_map; for (const Trk::Track* track : *trackCollection) { - auto momentum = track->trackParameters()->front()->momentum(); + // auto momentum = track->trackParameters()->front()->momentum(); int station = -1; Amg::Vector3D trackletPosition {0, 0, 0}; std::vector<const Tracker::FaserSCT_Cluster*> trackletClusters {}; diff --git a/Tracking/Acts/FaserActsKalmanFilter/src/TrackSeedWriterTool.cxx b/Tracking/Acts/FaserActsKalmanFilter/src/TrackSeedWriterTool.cxx index 42c4d1b7969d00e67b1f73ee21ff08a043c15df6..820e53cb18a6190992f3003c3df7fcd5fc751de9 100644 --- a/Tracking/Acts/FaserActsKalmanFilter/src/TrackSeedWriterTool.cxx +++ b/Tracking/Acts/FaserActsKalmanFilter/src/TrackSeedWriterTool.cxx @@ -75,6 +75,9 @@ void TrackSeedWriterTool::writeout( m_eTHETA.push_back(parameters[Acts::eBoundTheta]); m_eQOP.push_back(parameters[Acts::eBoundQOverP]); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + const auto& covariance = *initialParameters.covariance(); m_err_eLOC0.push_back(sqrt(covariance(Acts::eBoundLoc0, Acts::eBoundLoc0))); m_err_eLOC1.push_back(sqrt(covariance(Acts::eBoundLoc1, Acts::eBoundLoc1))); @@ -82,6 +85,8 @@ void TrackSeedWriterTool::writeout( m_err_eTHETA.push_back(sqrt(covariance(Acts::eBoundTheta, Acts::eBoundTheta))); m_err_eQOP.push_back(sqrt(covariance(Acts::eBoundQOverP, Acts::eBoundQOverP))); +#pragma GCC diagnostic pop + const auto& position = initialParameters.position(gctx); const auto& momentum = initialParameters.momentum(); m_x.push_back(position.x()); diff --git a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py index daf5ae7ca6ee1bd3474421ae0e1e9156c2263a40..414773bf9dc2e9b8140b33d81a80220c4288e4bf 100644 --- a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py +++ b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py @@ -23,10 +23,7 @@ def WaveformReconstructionCfg(flags): acc.merge(WaveformHitRecCfg(flags, "VetoWaveformRecAlg", "Veto")) acc.merge(WaveformHitRecCfg(flags, "PreshowerWaveformRecAlg", "Preshower")) acc.merge(WaveformHitRecCfg(flags, "CaloWaveformRecAlg", "Calo")) - if flags.Input.isMC: - print("Turning off VetoNu reco in MC!") - else: - acc.merge(WaveformHitRecCfg(flags, "VetoNuWaveformRecAlg", "VetoNu")) + acc.merge(WaveformHitRecCfg(flags, "VetoNuWaveformRecAlg", "VetoNu")) acc.merge(WaveformTimingCfg(flags))