FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndHypHitProducerIdeal Class Reference

#include <PndHypHitProducerIdeal.h>

Inheritance diagram for PndHypHitProducerIdeal:

Public Member Functions

 PndHypHitProducerIdeal ()
 
 ~PndHypHitProducerIdeal ()
 
virtual void SetParContainers ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void smear (TVector3 &pos, TVector3 &dpos)
 

Private Member Functions

void Register ()
 
void Reset ()
 
void ProduceHits ()
 
 ClassDef (PndHypHitProducerIdeal, 3)
 

Private Attributes

TString fBranchName
 
TClonesArray * fPointArray
 
TClonesArray * fHitArray
 
PndGeoHypParfGeoPar
 

Detailed Description

Definition at line 29 of file PndHypHitProducerIdeal.h.

Constructor & Destructor Documentation

PndHypHitProducerIdeal::PndHypHitProducerIdeal ( )

Default constructor

Definition at line 18 of file PndHypHitProducerIdeal.cxx.

References fBranchName.

18  :
19  FairTask("Ideal PndHyp Hit Producer")
20 {
21  fBranchName = "HypPoint";
22 }
PndHypHitProducerIdeal::~PndHypHitProducerIdeal ( )

Destructor

Definition at line 28 of file PndHypHitProducerIdeal.cxx.

29 {
30 }

Member Function Documentation

PndHypHitProducerIdeal::ClassDef ( PndHypHitProducerIdeal  ,
 
)
private
void PndHypHitProducerIdeal::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 74 of file PndHypHitProducerIdeal.cxx.

References fHitArray, fPointArray, PndHypPoint::GetDetName(), PndHypPoint::GetVolumeID(), PndHypPoint::GetXin(), PndHypPoint::GetYin(), PndHypPoint::GetZin(), point, and smear().

75 {
76  // Reset output array
77  if ( ! fHitArray )
78  Fatal("Exec", "No HitArray");
79 
80  fHitArray->Delete();
81 
82  // Declare some variables
83  PndHypPoint *point = 0;
84 
85  Int_t
86  detID = 0; // Detector ID
87  //trackID = 0; // Track index //[R.K.03/2017] unused variable
88 
89  TVector3
90  dpos; // Position and error vectors
91 
92  // Loop over PndHypPoints
93  Int_t
94  nPoints = fPointArray->GetEntriesFast();
95 
96  for (Int_t iPoint = 0; iPoint < nPoints; iPoint++)
97  {
98  point = (PndHypPoint*) fPointArray->At(iPoint);
99 // std::cout << " Ideal Hit Producer -Point-: " << point << std::endl;
100  if ( ! point)
101  continue;
102 
103  // Detector ID
104  detID = point->GetVolumeID();
105 
106  // MCTrack ID
107  //trackID = point->GetTrackID(); //[R.K.03/2017] unused variable
108 
109  TVector3 position(point->GetXin(), point->GetYin(), point->GetZin());
110  //point->Position(pos);
111  dpos.SetXYZ(0.2,0.2,0.2);
112  smear(position,dpos);
113 
114  // Create new hit
115  new ((*fHitArray)[iPoint]) PndHypHit( detID, point->GetDetName(), position, dpos, iPoint, point->GetEnergyLoss(),1);
116  std::cout << "Hit created for module: " << point->GetDetName() << std::endl;
117 
118 
119 
120  } // Loop over MCPoints
121 
122  // Event summary
123  std::cout << "-I- PndHypHitProducerIdeal: " << nPoints << " HypPoints, "
124  << nPoints << " Hits created." << std::endl;
125 
126 }
Double_t GetZin() const
Definition: PndHypPoint.h:94
Double_t GetXin() const
Definition: PndHypPoint.h:92
Int_t GetVolumeID() const
Definition: PndHypPoint.h:91
void smear(TVector3 &pos, TVector3 &dpos)
TClonesArray * point
Definition: anaLmdDigi.C:29
Double_t GetYin() const
Definition: PndHypPoint.h:93
TString GetDetName() const
Definition: PndHypPoint.h:119
InitStatus PndHypHitProducerIdeal::Init ( )
virtual

Definition at line 33 of file PndHypHitProducerIdeal.cxx.

References fBranchName, fHitArray, and fPointArray.

34 {
35  // Get RootManager
36  FairRootManager* ioman = FairRootManager::Instance();
37 
38  if ( ! ioman )
39  {
40  std::cout << "-E- PndHypHitProducerIdeal::Init: "
41  << "RootManager not instantiated!" << std::endl;
42  return kFATAL;
43  }
44 
45  // Get input array
46  fPointArray = (TClonesArray*) ioman->GetObject(fBranchName);
47 
48  if ( ! fPointArray )
49  {
50  std::cout << "-W- PndHypHitProducerIdeal::Init: "
51  << "No HypPoint array!" << std::endl;
52  return kERROR;
53  }
54 
55  // Create and register output array
56  fHitArray = new TClonesArray("PndHypHit");
57  ioman->Register("HypHit", "Hyp", fHitArray, kTRUE);
58 
59  std::cout << "-I- PndHypHitProducerIdeal: Intialisation successfull" << std::endl;
60  return kSUCCESS;
61 }
void PndHypHitProducerIdeal::ProduceHits ( )
private
void PndHypHitProducerIdeal::Register ( )
private
void PndHypHitProducerIdeal::Reset ( )
private
void PndHypHitProducerIdeal::SetParContainers ( )
virtual

Virtual method Init

Definition at line 63 of file PndHypHitProducerIdeal.cxx.

References fGeoPar, and rtdb.

64 {
65  // Get Base Container
66  FairRun* ana = FairRun::Instance();
67  FairRuntimeDb* rtdb=ana->GetRuntimeDb();
68  fGeoPar = (PndGeoHypPar*)(rtdb->getContainer("PndGeoHypPar"));
69 
70 }
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndHypHitProducerIdeal::smear ( TVector3 &  pos,
TVector3 &  dpos 
)

smear a 3d vector

Definition at line 128 of file PndHypHitProducerIdeal.cxx.

References x, y, and z.

Referenced by Exec().

129 {
131 
132  double x=pos.x(),
133  y=pos.y(),
134  z=pos.z(),
135  sigx=dpos.x(),
136  sigy=dpos.y(),
137  sigz=dpos.z();
138 
139  sigx=gRandom->Gaus(0,sigx);
140  sigy=gRandom->Gaus(0,sigy);
141  sigz=gRandom->Gaus(0,sigz);
142 
143  x += sigx;
144  y += sigy;
145  z += sigz;
146 
147  pos.SetXYZ(x,y,z);
148  return;
149 }
TVector3 pos
Double_t z
Double_t x
Double_t y

Member Data Documentation

TString PndHypHitProducerIdeal::fBranchName
private

Definition at line 52 of file PndHypHitProducerIdeal.h.

Referenced by Init(), and PndHypHitProducerIdeal().

PndGeoHypPar* PndHypHitProducerIdeal::fGeoPar
private

Definition at line 59 of file PndHypHitProducerIdeal.h.

Referenced by SetParContainers().

TClonesArray* PndHypHitProducerIdeal::fHitArray
private

Output array of PndHypHits

Definition at line 57 of file PndHypHitProducerIdeal.h.

Referenced by Exec(), and Init().

TClonesArray* PndHypHitProducerIdeal::fPointArray
private

Input array of PndHypPoints

Definition at line 54 of file PndHypHitProducerIdeal.h.

Referenced by Exec(), and Init().


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