BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnSiliconHitMaker.cxx
Go to the documentation of this file.
2
3#include "BmnSiliconModule.h"
4#include "FairRootManager.h"
5#include "TClonesArray.h"
6#include "TSystem.h"
7#include "UniDetectorParameter.h"
8
9#include <TStopwatch.h>
10
11static Double_t workTime = 0.0;
12
15{
16
17 fInputPointsBranchName = "SiliconPoint";
18 fInputDigitsBranchName = "BmnSiliconDigit";
19 fInputDigitMatchesBranchName = "BmnSiliconDigitMatch";
20
21 fOutputHitsBranchName = "BmnSiliconHit";
22
24 StationSet = nullptr;
25 GlobalModTransfSet = nullptr;
26
27 fBmnSiliconHitsArray = nullptr;
30}
31
32BmnSiliconHitMaker::BmnSiliconHitMaker(Int_t run_period, Int_t run_number, Bool_t isExp, Bool_t isSrc)
34{
35 fIsExp = isExp;
36 fIsSrc = isSrc;
37
38 fRunPeriod = run_period;
39 fRunNumber = run_number;
40
41 fInputPointsBranchName = "SiliconPoint";
42 fInputDigitsBranchName = (!isExp) ? "BmnSiliconDigit" : "SILICON";
43 fInputDigitMatchesBranchName = "BmnSiliconDigitMatch";
44
45 fOutputHitsBranchName = "BmnSiliconHit";
46
48 StationSet = nullptr;
49 GlobalModTransfSet = nullptr;
50
51 fBmnSiliconHitsArray = nullptr;
54
55 fSignalLow = 0.;
56 fSignalUp = DBL_MAX;
57
58 switch (fRunPeriod) {
59 case 6: // BM@N RUN-6
61 break;
62 case 7: // BM@N RUN-7 (and SRC)
63 if (fIsSrc) {
65 } else {
67 }
68 break;
69 case 8: // BM@N RUN-8
71 break;
72 case 9: // BM@N RUN-9
74 break;
75
76 default:
78 }
79}
80
82{
83 TString gPathSiliconConfig = gSystem->Getenv("VMCWORKDIR");
84 gPathSiliconConfig += "/parameters/silicon/XMLConfigs/";
85
86 // Create SILICON detector --------------------------------------------------
87 switch (fCurrentConfig) {
89 XMLConfigFile = gPathSiliconConfig + "SiliconRunSpring2017.xml";
90 if (fVerbose)
91 cout << " Current SILICON Configuration : RunSpring2017"
92 << "\n";
93 break;
94
96 XMLConfigFile = gPathSiliconConfig + "SiliconRunSpring2018.xml";
97 if (fVerbose)
98 cout << " Current SILICON Configuration : RunSpring2018"
99 << "\n";
100 break;
101
103 XMLConfigFile = gPathSiliconConfig + "SiliconRunSRCSpring2018.xml";
104 if (fVerbose)
105 cout << " Current SILICON Configuration : RunSRCSpring2018"
106 << "\n";
107 break;
108
110 XMLConfigFile = gPathSiliconConfig + "SiliconRun8_3stations.xml";
111 if (fVerbose)
112 cout << " Current SILICON Configuration : SiliconRun8_3stations"
113 << "\n";
114 break;
115
117 XMLConfigFile = gPathSiliconConfig + "SiliconRun8_4stations.xml";
118 if (fVerbose)
119 cout << " Current SILICON Configuration : SiliconRun8_4stations"
120 << "\n";
121 break;
122
124 XMLConfigFile = gPathSiliconConfig + "SiliconRun8_5stations.xml";
125 if (fVerbose)
126 cout << " Current SILICON Configuration : SiliconRun8_5stations"
127 << "\n";
128 break;
129
131 XMLConfigFile = gPathSiliconConfig + "SiliconRun8_mods_6_10_14_18.xml";
132 if (fVerbose)
133 cout << " Current SILICON Configuration : SiliconRun8_mods_6_10_14_18"
134 << "\n";
135 break;
136
138 XMLConfigFile = gPathSiliconConfig + "SiliconRun8_mods_10_14rot_18.xml";
139 if (fVerbose)
140 cout << " Current SILICON Configuration : SiliconRun8_mods_10_14rot_18"
141 << "\n";
142 break;
143
145 XMLConfigFile = gPathSiliconConfig + "SiliconRun8.xml";
146 if (fVerbose)
147 cout << " Current SILICON Configuration : Run8"
148 << "\n";
149 break;
150
152 XMLConfigFile = gPathSiliconConfig + "SiliconRun9.xml";
153 if (fVerbose)
154 cout << " Current SILICON Configuration : Run9"
155 << "\n";
156 break;
157
159 XMLConfigFile = gPathSiliconConfig + "Silicon_5stations_2026.xml";
160 if (fVerbose)
161 cout << " Current SILICON Configuration : 5stations_2026"
162 << "\n";
163 break;
164
165 default:;
166 }
167
168 if (!gSystem->AccessPathName(XMLConfigFile)) { // returns FALSE if the file exists
169 if (fVerbose)
170 cout << " XMLConfigFile : " << XMLConfigFile << "\n";
173 GlobalModTransfSet->LoadFromXMLFile(XMLConfigFile);
174 } else {
175 Fatal("BmnSiliconHitMaker::createSiliconDetector()", " !!! Current configuration is not set !!! ");
176 }
177
178 if (fIsExp) {
179 const Int_t nStat = StationSet->GetNStations();
180 UniDetectorParameter* coeffAlignCorrs =
182 vector<UniValue*> algnShifts;
183 if (coeffAlignCorrs)
184 coeffAlignCorrs->GetValue(algnShifts);
185 fAlignCor = new Double_t**[nStat];
186 for (Int_t iStat = 0; iStat < nStat; iStat++) {
187 const Int_t nParams = 3;
188 Int_t nModul = StationSet->GetSiliconStation(iStat)->GetNModules();
189 fAlignCor[iStat] = new Double_t*[nModul];
190 for (Int_t iMod = 0; iMod < nModul; iMod++) {
191 fAlignCor[iStat][iMod] = new Double_t[nParams];
192 for (Int_t iPar = 0; iPar < nParams; iPar++) {
193 fAlignCor[iStat][iMod][iPar] = 0.0;
194 }
195 }
196 }
197
198 for (size_t i = 0; i < algnShifts.size(); ++i) {
199 // cout << ((AlignmentValue*)algnShifts[i])->value[0] << endl;
200 // cout << ((AlignmentValue*)algnShifts[i])->value[1] << endl;
201 // cout << ((AlignmentValue*)algnShifts[i])->value[2] << endl;
202 Int_t st = ((AlignmentValue*)algnShifts[i])->station;
203 Int_t mod = ((AlignmentValue*)algnShifts[i])->module;
204 fAlignCor[st][mod][0] = ((AlignmentValue*)algnShifts[i])->value[0];
205 fAlignCor[st][mod][1] = ((AlignmentValue*)algnShifts[i])->value[1];
206 fAlignCor[st][mod][2] = ((AlignmentValue*)algnShifts[i])->value[2];
207 }
208 }
209}
210
212{
213
214 if (fIsExp) {
215 for (Int_t iStat = 0; iStat < StationSet->GetNStations(); iStat++) {
216 for (Int_t iMod = 0; iMod < StationSet->GetSiliconStation(iStat)->GetNModules(); iMod++)
217 delete[] fAlignCor[iStat][iMod];
218 delete[] fAlignCor[iStat];
219 }
220 delete[] fAlignCor;
221 }
222
223 if (StationSet) {
224 delete StationSet;
225 }
226
227 if (GlobalModTransfSet) {
228 delete GlobalModTransfSet;
229 }
230
232 fBmnSiliconHitsArray->Delete();
234 };
238 };
242 }
243}
244
246{
247
248 if (fVerbose > 1)
249 cout << "=================== BmnSiliconHitMaker::Init() started ================" << endl;
250
252
253 FairRootManager* ioman = FairRootManager::Instance();
254
257 cout << "BmnSiliconHitMaker::Init(): branch " << fInputDigitsBranchName
258 << " not found! Task will be deactivated" << endl;
259 SetActive(kFALSE);
260 return kERROR;
261 }
263
264 if (fVerbose > 1) {
266 cout << " Strip matching information exists!\n";
267 else
268 cout << " Strip matching information doesn`t exist!\n";
269 }
270
271 // AZ-240726
273 //
275 ioman->Register(fOutputHitsBranchName, "SILICON", fBmnSiliconHitsArray, kTRUE);
276 fBmnSiliconUpperClustersArray = new TClonesArray("StripCluster");
277 ioman->Register("BmnSiliconUpperCluster", "SILICON", fBmnSiliconUpperClustersArray, kTRUE);
278 fBmnSiliconLowerClustersArray = new TClonesArray("StripCluster");
279 ioman->Register("BmnSiliconLowerCluster", "SILICON", fBmnSiliconLowerClustersArray, kTRUE);
280
281 if (fVerbose > 1)
282 cout << "=================== BmnSiliconHitMaker::Init() finished ===============" << endl;
283
284 return kSUCCESS;
285}
286
288{
289
290 TStopwatch sw;
291 sw.Start();
292
293 if (!IsActive())
294 return;
295
296 fBmnSiliconHitsArray->Delete();
299
302
303 if (fVerbose > 1)
304 cout << "=================== BmnSiliconHitMaker::Exec() started ================" << endl;
305 if (fVerbose > 1)
306 cout << " BmnSiliconHitMaker::Exec(), Number of BmnSiliconDigits = " << fBmnSiliconDigitsArray->GetEntriesFast()
307 << "\n";
308
310
311 if (fVerbose > 1)
312 cout << "=================== BmnSiliconHitMaker::Exec() finished ===============" << endl;
313
314 sw.Stop();
315 workTime += sw.RealTime();
316}
317
319{
320
321 // FairMCPoint* MCPoint;
322 BmnSiliconDigit* digit;
323 BmnMatch* strip_match; // MC-information for a strip
324
325 BmnSiliconStation* station;
326 BmnSiliconModule* module;
327
328 // Loading digits ---------------------------------------------------------------
329 Int_t AddedDigits = 0;
330 Int_t AddedStripDigitMatches = 0;
331
332 for (Int_t idigit = 0; idigit < fBmnSiliconDigitsArray->GetEntriesFast(); idigit++) {
333 digit = (BmnSiliconDigit*)fBmnSiliconDigitsArray->At(idigit);
334 if (!digit->IsGoodDigit())
335 continue;
336
337 if (digit->GetStripSignal() < fSignalLow || digit->GetStripSignal() > fSignalUp)
338 continue;
339
340 station = StationSet->GetSiliconStation(digit->GetStation());
341 module = station->GetModule(digit->GetModule());
342 if (!module)
343 return;
344
345 if (module->SetStripSignalInLayerByZoneId(digit->GetStripLayer(), digit->GetStripNumber(),
346 digit->GetStripSignal()))
347 AddedDigits++;
348
349 // Add a MC-match to the current strip if this MC-match array exists
351 strip_match = (BmnMatch*)fBmnSiliconDigitMatchesArray->At(idigit);
352 if (module->SetStripMatchInLayerByZoneId(digit->GetStripLayer(), digit->GetStripNumber(), *strip_match))
353 AddedStripDigitMatches++;
354 }
355
356 // Add a digit number match to the current strip
357 BmnMatch stripDigitNumberMatch; // digit number information for the current strip
358 stripDigitNumberMatch.AddLink(1.0, idigit);
359 module->SetStripDigitNumberMatchInLayerByZoneId(digit->GetStripLayer(), digit->GetStripNumber(),
360 stripDigitNumberMatch);
361 }
362
363 if (fVerbose > 1)
364 cout << " Processed strip digits : " << AddedDigits << "\n";
365 if (fVerbose > 1 && fBmnSiliconDigitMatchesArray)
366 cout << " Added strip digit MC-matches : " << AddedStripDigitMatches << "\n";
367 //------------------------------------------------------------------------------
368
369 // Processing digits
370 StationSet->ProcessPointsInDetector();
371
372 Int_t NCalculatedPoints = StationSet->CountNProcessedPointsInDetector();
373 if (fVerbose > 1)
374 cout << " Calculated points : " << NCalculatedPoints << "\n";
375 if (fVerbose == 1)
376 cout << "BmnSiliconHitMaker: " << NCalculatedPoints << " hits\n";
377
378 Int_t clear_matched_points_cnt = 0; // points with the only one match-indexes
379
380 map<Int_t, StripCluster> UniqueUpperClusters;
381 map<Int_t, StripCluster> UniqueLowerClusters;
382
383 for (Int_t iStation = 0; iStation < StationSet->GetNStations(); ++iStation) {
384 station = StationSet->GetSiliconStation(iStation);
385
386 for (Int_t iModule = 0; iModule < station->GetNModules(); ++iModule) {
387 module = station->GetModule(iModule);
388
389 for (Int_t iLayer = 0; iLayer < module->GetNStripLayers(); ++iLayer) {
390 BmnSiliconLayer layer = module->GetStripLayer(iLayer);
391
392 for (size_t iCluster = 0; iCluster < layer.GetStripClusters().size(); ++iCluster) {
393 StripCluster cluster = layer.GetStripClusters()[iCluster];
394 cluster.SetModule(iModule);
395 cluster.SetStation(iStation);
396
397 // Saving all strip clusters into branches (each cluster have its own unique id in the current
398 // event)
399 if (cluster.GetType() == UpperStripLayer) {
400 new ((*fBmnSiliconUpperClustersArray)[fBmnSiliconUpperClustersArray->GetEntriesFast()])
401 StripCluster(cluster);
402 } else {
403 new ((*fBmnSiliconLowerClustersArray)[fBmnSiliconLowerClustersArray->GetEntriesFast()])
404 StripCluster(cluster);
405 }
406 }
407 }
408
409 Int_t NIntersectionPointsInModule = module->GetNIntersectionPoints();
410
411 // Int_t NPseudoIntersectionsInModule = module->GetNPseudoIntersections();
412 Int_t NPseudoIntersectionsInModule = 0; // !!! IGNORE PSEUDO INTERSECTIONS !!!
413
414 for (Int_t iPoint = 0; iPoint < NIntersectionPointsInModule + NPseudoIntersectionsInModule; ++iPoint) {
415
416 // Double_t threshold = 2000000;// ADC
417
418 // Double_t sigL;
419 // Double_t sigU;
420 Double_t x, y, z;
421 Double_t x_err, y_err, z_err;
422
423 if (iPoint < NIntersectionPointsInModule) {
424 // sigL = module->GetIntersectionPoint_LowerLayerSripTotalSignal(iPoint);
425 // sigU = module->GetIntersectionPoint_UpperLayerSripTotalSignal(iPoint);
426 x = module->GetIntersectionPointX(iPoint);
427 y = module->GetIntersectionPointY(iPoint);
428 z = module->GetZPositionRegistered();
429 x_err = module->GetIntersectionPointXError(iPoint);
430 y_err = module->GetIntersectionPointYError(iPoint);
431 z_err = 0.0;
432 } else {
433 // sigL =
434 // module->GetPseudoIntersection_LowerLayerSripTotalSignal(iPoint-NIntersectionPointsInModule); sigU
435 // = module->GetPseudoIntersection_UpperLayerSripTotalSignal(iPoint-NIntersectionPointsInModule);
436 x = module->GetPseudoIntersectionX(iPoint - NIntersectionPointsInModule);
437 y = module->GetPseudoIntersectionY(iPoint - NIntersectionPointsInModule);
438 z = module->GetZPositionRegistered();
439 x_err = module->GetPseudoIntersectionXError(iPoint - NIntersectionPointsInModule);
440 y_err = module->GetPseudoIntersectionYError(iPoint - NIntersectionPointsInModule);
441 z_err = 0.0;
442 }
443
444 z += fIsExp ? fAlignCor[iStation][iModule][2] : 0.; // alignment shift
445
446 // Apply global module transforms to detector hit (in right-handed system)
447 if (GlobalModTransfSet) {
448 Plane3D::Point point_transformed =
449 GlobalModTransfSet->ApplyTransforms(Plane3D::Point(-x, y, z), iStation, iModule);
450 x = -point_transformed.X(); // convert to detector system (x-inverted)
451 y = point_transformed.Y();
452 z = point_transformed.Z();
453 }
454
455 Int_t RefMCIndex = -1;
456
457 // MC-matching for the current hit (define RefMCIndex)) ---------
458 BmnMatch mc_match_hit;
459 if (iPoint < NIntersectionPointsInModule) {
460 mc_match_hit = module->GetIntersectionPointMatch(iPoint);
461 } else {
462 mc_match_hit = module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
463 }
464
465 Int_t most_probably_index = -1;
466 Double_t max_weight = 0;
467
468 Int_t n_links = mc_match_hit.GetNofLinks();
469 if (n_links == 1)
470 clear_matched_points_cnt++;
471 for (Int_t ilink = 0; ilink < n_links; ilink++) {
472 Int_t index = mc_match_hit.GetLink(ilink).GetIndex();
473 Double_t weight = mc_match_hit.GetLink(ilink).GetWeight();
474 if (weight > max_weight) {
475 max_weight = weight;
476 most_probably_index = index;
477 }
478 }
479
480 RefMCIndex = most_probably_index;
481 //--------------------------------------------------------------
482
483 // Add hit ------------------------------------------------------
484 x *= -1; // invert to global X
485 Double_t deltaX = fIsExp ? fAlignCor[iStation][iModule][0] : 0.;
486 Double_t deltaY = fIsExp ? fAlignCor[iStation][iModule][1] : 0.;
487
488 x += deltaX;
489 y += deltaY;
490
491 new ((*fBmnSiliconHitsArray)[fBmnSiliconHitsArray->GetEntriesFast()])
492 BmnSiliconHit(0, TVector3(x, y, z), TVector3(x_err, y_err, z_err), RefMCIndex);
493
494 BmnSiliconHit* hit =
495 (BmnSiliconHit*)fBmnSiliconHitsArray->At(fBmnSiliconHitsArray->GetEntriesFast() - 1);
496 hit->SetStation(iStation);
497 hit->SetModule(iModule);
498 hit->SetIndex(fBmnSiliconHitsArray->GetEntriesFast() - 1);
499
500 if (iPoint < NIntersectionPointsInModule) {
502 module->GetIntersectionPointDigitNumberMatch(iPoint)); // digit number match for the hit
503 hit->SetUpperClusterIndex(module->GetUpperCluster(iPoint).GetUniqueID());
504 hit->SetLowerClusterIndex(module->GetLowerCluster(iPoint).GetUniqueID());
505 hit->SetPseudo(false);
506 } else {
508 iPoint - NIntersectionPointsInModule)); // digit number match for the hit
510 module->GetUpperCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
511 .GetUniqueID());
513 module->GetLowerCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
514 .GetUniqueID());
515 hit->SetPseudo(true);
516 }
517 //--------------------------------------------------------------
518 /*
519 StripCluster ucls = module->GetUpperCluster(iPoint);
520 StripCluster lcls = module->GetLowerCluster(iPoint);
521 ucls.SetModule(iModule);
522 lcls.SetModule(iModule);
523 ucls.SetStation(iStation);
524 lcls.SetStation(iStation);
525
526 Int_t upperClusterIndex = ucls.GetUniqueID();
527 Int_t lowerClusterIndex = lcls.GetUniqueID();
528
529 //Filtration of duplicate clusters in the current module for the same type of strips
530 Bool_t duplicateUpperCluster = false;
531 for(auto it : UniqueUpperClusters) {
532 StripCluster cluster = it.second;
533
534 if(cluster.GetClusterSize() != ucls.GetClusterSize()) continue;
535
536 Int_t identic_cnt = 0;
537 for(Int_t istrip = 0; istrip < cluster.GetClusterSize(); ++istrip) {
538 Int_t strip_num = cluster.Strips.at(istrip);
539 Double_t strip_signal = cluster.Signals.at(istrip);
540
541 if( (strip_num == ucls.Strips.at(istrip)) && (strip_signal ==
542 ucls.Signals.at(istrip)) ) identic_cnt++; else break;
543 }
544 if(identic_cnt == ucls.GetClusterSize()) {
545 upperClusterIndex = cluster.GetUniqueID();
546 duplicateUpperCluster = true;
547 break;
548 }
549 }
550
551 Bool_t duplicateLowerCluster = false;
552 for(auto it : UniqueLowerClusters) {
553 StripCluster cluster = it.second;
554
555 if(cluster.GetClusterSize() != lcls.GetClusterSize()) continue;
556
557 Int_t identic_cnt = 0;
558 for(Int_t istrip = 0; istrip < cluster.GetClusterSize(); ++istrip) {
559 Int_t strip_num = cluster.Strips.at(istrip);
560 Double_t strip_signal = cluster.Signals.at(istrip);
561
562 if( (strip_num == lcls.Strips.at(istrip)) && (strip_signal ==
563 lcls.Signals.at(istrip)) ) identic_cnt++; else break;
564 }
565 if(identic_cnt == lcls.GetClusterSize()) {
566 lowerClusterIndex = cluster.GetUniqueID();
567 duplicateLowerCluster = true;
568 break;
569 }
570 }
571 //--------------------------------------------------------------
572
573 if(!duplicateUpperCluster) UniqueUpperClusters[upperClusterIndex] = ucls;
574 if(!duplicateLowerCluster) UniqueLowerClusters[lowerClusterIndex] = lcls;
575 hit->SetUpperClusterIndex(upperClusterIndex);
576 hit->SetLowerClusterIndex(lowerClusterIndex);
577 */
578 if (fHitMatching) {
579 BmnMatch digiMatch;
580 Int_t idx0, idx1;
581 if (iPoint < NIntersectionPointsInModule) {
582 digiMatch = module->GetIntersectionPointDigitNumberMatch(iPoint);
583 idx0 = digiMatch.GetLink(0).GetIndex();
584 idx1 = digiMatch.GetLink(1).GetIndex();
585 } else {
586 digiMatch = module->GetPseudoIntersectionDigitNumberMatch(iPoint - NIntersectionPointsInModule);
587 idx0 = digiMatch.GetLink(0).GetIndex();
588 idx1 = digiMatch.GetLink(0).GetIndex();
589 }
590 BmnMatch* digiMatch0 = (BmnMatch*)fBmnSiliconDigitMatchesArray->At(idx0);
591 BmnMatch* digiMatch1 = (BmnMatch*)fBmnSiliconDigitMatchesArray->At(idx1);
592
593 Bool_t hitOk = kFALSE;
594 for (Int_t ilink = 0; ilink < digiMatch0->GetNofLinks(); ilink++) {
595 Int_t iindex = digiMatch0->GetLink(ilink).GetIndex();
596 for (Int_t jlink = 0; jlink < digiMatch1->GetNofLinks(); jlink++) {
597 Int_t jindex = digiMatch1->GetLink(jlink).GetIndex();
598 if (iindex == jindex) {
599 hitOk = kTRUE;
600 break;
601 }
602 }
603 if (hitOk)
604 break;
605 }
606
607 hit->SetType(hitOk);
608 if (!hitOk)
609 hit->SetRefIndex(-1);
610
611 // hit MC-matching ----------------------------------------------
612 FairRootManager::Instance()->SetUseFairLinks(kTRUE);
613 BmnMatch hitMatch;
614 if (iPoint < NIntersectionPointsInModule) {
615 hitMatch = module->GetIntersectionPointMatch(iPoint);
616 } else {
617 hitMatch = module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
618 }
619
620 /* AZ-240726 for (BmnLink lnk : hitMatch.GetLinks())
621 hit->AddLink(FairLink(-1, lnk.GetIndex(), lnk.GetWeight())); */
622 // AZ-240726 - save MC track ID in all links in the field "Entry"
623 int trID = -1;
624 if (hit->GetRefIndex() >= 0) {
625 FairMCPoint* mcp = (FairMCPoint*)fBmnSiliconPointsArray->UncheckedAt(hit->GetRefIndex());
626 trID = mcp->GetTrackID();
627 }
628 auto links = hitMatch.GetLinks();
629
630 for (int jl = 0; jl < int(links.size()); ++jl) {
631 BmnLink lnk = links[jl];
632 FairLink flink(-1, lnk.GetIndex(), lnk.GetWeight());
633 flink.SetEntry(trID);
634 hit->AddLink(flink);
635 }
636 //
637 FairRootManager::Instance()->SetUseFairLinks(kFALSE);
638 }
639 //--------------------------------------------------------------
640 }
641 }
642 }
643
644 /*
645 for (auto it : UniqueUpperClusters) {
646 for (Int_t i = 0; i < fBmnSiliconHitsArray->GetEntriesFast(); i++) {
647 BmnSiliconHit* hit = (BmnSiliconHit*)fBmnSiliconHitsArray->At(i);
648 if (hit->GetUpperClusterIndex() != it.first) continue;
649 hit->SetUpperClusterIndex(fBmnSiliconUpperClustersArray->GetEntriesFast());
650 }
651 it.second.SetUniqueID(fBmnSiliconUpperClustersArray->GetEntriesFast());
652 new ((*fBmnSiliconUpperClustersArray)[fBmnSiliconUpperClustersArray->GetEntriesFast()])
653 StripCluster(it.second);
654 }
655 for (auto it : UniqueLowerClusters) {
656 for (Int_t i = 0; i < fBmnSiliconHitsArray->GetEntriesFast(); i++) {
657 BmnSiliconHit* hit = (BmnSiliconHit*)fBmnSiliconHitsArray->At(i);
658 if (hit->GetLowerClusterIndex() != it.first) continue;
659 hit->SetLowerClusterIndex(fBmnSiliconLowerClustersArray->GetEntriesFast());
660 }
661 it.second.SetUniqueID(fBmnSiliconLowerClustersArray->GetEntriesFast());
662 new ((*fBmnSiliconLowerClustersArray)[fBmnSiliconLowerClustersArray->GetEntriesFast()])
663 StripCluster(it.second);
664 }
665 */
666
667 if (fVerbose > 1)
668 cout << " N clear matches with MC-points = " << clear_matched_points_cnt << "\n";
669 //------------------------------------------------------------------------------
670 StationSet->Reset();
671}
672
673void BmnSiliconHitMaker::OnlineWrite(const std::unique_ptr<TTree>& resultTree)
674{
675 if (!IsActive())
676 return;
677
678 resultTree->Branch(fOutputHitsBranchName, &fBmnSiliconHitsArray);
679 resultTree->Branch("BmnSiliconUpperCluster", &fBmnSiliconUpperClustersArray);
680 resultTree->Branch("BmnSiliconLowerCluster", &fBmnSiliconLowerClustersArray);
681 resultTree->Fill();
682}
683
685{
686 printf("Work time of BmnSiliconHitMaker: %4.2f sec.\n", workTime);
687}
static Double_t workTime
int i
Definition P4_F32vec4.h:22
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 TSystem * gSystem
@ UpperStripLayer
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
BmnSiliconTransform * GlobalModTransfSet
virtual void Exec(Option_t *opt)
TClonesArray * fBmnSiliconDigitMatchesArray
BmnSiliconStationSet * StationSet
TClonesArray * fBmnSiliconDigitsArray
TClonesArray * fBmnSiliconUpperClustersArray
Output array of Silicon Upper Clusters.
TClonesArray * fBmnSiliconLowerClustersArray
Output array of Silicon Lower Clusters.
TClonesArray * fBmnSiliconHitsArray
Output array of Silicon Hits.
virtual void OnlineWrite(const std::unique_ptr< TTree > &resultTree)
Write task resul to tree.
BmnSiliconConfiguration::SILICON_CONFIG fCurrentConfig
virtual InitStatus Init()
TClonesArray * fBmnSiliconPointsArray
Input array of Silicon Points.
static void SetLowerUniqueID(Int_t id)
vector< StripCluster > GetStripClusters()
static void SetUpperUniqueID(Int_t id)
Bool_t SetStripMatchInLayerByZoneId(Int_t zone_id, Int_t strip_num, BmnMatch mc_match)
BmnMatch GetIntersectionPointDigitNumberMatch(Int_t indx)
StripCluster GetUpperCluster(Int_t indx)
StripCluster GetLowerCluster_PseudoIntersections(Int_t indx)
Bool_t SetStripSignalInLayerByZoneId(Int_t zone_id, Int_t strip_num, Double_t signal)
StripCluster GetUpperCluster_PseudoIntersections(Int_t indx)
BmnMatch GetPseudoIntersectionDigitNumberMatch(Int_t indx)
StripCluster GetLowerCluster(Int_t indx)
Bool_t IsGoodDigit()
Int_t GetStripNumber()
Int_t GetStripLayer()
Int_t GetStation()
Double_t GetStripSignal()
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