BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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 "TF1.h"
9#include "TGeoBBox.h"
10#include "TGeoManager.h"
11#include "TGeoMatrix.h"
12#include "TGeoNode.h"
13#include "TMath.h"
14#include "TObjArray.h"
15#include "TRandom3.h"
16
17// Includes from base
18#include "FairEventHeader.h"
19#include "FairRootManager.h"
20#include "FairRunAna.h"
21#include "FairRuntimeDb.h"
22
23// Includes from STS
24#include "BmnGemStripDigit.h"
25#include "BmnSiliconDigit.h"
26#include "BmnStripDigit.h"
27#include "BmnTrigDigit.h"
28#include "CbmBmnStsDigitize.h"
29#include "CbmGeoStsPar.h"
30#include "CbmStsDigi.h"
31#include "CbmStsDigiMatch.h"
32#include "CbmStsDigiPar.h"
33#include "CbmStsPoint.h"
34#include "CbmStsSector.h"
35#include "CbmStsSensor.h"
36#include "CbmStsStation.h"
37
38#include <iomanip>
39#include <iostream>
40#include <map>
41#include <vector>
42
43using namespace std;
44
46// ----- Default constructor ------------------------------------------
48 : FairTask("STS Digitizer", 1)
49 , fGeoPar(NULL)
50 , fDigiPar(NULL)
51 , fDigiScheme(NULL)
52 , fPoints(NULL)
53 , fPointsSI(NULL)
54 , fDigis(NULL)
55 , fDigisCSC(0)
56 , fDigiMatches(NULL)
57 , fNDigis(0)
58 , fNMulti(0)
59 , fNEvents(0)
60 , fNPoints(0)
61 , fNDigisFront(0)
62 , fNDigisBack(0)
63 , fTime(0.)
64 , fStep(0.001)
65 , fTimer()
68 , fFThreshold(4.0)
69 , fBThreshold(4.0)
70 , fFNoiseWidth(0.1)
71 , fBNoiseWidth(0.1)
72 , fStripDeadTime(10)
73 , fFNofBits(12)
74 , fBNofBits(12)
75 , fFNofElPerAdc(10.)
76 , fBNofElPerAdc(10.)
77 , fFNofSteps(0)
78 , fBNofSteps(0)
79 , fStripSignalF(NULL)
80 , fStripSignalB(NULL)
83 , fPointMap()
84{
85 // AZ fDigiScheme = new CbmStsDigiScheme();
87 Reset();
88}
89// -------------------------------------------------------------------------
90
91// ----- Standard constructor ------------------------------------------
93 : FairTask("STSDigitize", iVerbose)
94 , fGeoPar(NULL)
95 , fDigiPar(NULL)
96 , fDigiScheme(NULL)
97 , fPoints(NULL)
98 , fPointsSI(NULL)
99 , fDigis(NULL)
100 , fDigisCSC(0)
101 , fDigiMatches(NULL)
102 , fNDigis(0)
103 , fNMulti(0)
104 , fNEvents(0)
105 , fNPoints(0)
106 , fNDigisFront(0)
107 , fNDigisBack(0)
108 , fTime(0.)
109 , fStep(0.001)
110 , fTimer()
113 , fFThreshold(4.0)
114 , fBThreshold(4.0)
115 , fFNoiseWidth(0.1)
116 , fBNoiseWidth(0.1)
117 , fStripDeadTime(10)
118 , fFNofBits(12)
119 , fBNofBits(12)
120 , fFNofElPerAdc(10.)
121 , fBNofElPerAdc(10.)
122 , fFNofSteps(0)
123 , fBNofSteps(0)
124 , fStripSignalF(NULL)
125 , fStripSignalB(NULL)
128 , fPointMap()
129{
130 // AZ fDigiScheme = new CbmStsDigiScheme();
132 Reset();
133}
134// -------------------------------------------------------------------------
135
136// ----- Constructor with name -----------------------------------------
138 : FairTask(name, iVerbose)
139 , fGeoPar(NULL)
140 , fDigiPar(NULL)
141 , fDigiScheme(NULL)
142 , fPoints(NULL)
143 , fPointsSI(NULL)
144 , fDigis(NULL)
145 , fDigisCSC(0)
146 , fDigiMatches(NULL)
147 , fNDigis(0)
148 , fNMulti(0)
149 , fNEvents(0)
150 , fNPoints(0)
151 , fNDigisFront(0)
152 , fNDigisBack(0)
153 , fTime(0.)
154 , fStep(0.001)
155 , fTimer()
158 , fFThreshold(4.0)
159 , fBThreshold(4.0)
160 , fFNoiseWidth(0.1)
161 , fBNoiseWidth(0.1)
162 , fStripDeadTime(10)
163 , fFNofBits(12)
164 , fBNofBits(12)
165 , fFNofElPerAdc(10.)
166 , fBNofElPerAdc(10.)
167 , fFNofSteps(0)
168 , fBNofSteps(0)
169 , fStripSignalF(NULL)
170 , fStripSignalB(NULL)
173 , fPointMap()
174{
175 fGeoPar = NULL;
176 fDigiPar = NULL;
177 fPoints = NULL;
178 fDigis = NULL;
179 fDigisCSC = NULL;
180 fDigiMatches = NULL;
182 // AZ fDigiScheme = new CbmStsDigiScheme();
184 Reset();
185
186 fStep = 0.001;
187
188 fFThreshold = 4.0;
189 fBThreshold = 4.0;
190 fFNoiseWidth = 0.1;
191 fBNoiseWidth = 0.1;
192
193 fFNofBits = 12;
194 fBNofBits = 12;
195 fFNofElPerAdc = 10.;
196 fBNofElPerAdc = 10.;
197 fStripDeadTime = 10;
198 fNEvents = 0.;
199}
200// -------------------------------------------------------------------------
201
202// ----- Destructor ----------------------------------------------------
204{
205
206 if (fGeoPar)
207 delete fGeoPar;
208 if (fDigiPar)
209 delete fDigiPar;
210 if (fDigis) {
211 fDigis->Delete();
212 delete fDigis;
213 }
214 if (fDigisCSC) {
215 fDigisCSC->Delete();
216 delete fDigisCSC;
217 }
218 if (fDigiMatches) {
219 fDigiMatches->Delete();
220 delete fDigiMatches;
221 }
222 // AZ if ( fDigiScheme ) delete fDigiScheme;
223 Reset();
224}
225// -------------------------------------------------------------------------
226
227// ----- Public method Exec --------------------------------------------
229{
230
231 fTimer.Start();
232 Reset(); // AZ
233 Int_t stationNr = 0;
234 Int_t sectorNr = 0;
235 Int_t side = -1;
236 Int_t stripNr = 0;
237
238 // FairRunAna *run = FairRunAna::Instance();
239
240 Int_t nDigis = 0 /*, nDigisCSC=0*/;
241
242 if (fPointsSI->GetEntries() + fPoints->GetEntries() > 3000)
243 return;
244
245 for (Int_t iPointSI = 0; iPointSI < fPointsSI->GetEntries(); iPointSI++) {
246
247 BmnSiliconDigit* sidig = (BmnSiliconDigit*)fPointsSI->At(iPointSI);
248
249 // cout<<" Event: "<<fch<<" SI: "<<sidig->GetStation()<<" Mod: "<<sidig->GetModule()<<" Layer:
250 // "<<sidig->GetStripLayer()<<" strip Num: "<<sidig->GetStripNumber()<< " signal:
251 // "<<sidig->GetStripSignal()<<endl;
252
253 Double_t sisig = sidig->GetStripSignal();
254 Int_t stripNrSI = sidig->GetStripNumber() - 1; // GP kapishin MYSILICON start from num. 1
255 Int_t stationNrSI = sidig->GetStation();
256 Int_t sectorNrSI = -100; // start from num. 1
257 Int_t sideSI = -1;
258
259 if (sidig->GetStripLayer() == 1)
260 sideSI = 1;
261 else if (sidig->GetStripLayer() == 0)
262 sideSI = 0;
263
264 // Int_t simod=-100;
265 sectorNrSI = sidig->GetModule() + 1;
266
267 new ((*fDigis)[nDigis++]) CbmStsDigi(stationNrSI, sectorNrSI, sideSI, stripNrSI, sisig, 0); // AZ
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:
274 // "<<stdig->GetStripLayer()<<" strip Num: "<<stdig->GetStripNumber()<<
275 // " signal: "<<stdig->GetStripSignal()<<endl;
276 Double_t stsig = stdig->GetStripSignal();
277
278 stripNr = stdig->GetStripNumber() - 1; // GP kapishin STRIPGEM start from num. 1
279
280 if (stdig->GetStation() == 5 && stdig->GetModule() == 1 && stdig->GetStripLayer() == 2
281 && stdig->GetStripNumber() > 128 && stdig->GetStripNumber() < 257)
282 stripNr = stripNr - 2;
283
284 // if(TMath::Abs(stripNr-120)<=64) continue; //remove strips for MC && DATA compare
285
286 stationNr = stdig->GetStation();
287
288 if (stationNr == 3)
289 continue;
290 else if (stationNr > 3)
291 stationNr = stationNr - 1;
292
293 Int_t modNum = stdig->GetModule();
294
295 if ((stdig->GetStripLayer() == 0 || stdig->GetStripLayer() == 1) && modNum == 0)
296 sectorNr = 1;
297 if ((stdig->GetStripLayer() == 2 || stdig->GetStripLayer() == 3) && modNum == 0)
298 sectorNr = 2;
299
300 if ((stdig->GetStripLayer() == 0 || stdig->GetStripLayer() == 1) && modNum == 1)
301 sectorNr = 3;
302 if ((stdig->GetStripLayer() == 2 || stdig->GetStripLayer() == 3) && modNum == 1)
303 sectorNr = 4;
304
305 // if(stationNr==7) sectorNr=stdig->GetModule()*2+stdig->GetStripLayer()/2;
306
307 if ((stdig->GetStripLayer() == 0 || stdig->GetStripLayer() == 2))
308 side = 0; // true for small station
309 if ((stdig->GetStripLayer() == 1 || stdig->GetStripLayer() == 3))
310 side = 1; // true for small station
311
312 if (stationNr < 7)
313 new ((*fDigis)[nDigis++]) CbmStsDigi(stationNr + 3, sectorNr, side, stripNr, stsig, 0); // AZ
314 // else if(stationNr==7) new ((*fDigisCSC)[nDigisCSC++]) CbmStsDigi(stationNr+3, sectorNr, side, stripNr,
315 // stsig, 0); //AZ
316 }
317
318 fTimer.Stop();
319
320 fTime += fTimer.RealTime();
321}
322// -----------------------end Exec--------------------------------------------------
323
324// ----- Private method CrossSpacer ------------------------------------
326{
327
328 return kFALSE;
329}
330// -------------------------------------------------------------------------
331
332// ----- Private method ProduceHitResponse --------------------------------
334
335// ----- Private method SetParContainers -------------------------------
337{
338
339 // Get run and runtime database
340 FairRunAna* run = FairRunAna::Instance();
341 if (!run)
342 Fatal("SetParContainers", "No analysis run");
343
344 FairRuntimeDb* db = run->GetRuntimeDb();
345 if (!db)
346 Fatal("SetParContainers", "No runtime database");
347 // Get STS digitisation parameter container
348 fDigiPar = (CbmStsDigiPar*)db->getContainer("CbmStsDigiPar");
349}
350// -------------------------------------------------------------------------
351
352// ----- Private method Init -------------------------------------------
354{
355
356 // Get input array
357 FairRootManager* ioman = FairRootManager::Instance();
358 if (!ioman)
359 Fatal("Init", "No FairRootManager");
360 fPoints = (TClonesArray*)ioman->GetObject("STRIPGEM"); // StsPoint
361
362 fPointsSI = (TClonesArray*)ioman->GetObject("MYSILICON"); // StsPoint
363
364 fEventHeader = (TClonesArray*)ioman->GetObject("EventHeader"); // StsPoint
365
366 /*
367 fPointsT0=(TClonesArray*) ioman->GetObject("T0");
368 fPointsBC1=(TClonesArray*) ioman->GetObject("BC1");
369 fPointsBC2=(TClonesArray*) ioman->GetObject("BC2");
370 fPointsVeto=(TClonesArray*) ioman->GetObject("VC");
371 fPointsBD=(TClonesArray*) ioman->GetObject("BD");
372 fPointsSi=(TClonesArray*) ioman->GetObject("Si");
373*/
374 // fDigiMatches = new TClonesArray("CbmStsDigiMatch",1000);
375 // ioman->Register("StsDigiMatch", "Digi Match in STS", fDigiMatches, kTRUE);
376
377 // Register output array StsDigi
378 fDigis = new TClonesArray("CbmStsDigi", 1000);
379 ioman->Register("StsDigi", "Digital response in STS", fDigis, kTRUE);
380
381 // Register output array StsDigi
382 // fDigisCSC = new TClonesArray("CbmStsDigi",1000);
383 // ioman->Register("StsDigiCSC", "Digital response in STS", fDigisCSC, kTRUE);
384
385 ApplyAlignment(); // AZ
386 gGeoManager->CheckOverlaps(); // AZ
387 gGeoManager->PrintOverlaps(); // AZ
388
389 // Build digitisation scheme
390 if (fDigiScheme->Init(NULL, fDigiPar)) {
391 // MakeSets();
392
393 if (fVerbose == 1 || fVerbose == 2)
394 fDigiScheme->Print(kFALSE);
395 else if (fVerbose > 2)
396 fDigiScheme->Print(kTRUE);
397 cout << "-I- " << fName << "::Init: "
398 << "STS digitisation scheme succesfully initialised" << endl;
399 if (fDigiScheme->IsNewGeometry())
400 cout << "-I- Using new geometry" << endl;
401 cout << " Stations: " << fDigiScheme->GetNStations() << ", Sectors: " << fDigiScheme->GetNSectors()
402 << ", Channels: " << fDigiScheme->GetNChannels() << endl;
403
404 return kSUCCESS;
405 }
406
407 return kSUCCESS; // kERROR;
408}
409// -------------------------------------------------------------------------
410
411// ----- Private method ReInit -----------------------------------------
413{
414 /*
415 // Clear digitisation scheme
416 fDigiScheme->Clear();
417
418 // Build new digitisation scheme
419 if ( fDigiScheme->Init(fGeoPar, fDigiPar) ) {
420 MakeSets();
421 return kSUCCESS;
422 }
423*/
424 return kSUCCESS; // kERROR;
425}
426// -------------------------------------------------------------------------
427
428// ----- Private method MakeSets ---------------------------------------
430// -------------------------------------------------------------------------
432{ // with occupancy file - default not used
433}
434// -------------------------------------------------------------------------
435
436// ----- Private method Reset ------------------------------------------
438{
439 fNDigis = fNMulti = 0;
440 fFChannelPointsMap.clear();
441 fBChannelPointsMap.clear();
442 // if ( fDigis ) fDigis->Clear();
443 // if ( fDigiMatches ) fDigiMatches->Clear();
444 if (fDigis)
445 fDigis->Delete();
446 if (fDigisCSC)
447 fDigisCSC->Delete();
448 if (fDigiMatches)
449 fDigiMatches->Delete();
450}
451// -------------------------------------------------------------------------
452
453// ----- Virtual method Finish -----------------------------------------
455{
456
457 // u_gem.close();
458 /* cout << endl;
459 cout << "============================================================"
460 << endl;
461 cout << "===== " << fName << ": Run summary " << endl;
462 cout << "===== " << endl;
463 cout << "===== Events processed : " << setw(8) << fNEvents << endl;
464 cout.setf(ios_base::fixed, ios_base::floatfield);
465 cout << "===== Real time per event : "
466 << setw(8) << setprecision(4)
467 << fTime / fNEvents << " s" << endl;
468 cout << "===== StsPoints per event : "
469 << setw(8) << setprecision(2)
470 << fNPoints / fNEvents << endl;
471 cout << "===== StsDigis per event : "
472 << setw(8) << setprecision(2)
473 << (fNDigisFront+fNDigisBack) / fNEvents << endl;
474 cout << "===== Front digis per point : "
475 << setw(8) << setprecision(2)
476 << fNDigisFront / (fNPoints) << endl;
477 cout << "===== Back digis per point : "
478 << setw(8) << setprecision(2)
479 << fNDigisBack / (fNPoints) << endl;
480 cout << "============================================================"
481 << endl;
482*/
483}
484// -------------------------------------------------------------------------
485
486// -------------------------------------------------------------------------
487
489{
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"))
499 nModules++;
500 }
501 //*/
502
503 return nModules;
504}
505
506// -------------------------------------------------------------------------
507
509{
510
511 // Apply alignment
512
513 const int ip_r7[6][2] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
514
515 TGeoNode* st_node = NULL;
516 // Get STS node
517 TGeoNode* sts = NULL;
518 gGeoManager->CdTop();
519 TGeoNode* cave = gGeoManager->GetCurrentNode();
520 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
521 TGeoNode* node = cave->GetDaughter(iNode);
522 TString name = node->GetName();
523 if (name.Contains("GEMS_0")) {
524 sts = node;
525 gGeoManager->CdDown(iNode);
526 break;
527 }
528 }
529 if (!sts) {
530 cout << "-E- CbmBmnStsDigitize::ApplyAlignment: Cannot find top GEM node" << 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] = {3.33029, -2.67835, 2.82585, -3.14615, // I Si
542 2.85175, -3.11705, // II Si
543 8.91918, 2.92088, -3.09752, -9.09492, 8.91198, 2.94528, -2.98182, -8.98402, // III Si
544 -40.718, 40.916, 41.087, -40.6, 42.28, -39.431, -38.452, 43.252,
545 44.078, -37.598, -36.8112, 44.8227}; // GEM
546
547 Double_t yAlign[26] = {4.46297, 5.07597, -1.48803, -0.910531, // I Si
548 1.8115, 1.42, // II Si
549 7.84856, 7.80306, 7.92256, 7.85506, -4.57154, -4.61864, -4.43934, -4.51954, // III Si
550 22.5211, 22.2759, 22.574, 22.6124, 22.8827, 22.516, 22.5385, 22.9377,
551 22.5828, 22.3481, 22.7875, 23.007}; // GEM
552
553 Double_t zAlign3[9] = {14.352475, 17.68975, 26.2729875, // 3 planes of Si
554 42.19995, 67.76995, 115.569, 137.8325, 163.54, 186.103}; // 6 planes of GEM
555
556 Double_t zAlign23[26] = {
557 -0.406375, 0.430925, 0.274025, -0.298575, // I Si
558 -0.43165, 0.43165, // II Si
559 0.540813, -1.06009, 0.653113, -0.915988, -0.719887, 0.761012, -0.386287, 1.12281, // III Si
560 0.08685, -0.08685, -0.07145, 0.07145, -0.128, 0.128, 0.0115, -0.0115,
561 -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 //-------------------------add I II III Si----------------------------
641
642 if (iNode > 2) {
643 if (TString(module->GetName()).Contains("Senso")) {
644
645 if (iStatD == 0)
646 moduleNr = 0;
647 if (iStatD > 0)
648 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]
660 + 14]; // - modTrans[1]; //not need anymore (- mod...)
661 modTrans[2] = zAlign23[ip_r7[(statNr - 1) - 3][moduleNr] + 14]; // zAlign2[ipNr];
662
663 matrMod->SetTranslation(modTrans);
664 TGeoHMatrix* matr0Mod = new TGeoHMatrix(*matrMod);
665 matr0Mod->RegisterYourself();
666 ipNr++;
667
668 st_node->GetVolume()->AddNode((TGeoVolumeAssembly*)module->GetVolume(), copy_no, matr0Mod);
669
670 copy_no++;
671 // delete matr0Mod;
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 for (Int_t iNode = 0; iNode < nStat0; iNode++) {
700 // Go to station node
701 // gGeoManager->CdDown(iNode);
702 gGeoManager->CdDown(iNode);
703 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
704
705 TString statName = stationNode->GetName();
706 if (!statName.Contains("station")) {
707 gGeoManager->CdUp();
708 continue;
709 }
710 if (iNode > 2) {
711 Int_t nMod = 2;
712 for (Int_t iStatD = 0; iStatD < nMod; iStatD++) {
713 gGeoManager->CdDown(0); // stationNode->GetNdaughters()-1);
714
715 TGeoNode* module = gGeoManager->GetCurrentNode();
716 // cout<<" 2 st name del: "<< stationNode->GetName()<<" mod name del: "<<module->GetName() << " i:
717 // "<<iStatD<<endl;
718 stationNode->GetVolume()->RemoveNode(module); // AZ
719
720 gGeoManager->CdUp(); // to sts
721 }
722 } else { // cout<<" nModules: "<<GetNofModules(stationNode)<<endl;
723 Int_t currNodes = GetNofModules(stationNode) / 2;
724 for (Int_t iStatD = 0; iStatD < currNodes; iStatD++) {
725 gGeoManager->CdDown(0); // stationNode->GetNdaughters()-1);
726 TString mName = gGeoManager->GetCurrentNode()->GetName();
727 if (!mName.Contains("module")) {
728 gGeoManager->CdUp();
729 continue;
730 }
731 TGeoNode* moduleS = gGeoManager->GetCurrentNode();
732 // cout<<" DELETE VALUME: "<< stationNode->GetName()<<" mod name del: "<<moduleS->GetName() << " i:
733 // "<<iStatD<<endl;
734 stationNode->GetVolume()->RemoveNode(moduleS); // AZ
735
736 gGeoManager->CdUp(); // to sts
737 }
738 }
739
740 gGeoManager->CdUp();
741 }
742
743 for (Int_t iNode = 0; iNode < sts->GetNdaughters(); iNode++) {
744
745 // Go to station node
746 // gGeoManager->CdDown(iNode);
747 gGeoManager->CdDown(iNode);
748 TGeoNode* stationNode = gGeoManager->GetCurrentNode();
749 cout << " Check-in STATION: " << stationNode->GetName()
750 << " zpos : " << gGeoManager->GetCurrentMatrix()->GetTranslation()[2] << endl;
751 for (Int_t iModule = 0; iModule < stationNode->GetNdaughters(); iModule++) {
752 gGeoManager->CdDown(iModule);
753 TGeoNode* moduleNode = gGeoManager->GetCurrentNode();
754
755 TString gName = moduleNode->GetName();
756 if (gName.Contains("frame")) {
757 stationNode->GetVolume()->RemoveNode(moduleNode); // remove frames
758 iModule--;
759 gGeoManager->CdUp();
760 continue;
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()
779 << endl;
780 sensTrans = gGeoManager->GetCurrentMatrix()->GetTranslation();
781 cout << "trans hot: " << sensTrans[0] << " " << sensTrans[1] << " " << sensTrans[2] << endl;
782
783 gGeoManager->CdUp();
784 }
785 // stationNode->GetVolume()->RemoveNode(moduleNode); //AZ
786 gGeoManager->CdUp();
787 }
788
789 gGeoManager->CdUp(); // to sts
790 }
791
792 // exit(0);
793 // gGeoManager->GetTopVolume()->Draw("ogl");
794 // gGeoManager->Export("SIGEMS_r7_eventDisplay.root","SIGEMS"); //with geomanager
795}
Int_t GetNofModules(TGeoNode *station)
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TGeoManager * gGeoManager
Int_t GetStripNumber()
Int_t GetStripLayer()
Int_t GetStation()
Double_t GetStripSignal()
Int_t GetModule()
TClonesArray * fDigis
Input array of CbmStsDigi from T0.
CbmGeoStsPar * fGeoPar
void Reset()
Reset eventwise counters.
Bool_t CrossSpacer(const TGeoNode *node, const CbmStsPoint *point)
AZ Check if particle goes thru the spacer (dead space).
TClonesArray * fPoints
Digitisation scheme.
map< Int_t, set< Int_t > > fFChannelPointsMap
virtual void Finish()
Virtual method Finish.
map< Int_t, set< Int_t > > fBChannelPointsMap
virtual void Exec(Option_t *opt)
Execution.
virtual ~CbmBmnStsDigitize()
Destructor.
CbmBmnStsDigitize()
Default constructor.
TClonesArray * fPointsSI
Input array of CbmStsDigi from GEM.
virtual void SetParContainers()
Get parameter containers.
void ProduceHitResponse(CbmStsSensor *sensor)
CbmStsDigiPar * fDigiPar
Geometry parameter container.
CbmStsDigiScheme * fDigiScheme
Digitisation parameter container.
virtual InitStatus Init()
Intialisation.
TClonesArray * fEventHeader
Output array of CbmStsDigiMatches.
TClonesArray * fDigiMatches
Output array of CbmStsDigi.
map< CbmStsSensor *, set< Int_t > > fPointMap
TClonesArray * fDigisCSC
Output array of CbmStsDigi.
virtual InitStatus ReInit()
Reinitialisation.
void MakeSets()
Make sensorwise set for points.
static CbmStsDigiScheme * Instance(int version=1)
CbmStsDigi.h.
Definition CbmStsDigi.h:32
virtual Double_t * GetTranslation()
void SetTranslation(const Double_t *vect)
virtual void RegisterYourself()
TGeoVolume * GetVolume() const
Int_t GetNdaughters() const
TGeoNode * GetDaughter(Int_t ind) const
void RemoveNode(TGeoNode *node)
virtual TGeoNode * AddNode(TGeoVolume *vol, Int_t copy_no, TGeoMatrix *mat=nullptr, Option_t *option="")
TObjArray * GetNodes()
const char * GetName() const override
TObject * Last() const override
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition json.hpp:4446