144 cout <<
"=================== BmnVSPHitMaker::Init() started ================" << endl;
146 if (fRunPeriod < 9) {
153 FairRootManager* ioman = FairRootManager::Instance();
155 fBmnVSPDigitsArray = (TClonesArray*)ioman->GetObject(fInputDigitsBranchName);
156 if (!fBmnVSPDigitsArray) {
157 cout <<
"BmnVSPHitMaker::Init(): branch " << fInputDigitsBranchName <<
" not found! Task will be deactivated"
162 fBmnVSPDigitMatchesArray = (TClonesArray*)ioman->GetObject(fInputDigitMatchesBranchName);
165 if (fBmnVSPDigitMatchesArray)
166 cout <<
" Strip matching information exists!\n";
168 cout <<
" Strip matching information doesn`t exist!\n";
171 fBmnVSPHitsArray =
new TClonesArray(fOutputHitsBranchName);
172 ioman->Register(fOutputHitsBranchName,
"VSP", fBmnVSPHitsArray, kTRUE);
173 fBmnVSPUpperClustersArray =
new TClonesArray(
"StripCluster");
174 ioman->Register(
"BmnVSPUpperCluster",
"VSP", fBmnVSPUpperClustersArray, kTRUE);
175 fBmnVSPLowerClustersArray =
new TClonesArray(
"StripCluster");
176 ioman->Register(
"BmnVSPLowerCluster",
"VSP", fBmnVSPLowerClustersArray, kTRUE);
179 cout <<
"=================== BmnVSPHitMaker::Init() finished ===============" << endl;
225 Int_t AddedDigits = 0;
226 Int_t AddedStripDigitMatches = 0;
228 for (Int_t idigit = 0; idigit < fBmnVSPDigitsArray->GetEntriesFast(); idigit++) {
229 digit = (
BmnVSPDigit*)fBmnVSPDigitsArray->At(idigit);
237 module = station->GetModule(digit->GetModule());
246 if (fBmnVSPDigitMatchesArray) {
247 strip_match = (
BmnMatch*)fBmnVSPDigitMatchesArray->At(idigit);
249 AddedStripDigitMatches++;
254 stripDigitNumberMatch.
AddLink(1.0, idigit);
255 module->SetStripDigitNumberMatchInLayerByZoneId(digit->GetStripLayer(), digit->GetStripNumber(),
256 stripDigitNumberMatch);
260 cout <<
" Processed strip digits : " << AddedDigits <<
"\n";
261 if (fVerbose > 1 && fBmnVSPDigitMatchesArray)
262 cout <<
" Added strip digit MC-matches : " << AddedStripDigitMatches <<
"\n";
270 cout <<
" Calculated points : " << NCalculatedPoints <<
"\n";
272 cout <<
"BmnVSPHitMaker: " << NCalculatedPoints <<
" hits\n";
274 Int_t clear_matched_points_cnt = 0;
276 map<Int_t, StripCluster> UniqueUpperClusters;
277 map<Int_t, StripCluster> UniqueLowerClusters;
279 for (Int_t iStation = 0; iStation < StationSet->
GetNStations(); ++iStation) {
282 for (Int_t iModule = 0; iModule < station->
GetNModules(); ++iModule) {
283 module = station->GetModule(iModule);
285 for (Int_t iLayer = 0; iLayer <
module->GetNStripLayers(); ++iLayer) {
288 for (
size_t iCluster = 0; iCluster < layer.
GetStripClusters().size(); ++iCluster) {
296 new ((*fBmnVSPUpperClustersArray)[fBmnVSPUpperClustersArray->GetEntriesFast()])
299 new ((*fBmnVSPLowerClustersArray)[fBmnVSPLowerClustersArray->GetEntriesFast()])
305 Int_t NIntersectionPointsInModule =
module->GetNIntersectionPoints();
308 Int_t NPseudoIntersectionsInModule = 0;
310 for (Int_t iPoint = 0; iPoint < NIntersectionPointsInModule + NPseudoIntersectionsInModule; ++iPoint) {
317 Double_t x_err, y_err, z_err;
319 if (iPoint < NIntersectionPointsInModule) {
322 x =
module->GetIntersectionPointX(iPoint);
323 y =
module->GetIntersectionPointY(iPoint);
324 z =
module->GetZPositionRegistered();
325 x_err =
module->GetIntersectionPointXError(iPoint);
326 y_err =
module->GetIntersectionPointYError(iPoint);
332 x =
module->GetPseudoIntersectionX(iPoint - NIntersectionPointsInModule);
333 y =
module->GetPseudoIntersectionY(iPoint - NIntersectionPointsInModule);
334 z =
module->GetZPositionRegistered();
335 x_err =
module->GetPseudoIntersectionXError(iPoint - NIntersectionPointsInModule);
336 y_err =
module->GetPseudoIntersectionYError(iPoint - NIntersectionPointsInModule);
340 z += fIsExp ? fAlignCor[iStation][iModule][2] : 0.;
344 Plane3D::Point glob_point = TransfSet->
ApplyTransforms(Plane3D::Point(-x, y, z), iStation, iModule);
350 Int_t RefMCIndex = -1;
354 if (iPoint < NIntersectionPointsInModule) {
355 mc_match_hit =
module->GetIntersectionPointMatch(iPoint);
357 mc_match_hit =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
360 Int_t most_probably_index = -1;
361 Double_t max_weight = 0;
365 clear_matched_points_cnt++;
366 for (Int_t ilink = 0; ilink < n_links; ilink++) {
369 if (weight > max_weight) {
371 most_probably_index = index;
375 RefMCIndex = most_probably_index;
380 Double_t deltaX = fIsExp ? fAlignCor[iStation][iModule][0] : 0.;
381 Double_t deltaY = fIsExp ? fAlignCor[iStation][iModule][1] : 0.;
386 new ((*fBmnVSPHitsArray)[fBmnVSPHitsArray->GetEntriesFast()])
387 BmnVSPHit(0, TVector3(x, y, z), TVector3(x_err, y_err, z_err), RefMCIndex);
389 BmnVSPHit* hit = (
BmnVSPHit*)fBmnVSPHitsArray->At(fBmnVSPHitsArray->GetEntriesFast() - 1);
392 hit->
SetIndex(fBmnVSPHitsArray->GetEntriesFast() - 1);
394 if (iPoint < NIntersectionPointsInModule) {
396 module->GetIntersectionPointDigitNumberMatch(iPoint));
402 iPoint - NIntersectionPointsInModule));
404 module->GetUpperCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
407 module->GetLowerCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
475 if (iPoint < NIntersectionPointsInModule) {
476 digiMatch =
module->GetIntersectionPointDigitNumberMatch(iPoint);
480 digiMatch =
module->GetPseudoIntersectionDigitNumberMatch(iPoint - NIntersectionPointsInModule);
487 Bool_t hitOk = kFALSE;
488 for (Int_t ilink = 0; ilink < digiMatch0->
GetNofLinks(); ilink++) {
490 for (Int_t jlink = 0; jlink < digiMatch1->
GetNofLinks(); jlink++) {
492 if (iindex == jindex) {
503 hit->SetRefIndex(-1);
506 FairRootManager::Instance()->SetUseFairLinks(kTRUE);
508 if (iPoint < NIntersectionPointsInModule) {
509 hitMatch =
module->GetIntersectionPointMatch(iPoint);
511 hitMatch =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
515 hit->AddLink(FairLink(-1, lnk.GetIndex(), lnk.GetWeight()));
516 FairRootManager::Instance()->SetUseFairLinks(kFALSE);
545 cout <<
" N clear matches with MC-points = " << clear_matched_points_cnt <<
"\n";