/[PAMELA software]/PamVMC_update/trk/include/PamVMCTrkF77GpsSpe.h
ViewVC logotype

Contents of /PamVMC_update/trk/include/PamVMCTrkF77GpsSpe.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Oct 15 15:51:27 2013 UTC (11 years, 1 month ago) by formato
Branch point for: MAIN, rel
File MIME type: text/plain
Initial revision

1 #ifndef PAMVMCTRK_F77_GPSSPE
2 #define PAMVMCTRK_F77_GPSSPE
3
4 #include <TObject.h>
5 #include <TClonesArray.h>
6 #include "PamRootManager.h"
7 #include <iostream>
8
9 using std::cout;
10 using std::endl;
11 // structures for C++ <=> COMMON data exchange
12
13 #define maxstr 5000
14
15 struct cGPSSPE {
16 Int_t nstrpx;
17 Int_t nstrpy;
18 Int_t istripx[maxstr];
19 Int_t istripy[maxstr];
20 Float_t qstripx[maxstr];
21 Float_t qstripy[maxstr];
22 Float_t xstripx[maxstr];
23 Float_t ystripy[maxstr];
24 Int_t npstripx[maxstr];
25 Int_t npstripy[maxstr];
26 Int_t ntstripx[maxstr];
27 Int_t ntstripy[maxstr];
28 } ;
29
30 extern "C" {
31 extern struct cGPSSPE gpsspe_;
32 }
33
34 class GPSSPEData: public TObject {
35
36 public:
37
38 Int_t fistrip;
39 Float_t fqstrip;
40 Float_t fstripc;
41 Int_t fnpstrip;
42 Int_t fntstrip;
43
44 GPSSPEData(){fistrip=fnpstrip=fntstrip=0; fqstrip=fstripc=0.;}
45
46 virtual ~GPSSPEData(){; };
47
48 void Clean(){fistrip=fnpstrip=fntstrip=0; fqstrip=fstripc=0.;}
49
50 void Clear(Option_t * = "") { this->~GPSSPEData(); }
51
52 void Print(Option_t * ="" ) const {
53 cout<<" ISTRIP: " <<fistrip<<" (Strip ID in all plane)"<<endl
54 <<" QSTRIP: " <<fqstrip<<" (ADC value in strip)"<<endl
55 <<" CSTRIP: " <<fstripc<<" (Strip coordinate)"<<endl
56 <<" NPSTRIP: " <<fnpstrip<<" (Plane No)"<<endl
57 <<" NTSTRIP: " <<fntstrip<<" (Sensor No)"<<endl;
58 }
59
60 ClassDef(GPSSPEData,1);
61 };
62
63 class pGPSSPEHits{
64
65 private:
66
67 Int_t fnstrpx;
68 Int_t fnstrpy;
69 TClonesArray * fGPSSPEDataXColl;
70 TClonesArray * fGPSSPEDataYColl;
71
72 public:
73
74 pGPSSPEHits():fnstrpx(0), fnstrpy(0){
75 fGPSSPEDataXColl = new TClonesArray("GPSSPEData",1000);
76 fGPSSPEDataYColl = new TClonesArray("GPSSPEData",1000);
77 }
78
79 virtual ~pGPSSPEHits(){ delete fGPSSPEDataYColl; delete fGPSSPEDataXColl; }
80
81 void Clean() {
82 fnstrpx=fnstrpy=0;
83 (*fGPSSPEDataXColl).Clear("C");
84 (*fGPSSPEDataYColl).Clear("C");
85 }
86
87 void Clear( Option_t * = "") { Clean(); }
88
89 void Compress(){
90 fGPSSPEDataXColl->Compress();
91 fGPSSPEDataYColl->Compress();
92 }
93
94 GPSSPEData * CreateXHit(Int_t flag){
95 if(!fGPSSPEDataXColl->At(flag)){
96 return (GPSSPEData *)fGPSSPEDataXColl->New(flag);
97 }
98 return (GPSSPEData *)fGPSSPEDataXColl->At(flag);
99 }
100
101 GPSSPEData * CreateYHit(Int_t flag){
102 if(!fGPSSPEDataYColl->At(flag)){
103 return (GPSSPEData *)fGPSSPEDataYColl->New(flag);
104 }
105 return (GPSSPEData *)fGPSSPEDataYColl->At(flag);
106 }
107
108 Int_t GetNXHit(){ return fnstrpx; }
109
110 Int_t GetNYHit(){ return fnstrpy; }
111
112 GPSSPEData * GetXHit(Int_t flag){
113 if(fGPSSPEDataXColl->At(flag)){
114 GPSSPEData * hit = (GPSSPEData *)fGPSSPEDataXColl->At(flag);
115 return hit;
116 }
117 cout<<"Tracker GPSSPE_X Hit at "<<flag<<" is empry"<<endl;
118 return 0;
119 }
120
121 GPSSPEData * GetYHit(Int_t flag){
122 if(fGPSSPEDataYColl->At(flag)){
123 GPSSPEData * hit = (GPSSPEData *)fGPSSPEDataYColl->At(flag);
124 return hit;
125 }
126 cout<<"Tracker GPSSPE_Y Hit at "<<flag<<" is empry"<<endl;
127 return 0;
128 }
129
130 void SetData(cGPSSPE * c){
131
132 fnstrpx=c->nstrpx;
133 fnstrpy=c->nstrpy;
134 for (Int_t i=0; i<fnstrpx; i++){
135 GPSSPEData *hx = CreateXHit(i);
136 hx->fqstrip=c->qstripx[i];
137 hx->fstripc=c->xstripx[i];
138 hx->fnpstrip=c->npstripx[i];
139 hx->fntstrip=c->ntstripx[i];
140 hx->fistrip=c->istripx[i];
141 }
142 for (Int_t i=0; i<fnstrpy; i++){
143 GPSSPEData *hy = CreateYHit(i);
144 hy->fqstrip=c->qstripy[i];
145 hy->fstripc=c->ystripy[i];
146 hy->fnpstrip=c->npstripy[i];
147 hy->fntstrip=c->ntstripy[i];
148 hy->fistrip=c->istripy[i];
149 }
150
151 }
152
153 void Print(Option_t * ="" ) const
154 { cout << "pGPSSPEHitData: "<<endl
155 <<"NSTRPX Number of hits (X View):" << fnstrpx
156 <<" NSTRPY Number of hits (Y View):" << fnstrpy << endl;
157 for (Int_t i=0; i<fnstrpx; i++){
158 cout<<"HIT #" << i << " (X View):" << endl;
159 GPSSPEData * hx = (GPSSPEData *)fGPSSPEDataXColl->At(i);
160 if(hx) hx->Print();
161 }
162 for (Int_t i=0; i<fnstrpy; i++){
163 cout<<"HIT #" << i << " (Y View):" << endl;
164 GPSSPEData * hy = (GPSSPEData *)fGPSSPEDataYColl->At(i);
165 if (hy) hy->Print();
166 }
167 }
168
169 ClassDef(pGPSSPEHits,1)
170
171 };
172
173 #endif
174

  ViewVC Help
Powered by ViewVC 1.1.23