All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
spacecharge::ShiftEdepSCE Class Reference
Inheritance diagram for spacecharge::ShiftEdepSCE:

Public Member Functions

 ShiftEdepSCE (fhicl::ParameterSet const &p)
 
 ShiftEdepSCE (ShiftEdepSCE const &)=delete
 
 ShiftEdepSCE (ShiftEdepSCE &&)=delete
 
ShiftEdepSCEoperator= (ShiftEdepSCE const &)=delete
 
ShiftEdepSCEoperator= (ShiftEdepSCE &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 

Private Attributes

art::InputTag fEDepTag
 
bool fMakeAnaTree
 
TNtuple * fNtEdepAna
 
larg4::ISCalcSeparate fISAlg
 

Detailed Description

Definition at line 35 of file ShiftEdepSCE_module.cc.

Constructor & Destructor Documentation

spacecharge::ShiftEdepSCE::ShiftEdepSCE ( fhicl::ParameterSet const &  p)
explicit

Definition at line 61 of file ShiftEdepSCE_module.cc.

62  : EDProducer{p}
63  , fEDepTag(p.get<art::InputTag>("EDepTag"))
64  , fMakeAnaTree(p.get<bool>("MakeAnaTree", true))
65 {
66  produces<std::vector<sim::SimEnergyDeposit>>();
67 }
pdgs p
Definition: selectors.fcl:22
spacecharge::ShiftEdepSCE::ShiftEdepSCE ( ShiftEdepSCE const &  )
delete
spacecharge::ShiftEdepSCE::ShiftEdepSCE ( ShiftEdepSCE &&  )
delete

Member Function Documentation

void spacecharge::ShiftEdepSCE::beginJob ( )
override

Definition at line 70 of file ShiftEdepSCE_module.cc.

71 {
72  if (fMakeAnaTree) {
73  art::ServiceHandle<art::TFileService const> tfs;
74  fNtEdepAna = tfs->make<TNtuple>(
75  "nt_edep_ana",
76  "Edep PosDiff Ana Ntuple",
77  "energy:orig_x:orig_y:orig_z:orig_el:orig_ph:shift_x:shift_y:shift_z:shift_el:shift_ph");
78  }
79 }
art::ServiceHandle< art::TFileService > tfs
ShiftEdepSCE& spacecharge::ShiftEdepSCE::operator= ( ShiftEdepSCE const &  )
delete
ShiftEdepSCE& spacecharge::ShiftEdepSCE::operator= ( ShiftEdepSCE &&  )
delete
void spacecharge::ShiftEdepSCE::produce ( art::Event &  e)
override

Definition at line 82 of file ShiftEdepSCE_module.cc.

83 {
84  auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
85  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
86 
87  auto const& inEdepVec = *e.getValidHandle<std::vector<sim::SimEnergyDeposit>>(fEDepTag);
88 
89  auto outEdepVecPtr = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
90  auto& outEdepVec = *outEdepVecPtr;
91  outEdepVec.reserve(inEdepVec.size());
92 
93  geo::Vector_t posOffsetsStart{0.0, 0.0, 0.0};
94  geo::Vector_t posOffsetsEnd{0.0, 0.0, 0.0};
95  for (auto const& edep : inEdepVec) {
96  if (sce->EnableSimSpatialSCE()) {
97  posOffsetsStart = sce->GetPosOffsets({edep.StartX(), edep.StartY(), edep.StartZ()});
98  posOffsetsEnd = sce->GetPosOffsets({edep.EndX(), edep.EndY(), edep.EndZ()});
99  if (larsim::Utils::SCE::out_of_bounds(posOffsetsStart) ||
100  larsim::Utils::SCE::out_of_bounds(posOffsetsEnd) ) {
101  continue;
102  }
103  }
104  auto const isData = fISAlg.CalcIonAndScint(detProp, edep);
105  outEdepVec.emplace_back(
106  isData.numPhotons,
107  isData.numElectrons,
108  0.0,
109  edep.Energy(),
110  geo::Point_t{(float)(edep.StartX() - posOffsetsStart.X()), //x should be subtracted
111  (float)(edep.StartY() + posOffsetsStart.Y()),
112  (float)(edep.StartZ() + posOffsetsStart.Z())},
113  geo::Point_t{(float)(edep.EndX() - posOffsetsEnd.X()), //x should be subtracted
114  (float)(edep.EndY() + posOffsetsEnd.Y()),
115  (float)(edep.EndZ() + posOffsetsEnd.Z())},
116  edep.StartT(),
117  edep.EndT(),
118  edep.TrackID(),
119  edep.PdgCode());
120  if (fMakeAnaTree)
121  fNtEdepAna->Fill(edep.Energy(),
122  edep.X(),
123  edep.Y(),
124  edep.Z(),
125  edep.NumElectrons(),
126  edep.NumPhotons(),
127  outEdepVec.back().X(),
128  outEdepVec.back().Y(),
129  outEdepVec.back().Z(),
130  outEdepVec.back().NumElectrons(),
131  outEdepVec.back().NumPhotons());
132  }
133 
134  e.put(std::move(outEdepVecPtr));
135 }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
bool out_of_bounds(geo::Vector_t const &offset)
ISCalcData CalcIonAndScint(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep) override
larg4::ISCalcSeparate fISAlg
do i e
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
auto const detProp

Member Data Documentation

art::InputTag spacecharge::ShiftEdepSCE::fEDepTag
private

Definition at line 53 of file ShiftEdepSCE_module.cc.

larg4::ISCalcSeparate spacecharge::ShiftEdepSCE::fISAlg
private

Definition at line 58 of file ShiftEdepSCE_module.cc.

bool spacecharge::ShiftEdepSCE::fMakeAnaTree
private

Definition at line 54 of file ShiftEdepSCE_module.cc.

TNtuple* spacecharge::ShiftEdepSCE::fNtEdepAna
private

Definition at line 55 of file ShiftEdepSCE_module.cc.


The documentation for this class was generated from the following file: