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

Contents of /PamVMC/trk/include/PamVMCTrkF77GpsSpe.h~

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Feb 18 17:41:08 2009 UTC (15 years, 9 months ago) by nikolas
Branch: MAIN
Cleaning up before a release

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 1000
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 cout<<c->qstripx[i]<<endl;
137 hx->fqstrip=c->qstripx[i];
138 hx->fstripc=c->xstripx[i];
139 hx->fnpstrip=c->npstripx[i];
140 hx->fntstrip=c->ntstripx[i];
141 hx->fistrip=c->istripx[i];
142 }
143 for (Int_t i=0; i<fnstrpy; i++){
144 GPSSPEData *hy = CreateYHit(i);
145 hy->fqstrip=c->qstripy[i];
146 hy->fstripc=c->ystripy[i];
147 hy->fnpstrip=c->npstripy[i];
148 hy->fntstrip=c->ntstripy[i];
149 hy->fistrip=c->istripy[i];
150 }
151
152 }
153
154 void Print(Option_t * ="" ) const
155 { cout << "pGPSSPEHitData: "<<endl
156 <<"NSTRPX Number of hits (X View):" << fnstrpx
157 <<" NSTRPY Number of hits (Y View):" << fnstrpy << endl;
158 for (Int_t i=0; i<fnstrpx; i++){
159 cout<<"HIT #" << i << " (X View):" << endl;
160 GPSSPEData * hx = (GPSSPEData *)fGPSSPEDataXColl->At(i);
161 if(hx) hx->Print();
162 }
163 for (Int_t i=0; i<fnstrpy; i++){
164 cout<<"HIT #" << i << " (Y View):" << endl;
165 GPSSPEData * hy = (GPSSPEData *)fGPSSPEDataYColl->At(i);
166 if (hy) hy->Print();
167 }
168 }
169
170 ClassDef(pGPSSPEHits,1)
171
172 };
173
174 #endif
175

  ViewVC Help
Powered by ViewVC 1.1.23