Public Member Functions | Private Attributes | List of all members
spacecharge::ShiftEdepSCE Class Reference
Inheritance diagram for spacecharge::ShiftEdepSCE:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

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
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 33 of file ShiftEdepSCE_module.cc.

Constructor & Destructor Documentation

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

Definition at line 59 of file ShiftEdepSCE_module.cc.

60  : EDProducer{p}
61  , fEDepTag(p.get<art::InputTag>("EDepTag"))
62  , fMakeAnaTree(p.get<bool>("MakeAnaTree", true))
63 {
64  produces<std::vector<sim::SimEnergyDeposit>>();
65 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
p
Definition: test.py:223
spacecharge::ShiftEdepSCE::ShiftEdepSCE ( ShiftEdepSCE const &  )
delete
spacecharge::ShiftEdepSCE::ShiftEdepSCE ( ShiftEdepSCE &&  )
delete

Member Function Documentation

void spacecharge::ShiftEdepSCE::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 68 of file ShiftEdepSCE_module.cc.

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

Implements art::EDProducer.

Definition at line 80 of file ShiftEdepSCE_module.cc.

81 {
82  auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
83  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e);
84 
85  auto const& inEdepVec = *e.getValidHandle<std::vector<sim::SimEnergyDeposit>>(fEDepTag);
86 
87  auto outEdepVecPtr = std::make_unique<std::vector<sim::SimEnergyDeposit>>();
88  auto& outEdepVec = *outEdepVecPtr;
89  outEdepVec.reserve(inEdepVec.size());
90 
91  geo::Vector_t posOffsetsStart{0.0, 0.0, 0.0};
92  geo::Vector_t posOffsetsEnd{0.0, 0.0, 0.0};
93  for (auto const& edep : inEdepVec) {
94  if (sce->EnableSimSpatialSCE()) {
95  posOffsetsStart = sce->GetPosOffsets({edep.StartX(), edep.StartY(), edep.StartZ()});
96  posOffsetsEnd = sce->GetPosOffsets({edep.EndX(), edep.EndY(), edep.EndZ()});
97  if (larsim::Utils::SCE::out_of_bounds(posOffsetsStart) ||
98  larsim::Utils::SCE::out_of_bounds(posOffsetsEnd) ) {
99  continue;
100  }
101  }
102  auto const isData = fISAlg.CalcIonAndScint(detProp, edep);
103  outEdepVec.emplace_back(
104  isData.numPhotons,
105  isData.numElectrons,
106  0.0,
107  edep.Energy(),
108  geo::Point_t{(float)(edep.StartX() - posOffsetsStart.X()), //x should be subtracted
109  (float)(edep.StartY() + posOffsetsStart.Y()),
110  (float)(edep.StartZ() + posOffsetsStart.Z())},
111  geo::Point_t{(float)(edep.EndX() - posOffsetsEnd.X()), //x should be subtracted
112  (float)(edep.EndY() + posOffsetsEnd.Y()),
113  (float)(edep.EndZ() + posOffsetsEnd.Z())},
114  edep.StartT(),
115  edep.EndT(),
116  edep.TrackID(),
117  edep.PdgCode());
118  if (fMakeAnaTree)
119  fNtEdepAna->Fill(edep.Energy(),
120  edep.X(),
121  edep.Y(),
122  edep.Z(),
123  edep.NumElectrons(),
124  edep.NumPhotons(),
125  outEdepVec.back().X(),
126  outEdepVec.back().Y(),
127  outEdepVec.back().Z(),
128  outEdepVec.back().NumElectrons(),
129  outEdepVec.back().NumPhotons());
130  }
131 
132  e.put(std::move(outEdepVecPtr));
133 }
bool out_of_bounds(geo::Vector_t const &offset)
ISCalcData CalcIonAndScint(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep) override
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
def move(depos, offset)
Definition: depos.py:107
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
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
larg4::ISCalcSeparate fISAlg

Member Data Documentation

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

Definition at line 51 of file ShiftEdepSCE_module.cc.

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

Definition at line 56 of file ShiftEdepSCE_module.cc.

bool spacecharge::ShiftEdepSCE::fMakeAnaTree
private

Definition at line 52 of file ShiftEdepSCE_module.cc.

TNtuple* spacecharge::ShiftEdepSCE::fNtEdepAna
private

Definition at line 53 of file ShiftEdepSCE_module.cc.


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