StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_pp2pp_Maker.h
1 // $Id: St_pp2pp_Maker.h,v 1.27 2015/11/01 22:58:51 yipkin Exp $
2 
3 #ifndef STAR_St_pp2pp_Maker
4 #define STAR_St_pp2pp_Maker
5 
18 #include "StRTSBaseMaker.h"
19 #include "pp2ppHit_Cluster.h"
20 
21 class TGenericTable;
22 class StEvent;
23 class StRpsCollection;
24 class StRpsRomanPot; // added by Rafal
25 class StRpsTrack; // added by Rafal
26 class StRpsTrackPoint; // added by Rafal
27 
28 class pp2pp_t;
29 class pp2ppOffset_st;
30 class pp2ppZ_st;
31 class pp2ppRPpositions_st;
32 class pp2ppAcceleratorParameters_st;
33 class pp2ppPMTSkewConstants_st;
34 
36 
37  public:
38  enum {ErrorCode = -9999,
39  kMAXSEC = 2 ,
40  kMAXCHAIN = 4 ,
41  kMAXSVX = 6 ,
42  kMAXSEQ = 8 ,
43  kMAXSTRIP = 128 } ;
44 
45  private:
46  StEvent *mEvent ;
47 
48  typedef pair<Int_t, Double_t> HitChannel ;
49 
50  vector<HitChannel> mValidHits[kMAXSEQ][kMAXCHAIN] ;
51  static Bool_t hitcompare (HitChannel A,HitChannel B) { return (A.first<B.first); }
52 
53  Double_t mPedave[kMAXSEQ][kMAXCHAIN][kMAXSVX][kMAXSTRIP] ;
54  Double_t mPedrms[kMAXSEQ][kMAXCHAIN][kMAXSVX][kMAXSTRIP] ;
55 
56  unsigned char mRpStatus[kMAXSEQ] ;
57 
58  Int_t mLastSvx;
59  Int_t mLastChain;
60  Int_t mLastSeq;
61 
62  string mPedestalPerchannelFilename ;
63  Int_t readPedestalPerchannel() ;
64  Int_t readOffsetPerplane() ;
65  Int_t readZPerplane() ;
66  pp2ppOffset_st *mOffsetTable ;
67  pp2ppZ_st *mZTable ;
68  pp2ppRPpositions_st *mRPpositionsTable ;
69  Double_t mLVDT_pos[kMAXSEQ] ;
70 
71  UChar_t mSiliconBunch ;
72 
73  // K. Yip (2015-10-22) : Adding variables for Accelerator and Skew parameters in the respective database ;
74  double mSkew_param[kMAXSEQ][2][4] ; // 4 parameters for each PMT and there are 2 PMT's for each of the 8 RP
75  double mXYZ_IP[3]; /* collision coordinates at the IP; 0=X, 1=Y, 2=Z */
76  double mThetaXY_tilt[2]; /* tilt angles of the beam at collision; 0=X, 1=Y */
77  double mDistanceFromIPtoDX[2]; /* distance from the IP to the DX magnet in the East and West; 0=E, 1=W */
78  double mLDX[2]; /* length of DX in the East and West; 0=E, 1=W */
79  double mBendingAngle[2]; /* DX bending angles in the East and West; 0=E, 1=W */
80  double mConversion_TAC_time ; /* converting the TAC tick to time (second) */
81 
82  // K. Yip (2015-10-22) : Adding methods to read Accelerator and Skew parameters from the respective database ;
83  Int_t readAccelerateParameter() ;
84  Int_t readSkewParameter() ;
85 
86  // Int_t nevt_count ;
87 
88  Bool_t mLDoCluster; // to do clustering or not
89 
90  Int_t mVersion ; // K. Yip (2015-2-22) : to deal with different (years of) data
91 
92  // K. Yip (2015-10-15) : Make constants for the class so that MakeTrack can use, too.
93  // All pitches in meter
94  // For A & C planes
95  const double kpitch_4svx = 9.74E-5;
96  // For E2D.A >= 2015
97  const double kpitch_4svx2 = 9.55E-5;
98  // For B & D planes
99  const double kpitch_6svx = 1.050E-4;
100 
101  public:
102 
103  St_pp2pp_Maker(const char *name="PP2PP") ;
104 
105  virtual ~St_pp2pp_Maker();
106  virtual void Clear(Option_t *option="");
107  virtual Int_t Init();
108  virtual Int_t Make();
109  virtual Int_t Finish();
110 
111 
116  void SetPedestalFileName(const char* filename) { mPedestalPerchannelFilename = filename ; }
117 
122  void DoClusterOrNot(Bool_t todo) { mLDoCluster = todo ; }
123 
129  Int_t DoerPp2pp(const pp2pp_t &d, TGenericTable &hitsTable);
130 
134  Int_t MakeClusters();
135 
139  Int_t MakeTracks(StRpsCollection &RpsColl, float blue_beamenergy, float yellow_beamenergy);
140 
141  virtual Int_t InitRun (int runumber);
142  // virtual Int_t FinishRun(int runumber){return 0;}; // Overload empty StMaker::FinishRun
143 
145  virtual const char *GetCVS() const {
146  static const char cvs[]="Tag $Name: $ $Id: St_pp2pp_Maker.h,v 1.27 2015/11/01 22:58:51 yipkin Exp $ built " __DATE__ " " __TIME__ ;
147  return cvs;
148  }
149 
150  // obtain the whole list of leading edge hits
151  // to obtain the published result use StMaker::GetDataSet("pp2ppRawHits");
152 
153 
154  //BEGIN ------------------------ Rafal's code ------------------------
155  private:
156 
157  enum RP_STATIONS_PER_BRANCH { kRP1, kRP2, kStationsPerBranch };
158  enum SILICON_PLANES_PER_COORDINATE { kFirst, kSecond };
159  enum COORDINATES { kX, kY, kCoordinates, kZ = kCoordinates };
160 
161  // additional constants describing the Roman Pot Phase II* system
162  static const int kBranches = 4; // number of branches in RP system (EU, ED, WU and WD)
163  static const int kPlanesPerCoordinate = kMAXCHAIN/2; // number of Si planes for one spatial coordinate (assumes kMAXCHAIN is even!)
164 
165  // reconstruction parameters
166  static const int kMaxClusterLength = 5;
167  const int kMaxNumberOfClusterPerPlane = 5;
168  const double kMaxPitchesToMatch;
169  static const double kEmin[kMAXSEQ][kMaxClusterLength];
170  const double kMaxPedestalTAC = 100;
171 
172  // handy arrays
173  static const int kPlanes[kCoordinates][kPlanesPerCoordinate];
174  static const int kRpInBranch[kBranches][kStationsPerBranch];
175  const double kPitch[kCoordinates];
176 
177  // structures
178  struct StRpsHit { // structure representing reconstructed coordinate (one) of track-point
179  double mPositionXY;
180  double mPositionZ;
181  int mClusterId[kPlanesPerCoordinate];
182  int mPlanesUsed;
183  bool mGolden;
184  };
185 
186  // methods
187  void formTracks( vector< StRpsTrack* > *, const vector< StRpsTrackPoint* > * , const float, const float ) const;
188  void formTrackPoints(const StRpsCollection &, vector< StRpsTrackPoint* > * ) const;
189  vector<St_pp2pp_Maker::StRpsHit> formHits(const StRpsRomanPot *, const int) const;
190  void preselectClusters(const StRpsRomanPot *, const int coordinate, vector<double>*, vector<int>*, vector<int>*, vector<int>*) const;
191  Int_t classifyClustersCase(vector<double>*) const;
192  Bool_t matchClusters(const int, const int, const vector<double>*, std::vector<int>*) const;
193  Bool_t areMatched(const int, const double, const double, double* = nullptr) const;
194  Double_t timeFromTAC(const int, const int, const int, const int) const;
195 
196  //END ------------------------ Rafal's code ------------------------
197 
198  ClassDef(St_pp2pp_Maker,1) //StAF chain virtual base class for Makers
199 
200 };
201 
202 //BEGIN ------------------------ Rafal's code ------------------------
203 inline Double_t St_pp2pp_Maker::timeFromTAC(const int Rp, const int pmt, const int Tac, const int Adc) const{
204  return mConversion_TAC_time * (Tac + mSkew_param[Rp][pmt][0]
205  + mSkew_param[Rp][pmt][1]*exp(-mSkew_param[Rp][pmt][2]*(Adc-mSkew_param[Rp][pmt][3])) / (Adc-mSkew_param[Rp][pmt][3]) );
206 }
207 //END ------------------------ Rafal's code ------------------------
208 
209 #endif
210 
211 
For pp2pp analysis : mainly to create clusters from raw data silicon hits.
Class StRTSBaseMaker - is an abstract StMaker to define the interface to access the DAQ data from the...
virtual const char * GetCVS() const
Overload empty StMaker::InitRun.
virtual Int_t Make()
Make - this method is called in loop for each event.
Int_t MakeTracks(StRpsCollection &RpsColl, float blue_beamenergy, float yellow_beamenergy)
void SetPedestalFileName(const char *filename)
Int_t DoerPp2pp(const pp2pp_t &d, TGenericTable &hitsTable)
DoerPp2pp - this method is called as soon as next pp2pp record is read in.
virtual Int_t Finish()
4 chains/planes
virtual void Clear(Option_t *option="")
Clear - this method is called in loop for prepare the maker for the next event.
virtual Int_t Init()
Init - is a first method the top level StChain calls to initialize all its makers.
8 sequencers/roman pots
void DoClusterOrNot(Bool_t todo)