FairRoot/PandaRoot
PndTrkHitList.cxx
Go to the documentation of this file.
1 //
2 // PndTrkHitList.cxx
3 //
4 //
5 //
6 //
7 // authors: Lia Lavezzi - INFN Pavia (2012)
8 //
10 
11 #include "PndTrkHitList.h"
12 
13 #include "PndDetectorList.h"
14 
15 #include <iostream>
16 #include "TMath.h"
17 #include "PndSttHit.h"
18 #include "PndSdsHit.h"
19 
20 #include "TClonesArray.h"
21 
22 using namespace std;
23 
24 
26  hitlist.resize(0);
27 }
28 
30 
31 // ----------------------------------------------------
32 void PndTrkHitList::AddHit(Int_t hitID, Int_t detID, Bool_t used, Int_t iregion, TVector3& pos)
33 {
34  PndTrkHit hit(hitID, detID, used, iregion, -1, pos, 0., -1);
35  hitlist.push_back(hit);
36 }
37 
38 void PndTrkHitList::AddHit(Int_t hitID, Int_t detID, Bool_t used, Int_t iregion, Int_t tubeID, TVector3& pos, Double_t isochrone)
39 {
40  PndTrkHit hit(hitID, detID, used, iregion, tubeID, pos, isochrone, -1);
41  hitlist.push_back(hit);
42 }
43 
44 void PndTrkHitList::AddHit(Int_t hitID, Int_t detID, Bool_t used, Int_t iregion, Int_t sensorID, TVector3& pos)
45 {
46  PndTrkHit hit(hitID, detID, used, iregion, sensorID, pos, 0.0, -1);
47  hitlist.push_back(hit);
48 }
49 
50 
52 {
53  hitlist.push_back(*hit);
54 }
55 // ----------------------------------------------------
56 
57 void PndTrkHitList::AddHit(Int_t hitid, Int_t detid, FairHit *hit) {
58  TVector3 position;
59  hit->Position(position);
60  AddHit(hitid, detid, 0, -1, position); // CHECK iregion
61 }
62 
63 void PndTrkHitList::AddTCA(Int_t detID, TClonesArray *array) {
64  for(int ihit = 0; ihit < array->GetEntriesFast(); ihit++) {
65  FairHit *hit = (FairHit*) array->At(ihit);
66  AddHit(ihit, detID, hit);
67  }
68 }
69 
71  return &hitlist[index];
72 
73 }
74 
76  std::vector< PndTrkHit >::iterator itr = hitlist.begin();
77  while(itr != hitlist.end()) {
78  if(id == (*itr).GetHitID()) return &(*itr);
79  itr++;
80  }
81  return NULL;
82 
83 }
84 
86 
87  cout << "###############################" << endl;
88  std::vector< PndTrkHit >::iterator itr;
89  itr = hitlist.begin();
90  while(itr != hitlist.end()) {
91  cout << " " << (*itr).GetHitID() << " " << (*itr).GetDetectorID() << endl;
92  itr++;
93  }
94 }
95 
96 void PndTrkHitList::Draw(Color_t color) {
97  std::vector< PndTrkHit >::iterator itr = hitlist.begin();
98  while(itr != hitlist.end()) {
99  (*itr).Draw(color);
100  itr++;
101  }
102 }
103 
104 
105 
107 
TVector3 pos
void AddTCA(Int_t detID, TClonesArray *array)
PndTrkHit * GetHitByID(int id)
PndTrkHit * GetHit(int index)
Double_t
void Draw(Color_t color=kBlack)
void AddHit(Int_t hitID, Int_t detID, Bool_t used, Int_t iregion, TVector3 &pos)
ClassImp(PndAnaContFact)
PndSdsMCPoint * hit
Definition: anasim.C:70