249 cout <<
"=================== BmnSiliconHitMaker::Init() started ================" << endl;
251 createSiliconDetector();
253 FairRootManager* ioman = FairRootManager::Instance();
255 fBmnSiliconDigitsArray = (TClonesArray*)ioman->GetObject(fInputDigitsBranchName);
256 if (!fBmnSiliconDigitsArray) {
257 cout <<
"BmnSiliconHitMaker::Init(): branch " << fInputDigitsBranchName
258 <<
" not found! Task will be deactivated" << endl;
262 fBmnSiliconDigitMatchesArray = (TClonesArray*)ioman->GetObject(fInputDigitMatchesBranchName);
265 if (fBmnSiliconDigitMatchesArray)
266 cout <<
" Strip matching information exists!\n";
268 cout <<
" Strip matching information doesn`t exist!\n";
271 fBmnSiliconHitsArray =
new TClonesArray(fOutputHitsBranchName);
272 ioman->Register(fOutputHitsBranchName,
"SILICON", fBmnSiliconHitsArray, kTRUE);
273 fBmnSiliconUpperClustersArray =
new TClonesArray(
"StripCluster");
274 ioman->Register(
"BmnSiliconUpperCluster",
"SILICON", fBmnSiliconUpperClustersArray, kTRUE);
275 fBmnSiliconLowerClustersArray =
new TClonesArray(
"StripCluster");
276 ioman->Register(
"BmnSiliconLowerCluster",
"SILICON", fBmnSiliconLowerClustersArray, kTRUE);
279 cout <<
"=================== BmnSiliconHitMaker::Init() finished ===============" << endl;
326 Int_t AddedDigits = 0;
327 Int_t AddedStripDigitMatches = 0;
329 for (Int_t idigit = 0; idigit < fBmnSiliconDigitsArray->GetEntriesFast(); idigit++) {
338 module = station->GetModule(digit->GetModule());
347 if (fBmnSiliconDigitMatchesArray) {
348 strip_match = (
BmnMatch*)fBmnSiliconDigitMatchesArray->At(idigit);
350 AddedStripDigitMatches++;
355 stripDigitNumberMatch.
AddLink(1.0, idigit);
356 module->SetStripDigitNumberMatchInLayerByZoneId(digit->GetStripLayer(), digit->GetStripNumber(),
357 stripDigitNumberMatch);
361 cout <<
" Processed strip digits : " << AddedDigits <<
"\n";
362 if (fVerbose > 1 && fBmnSiliconDigitMatchesArray)
363 cout <<
" Added strip digit MC-matches : " << AddedStripDigitMatches <<
"\n";
371 cout <<
" Calculated points : " << NCalculatedPoints <<
"\n";
373 cout <<
"BmnSiliconHitMaker: " << NCalculatedPoints <<
" hits\n";
375 Int_t clear_matched_points_cnt = 0;
377 map<Int_t, StripCluster> UniqueUpperClusters;
378 map<Int_t, StripCluster> UniqueLowerClusters;
380 for (Int_t iStation = 0; iStation < StationSet->
GetNStations(); ++iStation) {
383 for (Int_t iModule = 0; iModule < station->
GetNModules(); ++iModule) {
384 module = station->GetModule(iModule);
386 for (Int_t iLayer = 0; iLayer <
module->GetNStripLayers(); ++iLayer) {
389 for (
size_t iCluster = 0; iCluster < layer.
GetStripClusters().size(); ++iCluster) {
397 new ((*fBmnSiliconUpperClustersArray)[fBmnSiliconUpperClustersArray->GetEntriesFast()])
400 new ((*fBmnSiliconLowerClustersArray)[fBmnSiliconLowerClustersArray->GetEntriesFast()])
406 Int_t NIntersectionPointsInModule =
module->GetNIntersectionPoints();
409 Int_t NPseudoIntersectionsInModule = 0;
411 for (Int_t iPoint = 0; iPoint < NIntersectionPointsInModule + NPseudoIntersectionsInModule; ++iPoint) {
418 Double_t x_err, y_err, z_err;
420 if (iPoint < NIntersectionPointsInModule) {
423 x =
module->GetIntersectionPointX(iPoint);
424 y =
module->GetIntersectionPointY(iPoint);
425 z =
module->GetZPositionRegistered();
426 x_err =
module->GetIntersectionPointXError(iPoint);
427 y_err =
module->GetIntersectionPointYError(iPoint);
433 x =
module->GetPseudoIntersectionX(iPoint - NIntersectionPointsInModule);
434 y =
module->GetPseudoIntersectionY(iPoint - NIntersectionPointsInModule);
435 z =
module->GetZPositionRegistered();
436 x_err =
module->GetPseudoIntersectionXError(iPoint - NIntersectionPointsInModule);
437 y_err =
module->GetPseudoIntersectionYError(iPoint - NIntersectionPointsInModule);
441 z += fIsExp ? fAlignCor[iStation][iModule][2] : 0.;
445 Plane3D::Point glob_point = TransfSet->
ApplyTransforms(Plane3D::Point(-x, y, z), iStation, iModule);
451 Int_t RefMCIndex = -1;
455 if (iPoint < NIntersectionPointsInModule) {
456 mc_match_hit =
module->GetIntersectionPointMatch(iPoint);
458 mc_match_hit =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
461 Int_t most_probably_index = -1;
462 Double_t max_weight = 0;
466 clear_matched_points_cnt++;
467 for (Int_t ilink = 0; ilink < n_links; ilink++) {
470 if (weight > max_weight) {
472 most_probably_index = index;
476 RefMCIndex = most_probably_index;
481 Double_t deltaX = fIsExp ? fAlignCor[iStation][iModule][0] : 0.;
482 Double_t deltaY = fIsExp ? fAlignCor[iStation][iModule][1] : 0.;
487 new ((*fBmnSiliconHitsArray)[fBmnSiliconHitsArray->GetEntriesFast()])
488 BmnSiliconHit(0, TVector3(x, y, z), TVector3(x_err, y_err, z_err), RefMCIndex);
491 (
BmnSiliconHit*)fBmnSiliconHitsArray->At(fBmnSiliconHitsArray->GetEntriesFast() - 1);
494 hit->
SetIndex(fBmnSiliconHitsArray->GetEntriesFast() - 1);
496 if (iPoint < NIntersectionPointsInModule) {
498 module->GetIntersectionPointDigitNumberMatch(iPoint));
504 iPoint - NIntersectionPointsInModule));
506 module->GetUpperCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
509 module->GetLowerCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
577 if (iPoint < NIntersectionPointsInModule) {
578 digiMatch =
module->GetIntersectionPointDigitNumberMatch(iPoint);
582 digiMatch =
module->GetPseudoIntersectionDigitNumberMatch(iPoint - NIntersectionPointsInModule);
589 Bool_t hitOk = kFALSE;
590 for (Int_t ilink = 0; ilink < digiMatch0->
GetNofLinks(); ilink++) {
592 for (Int_t jlink = 0; jlink < digiMatch1->
GetNofLinks(); jlink++) {
594 if (iindex == jindex) {
605 hit->SetRefIndex(-1);
608 FairRootManager::Instance()->SetUseFairLinks(kTRUE);
610 if (iPoint < NIntersectionPointsInModule) {
611 hitMatch =
module->GetIntersectionPointMatch(iPoint);
613 hitMatch =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
617 hit->AddLink(FairLink(-1, lnk.GetIndex(), lnk.GetWeight()));
618 FairRootManager::Instance()->SetUseFairLinks(kFALSE);
649 cout <<
" N clear matches with MC-points = " << clear_matched_points_cnt <<
"\n";