BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnGemStripHitMaker.cxx
Go to the documentation of this file.
2
3#include "BmnEventHeader.h"
4#include "FairLinkManager.h"
5#include "FairRunAna.h"
6#include "TSystem.h"
7#include "UniDetectorParameter.h"
8
9#include <TChain.h>
10#include <TRandom.h>
11#include <TStopwatch.h>
12#include <zlib.h>
13
14static Double_t workTime = 0.0;
15
18{
19
20 fInputPointsBranchName = "StsPoint";
21 fInputDigitsBranchName = "BmnGemStripDigit";
22 fInputDigitMatchesBranchName = "BmnGemStripDigitMatch";
23
24 fOutputHitsBranchName = "BmnGemStripHit";
25
26 fField = NULL;
27 fFieldScale = 0.0;
28
30 StationSet = nullptr;
31 GlobalModTransfSet = nullptr;
32
33 fBmnGemStripHitsArray = nullptr;
36}
37
40{
41
42 fInputPointsBranchName = "StsPoint";
43 fInputDigitsBranchName = (!isExp) ? "BmnGemStripDigit" : "GEM";
44
45 fRunPeriod = run_period;
46 fRunNumber = run_number;
47
48 fIsExp = isExp;
49 fIsSrc = isSrc;
50
51 fSignalLow = 0.;
52 fSignalUp = DBL_MAX;
53
54 fInputDigitMatchesBranchName = "BmnGemStripDigitMatch";
55
56 fOutputHitsBranchName = "BmnGemStripHit";
57
58 fField = NULL;
59 fFieldScale = 0.0;
60
62 StationSet = nullptr;
63 GlobalModTransfSet = nullptr;
64
65 fBmnGemStripHitsArray = nullptr;
68
69 switch (fRunPeriod) {
70 case 6: // BM@N RUN-6
72 break;
73 case 7: // BM@N RUN-7 (and SRC)
74 if (fIsSrc) {
76 } else {
78 }
79 break;
80 case 8: // BM@N RUN-8
81 if (fIsSrc) {
83 } else {
85 }
86 break;
87 case 9: // BM@N RUN-9
89 break;
90
91 default:
93 }
94}
95
97{
98 TString gPathGemConfig = gSystem->Getenv("VMCWORKDIR");
99 gPathGemConfig += "/parameters/gem/XMLConfigs/";
100
101 switch (fCurrentConfig) {
103 XMLConfigFile = gPathGemConfig + "GemRunSpring2017.xml";
104 if (fVerbose)
105 cout << " Current GEM Configuration : RunSpring2017"
106 << "\n";
107 break;
108
110 XMLConfigFile = gPathGemConfig + "GemRunSpring2018.xml";
111 if (fVerbose)
112 cout << " Current GEM Configuration : RunSpring2018"
113 << "\n";
114 break;
115
117
118 XMLConfigFile = gPathGemConfig + "GemRunSRCSpring2018.xml";
119 if (fVerbose)
120 cout << " Current GEM Configuration : GemRunSRCSpring2018"
121 << "\n";
122 break;
123
125 XMLConfigFile = gPathGemConfig + "GemRunSRC2021.xml";
126 if (fVerbose)
127 cout << " Current GEM Configuration : RunSRC2021"
128 << "\n";
129 break;
130
132 XMLConfigFile = gPathGemConfig + "GemRun8.xml";
133 if (fVerbose)
134 cout << " Current GEM Configuration : Run8"
135 << "\n";
136 break;
137
139 XMLConfigFile = gPathGemConfig + "GemRun9.xml";
140 if (fVerbose)
141 cout << " Current GEM Configuration : Run9"
142 << "\n";
143 break;
144
145 default:;
146 }
147
148 if (!gSystem->AccessPathName(XMLConfigFile)) { // returns FALSE if the file exists
149 if (fVerbose)
150 cout << " XMLConfigFile : " << XMLConfigFile << "\n";
153 GlobalModTransfSet->LoadFromXMLFile(XMLConfigFile);
154 } else {
155 Fatal("BmnGemStripHitMaker::createGemDetector()", " !!! Current configuration is not set !!! ");
156 }
157
158 const Int_t nStat = StationSet->GetNStations();
159 fLorCor = new Double_t*[nStat];
160 for (Int_t iStat = 0; iStat < nStat; iStat++) {
161 const Int_t nParams = 3;
162 fLorCor[iStat] = new Double_t[nParams];
163 for (Int_t iPar = 0; iPar < nParams; iPar++) {
164 fLorCor[iStat][iPar] = 0.0;
165 }
166 }
167
168 if (fRunPeriod == 7) {
169 if (fIsExp) {
170 UniDetectorParameter* coeffLorCorrs =
172 vector<UniValue*> shifts;
173 if (coeffLorCorrs)
174 coeffLorCorrs->GetValue(shifts);
175 for (Int_t iStat = 0; iStat < nStat; iStat++) {
176 const Int_t nParams = 3;
177 for (Int_t iPar = 0; iPar < nParams; iPar++) {
178 fLorCor[iStat][iPar] = (coeffLorCorrs) ? ((LorentzShiftValue*)shifts[iStat])->ls[iPar] : 0.0;
179 // printf("fLorCor[%d][%d] = %f\n", iStat, iPar, fLorCor[iStat][iPar]);
180 }
181 }
182 }
183 // AZ-110625 } else if (fRunPeriod == 8) {
184 } else if (fRunPeriod >= 8) { // AZ-110625
185 for (Int_t iStat = 0; iStat < nStat; iStat++) {
186 // Pol2 approximation of the next configuration:
187 // BmnGemStripMediumConfiguration::ARC4H10_80_20_E_1720_2240_3230_3730_B_0_8T
188 fLorCor[iStat][0] = -0.01710;
189 fLorCor[iStat][1] = 0.01730;
190 fLorCor[iStat][2] = 0.00024;
191 }
192 }
193
194 if (fIsExp) {
195 UniDetectorParameter* coeffAlignCorrs =
197 vector<UniValue*> algnShifts;
198 if (coeffAlignCorrs)
199 coeffAlignCorrs->GetValue(algnShifts);
200 fAlignCor = new Double_t**[nStat];
201 for (Int_t iStat = 0; iStat < nStat; iStat++) {
202 const Int_t nParams = 3;
203 Int_t nModul = StationSet->GetGemStation(iStat)->GetNModules();
204 fAlignCor[iStat] = new Double_t*[nModul];
205 for (Int_t iMod = 0; iMod < nModul; iMod++) {
206 fAlignCor[iStat][iMod] = new Double_t[nParams];
207 for (Int_t iPar = 0; iPar < nParams; iPar++) {
208 // cout << iStat << " " << iMod << ": " << ((AlignmentValue*)algnShifts[iStat * nModul +
209 // iMod])->value[iPar] << endl;
210 fAlignCor[iStat][iMod][iPar] =
211 (coeffAlignCorrs) ? ((AlignmentValue*)algnShifts[iStat * nModul + iMod])->value[iPar] : 0.0;
212 }
213 }
214 }
215 }
216}
217
219{
220 if (fIsExp) {
221 for (Int_t iStat = 0; iStat < StationSet->GetNStations(); iStat++) {
222 for (Int_t iMod = 0; iMod < StationSet->GetGemStation(iStat)->GetNModules(); iMod++) {
223 delete[] fAlignCor[iStat][iMod];
224 }
225 delete[] fAlignCor[iStat];
226 }
227 delete[] fAlignCor;
228 }
229 for (Int_t iStat = 0; iStat < StationSet->GetNStations(); iStat++) {
230 delete[] fLorCor[iStat];
231 }
232 delete[] fLorCor;
233
234 if (StationSet) {
235 delete StationSet;
236 }
237
238 if (GlobalModTransfSet) {
239 delete GlobalModTransfSet;
240 }
241
243 fBmnGemStripHitsArray->Delete();
245 }
249 }
253 }
254}
255
257{
258
259 if (fVerbose > 1)
260 cout << "=================== BmnGemStripHitMaker::Init() started ===============" << endl;
261
263
264 FairRootManager* ioman = FairRootManager::Instance();
265
268 cout << "BmnGemStripHitMaker::Init(): branch " << fInputDigitsBranchName
269 << " not found! Task will be deactivated" << endl;
270 SetActive(kFALSE);
271 return kERROR;
272 }
273
275
276 if (fVerbose > 1) {
278 cout << " Strip matching information exists!\n";
279 else
280 cout << " Strip matching information doesn`t exist!\n";
281 }
282
283 // AZ-240726
285 //
287 ioman->Register(fOutputHitsBranchName, "GEM", fBmnGemStripHitsArray, kTRUE);
288 fBmnGemUpperClustersArray = new TClonesArray("StripCluster");
289 ioman->Register("BmnGemUpperCluster", "GEM", fBmnGemUpperClustersArray, kTRUE);
290 fBmnGemLowerClustersArray = new TClonesArray("StripCluster");
291 ioman->Register("BmnGemLowerCluster", "GEM", fBmnGemLowerClustersArray, kTRUE);
292
293 fField = FairRunAna::Instance()->GetField();
294 if (!fField)
295 // Fatal("Init", "No Magnetic Field found");
296 Warning("Init", "No Magnetic Field found");
297
298 //--------------------------------------------------------------------------
299
300 if (fVerbose > 1)
301 cout << "=================== BmnGemStripHitMaker::Init() finished ==============" << endl;
302
303 return kSUCCESS;
304}
305
307{
308
309 TStopwatch sw;
310 sw.Start();
311
312 if (!IsActive())
313 return;
314
315 fBmnGemStripHitsArray->Delete();
318
321
322 if (fVerbose > 1)
323 cout << "=================== BmnGemStripHitMaker::Exec() started ===============" << endl;
324
325 if (fVerbose > 1)
326 cout << " BmnGemStripHitMaker::Exec(), Number of BmnGemStripDigits = "
327 << fBmnGemStripDigitsArray->GetEntriesFast() << "\n";
328
330
331 if (fVerbose > 1)
332 cout << "=================== BmnGemStripHitMaker::Exec() finished ==============" << endl;
333
334 sw.Stop();
335 workTime += sw.RealTime();
336}
337
339{
340
341 // FairMCPoint* MCPoint;
342 BmnGemStripDigit* digit;
343 BmnMatch* strip_match; // MC-information for a strip
344
345 // Loading digits ---------------------------------------------------------------
346 Int_t AddedDigits = 0;
347 Int_t AddedStripDigitMatches = 0;
348
349 for (Int_t idigit = 0; idigit < fBmnGemStripDigitsArray->GetEntriesFast(); idigit++) {
350 digit = (BmnGemStripDigit*)fBmnGemStripDigitsArray->At(idigit);
351 if (!digit->IsGoodDigit())
352 continue;
353
354 if (digit->GetStripSignal() < fSignalLow || digit->GetStripSignal() > fSignalUp)
355 continue;
356
357 BmnGemStripStation* station = StationSet->GetGemStation(digit->GetStation());
358 BmnGemStripModule* module = station->GetModule(digit->GetModule());
359
360 if (module->SetStripSignalInLayer(digit->GetStripLayer(), digit->GetStripNumber(), digit->GetStripSignal()))
361 AddedDigits++;
362
363 // Add a MC-match to the current strip if this MC-match array exists
365 strip_match = (BmnMatch*)fBmnGemStripDigitMatchesArray->At(idigit);
366 if (module->SetStripMatchInLayer(digit->GetStripLayer(), digit->GetStripNumber(), *strip_match))
367 AddedStripDigitMatches++;
368 }
369
370 // Add a digit number match to the current strip
371 BmnMatch stripDigitNumberMatch; // digit number information for the current strip
372 stripDigitNumberMatch.AddLink(1.0, idigit);
373 module->SetStripDigitNumberMatchInLayer(digit->GetStripLayer(), digit->GetStripNumber(), stripDigitNumberMatch);
374 }
375
376 if (fVerbose > 1)
377 cout << " Processed strip digits : " << AddedDigits << "\n";
378 if (fVerbose > 1 && fBmnGemStripDigitMatchesArray)
379 cout << " Added strip digit MC-matches : " << AddedStripDigitMatches << "\n";
380 //------------------------------------------------------------------------------
381
382 // Processing digits
383 StationSet->ProcessPointsInDetector();
384
385 Int_t NCalculatedPoints = StationSet->CountNProcessedPointsInDetector();
386 if (fVerbose > 1)
387 cout << " Calculated points : " << NCalculatedPoints << "\n";
388 if (fVerbose == 1)
389 cout << "BmnGemStripHitMaker: " << NCalculatedPoints << " hits\n";
390
391 Int_t clear_matched_points_cnt = 0; // points with the only one match-index
392
393 map<Int_t, StripCluster> UniqueUpperClusters;
394 map<Int_t, StripCluster> UniqueLowerClusters;
395
396 int fieldFlag = 0; // AZ-120823
397 Double_t Bx = 0.;
398 Double_t By = 0.;
399 if (fField) {
400 if (Abs(fField->GetBy(0., 0., 0.)) > FLT_EPSILON)
401 fieldFlag = 1; // AZ-120823
402 Bx = Abs(fField->GetBx(0.0, 0.0, 135.0)); // AZ-090823 - fixed value (for more stability)
403 By = Abs(fField->GetBy(0.0, 0.0, 135.0)); // AZ-090823
404 }
405
406 for (Int_t iStation = 0; iStation < StationSet->GetNStations(); ++iStation) {
407 BmnGemStripStation* station = StationSet->GetGemStation(iStation);
408
409 for (Int_t iModule = 0; iModule < station->GetNModules(); ++iModule) {
410 BmnGemStripModule* module = station->GetModule(iModule);
411
412 for (Int_t iLayer = 0; iLayer < module->GetNStripLayers(); ++iLayer) {
413 BmnGemStripLayer layer = module->GetStripLayer(iLayer);
414
415 for (size_t iCluster = 0; iCluster < layer.GetStripClusters().size(); ++iCluster) {
416 StripCluster cluster = layer.GetStripClusters()[iCluster];
417 cluster.SetModule(iModule);
418 cluster.SetStation(iStation);
419
420 // Saving all strip clusters into branches (each cluster have its own unique id in the current
421 // event)
422 if (cluster.GetType() == UpperStripLayer) {
423 new ((*fBmnGemUpperClustersArray)[fBmnGemUpperClustersArray->GetEntriesFast()])
424 StripCluster(cluster);
425 } else {
426 new ((*fBmnGemLowerClustersArray)[fBmnGemLowerClustersArray->GetEntriesFast()])
427 StripCluster(cluster);
428 }
429 }
430 }
431
432 Int_t NIntersectionPointsInModule = module->GetNIntersectionPoints();
433
434 // Int_t NPseudoIntersectionsInModule = module->GetNPseudoIntersections();
435 Int_t NPseudoIntersectionsInModule = 0; // !!! IGNORE PSEUDO INTERSECTIONS !!!
436
437 for (Int_t iPoint = 0; iPoint < NIntersectionPointsInModule + NPseudoIntersectionsInModule; ++iPoint) {
438
439 // Double_t threshold = 2000000; // ADC
440
441 // Double_t sigL;
442 // Double_t sigU;
443 Double_t x, y, z;
444 Double_t x_err, y_err, z_err;
445
446 if (iPoint < NIntersectionPointsInModule) {
447 // sigL = module->GetIntersectionPoint_LowerLayerSripTotalSignal(iPoint);
448 // sigU = module->GetIntersectionPoint_UpperLayerSripTotalSignal(iPoint);
449 x = module->GetIntersectionPointX(iPoint);
450 y = module->GetIntersectionPointY(iPoint);
451 z = module->GetZPositionRegistered();
452 x_err = module->GetIntersectionPointXError(iPoint);
453 y_err = module->GetIntersectionPointYError(iPoint);
454 z_err = 0.0;
455 } else {
456 // sigL =
457 // module->GetPseudoIntersection_LowerLayerSripTotalSignal(iPoint -
458 // NIntersectionPointsInModule);
459 // sigU =
460 // module->GetPseudoIntersection_UpperLayerSripTotalSignal(iPoint -
461 // NIntersectionPointsInModule);
462 x = module->GetPseudoIntersectionX(iPoint - NIntersectionPointsInModule);
463 y = module->GetPseudoIntersectionY(iPoint - NIntersectionPointsInModule);
464 z = module->GetZPositionRegistered();
465 x_err = module->GetPseudoIntersectionXError(iPoint - NIntersectionPointsInModule);
466 y_err = module->GetPseudoIntersectionYError(iPoint - NIntersectionPointsInModule);
467 z_err = 0.0;
468 }
469
470 if (fIsExp && !fIsSrc)
471 z += fAlignCor[iStation][iModule][2]; // alignment implementation
472
473 // Apply global module transforms to detector hit (in right-handed system)
474 if (GlobalModTransfSet) {
475 Plane3D::Point point_transformed =
476 GlobalModTransfSet->ApplyTransforms(Plane3D::Point(-x, y, z), iStation, iModule);
477 x = -point_transformed.X(); // convert to detector system (x-inverted)
478 y = point_transformed.Y();
479 z = point_transformed.Z();
480 }
481
482 Int_t RefMCIndex = -1;
483
484 // MC-matching for the current hit (define RefMCIndex)) ---------
485 BmnMatch mc_match_hit;
486 if (iPoint < NIntersectionPointsInModule) {
487 mc_match_hit = module->GetIntersectionPointMatch(iPoint);
488 } else {
489 mc_match_hit = module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
490 }
491
492 Int_t most_probably_index = -1;
493 Double_t max_weight = 0;
494
495 Int_t n_links = mc_match_hit.GetNofLinks();
496 if (n_links == 1)
497 clear_matched_points_cnt++;
498 for (Int_t ilink = 0; ilink < n_links; ilink++) {
499 Int_t index = mc_match_hit.GetLink(ilink).GetIndex();
500 Double_t weight = mc_match_hit.GetLink(ilink).GetWeight();
501 if (weight > max_weight) {
502 max_weight = weight;
503 most_probably_index = index;
504 }
505 }
506
507 RefMCIndex = most_probably_index;
508 //--------------------------------------------------------------
509
510 // Add hit ------------------------------------------------------
511 x *= -1; // invert to global X
512
513 if (fIsExp) {
514 x += fAlignCor[iStation][iModule][0];
515 y += fAlignCor[iStation][iModule][1];
516 }
517
518 if (fieldFlag) { // AZ-120823
519 // AZ-120823 if (Abs(fField->GetBy(0., 0., 0.)) > FLT_EPSILON) {
520 if (!fIsSrc) { // For SRC lorentz corrections included into fAlignCor
521 // AZ-090823 Double_t Bx = Abs(fField->GetBx(x, y, z));
522 // AZ-090823 Double_t By = Abs(fField->GetBy(x, y, z));
523 // Bx = Abs(fField->GetBx(x, y, z)); //AZ-130823
524 // By = Abs(fField->GetBy(x, y, z)); //AZ-130823
525 Double_t yCor =
526 fLorCor[iStation][0] + fLorCor[iStation][1] * Bx + fLorCor[iStation][2] * Bx * Bx;
527 Double_t xCor =
528 fLorCor[iStation][0] + fLorCor[iStation][1] * By + fLorCor[iStation][2] * By * By;
529 if (!fIsExp)
530 yCor += 0.014; // AZ-191223
531 if (int(TMath::Abs(By) + 0.5) == 4) {
532 // AZ-110826 - 0.4T (Xe@1.6 GeV)
533 if (fIsExp) {
534 // xCor += 0.0160; //!!! AZ-should be removed in future
535 // yCor += 0.0140;
536 } else {
537 xCor -= 0.0080; // AZ-110826
538 yCor -= 0.0080; // AZ-110826
539 }
540 } else if (int(TMath::Abs(By) + 0.5) == 6) {
541 // AZ-180822 - 0.6T
542 xCor += 0.0180;
543 yCor += 0.0140;
544 } else {
545 // AZ-030823 - new field
546 // xCor += 0.0175;
547 // yCor += 0.0150;
548 }
549
550 Int_t sign = (module->GetElectronDriftDirection() == ForwardZAxisEDrift) ? +1 : -1;
551 x += xCor * sign;
552 y += yCor * sign;
553 }
554 }
555
556 new ((*fBmnGemStripHitsArray)[fBmnGemStripHitsArray->GetEntriesFast()])
557 BmnGemStripHit(0, TVector3(x, y, z), TVector3(x_err, y_err, z_err), RefMCIndex);
558
559 BmnGemStripHit* hit =
561 hit->SetStation(iStation);
562 hit->SetModule(iModule);
563 hit->SetIndex(fBmnGemStripHitsArray->GetEntriesFast() - 1);
564
565 if (iPoint < NIntersectionPointsInModule) {
567 module->GetIntersectionPointDigitNumberMatch(iPoint)); // digit number match for the hit
568 hit->SetUpperClusterIndex(module->GetUpperCluster(iPoint).GetUniqueID());
569 hit->SetLowerClusterIndex(module->GetLowerCluster(iPoint).GetUniqueID());
570 hit->SetPseudo(false);
571 } else {
573 iPoint - NIntersectionPointsInModule)); // digit number match for the hit
575 module->GetUpperCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
576 .GetUniqueID());
578 module->GetLowerCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
579 .GetUniqueID());
580 hit->SetPseudo(true);
581 }
582 /*
583 StripCluster ucls = module->GetUpperCluster(iPoint);
584 StripCluster lcls = module->GetLowerCluster(iPoint);
585 ucls.SetModule(iModule);
586 lcls.SetModule(iModule);
587 ucls.SetStation(iStation);
588 lcls.SetStation(iStation);
589 UniqueUpperClusters[ucls.GetUniqueID()] = ucls;
590 UniqueLowerClusters[lcls.GetUniqueID()] = lcls;
591 hit->SetUpperClusterIndex(ucls.GetUniqueID());
592 hit->SetLowerClusterIndex(lcls.GetUniqueID());
593 */
594 if (fHitMatching) {
595 BmnMatch digiMatch;
596 Int_t idx0, idx1;
597 if (iPoint < NIntersectionPointsInModule) {
598 digiMatch = module->GetIntersectionPointDigitNumberMatch(iPoint);
599 idx0 = digiMatch.GetLink(0).GetIndex();
600 idx1 = digiMatch.GetLink(1).GetIndex();
601 } else {
602 digiMatch = module->GetPseudoIntersectionDigitNumberMatch(iPoint - NIntersectionPointsInModule);
603 idx0 = digiMatch.GetLink(0).GetIndex();
604 idx1 = digiMatch.GetLink(0).GetIndex();
605 }
606 BmnMatch* digiMatch0 = (BmnMatch*)fBmnGemStripDigitMatchesArray->At(idx0);
607 BmnMatch* digiMatch1 = (BmnMatch*)fBmnGemStripDigitMatchesArray->At(idx1);
608
609 Bool_t hitOk = kFALSE;
610 for (Int_t ilink = 0; ilink < digiMatch0->GetNofLinks(); ilink++) {
611 Int_t iindex = digiMatch0->GetLink(ilink).GetIndex();
612 for (Int_t jlink = 0; jlink < digiMatch1->GetNofLinks(); jlink++) {
613 Int_t jindex = digiMatch1->GetLink(jlink).GetIndex();
614 if (iindex == jindex) {
615 hitOk = kTRUE;
616 break;
617 }
618 }
619 if (hitOk)
620 break;
621 }
622
623 hit->SetType(hitOk);
624 if (!hitOk)
625 hit->SetRefIndex(-1);
626 //--------------------------------------------------------------
627
628 // hit MC-matching ----------------------------------------------
629 FairRootManager::Instance()->SetUseFairLinks(kTRUE);
630 BmnMatch hitMatch;
631 if (iPoint < NIntersectionPointsInModule) {
632 hitMatch = module->GetIntersectionPointMatch(iPoint);
633 } else {
634 hitMatch = module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
635 }
636
637 /* AZ-240726 for (BmnLink lnk : hitMatch.GetLinks())
638 hit->AddLink(FairLink(-1, lnk.GetIndex(), lnk.GetWeight())); */
639 // AZ-240726 - save MC track ID in all links in the field "Entry"
640 int trID = -1;
641 if (hit->GetRefIndex() >= 0) {
642 FairMCPoint* mcp = (FairMCPoint*)fBmnGemStripPointsArray->UncheckedAt(hit->GetRefIndex());
643 trID = mcp->GetTrackID();
644 }
645 auto links = hitMatch.GetLinks();
646
647 for (int jl = 0; jl < int(links.size()); ++jl) {
648 BmnLink lnk = links[jl];
649 FairLink flink(-1, lnk.GetIndex(), lnk.GetWeight());
650 flink.SetEntry(trID);
651 hit->AddLink(flink);
652 }
653 //
654 FairRootManager::Instance()->SetUseFairLinks(kFALSE);
655 }
656 //--------------------------------------------------------------
657 }
658 }
659 }
660 /*
661 for (auto it : UniqueUpperClusters) {
662 for (Int_t i = 0; i < fBmnGemStripHitsArray->GetEntriesFast(); i++) {
663 BmnGemStripHit* hit = (BmnGemStripHit*)fBmnGemStripHitsArray->At(i);
664 if (hit->GetUpperClusterIndex() != it.first) continue;
665 hit->SetUpperClusterIndex(fBmnGemUpperClustersArray->GetEntriesFast());
666 }
667 it.second.SetUniqueID(fBmnGemUpperClustersArray->GetEntriesFast());
668 new ((*fBmnGemUpperClustersArray)[fBmnGemUpperClustersArray->GetEntriesFast()]) StripCluster(it.second);
669 }
670 for (auto it : UniqueLowerClusters) {
671 for (Int_t i = 0; i < fBmnGemStripHitsArray->GetEntriesFast(); i++) {
672 BmnGemStripHit* hit = (BmnGemStripHit*)fBmnGemStripHitsArray->At(i);
673 if (hit->GetLowerClusterIndex() != it.first) continue;
674 hit->SetLowerClusterIndex(fBmnGemLowerClustersArray->GetEntriesFast());
675 }
676 it.second.SetUniqueID(fBmnGemLowerClustersArray->GetEntriesFast());
677 new ((*fBmnGemLowerClustersArray)[fBmnGemLowerClustersArray->GetEntriesFast()]) StripCluster(it.second);
678 }
679 */
680 if (fVerbose > 1)
681 cout << " N clear matches with MC-points = " << clear_matched_points_cnt << "\n";
682 //------------------------------------------------------------------------------
683 StationSet->Reset();
684}
685
686void BmnGemStripHitMaker::OnlineWrite(const std::unique_ptr<TTree>& resultTree)
687{
688 if (!IsActive())
689 return;
690
691 resultTree->Branch(fOutputHitsBranchName, &fBmnGemStripHitsArray);
692 resultTree->Branch("BmnGemUpperCluster", &fBmnGemUpperClustersArray);
693 resultTree->Branch("BmnGemLowerCluster", &fBmnGemLowerClustersArray);
694 resultTree->Fill();
695}
696
698{
699 printf("Work time of BmnGemStripHitMaker: %4.2f sec.\n", workTime);
700}
static Double_t workTime
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
void Warning(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
R__EXTERN TSystem * gSystem
@ UpperStripLayer
BmnGemStripTransform * GlobalModTransfSet
virtual InitStatus Init()
TClonesArray * fBmnGemStripDigitsArray
virtual void Exec(Option_t *opt)
TClonesArray * fBmnGemStripPointsArray
Input array of Gem Points.
BmnGemStripConfiguration::GEM_CONFIG fCurrentConfig
TClonesArray * fBmnGemStripHitsArray
Output array of Gem Hits.
TClonesArray * fBmnGemLowerClustersArray
Output array of Gem Lower Clusters.
BmnGemStripStationSet * StationSet
TClonesArray * fBmnGemUpperClustersArray
Output array of Gem Upper Clusters.
TClonesArray * fBmnGemStripDigitMatchesArray
virtual void OnlineWrite(const std::unique_ptr< TTree > &resultTree)
Write task resul to tree.
static void SetUpperUniqueID(Int_t id)
vector< StripCluster > GetStripClusters()
static void SetLowerUniqueID(Int_t id)
StripCluster GetLowerCluster(Int_t indx)
StripCluster GetLowerCluster_PseudoIntersections(Int_t indx)
StripCluster GetUpperCluster_PseudoIntersections(Int_t indx)
Bool_t SetStripSignalInLayer(Int_t layer_num, Int_t strip_num, Double_t signal)
BmnMatch GetPseudoIntersectionDigitNumberMatch(Int_t indx)
BmnMatch GetIntersectionPointDigitNumberMatch(Int_t indx)
Bool_t SetStripMatchInLayer(Int_t layer_num, Int_t strip_num, BmnMatch mc_match)
StripCluster GetUpperCluster(Int_t indx)
BmnGemStripModule * GetModule(Int_t module_num)
void SetModule(Int_t mod)
Definition BmnHit.h:53
void SetType(Int_t type)
Definition BmnHit.h:54
void SetUpperClusterIndex(Int_t idx)
Definition BmnHit.h:64
void SetDigitNumberMatch(BmnMatch match)
Definition BmnHit.h:63
void SetIndex(Int_t id)
Definition BmnHit.h:49
void SetPseudo(Bool_t pseudo)
Definition BmnHit.h:56
void SetStation(Short_t st)
Definition BmnHit.h:52
void SetLowerClusterIndex(Int_t idx)
Definition BmnHit.h:65
const BmnLink & GetLink(Int_t i) const
Definition BmnMatch.h:38
void AddLink(const BmnMatch &match)
Definition BmnMatch.cxx:40
const vector< BmnLink > & GetLinks() const
Definition BmnMatch.h:39
Int_t GetNofLinks() const
Definition BmnMatch.h:41
Bool_t IsGoodDigit()
Int_t GetStripNumber()
Int_t GetStripLayer()
Int_t GetStation()
Double_t GetStripSignal()
Int_t GetModule()
PositionVector3D< Cartesian3D< T >, DefaultCoordinateSystemTag > Point
void SetStation(Int_t st)
Int_t GetType()
void SetModule(Int_t m)
virtual UInt_t GetUniqueID() const
Double_t RealTime()
void Start(Bool_t reset=kTRUE)
void Stop()
int GetValue(vector< UniValue * > &parameter_value)
get value of detector parameter presented by an array
static UniDetectorParameter * GetDetectorParameter(int value_id)
get detector parameter from the database
Double_t Abs(Double_t d)