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

Public Member Functions

 ProtonHitsRemoval (fhicl::ParameterSet const &p)
 
 ProtonHitsRemoval (ProtonHitsRemoval const &)=delete
 
 ProtonHitsRemoval (ProtonHitsRemoval &&)=delete
 
ProtonHitsRemovaloperator= (ProtonHitsRemoval const &)=delete
 
ProtonHitsRemovaloperator= (ProtonHitsRemoval &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 
void endJob () override
 
void reset ()
 
bool PassBeamQualityCut () const
 
void TrueBeamInfo (const art::Event &evt, const simb::MCParticle *true_beam_particle)
 
- 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

TTree * fTree
 
geo::GeometryCore const * fGeom
 
double reco_beam_len_sce
 
int selected_track
 
protoana::ProtoDUNETrackUtils trackUtil
 
protoana::ProtoDUNEPFParticleUtils pfpUtil
 
protoana::ProtoDUNETruthUtils truthUtil
 
int run
 
int subrun
 
int event
 
const double beam_startZ_data = 3.75897e+00
 
const double beam_startZ_rms_data = 1.03771e+00
 
const double beam_startY_data = 4.23949e+02
 
const double beam_startY_rms_data = 4.61753e+00
 
const double beam_startX_data = -2.83979e+01
 
const double beam_startX_rms_data = 3.88357e+00
 
const double beam_angleX_data = 100.454
 
const double beam_angleY_data = 103.523
 
const double beam_angleZ_data = 17.8288
 
const double beam_startZ_mc = 4.98555e-02
 
const double beam_startZ_rms_mc = 2.06792e-01
 
const double beam_startY_mc = 4.22400e+02
 
const double beam_startY_rms_mc = 4.18191e+00
 
const double beam_startX_mc = -3.07693e+01
 
const double beam_startX_rms_mc = 4.75347e+00
 
const double beam_angleX_mc = 101.578
 
const double beam_angleY_mc = 101.189
 
const double beam_angleZ_mc = 16.5942
 
double reco_beam_calo_startX
 
double reco_beam_calo_startY
 
double reco_beam_calo_startZ
 
double reco_beam_calo_endX
 
double reco_beam_calo_endY
 
double reco_beam_calo_endZ
 
double beam_dx
 
double beam_dy
 
double beam_dz
 
double beam_dxy
 
double beam_costh
 
int true_beam_PDG
 
std::string true_beam_endProcess
 
double true_beam_len
 
double sel_len
 

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 65 of file ProtonHitsRemoval_module.cc.

Constructor & Destructor Documentation

pdsp::ProtonHitsRemoval::ProtonHitsRemoval ( fhicl::ParameterSet const &  p)
explicit

Definition at line 149 of file ProtonHitsRemoval_module.cc.

150  : EDProducer{p} // ,
151  // More initializers here.
152 {
153  cout<<"$$$ProtonHitsRemoval$$$"<<endl;
154  // Call appropriate produces<>() functions here.
157  produces<std::vector<recob::SpacePoint>>();
158  produces<art::Assns<recob::Hit, recob::SpacePoint>>(); // this space point will only be used as a tag
159  sel_len=p.get<double>("seglen");
160 
161  // Call appropriate consumes<>() for any products to be retrieved by this module.
162 }
geo::GeometryCore const * fGeom
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Definition: HitCreator.cxx:248
p
Definition: test.py:223
ProducesCollector & producesCollector() noexcept
QTextStream & endl(QTextStream &s)
pdsp::ProtonHitsRemoval::ProtonHitsRemoval ( ProtonHitsRemoval const &  )
delete
pdsp::ProtonHitsRemoval::ProtonHitsRemoval ( ProtonHitsRemoval &&  )
delete

Member Function Documentation

void pdsp::ProtonHitsRemoval::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 163 of file ProtonHitsRemoval_module.cc.

163  {
164  cout<<"$$$beginJob"<<endl;
166  fTree = tfs->make<TTree>("beamana","beam analysis tree");
167 
168  fTree->Branch("run",&run,"run/I");
169  fTree->Branch("subrun",&subrun,"subrun/I");
170  fTree->Branch("event",&event,"event/I");
171 
172  fTree->Branch("reco_beam_len_sce", &reco_beam_len_sce);
173  fTree->Branch("beam_dx", &beam_dx);
174  fTree->Branch("beam_dy", &beam_dy);
175  fTree->Branch("beam_dz", &beam_dz);
176  fTree->Branch("beam_dxy", &beam_dxy);
177  fTree->Branch("beam_costh", &beam_costh);
178  fTree->Branch("selected_track", &selected_track);
179  fTree->Branch("true_beam_PDG", &true_beam_PDG);
180  fTree->Branch("true_beam_endProcess", &true_beam_endProcess);
181  fTree->Branch("true_beam_len", &true_beam_len);
182  //fTree->Branch("true_beam_len_sce", &true_beam_len_sce);
183 }
QTextStream & endl(QTextStream &s)
Event finding and building.
void pdsp::ProtonHitsRemoval::endJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 424 of file ProtonHitsRemoval_module.cc.

424  {
425  cout<<"$$$endJob"<<endl;
426 }
QTextStream & endl(QTextStream &s)
ProtonHitsRemoval& pdsp::ProtonHitsRemoval::operator= ( ProtonHitsRemoval const &  )
delete
ProtonHitsRemoval& pdsp::ProtonHitsRemoval::operator= ( ProtonHitsRemoval &&  )
delete
bool pdsp::ProtonHitsRemoval::PassBeamQualityCut ( ) const

Definition at line 452 of file ProtonHitsRemoval_module.cc.

452  { // cut on beam entrance location and beam angle
453  if (beam_dxy<-1) return false;
454  if (beam_dxy>3) return false;
455 
456  if (beam_dz<-3) return false;
457  if (beam_dz>3) return false;
458 
459  if (beam_dy<-3) return false;
460  if (beam_dy>3) return false;
461 
462  if (beam_dx<-3) return false;
463  if (beam_dx>3) return false;
464 
465  if (beam_costh<0.96) return false;
466  if (beam_costh>2) return false;
467 
468  return true;
469 }
void pdsp::ProtonHitsRemoval::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 184 of file ProtonHitsRemoval_module.cc.

185 {
186  cout<<"#####EvtNo."<<evt.id().event()<<endl;
187  reset();
188  string fPFParticleTag = "pandora";
189  //string fCalorimetryTagSCE = "pandoracalo";
190  string fCalorimetryTagSCE = "pandoracalinoxyzt";
191  string fTrackerTag = "pandoraTrack";
192  string fGeneratorTag = "generator";
193  // Implementation of required member function here.
194  // Add code to select beam tracks using Pandora information
195 
196  recob::HitCollectionCreator hcol(evt, true, false);
197  std::unique_ptr<std::vector<recob::SpacePoint>> spvp(new std::vector<recob::SpacePoint>);
198  auto assns = std::make_unique<art::Assns<recob::Hit, recob::SpacePoint>>();
199 
200  //get run info
201  run = evt.run();
202  subrun = evt.subRun();
203  event = evt.id().event();
204  std::cout<<"run/subrun/evt:"<<run<<"/"<<subrun<<"/"<<event<<std::endl;
205 
206  if (!evt.isRealData()) {// MC
207  const simb::MCParticle* true_beam_particle = 0x0;
208  auto mcTruths = evt.getValidHandle<std::vector<simb::MCTruth>>(fGeneratorTag);
209  true_beam_particle = truthUtil.GetGeantGoodParticle((*mcTruths)[0],evt);
210  if( !true_beam_particle ){
211  cout << "No true beam particle" << endl;
212  }
213  else{
214  TrueBeamInfo(evt, true_beam_particle);
215  cout<<"true_beam_PDG="<<true_beam_PDG<<endl;
216  cout<<"true_beam_endProcess="<<true_beam_endProcess<<endl;
217  cout<<"true_beam_len="<<true_beam_len<<endl;
218  //cout<<"true_beam_len_sce="<<true_beam_len_sce<<endl;
219  }
220  }
221 
222  const std::map<unsigned int, std::vector<const recob::PFParticle*>> sliceMap
223  = pfpUtil.GetPFParticleSliceMap(evt, fPFParticleTag);
224  std::vector<std::vector<const recob::PFParticle*>> beam_slices;
225  for(auto slice : sliceMap){
226  for(auto particle : slice.second){
227  bool added = false;
228  if(pfpUtil.IsBeamParticle(*particle,evt, fPFParticleTag)){
229  if (!added) {
230  beam_slices.push_back(slice.second);
231  added = true;
232  }
233  }
234  if (!added) {continue;}
235  //else {
236  // std::cout << "Not beam particle" << std::endl;
237  //}
238  }
239  }
240  if (beam_slices.size() > 0){
241  const recob::PFParticle* particle = beam_slices.at(0).at(0);
242 
243  const recob::Track* thisTrack = pfpUtil.GetPFParticleTrack(*particle,evt,fPFParticleTag,fTrackerTag);
244  //Primary Track Calorimetry
245  if( thisTrack ){
246  auto calo = trackUtil.GetRecoTrackCalorimetry(*thisTrack, evt, fTrackerTag,
247  fCalorimetryTagSCE);
248  bool found_calo = false;
249  size_t index = 0;
250  for ( index = 0; index < calo.size(); ++index) {
251  if (calo[index].PlaneID().Plane == 2) {
252  found_calo = true;
253  break;
254  }
255  }
256  if (found_calo) {
257  reco_beam_len_sce = calo[index].Range();
258  auto theXYZPoints = calo[index].XYZ();
259  std::sort(theXYZPoints.begin(), theXYZPoints.end(), [](auto a, auto b)
260  {return (a.Z() < b.Z());}); // sort according to Z position
261  if (theXYZPoints.size()) {
262  reco_beam_calo_startX = theXYZPoints[0].X();
263  reco_beam_calo_startY = theXYZPoints[0].Y();
264  reco_beam_calo_startZ = theXYZPoints[0].Z();
265  reco_beam_calo_endX = theXYZPoints.back().X();
266  reco_beam_calo_endY = theXYZPoints.back().Y();
267  reco_beam_calo_endZ = theXYZPoints.back().Z();
268  }
269 
270  TVector3 beamdir;
271  if (evt.isRealData()) { // beam quality requirement (for data)
272  cout<<"@@@Is real data"<<endl;
276  beam_dxy = sqrt(pow(beam_dx,2) + pow(beam_dy,2));
277 
278  TVector3 beamdir_data(cos(beam_angleX_data*TMath::Pi()/180),
279  cos(beam_angleY_data*TMath::Pi()/180),
280  cos(beam_angleZ_data*TMath::Pi()/180));
281  beamdir = beamdir_data.Unit();
282 
283  }
284  else { // beam quality requirement (for MC)
285  cout<<"@@@Is MC"<<endl;
289  beam_dxy = sqrt(pow(beam_dx,2) + pow(beam_dy,2));
290 
291  TVector3 beamdir_mc(cos(beam_angleX_mc*TMath::Pi()/180),
292  cos(beam_angleY_mc*TMath::Pi()/180),
293  cos(beam_angleZ_mc*TMath::Pi()/180));
294  beamdir = beamdir_mc.Unit();
295  }
296 
297  TVector3 pt0(reco_beam_calo_startX,
300  TVector3 pt1(reco_beam_calo_endX,
303  TVector3 dir = pt1 - pt0;
304  dir = dir.Unit();
305  beam_costh = dir.Dot(beamdir);
306  std::cout<<"\n--> reco_beam_len_sce:"<<reco_beam_len_sce<<""<<std::endl;
307  std::cout<<"PassBeamQualityCut:"<<PassBeamQualityCut()<<std::endl;
308  std::cout<<"selected_track:"<<selected_track<<std::endl;
310  selected_track = 1;
311  //if (reco_beam_len_sce>230 && reco_beam_len_sce<500)
312  if (reco_beam_len_sce<140)
313  selected_track = 2;
314  }
315  std::cout<<"--> selected_track:"<<selected_track<<""<<std::endl;
316  }
317 
318  string fHitModuleLabel = "hitpdune";
319  //string fSpModuleLabel = "reco3d";
320 
321  //double sel_len = 10.; // shorten to how long (cm)
322  std::cout<<"truncated length="<<sel_len<<" [cm]"<<std::endl;
323 
324  if (selected_track == 2) { // selected long tracks (not smaller than 5 m)
325  auto hitsHandle = evt.getValidHandle< std::vector<recob::Hit> >(fHitModuleLabel);
326  //auto spHandle = evt.getValidHandle< std::vector<recob::SpacePoint> >(fSpModuleLabel);
327  art::FindOneP<recob::Wire> channelHitWires (hitsHandle, evt, fHitModuleLabel);
328  //art::FindManyP< recob::SpacePoint > spFromHit(hitsHandle, evt, fSpModuleLabel);
329  //recob::HitCollectionCreator hcol(evt, true, true);
330  std::vector< art::Ptr<recob::Hit> > eventHits;
331  art::fill_ptr_vector(eventHits, hitsHandle);
332  //std::unordered_map< size_t, geo::WireID > hitToWire;
333  //hitToWire.reserve(eventHits.size());
334 
335  const std::vector< art::Ptr< recob::Hit > > beamPFP_hits = pfpUtil.GetPFParticleHits_Ptrs( *particle, evt, fPFParticleTag );
336  auto calo_dQdX = calo[index].dQdx();
337  double reco_beam_len = thisTrack->Length();
338  cout<<"$$Length:"<<reco_beam_len<<endl;
339  size_t i = 0;
340  for (; thisTrack->Length(i) > reco_beam_len - sel_len; ++i ){
341  ;
342  }
343  TVector3 pos = thisTrack->LocationAtPoint<TVector3>(i);
344  cout<<"$$"<<"\tX"<<pos.X()<<"\tY"<<pos.Y()<<"\tZ"<<pos.Z()<<endl; // position of cut point
345 
346  auto TpIndices = calo[index].TpIndices();
347 
348  double wirecoord_U = fGeom->WireCoordinate(pos.Y(), pos.Z(), 0, 1, 0);
349  double wirecoord_V = fGeom->WireCoordinate(pos.Y(), pos.Z(), 1, 1, 0);
350  double wirecoord_X = fGeom->WireCoordinate(pos.Y(), pos.Z(), 2, 1, 0);
351  cout<<"$$$WireCoord: U "<<wirecoord_U<<"\tV "<<wirecoord_V<<"\tX "<<wirecoord_X<<endl; // Wire ID of cut point
352 
353  std::vector< art::Ptr< recob::Hit > > remove_hits;
354  std::vector< art::Ptr< recob::Hit > > tag_hits;
356  std::vector< recob::SpacePoint > spv;
358  spv.push_back(sp);
359  spvp->insert(spvp->end(), spv.begin(), spv.end());
360  for (size_t kk = 0; kk < beamPFP_hits.size(); ++kk){
361  auto hit = beamPFP_hits[kk];
362 
363  geo::WireID hitid = hit->WireID();
364  //std::vector<geo::WireID> cwids = fGeom->ChannelToWire(hit->Channel());
365  //cout<<"@@@"<<hitid.Plane<<"\t"<<hitid.Wire<<"\t"<<hitid.TPC<<"\t"<<hitid.Cryostat<<endl;
366 
367  if (hitid.TPC == 1 && hitid.Cryostat == 0) {
368  if (hitid.Plane == 0) { // plane U
369  if (hitid.Wire > wirecoord_U) {
370  remove_hits.push_back(hit);
371  }
372  else {
373  tag_hits.push_back(hit);
374  }
375  }
376  else if (hitid.Plane == 1) { // plane V
377  if (hitid.Wire < wirecoord_V) {
378  remove_hits.push_back(hit);
379  }
380  else {
381  tag_hits.push_back(hit);
382  }
383  }
384  else if (hitid.Plane == 2) { // plane X
385  if (hitid.Wire > wirecoord_X) {
386  remove_hits.push_back(hit);
387  }
388  else {
389  tag_hits.push_back(hit);
390  }
391  }
392  }
393  }
394 
395  auto const hitPtrMaker = art::PtrMaker<recob::Hit>(evt);
396  // fill hits
397  for (size_t kk = 0; kk < eventHits.size(); ++kk){
398  auto hit = eventHits[kk];
399  vector<art::Ptr<recob::Hit>>::iterator itr;
400  itr = find(remove_hits.begin(), remove_hits.end(), hit);
401  if (itr == remove_hits.end()) { // not be to removed
402  hcol.emplace_back(std::move(*hit), channelHitWires.at(kk));
403 
404  vector<art::Ptr<recob::Hit>>::iterator itr_tag;
405  itr_tag = find(tag_hits.begin(), tag_hits.end(), hit);
406  if (itr_tag != tag_hits.end()) { // to be tagged (associated)
407  auto hitPtr = hitPtrMaker(hcol.size() - 1);
408  util::CreateAssn(evt, *spvp, hitPtr, *assns, 0);
409  }
410  }
411  }
412 
413  cout<<"$$$reco_beam_len_sce "<<reco_beam_len_sce<<endl;
414  }
415  }
416  }
417 
418 
419  hcol.put_into(evt);
420  evt.put(std::move(spvp));
421  evt.put(std::move(assns));
422  fTree->Fill();
423 }
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
bool IsBeamParticle(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
Use the pandora metadata to tell us if this is a beam particle or not.
unsigned int event
Definition: DataStructs.h:636
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
void TrueBeamInfo(const art::Event &evt, const simb::MCParticle *true_beam_particle)
unsigned int run
Definition: DataStructs.h:637
std::vector< anab::Calorimetry > GetRecoTrackCalorimetry(const recob::Track &track, art::Event const &evt, const std::string trackModule, const std::string caloModule) const
Get the Calorimetry(s) from a given reco track.
geo::GeometryCore const * fGeom
Point_t const & LocationAtPoint(size_t i) const
Definition: Track.h:126
constexpr T pow(T x)
Definition: pow.h:72
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
string dir
protoana::ProtoDUNETruthUtils truthUtil
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
protoana::ProtoDUNETrackUtils trackUtil
A class handling a collection of hits and its associations.
Definition: HitCreator.h:508
protoana::ProtoDUNEPFParticleUtils pfpUtil
const double a
def move(depos, offset)
Definition: depos.py:107
const recob::Track * GetPFParticleTrack(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel, const std::string trackLabel) const
Get the track associated to this particle. Returns a null pointer if not found.
const std::map< unsigned int, std::vector< const recob::PFParticle * > > GetPFParticleSliceMap(art::Event const &evt, const std::string particleLabel) const
Get a map of slice index to the primary PFParticles within it.
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
Detector simulation of raw signals on wires.
Hierarchical representation of particle flow.
Definition: PFParticle.h:44
const std::vector< art::Ptr< recob::Hit > > GetPFParticleHits_Ptrs(const recob::PFParticle &particle, art::Event const &evt, const std::string particleLabel) const
static bool * b
Definition: config.cpp:1043
unsigned int subRun
Definition: DataStructs.h:638
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Definition: Track.h:49
calorimetry
QTextStream & endl(QTextStream &s)
void pdsp::ProtonHitsRemoval::reset ( )

Definition at line 427 of file ProtonHitsRemoval_module.cc.

427  {
428  cout<<"$$$reset"<<endl;
429  run = -1;
430  subrun =-1;
431  event =-1;
432 
433  reco_beam_len_sce = -999;
434  beam_dx = -999;
435  beam_dy = -999;
436  beam_dz = -999;
437  beam_dxy = -999;
438  beam_costh = -999;
439  reco_beam_calo_startX = -999;
440  reco_beam_calo_startY = -999;
441  reco_beam_calo_startZ = -999;
442  reco_beam_calo_endX = -999;
443  reco_beam_calo_endY = -999;
444  reco_beam_calo_endZ = -999;
445  selected_track = 0;
446 
447  true_beam_PDG = -999;
449  true_beam_len = -999.;
450  //true_beam_len_sce = -999.;
451 }
QTextStream & endl(QTextStream &s)
void pdsp::ProtonHitsRemoval::TrueBeamInfo ( const art::Event evt,
const simb::MCParticle true_beam_particle 
)

Definition at line 470 of file ProtonHitsRemoval_module.cc.

471 {
472  true_beam_PDG = true_beam_particle->PdgCode();
473  true_beam_endProcess = true_beam_particle->EndProcess();
474  const simb::MCTrajectory & true_beam_trajectory = true_beam_particle->Trajectory();
475  //auto sce = lar::providerFrom<spacecharge::SpaceChargeService>();
476 
477  vector<double> true_beam_traj_X;
478  vector<double> true_beam_traj_Y;
479  vector<double> true_beam_traj_Z;
480  vector<double> true_beam_traj_X_SCE;
481  vector<double> true_beam_traj_Y_SCE;
482  vector<double> true_beam_traj_Z_SCE;
483  for (size_t i = 0; i < true_beam_trajectory.size(); ++i) {
484  double trajX = true_beam_trajectory.X(i);
485  double trajY = true_beam_trajectory.Y(i);
486  double trajZ = true_beam_trajectory.Z(i);
487  true_beam_traj_X.push_back(trajX);
488  true_beam_traj_Y.push_back(trajY);
489  true_beam_traj_Z.push_back(trajZ);
490  /*auto offset = sce->GetPosOffsets( {trajX, trajY, trajZ} );
491  cout<<"@@@ "<<i<<endl;
492  true_beam_traj_X_SCE.push_back(trajX - offset.X());
493  true_beam_traj_Y_SCE.push_back(trajY + offset.Y());
494  true_beam_traj_Z_SCE.push_back(trajZ + offset.Z());*/
495  }
496  true_beam_len = 0;
497  //true_beam_len_sce = 0;
498  for (size_t i = 1; i < true_beam_trajectory.size(); ++i) {
499  true_beam_len += sqrt( pow( true_beam_traj_X.at(i)-true_beam_traj_X.at(i-1), 2)
500  + pow( true_beam_traj_Y.at(i)-true_beam_traj_Y.at(i-1), 2)
501  + pow( true_beam_traj_Z.at(i)-true_beam_traj_Z.at(i-1), 2));
502  /*true_beam_len_sce += sqrt( pow( true_beam_traj_X_SCE.at(i)-true_beam_traj_X_SCE.at(i-1), 2)
503  + pow( true_beam_traj_Y_SCE.at(i)-true_beam_traj_Y_SCE.at(i-1), 2)
504  + pow( true_beam_traj_Z_SCE.at(i)-true_beam_traj_Z_SCE.at(i-1), 2));*/
505  }
506 }
double Z(const size_type i) const
Definition: MCTrajectory.h:151
double X(const size_type i) const
Definition: MCTrajectory.h:149
int PdgCode() const
Definition: MCParticle.h:212
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
constexpr T pow(T x)
Definition: pow.h:72
double Y(const size_type i) const
Definition: MCTrajectory.h:150
std::string EndProcess() const
Definition: MCParticle.h:216
size_type size() const
Definition: MCTrajectory.h:166

Member Data Documentation

const double pdsp::ProtonHitsRemoval::beam_angleX_data = 100.454
private

Definition at line 107 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_angleX_mc = 101.578
private

Definition at line 129 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_angleY_data = 103.523
private

Definition at line 108 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_angleY_mc = 101.189
private

Definition at line 130 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_angleZ_data = 17.8288
private

Definition at line 109 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_angleZ_mc = 16.5942
private

Definition at line 131 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::beam_costh
private

Definition at line 136 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::beam_dx
private

Definition at line 136 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::beam_dxy
private

Definition at line 136 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::beam_dy
private

Definition at line 136 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::beam_dz
private

Definition at line 136 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startX_data = -2.83979e+01
private

Definition at line 104 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startX_mc = -3.07693e+01
private

Definition at line 126 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startX_rms_data = 3.88357e+00
private

Definition at line 105 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startX_rms_mc = 4.75347e+00
private

Definition at line 127 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startY_data = 4.23949e+02
private

Definition at line 102 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startY_mc = 4.22400e+02
private

Definition at line 124 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startY_rms_data = 4.61753e+00
private

Definition at line 103 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startY_rms_mc = 4.18191e+00
private

Definition at line 125 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startZ_data = 3.75897e+00
private

Definition at line 100 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startZ_mc = 4.98555e-02
private

Definition at line 122 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startZ_rms_data = 1.03771e+00
private

Definition at line 101 of file ProtonHitsRemoval_module.cc.

const double pdsp::ProtonHitsRemoval::beam_startZ_rms_mc = 2.06792e-01
private

Definition at line 123 of file ProtonHitsRemoval_module.cc.

int pdsp::ProtonHitsRemoval::event
private

Definition at line 96 of file ProtonHitsRemoval_module.cc.

geo::GeometryCore const* pdsp::ProtonHitsRemoval::fGeom
private

Definition at line 86 of file ProtonHitsRemoval_module.cc.

TTree* pdsp::ProtonHitsRemoval::fTree
private

Definition at line 85 of file ProtonHitsRemoval_module.cc.

protoana::ProtoDUNEPFParticleUtils pdsp::ProtonHitsRemoval::pfpUtil
private

Definition at line 90 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_endX
private

Definition at line 135 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_endY
private

Definition at line 135 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_endZ
private

Definition at line 135 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_startX
private

Definition at line 134 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_startY
private

Definition at line 134 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_calo_startZ
private

Definition at line 134 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::reco_beam_len_sce
private

Definition at line 87 of file ProtonHitsRemoval_module.cc.

int pdsp::ProtonHitsRemoval::run
private

Definition at line 94 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::sel_len
private

Definition at line 144 of file ProtonHitsRemoval_module.cc.

int pdsp::ProtonHitsRemoval::selected_track
private

Definition at line 88 of file ProtonHitsRemoval_module.cc.

int pdsp::ProtonHitsRemoval::subrun
private

Definition at line 95 of file ProtonHitsRemoval_module.cc.

protoana::ProtoDUNETrackUtils pdsp::ProtonHitsRemoval::trackUtil
private

Definition at line 89 of file ProtonHitsRemoval_module.cc.

std::string pdsp::ProtonHitsRemoval::true_beam_endProcess
private

Definition at line 139 of file ProtonHitsRemoval_module.cc.

double pdsp::ProtonHitsRemoval::true_beam_len
private

Definition at line 140 of file ProtonHitsRemoval_module.cc.

int pdsp::ProtonHitsRemoval::true_beam_PDG
private

Definition at line 138 of file ProtonHitsRemoval_module.cc.

protoana::ProtoDUNETruthUtils pdsp::ProtonHitsRemoval::truthUtil
private

Definition at line 91 of file ProtonHitsRemoval_module.cc.


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