All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
hit::HitFinderAna Class Reference

Base class for creation of raw signals on wires. More...

Inheritance diagram for hit::HitFinderAna:

Public Member Functions

 HitFinderAna (fhicl::ParameterSet const &pset)
 

Private Member Functions

void analyze (const art::Event &evt)
 read/write access to event More...
 
void beginJob ()
 

Private Attributes

std::string fFFTHitFinderModuleLabel
 
std::string fLArG4ModuleLabel
 
TTree * fHTree
 
Int_t fRun
 
Int_t fEvt
 
Int_t fNp0
 
Int_t fNp1
 
Int_t fNp2
 
Int_t fN3p0
 
Int_t fN3p1
 
Int_t fN3p2
 
Float_t * fTimep0
 
Float_t * fTimep1
 
Float_t * fTimep2
 
Int_t * fWirep0
 
Int_t * fWirep1
 
Int_t * fWirep2
 
Float_t * fChgp0
 
Float_t * fChgp1
 
Float_t * fChgp2
 
Float_t * fXYZp0
 
Float_t * fXYZp1
 
Float_t * fXYZp2
 
Int_t * fMCPdg0
 
Int_t * fMCTId0
 
Float_t * fMCE0
 
Int_t * fMCPdg1
 
Int_t * fMCTId1
 
Float_t * fMCE1
 
Int_t * fMCPdg2
 
Int_t * fMCTId2
 
Float_t * fMCE2
 

Detailed Description

Base class for creation of raw signals on wires.

Definition at line 48 of file HitFinderAna_module.cc.

Constructor & Destructor Documentation

hit::HitFinderAna::HitFinderAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 99 of file HitFinderAna_module.cc.

99  : EDAnalyzer(pset)
100  {
101  fFFTHitFinderModuleLabel = pset.get<std::string>("HitsModuleLabel");
102  fLArG4ModuleLabel = pset.get<std::string>("LArGeantModuleLabel");
103  }
std::string fFFTHitFinderModuleLabel
std::string fLArG4ModuleLabel

Member Function Documentation

void hit::HitFinderAna::analyze ( const art::Event &  evt)
private

read/write access to event

Definition at line 174 of file HitFinderAna_module.cc.

175  {
176 
177  if (evt.isRealData()) {
178  throw cet::exception("HitFinderAna: ") << "Not for use on Data yet...\n";
179  }
180 
181  art::Handle<std::vector<recob::Hit>> hitHandle;
182  evt.getByLabel(fFFTHitFinderModuleLabel, hitHandle);
183 
184  art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
185  art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
186  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
187 
188  sim::ParticleList const& _particleList = pi_serv->ParticleList();
189 
190  MF_LOG_VERBATIM("HitFinderAna") << _particleList;
191 
192  art::ServiceHandle<geo::Geometry const> geom;
193 
194  std::map<geo::PlaneID, std::vector<art::Ptr<recob::Hit>>> planeIDToHits;
195  for (size_t h = 0; h < hitHandle->size(); ++h)
196  planeIDToHits[hitHandle->at(h).WireID().planeID()].push_back(
197  art::Ptr<recob::Hit>(hitHandle, h));
198 
199  for (auto mapitr : planeIDToHits) {
200  fNp0 = 0;
201  fN3p0 = 0;
202  fNp1 = 0;
203  fN3p1 = 0;
204  fNp2 = 0;
205  fN3p2 = 0;
206 
207  geo::PlaneID pid = mapitr.first;
208  auto itr = mapitr.second.begin();
209  while (itr != mapitr.second.end()) {
210 
211  fRun = evt.run();
212  fEvt = evt.id().event();
213 
214  std::vector<sim::TrackIDE> trackides = bt_serv->HitToTrackIDEs(clockData, *itr);
215  std::vector<sim::TrackIDE>::iterator idesitr = trackides.begin();
216  std::vector<double> xyz = bt_serv->HitToXYZ(clockData, *itr);
217 
218  if (pid.Plane == 0 && fNp0 < 9000) {
219  fTimep0[fNp0] = (*itr)->PeakTime();
220  fWirep0[fNp0] = (*itr)->WireID().Wire;
221  fChgp0[fNp0] = (*itr)->Integral();
222 
223  for (unsigned int kk = 0; kk < 3; ++kk) {
224  fXYZp0[fNp0 * 3 + kk] = xyz[kk];
225  }
226 
227  while (idesitr != trackides.end()) {
228  fMCTId0[fNp0] = (*idesitr).trackID;
229  if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
230  const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
231  fMCPdg0[fNp0] = particle->PdgCode();
232  fMCE0[fNp0] = particle->E();
233  }
234  idesitr++;
235  }
236 
237  ++fNp0;
238  }
239 
240  else if (pid.Plane == 1 && fNp1 < 9000) {
241  fTimep1[fNp1] = (*itr)->PeakTime();
242  fWirep1[fNp1] = (*itr)->WireID().Wire;
243  fChgp1[fNp1] = (*itr)->Integral();
244 
245  for (unsigned int kk = 0; kk < 3; ++kk) {
246  fXYZp1[fNp1 * 3 + kk] = xyz[kk];
247  }
248 
249  while (idesitr != trackides.end()) {
250  fMCTId1[fNp1] = (*idesitr).trackID;
251  if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
252  const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
253  fMCPdg1[fNp1] = particle->PdgCode();
254  fMCE1[fNp1] = particle->E();
255  }
256  idesitr++;
257  }
258  ++fNp1;
259  }
260 
261  else if (pid.Plane == 2 && fNp2 < 9000) {
262  fTimep2[fNp2] = (*itr)->PeakTime();
263  fWirep2[fNp2] = (*itr)->WireID().Wire;
264  fChgp2[fNp2] = (*itr)->Integral();
265 
266  for (unsigned int kk = 0; kk < 3; ++kk) {
267  fXYZp2[fNp2 * 3 + kk] = xyz[kk];
268  }
269 
270  while (idesitr != trackides.end()) {
271  fMCTId2[fNp2] = (*idesitr).trackID;
272  if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
273  const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
274  fMCPdg2[fNp2] = particle->PdgCode();
275  fMCE2[fNp2] = particle->E();
276  }
277  idesitr++;
278  }
279  ++fNp2;
280  }
281 
282  fN3p0 = 3 * fNp0;
283  fN3p1 = 3 * fNp1;
284  fN3p2 = 3 * fNp2;
285 
286  fHTree->Fill();
287  itr++;
288  } // loop on Hits
289  } // loop on map
290 
291  return;
292  } // end analyze method
unsigned int event
Definition: DataStructs.h:634
unsigned int run
Definition: DataStructs.h:635
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
std::string fFFTHitFinderModuleLabel
while getopts h
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
TCEvent evt
Definition: DataStructs.cxx:8
void hit::HitFinderAna::beginJob ( )
private

Definition at line 107 of file HitFinderAna_module.cc.

108  {
109  // get access to the TFile service
110  art::ServiceHandle<art::TFileService const> tfs;
111  fNp0 = 9000;
112  fNp1 = 9000;
113  fNp2 = 9000;
114 
115  fHTree = tfs->make<TTree>("HTree", "HTree");
116  fTimep0 = new Float_t[fNp0];
117  fTimep1 = new Float_t[fNp1];
118  fTimep2 = new Float_t[fNp2];
119  fWirep0 = new Int_t[fNp0];
120  fWirep1 = new Int_t[fNp1];
121  fWirep2 = new Int_t[fNp2];
122  fChgp0 = new Float_t[fNp0];
123  fChgp1 = new Float_t[fNp1];
124  fChgp2 = new Float_t[fNp2];
125  fXYZp0 = new Float_t[fNp0 * 3];
126  fXYZp1 = new Float_t[fNp1 * 3];
127  fXYZp2 = new Float_t[fNp2 * 3];
128 
129  fMCPdg0 = new Int_t[fNp0];
130  fMCPdg1 = new Int_t[fNp1];
131  fMCPdg2 = new Int_t[fNp2];
132  fMCTId0 = new Int_t[fNp0];
133  fMCTId1 = new Int_t[fNp1];
134  fMCTId2 = new Int_t[fNp2];
135  fMCE0 = new Float_t[fNp0];
136  fMCE1 = new Float_t[fNp1];
137  fMCE2 = new Float_t[fNp2];
138 
139  fHTree->Branch("HEvt", &fEvt, "HEvt/I");
140  fHTree->Branch("HRun", &fRun, "HRun/I");
141  fHTree->Branch("HNp0", &fNp0, "HNp0/I");
142  fHTree->Branch("HNp1", &fNp1, "HNp1/I");
143  fHTree->Branch("HNp2", &fNp2, "HNp2/I");
144  fHTree->Branch("HN3p0", &fN3p0, "HN3p0/I");
145  fHTree->Branch("HN3p1", &fN3p1, "HN3p1/I");
146  fHTree->Branch("HN3p2", &fN3p2, "HN3p2/I");
147  fHTree->Branch("Htp0", fTimep0, "Htp0[HNp0]/F");
148  fHTree->Branch("Htp1", fTimep1, "Htp1[HNp1]/F");
149  fHTree->Branch("Htp2", fTimep2, "Htp2[HNp2]/F");
150  fHTree->Branch("Hwp0", fWirep0, "Hwp0[HNp0]/I");
151  fHTree->Branch("Hwp1", fWirep1, "Hwp1[HNp1]/I");
152  fHTree->Branch("Hwp2", fWirep2, "Hwp2[HNp2]/I");
153  fHTree->Branch("Hchgp0", fChgp0, "Hchgp0[HNp0]/F");
154  fHTree->Branch("Hchgp1", fChgp1, "Hchgp1[HNp1]/F");
155  fHTree->Branch("Hchgp2", fChgp2, "Hchgp2[HNp2]/F");
156  fHTree->Branch("HMCXYZp0", fXYZp0, "HMCXYZp0[HN3p0]/F");
157  fHTree->Branch("HMCXYZp1", fXYZp1, "HMCXYZp1[HN3p1]/F");
158  fHTree->Branch("HMCXYZp2", fXYZp2, "HMCXYZp2[HN3p2]/F");
159  fHTree->Branch("HMCPdgp0", fMCPdg0, "HMCPdgp0[HNp0]/I");
160  fHTree->Branch("HMCPdgp1", fMCPdg1, "HMCPdgp1[HNp1]/I");
161  fHTree->Branch("HMCPdgp2", fMCPdg2, "HMCPdgp2[HNp2]/I");
162  fHTree->Branch("HMCTIdp0", fMCTId0, "HMCTIdp0[HNp0]/I");
163  fHTree->Branch("HMCTIdp1", fMCTId1, "HMCTIdp1[HNp1]/I");
164  fHTree->Branch("HMCTIdp2", fMCTId2, "HMCTIdp2[HNp2]/I");
165  fHTree->Branch("HMCEp0", fMCE0, "HMCEp0[HNp0]/F");
166  fHTree->Branch("HMCEp1", fMCE1, "HMCEp1[HNp1]/F");
167  fHTree->Branch("HMCEp2", fMCE2, "HMCEp2[HNp2]/F");
168 
169  return;
170  }
art::ServiceHandle< art::TFileService > tfs

Member Data Documentation

Float_t* hit::HitFinderAna::fChgp0
private

Definition at line 75 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fChgp1
private

Definition at line 76 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fChgp2
private

Definition at line 77 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fEvt
private

Definition at line 62 of file HitFinderAna_module.cc.

std::string hit::HitFinderAna::fFFTHitFinderModuleLabel
private

Definition at line 57 of file HitFinderAna_module.cc.

TTree* hit::HitFinderAna::fHTree
private

Definition at line 60 of file HitFinderAna_module.cc.

std::string hit::HitFinderAna::fLArG4ModuleLabel
private

Definition at line 58 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fMCE0
private

Definition at line 84 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fMCE1
private

Definition at line 87 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fMCE2
private

Definition at line 90 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCPdg0
private

Definition at line 82 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCPdg1
private

Definition at line 85 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCPdg2
private

Definition at line 88 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCTId0
private

Definition at line 83 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCTId1
private

Definition at line 86 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fMCTId2
private

Definition at line 89 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fN3p0
private

Definition at line 66 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fN3p1
private

Definition at line 67 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fN3p2
private

Definition at line 68 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fNp0
private

Definition at line 63 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fNp1
private

Definition at line 64 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fNp2
private

Definition at line 65 of file HitFinderAna_module.cc.

Int_t hit::HitFinderAna::fRun
private

Definition at line 61 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fTimep0
private

Definition at line 69 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fTimep1
private

Definition at line 70 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fTimep2
private

Definition at line 71 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fWirep0
private

Definition at line 72 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fWirep1
private

Definition at line 73 of file HitFinderAna_module.cc.

Int_t* hit::HitFinderAna::fWirep2
private

Definition at line 74 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fXYZp0
private

Definition at line 78 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fXYZp1
private

Definition at line 79 of file HitFinderAna_module.cc.

Float_t* hit::HitFinderAna::fXYZp2
private

Definition at line 80 of file HitFinderAna_module.cc.


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