InfoTransfer.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // $Id: InfoTransfer.h,v 1.15 2010/08/30 21:33:24 andrzejs Exp $
3 //
4 // Transfer hitlist and run info into a producer module.
5 // Do not copy this code without contacting Andrzej Szelc and Brian Rebel first.
6 //
7 // \author andrzej.szelc@yale.edu
8 // \author ellen.klein@yale.edu
9 ////////////////////////////////////////////////////////////////////////
10 #ifndef INFOTRANSFER_H
11 #define INFOTRANSFER_H
12 #ifndef __CINT__
13 #include <string>
14 #include <vector>
15 #include <iostream>
16 
17 #include "fhiclcpp/ParameterSet.h"
22 
25 
26 
27  namespace util {
28  class PxPoint;
29  class PxLine;
30  }
31 
32 
33 namespace evd {
35  {
36  public:
38  ~InfoTransfer();
39 
40 
41  // The Rebuild function rebuilds the various maps we need to pickup hits.
42  // It is called automatically before each event is processed. For jobs involving
43  // Monte Carlo generation, this is too soon. So, we'll call rebuild after those data
44  // products are put into the event in LArG4. This is the least bad way of ensuring the
45  // InfoTransfer works in jobs that combine MC production and reconstruction analysis based
46  // on MC truth. Don't copy this design pattern without talking to brebel@fnal.gov first
47  void Rebuild(const art::Event& evt);
48 
49 
50  void reconfigure(fhicl::ParameterSet const& pset);
51  void SetTestFlag(int value){ testflag = value; };
52  int GetTestFlag(){return testflag; };
53  void SetRunNumber(int value){ fRun = value; };
54  int GetRunNumber(){return fRun; };
55  void SetSubRunNumber(int value){ fSubRun = value; };
56  int GetSubRunNumber(){return fSubRun; };
57  void SetEvtNumber(int value){ fEvt = value; };
58  int GetEvtNumber(){return fEvt; };
59 
60 
61  void SetHitList(unsigned int p,std::vector<art::Ptr < recob::Hit> > hits_to_save)
62  { fSelectedHitlist[p].clear(); fSelectedHitlist[p]=hits_to_save; };
63 
64  std::vector < art::Ptr < recob::Hit> > GetHitList(unsigned int plane)
65  { return fRefinedHitlist[plane]; };
66 
67  std::vector< art::Ptr < recob::Hit> > GetSelectedHitList(unsigned int plane)
68  { return fSelectedHitlist[plane]; };
69 
70  void ClearSelectedHitList(int plane)
71  {
72  if (fSelectedHitlist.size()==0) {return; std::cout<<"no size"<<std::endl;}
73  fSelectedHitlist[plane].clear();
74  for(unsigned int i=0; i<fRefStartHit.size(); i++){
75  fRefStartHit[i]=NULL;
76  fRefEndHit[i]=NULL;
77  }
78  return;
79  }
80 
81  void SetStartHit(unsigned int p, recob::Hit * starthit)
82  { fStartHit[p]=starthit; };
83 
84  recob::Hit * GetStartHit(unsigned int plane)
85  {return fRefStartHit[plane];};
86 
87  void SetEndHit(unsigned int p, recob::Hit * endhit)
88  { fEndHit[p]=endhit; };
89 
90  recob::Hit * GetEndHit(unsigned int plane)
91  { return fRefEndHit[plane]; };
92 
93  std::vector< double > GetStartHitCoords(unsigned int plane)
94  { return refstarthitout[plane]; };
95  std::vector< double > GetEndHitCoords(unsigned int plane)
96  { return refendhitout[plane]; };
97 
98  void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
99  { starthitout[plane].clear();
100  starthitout[plane].resize(2);
101  starthitout[plane]=starthitin; };
102  void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
103  { endhitout[plane].clear();
104  endhitout[plane].resize(2);
105  endhitout[plane]=endhitin; };
106 
107 
108  void SetSeedList(std::vector < util::PxLine > seedlines);
109 
110 
111  std::vector < util::PxLine > GetSeedList();
112 
113 
114 
115  private:
116 
117  void FillStartEndHitCoords(unsigned int plane);
118 
119  int testflag;
120  int fEvt;
121  int fRun;
122  int fSubRun;
123  std::vector < std::vector< art::Ptr < recob::Hit > > > fSelectedHitlist; ///< the list selected by the GUI (one for each plane)
124  std::vector < std::vector< art::Ptr < recob::Hit > > > fRefinedHitlist; ///< the refined hitlist after rebuild (one for each plane)
125  std::vector< art::Ptr < recob::Hit > > fFullHitlist; ///< the full Hit list from the Hitfinder.
126  std::string fHitModuleLabel; ///< label for geant4 module
127 
128  std::vector < recob::Hit * > fStartHit; ///< The Starthit
129  std::vector < recob::Hit * > fRefStartHit; ///< The Refined Starthit
130 
131  std::vector < recob::Hit * > fEndHit; ///< The Starthit
132  std::vector < recob::Hit * > fRefEndHit; ///< The Refined Starthit
133 
134  std::vector < util::PxLine > fSeedList;
135 
136  std::vector < std::vector <double > > starthitout;
137  std::vector < std::vector <double > > endhitout;
138 
139  std::vector < std::vector <double > > refstarthitout;
140  std::vector < std::vector <double > > refendhitout;
141 
142  };
143 }//namespace
144 #endif // __CINT__
146 #endif
147 
void SetTestFlag(int value)
Definition: InfoTransfer.h:51
std::vector< std::vector< art::Ptr< recob::Hit > > > fRefinedHitlist
the refined hitlist after rebuild (one for each plane)
Definition: InfoTransfer.h:124
std::vector< std::vector< double > > refendhitout
Definition: InfoTransfer.h:140
std::vector< double > GetStartHitCoords(unsigned int plane)
Definition: InfoTransfer.h:93
Namespace for general, non-LArSoft-specific utilities.
void SetStartHit(unsigned int p, recob::Hit *starthit)
Definition: InfoTransfer.h:81
void SetEndHit(unsigned int p, recob::Hit *endhit)
Definition: InfoTransfer.h:87
void ClearSelectedHitList(int plane)
Definition: InfoTransfer.h:70
std::string string
Definition: nybbler.cc:12
std::vector< art::Ptr< recob::Hit > > fFullHitlist
the full Hit list from the Hitfinder.
Definition: InfoTransfer.h:125
struct vector vector
recob::Hit * GetStartHit(unsigned int plane)
Definition: InfoTransfer.h:84
void SetStartHitCoords(unsigned int plane, std::vector< double > starthitin)
Definition: InfoTransfer.h:98
std::vector< recob::Hit * > fStartHit
The Starthit.
Definition: InfoTransfer.h:128
std::vector< recob::Hit * > fRefStartHit
The Refined Starthit.
Definition: InfoTransfer.h:129
void SetRunNumber(int value)
Definition: InfoTransfer.h:53
LArSoft includes.
Definition: InfoTransfer.h:33
void SetSubRunNumber(int value)
Definition: InfoTransfer.h:55
virtual void reconfigure(fhicl::ParameterSet const &pset)
#define DECLARE_ART_SERVICE(svc, scope)
std::vector< double > GetEndHitCoords(unsigned int plane)
Definition: InfoTransfer.h:95
void SetHitList(unsigned int p, std::vector< art::Ptr< recob::Hit > > hits_to_save)
Definition: InfoTransfer.h:61
std::vector< recob::Hit * > fRefEndHit
The Refined Starthit.
Definition: InfoTransfer.h:132
recob::Hit * GetEndHit(unsigned int plane)
Definition: InfoTransfer.h:90
std::vector< recob::Hit * > fEndHit
The Starthit.
Definition: InfoTransfer.h:131
p
Definition: test.py:223
std::vector< std::vector< double > > starthitout
Definition: InfoTransfer.h:136
std::string fHitModuleLabel
label for geant4 module
Definition: InfoTransfer.h:126
std::vector< std::vector< double > > endhitout
Definition: InfoTransfer.h:137
void SetEvtNumber(int value)
Definition: InfoTransfer.h:57
std::vector< std::vector< art::Ptr< recob::Hit > > > fSelectedHitlist
the list selected by the GUI (one for each plane)
Definition: InfoTransfer.h:123
std::vector< art::Ptr< recob::Hit > > GetSelectedHitList(unsigned int plane)
Definition: InfoTransfer.h:67
void SetEndHitCoords(unsigned int plane, std::vector< double > endhitin)
Definition: InfoTransfer.h:102
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
TCEvent evt
Definition: DataStructs.cxx:7
std::vector< std::vector< double > > refstarthitout
Definition: InfoTransfer.h:139
QTextStream & endl(QTextStream &s)
std::vector< util::PxLine > fSeedList
Definition: InfoTransfer.h:134
std::vector< art::Ptr< recob::Hit > > GetHitList(unsigned int plane)
Definition: InfoTransfer.h:64