| 8 | #include <TObject.h> | #include <TObject.h> | 
| 9 | #include <TObjArray.h> | #include <TObjArray.h> | 
| 10 | #include <TClonesArray.h> | #include <TClonesArray.h> | 
| 11 |  | #include <TRefArray.h> | 
| 12 |  | #include <TRef.h> | 
| 13 |  |  | 
| 14 | #include <TrkStruct.h> | #include <TrkStruct.h> | 
| 15 |  | #include <TrkLevel1.h> | 
| 16 |  |  | 
| 17 | // z-coordinate of track state-vector reference-plane | // z-coordinate of track state-vector reference-plane | 
| 18 | #define ZINI 23.5 | #define ZINI 23.5 | 
| 19 | // upper and lower (mechanical) z-coordinate of the tracker | // upper and lower (mechanical) z-coordinate of the tracker | 
| 20 | #define ZTRKUP 22.29 | //#define ZTRKUP 22.29 | 
| 21 | #define ZTRKDW -22.22 | //#define ZTRKDW -22.22 | 
| 22 |  | // (mechanical) z-coordinate of the tracker planes | 
| 23 |  | #define ZTRK6 -22.23 | 
| 24 |  | #define ZTRK5 -13.32 | 
| 25 |  | #define ZTRK4 -4.42 | 
| 26 |  | #define ZTRK3 4.48 | 
| 27 |  | #define ZTRK2 13.38 | 
| 28 |  | #define ZTRK1 22.28 | 
| 29 |  | // (mechanical) x/y-coordinates of magnet cavity | 
| 30 |  | #define XTRKL -8.1 | 
| 31 |  | #define XTRKR  8.1 | 
| 32 |  | #define YTRKL -6.6 | 
| 33 |  | #define YTRKR  6.6 | 
| 34 |  |  | 
| 35 | /** | /** | 
| 36 | * \brief Class to describe, by points, a particle trajectory in the apparatus. | * \brief Class to describe, by points, a particle trajectory in the apparatus. | 
| 57 | Trajectory(int n, float* pz); | Trajectory(int n, float* pz); | 
| 58 | void Dump(); | void Dump(); | 
| 59 |  |  | 
| 60 |  | int DoTrack2(float* al); | 
| 61 | float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;}; | float GetLength(){float l=0; for(int i=0; i<npoint;i++)l=l+tl[i]; return l;}; | 
| 62 | float GetLength(int,int); | float GetLength(int,int); | 
| 63 |  |  | 
| 64 | ClassDef(Trajectory,1); | ClassDef(Trajectory,2); | 
| 65 |  |  | 
| 66 | }; | }; | 
| 67 | /** | /** | 
| 76 |  |  | 
| 77 | private: | private: | 
| 78 |  |  | 
| 79 |  | int   seqno;           ///<stored track sequential number | 
| 80 |  | int   image;           ///<sequential number of track-image | 
| 81 |  |  | 
| 82 |  |  | 
| 83 | public: | public: | 
| 84 |  |  | 
| 85 |  | //      TRef clx[6]; | 
| 86 |  | //      TRef cly[6]; | 
| 87 |  | TRefArray *clx; | 
| 88 |  | TRefArray *cly; | 
| 89 |  |  | 
| 90 | float al[5];           ///<TRACK STATE VECTOR | float al[5];           ///<TRACK STATE VECTOR | 
| 91 | float coval[5][5];     ///<covariance matrix | float coval[5][5];     ///<covariance matrix | 
| 92 | int   xgood[6];        ///<mask of included x planes | int   xgood[6];        ///<mask of included x planes | 
| 97 | float resx[6];         ///<spatial resolution on X view | float resx[6];         ///<spatial resolution on X view | 
| 98 | float resy[6];         ///<spatial resolution on y view | float resy[6];         ///<spatial resolution on y view | 
| 99 | float chi2;            ///<chi2 | float chi2;            ///<chi2 | 
| 100 |  | int   nstep;           ///<n. step | 
| 101 | float xv[6];           ///<calculated x coordinates | float xv[6];           ///<calculated x coordinates | 
| 102 | float yv[6];           ///<calculated y coordinates | float yv[6];           ///<calculated y coordinates | 
| 103 | float zv[6];           ///<calculated z coordinates | float zv[6];           ///<calculated z coordinates | 
| 105 | float ayv[6];          ///<calculated angles (deg) on y view | float ayv[6];          ///<calculated angles (deg) on y view | 
| 106 | float dedx_x[6];       ///<signal in MIP (scaled to 300 micrometer) | float dedx_x[6];       ///<signal in MIP (scaled to 300 micrometer) | 
| 107 | float dedx_y[6];       ///<signal in MIP (scaled to 300 micrometer) | float dedx_y[6];       ///<signal in MIP (scaled to 300 micrometer) | 
| 108 | int   image;           ///<flag to tag track-images |  | 
| 109 |  |  | 
| 110 | TrkTrack(); | TrkTrack(); | 
| 111 | TrkTrack(const TrkTrack&); | TrkTrack(const TrkTrack&); | 
| 112 |  |  | 
| 113 |  | ~TrkTrack(){Delete();}; | 
| 114 |  |  | 
| 115 | void Dump(); | void Dump(); | 
| 116 |  | void Clear(); | 
| 117 |  | void Delete(); | 
| 118 |  |  | 
| 119 |  | Int_t  GetSeqNo(){return seqno;}        ///< Returns the track sequential number | 
| 120 |  | Int_t  GetImageSeqNo(){return image;}   ///< Returns the track image sequential number | 
| 121 | Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image | Bool_t HasImage(){return !(image==-1);} ///< Returns true if the track has an image | 
| 122 | int DoTrack(Trajectory* t);                         ///< Evaluates the trajectory in the apparatus. | int DoTrack(Trajectory* t);                         ///< Evaluates the trajectory in the apparatus. | 
| 123 | int DoTrack2(Trajectory* t);                        ///< Evaluates the trajectory in the apparatus. | int DoTrack2(Trajectory* t);                        ///< Evaluates the trajectory in the apparatus. | 
| 124 | float BdL(){return 0;};                                     ///< Evaluates the integral of B*dL along the track. | float BdL(){return 0;};                                     ///< Evaluates the integral of B*dL along the track. | 
| 125 | Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=xgood[i]; return n;}; | Int_t GetNX(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=xgood[i]; return n;}; | 
| 126 | Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=ygood[i]; return n;}; | Int_t GetNY(){Int_t n=0; for(Int_t i=0; i<6; i++)n+=ygood[i]; return n;}; | 
| 127 |  | Int_t GetNtot(){return GetNX()+GetNY();}; | 
| 128 | Float_t GetRigidity(); | Float_t GetRigidity(); | 
| 129 | Float_t GetDeflection(); | Float_t GetDeflection(); | 
| 130 | Float_t GetDEDX(); | Float_t GetDEDX(); | 
| 131 |  | Float_t GetDEDX(Int_t ip){if( !(xgood[ip]+ygood[ip]) ) return 0; return (dedx_x[ip]+dedx_y[ip])/(xgood[ip]+ygood[ip]);}; | 
| 132 |  | // sono un'imbecille... assegno xm e ym anche quando si tratta di un singolo | 
| 133 |  | // non posso quindi usare xm e ym per dire se una vista e` inclusa nel fit o no | 
| 134 |  | /*      Bool_t XGood(int ip){ return xm[ip] != -100.;}; | 
| 135 |  | Bool_t YGood(int ip){ return ym[ip] != -100.;};*/ | 
| 136 |  | Bool_t XGood(int ip){ return xgood[ip]==1;}; | 
| 137 |  | Bool_t YGood(int ip){ return ygood[ip]==1;}; | 
| 138 |  |  | 
| 139 |  | void SetMeasure(double *xmeas, double *ymeas, double *zmeas); | 
| 140 |  | void SetResolution(double *rx, double *ry); | 
| 141 |  | void SetGood(int *xg, int *yg); | 
| 142 |  | void LoadField(TString s); | 
| 143 |  | void Fit(double pfixed, int& fail, int iprint); | 
| 144 |  | void FitReset(); | 
| 145 |  |  | 
| 146 |  | void FillMiniStruct(cMini2track&); | 
| 147 |  | void SetFromMiniStruct(cMini2track*); | 
| 148 |  |  | 
| 149 |  | TrkCluster *GetClusterX(int ip){TrkCluster *pt = (TrkCluster*)(clx->At(ip)); return pt;}; | 
| 150 |  | TrkCluster *GetClusterY(int ip){TrkCluster *pt = (TrkCluster*)(cly->At(ip)); return pt;}; | 
| 151 |  |  | 
| 152 | TrkTrack* GetTrkTrack(){return this;}; | TrkTrack* GetTrkTrack(){return this;}; | 
| 153 |  |  | 
| 154 | ClassDef(TrkTrack,1); | friend class TrkLevel2; | 
| 155 |  |  | 
| 156 |  | ClassDef(TrkTrack,2); | 
| 157 |  |  | 
| 158 | }; | }; | 
| 159 | /** | /** | 
| 164 | class TrkSinglet : public TObject { | class TrkSinglet : public TObject { | 
| 165 |  |  | 
| 166 | private: | private: | 
| 167 |  |  | 
| 168 |  |  | 
| 169 | public: | public: | 
| 170 |  |  | 
| 171 |  | TRef cls; | 
| 172 |  |  | 
| 173 | int plane;       ///<plane | int plane;       ///<plane | 
| 174 | float coord[2];  ///<coordinate (on sensor 1 and 2) | float coord[2];  ///<coordinate (on sensor 1 and 2) | 
| 178 | TrkSinglet(const TrkSinglet&); | TrkSinglet(const TrkSinglet&); | 
| 179 |  |  | 
| 180 | void Dump(); | void Dump(); | 
| 181 |  |  | 
| 182 |  | TrkCluster *GetCluster(){TrkCluster *pt = (TrkCluster*)cls.GetObject(); return pt;}; | 
| 183 |  |  | 
| 184 | ClassDef(TrkSinglet,1); | friend class TrkLevel2; | 
| 185 |  |  | 
| 186 |  | ClassDef(TrkSinglet,2); | 
| 187 |  |  | 
| 188 | }; | }; | 
| 189 |  |  | 
| 201 | class TrkLevel2 : public TObject { | class TrkLevel2 : public TObject { | 
| 202 |  |  | 
| 203 | private: | private: | 
| 204 |  |  | 
| 205 |  | //      TRefArray    *PhysicalTrack;  ///< physical tracks (no image) - | 
| 206 |  |  | 
| 207 | public: | public: | 
| 208 |  |  | 
| 209 |  | Int_t         good[12];       ///< event status | 
| 210 |  | //      Int_t good2; | 
| 211 | Int_t good2; | //    Int_t crc[12]; | 
|  | Int_t crc[12]; |  | 
| 212 |  |  | 
| 213 | TClonesArray *Track;        ///< fitted tracks | TClonesArray *Track;        ///< fitted tracks | 
| 214 | TClonesArray *SingletX;     ///< x singlets | TClonesArray *SingletX;     ///< x singlets | 
| 216 |  |  | 
| 217 | TrkLevel2(); | TrkLevel2(); | 
| 218 | //    TrkLevel2(cTrkLevel2 *); | //    TrkLevel2(cTrkLevel2 *); | 
| 219 |  | ~TrkLevel2(){Delete();}; | 
| 220 | int ntrk(){return Track->GetEntries();}     ///< number of stored track |  | 
| 221 |  | void Clear(); | 
| 222 |  | void Delete(); | 
| 223 |  |  | 
| 224 |  | int ntrk() {return Track->GetEntries();}    ///< number of stored track | 
| 225 | int nclsx(){return SingletX->GetEntries();} ///< number of x singlets | int nclsx(){return SingletX->GetEntries();} ///< number of x singlets | 
| 226 | int nclsy(){return SingletY->GetEntries();} ///< number of y singlets | int nclsy(){return SingletY->GetEntries();} ///< number of y singlets | 
| 227 |  |  | 
| 228 | void Dump(); | void Dump(); | 
| 229 | void FillCommonVar(cTrkLevel2 *); | void SetFromLevel2Struct(cTrkLevel2 *); | 
| 230 | void Clear(); | void SetFromLevel2Struct(cTrkLevel2 *, TrkLevel1 *); | 
| 231 | void LoadField(TString); | void GetLevel2Struct(cTrkLevel2 *) const; | 
| 232 |  | void LoadField(TString); | 
| 233 | TrkTrack *GetStoredTrack(int i); | Float_t GetZTrk(Int_t); | 
| 234 | TClonesArray *GetTracks(); | Float_t GetXTrkLeft(){return XTRKL;}; | 
| 235 |  | Float_t GetXTrkRight(){return XTRKR;}; | 
| 236 | int GetNTracks(){return this->GetTracks()->GetEntries();} | Float_t GetYTrkLeft(){return YTRKL;}; | 
| 237 |  | Float_t GetYTrkRight(){return YTRKR;}; | 
| 238 |  |  | 
| 239 |  | TrkSinglet   *GetSingletX(int); | 
| 240 |  | TrkSinglet   *GetSingletY(int); | 
| 241 |  |  | 
| 242 |  | TrkTrack     *GetStoredTrack(int i); | 
| 243 |  | Int_t         GetSeqNo(Int_t i)  {return (((TrkTrack *)Track->At(i))->seqno);}; ///< Returns track sequential number | 
| 244 |  | //    TClonesArray *GetTracks_Chi2Sorted(); | 
| 245 |  | //    TClonesArray *GetTracks_NFitSorted(); | 
| 246 |  | //    TClonesArray *GetTracks(); | 
| 247 |  | TRefArray *GetTracks_NFitSorted(); | 
| 248 |  | TRefArray *GetTracks(){return this->GetTracks_NFitSorted();}; | 
| 249 |  |  | 
| 250 |  | //    int       GetNTracks(){return this->GetTracks()->GetEntries();} | 
| 251 |  | Int_t     GetNTracks(); | 
| 252 | TrkTrack* GetTrack(int i); | TrkTrack* GetTrack(int i); | 
| 253 | TrkTrack* GetTrackImage(int i); | TrkTrack* GetTrackImage(int i); | 
| 254 |  |  | 
| 255 | TrkLevel2* GetTrkLevel2(){return this;} | TrkLevel2*    GetTrkLevel2(){return this;} | 
| 256 |  | TClonesArray* GetTrackArray(){return Track;};///< returns pointer to the track array | 
| 257 | ClassDef(TrkLevel2,1); |  | 
| 258 |  | ClassDef(TrkLevel2,2); | 
| 259 |  |  | 
| 260 | }; | }; | 
| 261 |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
| 262 | #endif | #endif |