CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
bak_ReadCosmicRayData-00-00-09/src/TestMapping.cxx
Go to the documentation of this file.
1// **************************************************************************
2// authors: L. Lavezzi (univ. of Torino & INFN, Italy)
3//
4
5//include system lib
6#include <iostream>
7#include <iomanip>
8#include <string>
9#include <cmath>
10
11// Include files
12#include "GaudiKernel/AlgFactory.h"
13#include "GaudiKernel/DataObject.h"
14#include "GaudiKernel/IEventProcessor.h"
15
16#include "GaudiKernel/Incident.h"
17#include "GaudiKernel/IIncidentSvc.h"
18#include "GaudiKernel/Memory.h"
19
20#include <csignal>
21
22// for save digit & cluster
23#include "GaudiKernel/ISvcLocator.h"
24#include "GaudiKernel/IDataProviderSvc.h"
25#include "GaudiKernel/Bootstrap.h"
26#include "GaudiKernel/RegistryEntry.h"
27#include "GaudiKernel/MsgStream.h"
28
29#include "CgemRawEvent/CgemDigi.h"
30#include "CgemRecEvent/RecCgemCluster.h"
31
32#include "Identifier/CgemID.h"
33#include "RawEvent/RawDataUtil.h"
34#include "RawEvent/DigiEvent.h"
35#include "ReconEvent/ReconEvent.h"
36#include "EventModel/EventHeader.h"
37#include "GaudiKernel/SmartDataPtr.h"
38
39#include "ReadCosmicRayData/TestMapping.h"
40#include "TMath.h"
41//using namespace std;
42
43
44TestMapping::TestMapping(const std::string& name, ISvcLocator* pSvcLocator):
45 Algorithm(name,pSvcLocator){
46
47 declareProperty("CosmicRayDataSetID", CosmicRayDataSetID = "CR201909");
48}
49
52 MsgStream log(msgSvc(), name());
53 log << MSG::INFO << "TestMapping initialize()" << endreq;
54
55 StatusCode sc = service("CgemGeomSvc", m_geomSvc);
56 if(sc != StatusCode::SUCCESS) {
57 log << MSG::ERROR << "can not use CgemGeomSvc" << endreq;
58 return StatusCode::FAILURE;
59 }
60
61 output = new TFile("Mappingtest_histo.root", "RECREATE");
62
63 bool iscgemboss = PositionCgemBoss();
64 bool isGRAAL = PositionGRAAL();
65
66
67 return StatusCode::SUCCESS;
68}
69
70
72 MsgStream log(msgSvc(), name());
73 cout << "->TestMapping::execute" << endl;
74 cout << "geomtry service pointer " << m_geomSvc << endl;
75 return StatusCode::SUCCESS;
76}
77
78
80 const int nlayer = 3; // CHECK hardcoded
81 const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded
82 const int nview = 2;
83 const int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded
84
85 for(int ilayer = 0; ilayer < nlayer; ilayer++) {
86 for(int isheet = 0; isheet < nsheet[ilayer]; isheet++) {
87
88 CgemGeoReadoutPlane* anode = m_geomSvc->getReadoutPlane(ilayer, isheet);
89 int layerid = anode->getLayerId();
90 int sheetid = anode->getSheetId();
91 int nxstrip = anode->getNXstrips();
92 int nvstrip = anode->getNVstrips();
93 double anode_radius_x = anode->getRX();
94 double anode_radius_v = anode->getRV();
95
96 for(int iview = 0; iview < nview; iview++) {
97
98 int nstrip = nxstrip;
99 if(iview==1) nstrip = nvstrip;
100
101 for(int istrip=0; istrip < nstrip; istrip++) {
102 const Identifier ident = CgemID::strip_id(layerid, sheetid, iview, istrip);
103
104 // output
105 bool isxstrip = CgemID::is_xstrip(ident);
106 int stripid = CgemID::strip(ident);
107
108 if(isxstrip==true) {
109 double s = anode->getCentralXFromXID(stripid);
110 double phi = anode->getPhiFromXID(stripid);
111
112 if(layerid==0) {
113 stripid_L1_x[istrip] = stripid;
114 s_L1_S1[istrip] = s;
115 phi_L1_S1[istrip] = phi;
116 }
117 else if(layerid==1 && sheetid==0) {
118 stripid_L2_x[istrip] = stripid;
119 s_L2_S1[istrip] = s;
120 phi_L2_S1[istrip] = phi;
121 }
122 else if(layerid==1 && sheetid==1) {
123 s_L2_S2[istrip] = s;
124 phi_L2_S2[istrip] = phi;
125 }
126 else if(layerid==2 && sheetid==0) {
127 stripid_L3_x[istrip] = stripid;
128 s_L3_S1[istrip] = s;
129 phi_L3_S1[istrip] = phi;
130 }
131 else if(layerid==2 && sheetid==1) {
132 s_L3_S2[istrip] = s;
133 phi_L3_S2[istrip] = phi;
134 }
135 }
136 else {
137 double v = anode->getCentralVFromVID(stripid);
138
139 if(layerid==0) {
140 stripid_L1_v[istrip] = stripid;
141 v_L1_S1[istrip] = v;
142 }
143 else if(layerid==1 && sheetid==0) {
144 stripid_L2_v[istrip] = stripid;
145 v_L2_S1[istrip] = v;
146 }
147 else if(layerid==1 && sheetid==1) v_L2_S2[istrip] = v;
148 else if(layerid==2 && sheetid==0) {
149 stripid_L3_v[istrip] = stripid;
150 v_L3_S1[istrip] = v;
151 }
152 else if(layerid==2 && sheetid==1) v_L3_S2[istrip] = v;
153 }
154 }
155 }
156 }
157 }
158
159 return true;
160}
161
163
164
165 if(CosmicRayDataSetID=="CR201909") {
166
167 const int nlayer = 3; // CHECK hardcoded
168 const int nsheet[nlayer] = {1, 2, 2}; // CHECK hardcoded
169 const int nview = 2;
170 const int nstrip[nlayer][nview] = {{856, 1173}, {630, 1077}, {832, 1395}}; // CHECK hardcoded
171
172 double pitch = 0.660; // CHECK
173 double anode_radius[3] = {90., 132.5, 175};
174 double overlap_gap[3] = {0.407, 0.32, 0.415};
175
176 double phi;
177 for(int ilayer = 0; ilayer < nlayer; ilayer++) {
178 for(int iview = 0; iview < nview; iview++) {
179 int ntot = nstrip[ilayer][iview] * nsheet[ilayer];
180
181 for(int istrip = 0; istrip < ntot; istrip++) {
182 int stripid = istrip+1;
183
184 if(iview==0) {
185 phi = TMath::TwoPi() - (pitch/anode_radius[ilayer]) * stripid;
186 double x = cos(phi) * anode_radius[ilayer];
187 double z = sin(phi) * anode_radius[ilayer];
188 double phi_corr = TMath::Pi() - phi;
189
190 if(ilayer==0) {
191 stripid_L1_x_GRAAL[istrip] = stripid;
192 x_L1_GRAAL[istrip] = x;
193 z_L1_GRAAL[istrip] = z;
194 phi_L1_GRAAL[istrip] = phi;
195 phi_L1_GRAAL_corr[istrip] = phi_corr;
196 }
197 else if(ilayer==1) {
198 stripid_L2_x_GRAAL[istrip] = stripid;
199 x_L2_GRAAL[istrip] = x;
200 z_L2_GRAAL[istrip] = z;
201 phi_L2_GRAAL[istrip] = phi;
202 phi_L2_GRAAL_corr[istrip] = phi_corr;
203 }
204 else if(ilayer==2) {
205 stripid_L3_x_GRAAL[istrip] = stripid;
206 x_L3_GRAAL[istrip] = x;
207 z_L3_GRAAL[istrip] = z;
208 phi_L3_GRAAL[istrip] = phi;
209 phi_L3_GRAAL_corr[istrip] = phi_corr;
210 }
211 }
212 else {
213 // ......
214 }
215 }
216 }
217 }
218
219
220 return true;
221 }
222
223 return false;
224}
225
227 MsgStream log(msgSvc(),name());
228 log << MSG::INFO << "TestMapping finalize()" << endreq;
229
230 gs_L1_S1 = new TGraph(nstrip_L1_x, stripid_L1_x, s_L1_S1);
231 gphi_L1_S1 = new TGraph(nstrip_L1_x, stripid_L1_x, phi_L1_S1);
232 gv_L1_S1 = new TGraph(nstrip_L1_v, stripid_L1_v, v_L1_S1);
233
234 gs_L2_S1 = new TGraph(nstrip_L2_x, stripid_L2_x, s_L2_S1);
235 gphi_L2_S1 = new TGraph(nstrip_L2_x, stripid_L2_x, phi_L2_S1);
236 gv_L2_S1 = new TGraph(nstrip_L2_v, stripid_L2_v, v_L2_S1);
237 gs_L2_S2 = new TGraph(nstrip_L2_x, stripid_L2_x, s_L2_S2);
238 gphi_L2_S2 = new TGraph(nstrip_L2_x, stripid_L2_x, phi_L2_S2);
239 gv_L2_S2 = new TGraph(nstrip_L2_v, stripid_L2_v, v_L2_S2);
240
241 gs_L3_S1 = new TGraph(nstrip_L3_x, stripid_L3_x, s_L3_S1);
242 gphi_L3_S1 = new TGraph(nstrip_L3_x, stripid_L3_x, phi_L3_S1);
243 gv_L3_S1 = new TGraph(nstrip_L3_v, stripid_L3_v, v_L3_S1);
244 gs_L3_S2 = new TGraph(nstrip_L3_x, stripid_L3_x, s_L3_S2);
245 gphi_L3_S2 = new TGraph(nstrip_L3_x, stripid_L3_x, phi_L3_S2);
246 gv_L3_S2 = new TGraph(nstrip_L3_v, stripid_L3_v, v_L3_S2);
247
248 gs_L1_S1->SetName("gs_L1_S1");
249 gphi_L1_S1->SetName("gphi_L1_S1");
250 gv_L1_S1->SetName("gv_L1_S1");
251
252 gs_L2_S1->SetName("gs_L2_S1");
253 gphi_L2_S1->SetName("gphi_L2_S1");
254 gv_L2_S1->SetName("gv_L2_S1");
255 gs_L2_S2->SetName("gs_L2_S2");
256 gphi_L2_S2->SetName("gphi_L2_S2");
257 gv_L2_S2->SetName("gv_L2_S2");
258
259 gs_L3_S1->SetName("gs_L3_S1");
260 gphi_L3_S1->SetName("gphi_L3_S1");
261 gv_L3_S1->SetName("gv_L3_S1");
262 gs_L3_S2->SetName("gs_L3_S2");
263 gphi_L3_S2->SetName("gphi_L3_S2");
264 gv_L3_S2->SetName("gv_L3_S2");
265
266 gs_L1_S1->Write();
267 gphi_L1_S1->Write();
268 gv_L1_S1->Write();
269
270 gs_L2_S1->Write();
271 gphi_L2_S1->Write();
272 gv_L2_S1->Write();
273 gs_L2_S2->Write();
274 gphi_L2_S2->Write();
275 gv_L2_S2->Write();
276
277 gs_L3_S1->Write();
278 gphi_L3_S1->Write();
279 gv_L3_S1->Write();
280 gs_L3_S2->Write();
281 gphi_L3_S2->Write();
282 gv_L3_S2->Write();
283
284 // ----------------------
285 gx_L1_GRAAL = new TGraph(nstrip_L1_x, stripid_L1_x_GRAAL, x_L1_GRAAL);
286 gz_L1_GRAAL = new TGraph(nstrip_L1_x, stripid_L1_x_GRAAL, z_L1_GRAAL);
287 gphi_L1_GRAAL = new TGraph(nstrip_L1_x, stripid_L1_x_GRAAL, phi_L1_GRAAL);
288 gv_L1_GRAAL = new TGraph(nstrip_L1_v, stripid_L1_v_GRAAL, v_L1_GRAAL);
289
290 gx_L2_GRAAL = new TGraph(2*nstrip_L2_x, stripid_L2_x_GRAAL, x_L2_GRAAL);
291 gz_L2_GRAAL = new TGraph(2*nstrip_L2_x, stripid_L2_x_GRAAL, z_L2_GRAAL);
292 gphi_L2_GRAAL = new TGraph(2*nstrip_L2_x, stripid_L2_x_GRAAL, phi_L2_GRAAL);
293 gv_L2_GRAAL = new TGraph(2*nstrip_L2_v, stripid_L2_v_GRAAL, v_L2_GRAAL);
294
295 gx_L3_GRAAL = new TGraph(2*nstrip_L3_x, stripid_L3_x_GRAAL, x_L3_GRAAL);
296 gz_L3_GRAAL = new TGraph(2*nstrip_L3_x, stripid_L3_x_GRAAL, z_L3_GRAAL);
297 gphi_L3_GRAAL = new TGraph(2*nstrip_L3_x, stripid_L3_x_GRAAL, phi_L3_GRAAL);
298 gv_L3_GRAAL = new TGraph(2*nstrip_L3_v, stripid_L3_v_GRAAL, v_L3_GRAAL);
299
300 gx_L1_GRAAL->SetName("gx_L1_GRAAL");
301 gz_L1_GRAAL->SetName("gz_L1_GRAAL");
302 gphi_L1_GRAAL->SetName("gphi_L1_GRAAL");
303 gv_L1_GRAAL->SetName("gv_L1_GRAAL");
304
305 gx_L2_GRAAL->SetName("gx_L2_GRAAL");
306 gz_L2_GRAAL->SetName("gz_L2_GRAAL");
307 gphi_L2_GRAAL->SetName("gphi_L2_GRAAL");
308 gv_L2_GRAAL->SetName("gv_L2_GRAAL");
309
310 gx_L3_GRAAL->SetName("gx_L3_GRAAL");
311 gz_L3_GRAAL->SetName("gz_L3_GRAAL");
312 gphi_L3_GRAAL->SetName("gphi_L3_GRAAL");
313 gv_L3_GRAAL->SetName("gv_L3_GRAAL");
314
315 gx_L1_GRAAL->Write();
316 gz_L1_GRAAL->Write();
317 gphi_L1_GRAAL->Write();
318 gv_L1_GRAAL->Write();
319
320 gx_L2_GRAAL->Write();
321 gz_L2_GRAAL->Write();
322 gphi_L2_GRAAL->Write();
323 gv_L2_GRAAL->Write();
324
325 gx_L3_GRAAL->Write();
326 gz_L3_GRAAL->Write();
327 gphi_L3_GRAAL->Write();
328 gv_L3_GRAAL->Write();
329
330 // -----
331 gphi_L1_GRAAL_corr = new TGraph(nstrip_L1_x, stripid_L1_x_GRAAL, phi_L1_GRAAL_corr);
332 gphi_L2_GRAAL_corr = new TGraph(2*nstrip_L2_x, stripid_L2_x_GRAAL, phi_L2_GRAAL_corr);
333 gphi_L3_GRAAL_corr = new TGraph(2*nstrip_L3_x, stripid_L3_x_GRAAL, phi_L3_GRAAL_corr);
334
335 gphi_L1_GRAAL_corr->SetName("gphi_L1_GRAAL_corr");
336 gphi_L2_GRAAL_corr->SetName("gphi_L2_GRAAL_corr");
337 gphi_L3_GRAAL_corr->SetName("gphi_L3_GRAAL_corr");
338
339 gphi_L1_GRAAL_corr->Write();
340 gphi_L2_GRAAL_corr->Write();
341 gphi_L3_GRAAL_corr->Write();
342
343
344
345 output->Write();
346 output->Close();
347
348 return StatusCode::SUCCESS;
349}
350
351
Double_t x[10]
XmlRpcServer s
Definition: HelloServer.cpp:11
double sin(const BesAngle a)
double cos(const BesAngle a)
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
double getPhiFromXID(int X_ID) const
static int strip(const Identifier &id)
static bool is_xstrip(const Identifier &id)
static Identifier strip_id(int f_layer, int f_sheet, int f_strip_type, int f_strip)
virtual CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const =0
TestMapping(const std::string &name, ISvcLocator *pSvcLocator)