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

#include <PndSciT.h>

Inheritance diagram for PndSciT:

Public Member Functions

 PndSciT ()
 
 PndSciT (const char *name, Bool_t active)
 
virtual ~PndSciT ()
 
virtual void Initialize ()
 
virtual Bool_t ProcessHits (FairVolume *vol=0)
 
virtual void EndOfEvent ()
 
virtual void BeginEvent ()
 
virtual void Register ()
 
virtual TClonesArray * GetCollection (Int_t iColl) const
 
virtual void Print () const
 
virtual void Reset ()
 
virtual void CopyClones (TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
 
virtual void ConstructGeometry ()
 
void SetThreshold (Double_t val)
 
PndSciTPointAddHit (Int_t eventID, Int_t trackID, Int_t sensorID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss)
 

Private Member Functions

bool CheckIfSensitive (std::string name)
 
void ResetParameters ()
 

Private Attributes

std::vector< std::string > fListOfSensitives
 
Int_t fEventID
 
Int_t fTrackID
 
Int_t fSensorID
 
TString fdetPath
 
TLorentzVector fPosIn
 
TLorentzVector fMomIn
 
TLorentzVector fPosOut
 
TLorentzVector fMomOut
 
Double32_t fTime
 
Double32_t fLength
 
Double_t fELoss
 
Double_t fThreshold
 
PndGeoHandlingfGeoH
 
PndGeoSciTParpar
 Gives Access to the Path info of a hit. More...
 
Int_t fPosIndex
 for saving parameters, although not mandatory, may someone can make use out of the stored parameters More...
 
TClonesArray * fSciTCollection
 

Detailed Description

Definition at line 28 of file PndSciT.h.

Constructor & Destructor Documentation

PndSciT::PndSciT ( )

Default constructor

Definition at line 52 of file PndSciT.cxx.

References fGeoH, fListOfSensitives, fSciTCollection, fThreshold, and PndGeoHandling::Instance().

53  : FairDetector(), fSciTCollection(0)
54  {
55  fSciTCollection = new TClonesArray("PndSciTPoint");
56  fVerboseLevel = 0;
57  fThreshold = 0.0001; // Standard Threshold set to 100 keV
58  fGeoH = NULL;
60 
61  // Volumes containing "SENSOR" in the name will be processed in the process hit funktion
62  fListOfSensitives.push_back("SENSOR");
63 
64 }
Double_t fThreshold
Definition: PndSciT.h:149
PndGeoHandling * fGeoH
Definition: PndSciT.h:151
static PndGeoHandling * Instance()
std::vector< std::string > fListOfSensitives
Definition: PndSciT.h:132
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
PndSciT::PndSciT ( const char *  name,
Bool_t  active 
)

Standard constructor.

Parameters
namedetetcor name
activesensitivity flag

Definition at line 68 of file PndSciT.cxx.

References fGeoH, fListOfSensitives, fSciTCollection, fThreshold, and PndGeoHandling::Instance().

69  : FairDetector(name, active), fSciTCollection(0)
70 {
71  fSciTCollection = new TClonesArray("PndSciTPoint");
72  fVerboseLevel = 0;
73  fThreshold = 0.0001; // Standard Threshold set to 100 keV
74 
75  fGeoH = NULL;
76  std::cout << "ScitTil fGeoH is loading" << std::endl;
78  if ( fGeoH == NULL ){
79  std::cout << "ScitTil fGeoH was loaded but is still NULL" << std::endl;
80  }
81 
82  // Volumes containing "SENSOR" in the name will be processed in the process hit funktion
83  fListOfSensitives.push_back("SENSOR");
84 
85 }
Double_t fThreshold
Definition: PndSciT.h:149
PndGeoHandling * fGeoH
Definition: PndSciT.h:151
static PndGeoHandling * Instance()
TString name
std::vector< std::string > fListOfSensitives
Definition: PndSciT.h:132
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
PndSciT::~PndSciT ( )
virtual

Destructor

Definition at line 91 of file PndSciT.cxx.

References fSciTCollection.

91  {
92  if (fSciTCollection) {
93  fSciTCollection->Delete();
94  delete fSciTCollection;
95  }
96 
97 }
TClonesArray * fSciTCollection
Definition: PndSciT.h:154

Member Function Documentation

PndSciTPoint * PndSciT::AddHit ( Int_t  eventID,
Int_t  trackID,
Int_t  sensorID,
TString  detName,
TVector3  posin,
TVector3  momin,
TVector3  posout,
TVector3  momout,
Double_t  tof,
Double_t  length,
Double_t  eLoss 
)

Definition at line 286 of file PndSciT.cxx.

References fSciTCollection.

Referenced by ProcessHits().

292  {
293  TClonesArray& clref = *fSciTCollection;
294  Int_t size = clref.GetEntriesFast();
295  return new(clref[size]) PndSciTPoint( eventID, trackID, sensorID, detName,pos, mom,
296  posout, momout,
297  time, length, eLoss);
298  }
TVector3 pos
Double_t mom
Definition: plot_dirc.C:14
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
void PndSciT::BeginEvent ( )
virtual

Definition at line 127 of file PndSciT.cxx.

127  {
128  // Begin of the event
129 
130 }
bool PndSciT::CheckIfSensitive ( std::string  name)
private

Definition at line 274 of file PndSciT.cxx.

References fListOfSensitives, and i.

275 {
276  for (size_t i = 0; i < fListOfSensitives.size(); i++){
277  if (name.find(fListOfSensitives[i]) != std::string::npos)
278  return true;
279  }
280  return false;
281 }
Int_t i
Definition: run_full.C:25
TString name
std::vector< std::string > fListOfSensitives
Definition: PndSciT.h:132
void PndSciT::ConstructGeometry ( )
virtual

Virtual method Construct geometry

Definition at line 261 of file PndSciT.cxx.

References TString.

261  {
262 
263  TString fileName=GetGeometryFileName();
264 
265  if(fileName.EndsWith(".root")){
266  ConstructRootGeometry();
267  }else {
268  cout<<" geometry format not supported"<<endl;}
269 
270 }
void PndSciT::CopyClones ( TClonesArray *  cl1,
TClonesArray *  cl2,
Int_t  offset 
)
virtual

Virtual method CopyClones

Copies the hit collection with a given track index offset

Parameters
cl1Origin
cl2Target
offsetIndex offset

Definition at line 244 of file PndSciT.cxx.

References fPosIndex, i, and offset().

244  {
245  Int_t nEntries = cl1->GetEntriesFast();
246  //cout << "-I- PndSciT: " << nEntries << " entries to add." << endl;
247  TClonesArray& clref = *cl2;
248  PndSciTPoint* oldpoint = NULL;
249  for (Int_t i=0; i<nEntries; i++) {
250  oldpoint = (PndSciTPoint*) cl1->At(i);
251  Int_t index = oldpoint->GetTrackID() + offset;
252  oldpoint->SetTrackID(index);
253  new (clref[fPosIndex]) PndSciTPoint(*oldpoint);
254  fPosIndex++;
255  }
256  cout << " -I- PndSciT: " << cl2->GetEntriesFast() << " merged entries."
257  << endl;
258 }
Int_t fPosIndex
for saving parameters, although not mandatory, may someone can make use out of the stored parameters ...
Definition: PndSciT.h:153
Int_t i
Definition: run_full.C:25
TVector3 offset(2, 0, 0)
void PndSciT::EndOfEvent ( )
virtual

Virtual method EndOfEvent

If verbosity level is set, print hit collection at the end of the event and resets it afterwards.

Definition at line 195 of file PndSciT.cxx.

References Print(), and Reset().

195  {
196  if (fVerboseLevel) Print();
197 
198  Reset();
199 }
virtual void Print() const
Definition: PndSciT.cxx:220
virtual void Reset()
Definition: PndSciT.cxx:233
TClonesArray * PndSciT::GetCollection ( Int_t  iColl) const
virtual

Accessor to the hit collection

Definition at line 211 of file PndSciT.cxx.

References fSciTCollection.

211  {
212  if (iColl == 0)
213  return fSciTCollection;
214  else
215  return NULL;
216 }
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
void PndSciT::Initialize ( )
virtual

Virtual method Initialize Initialises detector. Stores volume IDs for MUO detector and mirror.

Definition at line 103 of file PndSciT.cxx.

References PndGeoHandling::CreateUniqueSensorId(), fGeoH, fListOfSensitives, gGeoManager, Initialize(), par, PndGeoHandling::PrintSensorNames(), rtdb, and sim().

103  {
104 
105  std::cout<<" -I- Initializing PndSciT()"<<std::endl;
107  std::cout<<" Fairdetector geht"<<std::endl;
108  // not mandatory ,but may someone can make use out of the stored parameters
109  FairRun* sim = FairRun::Instance();
110  FairRuntimeDb* rtdb=sim->GetRuntimeDb();
111  par=(PndGeoSciTPar*)(rtdb->getContainer("PndGeoSciTPar"));
112  par->setChanged();
113  par->setInputVersion(sim->GetRunId(),1);
114  //-----------------------------------------------------------------
115 
116  if(0==gGeoManager) {
117  std::cout<<" -E- No gGeoManager in PndSciT::Initialize()!"<<std::endl;
118  abort();
119  }
120 
122  if(fVerboseLevel>0) fGeoH->PrintSensorNames();
123 
124  std::cout<<" -I- Initialized PndSciT()"<<std::endl;
125 }
sim(Int_t nEvents=1, TString SimEngine="TGeant4", Float_t mom=6.231552)
void CreateUniqueSensorId(TString startName, std::vector< std::string > listOfSensitives)
Has to be called during simulation to create unique sensor id.
PndGeoHandling * fGeoH
Definition: PndSciT.h:151
TGeoManager * gGeoManager
void PrintSensorNames()
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
std::vector< std::string > fListOfSensitives
Definition: PndSciT.h:132
PndGeoSciTPar * par
Gives Access to the Path info of a hit.
Definition: PndSciT.h:152
Mvd Initialize()
void PndSciT::Print ( ) const
virtual

Virtual method Print

Screen output of hit collection.

Definition at line 220 of file PndSciT.cxx.

References fSciTCollection, i, and nHits.

Referenced by EndOfEvent().

220  {
221  Int_t nHits = fSciTCollection->GetEntriesFast();
222  cout << "-I- PndSciT: " << nHits << " points registered in this event."
223  << endl;
224 
225  if (fVerboseLevel>1)
226  for (Int_t i=0; i<nHits; i++) (*fSciTCollection)[i]->Print();
227 }
Int_t i
Definition: run_full.C:25
int nHits
Definition: RiemannTest.C:16
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
Bool_t PndSciT::ProcessHits ( FairVolume *  vol = 0)
virtual

Virtual method ProcessHits

Defines the action to be taken when a step is inside the active volume. Creates PndSciTPoints and PndSciTMirrorPoints and adds them to the collections.

Parameters
volPointer to the active volume

Definition at line 134 of file PndSciT.cxx.

References AddHit(), PndStack::AddPoint(), fdetPath, fELoss, fEventID, fGeoH, fLength, fMomIn, fMomOut, fPosIn, fPosOut, fSensorID, fThreshold, fTime, fTrackID, PndGeoHandling::GetShortID(), kTOF, and ResetParameters().

135 {
136 
137  if(0==fGeoH) {
138  std::cout<<" -E- No PndGeoHandling loaded."<<std::endl;
139  abort();
140  }
141 
142  // Set parameters at entrance of volume. Reset ELoss.
143  if ( gMC->IsTrackEntering() )
144  {
145  fELoss = 0.;
146  fEventID = gMC->CurrentEvent();
147  fTime = gMC->TrackTime() * 1.0e09;
148  fLength = gMC->TrackLength();
149  gMC->TrackPosition(fPosIn);
150  gMC->TrackMomentum(fMomIn);
151  }
152 
153  // Sum energy loss for all steps in the active volume
154  fELoss += gMC->Edep();
155 
156  // Set additional parameters at exit of active volume.
157  // And create the PndSciTPoint.
158  if ( (gMC->IsTrackExiting() ||
159  gMC->IsTrackStop() ||
160  gMC->IsTrackDisappeared() ))
161  {
162  fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
163 
164  fdetPath = gMC->CurrentVolPath();
165  fSensorID = fGeoH->GetShortID(gMC->CurrentVolPath());
166 
167  //fSensorID = vol->getCopyNo();
168 
169  gMC->TrackPosition(fPosOut);
170  gMC->TrackMomentum(fMomOut);
171 
172  //Cut on energy loss to reduce stored data Elos < 100 keV
173  if (fELoss < fThreshold) return kFALSE;
174 
176  TVector3(fPosIn.X(), fPosIn.Y(), fPosIn.Z()),
177  TVector3(fMomIn.Px(), fMomIn.Py(), fMomIn.Pz()),
178  TVector3(fPosOut.X(), fPosOut.Y(), fPosOut.Z()),
179  TVector3(fMomOut.Px(), fMomOut.Py(), fMomOut.Pz()),
180  fTime, fLength,fELoss);
181 
182  PndStack* stack = (PndStack*) gMC->GetStack();
183  stack->AddPoint(kTOF);
184 
185  ResetParameters();
186  }
187 
188  return kTRUE;
189 
190 }//ProcessHits
Double_t fThreshold
Definition: PndSciT.h:149
TLorentzVector fMomIn
Definition: PndSciT.h:142
TLorentzVector fMomOut
Definition: PndSciT.h:144
PndGeoHandling * fGeoH
Definition: PndSciT.h:151
void AddPoint(DetectorId iDet)
Definition: PndStack.cxx:408
TString fdetPath
Definition: PndSciT.h:139
Int_t fSensorID
Definition: PndSciT.h:138
Int_t fEventID
Definition: PndSciT.h:136
Int_t GetShortID(TString path)
for a given path the (unique) position of the sensor path in the fSensorNamePar-List is given...
Double_t fELoss
Definition: PndSciT.h:148
TLorentzVector fPosOut
Definition: PndSciT.h:143
TLorentzVector fPosIn
Definition: PndSciT.h:141
Double32_t fLength
Definition: PndSciT.h:147
PndSciTPoint * AddHit(Int_t eventID, Int_t trackID, Int_t sensorID, TString detName, TVector3 posin, TVector3 momin, TVector3 posout, TVector3 momout, Double_t tof, Double_t length, Double_t eLoss)
Definition: PndSciT.cxx:286
Int_t fTrackID
Definition: PndSciT.h:137
void ResetParameters()
Definition: PndSciT.h:164
Double32_t fTime
Definition: PndSciT.h:146
void PndSciT::Register ( )
virtual

Virtual method Register

Registers the hit collection in the ROOT manager.

Definition at line 203 of file PndSciT.cxx.

References fSciTCollection.

203  {
204  FairRootManager::Instance()->Register("SciTPoint","PndSciT", fSciTCollection, kTRUE);
205 
206 
207 }
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
void PndSciT::Reset ( )
virtual

Virtual method Reset

Clears the hit collection

Definition at line 233 of file PndSciT.cxx.

References fPosIndex, and fSciTCollection.

Referenced by EndOfEvent().

233  {
234  fSciTCollection->Clear();
235 
236 
237  fPosIndex = 0;
238 }
Int_t fPosIndex
for saving parameters, although not mandatory, may someone can make use out of the stored parameters ...
Definition: PndSciT.h:153
TClonesArray * fSciTCollection
Definition: PndSciT.h:154
void PndSciT::ResetParameters ( )
inlineprivate

Definition at line 164 of file PndSciT.h.

References fELoss, fEventID, fLength, fMomIn, fMomOut, fPosIn, fPosOut, fSensorID, fTime, and fTrackID.

Referenced by ProcessHits().

164  {
165  fTrackID = fSensorID = fEventID = -1;
166  fPosIn.SetXYZM(0.0, 0.0, 0.0, 0.0);
167  fPosOut.SetXYZM(0.0, 0.0, 0.0, 0.0);
168  fMomIn.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
169  fMomOut.SetPxPyPzE(0.0, 0.0, 0.0, 0.0);
170 
171  fTime = fLength = fELoss = 0;
172 
173 };
TLorentzVector fMomIn
Definition: PndSciT.h:142
TLorentzVector fMomOut
Definition: PndSciT.h:144
Int_t fSensorID
Definition: PndSciT.h:138
Int_t fEventID
Definition: PndSciT.h:136
Double_t fELoss
Definition: PndSciT.h:148
TLorentzVector fPosOut
Definition: PndSciT.h:143
TLorentzVector fPosIn
Definition: PndSciT.h:141
Double32_t fLength
Definition: PndSciT.h:147
Int_t fTrackID
Definition: PndSciT.h:137
Double32_t fTime
Definition: PndSciT.h:146
void PndSciT::SetThreshold ( Double_t  val)
inline

Definition at line 116 of file PndSciT.h.

References fThreshold, and val.

116 {fThreshold = val;}; //default value is 0.0001 GeV
Double_t fThreshold
Definition: PndSciT.h:149
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11

Member Data Documentation

TString PndSciT::fdetPath
private

Definition at line 139 of file PndSciT.h.

Referenced by ProcessHits().

Double_t PndSciT::fELoss
private

Definition at line 148 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndSciT::fEventID
private

Definition at line 136 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

PndGeoHandling* PndSciT::fGeoH
private

Definition at line 151 of file PndSciT.h.

Referenced by Initialize(), PndSciT(), and ProcessHits().

Double32_t PndSciT::fLength
private

Definition at line 147 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

std::vector<std::string> PndSciT::fListOfSensitives
private

Definition at line 132 of file PndSciT.h.

Referenced by CheckIfSensitive(), Initialize(), and PndSciT().

TLorentzVector PndSciT::fMomIn
private

Definition at line 142 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

TLorentzVector PndSciT::fMomOut
private

Definition at line 144 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

TLorentzVector PndSciT::fPosIn
private

Definition at line 141 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndSciT::fPosIndex
private

for saving parameters, although not mandatory, may someone can make use out of the stored parameters

Definition at line 153 of file PndSciT.h.

Referenced by CopyClones(), and Reset().

TLorentzVector PndSciT::fPosOut
private

Definition at line 143 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

TClonesArray* PndSciT::fSciTCollection
private

Definition at line 154 of file PndSciT.h.

Referenced by AddHit(), GetCollection(), PndSciT(), Print(), Register(), Reset(), and ~PndSciT().

Int_t PndSciT::fSensorID
private

Definition at line 138 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

Double_t PndSciT::fThreshold
private

Definition at line 149 of file PndSciT.h.

Referenced by PndSciT(), ProcessHits(), and SetThreshold().

Double32_t PndSciT::fTime
private

Definition at line 146 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

Int_t PndSciT::fTrackID
private

Definition at line 137 of file PndSciT.h.

Referenced by ProcessHits(), and ResetParameters().

PndGeoSciTPar* PndSciT::par
private

Gives Access to the Path info of a hit.

Definition at line 152 of file PndSciT.h.

Referenced by Initialize().


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