180 cout <<
"=================== BmnCSCHitMaker::Init() started ====================" << endl;
182 FairRootManager* ioman = FairRootManager::Instance();
184 fBmnCSCDigitsArray = (TClonesArray*)ioman->GetObject(fInputDigitsBranchName);
185 if (!fBmnCSCDigitsArray) {
186 cout <<
"BmnCSCHitMaker::Init(): branch " << fInputDigitsBranchName <<
" not found! Task will be deactivated"
192 fBmnCSCDigitMatchesArray = (TClonesArray*)ioman->GetObject(fInputDigitMatchesBranchName);
195 if (fBmnCSCDigitMatchesArray)
196 cout <<
" Strip matching information exists!\n";
198 cout <<
" Strip matching information doesn`t exist!\n";
201 fBmnCSCHitsArray =
new TClonesArray(fOutputHitsBranchName);
202 ioman->Register(fOutputHitsBranchName,
"CSC", fBmnCSCHitsArray, kTRUE);
203 fBmnCSCUpperClustersArray =
new TClonesArray(
"StripCluster");
204 ioman->Register(
"BmnCSCUpperCluster",
"CSC", fBmnCSCUpperClustersArray, kTRUE);
205 fBmnCSCLowerClustersArray =
new TClonesArray(
"StripCluster");
206 ioman->Register(
"BmnCSCLowerCluster",
"CSC", fBmnCSCLowerClustersArray, kTRUE);
210 LoadDetectorConfiguration();
212 fField = FairRunAna::Instance()->GetField();
214 Fatal(
"Init",
"No Magnetic Field found");
219 cout <<
"=================== BmnCSCHitMaker::Init() finished ===================" << endl;
266 Int_t AddedDigits = 0;
267 Int_t AddedStripDigitMatches = 0;
269 for (Int_t idigit = 0; idigit < fBmnCSCDigitsArray->GetEntriesFast(); idigit++) {
270 digit = (
BmnCSCDigit*)fBmnCSCDigitsArray->At(idigit);
274 module = station->GetModule(digit->GetModule());
279 if (fBmnCSCDigitMatchesArray) {
280 strip_match = (
BmnMatch*)fBmnCSCDigitMatchesArray->At(idigit);
282 AddedStripDigitMatches++;
287 stripDigitNumberMatch.
AddLink(1.0, idigit);
288 module->SetStripDigitNumberMatchInLayer(digit->GetStripLayer(), digit->GetStripNumber(), stripDigitNumberMatch);
292 cout <<
" Processed strip digits : " << AddedDigits <<
"\n";
293 if (fVerbose > 1 && fBmnCSCDigitMatchesArray)
294 cout <<
" Added strip digit matches : " << AddedStripDigitMatches <<
"\n";
302 cout <<
" Calculated points : " << NCalculatedPoints <<
"\n";
304 cout <<
"BmnCSCHitMaker: " << NCalculatedPoints <<
" hits\n";
306 Int_t clear_matched_points_cnt = 0;
308 map<Int_t, StripCluster> UniqueUpperClusters;
309 map<Int_t, StripCluster> UniqueLowerClusters;
311 for (Int_t iStation = 0; iStation < StationSet->
GetNStations(); ++iStation) {
314 for (Int_t iModule = 0; iModule < station->
GetNModules(); ++iModule) {
315 module = station->GetModule(iModule);
317 for (Int_t iLayer = 0; iLayer <
module->GetNStripLayers(); ++iLayer) {
320 for (
size_t iCluster = 0; iCluster < layer.
GetStripClusters().size(); ++iCluster) {
328 new ((*fBmnCSCUpperClustersArray)[fBmnCSCUpperClustersArray->GetEntriesFast()])
331 new ((*fBmnCSCLowerClustersArray)[fBmnCSCLowerClustersArray->GetEntriesFast()])
337 Int_t NIntersectionPointsInModule =
module->GetNIntersectionPoints();
340 Int_t NPseudoIntersectionsInModule = 0;
342 for (Int_t iPoint = 0; iPoint < NIntersectionPointsInModule + NPseudoIntersectionsInModule; ++iPoint) {
347 Double_t x_err, y_err, z_err;
349 if (iPoint < NIntersectionPointsInModule) {
352 x =
module->GetIntersectionPointX(iPoint);
353 y =
module->GetIntersectionPointY(iPoint);
354 z =
module->GetZPositionRegistered();
355 x_err =
module->GetIntersectionPointXError(iPoint);
356 y_err =
module->GetIntersectionPointYError(iPoint);
362 x =
module->GetPseudoIntersectionX(iPoint - NIntersectionPointsInModule);
363 y =
module->GetPseudoIntersectionY(iPoint - NIntersectionPointsInModule);
364 z =
module->GetZPositionRegistered();
365 x_err =
module->GetPseudoIntersectionXError(iPoint - NIntersectionPointsInModule);
366 y_err =
module->GetPseudoIntersectionYError(iPoint - NIntersectionPointsInModule);
372 Plane3D::Point glob_point = TransfSet->
ApplyTransforms(Plane3D::Point(-x, y, z), iStation, iModule);
378 Int_t RefMCIndex = -1;
382 if (iPoint < NIntersectionPointsInModule) {
383 mc_match_hit =
module->GetIntersectionPointMatch(iPoint);
385 mc_match_hit =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
388 Int_t most_probably_index = -1;
389 Double_t max_weight = 0;
393 clear_matched_points_cnt++;
394 for (Int_t ilink = 0; ilink < n_links; ilink++) {
397 if (weight > max_weight) {
399 most_probably_index = index;
403 RefMCIndex = most_probably_index;
409 new ((*fBmnCSCHitsArray)[fBmnCSCHitsArray->GetEntriesFast()])
410 BmnCSCHit(0, TVector3(x, y, z), TVector3(x_err, y_err, z_err), RefMCIndex);
412 BmnCSCHit* hit = (
BmnCSCHit*)fBmnCSCHitsArray->At(fBmnCSCHitsArray->GetEntriesFast() - 1);
415 hit->
SetIndex(fBmnCSCHitsArray->GetEntriesFast() - 1);
417 if (iPoint < NIntersectionPointsInModule) {
419 module->GetIntersectionPointDigitNumberMatch(iPoint));
425 iPoint - NIntersectionPointsInModule));
427 module->GetUpperCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
430 module->GetLowerCluster_PseudoIntersections(iPoint - NIntersectionPointsInModule)
436 cout <<
" glob(x:y:z) = ( " << x <<
" : " << y <<
" : " << z <<
"\n";
437 cout <<
" hit(x:y:z) = ( " << hit->GetX() <<
" : " << hit->GetY() <<
" : " << hit->GetZ() <<
"\n";
488 FairRootManager::Instance()->SetUseFairLinks(kTRUE);
490 if (iPoint < NIntersectionPointsInModule) {
491 hitMatch =
module->GetIntersectionPointMatch(iPoint);
493 hitMatch =
module->GetPseudoIntersectionMatch(iPoint - NIntersectionPointsInModule);
497 hit->AddLink(FairLink(-1, lnk.GetIndex(), lnk.GetWeight()));
498 FairRootManager::Instance()->SetUseFairLinks(kFALSE);
525 cout <<
" N clear matches with MC-points = " << clear_matched_points_cnt <<
"\n";