Skip to content

Commit

Permalink
Merge pull request #11 from NamithaChitrazee/pbar2m3
Browse files Browse the repository at this point in the history
Changes to KinKal and CRV (PR1073) incorporated while still keeping the build e20-p047
  • Loading branch information
NamithaChitrazee authored Sep 24, 2023
2 parents 23c68d3 + db36f13 commit 2c379aa
Show file tree
Hide file tree
Showing 290 changed files with 3,496 additions and 5,117 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,bugprone-*,performance-*,readability-braces-around-statements,readability-misleading-indentation,readability-non-const-parameter'
Checks: 'clang-diagnostic-*,clang-analyzer-*,bugprone-*,performance-*,readability-misleading-indentation,readability-non-const-parameter,-bugprone-narrowing-conversions,-bugprone-easily-swappable-parameters'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
Expand Down
2 changes: 1 addition & 1 deletion .muse
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# prefer to build with this environment
ENVSET p045
ENVSET p047
# add these to python path
PYTHONPATH Trigger/python
# add Offline/bin to path
Expand Down
18 changes: 9 additions & 9 deletions Analyses/src/EMFCSimpleDumper_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ namespace mu2e {
int pdgId;
unsigned particleId;

VDHit() : pmag(std::numeric_limits<double>::quiet_NaN())
, px(std::numeric_limits<double>::quiet_NaN())
, py(std::numeric_limits<double>::quiet_NaN())
, pz(std::numeric_limits<double>::quiet_NaN())
VDHit() : pmag(std::numeric_limits<double>::max())
, px(std::numeric_limits<double>::max())
, py(std::numeric_limits<double>::max())
, pz(std::numeric_limits<double>::max())

, x(std::numeric_limits<double>::quiet_NaN())
, y(std::numeric_limits<double>::quiet_NaN())
, z(std::numeric_limits<double>::quiet_NaN())
, x(std::numeric_limits<double>::max())
, y(std::numeric_limits<double>::max())
, z(std::numeric_limits<double>::max())

, time(std::numeric_limits<double>::quiet_NaN())
, time(std::numeric_limits<double>::max())

, charge(std::numeric_limits<double>::quiet_NaN())
, charge(std::numeric_limits<double>::max())
, pdgId(0)
, particleId(-1U)
{}
Expand Down
21 changes: 0 additions & 21 deletions Analyses/src/KineticFracAnalysis_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#include "Offline/GlobalConstantsService/inc/unknownPDGIdName.hh"
#include "art/Framework/Core/EDAnalyzer.h"

#include "Offline/ConditionsService/inc/AcceleratorParams.hh"
#include "Offline/ConditionsService/inc/CalorimeterPhysicalConstants.hh"
#include "Offline/ConditionsService/inc/ConditionsHandle.hh"

#include "Offline/TrackerGeom/inc/Tracker.hh"

#include "Offline/CalorimeterGeom/inc/Calorimeter.hh"
Expand All @@ -42,8 +38,6 @@
#include "Offline/MCDataProducts/inc/GenId.hh"
#include "Offline/DataProducts/inc/VirtualDetectorId.hh"

#include "Offline/Mu2eUtilities/inc/SimParticleTimeOffset.hh"

#include "Offline/RecoDataProducts/inc/CaloHit.hh"
#include "Offline/RecoDataProducts/inc/TrkCaloIntersect.hh"
#include "Offline/RecoDataProducts/inc/TrkCaloMatch.hh"
Expand Down Expand Up @@ -137,7 +131,6 @@ namespace mu2e {
std::string _trkPatRecModuleLabel;
TrkParticle _tpart;
TrkFitDirection _fdir;
SimParticleTimeOffset _toff; // time offset smearing
std::string _shLabel;
std::string _shpLabel;
std::string _shfLabel;
Expand Down Expand Up @@ -337,9 +330,6 @@ namespace mu2e {
//CLHEP::Hep3Vector _secondDiskLoc;
double _firstDiskZ;
double _secondDiskZ;
double _eCritPos;
double _eCritNeg;
double _density;
double _tol = 1.0*CLHEP::mm; // for comparisons, slight differences in computations at 1e-9 level
};

Expand All @@ -363,7 +353,6 @@ namespace mu2e {
_trkPatRecModuleLabel(pset.get<string>("trkPatRecModuleLabel")),
_tpart((TrkParticle::type)(pset.get<int>("fitparticle",TrkParticle::e_minus))),
_fdir((TrkFitDirection::FitDirection)(pset.get<int>("fitdirection",TrkFitDirection::downstream))),
_toff(pset.get<fhicl::ParameterSet>("TimeOffsets", fhicl::ParameterSet())),
_shLabel(pset.get<string>("StrawHitCollectionLabel","makeSH")),
_shpLabel(pset.get<string>("StrawHitPositionCollectionLabel","MakeStereoHits")),
_shfLabel (pset.get<std::string>("StrawHitFlagCollectionLabel" ,"FlagStrawHits" )),
Expand Down Expand Up @@ -665,16 +654,6 @@ namespace mu2e {

if (_diagLevel > 0){std::cout << "******************new event in KineticFracAnalysis*******************" << std::endl;}

// ConditionsHandle<AcceleratorParams> accPar("ignored");
//double _mbtime = accPar->deBuncherPeriod;
//_toff.updateMap(event);

ConditionsHandle<CalorimeterPhysicalConstants> calPhys("ignored");
_density = calPhys->density();
// std::cout << "density is " << _density/(CLHEP::g/CLHEP::cm3) << std::endl;
_eCritPos = calPhys->criticalEnergyPos();
_eCritNeg = calPhys->criticalEnergyNeg();

//Get handle to the calorimeter
art::ServiceHandle<GeometryService> geom;
if( ! geom->hasElement<Calorimeter>() ) return;
Expand Down
6 changes: 3 additions & 3 deletions Analyses/src/Mu2eG4StudyCalo01ReadBack_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ namespace mu2e {
ttp.time = sim.startGlobalTime(); // start time
ttp.gtime = gtime_parent+sim.startProperTime(); // start time
CLHEP::Hep3Vector const & pos_start = sim.startPosition();
CLHEP::Hep3Vector const & mom_start = sim.startMomentum();
CLHEP::Hep3Vector const mom_start = sim.startMomentum();
ttp.x = pos_start.x();
ttp.y = pos_start.y();
ttp.z = pos_start.z();
Expand All @@ -514,7 +514,7 @@ namespace mu2e {
ttp.tstop = sim.endGlobalTime();
ttp.gtstop = gtime_parent+sim.endProperTime();
CLHEP::Hep3Vector const & pos_end = sim.endPosition();
CLHEP::Hep3Vector const & mom_end = sim.endMomentum();
CLHEP::Hep3Vector const mom_end = sim.endMomentum();

ttp.xstop = pos_end.x();
ttp.ystop = pos_end.y();
Expand Down Expand Up @@ -601,7 +601,7 @@ namespace mu2e {
if( sim_parent ) {
ttp.parent_pdg = sim_parent->pdgId();
CLHEP::Hep3Vector const & pos_parent = sim_parent->startPosition();
CLHEP::Hep3Vector const & mom_parent = sim_parent->startMomentum();
CLHEP::Hep3Vector const mom_parent = sim_parent->startMomentum();
ttp.parent_x = pos_parent.x();
ttp.parent_y = pos_parent.y();
ttp.parent_z = pos_parent.z();
Expand Down
6 changes: 3 additions & 3 deletions Analyses/src/Mu2eG4StudyReadBack_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ namespace mu2e {
ttp.time = sim.startGlobalTime(); // start time
ttp.gtime = gtime_parent+sim.startProperTime(); // start time
CLHEP::Hep3Vector const & pos_start = sim.startPosition();
CLHEP::Hep3Vector const & mom_start = sim.startMomentum();
CLHEP::Hep3Vector const mom_start = sim.startMomentum();
ttp.x = pos_start.x();
ttp.y = pos_start.y();
ttp.z = pos_start.z();
Expand All @@ -463,7 +463,7 @@ namespace mu2e {
ttp.tstop = sim.endGlobalTime();
ttp.gtstop = gtime_parent+sim.endProperTime();
CLHEP::Hep3Vector const & pos_end = sim.endPosition();
CLHEP::Hep3Vector const & mom_end = sim.endMomentum();
CLHEP::Hep3Vector const mom_end = sim.endMomentum();

ttp.xstop = pos_end.x();
ttp.ystop = pos_end.y();
Expand Down Expand Up @@ -551,7 +551,7 @@ namespace mu2e {
if( sim_parent ) {
ttp.parent_pdg = sim_parent->pdgId();
CLHEP::Hep3Vector const & pos_parent = sim_parent->startPosition();
CLHEP::Hep3Vector const & mom_parent = sim_parent->startMomentum();
CLHEP::Hep3Vector const mom_parent = sim_parent->startMomentum();
ttp.parent_x = pos_parent.x();
ttp.parent_y = pos_parent.y();
ttp.parent_z = pos_parent.z();
Expand Down
8 changes: 1 addition & 7 deletions Analyses/src/PbarAnalysis2_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
#include "Offline/MCDataProducts/inc/StepPointMC.hh"
#include "Offline/MCDataProducts/inc/CaloMCTruthAssns.hh"


#include "Offline/Mu2eUtilities/inc/SimParticleTimeOffset.hh"
#include "Offline/RecoDataProducts/inc/TrkCaloMatch.hh"
// data
#include "Offline/CaloCluster/inc/ClusterUtils.hh"
Expand Down Expand Up @@ -163,7 +161,6 @@ namespace mu2e {
std::string _stepPointMCLabel;
std::string _trkFitterModuleLabel;
std::string _trackClusterMatchModuleLabel;
SimParticleTimeOffset _toff; // time offset smearing

double _maxChi2Match;
bool _writeVertexFile;
Expand Down Expand Up @@ -264,7 +261,6 @@ namespace mu2e {
_stepPointMCLabel(pset.get<std::string>("stepPointMCLabel")),
_trkFitterModuleLabel(pset.get<std::string>("trkFitterModuleLabel")),
_trackClusterMatchModuleLabel(pset.get<std::string>("trackClusterMatchModuleLabel")),
_toff(pset.get<fhicl::ParameterSet>("TimeOffsets", fhicl::ParameterSet())),
_maxChi2Match(pset.get<double>("maxChi2Match")),
_writeVertexFile(pset.get<bool>("writeVertexFile")),
_pbarVertexOutName(pset.get<std::string>("pbarVertexOut")),
Expand Down Expand Up @@ -449,7 +445,6 @@ namespace mu2e {

ConditionsHandle<AcceleratorParams> accPar("ignored");
double _mbtime = accPar->deBuncherPeriod;
_toff.updateMap(event);


//Handle to the calorimeter
Expand Down Expand Up @@ -926,8 +921,7 @@ namespace mu2e {

if (hit.volumeId()<VirtualDetectorId::EMC_Disk_0_SurfIn || hit.volumeId()>VirtualDetectorId::EMC_Disk_1_EdgeOut) continue;

double hitTimeUnfolded = _toff.timeWithOffsetsApplied(hit);
double hitTime = fmod(hitTimeUnfolded,_mbtime);
double hitTime = fmod(hit.time(),_mbtime);

CLHEP::Hep3Vector VDPos = cal.geomUtil().mu2eToTracker(hit.position());

Expand Down
34 changes: 15 additions & 19 deletions Analyses/src/PrimaryProtonEnergyDumper_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "art_root_io/TFileDirectory.h"

#include "Offline/MCDataProducts/inc/StepPointMC.hh"
#include "Offline/Mu2eUtilities/inc/SimParticleTimeOffset.hh"
#include "Offline/Mu2eUtilities/inc/SimParticleGetTau.hh"

#include "art/Framework/Principal/Run.h"
Expand Down Expand Up @@ -90,33 +89,33 @@ namespace mu2e {
unsigned particleId;
unsigned volumeCopyNumber;

VDHit() : x(std::numeric_limits<double>::quiet_NaN())
, y(std::numeric_limits<double>::quiet_NaN())
, z(std::numeric_limits<double>::quiet_NaN())
VDHit() : x(std::numeric_limits<double>::max())
, y(std::numeric_limits<double>::max())
, z(std::numeric_limits<double>::max())

, time(std::numeric_limits<double>::quiet_NaN())
, time(std::numeric_limits<double>::max())

, px(std::numeric_limits<double>::quiet_NaN())
, py(std::numeric_limits<double>::quiet_NaN())
, pz(std::numeric_limits<double>::quiet_NaN())
, pmag(std::numeric_limits<double>::quiet_NaN())
, ek(std::numeric_limits<double>::quiet_NaN())
, totalEDep(std::numeric_limits<double>::quiet_NaN())
, nonIonizingEDep(std::numeric_limits<double>::quiet_NaN())
, px(std::numeric_limits<double>::max())
, py(std::numeric_limits<double>::max())
, pz(std::numeric_limits<double>::max())
, pmag(std::numeric_limits<double>::max())
, ek(std::numeric_limits<double>::max())
, totalEDep(std::numeric_limits<double>::max())
, nonIonizingEDep(std::numeric_limits<double>::max())

, charge(std::numeric_limits<double>::quiet_NaN())
, charge(std::numeric_limits<double>::max())
, pdgId(0)
, particleId(-1U)
, volumeCopyNumber(-1U)
{}

//----------------------------------------------------------------
VDHit(const SimParticleTimeOffset& toff, const StepPointMC& hit)
VDHit(const StepPointMC& hit)
: x(hit.position().x())
, y(hit.position().y())
, z(hit.position().z())

, time(toff.timeWithOffsetsApplied(hit))
, time(hit.time())

, px(hit.momentum().x())
, py(hit.momentum().y())
Expand All @@ -143,7 +142,6 @@ namespace mu2e {
typedef std::vector<StepPointMCCollection> VspMC;

art::InputTag hitsInputTag_;
SimParticleTimeOffset toff_;

bool writeProperTime_;
VS tauHitCollections_;
Expand Down Expand Up @@ -189,7 +187,6 @@ namespace mu2e {
PrimaryProtonEnergyDumper::PrimaryProtonEnergyDumper(const fhicl::ParameterSet& pset)
: art::EDAnalyzer(pset)
, hitsInputTag_(pset.get<std::string>("hitsInputTag"))
, toff_(pset.get<fhicl::ParameterSet>("TimeOffsets"))
, writeProperTime_(pset.get<bool>("writeProperTime", false))
, tauHitCollections_( writeProperTime_ ? pset.get<VS>("tauHitCollections") : VS() )
, nt_(0)
Expand Down Expand Up @@ -261,7 +258,6 @@ namespace mu2e {

//================================================================
void PrimaryProtonEnergyDumper::analyze(const art::Event& event) {
toff_.updateMap(event);

VspMC spMCColls;
for ( const auto& iColl : tauHitCollections_ ){
Expand All @@ -279,7 +275,7 @@ namespace mu2e {

for(const auto& i : *ih) {

hit_ = VDHit(toff_, i);
hit_ = VDHit(i);
CLHEP::Hep3Vector hitLoc(hit_.x,hit_.y,hit_.z);

// std::cout << "hit x = " << hitLoc << std::endl;
Expand Down
6 changes: 1 addition & 5 deletions Analyses/src/ReadCaloDigi_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "Offline/GeometryService/inc/GeomHandle.hh"
#include "Offline/RecoDataProducts/inc/CaloHit.hh"
#include "Offline/SeedService/inc/SeedService.hh"
#include "Offline/Mu2eUtilities/inc/SimParticleTimeOffset.hh"

#include "Offline/RecoDataProducts/inc/CaloRecoDigi.hh"
#include "Offline/RecoDataProducts/inc/CaloCluster.hh"
Expand Down Expand Up @@ -136,7 +135,6 @@ namespace mu2e {
TrkParticle _tpart;
TrkFitDirection _fdir;

SimParticleTimeOffset _toff; // time offset smearing
double _mbtime;
double _mbbuffer;
double _blindTime;
Expand Down Expand Up @@ -235,7 +233,6 @@ namespace mu2e {
_trackModuleLabel (pset.get<string>("trackModuleLabel")),
_tpart ((TrkParticle::type)(pset.get<int>("fitparticle",TrkParticle::e_minus))),
_fdir((TrkFitDirection::FitDirection)(pset.get<int>("fitdirection",TrkFitDirection::downstream))),
_toff (pset.get<fhicl::ParameterSet>("TimeOffsets", fhicl::ParameterSet())),
_mbbuffer (pset.get<double> ("TimeFoldingBuffer")), // ns
_blindTime (pset.get<double> ("blindTime" )), // ns
_fillWaveforms (pset.get<int> ("fillWaveforms" )),
Expand Down Expand Up @@ -378,7 +375,6 @@ namespace mu2e {
//load the timeoffset
ConditionsHandle<AcceleratorParams> accPar("ignored");
_mbtime = accPar->deBuncherPeriod;
_toff.updateMap(event);

//data about hits in the calorimeter crystals
art::Handle<CaloHitMCCollection> caloDigiMCHandle;
Expand Down Expand Up @@ -534,7 +530,7 @@ namespace mu2e {
}
if ( !sim.fromGenerator() ) continue;

double hitTime = fmod(hit.time() + _toff.totalTimeOffset(simptr), _mbtime);
double hitTime = fmod(hit.time(), _mbtime);
if (hitTime < _mbbuffer) {
if (hitTime+_mbtime > _blindTime) {
hitTime = hitTime + _mbtime;
Expand Down
1 change: 0 additions & 1 deletion Analyses/src/ReadTrackCaloMatchingMVA_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "Offline/DataProducts/inc/VirtualDetectorId.hh"
#include "Offline/MCDataProducts/inc/CaloMCTruthAssns.hh"

#include "Offline/Mu2eUtilities/inc/SimParticleTimeOffset.hh"
#include "Offline/RecoDataProducts/inc/CaloHit.hh"

#include "BTrk/TrkBase/HelixParams.hh"
Expand Down
8 changes: 4 additions & 4 deletions Analyses/src/ReadVirtualDetector_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ namespace mu2e {
ntp.gtime = gtime_parent+sim.startProperTime(); // start time
if( sim_child ) {
CLHEP::Hep3Vector const & pos_start = sim_child->startPosition();
CLHEP::Hep3Vector const & mom_start = sim_child->startMomentum();
CLHEP::Hep3Vector const mom_start = sim_child->startMomentum();
ntp.x = pos_start.x();
ntp.y = pos_start.y();
ntp.z = pos_start.z();
Expand Down Expand Up @@ -833,7 +833,7 @@ namespace mu2e {
ntp.ystop = pos_end.y();
ntp.zstop = pos_end.z();
ntp.codestop = sim.stoppingCode();
CLHEP::Hep3Vector const & mom_end = sim.endMomentum();
CLHEP::Hep3Vector const mom_end = sim.endMomentum();
ntp.pxstop = mom_end.x();
ntp.pystop = mom_end.y();
ntp.pzstop = mom_end.z();
Expand Down Expand Up @@ -869,15 +869,15 @@ namespace mu2e {
ntp.parent_id = sim_parent->id().asInt();
ntp.parent_pdg = sim_parent->pdgId();
CLHEP::Hep3Vector const & pos_parent = sim_parent->startPosition();
CLHEP::Hep3Vector const & mom_parent = sim_parent->startMomentum();
CLHEP::Hep3Vector const mom_parent = sim_parent->startMomentum();
ntp.parent_x = pos_parent.x();
ntp.parent_y = pos_parent.y();
ntp.parent_z = pos_parent.z();
ntp.parent_px = mom_parent.x();
ntp.parent_py = mom_parent.y();
ntp.parent_pz = mom_parent.z();
ntp.parent_p = mom_parent.mag();
CLHEP::Hep3Vector const & endmom_parent = sim_parent->endMomentum();
CLHEP::Hep3Vector const endmom_parent = sim_parent->endMomentum();
ntp.parent_pxstop = endmom_parent.x();
ntp.parent_pystop = endmom_parent.y();
ntp.parent_pzstop = endmom_parent.z();
Expand Down
Loading

0 comments on commit 2c379aa

Please sign in to comment.