BmnRoot
Loading...
Searching...
No Matches
CbmBmnStsDigitize.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- CbmBmnStsDigitize source file -----
3// ----- Created 08/07/2008 by R. Karabowicz -----
4// -------------------------------------------------------------------------
5
6// Includes from ROOT
7#include "TClonesArray.h"
8#include "TGeoBBox.h"
9#include "TObjArray.h"
10#include "TMath.h"
11#include "TF1.h"
12#include "TRandom3.h"
13
14#include "TGeoManager.h"
15#include "TGeoNode.h"
16#include "TGeoMatrix.h"
17
18// Includes from base
19#include "FairEventHeader.h"
20#include "FairRootManager.h"
21#include "FairRunAna.h"
22#include "FairRuntimeDb.h"
23
24// Includes from STS
25#include "CbmGeoStsPar.h"
26#include "CbmStsDigi.h"
27#include "CbmStsDigiMatch.h"
28#include "CbmStsDigiPar.h"
29
30
31#include "CbmBmnStsDigitize.h"
32#include "CbmStsPoint.h"
33#include "CbmStsSensor.h"
34#include "CbmStsSector.h"
35#include "CbmStsStation.h"
36#include "BmnTrigDigit.h"
37
38#include "BmnGemStripDigit.h"
39#include "BmnSiliconDigit.h"
40#include "BmnStripDigit.h"
41
42#include <iostream>
43
44#include <iomanip>
45#include <map>
46#include <vector>
47
48using namespace std;
49
50Int_t GetNofModules(TGeoNode* station);
51// ----- Default constructor ------------------------------------------
53 : FairTask("STS Digitizer", 1),
54 fGeoPar(NULL),
55 fDigiPar(NULL),
56 fDigiScheme(NULL),
57 fPoints(NULL),
58 fPointsSI(NULL),
59 fDigis(NULL),
60 fDigisCSC(0),
61 fDigiMatches(NULL),
62 fNDigis(0),
63 fNMulti(0),
64 fNEvents(0),
65 fNPoints(0),
66 fNDigisFront(0),
67 fNDigisBack(0),
68 fTime(0.),
69 fStep(0.001),
70 fTimer(),
71 fRealistic(kFALSE),
72 fEnergyLossToSignal(0.),
73 fFThreshold(4.0),
74 fBThreshold(4.0),
75 fFNoiseWidth(0.1),
76 fBNoiseWidth(0.1),
77 fStripDeadTime(10),
78 fFNofBits(12),
79 fBNofBits(12),
80 fFNofElPerAdc(10.),
81 fBNofElPerAdc(10.),
82 fFNofSteps(0),
83 fBNofSteps(0),
84 fStripSignalF(NULL),
85 fStripSignalB(NULL),
86 fFChannelPointsMap(),
87 fBChannelPointsMap(),
88 fPointMap()
89{
90 //AZ fDigiScheme = new CbmStsDigiScheme();
91 fDigiScheme = CbmStsDigiScheme::Instance();
92 Reset();
93}
94// -------------------------------------------------------------------------
95
96// ----- Standard constructor ------------------------------------------
98 : FairTask("STSDigitize", iVerbose),
99 fGeoPar(NULL),
100 fDigiPar(NULL),
101 fDigiScheme(NULL),
102 fPoints(NULL),
103 fPointsSI(NULL),
104 fDigis(NULL),
105 fDigisCSC(0),
106 fDigiMatches(NULL),
107 fNDigis(0),
108 fNMulti(0),
109 fNEvents(0),
110 fNPoints(0),
111 fNDigisFront(0),
112 fNDigisBack(0),
113 fTime(0.),
114 fStep(0.001),
115 fTimer(),
116 fRealistic(kFALSE),
117 fEnergyLossToSignal(0.),
118 fFThreshold(4.0),
119 fBThreshold(4.0),
120 fFNoiseWidth(0.1),
121 fBNoiseWidth(0.1),
122 fStripDeadTime(10),
123 fFNofBits(12),
124 fBNofBits(12),
125 fFNofElPerAdc(10.),
126 fBNofElPerAdc(10.),
127 fFNofSteps(0),
128 fBNofSteps(0),
129 fStripSignalF(NULL),
130 fStripSignalB(NULL),
131 fFChannelPointsMap(),
132 fBChannelPointsMap(),
133 fPointMap()
134{
135 //AZ fDigiScheme = new CbmStsDigiScheme();
136 fDigiScheme = CbmStsDigiScheme::Instance();
137 Reset();
138}
139// -------------------------------------------------------------------------
140
141// ----- Constructor with name -----------------------------------------
142CbmBmnStsDigitize::CbmBmnStsDigitize(const char* name, Int_t iVerbose)
143 : FairTask(name, iVerbose),
144 fGeoPar(NULL),
145 fDigiPar(NULL),
146 fDigiScheme(NULL),
147 fPoints(NULL),
148 fPointsSI(NULL),
149 fDigis(NULL),
150 fDigisCSC(0),
151 fDigiMatches(NULL),
152 fNDigis(0),
153 fNMulti(0),
154 fNEvents(0),
155 fNPoints(0),
156 fNDigisFront(0),
157 fNDigisBack(0),
158 fTime(0.),
159 fStep(0.001),
160 fTimer(),
161 fRealistic(kFALSE),
162 fEnergyLossToSignal(0.),
163 fFThreshold(4.0),
164 fBThreshold(4.0),
165 fFNoiseWidth(0.1),
166 fBNoiseWidth(0.1),
167 fStripDeadTime(10),
168 fFNofBits(12),
169 fBNofBits(12),
170 fFNofElPerAdc(10.),
171 fBNofElPerAdc(10.),
172 fFNofSteps(0),
173 fBNofSteps(0),
174 fStripSignalF(NULL),
175 fStripSignalB(NULL),
176 fFChannelPointsMap(),
177 fBChannelPointsMap(),
178 fPointMap()
179{
180 fGeoPar = NULL;
181 fDigiPar = NULL;
182 fPoints = NULL;
183 fDigis = NULL;
184 fDigisCSC = NULL;
185 fDigiMatches = NULL;
186 fRealistic = kFALSE;
187 //AZ fDigiScheme = new CbmStsDigiScheme();
188 fDigiScheme = CbmStsDigiScheme::Instance();
189 Reset();
190
191 fStep = 0.001;
192
193 fFThreshold = 4.0;
194 fBThreshold = 4.0;
195 fFNoiseWidth = 0.1;
196 fBNoiseWidth = 0.1;
197
198 fFNofBits = 12;
199 fBNofBits = 12;
200 fFNofElPerAdc = 10.;
201 fBNofElPerAdc = 10.;
202 fStripDeadTime = 10;
203 fNEvents = 0.;
204}
205// -------------------------------------------------------------------------
206
207// ----- Destructor ----------------------------------------------------
209
210
211 if ( fGeoPar) delete fGeoPar;
212 if ( fDigiPar) delete fDigiPar;
213 if ( fDigis ) {
214 fDigis->Delete();
215 delete fDigis;
216 }
217 if ( fDigisCSC ) {
218 fDigisCSC->Delete();
219 delete fDigisCSC;
220 }
221 if ( fDigiMatches ) {
222 fDigiMatches->Delete();
223 delete fDigiMatches;
224 }
225 //AZ if ( fDigiScheme ) delete fDigiScheme;
226 Reset();
227}
228// -------------------------------------------------------------------------
229
230// ----- Public method Exec --------------------------------------------
231void CbmBmnStsDigitize::Exec(Option_t* opt) {
232
233 fTimer.Start();
234 Reset(); //AZ
235 Int_t stationNr=0;
236 Int_t sectorNr=0;
237 Int_t side=-1;
238 Int_t stripNr=0;
239
240 //FairRunAna *run = FairRunAna::Instance();
241
242
243 Int_t nDigis = 0/*, nDigisCSC=0*/;
244
245 if(fPointsSI->GetEntries()+fPoints->GetEntries() > 3000 ) return;
246
247 for (Int_t iPointSI=0; iPointSI<fPointsSI->GetEntries(); iPointSI++) {
248
249 BmnSiliconDigit* sidig=(BmnSiliconDigit*)fPointsSI->At(iPointSI);
250
251 // cout<<" Event: "<<fch<<" SI: "<<sidig->GetStation()<<" Mod: "<<sidig->GetModule()<<" Layer: "<<sidig->GetStripLayer()<<" strip Num: "<<sidig->GetStripNumber()<<
252 // " signal: "<<sidig->GetStripSignal()<<endl;
253
254 Double_t sisig=sidig->GetStripSignal();
255 Int_t stripNrSI=sidig->GetStripNumber()-1; // GP kapishin MYSILICON start from num. 1
256 Int_t stationNrSI=sidig->GetStation();
257 Int_t sectorNrSI=-100; // start from num. 1
258 Int_t sideSI=-1;
259
260 if(sidig->GetStripLayer()==1) sideSI=1;
261 else if(sidig->GetStripLayer()==0) sideSI=0;
262
263 //Int_t simod=-100;
264 sectorNrSI=sidig->GetModule()+1;
265
266 new ((*fDigis)[nDigis++]) CbmStsDigi(stationNrSI, sectorNrSI, sideSI, stripNrSI, sisig, 0); //AZ
267
268 }
269
270 for (Int_t iPoint=0; iPoint<fPoints->GetEntries(); iPoint++) {
271
272 BmnGemStripDigit* stdig= (BmnGemStripDigit*)fPoints->At(iPoint) ;
273 // cout<<" Event: "<<fch<<" ST: "<<stdig->GetStation()<<" Mod: "<<stdig->GetModule()<<" Layer: "<<stdig->GetStripLayer()<<" strip Num: "<<stdig->GetStripNumber()<<
274 // " signal: "<<stdig->GetStripSignal()<<endl;
275 Double_t stsig= stdig->GetStripSignal();
276
277 stripNr=stdig->GetStripNumber()-1; // GP kapishin STRIPGEM start from num. 1
278
279 if(stdig->GetStation()==5 && stdig->GetModule()==1 && stdig->GetStripLayer()==2 && stdig->GetStripNumber()>128 && stdig->GetStripNumber()<257)
280 stripNr=stripNr-2;
281
282
283 // if(TMath::Abs(stripNr-120)<=64) continue; //remove strips for MC && DATA compare
284
285 stationNr=stdig->GetStation();
286
287 if(stationNr==3) continue;
288 else if(stationNr>3) stationNr=stationNr-1;
289
290 Int_t modNum=stdig->GetModule();
291
292
293 if( (stdig->GetStripLayer()==0 || stdig->GetStripLayer()==1) && modNum==0) sectorNr=1;
294 if( (stdig->GetStripLayer()==2 || stdig->GetStripLayer()==3) && modNum==0) sectorNr=2;
295
296
297 if( (stdig->GetStripLayer()==0 || stdig->GetStripLayer()==1) && modNum==1) sectorNr=3;
298 if( (stdig->GetStripLayer()==2 || stdig->GetStripLayer()==3) && modNum==1) sectorNr=4;
299
300 //if(stationNr==7) sectorNr=stdig->GetModule()*2+stdig->GetStripLayer()/2;
301
302 if( (stdig->GetStripLayer()==0 || stdig->GetStripLayer()==2) ) side=0; //true for small station
303 if( (stdig->GetStripLayer()==1 || stdig->GetStripLayer()==3) ) side=1; //true for small station
304
305 if(stationNr<7) new ((*fDigis)[nDigis++]) CbmStsDigi(stationNr+3, sectorNr, side, stripNr, stsig, 0); //AZ
306 //else if(stationNr==7) new ((*fDigisCSC)[nDigisCSC++]) CbmStsDigi(stationNr+3, sectorNr, side, stripNr, stsig, 0); //AZ
307
308 }
309
310
311
312 fTimer.Stop();
313
314 fTime += fTimer.RealTime();
315
316}
317// -----------------------end Exec--------------------------------------------------
318
319// ----- Private method CrossSpacer ------------------------------------
320Bool_t CbmBmnStsDigitize::CrossSpacer(const TGeoNode *node, const CbmStsPoint *point)
321{
322
323 return kFALSE;
324}
325// -------------------------------------------------------------------------
326
327// ----- Private method ProduceHitResponse --------------------------------
332
333// ----- Private method SetParContainers -------------------------------
334void CbmBmnStsDigitize::SetParContainers() {
335
336 // Get run and runtime database
337 FairRunAna* run = FairRunAna::Instance();
338 if ( ! run ) Fatal("SetParContainers", "No analysis run");
339
340 FairRuntimeDb* db = run->GetRuntimeDb();
341 if ( ! db ) Fatal("SetParContainers", "No runtime database");
342 // Get STS digitisation parameter container
343 fDigiPar = (CbmStsDigiPar*) db->getContainer("CbmStsDigiPar");
344
345}
346// -------------------------------------------------------------------------
347
348
349
350// ----- Private method Init -------------------------------------------
351InitStatus CbmBmnStsDigitize::Init() {
352
353 // Get input array
354 FairRootManager* ioman = FairRootManager::Instance();
355 if ( ! ioman ) Fatal("Init", "No FairRootManager");
356 fPoints = (TClonesArray*) ioman->GetObject("STRIPGEM");//StsPoint
357
358 fPointsSI = (TClonesArray* ) ioman->GetObject("MYSILICON");//StsPoint
359
360 fEventHeader = (TClonesArray*) ioman->GetObject("EventHeader");//StsPoint
361
362 /*
363 fPointsT0=(TClonesArray*) ioman->GetObject("T0");
364 fPointsBC1=(TClonesArray*) ioman->GetObject("BC1");
365 fPointsBC2=(TClonesArray*) ioman->GetObject("BC2");
366 fPointsVeto=(TClonesArray*) ioman->GetObject("VC");
367 fPointsBD=(TClonesArray*) ioman->GetObject("BD");
368 fPointsSi=(TClonesArray*) ioman->GetObject("Si");
369*/
370 //fDigiMatches = new TClonesArray("CbmStsDigiMatch",1000);
371 //ioman->Register("StsDigiMatch", "Digi Match in STS", fDigiMatches, kTRUE);
372
373 // Register output array StsDigi
374 fDigis = new TClonesArray("CbmStsDigi",1000);
375 ioman->Register("StsDigi", "Digital response in STS", fDigis, kTRUE);
376
377 // Register output array StsDigi
378 //fDigisCSC = new TClonesArray("CbmStsDigi",1000);
379 //ioman->Register("StsDigiCSC", "Digital response in STS", fDigisCSC, kTRUE);
380
381 ApplyAlignment(); //AZ
382 gGeoManager->CheckOverlaps(); //AZ
383 gGeoManager->PrintOverlaps(); //AZ
384
385 // Build digitisation scheme
386 if ( fDigiScheme->Init(NULL, fDigiPar) ) {
387 // MakeSets();
388
389 if (fVerbose == 1 || fVerbose == 2) fDigiScheme->Print(kFALSE);
390 else if (fVerbose > 2) fDigiScheme->Print(kTRUE);
391 cout << "-I- " << fName << "::Init: "
392 << "STS digitisation scheme succesfully initialised" << endl;
393 if ( fDigiScheme->IsNewGeometry() ) cout << "-I- Using new geometry" << endl;
394 cout << " Stations: " << fDigiScheme->GetNStations()
395 << ", Sectors: " << fDigiScheme->GetNSectors() << ", Channels: "
396 << fDigiScheme->GetNChannels() << endl;
397
398
399 return kSUCCESS;
400 }
401
402
403
404 return kSUCCESS;//kERROR;
405
406}
407// -------------------------------------------------------------------------
408
409
410
411// ----- Private method ReInit -----------------------------------------
412InitStatus CbmBmnStsDigitize::ReInit() {
413 /*
414 // Clear digitisation scheme
415 fDigiScheme->Clear();
416
417 // Build new digitisation scheme
418 if ( fDigiScheme->Init(fGeoPar, fDigiPar) ) {
419 MakeSets();
420 return kSUCCESS;
421 }
422*/
423 return kSUCCESS;//kERROR;
424
425}
426// -------------------------------------------------------------------------
427
428
429// ----- Private method MakeSets ---------------------------------------
430void CbmBmnStsDigitize::MakeSets() {
431
432
433}
434// -------------------------------------------------------------------------
435void CbmBmnStsDigitize::MakeSets1() { //with occupancy file - default not used
436
437
438}
439// -------------------------------------------------------------------------
440
441// ----- Private method Reset ------------------------------------------
442void CbmBmnStsDigitize::Reset() {
443 fNDigis = fNMulti = 0;
444 fFChannelPointsMap.clear();
445 fBChannelPointsMap.clear();
446 // if ( fDigis ) fDigis->Clear();
447 // if ( fDigiMatches ) fDigiMatches->Clear();
448 if ( fDigis ) fDigis->Delete();
449 if ( fDigisCSC ) fDigisCSC->Delete();
450 if ( fDigiMatches ) fDigiMatches->Delete();
451}
452// -------------------------------------------------------------------------
453
454
455// ----- Virtual method Finish -----------------------------------------
457
458 // u_gem.close();
459 /* cout << endl;
460 cout << "============================================================"
461 << endl;
462 cout << "===== " << fName << ": Run summary " << endl;
463 cout << "===== " << endl;
464 cout << "===== Events processed : " << setw(8) << fNEvents << endl;
465 cout.setf(ios_base::fixed, ios_base::floatfield);
466 cout << "===== Real time per event : "
467 << setw(8) << setprecision(4)
468 << fTime / fNEvents << " s" << endl;
469 cout << "===== StsPoints per event : "
470 << setw(8) << setprecision(2)
471 << fNPoints / fNEvents << endl;
472 cout << "===== StsDigis per event : "
473 << setw(8) << setprecision(2)
474 << (fNDigisFront+fNDigisBack) / fNEvents << endl;
475 cout << "===== Front digis per point : "
476 << setw(8) << setprecision(2)
477 << fNDigisFront / (fNPoints) << endl;
478 cout << "===== Back digis per point : "
479 << setw(8) << setprecision(2)
480 << fNDigisBack / (fNPoints) << endl;
481 cout << "============================================================"
482 << endl;
483*/
484}
485// -------------------------------------------------------------------------
486
487// -------------------------------------------------------------------------
488
489Int_t GetNofModules(TGeoNode* station) {
490
491 Int_t nModules = 0; //station->GetNdaughters();
492
493 // --- Modules
494
495 //*
496 for (Int_t iModule = 0; iModule < station->GetNdaughters(); iModule++) {
497 TGeoNode* module = station->GetDaughter(iModule);
498 if ( TString(module->GetName()).Contains("module") ) nModules++;
499 }
500 //*/
501
502 return nModules;
503}
504
505// -------------------------------------------------------------------------
506
508{
509
510 // Apply alignment
511
512 const int ip_r7[6][2]={0,1, 2,3, 4,5, 6,7, 8,9, 10,11};
513
514 TGeoNode* st_node = NULL;
515 // Get STS node
516 TGeoNode* sts = NULL;
517 gGeoManager->CdTop();
518 TGeoNode* cave = gGeoManager->GetCurrentNode();
519 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
520 TGeoNode* node = cave->GetDaughter(iNode);
521 TString name = node->GetName();
522 if ( name.Contains("GEMS_0") ) {
523 sts = node;
524 gGeoManager->CdDown(iNode);
525 break;
526 }
527 }
528 if ( ! sts ) {
529 cout << "-E- CbmBmnStsDigitize::ApplyAlignment: Cannot find top GEM node"
530 << endl;
531 //return kFALSE;
532 }
533
534 // Loop over stations in STS
535 Int_t statNr = 0;
536 Int_t nStat0 = sts->GetNdaughters();
537 //Int_t nMod0sts=0;
538
539 cout<<"STATIONS : "<<nStat0<<endl;
540
541 Double_t xAlign[ 26 ]=
542 {3.33029,-2.67835,2.82585 ,-3.14615, //I Si
543 2.85175, -3.11705, //II Si
544 8.91918 ,2.92088, -3.09752,-9.09492, 8.91198 ,2.94528 ,-2.98182,-8.98402, //III Si
545 -40.718 , 40.916, 41.087, -40.6, 42.28, -39.431, -38.452, 43.252, 44.078, -37.598, -36.8112, 44.8227};//GEM
546
547 Double_t yAlign[ 26 ]=
548 {4.46297,5.07597, -1.48803,-0.910531, //I Si
549 1.8115,1.42, //II Si
550 7.84856,7.80306,7.92256,7.85506,-4.57154,-4.61864, -4.43934,-4.51954, // III Si
551 22.5211, 22.2759, 22.574, 22.6124, 22.8827, 22.516, 22.5385, 22.9377, 22.5828, 22.3481, 22.7875, 23.007};//GEM
552
553 Double_t zAlign3[9] =
554 {14.352475, 17.68975, 26.2729875, //3 planes of Si
555 42.19995,67.76995,115.569,137.8325,163.54,186.103}; //6 planes of GEM
556
557 Double_t zAlign23[26] =
558 {-0.406375,0.430925,0.274025,-0.298575, // I Si
559 -0.43165,0.43165, //II Si
560 0.540813, -1.06009, 0.653113, -0.915988, -0.719887, 0.761012, -0.386287, 1.12281, //III Si
561 0.08685,-0.08685, -0.07145,0.07145, -0.128, 0.128, 0.0115,-0.0115, -0.004,0.004, 0,0}; //GEMS sensors
562
563 //Double_t driftcorr= 0;//-0.2;
564 Int_t stn=0,SensCh=0;
565
566 for (Int_t iNode = 0; iNode < nStat0; iNode++) {
567 // Go to station node
568 gGeoManager->CdDown(iNode);
569 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
570 TString statName = stationNode->GetName();
571 if ( ! statName.Contains("station") ) {
572 gGeoManager->CdUp();
573 continue;
574 }
575 ++stn; //AZ
576 ++ statNr;
577
578 TGeoHMatrix *matr = gGeoManager->GetCurrentMatrix();
579 Double_t* statTrans = matr->GetTranslation();
580 TGeoRotation *r2;
581 cout<<"statNr : "<<statNr <<", "<<statTrans[2] <<" zal: "<<zAlign3[statNr-1]<<endl;
582 statTrans[2] = zAlign3[statNr-1];//zAlign[statNr];
583
584 TGeoTranslation *t2 = new TGeoTranslation(statTrans[0],statTrans[1],statTrans[2]);
585
586 r2 = new TGeoRotation("rot",0,0,0);
587 TGeoCombiTrans *cc1 = new TGeoCombiTrans(*t2,*r2);
588
589 TGeoHMatrix *matr0 = new TGeoHMatrix(*cc1);
590 matr0->RegisterYourself();
591
592 // Int_t nModules = stationNode->GetNdaughters();
593 Int_t nModules = GetNofModules(stationNode);
594 // cout<<"nModules: "<<nModules<<endl;
595
596 sts->GetVolume()->AddNode((TGeoVolumeAssembly*)stationNode->GetVolume(),0,matr0); //AZ
597
598 //AZ- hard-coded st_node=sts->GetVolume()->GetNode(iNode+6);
599 st_node = (TGeoNode*) sts->GetVolume()->GetNodes()->Last(); //AZ
600
601 //-----------------------module translate-------------
602 Int_t moduleNr = 0, copy_no = 0;
603
604 // ---> Large sensors
605 for (Int_t iStatD = 0; iStatD < nModules; iStatD++) {
606 gGeoManager->CdDown(iStatD);
607
608 TGeoNode* module = gGeoManager->GetCurrentNode();
609 if ( ! TString(module->GetName()).Contains("module") ) {
610 gGeoManager->CdUp();
611 continue;
612 }
613 cout << iStatD << " " << module->GetName() << " stn: "<<statNr << endl;
614
615 //-------------------------add I II III Si----------------------------
616 if(iNode<=2){
617
618 Int_t nOfModSi=SensCh;//10+(moduleNr++);
619 cout<<"modSI: "<<nOfModSi<<" "<<zAlign23[nOfModSi]<<endl;
620
621 TGeoHMatrix *matrMod = gGeoManager->GetCurrentMatrix();
622 Double_t* modTrans = matrMod->GetTranslation();
623 //cout<<"trans: "<<modTrans[2]<<endl;
624 modTrans[0] = xAlign[nOfModSi];
625 modTrans[1] = yAlign[nOfModSi];
626 modTrans[2] = zAlign23[nOfModSi];//zAlign2[ipNr];
627 matrMod->SetTranslation(modTrans);
628 TGeoHMatrix *matr0Mod = new TGeoHMatrix(*matrMod);
629 matr0Mod->RegisterYourself();
630
631 st_node->GetVolume()->AddNode((TGeoVolumeAssembly*)module->GetVolume(),copy_no,matr0Mod);
632
633 //Double_t* modTrans1 = gGeoManager->GetCurrentMatrix()->GetTranslation();
634 copy_no++;
635 //delete matr0Mod;
636 gGeoManager->CdUp(); // back to module
637
638 SensCh++;
639
640 }
641 //-------------------------add I II III Si----------------------------
642
643
644 if(iNode>2){
645 if (TString(module->GetName()).Contains("Senso")) {
646
647 if(iStatD==0) moduleNr=0;
648 if(iStatD>0) moduleNr=1;
649
650 Int_t ipNr = 0;
651
652 TGeoHMatrix *matrMod = gGeoManager->GetCurrentMatrix();
653 Double_t* modTrans = matrMod->GetTranslation();
654 cout<<" aaaa ^^^^^^^^^^^^^^^^^^^ : "<<statNr-1;
655 cout<<"\n"<<moduleNr;
656 cout<<"\n"<<ip_r7[ (statNr-1)-3 ][moduleNr]<<endl;
657
658 modTrans[0] = xAlign[ip_r7[(statNr-1)-3][moduleNr]+14];
659 modTrans[1] = yAlign[ip_r7[(statNr-1)-3][moduleNr]+14];// - modTrans[1]; //not need anymore (- mod...)
660 modTrans[2] = zAlign23[ip_r7[(statNr-1)-3][moduleNr]+14];//zAlign2[ipNr];
661
662 matrMod->SetTranslation(modTrans);
663 TGeoHMatrix *matr0Mod = new TGeoHMatrix(*matrMod);
664 matr0Mod->RegisterYourself();
665 ipNr++;
666
667 st_node->GetVolume()->AddNode((TGeoVolumeAssembly*)module->GetVolume(),copy_no,matr0Mod);
668
669 copy_no++;
670 //delete matr0Mod;
671
672 }
673
674 gGeoManager->CdUp(); // back to module
675
676 }} // for (Int_t iStatD = 0; iStatD < nModules;
677 //----------------------end module translate----------
678 //delete matr0;
679 gGeoManager->CdUp(); // to sts
680 } // station loop
681
682 //Int_t snr=1;
683 vector<TGeoNode*> removNodes;
684 // Remove extra nodes
685 for (Int_t iNode = 0; iNode < nStat0; iNode++) {
686 // Go to station node
687 //gGeoManager->CdDown(1);
688 gGeoManager->CdDown(iNode);
689 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
690 cout<<" st name del: "<< stationNode->GetName()<< " iNode: "<<iNode<<endl;
691 /*if(iNode>2)*/ removNodes.push_back(stationNode);//sts->GetVolume()->RemoveNode(stationNode); //AZ
692 gGeoManager->CdUp(); // to sts
693 }
694
695 for (size_t o=0; o<removNodes.size(); o++)
696 sts->GetVolume()->RemoveNode(removNodes[o]);
697 removNodes.clear();
698
699
700 for (Int_t iNode = 0; iNode <nStat0; iNode++) {
701 // Go to station node
702 //gGeoManager->CdDown(iNode);
703 gGeoManager->CdDown(iNode);
704 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
705
706 TString statName = stationNode->GetName();
707 if ( ! statName.Contains("station") ) {
708 gGeoManager->CdUp();
709 continue;
710 }
711 if(iNode>2){
712 Int_t nMod = 2;
713 for (Int_t iStatD = 0; iStatD < nMod; iStatD++) {
714 gGeoManager->CdDown(0);//stationNode->GetNdaughters()-1);
715
716 TGeoNode* module = gGeoManager->GetCurrentNode();
717 // cout<<" 2 st name del: "<< stationNode->GetName()<<" mod name del: "<<module->GetName() << " i: "<<iStatD<<endl;
718 stationNode->GetVolume()->RemoveNode(module); //AZ
719
720 gGeoManager->CdUp(); // to sts
721 } } else{ //cout<<" nModules: "<<GetNofModules(stationNode)<<endl;
722 Int_t currNodes=GetNofModules(stationNode)/2;
723 for (Int_t iStatD = 0; iStatD <currNodes; iStatD++) {
724 gGeoManager->CdDown(0);//stationNode->GetNdaughters()-1);
725 TString mName = gGeoManager->GetCurrentNode()->GetName();
726 if(!mName.Contains("module")) {
727 gGeoManager->CdUp();
728 continue;
729 }
730 TGeoNode* moduleS = gGeoManager->GetCurrentNode();
731 // cout<<" DELETE VALUME: "<< stationNode->GetName()<<" mod name del: "<<moduleS->GetName() << " i: "<<iStatD<<endl;
732 stationNode->GetVolume()->RemoveNode(moduleS); //AZ
733
734 gGeoManager->CdUp(); // to sts
735 }
736
737 }
738
739 gGeoManager->CdUp();
740 }
741
742 for (Int_t iNode = 0; iNode < sts->GetNdaughters(); iNode++) {
743
744 // Go to station node
745 //gGeoManager->CdDown(iNode);
746 gGeoManager->CdDown(iNode);
747 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
748 cout<<" Check-in STATION: "<< stationNode->GetName()<<" zpos : "<<gGeoManager->GetCurrentMatrix()->GetTranslation()[2]<<endl;
749 for (Int_t iModule = 0; iModule < stationNode->GetNdaughters() ; iModule++) {
750 gGeoManager->CdDown(iModule);
751 TGeoNode* moduleNode = gGeoManager->GetCurrentNode();
752
753
754 TString gName = moduleNode->GetName();
755 if(gName.Contains("frame")) {
756 stationNode->GetVolume()->RemoveNode(moduleNode); // remove frames
757 iModule--;
758 gGeoManager->CdUp();
759 continue;
760 }
761
762
763 cout<<" Check-in st name : "<< stationNode->GetName()<<" mod name : "<<moduleNode->GetName()<<endl;
764 Double_t* sensTrans = gGeoManager->GetCurrentMatrix()->GetTranslation();
765 cout<<"trans mod: "<<sensTrans[0]<<" "<<sensTrans[1]<<" "<<sensTrans[2]<< endl;
766 for (Int_t iModule2 = 0; iModule2 < moduleNode->GetNdaughters() ; iModule2++) {
767 gGeoManager->CdDown(iModule2);
768 TGeoNode* moduleNode2 = gGeoManager->GetCurrentNode();
769
770 TString hName = moduleNode2->GetName();
771 if(hName.Contains("frame")) {
772 moduleNode->GetVolume()->RemoveNode(moduleNode2); // remove frames
773 iModule2--;
774 gGeoManager->CdUp();
775 continue;
776 }
777
778 cout<<" Check-in st name : "<< stationNode->GetName()<<" hot name : "<<moduleNode2->GetName()<<endl;
779 sensTrans = gGeoManager->GetCurrentMatrix()->GetTranslation();
780 cout<<"trans hot: "<<sensTrans[0]<<" "<<sensTrans[1]<<" "<<sensTrans[2]<< endl;
781
782 gGeoManager->CdUp();
783 }
784 // stationNode->GetVolume()->RemoveNode(moduleNode); //AZ
785 gGeoManager->CdUp();
786 }
787
788 gGeoManager->CdUp(); // to sts
789 }
790
791 //exit(0);
792 //gGeoManager->GetTopVolume()->Draw("ogl");
793 // gGeoManager->Export("SIGEMS_r7_eventDisplay.root","SIGEMS"); //with geomanager
794
795}
BmnSsdDigitizeParameters * fDigiPar
Digitisation parameters.
Int_t GetNofModules(TGeoNode *station)
Int_t GetStripNumber()
Int_t GetStripLayer()
Int_t GetStation()
Double_t GetStripSignal()
Int_t GetModule()
virtual void Exec(Option_t *opt)
void ProduceHitResponse(CbmStsSensor *sensor)
void Print(Bool_t kLong=kFALSE)
static CbmStsDigiScheme * Instance(int version=1)
Bool_t IsNewGeometry() const
-clang-format
STL namespace.