LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ShiftEdepSCE_module.cc
Go to the documentation of this file.
1 // Class: ShiftEdepSCE
3 // Plugin Type: producer (art v2_05_01)
4 // File: ShiftEdepSCE_module.cc
5 //
6 // Generated at Thu Apr 19 00:41:18 2018 by Wesley Ketchum using cetskelgen
7 // from cetlib version v1_21_00.
9 
17 #include "fhiclcpp/ParameterSet.h"
20 
21 #include <memory>
22 
29 #include "TNtuple.h"
30 
31 namespace spacecharge {
32  class ShiftEdepSCE;
33 }
34 
35 
37 public:
38  explicit ShiftEdepSCE(fhicl::ParameterSet const & p);
39  // The compiler-generated destructor is fine for non-base
40  // classes without bare pointers or other resource use.
41 
42  // Plugins should not be copied or assigned.
43  ShiftEdepSCE(ShiftEdepSCE const &) = delete;
44  ShiftEdepSCE(ShiftEdepSCE &&) = delete;
45  ShiftEdepSCE & operator = (ShiftEdepSCE const &) = delete;
46  ShiftEdepSCE & operator = (ShiftEdepSCE &&) = delete;
47 
48  // Required functions.
49  void produce(art::Event & e) override;
50  void beginJob() override;
51 
52 private:
53 
54  // Declare member data here.
57  TNtuple* fNtEdepAna;
58 
59  //IS calculationg
61 };
62 
63 
65  : fEDepTag(p.get<art::InputTag>("EDepTag")),
66  fMakeAnaTree(p.get<bool>("MakeAnaTree",true))
67 {
68  produces< std::vector<sim::SimEnergyDeposit> >();
69 }
70 
72 {
73  if(fMakeAnaTree){
75  fNtEdepAna = tfs->make<TNtuple>("nt_edep_ana","Edep PosDiff Ana Ntuple","energy:orig_x:orig_y:orig_z:orig_el:orig_ph:shift_x:shift_y:shift_z:shift_el:shift_ph");
76  }
77 
79  fISAlg.Initialize(lar::providerFrom<detinfo::LArPropertiesService>(),
80  lar::providerFrom<detinfo::DetectorPropertiesService>(),
81  &(*lg4paramHandle),
82  lar::providerFrom<spacecharge::SpaceChargeService>());
83 
84 }
85 
87 {
88  auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
89 
90  std::unique_ptr< std::vector<sim::SimEnergyDeposit> >
91  outEdepVecPtr(new std::vector<sim::SimEnergyDeposit>() );
92  auto & outEdepVec(*outEdepVecPtr);
93 
95  e.getByLabel(fEDepTag,inEdepHandle);
96  auto const& inEdepVec(*inEdepHandle);
97 
98  outEdepVec.reserve(inEdepVec.size());
99 
100  geo::Vector_t posOffsetsStart{0.0,0.0,0.0};
101  geo::Vector_t posOffsetsEnd{0.0,0.0,0.0};
102  for(auto const& edep : inEdepVec){
103  if(sce->EnableSimSpatialSCE()){
104  posOffsetsStart = sce->GetPosOffsets({edep.StartX(),edep.StartY(),edep.StartZ()});
105  posOffsetsEnd = sce->GetPosOffsets({edep.EndX(),edep.EndY(),edep.EndZ()});
106  }
107  fISAlg.Reset();
109  outEdepVec.emplace_back(fISAlg.NumberScintillationPhotons(),
111  edep.Energy(),
112  sim::SimEnergyDeposit::Point_t{(float)(edep.StartX()+posOffsetsStart.X()),
113  (float)(edep.StartY()+posOffsetsStart.Y()),
114  (float)(edep.StartZ()+posOffsetsStart.Z())},
115  sim::SimEnergyDeposit::Point_t{(float)(edep.EndX()+posOffsetsEnd.X()),
116  (float)(edep.EndY()+posOffsetsEnd.Y()),
117  (float)(edep.EndZ()+posOffsetsEnd.Z())},
118  edep.StartT(),
119  edep.EndT(),
120  edep.TrackID(),
121  edep.PdgCode());
122  if(fMakeAnaTree)
123  fNtEdepAna->Fill(edep.Energy(),
124  edep.X(),edep.Y(),edep.Z(),edep.NumElectrons(),edep.NumPhotons(),
125  outEdepVec.back().X(),outEdepVec.back().Y(),outEdepVec.back().Z(),
126  outEdepVec.back().NumElectrons(),outEdepVec.back().NumPhotons());
127  }
128 
129  e.put(std::move(outEdepVecPtr));
130 }
131 
Store parameters for running LArG4.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:167
void produce(art::Event &e) override
ShiftEdepSCE(fhicl::ParameterSet const &p)
ShiftEdepSCE & operator=(ShiftEdepSCE const &)=delete
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< Length_t > > Point_t
void CalculateIonizationAndScintillation(sim::SimEnergyDeposit const &edep)
Double_t edep
Definition: macro.C:13
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
larg4::ISCalculationSeparate fISAlg
contains information for a single step in the detector simulation
HLT enums.
Float_t e
Definition: plot.C:34
void Initialize(const detinfo::LArProperties *larp, const detinfo::DetectorProperties *detp, const sim::LArG4Parameters *lgp, const spacecharge::SpaceCharge *sce)