CbmStt.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. // -------------------------------------------------------------------------
  2. // ----- CbmStt header file -----
  3. // ----- Created 25/03/06 by R. Castelijns -----
  4. // ----- Based on FairTof -----
  5. // -------------------------------------------------------------------------
  6. /** CbmStt.h
  7. *@author R.Castelijns <r.castelijns@fz-juelich.de>
  8. **
  9. ** Defines the active detector STT. Constructs the geometry and
  10. ** registers MCPoints.
  11. **/
  12. #ifndef CBMSTT_H
  13. #define CBMSTT_H
  14. #include "TClonesArray.h"
  15. #include "TLorentzVector.h"
  16. #include "TVector3.h"
  17. #include "FairDetector.h"
  18. #include "CbmGeoSttPar.h"
  19. #include "FairRun.h"
  20. #include <string>
  21. #include <sstream>
  22. using std::string;
  23. class TClonesArray;
  24. class CbmSttPoint;
  25. class FairVolume;
  26. class CbmStt : public FairDetector
  27. {
  28. public:
  29. /** Default constructor **/
  30. CbmStt();
  31. /** Standard constructor.
  32. *@param name detetcor name
  33. *@param active sensitivity flag
  34. **/
  35. CbmStt(const char* name, Bool_t active);
  36. /** Destructor **/
  37. virtual ~CbmStt();
  38. /** Virtual method ProcessHits
  39. **
  40. ** Defines the action to be taken when a step is inside the
  41. ** active volume. Creates FairTrdPoints and adds them to the
  42. ** collection.
  43. *@param vol Pointer to the active volume
  44. **/
  45. virtual Bool_t ProcessHits(FairVolume* vol = 0);
  46. /** Virtual method EndOfEvent
  47. **
  48. ** If verbosity level is set, print hit collection at the
  49. ** end of the event and resets it afterwards.
  50. **/
  51. virtual void EndOfEvent();
  52. /** Virtual method Register
  53. **
  54. ** Registers the hit collection in the ROOT manager.
  55. **/
  56. virtual void Register();
  57. /** Accessor to the hit collection **/
  58. virtual TClonesArray* GetCollection(Int_t iColl) const;
  59. /** Virtual method Print
  60. **
  61. ** Screen output of hit collection.
  62. **/
  63. virtual void Print() const;
  64. /** Virtual method Reset
  65. **
  66. ** Clears the hit collection
  67. **/
  68. virtual void Reset();
  69. /** Virtual method CopyClones
  70. **
  71. ** Copies the hit collection with a given track index offset
  72. *@param cl1 Origin
  73. *@param cl2 Target
  74. *@param offset Index offset
  75. **/
  76. virtual void CopyClones(TClonesArray* cl1, TClonesArray* cl2,
  77. Int_t offset);
  78. /** Virtual method Construct geometry
  79. **
  80. ** Constructs the STT geometry
  81. **/
  82. virtual void ConstructGeometry();
  83. private:
  84. /** Track information to be stored until the track leaves the
  85. active volume. **/
  86. Int_t fTrackID; //! track index
  87. Int_t fVolumeID; //! volume id
  88. TLorentzVector fPos; //! wire position in global frame
  89. TLorentzVector fPosIn; //! entry position in global frame
  90. TLorentzVector fPosOut; //! exit position in global frame
  91. TLorentzVector fPosInLocal; //! entry position in straw frame
  92. TLorentzVector fPosOutLocal; //! exit position in straw frame
  93. TLorentzVector fMomIn; //! momentum
  94. TLorentzVector fMomOut; //! momentum
  95. Double32_t fTime; //! time
  96. Double32_t fLength; //! length
  97. Double32_t fELoss; //! energy loss
  98. Double32_t fMass; //! particle mass
  99. Bool_t fIsInitialized;
  100. TObjArray * fSensNodes;
  101. TObjArray * fPassNodes;
  102. CbmGeoSttPar * fParameters;
  103. // FairRun * fRun;
  104. Int_t fPosIndex; //!
  105. TClonesArray* fSttCollection; //! Hit collection
  106. TLorentzVector fpostot; //! global frame hit position (in)// da cancellare
  107. TLorentzVector fpostotin; //! global frame hit position (in)// da cancellare
  108. TLorentzVector fpostotout; //! global frame hit position (in)// da cancellare
  109. /** Private method AddHit
  110. **
  111. ** Adds a FairTrdPoint to the HitCollection
  112. **/
  113. CbmSttPoint* AddHit(Int_t trackID, Int_t detID, TVector3 pos,
  114. TVector3 posInLocal, TVector3 posOutLocal,
  115. TVector3 momIn, TVector3 momOut, TVector3 wireDir,
  116. Double_t time, Double_t length, Double_t eLoss, Double_t mass, TVector3 postot); // da cancellare postot
  117. string GetStringPart(string &aSrc, Int_t part, char aDelim);
  118. bool Split(string &aDest, string &aSrc, char aDelim);
  119. /** Private method ResetParameters
  120. **
  121. ** Resets the private members for the track parameters
  122. **/
  123. void ResetParameters();
  124. Bool_t InitProcessHits();
  125. /** Private method GetSquaredDistanceFromWire
  126. **
  127. ** Returns the square of the distance of the current trackpoint to the wire
  128. *@return distance
  129. **/
  130. float GetSquaredDistanceFromWire();
  131. ClassDef(CbmStt,2)
  132. };
  133. inline void CbmStt::ResetParameters() {
  134. fTrackID = fVolumeID = 0;
  135. fPos.SetXYZM(0.0, 0.0, 0.0, 0.0);
  136. fPosInLocal.SetXYZM(0.0, 0.0, 0.0, 0.0);
  137. fPosOutLocal.SetXYZM(0.0, 0.0, 0.0, 0.0);
  138. fMomIn.SetXYZM(0.0, 0.0, 0.0, 0.0);
  139. fMomOut.SetXYZM(0.0, 0.0, 0.0, 0.0);
  140. fTime = fLength = fELoss = 0;
  141. fPosIndex = 0;
  142. fpostot.SetXYZM(0.0, 0.0, 0.0, 0.0); // da cancellare
  143. };
  144. #endif