BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EventDisplay/BesVisLib/BesVisLib-00-06-02/src/MdcROOTGeo.cxx
Go to the documentation of this file.
1//$id$
2/*
3 * 2004/11/29 Zhengyun You Peking University
4 * Tof Geometry General for EventDisplay
5 *
6 * 2004/12/10 Zhengyun You Peking University
7 * named from MdcGeo to MdcROOTGeo
8 * inherit from class SubDetectorROOTGeo
9 */
10
11using namespace std;
12
13#include <string>
14#include <fstream>
15#include <iostream>
16#include <sstream>
17#include <vector>
18#include <iomanip>
19
20#include <TGeoManager.h>
21#include <TGeoTube.h>
22#include <TGeoArb8.h>
23#include <TMath.h>
24
26#include "Identifier/MdcID.h"
27#include "BesVisLib/BesEvent.h"
28#include "BesVisLib/BesView.h"
30
31const int
32MdcROOTGeo::m_kReplica[m_kLayer] = { 40, 44, 48, 56, 64, 72, 80, 80,
33 76, 76, 88, 88, 100, 100, 112, 112, 128, 128, 140, 140,
34 160, 160, 160, 160, 176, 176, 176, 176, 208, 208, 208, 208, 240, 240, 240, 240,
35 256, 256, 256, 256, 256, 256, 256, 256,
36 288, 288, 288, 288, 288, 288
37 };
38
39const int
40MdcROOTGeo::m_kStereoDir[m_kTrueLayer] = { 1, 1, 1, 1, -1, -1, -1, -1,
41 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1,
43 0, 0, 0, 0, 0, 0, 0
44 };
45const int
46MdcROOTGeo::m_kiCorrectLayer[m_kCorrectLayer] = {9, 11, 13, 15, 17, 19, 36, 38, 40, 42};
47const int
48//MdcROOTGeo::m_kiCorrectReplica[m_kCorrectLayer] = {38, 44, 50, 56, 65, 71, 127, 127, 144, 143};
49MdcROOTGeo::m_kiCorrectReplica[m_kCorrectLayer] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
50
51MdcROOTGeo::MdcROOTGeo(Bool_t cgem_flag) //Long Peixun's update: Add CGEM flag
53{
54 m_MdcColor = 3;
55 m_segmentColor = 0;
56 m_hypeColor = 3;
57 m_tubeColor = 4;
58 //m_twistedTubsColor = kBlue;
59 m_twistedTubsColor = 9; //Long Peixun's update: Blue -> Green, as same as XY View
60 //m_replicaColor = kCyan;
61 m_replicaColor = 8; //Long Peixun's update: Grey -> Blue, as same as XY View
62
63 //Long Peixun's update: According to CGEM flag, set start wire layer
64 if (cgem_flag) m_StartLayer = 8;
65 else m_StartLayer = 0;
66
67 k_TFire = kTRUE;
68 k_QFire = kTRUE;
69 k_QNotOverflow = kFALSE;
70
71 // Default constructor.
72 for (int layer = 0; layer < m_kLayer; layer++) {
73 m_NodeLayer[layer] = 0;
74 for (int replica = 0; replica < m_kReplicaMax; replica++) {
75 m_NodeReplica[layer][replica] = 0;
76 m_PhysicalReplica[layer][replica] = 0;
77 }
78 }
79
80 for (int i = 0; i < m_kCorrectLayer; i++) {
81 m_CorrectMap[m_kiCorrectLayer[i]] = m_kiCorrectReplica[i];
82 }
83
84 for (int layer = 0; layer < m_kTrueLayer; layer++) {
85 for (int replica = 0; replica < m_kReplicaMax; replica++) {
86 m_Mdc2DWire[layer][replica] = 0;
87 }
88 }
89}
90
92{
93 //Long Peixun's update: Add destructor
94 cout << "delete old MdcROOTGeo" << endl;
95 for (Int_t layer = 0; layer < m_kTrueLayer; ++layer)
96 {
97 Int_t simuLayer = GetSimuLayer(layer);
98 for (Int_t replica = 0; replica < m_kReplica[simuLayer]; ++replica)
99 {
100 delete m_Mdc2DWire[layer][replica];
101 }
102 }
103 delete m_MdcXY;
104 delete m_MdcZR[0];
105 delete m_MdcZR[1];
106}
107
108void
109MdcROOTGeo::InitFromGDML(const char *gdmlFile, const char *setupName)
110{
111 m_ROOTGeoInit = 2;
112 ReadGdml(gdmlFile, setupName);
113 SetNode();
114}
115
116void
117MdcROOTGeo::InitFromROOT( TGeoVolume *vol )
118{
119 m_ROOTGeoInit = 1;
120 SetVolumeMdc(vol);
121 SetNode();
122}
123
124void
126{
127 if (m_ROOTGeoInit != 1 && m_ROOTGeoInit != 2) {
128 cout << "MdcROOTGeo::Init2DGeometry, ROOT Geometry not Initialized yet!" << endl;
129 return;
130 }
131
132 m_2DGeoInit = 1;
133 Int_t mdcColor = 11; //1002; // 41, 29
134 Int_t mdcLineColor = 15;
135 Int_t mdcXYStyle = 1001;//3001;
136 Int_t mdcZRStyle = 1001;//3007;
137 Int_t mdcStereoSuperColor = 38;
138 Int_t mdcAxialSuperColor = 4;
139
140 Double_t local[3] = {0.0, 0.0, 0.0};
141 Double_t master[3] = {0.0, 0.0, 0.0};
142 //Int_t nPoints = 4;
143 Double_t P[306] = {0.0}; //Long Peixun's update: 300 -> 306, at most 102 points
144 Double_t center[3] = {0.0, 0.0, 0.0};
145 TString name;
146
147 //----------XY-----------
148 // Mdc
149 TGeoTube *mdcShape = (TGeoTube*)GetVolumeMdc()->GetShape();
150 //Long Peixun's update: Consider CGEM detector
151 Double_t rmin = mdcShape->GetRmin();
152 if (m_StartLayer > 0) //if contains CGEM
153 {
154 TGeoTube *mdcShapeOuter = (TGeoTube*)(GetLayer(m_StartLayer)->GetVolume())->GetShape();
155 rmin = mdcShapeOuter->GetRmin();
156 }
157
158 m_MdcXY = new BesCircle2D("Mdc", "Mdc", rmin, mdcShape->GetRmax(), &center[0]);
159 m_MdcXY->SetNSegment(360);
160 m_MdcXY->SetFillColor(mdcColor);
161 m_MdcXY->SetFillStyle(mdcXYStyle);
162 m_MdcXY->SetLineColor(mdcLineColor);
163
164 //Long Peixun's update: Annotate
165/* // Mdc Supers
166 Int_t layerIn[4] = {0,
167 m_kStereoLayerIn,
168 m_kStereoLayerIn+m_kAxialLayerIn,
169 m_kStereoLayerIn+m_kAxialLayerIn+m_kStereoLayerOut
170 };
171 Int_t layerOut[4] = {m_kStereoLayerIn-1,
172 m_kStereoLayerIn+m_kAxialLayerIn-1,
173 m_kStereoLayerIn+m_kAxialLayerIn+m_kStereoLayerOut-1,
174 m_kLayer-1
175 };
176 for (Int_t i = 0; i < 4; i++) {
177 TGeoTube *mdcSuperShapeIn = (TGeoTube*)(GetLayer(layerIn[i])->GetVolume())->GetShape();
178 TGeoTube *mdcSuperShapeOut = (TGeoTube*)(GetLayer(layerOut[i])->GetVolume())->GetShape();
179 name = TString("MdcSuper" + i);
180 m_MdcXYSuper[i] = new BesCircle2D(name, name, mdcSuperShapeIn->GetRmin(), mdcSuperShapeOut->GetRmax(), &center[0]);
181 if (i%2 == 0) m_MdcXYSuper[i]->SetFillColor(mdcStereoSuperColor);
182 else m_MdcXYSuper[i]->SetFillColor(mdcAxialSuperColor);
183 } */
184
185 // Mdc Wires
186 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
187 for (Int_t layer = m_StartLayer; layer < m_kTrueLayer; layer++) {
188 Int_t simuLayer = GetSimuLayer(layer);
189 for (int replica = 0; replica < m_kReplica[simuLayer]; replica++) {
190 //cout << "layer " << layer << " replica " << replica << endl;
191 TGeoPhysicalNode *wirePhyNode = GetPhysicalReplica(simuLayer, replica);
192 name = TString("Mdc Layer ");
193 name += layer;
194 name += " Wire ";
195 name += replica;
196
197 if (m_kStereoDir[layer] != 0) { // stereo Layer
198 TGeoArb8 *wireShape = (TGeoArb8*)wirePhyNode->GetShape();
199 Double_t *localArb8Point, masterArb8Point[24];
200 localArb8Point = wireShape->GetVertices();
201 for (Int_t i = 0; i < 8; i++) {
202 local[0] = localArb8Point[2*i];
203 local[1] = localArb8Point[2*i+1];
204 if (i < 4) local[2] = wireShape->GetDz() * (-1.0);
205 else local[2] = wireShape->GetDz();
206
207 wirePhyNode->GetMatrix(-1*wirePhyNode->GetLevel())
208 ->LocalToMaster(local, &master[0]); // transform to top
209 for (Int_t j = 0; j < 3; j++) {
210 masterArb8Point[3*i+j] = master[j];
211 }
212 }
213
214 m_Mdc2DWire[layer][replica] = new Mdc2DWire(name, name, 8, &masterArb8Point[0]);
215
216 }
217 else { // axial Layer
218
219 TGeoTubeSeg *wireShape = (TGeoTubeSeg*)wirePhyNode->GetShape();
220
221 Double_t centerR = 0.5*(wireShape->GetRmin() + wireShape->GetRmax());
222 if (layer >= m_kStereoLayerIn+m_kAxialLayerIn+m_kStereoLayerOut)
223 centerR = wireShape->GetRmax();
224 Double_t centerPhi =
225 0.5*(wireShape->GetPhi1() + wireShape->GetPhi2()) * TMath::DegToRad();
226 local[0] = centerR * cos(centerPhi);
227 local[1] = centerR * sin(centerPhi);
228 local[2] = 0.0;
229 wirePhyNode->GetMatrix(-1*wirePhyNode->GetLevel())
230 ->LocalToMaster(local, &master[0]); // transform to top
231
232 Double_t rmin = wireShape->GetRmin();
233 Double_t rmax = wireShape->GetRmax();
234 if (layer >= m_kStereoLayerIn+m_kAxialLayerIn+m_kStereoLayerOut)
235 rmax = rmin + 2*(rmax-rmin);
236 m_Mdc2DWire[layer][replica] =
237 new Mdc2DWire( name, name, rmin, rmax, wireShape->GetDz(),centerPhi, &master[0] );
238 }
239 }
240 }
241
242 //----------ZR-----------
243 // Mdc
244 Int_t iPoint = 0;
245 TGeoTube *aMdcLayer = 0;
246
247 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
248 for (Int_t layer = m_StartLayer; layer < m_kLayer; layer++) {
249 aMdcLayer = (TGeoTube*)GetLayer(layer)->GetVolume()->GetShape();
250 P[3*iPoint] = 0.0;
251 P[3*iPoint+1] = aMdcLayer->GetRmin();
252 P[3*iPoint+2] = aMdcLayer->GetDz();
253 iPoint++;
254 }
255
256 P[3*iPoint] = 0.0;
257 P[3*iPoint+1] = aMdcLayer->GetRmax();
258 P[3*iPoint+2] = aMdcLayer->GetDz();
259 iPoint++;
260 P[3*iPoint] = 0.0;
261 P[3*iPoint+1] = aMdcLayer->GetRmax();
262 P[3*iPoint+2] = aMdcLayer->GetDz() * (-1.0);
263 iPoint++;
264
265 for (Int_t layer = m_kLayer-1; layer >= m_StartLayer; layer--) {
266 aMdcLayer = (TGeoTube*)GetLayer(layer)->GetVolume()->GetShape();
267 P[3*iPoint] = 0.0;
268 P[3*iPoint+1] = aMdcLayer->GetRmin();
269 P[3*iPoint+2] = aMdcLayer->GetDz() * (-1.0);
270 iPoint++;
271 }
272
273
274 m_MdcZR[0] = new BesPolygon2D("MdcZRUp", "MdcZRUp", iPoint, &P[0]);
275
276 for (Int_t i = 0; i < iPoint; i++)
277 P[3*i+1] *= -1.0;
278
279 m_MdcZR[1] = new BesPolygon2D("MdcZRDown", "MdcZRDown", iPoint, &P[0]);
280
281 for (Int_t i = 0; i < 2; i++) {
282 m_MdcZR[i]->SetFillColor(mdcColor);
283 m_MdcZR[i]->SetFillStyle(mdcZRStyle);
284 m_MdcZR[i]->SetLineColor(mdcLineColor);
285 m_MdcZR[i]->SetRotatable(true); //Long Peixun's update
286 }
287}
288
289void
291{
292 if (gDebug) {
293 Int_t nDaughters = m_TopVolume->GetNodes()->GetEntries();
294 cout << "logicalMdc contains " << nDaughters << " nodes : " << endl;
295 for (Int_t i = 0; i < nDaughters; i++) {
296 cout << i << " : " << m_TopVolume->GetNode(i)->GetName() << endl;
297 }
298 }
299
300 if (m_ROOTGeoInit == 2) { // from GDML
301 m_Mdc = GetTopVolume();
302 if (!m_Mdc) std::cout << "m_Mdc = 0" << std::endl;
303
304 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
305 for (int layer = m_StartLayer; layer < m_kLayer; layer++) { // is simuLayer
306 // m_NodeReplica[layer][replica] = m_Mdc->GetNode(layer); // you could take it by id;
307 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
308 std::stringstream osname;
309 int rep = replica;
310 if (layer >= 0 && layer < m_kStereoLayerIn) {
311 //osname << "pv_" << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "TwistedTubs" << "_" << rep;
312 osname << "pv_" << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "Cell" << "_" << rep;
313 }
314 else if (layer >= m_kStereoLayerIn && layer < m_kStereoLayerIn + m_kAxialLayerIn) {
315 rep = CorrectReplica(layer, rep);
316 //osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << layer << "Replica" << "_" << rep;
317 osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << layer << "Cell" << "_" << rep;
318 }
319 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
320 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) {
321 //osname << "pv_" << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "TwistedTubs" << "_" << rep;
322 osname << "pv_" << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "Cell" << "_" << rep;
323 }
324 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut && layer < m_kLayer) {
325 rep = CorrectReplica(layer, rep);
326 Int_t nBeforeAxialLayerOut = m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut;
327 Int_t iTrueLayer = nBeforeAxialLayerOut + (layer - nBeforeAxialLayerOut)/2;
328 if (layer%2 == 0) {
329 //osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << iTrueLayer << "_0" << "Replica" << "_" << rep;
330 osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << iTrueLayer << "_0" << "Cell" << "_" << rep;
331 }
332 else {
333 //osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << iTrueLayer << "_1" << "Replica" << "_" << rep;
334 osname << "pv_" << "logical" << "Mdc" << "Axial" << "Layer" << iTrueLayer << "_1" << "Cell" << "_" << rep;
335 }
336 }
337
338 m_NodeReplica[layer][replica] = GetNode( osname.str() );
339 //cout << osname.str() << endl;
340 }
341 }
342 }
343 else if (m_ROOTGeoInit == 1) { // from ROOT object
344 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
345 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
346 // 0 : logicalMdcStereoLayer0_0 35 : logicalMdcStereoLayer35_35
347 // 36 : logicalMdcAxialLayer36_0_36 37 : logicalMdcAxialLayer36_1_37
348 // 49 : logicalMdcAxialLayer42_1_49 50 : logicalMdcSegment1_50
349 TGeoNode *nodeLayer = m_Mdc->GetNode(layer);
350 m_NodeLayer[layer] = nodeLayer;
351 //cout << layer << " " << m_NodeLayer[layer]->GetName() << endl;
352
353 Int_t nDaughters = nodeLayer->GetVolume()->GetNodes()->GetEntries();
354 // if (0) {
355 // cout << m_NodeLayer[layer] << " contains " << nDaughters << " nodes : " << endl;
356 // for (Int_t i = 0; i < nDaughters; i++) {
357 // cout << i << " : " << nodeLayer->GetVolume()->GetNode(i)->GetName() << endl;
358 // }
359 // } //Long Peixun's update: Annotate
360
361 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
362 m_NodeReplica[layer][replica] = nodeLayer->GetVolume()->GetNode(replica);
363 //cout << layer << " " << replica << " " << m_NodeReplica[layer][replica]->GetName() << endl;
364 }
365 }
366 }
367
368 //std::cout << "MdcROOTGeo::SetNode, end of set node" << std::endl;
369}
370
371int
372MdcROOTGeo::CorrectReplica(int layer, int replica)
373{
374 int rep = replica;
375 for (intMap::iterator iter = m_CorrectMap.begin(); iter != m_CorrectMap.end(); iter++) {
376 if (layer == (*iter).first ||
377 (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut + m_kAxialLayerOut &&
378 layer - m_kAxialLayerOut == (*iter).first)) {
379 rep -= (*iter).second;
380 if (rep < 0) rep += m_kReplica[layer];
381 }
382 }
383
384 //std::cout << "layer" << layer << " " << replica << "->" << rep << std::endl;
385 return rep;
386}
387
388void
390{
391 //std::cout << "begin of set defaultvis" << std::endl;
392 m_Mdc->SetLineColor(m_MdcColor);
393 m_Mdc->SetVisibility(0);
394
395 for (int segment = 1; segment <= m_kSegment; segment++) {
396 GetVolumeSegment(segment)->SetLineColor(m_segmentColor);
397 //if (segment > 3) GetVolumeSegment(segment)->SetVisibility(0);
398 GetVolumeSegment(segment)->SetVisibility(1);
399 }
400
401 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
402 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
403 if ( (layer >= 0 && layer < m_kStereoLayerIn) ||
404 (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
405 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) ) {
406 GetVolumeLayer(layer)->SetLineColor(m_hypeColor);
407 GetVolumeReplica(layer)->SetLineColor(m_twistedTubsColor);
408 }
409 else {
410 GetVolumeLayer(layer)->SetLineColor(m_tubeColor);
411 GetVolumeReplica(layer)->SetLineColor(m_replicaColor);
412 }
413 GetVolumeLayer(layer)->SetVisibility(0);
414 GetVolumeReplica(layer)->SetVisibility(1);
415 }
416
417 for (int segment = 1; segment <= m_kSegment; segment++) {
418 for (int no = 0; no < 2; no++) {
419 GetSegment(segment, no)->SetVisibility(0);
420 }
421 }
422
423 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
424 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
425 GetLayer(layer)->SetVisibility(0);
426 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
427 GetReplica(layer, replica)->SetVisibility(0);
428 }
429 }
430
431 //std::cout << "end of set defaultvis" << std::endl;
432}
433
434void
436{
437 //std::cout << "begin of set defaultvis" << std::endl;
438 m_Mdc->SetLineColor(m_MdcColor);
439 m_Mdc->SetVisibility(0);
440
441 for (int segment = 1; segment <= m_kSegment; segment++) {
442 GetVolumeSegment(segment)->SetLineColor(m_segmentColor);
443 //if (segment > 3) GetVolumeSegment(segment)->SetVisibility(0);
444 GetVolumeSegment(segment)->SetVisibility(1);
445 }
446
447 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
448 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
449 if ( (layer >= 0 && layer < m_kStereoLayerIn) ||
450 (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
451 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) ) {
452 GetVolumeLayer(layer)->SetLineColor(m_hypeColor);
453 GetVolumeReplica(layer)->SetLineColor(m_twistedTubsColor);
454 }
455 else {
456 GetVolumeLayer(layer)->SetLineColor(m_tubeColor);
457 GetVolumeReplica(layer)->SetLineColor(m_replicaColor);
458 }
459 GetVolumeLayer(layer)->SetVisibility(1);
460 GetVolumeReplica(layer)->SetVisibility(1);
461 }
462
463 for (int segment = 1; segment <= m_kSegment; segment++) {
464 for (int no = 0; no < 2; no++) {
465 GetSegment(segment, no)->SetVisibility(1);
466 }
467 }
468
469 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
470 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
471 GetLayer(layer)->SetVisibility(1);
472 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
473 GetReplica(layer, replica)->SetVisibility(1);
474 }
475 }
476
477
478
479}
480
481void
483{
484 for (int segment = 1; segment <= m_kSegment; segment++) {
485 GetVolumeSegment(segment)->SetVisibility(0);
486 }
487
488 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
489 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
490 GetVolumeLayer(layer)->SetVisibility(0);
491 GetVolumeReplica(layer)->SetVisibility(1);
492 }
493
494 for (int segment = 1; segment <= m_kSegment; segment++) {
495 for (int no = 0; no < 2; no++) {
496 GetSegment(segment, no)->SetVisibility(0);
497 }
498 }
499
500 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
501 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
502 GetLayer(layer)->SetVisibility(0);
503 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
504 if (replica < m_kReplica[layer]/4) GetReplica(layer, replica)->SetVisibility(0);
505 else GetReplica(layer, replica)->SetVisibility(1);
506 }
507 }
508}
509
510void
512{
513 for (int segment = 1; segment <= m_kSegment; segment++) {
514 GetVolumeSegment(segment)->SetVisibility(0);
515 }
516
517 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
518 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
519 GetVolumeLayer(layer)->SetVisibility(0);
520 GetVolumeReplica(layer)->SetVisibility(1);
521 }
522
523 for (int segment = 1; segment <= m_kSegment; segment++) {
524 for (int no = 0; no < 2; no++) {
525 GetSegment(segment, no)->SetVisibility(0);
526 }
527 }
528
529 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
530 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
531 GetLayer(layer)->SetVisibility(0);
532 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
533 if (replica < m_kReplica[layer]/4 ||
534 replica > m_kReplica[layer]*3/4 ) GetReplica(layer, replica)->SetVisibility(1);
535 else GetReplica(layer, replica)->SetVisibility(0);
536 }
537 }
538}
539
540void
542{
543 if (gGeoManager == 0) std::cout << "Create gGeoManager first" << std::endl;
544 TGeoNode *bes = gGeoManager->GetTopNode();
545 TGeoNode *nodeMdc = bes->GetVolume()->GetNode(m_childNo);
546 //std::cout << "Mdc m_childNo " << m_childNo << std::endl;
547
548 if (!m_Mdc) std::cout << "m_Mdc = 0" << std::endl;
549
550 for (int segment = 0; segment < 2*m_kSegment-2; segment++) {
551 m_PhysicalSegment[segment] = gGeoManager->MakePhysicalNode( TString("/") + bes->GetName() +
552 TString("/") + nodeMdc->GetName() +
553 TString("/") + m_Mdc->GetNode((m_kLayer + 2*m_kSegment - 2 - 1) - segment)->GetName() );
554 m_PhysicalSegment[segment]->SetVisibility(0);
555 m_PhysicalSegment[segment]->SetIsVolAtt(kFALSE);
556 m_PhysicalSegment[segment]->SetLineColor(m_segmentColor);
557 //cout << m_PhysicalSegment[segment]->GetName() << endl;
558 }
559
560 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
561 for (int layer = m_StartLayer; layer < m_kLayer; layer++) {
562 TGeoNode *nodeLayer = GetLayer(layer);
563 //std::cout << "Layer " << layer << std::endl;
564 for (int replica = 0; replica < m_kReplica[layer]; replica++) {
565 TGeoNode *nodeReplica = GetReplica(layer, replica);
566
567 m_PhysicalReplica[layer][replica] = gGeoManager->MakePhysicalNode( TString("/") + bes->GetName() +
568 TString("/") + nodeMdc->GetName() +
569 TString("/") + nodeLayer->GetName() +
570 TString("/") + nodeReplica->GetName() );
571 m_PhysicalReplica[layer][replica]->SetVisibility(0);
572 m_PhysicalReplica[layer][replica]->SetIsVolAtt(kFALSE);
573 if ( (layer >= 0 && layer < m_kStereoLayerIn) ||
574 (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
575 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) ) {
576 m_PhysicalReplica[layer][replica]->SetLineColor(m_twistedTubsColor);
577 }
578 else {
579 m_PhysicalReplica[layer][replica]->SetLineColor(m_replicaColor);
580 }
581 //if (m_PhysicalReplica[layer][replica]->IsVolAttributes()) std::cout << "yes " << std::endl;
582 }
583 }
584
585 SetDetector();
586}
587
588//Long Peixun's update: Remove annotation; Reset color of replicas
589void
591{
592 // for (int part = 0; part < m_kPart; part++)
593 // {
594 // int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
595 // for (int phi = 0; phi < nPhi; phi++)
596 // {
597 // int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
598 // for (int theta = 0; theta < nTheta; theta++)
599 // {
600 // m_PhysicalCrystal[part][phi][theta]->SetIsVolAtt(kFALSE);
601 // if (part == 1) m_PhysicalCrystal[part][phi][theta]->SetLineColor(m_brCrystalColor);
602 // else m_PhysicalCrystal[part][phi][theta]->SetLineColor(m_ecCrystalColor);
603 // }
604 // }
605 // }
606
607 for (int layer = m_StartLayer; layer < m_kLayer; layer++)
608 {
609 if ( (layer >= 0 && layer < m_kStereoLayerIn) ||
610 (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
611 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) )
612 {
613 for (int replica = 0; replica < m_kReplica[layer]; replica++)
614 GetPhysicalReplica(layer, replica)->SetLineColor(m_twistedTubsColor);
615 }
616 else
617 {
618 for (int replica = 0; replica < m_kReplica[layer]; replica++)
619 GetPhysicalReplica(layer, replica)->SetLineColor(m_replicaColor);
620 }
621 }
622 //std::cout << "end of set defaultvis" << std::endl;
623}
624
625
626void
628{
629 BesView *view = 0;
630 if (gPad) view = dynamic_cast<BesView*>(gPad->GetView());
631 //if (view) cout << "viewVisFull3DMdc " << view->GetVisFull3DMdc() << endl;
632
633 m_DetectorsArray->Clear();
634 for (int segment = 0; segment < 2*m_kSegment-2; segment++) {
635 TGeoPhysicalNode *phyNode = 0;
636 phyNode = m_PhysicalSegment[segment];
637 //cout << m_PhysicalSegment[segment]->GetName() << endl;
638 if (phyNode) {
639 phyNode->SetVisibility(0); // set all invisible before set any visible
640 if ( (segment >= 2 && segment <= 3) || segment > 59) {
641 m_DetectorsArray->Add( phyNode );
642 }
643 else if (view && view->GetVisFull3DMdc()) {
644 m_DetectorsArray->Add( phyNode );
645 }
646 }
647 }
648 /*
649 for (int part = 0; part < m_kPart; part++) {
650 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
651 for (int phi = 0; phi < nPhi; phi++) {
652 int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
653 for (int theta = 0; theta < nTheta; theta++) {
654 // This is you detector, set it on
655 if ( (part == 1 && theta != 0 && theta != 43 && ((phi != 0 && phi != 60) || theta%2 == 0)) ||
656 (part != 1 && theta != 0) ) {
657 m_PhysicalCrystal[part][phi][theta]->SetVisibility(0);
658 }
659
660 // This is you hit
661 // when you are to set fired hits to another color, say red,
662 // SetIsVolAtt(kFALSE) and to then SetLineColor(kRed);
663 if (phi == 12 && theta == 5) {
664 m_PhysicalCrystal[part][phi][theta]->SetVisibility(1);
665 m_PhysicalCrystal[part][phi][theta]->SetLineColor(2);
666 }
667 }
668 }
669 }
670 std::cout << "end of set detector on" << std::endl;
671 */
672}
673
674void
676{
677 // set previous event hits to default vis
678 //Long Peixun's update: Annotate cout
679 // cout << "m_HitsArray size(): " << m_HitsArray->GetEntries() << endl;
680 // cout << "m_2DHitsArray size(): " << m_2DHitsArray->GetEntries() << endl;
681 for (int i = 0; i < m_HitsArray->GetEntries(); i++) {
682 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)m_HitsArray->At(i);
683 phyNode->SetVisibility(0);
684 }
685 m_HitsArray->Clear("C");
686
687 // set previous event 2D hits info to default
688 for (int i = 0; i < m_2DHitsArray->GetEntries(); i++) {
689 Mdc2DWire *aWire = (Mdc2DWire*)m_2DHitsArray->At(i);
690 aWire->ClearInfo();
691 aWire->AddInfo(aWire->GetTitle());
692 aWire->CloseInfo();
693 }
694 m_2DHitsArray->Clear("C");
695
696 // set new hits
697 //Long Peixun's update: Consider gEvent == NULL
698 int NDigiCol = 0;
699 if (gEvent)
700 {
701 m_MdcDigiCol = gEvent->GetMdcDigiCol();
702 //Long Peixun's update: Consider m_MdcDigiCol == NULL
703 if (m_MdcDigiCol) NDigiCol = m_MdcDigiCol->GetEntries();
704 else NDigiCol = 0;
705 }
706
707 for (int i = 0; i < NDigiCol; i++) {
708 TMdcDigi *aMdcDigi = (TMdcDigi*)m_MdcDigiCol->At(i);
709 Identifier aMdcID( aMdcDigi->getIntId() );
710 int layer = MdcID::layer( aMdcID );
711 int wire = MdcID::wire( aMdcID );
712
713 Double_t time = RawDataUtil::MdcTime(aMdcDigi->getTimeChannel());
715
716 TGeoPhysicalNode *phyNode = 0;
717 if (layer < 36) { // number of layers in the three inner
718 phyNode = GetPhysicalReplica(layer, wire);
719 if (phyNode) m_HitsArray->Add( phyNode );
720 }
721 else {
722 phyNode = GetPhysicalReplica( GetSimuLayer(layer), wire );
723 if (phyNode) m_HitsArray->Add( phyNode );
724 phyNode = GetPhysicalReplica( GetSimuLayer(layer)+1, wire);
725 if (phyNode) m_HitsArray->Add( phyNode );
726 }
727
728 Mdc2DWire *aWire = 0;
729 aWire = m_Mdc2DWire[layer][wire];
730 if (aWire) {
731 aWire->ClearInfo();
732 aWire->AddInfo(aWire->GetTitle());
733 double evTime = gEvent->GetHeader().GetEvTime();
734
735 char data[200]; //Long Peixun's update: 100 -> 200
736 if(time>1000000) {
737 sprintf(data, "NO time");
738 }else{
739 sprintf(data, "time=%-.1f ns", time);
740 if(fabs(evTime)>0.0001){
741 sprintf(data, "%s, Tdrift(Raw)=%-.1f ns", data, time - evTime +230);
742 }
743 }
744 if(charge>1000000) {
745 sprintf(data, "%s, NO charge", data);
746 }else{
747 sprintf(data, "%s, charge=%d", data,charge);
748 }
749 aWire->AddInfo( TString(data) );
750 sprintf(data, "Fired");
751 aWire->AddInfo( TString(data) );
752
753 aWire->SetTime(time);//yzhang
754 aWire->SetCharge(charge);//yzhang
755 unsigned int overflow = aMdcDigi->getOverflow();
756 aWire->SetQOverflow(overflow&2);//yzhang
757 aWire->SetEvTime(evTime);
758
759 //Long Peixun's update: Set raw channel data of aWire
760 aWire->SetTimeChannel(aMdcDigi->getTimeChannel());
761 aWire->SetChargeChannel(aMdcDigi->getChargeChannel());
762
763 aWire->CloseInfo();
764
765 m_2DHitsArray->Add(aWire);
766 }
767
768 }
769}
770
771void
773{
774 BesView *view = 0;
775 if (gPad) view = dynamic_cast<BesView*>(gPad->GetView());
776
777 for (int i = 0; i < m_DetectorsArray->GetEntries(); i++) {
778 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)m_DetectorsArray->At(i);
779 if (view && view->GetVisMdcGlobal()) {
780 phyNode->SetVisibility(1);
781 continue;
782 }
783 phyNode->SetVisibility(0);
784 }
785}
786
787void
789{
790 BesView *view = 0;
791 if (gPad) view = dynamic_cast<BesView*>(gPad->GetView());
792
793 for (int i = 0; i < m_HitsArray->GetEntries(); i++) {
794 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)m_HitsArray->At(i);
795 if (view && view->GetVisMdcHitsGlobal()) {
796 phyNode->SetVisibility(1);
797 }
798 else {
799 phyNode->SetVisibility(0);
800 }
801 }
802}
803
804void
806 k_TFire= input;
807 //cout << "Mdc ROOT Geometry TDC Match: " << k_TMatch << endl;
808}
809
810//void
811//MdcROOTGeo::SetTOverflow(Bool_t input){
812// k_TOverflow = input;
813// //cout << "Mdc ROOT Geometry TDC Match: " << k_TMatch << endl;
814//}
815
816void
818 k_QNotOverflow = input;
819 //cout << "Mdc ROOT Geometry TDC Match: " << k_TMatch << endl;
820}
821
822void
824 k_QFire = input;
825 //cout << "Mdc ROOT Geometry ADC Match: " << k_QMatch << endl;
826}
827
828void
830 k_ColorfulWire = input;
831}
832
833void
835 k_MdcTimeSubEvTime = input;
836}
837
838TGeoVolume*
839MdcROOTGeo::GetVolumeSegment( int segment )
840{
841 std::stringstream osname;
842 osname << "logical" << "Mdc" << "Segment" << segment;
843 return GetLogicalVolume( osname.str() );
844}
845
846TGeoVolume*
848{
849 std::stringstream osname;
850 if (layer >= 0 && layer < m_kStereoLayerIn) {
851 osname << "logical" << "Mdc" << "Stereo" << "Layer" << layer;
852 }
853 else if (layer >= m_kStereoLayerIn && layer < m_kStereoLayerIn + m_kAxialLayerIn) {
854 osname << "logical" << "Mdc" << "Axial" << "Layer" << layer;
855 }
856 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
857 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) {
858 osname << "logical" << "Mdc" << "Stereo" << "Layer" << layer;
859 }
860 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut &&
861 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut + m_kAxialLayerOut) {
862 osname << "logical" << "Mdc" << "Axial" << "Layer" << layer << "_0";
863 }
864 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut + m_kAxialLayerOut &&
865 layer < m_kLayer) {
866 osname << "logical" << "Mdc" << "Axial" << "Layer" << layer - m_kAxialLayerOut << "_1";
867 }
868
869 return GetLogicalVolume( osname.str() );
870}
871
872TGeoVolume*
874{
875 std::stringstream osname;
876 if (layer >= 0 && layer < m_kStereoLayerIn) {
877 osname << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "Cell";
878 }
879 else if (layer >= m_kStereoLayerIn
880 && layer < m_kStereoLayerIn + m_kAxialLayerIn) {
881 osname << "logical" << "Mdc" << "Axial" << "Layer" << layer << "Cell";
882 }
883 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
884 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) {
885 osname << "logical" << "Mdc" << "Stereo" << "Layer" << layer << "Cell";
886 }
887 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut &&
888 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut + m_kAxialLayerOut) {
889 osname << "logical" << "Mdc"
890 << "Axial" << "Layer" << layer << "_0" << "Cell";
891 }
892 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut + m_kAxialLayerOut
893 && layer < m_kLayer) {
894 osname << "logical" << "Mdc"
895 << "Axial" << "Layer" << layer - m_kAxialLayerOut
896 << "_1" << "Cell";
897 }
898
899 return GetLogicalVolume( osname.str() );
900}
901
902TGeoNode*
903MdcROOTGeo::GetSegment( int segment, int no )
904{
905 std::stringstream osname;
906 if (segment == 1 || segment == 2) {
907 osname << "pv_" << "logical" << "Mdc"
908 << "Segment" << segment << "_"
909 << m_kSegmentNodeOffset - (segment - 1); //huangsh
910 //<< (m_kLayer + (2*m_kSegment -2) -1) - (segment - 1);
911 }
912 else {
913 osname << "pv_" << "logical" << "Mdc"
914 << "Segment" << segment << "_"
915 << m_kSegmentNodeOffset - m_kSegmentBr - 2*(segment - 1 - m_kSegmentBr) - no; //huangsh
916 //<< (m_kLayer + (2*m_kSegment -2) -1) - 2 - (segment - 3)*2 - no;
917 }
918
919 return GetNode( osname.str() );
920}
921
922TGeoNode*
923MdcROOTGeo::GetLayer( int layer )
924{
925 // if m_NodeLayer[] set in SetNode(), could also return m_NodeLayer[layer]
926 if (m_ROOTGeoInit == 2) { // from GDML
927 std::stringstream osname;
928 if (layer >= 0 && layer < m_kStereoLayerIn) {
929 osname << "pv_" << "logical" << "Mdc"
930 << "Stereo" << "Layer" << layer << "_" << layer;
931 }
932 else if (layer >= m_kStereoLayerIn
933 && layer < m_kStereoLayerIn + m_kAxialLayerIn) {
934 osname << "pv_" << "logical" << "Mdc"
935 << "Axial" << "Layer" << layer << "_" << layer;
936 }
937 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn &&
938 layer < m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut) {
939 osname << "pv_" << "logical" << "Mdc"
940 << "Stereo" << "Layer" << layer << "_" << layer;
941 }
942 else if (layer >= m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut
943 && layer < m_kLayer) {
944 Int_t nBeforeAxialLayerOut =
945 m_kStereoLayerIn + m_kAxialLayerIn + m_kStereoLayerOut;
946 Int_t iTrueLayer =
947 nBeforeAxialLayerOut + (layer - nBeforeAxialLayerOut)/2;
948 if (layer%2 == 0) {
949 osname << "pv_" << "logical" << "Mdc"
950 << "Axial" << "Layer" << iTrueLayer << "_0" << "_" << layer;
951 }
952 else {
953 osname << "pv_" << "logical" << "Mdc"
954 << "Axial" << "Layer" << iTrueLayer << "_1" << "_" << layer;
955 }
956 }
957
958 //std::cout << osname.str() << std::endl;
959 return GetNode( osname.str() );
960 }
961 else if (m_ROOTGeoInit == 1) { // from ROOT object
962 if (m_NodeLayer[layer] != 0) {
963 return m_NodeLayer[layer];
964 }
965 else {
966 //std::cout << "Node: " << "Layer" << layer << " not found" << std::endl;
967 return 0;
968 }
969 }
970
971 return 0;
972}
973
974TGeoNode*
975MdcROOTGeo::GetReplica( int layer, int replica )
976{
977 if (m_NodeReplica[layer][replica] != 0) {
978 //std::cout << " replica " << layer << " " << replica << " found " << std::endl;
979 return m_NodeReplica[layer][replica];
980 }
981 else {
982 //std::cout << "Node: " << "Layer" << layer << "Replica" << replica << " not found" << std::endl;
983 return 0;
984 }
985}
986
987TGeoPhysicalNode*
989{
990 if (m_PhysicalSegment[segment] != 0) {
991 return m_PhysicalSegment[segment];
992 }
993 else {
994 //std::cout << "PhysicalNode: " << "Segment" << segment << " not found" << std::endl;
995 return 0;
996 }
997}
998
999TGeoPhysicalNode*
1000MdcROOTGeo::GetPhysicalReplica( Int_t layer, Int_t replica )
1001{
1002 if (m_PhysicalReplica[layer][replica] != 0) {
1003 return m_PhysicalReplica[layer][replica];
1004 }
1005 else {
1006 //std::cout << "PhysicalNode: " << "Layer" << layer << "Replica" << replica << " not found" << std::endl;
1007 return 0;
1008 }
1009}
1010
1011Mdc2DWire*
1012MdcROOTGeo::Get2DWire( Int_t layer, Int_t wire)
1013{
1014 if (m_Mdc2DWire[layer][wire]) return m_Mdc2DWire[layer][wire];
1015 else return 0;
1016}
1017
1018Int_t
1020{
1021 if (trueLayer < 36 || trueLayer >= m_kTrueLayer) return trueLayer;
1022 if (trueLayer >= 36) return (36 + 2*(trueLayer-36));
1023 return trueLayer;
1024}
1025
1026Bool_t
1027MdcROOTGeo::IsHit(Int_t layer, Int_t wire)
1028{
1029 if (m_MdcDigiCol) {
1030 for (int i = 0; i < m_MdcDigiCol->GetEntries(); i++) {
1031 Identifier mdcID( ((TMdcDigi*)m_MdcDigiCol->At(i))->getIntId() );
1032 if (layer == MdcID::layer( mdcID ) && wire == MdcID::wire( mdcID )) {
1033 return kTRUE;
1034 }
1035 }
1036 }
1037
1038 return kFALSE;
1039}
1040
1041void
1042MdcROOTGeo::Draw(Option_t *option)
1043{
1044 TString opt = option;
1045 opt.ToUpper();
1046
1047 if (!m_2DGeoInit) cout << "MdcROOTGeo::Draw2D(), 2D Geometry not initialized!" << endl;
1048 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
1049 if (!view) cout << "MdcROOTGeo::Draw(), BesView not found" << endl;
1050
1051 if (view->GetVisMdcGlobal()) { // MdcVisGlobal
1052 if (opt.Contains("XY")) {
1053 m_MdcXY->Draw("");
1054 //Long Peixun's update: Annotate
1055 // for (Int_t i = 0; i < 4; i++) {
1056 // m_MdcXYSuper[i]->Draw("");
1057 // }
1058 }
1059
1060 if (opt.Contains("ZR")) {
1061 for (Int_t i = 0; i < 2; i++) {
1062 //m_MdcZR[i]->SetRotatable(true); //Long Peixun's update: Move to initializer
1063 m_MdcZR[i]->Draw("");
1064 }
1065 }
1066
1067 TString wireOpt;
1068 if (view->GetVisMdcTubes()) wireOpt += "TUBE";
1069 if (view->GetVisMdcWires()) wireOpt += ",WIRE";
1070
1071 Int_t replicaDraw = 0; // change draw sequence in a circle, (-1: 0->Max; 1: Max->0)
1072 //Long Peixun's update: Ignore layer 0~7 if detector contains CGEM
1073 for (Int_t layer = m_StartLayer; layer < m_kTrueLayer; layer++) {
1074 Int_t simuLayer = GetSimuLayer(layer);
1075 for (int replica = 0; replica < m_kReplica[simuLayer]; replica++) {
1076 if (m_kStereoDir[layer] == -1) replicaDraw = replica;
1077 else if (m_kStereoDir[layer] == 1) replicaDraw = m_kReplica[simuLayer]-1 - replica;
1078 else replicaDraw = replica;
1079
1080 if (m_Mdc2DWire[layer][replicaDraw]) {
1081 //cout << layer << " " << replicaDraw << endl;
1082 //m_Mdc2DWire[layer][replicaDraw]->SetHighlighted(false);
1083 m_Mdc2DWire[layer][replicaDraw]->SetFired(false);
1084 m_Mdc2DWire[layer][replicaDraw]->Draw(wireOpt);
1085 }
1086 }
1087 }
1088 }
1089}
1090
1091void
1092MdcROOTGeo::DrawHits(Option_t *option)
1093{
1094 // cout << "Draw Hits" << endl;
1095 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
1096 if (!view) cout << "MdcROOTGeo::DrawHits(), BesView not found" << endl;
1097
1098 //cout << "VisMdcHitsGlobal " << view->GetVisMdcHitsGlobal() << endl;
1099 //cout << "VisMdcHits " << view->GetVisMdcHits() << endl;
1100
1101
1102 if (view->GetVisMdcHitsGlobal()) {
1103 TString wireOpt("");
1104 if (view->GetVisMdcTubes()) wireOpt += ",TUBE";
1105 if (view->GetVisMdcHits()) wireOpt += ",WIRE";
1106
1107 //Long Peixun's update: Use m_2DHitsArray which contains ready hits rather than rebuild hits
1108 for (int i = 0; i < m_2DHitsArray->GetEntries(); ++i)
1109 {
1110 Mdc2DWire* aWire = (Mdc2DWire*)m_2DHitsArray->At(i);
1111 if (aWire)
1112 {
1113 if ((k_TFire) && (aWire->GetTimeChannel() == 0x7FFFFFFF))
1114 continue;
1115 if ((k_QFire) && (aWire->GetChargeChannel() == 0x7FFFFFFF))
1116 continue;
1117 if ((k_QNotOverflow) && aWire->GetQOverflow() )
1118 continue;
1119 aWire->SetFired(true);
1120 aWire->SetColorfulWire(k_ColorfulWire, k_MdcTimeSubEvTime);
1121 aWire->Draw(wireOpt);
1122 }
1123 }
1124
1125/* if (m_MdcDigiCol) {
1126 for (int i = 0; i < m_MdcDigiCol->GetEntries(); i++) {
1127 TMdcDigi *aMdcDigi = (TMdcDigi*)m_MdcDigiCol->At(i);
1128
1129 Identifier aMdcID( aMdcDigi->getIntId() );
1130 int layer = MdcID::layer( aMdcID );
1131 int wire = MdcID::wire( aMdcID );
1132 unsigned int overflow = aMdcDigi->getOverflow();
1133
1134 Mdc2DWire *aWire = 0;
1135 aWire = m_Mdc2DWire[layer][wire];
1136 if (aWire){
1137 if ((k_TFire) && (aMdcDigi->getTimeChannel() == 0x7FFFFFFF)){
1138 continue;
1139 }
1140 if ((k_QFire) && (aMdcDigi->getChargeChannel() == 0x7FFFFFFF)){
1141 continue;
1142 }
1143 //if ((!k_TOverflow) && ((overflow&1)>0) ){
1144 // continue;
1145 //}
1146 if ((k_QNotOverflow) && ((overflow&2)>0) ){
1147 continue;
1148 }
1149 aWire->SetFired(true);
1150 aWire->SetColorfulWire(k_ColorfulWire,k_MdcTimeSubEvTime);
1151 aWire->Draw(wireOpt);
1152 }
1153 }
1154 } */
1155 }
1156}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
R__EXTERN BesEvent * gEvent
Definition BesEvent.h:279
double P(RecMdcKalTrack *trk)
const int no
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
TTree * data
Double_t time
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
virtual void SetNSegment(Int_t np)
Definition BesCircle2D.h:53
virtual void Draw(Option_t *option="")
Double_t GetEvTime()
BesEventHeader GetHeader()
Definition BesEvent.h:272
const TObjArray * GetMdcDigiCol() const
Definition BesEvent.h:70
void SetRotatable(Bool_t input)
virtual void Draw(Option_t *option="")
Bool_t GetVisMdcHitsGlobal()
Definition BesView.h:193
Bool_t GetVisMdcTubes()
Definition BesView.h:113
Bool_t GetVisMdcWires()
Definition BesView.h:114
Bool_t GetVisMdcGlobal()
Definition BesView.h:112
Bool_t GetVisMdcHits()
Definition BesView.h:194
Bool_t GetVisFull3DMdc()
Definition BesView.h:161
void SetChargeChannel(UInt_t cc)
virtual void ClearInfo()
UInt_t GetTimeChannel() const
Definition Mdc2DWire.h:61
void SetQOverflow(Bool_t qOvfl)
virtual void CloseInfo()
void SetTime(Double_t time)
virtual void AddInfo(TString info)
Definition Mdc2DWire.h:37
void SetColorfulWire(Bool_t colorfulWire, Bool_t subEvTime)
void SetEvTime(Double_t time)
void SetTimeChannel(UInt_t tc)
virtual void Draw(Option_t *option="")
Bool_t GetQOverflow() const
Definition Mdc2DWire.h:60
UInt_t GetChargeChannel() const
Definition Mdc2DWire.h:62
virtual void SetFired(bool status=true)
Definition Mdc2DWire.h:33
void SetCharge(Double_t charge)
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition MdcID.cxx:49
static int wire(const Identifier &id)
Definition MdcID.cxx:54
TGeoNode * GetSegment(int segment, int no)
Get segment node;.
int CorrectReplica(int layer, int replica)
Correct some axial layer id to copyNo;.
void SetVolumeDefaultVis()
Set default visual attributes;.
TGeoVolume * GetVolumeLayer(int layer)
Get layer volume;
TGeoPhysicalNode * GetPhysicalSegment(int segment)
Get segment physical node;.
void SetNode()
Set the pointers to theirs nodes;.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalMdc.
TGeoNode * GetReplica(int layer, int replica)
Get replica node;.
TGeoVolume * GetVolumeReplica(int layer)
Get replica volume;.
TGeoVolume * GetVolumeSegment(int segment)
Get segment volume;.
void SetVisMdcDetector()
Set Mdc default detector visibility;.
Int_t GetSimuLayer(Int_t trueLayer)
Trans trueLayer to simuLayer (0~42)->(0~49)
Mdc2DWire * Get2DWire(Int_t layer, Int_t replica)
Get Mdc2DWire;.
void SetVolumeMdc(TGeoVolume *vol)
Set Mdc volume, while initializing from ROOT;.
TGeoPhysicalNode * GetPhysicalReplica(int layer, int replica)
Get replica physical node;.
void SetPhysicalDefaultVis()
Set default physical node attributes;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
Bool_t IsHit(Int_t layer, Int_t wire)
Judge whether the digiCol contains (layer, wire)
void SetDetector()
Draw Detecor (what is detector depends on you)
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static double MdcTime(int timeChannel)
Definition RawDataUtil.h:8
static double MdcCharge(int chargeChannel)
Definition RawDataUtil.h:11
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
TGeoVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
UInt_t getOverflow() const
Definition TMdcDigi.cxx:42
UInt_t getIntId() const
Definition TRawData.cxx:50
UInt_t getChargeChannel() const
Definition TRawData.cxx:60
UInt_t getTimeChannel() const
Definition TRawData.cxx:55
float charge