From c1d35ae20dd50619006a3daca58b49b63405ed26 Mon Sep 17 00:00:00 2001 From: sgorbuno <se.gorbunov@gsi.de> Date: Fri, 9 Jul 2021 23:03:52 +0000 Subject: [PATCH] rename L1StsHit to L1Hit --- reco/L1/CMakeLists.txt | 4 +- reco/L1/CbmL1.cxx | 28 +- reco/L1/CbmL1.h | 4 +- reco/L1/CbmL1Hit.h | 34 + reco/L1/CbmL1MCPoint.h | 2 +- reco/L1/CbmL1MCTrack.cxx | 4 +- reco/L1/CbmL1Performance.cxx | 8 +- reco/L1/CbmL1ReadEvent.cxx | 26 +- reco/L1/CbmL1StsHit.h | 52 - reco/L1/CbmL1TrackFitter.cxx | 10 +- reco/L1/L1Algo/L1Algo.cxx | 22 +- reco/L1/L1Algo/L1Algo.h | 28 +- reco/L1/L1Algo/L1Branch.h | 2 +- reco/L1/L1Algo/L1CATrackFinder.cxx | 81 +- reco/L1/L1Algo/L1Grid.cxx | 24 +- reco/L1/L1Algo/L1Grid.h | 12 +- reco/L1/L1Algo/L1Hit.h | 35 + reco/L1/L1Algo/L1HitsSortHelper.cxx | 6 +- reco/L1/L1Algo/L1HitsSortHelper.h | 8 +- reco/L1/L1Algo/L1StsHit.h | 30 - reco/L1/L1Algo/L1TrackExtender.cxx | 31 +- reco/L1/L1Algo/L1TrackFitter.cxx | 40 +- reco/L1/L1Algo/utils/L1AlgoDraw.cxx | 831 ++++++++++++++++ reco/L1/L1Algo/utils/L1AlgoDraw.h | 895 +----------------- .../utils/L1AlgoEfficiencyPerformance.h | 3 +- reco/L1/L1Algo/utils/L1AlgoPulls.h | 5 +- reco/L1/L1AlgoInputData.cxx | 6 +- reco/L1/L1AlgoInputData.h | 6 +- 28 files changed, 1112 insertions(+), 1125 deletions(-) create mode 100644 reco/L1/CbmL1Hit.h delete mode 100644 reco/L1/CbmL1StsHit.h create mode 100644 reco/L1/L1Algo/L1Hit.h delete mode 100644 reco/L1/L1Algo/L1StsHit.h create mode 100644 reco/L1/L1Algo/utils/L1AlgoDraw.cxx diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index 2344dcd91d..5276883e12 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -129,6 +129,8 @@ L1Algo/L1MCEvent.cxx L1Algo/L1Fit.cxx CbmL1MCTrack.cxx +L1Algo/utils/L1AlgoDraw.cxx + ParticleFinder/CbmL1PFFitter.cxx ParticleFinder/CbmL1PFMCParticle.cxx ) @@ -138,7 +140,7 @@ CbmL1CATrdTrackFinderSA.h CbmL1.h CbmL1MCTrack.h CbmL1MCPoint.h -CbmL1StsHit.h +CbmL1Hit.h CbmL1TofMerger.h CbmL1Track.h CbmL1TrackMerger.h diff --git a/reco/L1/CbmL1.cxx b/reco/L1/CbmL1.cxx index 63003bb6e6..4efb8e8ba6 100644 --- a/reco/L1/CbmL1.cxx +++ b/reco/L1/CbmL1.cxx @@ -65,7 +65,7 @@ #include "L1Algo/L1Algo.h" #include "L1Algo/L1Branch.h" #include "L1Algo/L1Field.h" -#include "L1Algo/L1StsHit.h" +#include "L1Algo/L1Hit.h" #include "L1AlgoInputData.h" #include "L1Event.h" @@ -1331,7 +1331,7 @@ void CbmL1::Reconstruct(CbmEvent* event) strips.clear(); zP.clear(); for (unsigned int iH = 0; iH < (*algo->vStsHits).size(); ++iH) { - L1StsHit& h = const_cast<L1StsHit&>((*algo->vStsHits)[iH]); + L1Hit& h = const_cast<L1Hit&>((*algo->vStsHits)[iH]); #ifdef USE_EVENT_NUMBER h.n = -1; #endif @@ -1406,7 +1406,7 @@ void CbmL1::Reconstruct(CbmEvent* event) for (unsigned int iH = 0; iH < (*algo->vStsHits).size(); ++iH) { #ifdef USE_EVENT_NUMBER - L1StsHit& h = const_cast<L1StsHit&>((*algo->vStsHits)[iH]); + L1Hit& h = const_cast<L1Hit&>((*algo->vStsHits)[iH]); h.n = -1; #endif if (vStsHits[iH].mcPointIds.size() == 0) continue; @@ -1427,7 +1427,7 @@ void CbmL1::Reconstruct(CbmEvent* event) for (unsigned int iH = 0; iH < MC.StsHits.size(); iH++) { const int hitI = MC.StsHits[iH]; - CbmL1StsHit& hit = const_cast<CbmL1StsHit&>(vStsHits[hitI]); + CbmL1Hit& hit = const_cast<CbmL1Hit&>(vStsHits[hitI]); hit.event = MC.iEvent; @@ -1613,7 +1613,7 @@ void CbmL1::Reconstruct(CbmEvent* event) for (unsigned int iH = 0; iH < (*algo->vStsHits).size(); ++iH) { #ifdef USE_EVENT_NUMBER - L1StsHit& h = const_cast<L1StsHit&>((*algo->vStsHits)[iH]); + L1Hit& h = const_cast<L1Hit&>((*algo->vStsHits)[iH]); h.n = -1; #endif if (vStsHits[iH].mcPointIds.size() == 0) continue; @@ -1634,7 +1634,7 @@ void CbmL1::Reconstruct(CbmEvent* event) for (unsigned int iH = 0; iH < MC.StsHits.size(); iH++) { const int hitI = MC.StsHits[iH]; - CbmL1StsHit& hit = const_cast<CbmL1StsHit&>(vStsHits[hitI]); + CbmL1Hit& hit = const_cast<CbmL1Hit&>(vStsHits[hitI]); hit.event = MC.iEvent; } @@ -1727,7 +1727,7 @@ void CbmL1::IdealTrackFinder() for (unsigned int iH = 0; iH < MC.StsHits.size(); iH++) { const int hitI = MC.StsHits[iH]; - const CbmL1StsHit& hit = vStsHits[hitI]; + const CbmL1Hit& hit = vStsHits[hitI]; const int iStation = vMCPoints[hit.mcPointIds[0]].iStation; @@ -1838,7 +1838,7 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent n = (*algo->vStsHits).size(); fadata << n << endl; for (int i = 0; i < n; i++) { - const L1StsHit& h = (*algo->vStsHits)[i]; + const L1Hit& h = (*algo->vStsHits)[i]; fadata << static_cast<int>(h.f) << " "; fadata << static_cast<int>(h.b) << " "; #ifdef USE_EVENT_NUMBER @@ -1848,7 +1848,7 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent fadata << h.u << " "; fadata << h.v << " "; // fadata << (*algo->vStsHits)[i].time << endl; - fadata << h.t_reco << endl; + fadata << h.t << endl; }; if (fVerbose >= 4) { cout << "vStsHits[" << n << "]" @@ -2065,7 +2065,7 @@ void CbmL1::ReadSTAPAlgoData() if (1) { if (nEvent == 1) fadata.open(fadata_name, fstream::in); - if (algo->vStsHits) const_cast<std::vector<L1StsHit>*>(algo->vStsHits)->clear(); + if (algo->vStsHits) const_cast<std::vector<L1Hit>*>(algo->vStsHits)->clear(); algo->NStsStrips = 0; if (algo->vStsZPos) const_cast<std::vector<float>*>(algo->vStsZPos)->clear(); if (algo->fStripFlag) algo->fStripFlag->clear(); @@ -2115,12 +2115,12 @@ void CbmL1::ReadSTAPAlgoData() int element_n; int element_iz; for (int i = 0; i < n; i++) { - L1StsHit element; - fadata >> element_f >> element_b >> element_n >> element_iz >> element.u >> element.v >> element.t_reco; + L1Hit element; + fadata >> element_f >> element_b >> element_n >> element_iz >> element.u >> element.v >> element.t; element.f = static_cast<THitI>(element_f); element.b = static_cast<THitI>(element_b); element.iz = static_cast<TZPosI>(element_iz); - const_cast<std::vector<L1StsHit>*>(algo->vStsHits)->push_back(element); + const_cast<std::vector<L1Hit>*>(algo->vStsHits)->push_back(element); } if (fVerbose >= 4) { cout << "vStsHits[" << n << "]" @@ -2291,7 +2291,7 @@ void CbmL1::ReadSTAPPerfData() // vStsHits fpdata >> n; for (int i = 0; i < n; i++) { - CbmL1StsHit element; + CbmL1Hit element; fpdata >> element.hitId; fpdata >> element.extIndex; diff --git a/reco/L1/CbmL1.h b/reco/L1/CbmL1.h index 5ac4910d14..c8c818cade 100644 --- a/reco/L1/CbmL1.h +++ b/reco/L1/CbmL1.h @@ -31,9 +31,9 @@ //#include "L1Algo/L1Algo.h" #include "CbmEvent.h" +#include "CbmL1Hit.h" #include "CbmL1MCPoint.h" #include "CbmL1MCTrack.h" -#include "CbmL1StsHit.h" #include "CbmMCTrack.h" #include "CbmMvdHit.h" #include "CbmMvdPoint.h" @@ -317,7 +317,7 @@ private: //CbmMCEventHeader* fEvent; /// Used data = Repacked input data - vector<CbmL1StsHit> vStsHits; // hits with hit-mcpoint match information + vector<CbmL1Hit> vStsHits; // hits with hit-mcpoint match information // vector<CbmL1MCPoint> vMCPoints; vector<int> SortedIndex; vector<int> StsIndex; diff --git a/reco/L1/CbmL1Hit.h b/reco/L1/CbmL1Hit.h new file mode 100644 index 0000000000..5b1615936d --- /dev/null +++ b/reco/L1/CbmL1Hit.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt + SPDX-License-Identifier: GPL-3.0-only + Authors: Igor Kulakov [committer], Valentina Akishina, Maksym Zyzak */ + +#ifndef _CbmL1Hit_h_ +#define _CbmL1Hit_h_ + +#include <vector> +using std::vector; + +/// +/// hits with hit-mcpoint match information +/// +class CbmL1Hit { +public: + CbmL1Hit() {}; + + CbmL1Hit(int hitId_, int extIndex_, int Det_) : hitId(hitId_), extIndex(extIndex_), Det(Det_) {}; + + int hitId = 0; // index of L1Hit in algo->vStsHits array. Should be equal to index of this in L1->vStsHits + int extIndex = 0; // index of hit in the TClonesArray array + int Det = 0; // station index + vector<int> mcPointIds {}; // indices of CbmL1MCPoint in L1->vMCPoints array + float x = 0.f; // measured X coordinate + float y = 0.f; // measured Y coordinate + float t = 0.f; // measured time + int f = 0; // front strip index + int b = 0; // back strip index + int ID = 0; // TODO: check if this ID is redundant + int file = 0; // TODO: ?? + int event = 0; // TODO: ?? +}; + +#endif diff --git a/reco/L1/CbmL1MCPoint.h b/reco/L1/CbmL1MCPoint.h index 1ac480f0d0..59f8580523 100644 --- a/reco/L1/CbmL1MCPoint.h +++ b/reco/L1/CbmL1MCPoint.h @@ -78,7 +78,7 @@ struct CbmL1MCPoint { return (a->ID < b->ID) || ((a->ID == b->ID) && (a->z < b->z)); } - vector<int> hitIds; // indices of CbmL1StsHits in L1->vStsHits array + vector<int> hitIds; // indices of CbmL1Hits in L1->vStsHits array }; #endif diff --git a/reco/L1/CbmL1MCTrack.cxx b/reco/L1/CbmL1MCTrack.cxx index 620dc497b1..4bdf70d64f 100644 --- a/reco/L1/CbmL1MCTrack.cxx +++ b/reco/L1/CbmL1MCTrack.cxx @@ -24,7 +24,7 @@ #include "CbmL1Constants.h" #include "L1Algo/L1Algo.h" -#include "L1Algo/L1StsHit.h" +#include "L1Algo/L1Hit.h" CbmL1MCTrack::CbmL1MCTrack(double mass_, double q_, TVector3 vr, TLorentzVector vp, int _ID, int _mother_ID, int _pdg) : mass(mass_) @@ -147,7 +147,7 @@ void CbmL1MCTrack::CalculateHitCont() { for (int ih = 0; ih < nhits; ih++) { int jh = StsHits[ih]; - const L1StsHit& h = (*algo->vStsHits)[jh]; + const L1Hit& h = (*algo->vStsHits)[jh]; int ista = (*algo->fStripFlag)[h.f] / 4; if (ista - istaold == 1) ncont++; diff --git a/reco/L1/CbmL1Performance.cxx b/reco/L1/CbmL1Performance.cxx index b077730b0d..37da82fff2 100644 --- a/reco/L1/CbmL1Performance.cxx +++ b/reco/L1/CbmL1Performance.cxx @@ -1813,7 +1813,7 @@ void CbmL1::InputPerformance() if (listStsHits && listStsHitMatch) { for (unsigned int iH = 0; iH < vStsHits.size(); iH++) { - const CbmL1StsHit& h = vStsHits[iH]; + const CbmL1Hit& h = vStsHits[iH]; if (h.Det != 1) continue; // mvd hit const CbmStsHit* sh = L1_DYNAMIC_CAST<CbmStsHit*>(listStsHits->At(h.extIndex)); @@ -1957,7 +1957,7 @@ void CbmL1::InputPerformance() if (fMuchPixelHits && listMuchHitMatches) { for (unsigned int iH = 0; iH < vStsHits.size(); iH++) { - const CbmL1StsHit& h = vStsHits[iH]; + const CbmL1Hit& h = vStsHits[iH]; if (h.Det != 2) continue; // mvd hit @@ -2027,7 +2027,7 @@ void CbmL1::InputPerformance() if (listTrdHits && fTrdHitMatches) { for (unsigned int iH = 0; iH < vStsHits.size(); iH++) { - const CbmL1StsHit& h = vStsHits[iH]; + const CbmL1Hit& h = vStsHits[iH]; if (h.Det != 3) continue; // mvd hit const CbmTrdHit* sh = L1_DYNAMIC_CAST<CbmTrdHit*>(listTrdHits->At(h.extIndex)); @@ -2091,7 +2091,7 @@ void CbmL1::InputPerformance() if (fTofHits && fTofHitDigiMatches) { for (unsigned int iH = 0; iH < vStsHits.size(); iH++) { - const CbmL1StsHit& h = vStsHits[iH]; + const CbmL1Hit& h = vStsHits[iH]; if (h.Det != 4) continue; // mvd hit diff --git a/reco/L1/CbmL1ReadEvent.cxx b/reco/L1/CbmL1ReadEvent.cxx index cd2df4e03f..33f7e5bb81 100644 --- a/reco/L1/CbmL1ReadEvent.cxx +++ b/reco/L1/CbmL1ReadEvent.cxx @@ -71,7 +71,7 @@ struct TmpHit { // used for sort Hits before writing in the normal arrays double dx, dy, dxy; double du, dv; int iMC; // index of MCPoint in the vMCPoints array - double time, t_er, z; + double time, dt, z; int Det; int id; int track; @@ -513,7 +513,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, //Get time th.time = mh->GetTime(); - th.t_er = mh->GetTimeError(); + th.dt = mh->GetTimeError(); if (fTimesliceMode) th.id = hitIndex; else @@ -625,7 +625,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, th.iStation = DetId + NMvdStations + NStsStations; //Get time th.time = mh->GetTime() - 14.5; - th.t_er = mh->GetTimeError(); + th.dt = mh->GetTimeError(); // th.iSector = 0; @@ -689,7 +689,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, // th.x = pt->GetX( th.z );// + gRandom->Gaus(0,th.dx); // // th.y = pt->GetY(th.z);// + gRandom->Gaus(0,th.dy); - // th.time = pt->GetTime(); //+ gRandom->Gaus(0,th.t_er); + // th.time = pt->GetTime(); //+ gRandom->Gaus(0,th.dt); // // L1Station& st = algo->vStations[th.iStation]; // th.u_front = @@ -724,7 +724,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, th.time = mh->GetTime(); - th.t_er = mh->GetTimeError(); + th.dt = mh->GetTimeError(); // th.iSector = 0; th.iStripF = firstDetStrip + j; @@ -830,7 +830,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, th.time = mh->GetTime(); - th.t_er = mh->GetTimeError(); + th.dt = mh->GetTimeError(); th.dx = mh->GetDx(); th.dy = mh->GetDy(); @@ -885,7 +885,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, // th.x = pt->GetX() + gRandom->Gaus(0,th.dx); // // th.y = pt->GetY()+ gRandom->Gaus(0,th.dy); - // th.time = pt->GetTime()+ gRandom->Gaus(0,th.t_er); + // th.time = pt->GetTime()+ gRandom->Gaus(0,th.dt); // // L1Station &st = algo->vStations[th.iStation]; // th.u_front = th.x*st.frontInfo.cos_phi[0] + th.y*st.frontInfo.sin_phi[0]; @@ -952,14 +952,14 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, assert(th.iStripF >= 0 || th.iStripF < NStrips); assert(th.iStripB >= 0 || th.iStripB < NStrips); - L1StsHit h; + L1Hit h; h.f = th.iStripF; h.b = th.iStripB; h.ID = th.id; - h.t_reco = th.time; - h.t_er = th.t_er; + h.t = th.time; + h.dt = th.dt; // h.track = th.track; // h.dx = th.dx; // h.dy = th.dy; @@ -1040,7 +1040,7 @@ void CbmL1::ReadEvent(L1AlgoInputData* fData_, float& TsStart, float& TsLength, } // save hit - vStsHits.push_back(CbmL1StsHit(fData->vStsHits.size(), th.ExtIndex, th.Det)); + vStsHits.push_back(CbmL1Hit(fData->vStsHits.size(), th.ExtIndex, th.Det)); vStsHits[vStsHits.size() - 1].x = th.x; vStsHits[vStsHits.size() - 1].y = th.y; @@ -1359,13 +1359,13 @@ bool CbmL1::ReadMCPoint(CbmL1MCPoint* MC, int iPoint, int file, int event, int M bool CbmL1::ReadMCPoint(CbmL1MCPoint* /*MC*/, int /*iPoint*/, int /*MVD*/) { return 0; } /// Procedure for match hits and MCPoints. -/// Read information about correspondence between hits and mcpoints and fill CbmL1MCPoint::hitIds and CbmL1StsHit::mcPointIds arrays +/// Read information about correspondence between hits and mcpoints and fill CbmL1MCPoint::hitIds and CbmL1Hit::mcPointIds arrays /// should be called after fill of algo void CbmL1::HitMatch() { const int NHits = vStsHits.size(); for (int iH = 0; iH < NHits; iH++) { - CbmL1StsHit& hit = vStsHits[iH]; + CbmL1Hit& hit = vStsHits[iH]; if (hit.Det == 1) { CbmStsHit* sh = L1_DYNAMIC_CAST<CbmStsHit*>(listStsHits->At(vStsHits[iH].extIndex)); diff --git a/reco/L1/CbmL1StsHit.h b/reco/L1/CbmL1StsHit.h deleted file mode 100644 index ae654a5e35..0000000000 --- a/reco/L1/CbmL1StsHit.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt - SPDX-License-Identifier: GPL-3.0-only - Authors: Igor Kulakov [committer], Valentina Akishina, Maksym Zyzak */ - -#ifndef _CbmL1StsHit_h_ -#define _CbmL1StsHit_h_ - -#include <vector> -using std::vector; - -// hits with hit-mcpoint match information -class CbmL1StsHit { -public: - CbmL1StsHit() - : hitId(0) - , extIndex(0) - , Det(0) - , mcPointIds() - , x(0.) - , y(0.) - , t(0.) - , f(0.) - , b(0.) - , ID(0.) - , file(0) - , event(0) {}; - CbmL1StsHit(int hitId_, int extIndex_, int Det_) - : hitId(hitId_) - , extIndex(extIndex_) - , Det(Det_) - , mcPointIds() - , x(0.) - , y(0.) - , t(0.) - , f(0.) - , b(0.) - , ID(0.) - , file(0) - , event(0) {}; - - int hitId; // index of L1StsHit in algo->vStsHits array. Should be equal to index of this in L1->vStsHits - int extIndex; // index of hit in the TClonesArray array - int Det; - vector<int> mcPointIds; // indices of CbmL1MCPoint in L1->vMCPoints array - float x, y, t; - int f, b; - int ID; - int file; - int event; -}; - -#endif diff --git a/reco/L1/CbmL1TrackFitter.cxx b/reco/L1/CbmL1TrackFitter.cxx index 26564f93a8..cdd6328646 100644 --- a/reco/L1/CbmL1TrackFitter.cxx +++ b/reco/L1/CbmL1TrackFitter.cxx @@ -28,7 +28,7 @@ #include "L1Algo/L1Algo.h" #include "L1Algo/L1Extrapolation.h" #include "L1Algo/L1Filtration.h" -#include "L1Algo/L1StsHit.h" +#include "L1Algo/L1Hit.h" #include "L1Algo/L1TrackPar.h" void CbmL1::TrackFitter(vector<CbmL1Track>& Tracks, CbmL1Vtx* V) @@ -42,7 +42,7 @@ void CbmL1::TrackFitter(vector<CbmL1Track>& Tracks, CbmL1Vtx* V) CbmL1Track &T = *i; int stmin = 1000, stmax = -1000; - for ( vector<L1StsHit*>::iterator j = T.StsHits.begin(); j != T.StsHits.end(); ++j) + for ( vector<L1Hit*>::iterator j = T.StsHits.begin(); j != T.StsHits.end(); ++j) { if ((*j)->iStation < stmin ) stmin = (*j)->iStation; if ((*j)->iStation > stmax ) stmax = (*j)->iStation; @@ -56,7 +56,7 @@ void CbmL1::TrackFitter(vector<CbmL1Track>& Tracks, CbmL1Vtx* V) static L1FieldRegion fld[20]; { - vector<L1StsHit*>::iterator ih2 = T.StsHits.begin(), ih1, ih0; + vector<L1Hit*>::iterator ih2 = T.StsHits.begin(), ih1, ih0; ih1 = ih2; ih1++; ih0 = ih1; @@ -96,7 +96,7 @@ void CbmL1::TrackFitter(vector<CbmL1Track>& Tracks, CbmL1Vtx* V) fvec qp0 = tp.qp; tp.NDF = 2; tp.chi2 = 0; - vector<L1StsHit*>::iterator ih = T.StsHits.begin(); + vector<L1Hit*>::iterator ih = T.StsHits.begin(); int ist = (*ih)->iStation; L1Station *st = &(algo->vStations[ist]); tp.x = (*ih)->x; @@ -124,7 +124,7 @@ void CbmL1::TrackFitter(vector<CbmL1Track>& Tracks, CbmL1Vtx* V) fvec qp0 = tp.qp; tp.NDF = 2; tp.chi2 = 0; - vector<L1StsHit*>::reverse_iterator ih = T.StsHits.rbegin(); + vector<L1Hit*>::reverse_iterator ih = T.StsHits.rbegin(); int ist = (*ih)->iStation; L1Station *st = &(algo->vStations[ist]); tp.x = (*ih)->x; diff --git a/reco/L1/L1Algo/L1Algo.cxx b/reco/L1/L1Algo/L1Algo.cxx index 1a91e18324..cbbc855c5f 100644 --- a/reco/L1/L1Algo/L1Algo.cxx +++ b/reco/L1/L1Algo/L1Algo.cxx @@ -50,10 +50,6 @@ L1Algo::L1Algo(int nThreads, int ExpectedHits) , TIME_CUT2(0.) , MaxDZ(0.) , -#ifdef DRAW - draw(0) - , -#endif Pick_gather(0) , PickNeighbour(0) , // (PickNeighbour < dp/dp_error) => triplets are neighbours @@ -316,7 +312,7 @@ void L1Algo::Init(const vector<fscal>& geo, const bool UseHitErrors, const bool } -void L1Algo::SetData(vector<L1StsHit>& StsHits_, int nStsStrips_, const vector<fscal>& StsZPos_, +void L1Algo::SetData(vector<L1Hit>& StsHits_, int nStsStrips_, const vector<fscal>& StsZPos_, L1Vector<unsigned char>& SFlag_, const THitI* StsHitsStartIndex_, const THitI* StsHitsStopIndex_) { @@ -393,7 +389,7 @@ void L1Algo::SetData(vector<L1StsHit>& StsHits_, int nStsStrips_, const vector<f } -void L1Algo::GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, char iS) +void L1Algo::GetHitCoor(const L1Hit& _h, fscal& _x, fscal& _y, char iS) { L1Station& sta = vStations[int(iS)]; fscal u = _h.u; @@ -404,7 +400,7 @@ void L1Algo::GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, char iS) _y = (sta.yInfo.cos_phi[0] * u + sta.yInfo.sin_phi[0] * v) / (*vStsZPos)[_h.iz]; } -void L1Algo::GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, fscal& _z, const L1Station& sta) +void L1Algo::GetHitCoor(const L1Hit& _h, fscal& _x, fscal& _y, fscal& _z, const L1Station& sta) { fscal u = _h.u; fscal v = _h.v; @@ -466,25 +462,25 @@ void L1Algo::StripsToCoor( } /// full the hit point by hit information: takes hit as input (2 strips) and creates hit_point with all coordinates (x,y,z,u,v, n - event number); -L1HitPoint L1Algo::CreateHitPoint(const L1StsHit& hit, char /*ista*/) +L1HitPoint L1Algo::CreateHitPoint(const L1Hit& hit, char /*ista*/) /// hit and station number { // L1Station& sta = vStations[int(ista)]; const float& z = (*vStsZPos)[hit.iz]; - const float& time = hit.t_reco; - return L1HitPoint(z, hit.u, hit.v, hit.du, hit.dv, time, hit.t_er); + const float& time = hit.t; + return L1HitPoint(z, hit.u, hit.v, hit.du, hit.dv, time, hit.dt); } -void L1Algo::CreateHitPoint(const L1StsHit& hit, char /*ista*/, L1HitPoint& point) +void L1Algo::CreateHitPoint(const L1Hit& hit, char /*ista*/, L1HitPoint& point) /// hit and station number { // L1Station& sta = vStations[int(ista)]; const float& z = (*vStsZPos)[hit.iz]; - const float& time = hit.t_reco; + const float& time = hit.t; const float& du_ = hit.du; const float& dv_ = hit.dv; - point.Set(z, hit.u, hit.v, du_, dv_, time, hit.t_er); + point.Set(z, hit.u, hit.v, du_, dv_, time, hit.dt); // point.Set(x,y,z,v.f,u.f, time, n1, hit.time1, 2.9 ); // TODO put correct time error from the hit } diff --git a/reco/L1/L1Algo/L1Algo.h b/reco/L1/L1Algo/L1Algo.h index 170c608c7a..a85bb53507 100644 --- a/reco/L1/L1Algo/L1Algo.h +++ b/reco/L1/L1Algo/L1Algo.h @@ -11,7 +11,7 @@ // #define PULLS // triplets pulls // #define TRIP_PERFORMANCE // triplets efficiencies // #define DOUB_PERFORMANCE // doublets efficiencies -//#define DRAW // event display +// #define DRAW // event display #ifdef DRAW class L1AlgoDraw; #include "CbmL1Track.h" @@ -45,11 +45,11 @@ class L1AlgoDraw; #include "L1Branch.h" #include "L1Field.h" #include "L1Grid.h" +#include "L1Hit.h" #include "L1HitPoint.h" #include "L1HitsSortHelper.h" #include "L1Portion.h" #include "L1Station.h" -#include "L1StsHit.h" #include "L1Track.h" #include "L1TrackPar.h" #include "L1TrackParFit.h" @@ -131,15 +131,15 @@ public: #ifdef DRAW - L1AlgoDraw* draw; + L1AlgoDraw* draw {nullptr}; void DrawRecoTracksTime(const vector<CbmL1Track>& tracks); #endif void Init(const vector<fscal>& geo, const bool UseHitErrors, const bool mCBMmode); - void SetData(vector<L1StsHit>& StsHits_, int nStsStrips_, const vector<fscal>& StsZPos_, - L1Vector<unsigned char>& SFlag_, const THitI* StsHitsStartIndex_, const THitI* StsHitsStopIndex_); + void SetData(vector<L1Hit>& StsHits_, int nStsStrips_, const vector<fscal>& StsZPos_, L1Vector<unsigned char>& SFlag_, + const THitI* StsHitsStartIndex_, const THitI* StsHitsStopIndex_); void PrintHits(); @@ -170,7 +170,7 @@ public: int NStsStrips; // number of strips const vector<fscal>* vStsZPos; // all possible z-positions of hits - vector<L1StsHit>* vStsHits; // hits as a combination of front-, backstrips and z-position + vector<L1Hit>* vStsHits; // hits as a combination of front-, backstrips and z-position L1Grid vGrid[MaxNStations]; // hits as a combination of front-, backstrips and z-position L1Grid vGridTime[MaxNStations]; @@ -188,9 +188,9 @@ public: // L1Branch* pointer; unsigned int NHitsIsecAll; - vector<L1StsHit> vStsDontUsedHits_A; - vector<L1StsHit> vStsDontUsedHits_B; - vector<L1StsHit> vStsDontUsedHits_Buf; + vector<L1Hit> vStsDontUsedHits_A; + vector<L1Hit> vStsDontUsedHits_B; + vector<L1Hit> vStsDontUsedHits_Buf; vector<L1HitPoint> vStsDontUsedHitsxy_A; vector<L1HitPoint> vStsDontUsedHitsxy_buf; vector<L1HitPoint> vStsDontUsedHitsxy_B; @@ -241,7 +241,7 @@ public: /// --- data used during finding iterations int isec; // iteration - vector<L1StsHit>* vStsHitsUnused; + vector<L1Hit>* vStsHitsUnused; vector<THitI>* RealIHitP; vector<THitI>* RealIHitPBuf; vector<L1HitPoint>* vStsHitPointsUnused; @@ -275,7 +275,7 @@ public: const L1FieldRegion& GetVtxFieldRegion() const { return vtxFieldRegion; } /// ----- Hit-point-strips conversion routines ------ - void GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, fscal& _z, const L1Station& sta); + void GetHitCoor(const L1Hit& _h, fscal& _x, fscal& _y, fscal& _z, const L1Station& sta); void dUdV_to_dY(const fvec& u, const fvec& v, fvec& _y, const L1Station& sta); @@ -283,16 +283,16 @@ public: void dUdV_to_dXdY(const fvec& u, const fvec& v, fvec& _xy, const L1Station& sta); - void GetHitCoor(const L1StsHit& _h, fscal& _x, fscal& _y, char iS); + void GetHitCoor(const L1Hit& _h, fscal& _x, fscal& _y, char iS); void StripsToCoor(const fscal& u, const fscal& v, fscal& x, fscal& y, const L1Station& sta) const; // convert strip positions to coordinates void StripsToCoor(const fscal& u, const fscal& v, fvec& x, fvec& y, const L1Station& sta) const; // convert strip positions to coordinates void StripsToCoor(const fvec& u, const fvec& v, fvec& x, fvec& y, const L1Station& sta) const; - L1HitPoint CreateHitPoint(const L1StsHit& hit, + L1HitPoint CreateHitPoint(const L1Hit& hit, char ista); // full the hit point by hit information. - void CreateHitPoint(const L1StsHit& hit, char ista, L1HitPoint& point); + void CreateHitPoint(const L1Hit& hit, char ista, L1HitPoint& point); inline int PackIndex(const int& a, const int& b, const int& c); inline int UnPackIndex(const int& i, int& a, int& b, int& c); diff --git a/reco/L1/L1Algo/L1Branch.h b/reco/L1/L1Algo/L1Branch.h index 8a0b103656..f37ff197ad 100644 --- a/reco/L1/L1Algo/L1Branch.h +++ b/reco/L1/L1Algo/L1Branch.h @@ -10,7 +10,7 @@ #include "CbmL1Def.h" -#include "L1StsHit.h" +#include "L1Hit.h" #include "L1Vector.h" /// diff --git a/reco/L1/L1Algo/L1CATrackFinder.cxx b/reco/L1/L1Algo/L1CATrackFinder.cxx index 51ed29b947..661beb849c 100644 --- a/reco/L1/L1Algo/L1CATrackFinder.cxx +++ b/reco/L1/L1Algo/L1CATrackFinder.cxx @@ -403,9 +403,9 @@ inline void L1Algo::f20( // input n2 = 0; // number of doublet for (Tindex i1 = 0; i1 < n1; ++i1) // for each singlet { - const Tindex i1_V = i1 / fvecLen; - const Tindex i1_4 = i1 % fvecLen; - L1TrackPar& T1 = T_1[i1_V]; + const Tindex i1_V = i1 / fvecLen; + const Tindex i1_4 = i1 % fvecLen; + L1TrackPar& T1 = T_1[i1_V]; const int n2Saved = n2; @@ -952,9 +952,9 @@ inline void L1Algo::f32( // input // TODO not updated after gaps introduction fscal u[NHits], v[NHits], x[NHits], y[NHits], z[NHits]; for (int ih = 0; ih < NHits; ++ih) { - const L1StsHit& hit = (*vStsHits)[ihit[ih]]; - u[ih] = hit.u; - v[ih] = hit.v; + const L1Hit& hit = (*vStsHits)[ihit[ih]]; + u[ih] = hit.u; + v[ih] = hit.v; StripsToCoor(u[ih], v[ih], x[ih], y[ih], sta[ih]); z[ih] = (*vStsZPos)[hit.iz]; }; @@ -1135,10 +1135,10 @@ inline void L1Algo::f4( // input fscal MaxInvMomS = MaxInvMom[0]; fscal scale = 255 / (MaxInvMomS * 2); - fscal qp = MaxInvMomS + T3.qp[i3_4]; + fscal qp = MaxInvMomS + T3.qp[i3_4]; if (qp < 0) qp = 0; if (qp > MaxInvMomS * 2) qp = MaxInvMomS * 2; - qp = (static_cast<unsigned int>(qp * scale)) % 256; + qp = (static_cast<unsigned int>(qp * scale)) % 256; qp = static_cast<unsigned char>(qp); fscal Cqp = 5. * sqrt(fabs(T3.C44[i3_4])); @@ -1616,15 +1616,15 @@ void L1Algo::CATrackFinder() static Tindex stat_nTrCandidates[fNFindIterations] = {0}; #endif - RealIHitP = &RealIHit_v; - RealIHitPBuf = &RealIHit_v_buf; - vStsHitsUnused = &vStsDontUsedHits_B; /// array of hits used on current iteration - vector<L1StsHit>* vStsHitsUnused_buf = &vStsDontUsedHits_A; /// buffer for copy + RealIHitP = &RealIHit_v; + RealIHitPBuf = &RealIHit_v_buf; + vStsHitsUnused = &vStsDontUsedHits_B; /// array of hits used on current iteration + vector<L1Hit>* vStsHitsUnused_buf = &vStsDontUsedHits_A; /// buffer for copy vStsHitPointsUnused = &vStsDontUsedHitsxy_B; /// array of info for hits used on current iteration vector<L1HitPoint>* vStsHitPointsUnused_buf = &vStsDontUsedHitsxy_A; - NHitsIsecAll = 0; + NHitsIsecAll = 0; fTracks.clear(); fRecoHits.clear(); @@ -1644,14 +1644,14 @@ void L1Algo::CATrackFinder() for (int ist = 0; ist < NStations; ++ist) for (THitI ih = StsHitsStartIndex[ist]; ih < StsHitsStopIndex[ist]; ++ih) { - const float& time = (*vStsHits)[ih].t_reco; + const float& time = (*vStsHits)[ih].t; if ((lasttime < time) && (!isinf(time))) lasttime = time; if ((starttime > time) && (time > 0)) starttime = time; if (ist < NMvdStations) { - L1StsHit& h = (*vStsHits)[ih]; - h.t_reco = 0; - h.t_er = 100; + L1Hit& h = (*vStsHits)[ih]; + h.t = 0; + h.dt = 100; } } @@ -1694,7 +1694,7 @@ void L1Algo::CATrackFinder() for (int ist = 0; ist < NStations; ++ist) for (THitI ih = StsHitsStartIndex[ist]; ih < StsHitsStopIndex[ist]; ++ih) { - L1StsHit& h = (*vStsHits)[ih]; + L1Hit& h = (*vStsHits)[ih]; SetFUnUsed((*fStripFlag)[h.f]); SetFUnUsed((*fStripFlag)[h.b]); } @@ -1735,7 +1735,7 @@ void L1Algo::CATrackFinder() fTriplets[j][n].clear(); } } - /// isec - number of current iterations, fNFindIterations - number of all iterations + /// isec - number of current iterations, fNFindIterations - number of all iterations #ifdef COUNTERS Tindex nSinglets = 0; #endif @@ -1745,9 +1745,9 @@ void L1Algo::CATrackFinder() RealIHitP = RealIHitPBuf; RealIHitPBuf = RealIHitPTmp; - vector<L1StsHit>* vStsHitsUnused_temp = vStsHitsUnused; - vStsHitsUnused = vStsHitsUnused_buf; - vStsHitsUnused_buf = vStsHitsUnused_temp; + vector<L1Hit>* vStsHitsUnused_temp = vStsHitsUnused; + vStsHitsUnused = vStsHitsUnused_buf; + vStsHitsUnused_buf = vStsHitsUnused_temp; vector<L1HitPoint>* vStsHitsUnused_temp2 = vStsHitPointsUnused; vStsHitPointsUnused = vStsHitPointsUnused_buf; @@ -1868,7 +1868,7 @@ void L1Algo::CATrackFinder() fDupletPortionStopIndex[NStations - 1] = 0; fDupletPortionSize.clear(); for (int istal = NStations - 2; istal >= FIRSTCASTATION; istal--) { //start downstream chambers - int NHits_l = StsHitsUnusedStopIndex[istal] - StsHitsUnusedStartIndex[istal]; + int NHits_l = StsHitsUnusedStopIndex[istal] - StsHitsUnusedStartIndex[istal]; int nPortions = NHits_l / Portion; int rest = NHits_l - nPortions * Portion; for (int ipp = 0; ipp < nPortions; ipp++) { @@ -2176,7 +2176,7 @@ void L1Algo::CATrackFinder() for (L1Vector<THitI>::iterator phitIt = tr.fStsHits.begin(); /// used strips are marked phitIt != tr.fStsHits.end(); ++phitIt) { - const L1StsHit& h = (*vStsHits)[*phitIt]; + const L1Hit& h = (*vStsHits)[*phitIt]; #ifdef _OPENMP omp_set_lock(&fHitToBestTrackB[h.b]); #endif @@ -2188,7 +2188,7 @@ void L1Algo::CATrackFinder() if (L1Branch::compareCand(tr, fTrackCandidates[thread][num])) { fTrackCandidates[thread][num].CandIndex = -1; - strip1 = tr.CandIndex; + strip1 = tr.CandIndex; } else { check = 0; @@ -2215,7 +2215,7 @@ void L1Algo::CATrackFinder() if (L1Branch::compareCand(tr, fTrackCandidates[thread][num])) { fTrackCandidates[thread][num].CandIndex = -1; - strip2 = tr.CandIndex; + strip2 = tr.CandIndex; } else { check = 0; @@ -2258,7 +2258,7 @@ void L1Algo::CATrackFinder() if (fTrackCandidates[i][iCandidate].CandIndex != -1) { for (L1Vector<THitI>::iterator phIt = tr.fStsHits.begin(); /// used strips are marked phIt != tr.fStsHits.end(); ++phIt) { - const L1StsHit& h = (((*vStsHits))[*phIt]); + const L1Hit& h = (((*vStsHits))[*phIt]); if (((fStripToTrackB)[h.b] != tr.CandIndex) || ((fStripToTrack)[h.f] != tr.CandIndex)) { check = 0; break; @@ -2290,7 +2290,7 @@ void L1Algo::CATrackFinder() for (L1Vector<THitI>::iterator phIt = tr.fStsHits.begin(); /// used strips are marked phIt != tr.fStsHits.end(); ++phIt) { - L1StsHit& h = (*vStsHits)[*phIt]; + L1Hit& h = (*vStsHits)[*phIt]; SetFUsed((*fStripFlag)[h.f]); @@ -2298,7 +2298,7 @@ void L1Algo::CATrackFinder() fRecoHits_local[num_thread].push_back(*phIt); - const L1StsHit& hit = (*vStsHits)[*phIt]; + const L1Hit& hit = (*vStsHits)[*phIt]; L1HitPoint tempPoint = CreateHitPoint(hit, 0); //TODO take number of station from hit @@ -2309,7 +2309,7 @@ void L1Algo::CATrackFinder() float zcoor = tempPoint.Z(); float timeFlight = sqrt(xcoor * xcoor + ycoor * ycoor + zcoor * zcoor) / 30.f; // c = 30[cm/ns] - sumTime += (hit.t_reco - timeFlight); + sumTime += (hit.t - timeFlight); } t.NHits = tr.NHits; @@ -2463,7 +2463,7 @@ void L1Algo::CATrackFinder() NTimes++; NHits += vStsHitsUnused->size(); - HitSize += vStsHitsUnused->size()*sizeof(L1StsHit); + HitSize += vStsHitsUnused->size()*sizeof(L1Hit); NStrips+= vStsStrips.size(); StripSize += vStsStrips.size()*sizeof(fscal) + (*fStripFlag).size()*sizeof(unsigned char); NStripsB+= (*fStripFlagB).size(); @@ -2625,16 +2625,16 @@ inline void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best if (dqp > PickNeighbour * Cqp) continue; // bad neighbour // CHECKME why do we need recheck it?? (it really change result) - fscal tx1 = curr_trip->GetTx(); - fscal tx2 = new_trip.GetTx(); - fscal dtx = fabs(tx1 - tx2); - fscal Ctx = curr_trip->GetCtx(); + fscal tx1 = curr_trip->GetTx(); + fscal tx2 = new_trip.GetTx(); + fscal dtx = fabs(tx1 - tx2); + fscal Ctx = curr_trip->GetCtx(); Ctx += new_trip.GetCtx(); - fscal ty1 = curr_trip->GetTy(); - fscal ty2 = new_trip.GetTy(); - fscal dty = fabs(ty1 - ty2); - fscal Cty = curr_trip->GetCty(); + fscal ty1 = curr_trip->GetTy(); + fscal ty2 = new_trip.GetTy(); + fscal dty = fabs(ty1 - ty2); + fscal Cty = curr_trip->GetCty(); Cty += new_trip.GetCty(); if (fGlobal || fmCBMmode) { @@ -2692,7 +2692,8 @@ inline void L1Algo::CAFindTrack(int ista, L1Branch& best_tr, unsigned char& best #ifdef DRAW void L1Algo::DrawRecoTracksTime(const vector<CbmL1Track>& tracks) { - draw->DrawRecoTracksTime(tracks); + // TODO: find where the DrawRecoTracksTime is. It is missing in the git repository. + //draw->DrawRecoTracksTime(tracks); draw->SaveCanvas(" "); } #endif diff --git a/reco/L1/L1Algo/L1Grid.cxx b/reco/L1/L1Algo/L1Grid.cxx index 4dda96c73c..0227b0fa1e 100644 --- a/reco/L1/L1Algo/L1Grid.cxx +++ b/reco/L1/L1Algo/L1Grid.cxx @@ -11,6 +11,8 @@ #include <assert.h> #include <string.h> + +#include "L1Hit.h" #ifdef _OPENMP #include "omp.h" #endif @@ -37,8 +39,8 @@ inline void memset(T* dest, T i, size_t num) } -void L1Grid::UpdateIterGrid(unsigned int Nelements, L1StsHit* hits, vector<THitI>* indicesBuf, THitI* indices, - vector<L1StsHit>* hits2, vector<L1HitPoint>* pointsBuf, L1HitPoint* points, +void L1Grid::UpdateIterGrid(unsigned int Nelements, L1Hit* hits, vector<THitI>* indicesBuf, THitI* indices, + vector<L1Hit>* hits2, vector<L1HitPoint>* pointsBuf, L1HitPoint* points, int& NHitsOnStation, char iS, L1Algo& Algo, const L1Vector<unsigned char>* vSFlag) { @@ -52,12 +54,12 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1StsHit* hits, vector<THitI #endif for (THitI x = 0; x < Nelements; x++) { - const L1StsHit& hit = hits[x]; + const L1Hit& hit = hits[x]; if (!L1Algo::GetFUsed((*vSFlag)[hit.f] | (*vSFlag)[hit.b])) { Algo.GetHitCoor(hit, xs, ys, iS); - const THitI& bin = GetBinBounded(xs, ys, hit.t_reco); + const THitI& bin = GetBinBounded(xs, ys, hit.t); fHitsInBin[x] = fFirstHitInBin[bin + 1]; #ifdef _OPENMP @@ -95,12 +97,12 @@ void L1Grid::UpdateIterGrid(unsigned int Nelements, L1StsHit* hits, vector<THitI #endif for (THitI x = 0; x < Nelements; x++) { - const L1StsHit& hit = hits[x]; + const L1Hit& hit = hits[x]; if (!L1Algo::GetFUsed((*vSFlag)[hit.f] | (*vSFlag)[hit.b])) { Algo.GetHitCoor(hit, xs, ys, iS); - const THitI& bin = GetBinBounded(xs, ys, hit.t_reco); + const THitI& bin = GetBinBounded(xs, ys, hit.t); { @@ -165,8 +167,8 @@ void L1Grid::BuildBins(float yMin, float yMax, float zMin, float zMax, float tMi } -void L1Grid::StoreHits(THitI nhits, const L1StsHit* hits, char iS, L1Algo& Algo, THitI n, L1StsHit* hitsBuf1, - const L1StsHit* hits1, THitI* indices1) +void L1Grid::StoreHits(THitI nhits, const L1Hit* hits, char iS, L1Algo& Algo, THitI n, L1Hit* hitsBuf1, + const L1Hit* hits1, THitI* indices1) { fscal xs = 0; @@ -181,11 +183,11 @@ void L1Grid::StoreHits(THitI nhits, const L1StsHit* hits, char iS, L1Algo& Algo, Algo.GetHitCoor((hits)[x], xs, ys, iS); - fHitsInBin[x] = fFirstHitInBin[GetBinBounded(xs, ys, (hits)[x].t_reco) + 1]; + fHitsInBin[x] = fFirstHitInBin[GetBinBounded(xs, ys, (hits)[x].t) + 1]; #ifdef _OPENMP #pragma omp atomic #endif - fFirstHitInBin[GetBinBounded(xs, ys, (hits)[x].t_reco) + 1]++; + fFirstHitInBin[GetBinBounded(xs, ys, (hits)[x].t) + 1]++; } @@ -219,7 +221,7 @@ void L1Grid::StoreHits(THitI nhits, const L1StsHit* hits, char iS, L1Algo& Algo, Algo.GetHitCoor((hits1)[x], xs, ys, iS); - const THitI& bin = GetBinBounded(xs, ys, (hits1)[x].t_reco); + const THitI& bin = GetBinBounded(xs, ys, (hits1)[x].t); { diff --git a/reco/L1/L1Algo/L1Grid.h b/reco/L1/L1Algo/L1Grid.h index e5b249e58c..f4df6800a1 100644 --- a/reco/L1/L1Algo/L1Grid.h +++ b/reco/L1/L1Algo/L1Grid.h @@ -20,8 +20,8 @@ #ifdef _OPENMP #include "omp.h" #endif +#include "L1Hit.h" #include "L1HitPoint.h" -#include "L1StsHit.h" #include "L1Vector.h" using namespace std; @@ -85,13 +85,13 @@ public: // } // } - void StoreHits(THitI nhits, const L1StsHit* hits, char iS, L1Algo& Algo, THitI n, L1StsHit* hitsBuf1, - const L1StsHit* hits1, THitI* indices1); + void StoreHits(THitI nhits, const L1Hit* hits, char iS, L1Algo& Algo, THitI n, L1Hit* hitsBuf1, const L1Hit* hits1, + THitI* indices1); void CreatePar0(float yMin, float yMax, float zMin, float zMax, float sy, float sz); void BuildBins(float yMin, float yMax, float zMin, float zMax, float tMin, float tMax, float sy, float sz, float st); - void HitsSort(L1HitPoint* pointsBuf, L1StsHit* hitsBuf, const L1StsHit* hits, THitI* indices, THitI* indicesBuf, + void HitsSort(L1HitPoint* pointsBuf, L1Hit* hitsBuf, const L1Hit* hits, THitI* indices, THitI* indicesBuf, L1HitPoint* points, THitI n, THitI nhits, char iS, L1Algo& Algo); void Initial1(int NThreads); @@ -142,8 +142,8 @@ public: // }; - void UpdateIterGrid(unsigned int Nelements, L1StsHit* hits, vector<THitI>* indicesBuf, THitI* indices, - vector<L1StsHit>* hits2, vector<L1HitPoint>* pointsBuf, L1HitPoint* points, int& NHitsOnStation, + void UpdateIterGrid(unsigned int Nelements, L1Hit* hits, vector<THitI>* indicesBuf, THitI* indices, + vector<L1Hit>* hits2, vector<L1HitPoint>* pointsBuf, L1HitPoint* points, int& NHitsOnStation, char iS, L1Algo& Algo, const L1Vector<unsigned char>* vSFlag); diff --git a/reco/L1/L1Algo/L1Hit.h b/reco/L1/L1Algo/L1Hit.h new file mode 100644 index 0000000000..472ce18177 --- /dev/null +++ b/reco/L1/L1Algo/L1Hit.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2007-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Valentina Akishina, Igor Kulakov, Sergey Gorbunov [committer], Maksym Zyzak */ + +/// @file L1Hit.h +/// @author Sergey Gorbunov +/// @author Igor Kulakov +/// @author Valentina Akishina +/// @author Maksym Zyzak +/// @date 2007-2021 + +#ifndef L1Hit_h +#define L1Hit_h + +typedef unsigned /*short*/ int THitI; // hit index type +typedef unsigned short int TZPosI; // strip z-coor index type +typedef unsigned /*short*/ int TStripI; // strip index type + +/// +/// L1Hit class describes a generic hit for CA tracker +/// +struct L1Hit { + TStripI f = 0; // front strip index + TStripI b = 0; // back strip index + float u = 0.f; // measured U coordinate + float v = 0.f; // measured V coordinate + float du = 0.f; // mean squared error of u + float dv = 0.f; // mean squared error of v + float t = 0.f; // measured time + float dt = 0.f; // mean squared error of t + int ID = 0; // TODO: check if this ID is redundant + TZPosI iz = 0; // index of z coordinate in L1Algo::vStsZPos +}; + +#endif diff --git a/reco/L1/L1Algo/L1HitsSortHelper.cxx b/reco/L1/L1Algo/L1HitsSortHelper.cxx index 7339f68ef6..a0af17682b 100644 --- a/reco/L1/L1Algo/L1HitsSortHelper.cxx +++ b/reco/L1/L1Algo/L1HitsSortHelper.cxx @@ -8,12 +8,12 @@ #include <vector> #include "L1Grid.h" +#include "L1Hit.h" #include "L1HitPoint.h" -#include "L1StsHit.h" using std::vector; -L1HitsSortHelper::L1HitsSortHelper(vector<L1StsHit>& hits, vector<L1HitPoint>& points, vector<THitI>& indices, +L1HitsSortHelper::L1HitsSortHelper(vector<L1Hit>& hits, vector<L1HitPoint>& points, vector<THitI>& indices, const L1Grid* grid, THitI* iStart, THitI* iStop, int nStations, int nDontUsedHits) : fD() , fHits(hits) @@ -46,7 +46,7 @@ void L1HitsSortHelper::Sort() L1HitsSortHelperData::compare); } - vector<L1StsHit> hits = fHits; + vector<L1Hit> hits = fHits; vector<L1HitPoint> points = fPoints; const int NHits = fD.size(); for (int i = 0; i < NHits; i++) { diff --git a/reco/L1/L1Algo/L1HitsSortHelper.h b/reco/L1/L1Algo/L1HitsSortHelper.h index 2dd50fe725..554a324cf0 100644 --- a/reco/L1/L1Algo/L1HitsSortHelper.h +++ b/reco/L1/L1Algo/L1HitsSortHelper.h @@ -9,13 +9,13 @@ #include <vector> #include "L1Grid.h" +#include "L1Hit.h" #include "L1HitPoint.h" -#include "L1StsHit.h" using std::vector; struct L1HitsSortHelperData { - L1StsHit* h; + L1Hit* h; L1HitPoint* p; unsigned int bin; THitI i; @@ -28,14 +28,14 @@ struct L1HitsSortHelperData { class L1HitsSortHelper { public: - L1HitsSortHelper(vector<L1StsHit>& hits, vector<L1HitPoint>& points, vector<THitI>& indices, const L1Grid* grid, + L1HitsSortHelper(vector<L1Hit>& hits, vector<L1HitPoint>& points, vector<THitI>& indices, const L1Grid* grid, THitI* iStart, THitI* iStop, int nStations, int nDontUsedHits); void Sort(); private: vector<L1HitsSortHelperData> fD; - vector<L1StsHit>& fHits; + vector<L1Hit>& fHits; vector<L1HitPoint>& fPoints; vector<THitI>& fIndices; const L1Grid* fGrid; diff --git a/reco/L1/L1Algo/L1StsHit.h b/reco/L1/L1Algo/L1StsHit.h deleted file mode 100644 index bbe8eae5ef..0000000000 --- a/reco/L1/L1Algo/L1StsHit.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2007-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Valentina Akishina, Igor Kulakov, Sergey Gorbunov [committer], Maksym Zyzak */ - -#ifndef L1StsHit_h -#define L1StsHit_h - -//struct L1Branch; -typedef unsigned /*short*/ int THitI; // strip index type -typedef unsigned short int TZPosI; // strip z-coor index type -typedef unsigned /*short*/ int TStripI; // strip index type - -class L1StsHit { -public: - // float dx, dy, dxy; - TStripI f, b; // front and back strip indices - float du, dv; - float t_reco; - float t_er; - int ID; - // int ista; - //int track, n; - float u = 0, v = 0; - - TZPosI iz; // index of z coor. in L1Algo::vStsZPos - - L1StsHit() : f(0), b(0), du(0.), dv(0.), t_reco(0.f), t_er(0.), ID(0.), iz(0) {} -}; - -#endif diff --git a/reco/L1/L1Algo/L1TrackExtender.cxx b/reco/L1/L1Algo/L1TrackExtender.cxx index 2fc66613a1..317a7839b4 100644 --- a/reco/L1/L1Algo/L1TrackExtender.cxx +++ b/reco/L1/L1Algo/L1TrackExtender.cxx @@ -41,9 +41,9 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, const int iFirstHit = (dir) ? nHits - 1 : 0; const int iLastHit = (dir) ? 0 : nHits - 1; - const L1StsHit& hit0 = (*vStsHits)[hits[iFirstHit]]; - const L1StsHit& hit1 = (*vStsHits)[hits[iFirstHit + step]]; - const L1StsHit& hit2 = (*vStsHits)[hits[iFirstHit + 2 * step]]; + const L1Hit& hit0 = (*vStsHits)[hits[iFirstHit]]; + const L1Hit& hit1 = (*vStsHits)[hits[iFirstHit + step]]; + const L1Hit& hit2 = (*vStsHits)[hits[iFirstHit + 2 * step]]; int ista0 = GetFStation((*fStripFlag)[hit0.f]); int ista1 = GetFStation((*fStripFlag)[hit1.f]); @@ -83,9 +83,9 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, } T.z = z0; - T.t = hit0.t_reco; + T.t = hit0.t; - // T.t[0]=(hit0.t_reco+hit1.t_reco+hit2.t_reco)/3; + // T.t[0]=(hit0.t+hit1.t+hit2.t)/3; T.chi2 = 0.; T.NDF = 2.; T.C00 = sta0.XYInfo.C00; @@ -104,7 +104,7 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, T.C50 = T.C51 = T.C52 = T.C53 = T.C54 = 0; T.C22 = T.C33 = vINF; T.C44 = 1.; - T.C55 = hit0.t_er * hit0.t_er; + T.C55 = hit0.dt * hit0.dt; L1FieldValue fB0, fB1, fB2 _fvecalignment; L1FieldRegion fld _fvecalignment; @@ -123,7 +123,7 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, int ista = ista2; for (int i = iFirstHit + step; step * i <= step * iLastHit; i += step) { - const L1StsHit& hit = (*vStsHits)[hits[i]]; + const L1Hit& hit = (*vStsHits)[hits[i]]; ista_prev = ista; ista = GetFStation((*fStripFlag)[hit.f]); @@ -162,7 +162,7 @@ void L1Algo::BranchFitterFast(const L1Branch& t, L1TrackPar& T, const bool dir, #endif L1Filter(T, info, v); - FilterTime(T, hit.t_reco, hit.t_er); + FilterTime(T, hit.t, hit.dt); fB0 = fB1; fB1 = fB2; @@ -207,9 +207,9 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, const int iFirstHit = (dir) ? 2 : t.NHits - 3; // int ista = GetFStation((*fStripFlag)[(*vStsHits)[t.StsHits[iFirstHit]].f]) + 2*step; // current station. set to the end of track - const L1StsHit& hit0 = (*vStsHits)[t.fStsHits[iFirstHit]]; // optimize - const L1StsHit& hit1 = (*vStsHits)[t.fStsHits[iFirstHit + step]]; - const L1StsHit& hit2 = (*vStsHits)[t.fStsHits[iFirstHit + 2 * step]]; + const L1Hit& hit0 = (*vStsHits)[t.fStsHits[iFirstHit]]; // optimize + const L1Hit& hit1 = (*vStsHits)[t.fStsHits[iFirstHit + step]]; + const L1Hit& hit2 = (*vStsHits)[t.fStsHits[iFirstHit + 2 * step]]; const int ista0 = GetFStation((*fStripFlag)[hit0.f]); const int ista1 = GetFStation((*fStripFlag)[hit1.f]); @@ -281,8 +281,9 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, while (area.GetNext(ih)) { ih += StsHitsUnusedStartIndex[ista]; - const L1StsHit& hit = (*vStsHitsUnused)[ih]; - if (fabs(hit.t_reco - T.t[0]) > sqrt(T.C55[0] + hit.t_er) * 5) continue; + const L1Hit& hit = (*vStsHitsUnused)[ih]; + //TODO: bug, it should be hit.dt*hit.dt + if (fabs(hit.t - T.t[0]) > sqrt(T.C55[0] + hit.dt) * 5) continue; if (GetFUsed((*fStripFlag)[hit.f] | (*fStripFlag)[hit.b])) continue; // if used @@ -314,7 +315,7 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, newHits.push_back((*RealIHitP)[iHit_best]); - const L1StsHit& hit = (*vStsHitsUnused)[iHit_best]; + const L1Hit& hit = (*vStsHitsUnused)[iHit_best]; fvec u = hit.u; fvec v = hit.v; fvec x, y, z; @@ -342,7 +343,7 @@ void L1Algo::FindMoreHits(L1Branch& t, L1TrackPar& T, const bool dir, #endif L1Filter(T, info, v); - FilterTime(T, hit.t_reco, hit.t_er); + FilterTime(T, hit.t, hit.dt); fB0 = fB1; fB1 = fB2; diff --git a/reco/L1/L1Algo/L1TrackFitter.cxx b/reco/L1/L1Algo/L1TrackFitter.cxx index 385b84c825..e2fe29694d 100644 --- a/reco/L1/L1Algo/L1TrackFitter.cxx +++ b/reco/L1/L1Algo/L1TrackFitter.cxx @@ -52,9 +52,9 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. for (int iter = 0; iter < 3; iter++) { //cout<<" Back 1"<<endl; { // fit backward - const L1StsHit& hit0 = (*vStsHits)[hits[nHits - 1]]; - const L1StsHit& hit1 = (*vStsHits)[hits[nHits - 2]]; - const L1StsHit& hit2 = (*vStsHits)[hits[nHits - 3]]; + const L1Hit& hit0 = (*vStsHits)[hits[nHits - 1]]; + const L1Hit& hit1 = (*vStsHits)[hits[nHits - 2]]; + const L1Hit& hit2 = (*vStsHits)[hits[nHits - 3]]; int ista0 = (*fStripFlag)[hit0.f] / 4; int ista1 = (*fStripFlag)[hit1.f] / 4; @@ -126,7 +126,7 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. //cout<<"\nfit, iter=:"<<iter<<endl; for (int i = nHits - 2; i >= 0; i--) { // if( fabs(T.qp[0])>2. ) break; // iklm. Don't know it need for - const L1StsHit& hit = (*vStsHits)[hits[i]]; + const L1Hit& hit = (*vStsHits)[hits[i]]; ista = (*fStripFlag)[hit.f] / 4; L1Station& sta = vStations[ista]; @@ -193,9 +193,9 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. { //T.qp = first_trip->GetQpOrig(MaxInvMom); - const L1StsHit& hit0 = (*vStsHits)[hits[0]]; - const L1StsHit& hit1 = (*vStsHits)[hits[1]]; - const L1StsHit& hit2 = (*vStsHits)[hits[2]]; + const L1Hit& hit0 = (*vStsHits)[hits[0]]; + const L1Hit& hit1 = (*vStsHits)[hits[1]]; + const L1Hit& hit2 = (*vStsHits)[hits[2]]; int ista0 = GetFStation((*fStripFlag)[hit0.f]); int ista1 = GetFStation((*fStripFlag)[hit1.f]); @@ -262,7 +262,7 @@ void L1Algo::KFTrackFitter_simple() // TODO: Add pipe. int ista = ista2; for (int i = 1; i < nHits; i++) { - const L1StsHit& hit = (*vStsHits)[hits[i]]; + const L1Hit& hit = (*vStsHits)[hits[i]]; ista = (*fStripFlag)[hit.f] / 4; L1Station& sta = vStations[ista]; fvec u = hit.u; @@ -387,7 +387,7 @@ void L1Algo::L1KFTrackFitter() int nHitsTrack = t[iVec]->NHits; int iSta[MaxNStations]; for (i = 0; i < nHitsTrack; i++) { - const L1StsHit& hit = (*vStsHits)[fRecoHits[start_hit++]]; + const L1Hit& hit = (*vStsHits)[fRecoHits[start_hit++]]; const int ista = (*fStripFlag)[hit.f] / 4; iSta[i] = ista; w[ista][iVec] = 1.; @@ -400,8 +400,8 @@ void L1Algo::L1KFTrackFitter() StripsToCoor(u[ista], v[ista], x_temp, y_temp, sta[ista]); x[ista][iVec] = x_temp[iVec]; y[ista][iVec] = y_temp[iVec]; - time[ista][iVec] = hit.t_reco; - timeEr[ista][iVec] = hit.t_er; + time[ista][iVec] = hit.t; + timeEr[ista][iVec] = hit.dt; z[ista][iVec] = (*vStsZPos)[hit.iz]; sta[ista].fieldSlice.GetFieldValue(x[ista], y[ista], fB_temp); dUdV_to_dX(d_u[ista], d_v[ista], d_x[ista], sta[ista]); @@ -816,7 +816,7 @@ void L1Algo::L1KFTrackFitterMuch() int nHitsTrack = t[iVec]->NHits; int nHitsTrackSts = 0; for (i = 0; i < nHitsTrack; i++) { - const L1StsHit& hit = (*vStsHits)[fRecoHits[start_hit++]]; + const L1Hit& hit = (*vStsHits)[fRecoHits[start_hit++]]; const int ista = (*fStripFlag)[hit.f] / 4; if (ista < 8) nHitsTrackSts++; iSta[i] = ista; @@ -830,8 +830,8 @@ void L1Algo::L1KFTrackFitterMuch() StripsToCoor(u[ista], v[ista], x_temp, y_temp, sta[ista]); x[ista][iVec] = x_temp[iVec]; y[ista][iVec] = y_temp[iVec]; - time[ista][iVec] = hit.t_reco; - timeEr[ista][iVec] = hit.t_er; + time[ista][iVec] = hit.t; + timeEr[ista][iVec] = hit.dt; d_u[ista][iVec] = hit.du; d_v[ista][iVec] = hit.dv; dUdV_to_dX(d_u[ista], d_v[ista], d_x[ista], sta[ista]); @@ -1548,7 +1548,7 @@ void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& t, L1Stat track.NDF = -3.0; track.chi2 = ZERO; } -void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& t, fvec& t_er, L1Station& st, fvec& /*d_x*/, +void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& t, fvec& dt, L1Station& st, fvec& /*d_x*/, fvec& /*d_y*/, fvec& /*d_xy*/) { // initialize covariance matrix @@ -1576,7 +1576,7 @@ void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& t, fvec& track.C52 = ZERO; track.C53 = ZERO; track.C54 = ZERO; - track.C55 = t_er * t_er; + track.C55 = dt * dt; track.fx = x; track.fy = y; @@ -1585,7 +1585,7 @@ void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& t, fvec& track.chi2 = ZERO; } -void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fvec& t_er, L1Station& st) +void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fvec& dt, L1Station& st) { // initialize covariance matrix // track.C00= d_x*d_x; @@ -1611,7 +1611,7 @@ void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fv track.C52 = ZERO; track.C53 = ZERO; track.C54 = ZERO; - track.C55 = t_er * t_er; + track.C55 = dt * dt; track.fx = x; track.fy = y; @@ -1620,7 +1620,7 @@ void L1Algo::FilterFirst(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fv } -void L1Algo::FilterFirstL(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fvec& t_er, L1Station& /*st*/, fvec& d_x, +void L1Algo::FilterFirstL(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, fvec& dt, L1Station& /*st*/, fvec& d_x, fvec& d_y, fvec& d_xy) { // initialize covariance matrix @@ -1646,7 +1646,7 @@ void L1Algo::FilterFirstL(L1TrackParFit& track, fvec& x, fvec& y, fvec& /*t*/, f track.C52 = ZERO; track.C53 = ZERO; track.C54 = ZERO; - track.C55 = t_er * t_er; + track.C55 = dt * dt; track.fx = x; track.fy = y; diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.cxx b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx new file mode 100644 index 0000000000..d01901bcef --- /dev/null +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.cxx @@ -0,0 +1,831 @@ +/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt + SPDX-License-Identifier: GPL-3.0-only + Authors: Sergey Gorbunov [committer] */ + +#include "L1AlgoDraw.h" + +#include "CbmKF.h" +#include "CbmL1.h" + +#include "TApplication.h" +#include "TCanvas.h" +#include "TEllipse.h" +#include "TFrame.h" +#include "TLatex.h" +#include "TMarker.h" +#include "TPad.h" +#include "TPaveText.h" +#include "TPolyLine.h" +#include "TPolyLine3D.h" +#include "TPolyMarker.h" +#include "TStyle.h" +#include "TText.h" +#include "TView3D.h" + +#include "L1Algo.h" + +L1AlgoDraw::L1AlgoDraw() +{ + + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasBorderSize(1); + gStyle->SetCanvasColor(0); + + YZ = new TCanvas("YZ", "YZ Side View", -1, 0, 500, 500); + YZ->Range(-5.0, -50.0, 105.0, 50.0); + YZ->Draw(); + YZ->Update(); + + XZ = new TCanvas("XZ", "XZ Top View", -1, 500, 500, 500); + XZ->Range(-5.0, -50.0, 105.0, 50.0); + XZ->Draw(); + XZ->Update(); + + YX = new TCanvas("YX", "YX Front View", -506, 0, 500, 500); + YX->Range(-50.0, -50.0, 50.0, 50.0); + YX->Draw(); + YX->Update(); + + // XYZ = new TCanvas ("XYZ", "XYZ 3D View", -0, 0, 1000, 1000); + XYZ = new TCanvas("XYZ", "XYZ 3D View", -500, 500, 500, 500); + XYZ->Range(-5.0, -50.0, 115.0, 60.0); + // TView3D *view = (TView3D*) XYZ->GetView3D(); + // view = (TView3D*) TView::CreateView(1); + // TView3D *view = new TView3D(); + // view->SetRange(-50.0, -50.0, -0.0, 50.0, 50.0, 110.0); + // view->SetRange(0,0,0,4,4,4); + // view->Draw(); + // XYZ->ResetView3D(view); + XYZ->Draw(); + XYZ->Update(); + + fVerbose = CbmL1::Instance()->fVerbose; + ask = true; +} + +void L1AlgoDraw::InitL1Draw(L1Algo* algo_) +{ + // algo = CbmL1::Instance()->algo; + algo = algo_; + + vStsHits.reserve(algo->vStsHits->size()); + for (int i = 0; i < algo->vStsHits->size(); i++) { + vStsHits.push_back((*algo->vStsHits)[i]); + } + NStations = algo->NStations; + for (int i = 0; i < NStations; i++) { + StsHitsStartIndex[i] = algo->StsHitsStartIndex[i]; + StsHitsStopIndex[i] = algo->StsHitsStopIndex[i]; + vStations[i] = algo->vStations[i]; + } +} + +void L1AlgoDraw::DrawMCTracks() +{ + int NRegMCTracks = 0; + CbmL1& L1 = *CbmL1::Instance(); + TPolyLine pline; + if (fVerbose >= 10) { + cout << "Only reconstructable tracks are shown." << endl; + cout << "Red - primary p > 0.5 - (first iteration)" << endl; + cout << "Blue - primary p < 0.5 - (second iteration)" << endl; + cout << "Green - secondary p > 0.5 - (third\\first iteration)" << endl; + cout << "Gray - secondary p < 0.5 - (third\\second iteration)" << endl; + }; + + for (vector<CbmL1MCTrack>::iterator it = L1.vMCTracks.begin(); it != L1.vMCTracks.end(); ++it) { + CbmL1MCTrack& T = *it; + //draw reconstructable tracks only + if (!T.IsReconstructable()) continue; + //if (( T.mother_ID< 0 )&&( T.nContStations<3 )) continue; + //if (( T.mother_ID>=0 )&&( T.nContStations<4 )) continue; + //if( T.p<.2 ) continue; + if (T.p < 0.1) continue; + pline.SetLineColor(kRed); + if (T.p < 0.5) pline.SetLineColor(kBlue); + if (T.mother_ID != -1) pline.SetLineColor(8); + if ((T.mother_ID != -1) && (T.p < 0.5)) pline.SetLineColor(12); + if (fVerbose >= 1) + cout << "MC Track: p = " << T.p << " mother_ID = " << T.mother_ID << " PDG = " << T.pdg << " x,y,z = (" << T.x + << ", " << T.y << ", " << T.z << ")" << endl; + double par[6]; + par[0] = T.x; + par[1] = T.y; + //if( fabs(T.pz)<0.1 ) continue; + par[2] = T.px / T.pz; + par[3] = T.py / T.pz; + par[4] = T.q / T.p; + par[5] = T.z; + + int npoints = T.Points.size(); + if (fVerbose >= 10) cout << " NMCPoints = " << npoints << endl; + if (npoints < 1) continue; + + vector<double> lx, ly, lz; + lx.push_back(par[0]); + ly.push_back(par[1]); + lz.push_back(par[5]); + + bool ok = true; + + if (fVerbose >= 4) { + cout << "hits = "; + for (int ih = 0; ih < T.StsHits.size(); ih++) + cout << T.StsHits[ih] << " "; + cout << endl; + } + for (int ip = 0; ip < npoints; ip++) { + CbmL1MCPoint& p = L1.vMCPoints[T.Points[ip]]; + double par1[6]; + //if( fabs(p.pz)<0.05 ) continue; + par1[0] = p.x; + par1[1] = p.y; + par1[2] = p.px / p.pz; + par1[3] = p.py / p.pz; + par1[4] = p.q / p.p; + par1[5] = p.z; + if (fVerbose >= 5) { + static float pz = -1; + if (fabs(pz - p.z) > 1.0) cout << "-- "; + cout << "point.z = " << p.z << endl; + pz = p.z; + } + + double Zfrst = par[5]; + double Zlast = par1[5]; + double step = .5; + if (step > fabs(Zfrst - Zlast) / 5) step = fabs(Zfrst - Zlast) / 5; + if (Zlast < par[5]) step = -step; + while (fabs(par[5] - Zlast) > fabs(step)) { + double znxt = par[5] + step; + CbmKF::Instance()->Propagate(par1, 0, znxt, par1[4]); + CbmKF::Instance()->Propagate(par, 0, znxt, par[4]); + double w = fabs(znxt - Zfrst); + double w1 = fabs(znxt - Zlast); + if (w + w1 < 1.e-3) { + w = 1; + w1 = 0; + } + float xl = (w1 * par[0] + w * par1[0]) / (w + w1); + float yl = (w1 * par[1] + w * par1[1]) / (w + w1); + float zl = (w1 * par[5] + w * par1[5]) / (w + w1); + if ((fabs(xl) > 50.0) || (fabs(yl) > 50.0)) { + //cout << "*** track " << NRegMCTracks+1 << " xl = " << xl << ", zl = " << zl << endl; + //cout << "*** track " << NRegMCTracks+1 << " yl = " << yl << ", zl = " << zl << endl; + ok = false; + continue; + } + lx.push_back(xl); + ly.push_back(yl); + lz.push_back(zl); + } + + par[0] = p.x; + par[1] = p.y; + par[2] = p.px / p.pz; + par[3] = p.py / p.pz; + par[4] = p.q / p.p; + par[5] = p.z; + lx.push_back(par[0]); + ly.push_back(par[1]); + lz.push_back(par[5]); + } + + if (ok) { + + NRegMCTracks++; + + YZ->cd(); + pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); + XZ->cd(); + pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); + YX->cd(); + pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); + + // YZ->cd(); YZ->Update(); + // XZ->cd(); XZ->Update(); + // YX->cd(); YX->Update(); + // DrawAsk(); + } + } + + cout << "L1CADraw: number of registered MC tracks: " << NRegMCTracks << endl; + + YZ->cd(); + YZ->Update(); + XZ->cd(); + XZ->Update(); + YX->cd(); + YX->Update(); +} + +void L1AlgoDraw::DrawRecoTracks() +{ + // XYZ->cd(); + // TView *view = TView::CreateView(1); + // view->SetRange(-100,-100,-100, 100, 100, 100); + + int NRecTracks = 0; + // CbmL1 &L1 = *CbmL1::Instance(); + + int curRecoHit = 0; + L1Vector<THitI>& recoHits = algo->fRecoHits; + for (vector<L1Track>::iterator it = algo->fTracks.begin(); it != algo->fTracks.end(); ++it) { + L1Track& T = *it; + int nHits = T.NHits; + // if (nHits > 5) continue; // draw clones + // YZ->cd(); YZ->Update(); + // XZ->cd(); XZ->Update(); + // YX->cd(); YX->Update(); + // DrawAsk(); + vector<double> lx, ly, lz; + vector<double> lx_turned, ly_turned, lz_turned; + + TPolyLine pline; + pline.SetLineColor(kBlue); + // TPolyLine3D pline3D(nHits); + // pline3D.SetLineColor(kBlue); + if (fVerbose >= 4) { cout << "hits = "; } + for (int iHit = 0; iHit < nHits; iHit++) { + unsigned int ih = recoHits[curRecoHit++]; + if (fVerbose >= 4) { cout << ih << " "; } + + Point p = GetHitCoor(ih); + lx.push_back(p.x); + ly.push_back(p.y); + lz.push_back(p.z); + + TVector3 v3(p.x, p.y, p.z); + v3.RotateX(TMath::Pi() / 5); + v3.RotateY(TMath::Pi() / 20); + v3.RotateZ(TMath::Pi() / 100); + lx_turned.push_back(v3.x()); + ly_turned.push_back(v3.y()); + lz_turned.push_back(v3.z()); + // pline3D.SetPoint(iHit, p.x, p.y, p.z); + } + if (fVerbose >= 4) { cout << endl; } + if (1) { + + NRecTracks++; + + YZ->cd(); + pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); + XZ->cd(); + pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); + YX->cd(); + pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); + XYZ->cd(); + pline.DrawPolyLine(lx_turned.size(), &(lz_turned[0]), &(lx_turned[0])); + // pline3D.Draw(); + } + } + + cout << "L1CADraw: number of reconstructed tracks: " << NRecTracks << endl; + + YZ->cd(); + YZ->Update(); + XZ->cd(); + XZ->Update(); + YX->cd(); + YX->Update(); + + XYZ->cd(); + XYZ->Update(); +} + +void L1AlgoDraw::DrawTriplets(vector<L1Triplet>& triplets, const THitI* realIHit) +{ + // vector <L1Triplet> triplets = algo->vTriplets; + for (int iTrip = 0; iTrip < triplets.size(); iTrip++) { + L1Triplet& trip = triplets[iTrip]; + + unsigned int iLHit = trip.GetLHit(); + iLHit = realIHit[iLHit]; + unsigned int iMHit = trip.GetMHit(); + iMHit = realIHit[iMHit]; + unsigned int iRHit = trip.GetRHit(); + iRHit = realIHit[iRHit]; + + DrawTriplet(iLHit, iMHit, iRHit); + } + + YZ->cd(); + YZ->Update(); + XZ->cd(); + XZ->Update(); + YX->cd(); + YX->Update(); +}; + +void L1AlgoDraw::DrawTriplet(int il, int im, int ir) +{ + TPolyLine pline; + pline.SetLineColor(kBlack); + TMarker marker; + marker.SetMarkerColor(kBlack); + marker.SetMarkerStyle(26); + marker.SetMarkerSize(HitSize * 2); + + vector<double> lx, ly, lz; + + Point coor; + + coor = GetHitCoor(il); + lx.push_back(coor.x); + ly.push_back(coor.y); + lz.push_back(coor.z); + + coor = GetHitCoor(im); + lx.push_back(coor.x); + ly.push_back(coor.y); + lz.push_back(coor.z); + + coor = GetHitCoor(ir); + lx.push_back(coor.x); + ly.push_back(coor.y); + lz.push_back(coor.z); + + const int nHits = 3; + YZ->cd(); + pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); + marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); + XZ->cd(); + pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); + marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); + YX->cd(); + pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); + marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); +} + +void L1AlgoDraw::DrawDoublets(vector<THitI>* Duplets_hits, map<THitI, THitI>* Duplets_start, const int MaxArrSize, + THitI* StsRestHitsStartIndex, unsigned int* realIHit) +{ + for (int iSta = 0; iSta < NStations - 1; iSta++) { + const int firstHitOnSta = StsRestHitsStartIndex[iSta]; + const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; + THitI* staDupletsHits = &(Duplets_hits[iSta][0]); + map<THitI, THitI>& staDupletsStart = Duplets_start[iSta]; + + for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { + const int ilh = iRestLHit - firstHitOnSta; + const int iirhFirst = staDupletsStart[ilh]; + const int iirhLast = staDupletsStart[ilh + 1] - 1; + + for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { + const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta; + + const int iLHit = realIHit[iRestLHit]; + const int iRHit = realIHit[iRestRHit]; + + DrawDoublet(iLHit, iRHit); + } + } + } + + YZ->cd(); + YZ->Update(); + XZ->cd(); + XZ->Update(); + YX->cd(); + YX->Update(); +}; + +void L1AlgoDraw::DrawDoubletsOnSta(int iSta, THitI* Duplets_hits, THitI* Duplets_start, const int MaxArrSize, + THitI* StsRestHitsStartIndex, unsigned int* realIHit) +{ + const int firstHitOnSta = StsRestHitsStartIndex[iSta]; + const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; + THitI* staDupletsHits = Duplets_hits + MaxArrSize * iSta; + THitI* staDupletsStart = Duplets_start + MaxArrSize * iSta; + + for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { + const int ilh = iRestLHit - firstHitOnSta; + const int iirhFirst = staDupletsStart[ilh]; + const int iirhLast = staDupletsStart[ilh + 1] - 1; + + for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { + const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta; + + const int iLHit = realIHit[iRestLHit]; + const int iRHit = realIHit[iRestRHit]; + + DrawDoublet(iLHit, iRHit); + } + } + + YZ->cd(); + YZ->Update(); + XZ->cd(); + XZ->Update(); + YX->cd(); + YX->Update(); +}; + +void L1AlgoDraw::DrawDoublet(int il, int ir) +{ + TPolyLine pline; + pline.SetLineColor(kBlue); + TMarker marker; + marker.SetMarkerColor(kBlue); + marker.SetMarkerStyle(27); + marker.SetMarkerSize(HitSize * 2); + + vector<double> lx, ly, lz; + + Point coor; + + coor = GetHitCoor(il); + lx.push_back(coor.x); + ly.push_back(coor.y); + lz.push_back(coor.z); + + coor = GetHitCoor(ir); + lx.push_back(coor.x); + ly.push_back(coor.y); + lz.push_back(coor.z); + + const int nHits = 2; + YZ->cd(); + pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); + marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); + XZ->cd(); + pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); + marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); + YX->cd(); + pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); + marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); +} + + +void L1AlgoDraw::DrawInfo() +{ + cout << " vStsHits.size = " << algo->vStsHits->size() << endl; + cout << " vRecoHits.size = " << algo->fRecoHits.size() << endl; + cout << " vTracks.size = " << algo->fTracks.size() << endl; +} + +void L1AlgoDraw::DrawTarget() +{ + + float x = 0, y = 0, z = 0; + float x_t, z_t; + + TVector3 v3(x, y, z); + v3.RotateX(TMath::Pi() / 5); + v3.RotateY(TMath::Pi() / 20); + v3.RotateZ(TMath::Pi() / 100); + x_t = v3.x(); + z_t = v3.z(); + + { + YZ->cd(); + + TMarker* marker = new TMarker(z, y, targetMStyle); + marker->SetMarkerColor(kRed); + marker->SetMarkerStyle(targetMStyle); + marker->SetMarkerSize(HitSize); + marker->Draw(); + } + + { + XZ->cd(); + + TMarker* marker = new TMarker(z, x, targetMStyle); + marker->SetMarkerColor(kRed); + marker->SetMarkerStyle(targetMStyle); + marker->SetMarkerSize(HitSize); + marker->Draw(); + } + + { + YX->cd(); + + TMarker* marker = new TMarker(x, y, targetMStyle); + marker->SetMarkerColor(kRed); + marker->SetMarkerStyle(targetMStyle); + marker->SetMarkerSize(HitSize); + marker->Draw(); + } + + { + XYZ->cd(); + + TMarker* marker = new TMarker(z_t, x_t, targetMStyle); + marker->SetMarkerColor(kRed); + marker->SetMarkerStyle(targetMStyle); + marker->SetMarkerSize(HitSize); + marker->Draw(); + } +} + +void L1AlgoDraw::DrawInputHits() +{ + + TLatex latex; + latex.SetTextFont(132); + latex.SetTextAlign(12); + latex.SetTextSize(0.035); + + YZ->cd(); + latex.DrawLatex(0.0, 45.0, "YZ Side View"); + YZ->Draw(); + XZ->cd(); + latex.DrawLatex(0.0, 45.0, "XZ Top View"); + XZ->Draw(); + YX->cd(); + latex.DrawLatex(-45.0, 45.0, "YX Front View"); + YX->Draw(); + + + int nhits = vStsHits.size(); + Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; + Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; + Double_t x_poly_turned[nhits], z_poly_turned[nhits]; + Double_t x_poly_fake_turned[nhits], z_poly_fake_turned[nhits]; + + + for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers + L1Station& st = vStations[ista]; + Int_t n_poly = 0; + Int_t n_poly_fake = 0; + for (int ih = StsHitsStartIndex[ista]; ih < StsHitsStopIndex[ista]; ih++) { + L1Hit& h = vStsHits[ih]; + int iMC = CbmL1::Instance()->vHitMCRef[ih]; + //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used + + float x, y, z; + float x_t, z_t; + algo->GetHitCoor(h, x, y, z, st); + + TVector3 v3(x, y, z); + v3.RotateX(TMath::Pi() / 5); + v3.RotateY(TMath::Pi() / 20); + v3.RotateZ(TMath::Pi() / 100); + x_t = v3.x(); + z_t = v3.z(); + + if (iMC >= 0) { + x_poly[n_poly] = x; + y_poly[n_poly] = y; + z_poly[n_poly] = z; + x_poly_turned[n_poly] = x_t; + z_poly_turned[n_poly] = z_t; + n_poly++; + } + else { + x_poly_fake[n_poly_fake] = x; + y_poly_fake[n_poly_fake] = y; + z_poly_fake[n_poly_fake] = z; + x_poly_fake_turned[n_poly_fake] = x_t; + z_poly_fake_turned[n_poly_fake] = z_t; + n_poly_fake++; + } + } + + YZ->cd(); + + TLine* line = new TLine(); + line->SetLineColor(StaColor); + line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); + + TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); + pmyz->SetMarkerColor(mcolor[ista]); + pmyz->SetMarkerStyle(hitsMStyle); + pmyz->SetMarkerSize(HitSize); + pmyz->Draw(); + + TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); + pmyz_fake->SetMarkerColor(mcolor[ista]); + pmyz_fake->SetMarkerStyle(fakesMStyle); + pmyz_fake->SetMarkerSize(HitSize); + pmyz_fake->Draw(); + + XZ->cd(); + + line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); + + TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); + pmxz->SetMarkerColor(mcolor[ista]); + pmxz->SetMarkerStyle(hitsMStyle); + pmxz->SetMarkerSize(HitSize); + pmxz->Draw(); + + TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); + pmxz_fake->SetMarkerColor(mcolor[ista]); + pmxz_fake->SetMarkerStyle(fakesMStyle); + pmxz_fake->SetMarkerSize(HitSize); + pmxz_fake->Draw(); + + YX->cd(); + + TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]); + ellipse->SetLineColor(StaColor); + ellipse->SetFillStyle(0); + ellipse->Draw(); + + TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); + pmyx->SetMarkerColor(mcolor[ista]); + pmyx->SetMarkerStyle(hitsMStyle); + pmyx->SetMarkerSize(HitSize); + pmyx->Draw(); + + TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); + pmyx_fake->SetMarkerColor(mcolor[ista]); + pmyx_fake->SetMarkerStyle(fakesMStyle); + pmyx_fake->SetMarkerSize(HitSize); + pmyx_fake->Draw(); + + XYZ->cd(); + + TPolyMarker* pmxyz = new TPolyMarker(n_poly, z_poly_turned, x_poly_turned); + pmxyz->SetMarkerColor(mcolor[ista]); + pmxyz->SetMarkerStyle(hitsMStyle); + pmxyz->SetMarkerSize(HitSize); + pmxyz->Draw(); + + TPolyMarker* pmxyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake_turned, x_poly_fake_turned); + pmxyz_fake->SetMarkerColor(mcolor[ista]); + pmxyz_fake->SetMarkerStyle(fakesMStyle); + pmxyz_fake->SetMarkerSize(HitSize); + pmxyz_fake->Draw(); + } + +} // DrawInputHits + +void L1AlgoDraw::DrawRestHits(THitI* StsRestHitsStartIndex, THitI* StsRestHitsStopIndex, unsigned int* realIHit) +{ + + TLatex latex; + latex.SetTextFont(132); + latex.SetTextAlign(12); + latex.SetTextSize(0.035); + + YZ->cd(); + latex.DrawLatex(0.0, 45.0, "YZ Side View"); + YZ->Draw(); + XZ->cd(); + latex.DrawLatex(0.0, 45.0, "XZ Top View"); + XZ->Draw(); + YX->cd(); + latex.DrawLatex(-45.0, 45.0, "YX Front View"); + YX->Draw(); + + + int nhits = vStsHits.size(); + Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; + Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; + + + for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers + L1Station& st = vStations[ista]; + Int_t n_poly = 0; + Int_t n_poly_fake = 0; + for (int iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { + int ih = realIHit[iRestHit]; + L1Hit& h = vStsHits[ih]; + int iMC = CbmL1::Instance()->vHitMCRef[ih]; + //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used + + float x, y, z; + algo->GetHitCoor(h, x, y, z, st); + if (iMC >= 0) { + x_poly[n_poly] = x; + y_poly[n_poly] = y; + z_poly[n_poly] = z; + n_poly++; + } + else { + x_poly_fake[n_poly_fake] = x; + y_poly_fake[n_poly_fake] = y; + z_poly_fake[n_poly_fake] = z; + n_poly_fake++; + } + } + + YZ->cd(); + + TLine* line = new TLine(); + line->SetLineColor(StaColor); + line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); + + TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); + pmyz->SetMarkerColor(mcolor[ista]); + pmyz->SetMarkerStyle(hitsMStyle); + pmyz->SetMarkerSize(HitSize); + pmyz->Draw(); + + TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); + pmyz_fake->SetMarkerColor(mcolor[ista]); + pmyz_fake->SetMarkerStyle(fakesMStyle); + pmyz_fake->SetMarkerSize(HitSize); + pmyz_fake->Draw(); + + XZ->cd(); + + line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); + + TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); + pmxz->SetMarkerColor(mcolor[ista]); + pmxz->SetMarkerStyle(hitsMStyle); + pmxz->SetMarkerSize(HitSize); + pmxz->Draw(); + + TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); + pmxz_fake->SetMarkerColor(mcolor[ista]); + pmxz_fake->SetMarkerStyle(fakesMStyle); + pmxz_fake->SetMarkerSize(HitSize); + pmxz_fake->Draw(); + + YX->cd(); + + TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]); + ellipse->SetLineColor(StaColor); + ellipse->SetFillStyle(0); + ellipse->Draw(); + + TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); + pmyx->SetMarkerColor(mcolor[ista]); + pmyx->SetMarkerStyle(hitsMStyle); + pmyx->SetMarkerSize(HitSize); + pmyx->Draw(); + + TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); + pmyx_fake->SetMarkerColor(mcolor[ista]); + pmyx_fake->SetMarkerStyle(fakesMStyle); + pmyx_fake->SetMarkerSize(HitSize); + pmyx_fake->Draw(); + } + +} // DrawCurHits + +void L1AlgoDraw::DrawAsk() +{ + char symbol; + if (ask) { + std::cout << "ask>"; + do { + std::cin.get(symbol); + if (symbol == 'r') ask = false; + if (symbol == 'q') exit(0); + } while (symbol != '\n'); + std::cout << endl; + } +} + +void L1AlgoDraw::ClearVeiw() +{ + YZ->Clear(); + XZ->Clear(); + YX->Clear(); + XYZ->Clear(); +} + +L1AlgoDraw::Point L1AlgoDraw::GetHitCoor(int ih) +{ + L1Hit& hit = vStsHits[ih]; + // find station + int ista = 0; + for (int i = 0; i < NStations; i++) { + if ((StsHitsStartIndex[i] <= ih) && (StsHitsStopIndex[i] > ih)) { + ista = i; + break; + } + } + L1Station& sta = vStations[ista]; + float x, y, z; + algo->GetHitCoor(hit, x, y, z, sta); + return Point(x, y, z); +}; + +void L1AlgoDraw::SaveCanvas(TString name) +{ + system("mkdir L1CADraw -p"); + chdir("L1CADraw"); + TString tmp = name; + tmp += "YXView.pdf"; + YX->cd(); + // YX->SaveAs("YXView.eps"); + YX->SaveAs(tmp); + + tmp = name; + tmp += "XZView.pdf"; + XZ->cd(); + // XZ->SaveAs("XZView.eps"); + XZ->SaveAs(tmp); + + tmp = name; + tmp += "YZView.pdf"; + YZ->cd(); + // YZ->SaveAs("YZView.eps"); + YZ->SaveAs(tmp); + + tmp = name; + tmp += "XYZView.pdf"; + XYZ->cd(); + XYZ->SaveAs(tmp); + // XYZ->SaveAs("XYZView.eps"); + // XYZ->SaveAs("XYZView.png"); + // XYZ->SaveAs("XYZView.pdf"); + chdir(".."); +} diff --git a/reco/L1/L1Algo/utils/L1AlgoDraw.h b/reco/L1/L1Algo/utils/L1AlgoDraw.h index 9584d27b7a..129c9426ed 100644 --- a/reco/L1/L1Algo/utils/L1AlgoDraw.h +++ b/reco/L1/L1Algo/utils/L1AlgoDraw.h @@ -5,41 +5,28 @@ #ifndef L1AlgoDraw_h #define L1AlgoDraw_h 1 -#define DRAW +#include "CbmL1Def.h" -#include "CbmKF.h" -#include "CbmL1.h" +#include <map> +#include <vector> -#include "TApplication.h" -#include "TCanvas.h" -#include "TEllipse.h" -#include "TFrame.h" -#include "TLatex.h" -#include "TMarker.h" -#include "TPad.h" -#include "TPaveText.h" -#include "TPolyLine.h" -#include "TPolyLine3D.h" -#include "TPolyMarker.h" -#include "TStyle.h" -#include "TText.h" -#include "TView3D.h" +#include "L1Hit.h" +#include "L1Station.h" +#include "L1Triplet.h" -#include "L1Algo/L1Algo.h" - -// #include <unistd.h> // for dir navigation - -//static TApplication *myapp; +class TCanvas; +class L1Algo; class L1AlgoDraw { struct Point { - double x, y, z; - Point() {}; + double x {0}, y {0}, z {0}; + Point() = default; Point(double _x, double _y, double _z) : x(_x), y(_y), z(_z) {}; }; public: L1AlgoDraw(); + void InitL1Draw(L1Algo* algo_); void DrawMCTracks(); @@ -62,856 +49,38 @@ public: void DrawAsk(); private: + L1AlgoDraw(const L1AlgoDraw&); + L1AlgoDraw& operator=(const L1AlgoDraw&); + Point GetHitCoor(int ih); void DrawTriplet(int il, int im, int ir); void DrawDoublet(int il, int ir); + L1Algo* algo {nullptr}; - L1Algo* algo; - - vector<fscal> vStsStrips, vStsStripsB; - vector<L1StsHit> vStsHits; - int StsHitsStartIndex[20], StsHitsStopIndex[20]; - - int NStations; - L1Station vStations[20]; - - int mcolor[10]; // color for hits on i-station - int StaColor; // color for stantions - int hitsMStyle; // style for hits - int fakesMStyle; // style for fakes - int targetMStyle; // style for target - - double HitSize; // size of hits - - int fVerbose; - /*static*/ TCanvas *YZ, *YX, *XZ, *XYZ; - bool ask; -}; - -L1AlgoDraw::L1AlgoDraw() -{ - - int tmp[10] = {5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station - for (int i = 0; i < 10; i++) { - mcolor[i] = tmp[i]; - } - StaColor = 17; - hitsMStyle = 20; - fakesMStyle = 24; - targetMStyle = 29; - - HitSize = 1; - - gStyle->SetCanvasBorderMode(0); - gStyle->SetCanvasBorderSize(1); - gStyle->SetCanvasColor(0); - - YZ = new TCanvas("YZ", "YZ Side View", -1, 0, 500, 500); - YZ->Range(-5.0, -50.0, 105.0, 50.0); - YZ->Draw(); - YZ->Update(); - - XZ = new TCanvas("XZ", "XZ Top View", -1, 500, 500, 500); - XZ->Range(-5.0, -50.0, 105.0, 50.0); - XZ->Draw(); - XZ->Update(); - - YX = new TCanvas("YX", "YX Front View", -506, 0, 500, 500); - YX->Range(-50.0, -50.0, 50.0, 50.0); - YX->Draw(); - YX->Update(); - - // XYZ = new TCanvas ("XYZ", "XYZ 3D View", -0, 0, 1000, 1000); - XYZ = new TCanvas("XYZ", "XYZ 3D View", -500, 500, 500, 500); - XYZ->Range(-5.0, -50.0, 115.0, 60.0); - // TView3D *view = (TView3D*) XYZ->GetView3D(); - // view = (TView3D*) TView::CreateView(1); - // TView3D *view = new TView3D(); - // view->SetRange(-50.0, -50.0, -0.0, 50.0, 50.0, 110.0); - // view->SetRange(0,0,0,4,4,4); - // view->Draw(); - // XYZ->ResetView3D(view); - XYZ->Draw(); - XYZ->Update(); - - fVerbose = CbmL1::Instance()->fVerbose; - ask = true; -} - -void L1AlgoDraw::InitL1Draw(L1Algo* algo_) -{ - // algo = CbmL1::Instance()->algo; - algo = algo_; - vStsStrips.resize(algo->vStsStrips.size()); - for (int i = 0; i < algo->vStsStrips.size(); i++) { - vStsStrips[i] = algo->vStsStrips[i]; - } - vStsStripsB.resize(algo->vStsStripsB.size()); - for (int i = 0; i < algo->vStsStripsB.size(); i++) { - vStsStripsB[i] = algo->vStsStripsB[i]; - } - vStsHits.resize(algo->vStsHits.size()); - for (int i = 0; i < algo->vStsHits.size(); i++) { - vStsHits[i] = algo->vStsHits[i]; - } - NStations = algo->NStations; - for (int i = 0; i < NStations; i++) { - StsHitsStartIndex[i] = algo->StsHitsStartIndex[i]; - StsHitsStopIndex[i] = algo->StsHitsStopIndex[i]; - vStations[i] = algo->vStations[i]; - } -} - -void L1AlgoDraw::DrawMCTracks() -{ - int NRegMCTracks = 0; - CbmL1& L1 = *CbmL1::Instance(); - TPolyLine pline; - if (fVerbose >= 10) { - cout << "Only reconstructable tracks are shown." << endl; - cout << "Red - primary p > 0.5 - (first iteration)" << endl; - cout << "Blue - primary p < 0.5 - (second iteration)" << endl; - cout << "Green - secondary p > 0.5 - (third\\first iteration)" << endl; - cout << "Gray - secondary p < 0.5 - (third\\second iteration)" << endl; - }; - - for (vector<CbmL1MCTrack>::iterator it = L1.vMCTracks.begin(); it != L1.vMCTracks.end(); ++it) { - CbmL1MCTrack& T = *it; - //draw reconstructable tracks only - if (!T.IsReconstructable()) continue; - //if (( T.mother_ID< 0 )&&( T.nContStations<3 )) continue; - //if (( T.mother_ID>=0 )&&( T.nContStations<4 )) continue; - //if( T.p<.2 ) continue; - if (T.p < 0.1) continue; - pline.SetLineColor(kRed); - if (T.p < 0.5) pline.SetLineColor(kBlue); - if (T.mother_ID != -1) pline.SetLineColor(8); - if ((T.mother_ID != -1) && (T.p < 0.5)) pline.SetLineColor(12); - if (fVerbose >= 1) - cout << "MC Track: p = " << T.p << " mother_ID = " << T.mother_ID << " PDG = " << T.pdg << " x,y,z = (" << T.x - << ", " << T.y << ", " << T.z << ")" << endl; - double par[6]; - par[0] = T.x; - par[1] = T.y; - //if( fabs(T.pz)<0.1 ) continue; - par[2] = T.px / T.pz; - par[3] = T.py / T.pz; - par[4] = T.q / T.p; - par[5] = T.z; - - int npoints = T.Points.size(); - if (fVerbose >= 10) cout << " NMCPoints = " << npoints << endl; - if (npoints < 1) continue; - - vector<double> lx, ly, lz; - lx.push_back(par[0]); - ly.push_back(par[1]); - lz.push_back(par[5]); - - bool ok = true; - - if (fVerbose >= 4) { - cout << "hits = "; - for (int ih = 0; ih < T.StsHits.size(); ih++) - cout << T.StsHits[ih] << " "; - cout << endl; - } - for (int ip = 0; ip < npoints; ip++) { - CbmL1MCPoint& p = L1.vMCPoints[T.Points[ip]]; - double par1[6]; - //if( fabs(p.pz)<0.05 ) continue; - par1[0] = p.x; - par1[1] = p.y; - par1[2] = p.px / p.pz; - par1[3] = p.py / p.pz; - par1[4] = p.q / p.p; - par1[5] = p.z; - if (fVerbose >= 5) { - static float pz = -1; - if (fabs(pz - p.z) > 1.0) cout << "-- "; - cout << "point.z = " << p.z << endl; - pz = p.z; - } - - double Zfrst = par[5]; - double Zlast = par1[5]; - double step = .5; - if (step > fabs(Zfrst - Zlast) / 5) step = fabs(Zfrst - Zlast) / 5; - if (Zlast < par[5]) step = -step; - while (fabs(par[5] - Zlast) > fabs(step)) { - double znxt = par[5] + step; - CbmKF::Instance()->Propagate(par1, 0, znxt, par1[4]); - CbmKF::Instance()->Propagate(par, 0, znxt, par[4]); - double w = fabs(znxt - Zfrst); - double w1 = fabs(znxt - Zlast); - if (w + w1 < 1.e-3) { - w = 1; - w1 = 0; - } - float xl = (w1 * par[0] + w * par1[0]) / (w + w1); - float yl = (w1 * par[1] + w * par1[1]) / (w + w1); - float zl = (w1 * par[5] + w * par1[5]) / (w + w1); - if ((fabs(xl) > 50.0) || (fabs(yl) > 50.0)) { - //cout << "*** track " << NRegMCTracks+1 << " xl = " << xl << ", zl = " << zl << endl; - //cout << "*** track " << NRegMCTracks+1 << " yl = " << yl << ", zl = " << zl << endl; - ok = false; - continue; - } - lx.push_back((w1 * par[0] + w * par1[0]) / (w + w1)); - ly.push_back((w1 * par[1] + w * par1[1]) / (w + w1)); - lz.push_back((w1 * par[5] + w * par1[5]) / (w + w1)); - } - - par[0] = p.x; - par[1] = p.y; - par[2] = p.px / p.pz; - par[3] = p.py / p.pz; - par[4] = p.q / p.p; - par[5] = p.z; - lx.push_back(par[0]); - ly.push_back(par[1]); - lz.push_back(par[5]); - } - - if (ok) { - - NRegMCTracks++; - - YZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); - XZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); - YX->cd(); - pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); - - // YZ->cd(); YZ->Update(); - // XZ->cd(); XZ->Update(); - // YX->cd(); YX->Update(); - // DrawAsk(); - } - } - - cout << "L1CADraw: number of registered MC tracks: " << NRegMCTracks << endl; - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -} - -void L1AlgoDraw::DrawRecoTracks() -{ - // XYZ->cd(); - // TView *view = TView::CreateView(1); - // view->SetRange(-100,-100,-100, 100, 100, 100); - - int NRecTracks = 0; - // CbmL1 &L1 = *CbmL1::Instance(); - - int curRecoHit = 0; - vector<THitI>& recoHits = algo->vRecoHits; - for (vector<L1Track>::iterator it = algo->vTracks.begin(); it != algo->vTracks.end(); ++it) { - L1Track& T = *it; - int nHits = T.NHits; - // if (nHits > 5) continue; // draw clones - // YZ->cd(); YZ->Update(); - // XZ->cd(); XZ->Update(); - // YX->cd(); YX->Update(); - // DrawAsk(); - vector<double> lx, ly, lz; - vector<double> lx_turned, ly_turned, lz_turned; - - TPolyLine pline; - pline.SetLineColor(kBlue); - // TPolyLine3D pline3D(nHits); - // pline3D.SetLineColor(kBlue); - if (fVerbose >= 4) { cout << "hits = "; } - for (int iHit = 0; iHit < nHits; iHit++) { - unsigned int ih = recoHits[curRecoHit++]; - if (fVerbose >= 4) { cout << ih << " "; } - - Point p = GetHitCoor(ih); - lx.push_back(p.x); - ly.push_back(p.y); - lz.push_back(p.z); - - TVector3 v3(p.x, p.y, p.z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - lx_turned.push_back(v3.x()); - ly_turned.push_back(v3.y()); - lz_turned.push_back(v3.z()); - // pline3D.SetPoint(iHit, p.x, p.y, p.z); - } - if (fVerbose >= 4) { cout << endl; } - if (1) { - - NRecTracks++; - - YZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(ly[0])); - XZ->cd(); - pline.DrawPolyLine(lx.size(), &(lz[0]), &(lx[0])); - YX->cd(); - pline.DrawPolyLine(lx.size(), &(lx[0]), &(ly[0])); - XYZ->cd(); - pline.DrawPolyLine(lx_turned.size(), &(lz_turned[0]), &(lx_turned[0])); - // pline3D.Draw(); - } - } - - cout << "L1CADraw: number of reconstructed tracks: " << NRecTracks << endl; - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); - - XYZ->cd(); - XYZ->Update(); -} - -void L1AlgoDraw::DrawTriplets(vector<L1Triplet>& triplets, const THitI* realIHit) -{ - // vector <L1Triplet> triplets = algo->vTriplets; - for (int iTrip = 0; iTrip < triplets.size(); iTrip++) { - L1Triplet& trip = triplets[iTrip]; - - unsigned int iLHit = trip.GetLHit(); - iLHit = realIHit[iLHit]; - unsigned int iMHit = trip.GetMHit(); - iMHit = realIHit[iMHit]; - unsigned int iRHit = trip.GetRHit(); - iRHit = realIHit[iRHit]; - - DrawTriplet(iLHit, iMHit, iRHit); - } - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawTriplet(int il, int im, int ir) -{ - TPolyLine pline; - pline.SetLineColor(kBlack); - TMarker marker; - marker.SetMarkerColor(kBlack); - marker.SetMarkerStyle(26); - marker.SetMarkerSize(HitSize * 2); - - vector<double> lx, ly, lz; - - Point coor; - - coor = GetHitCoor(il); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(im); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(ir); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - const int nHits = 3; - YZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); - marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); - XZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); - marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); - YX->cd(); - pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); - marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); -} - -void L1AlgoDraw::DrawDoublets(vector<THitI>* Duplets_hits, map<THitI, THitI>* Duplets_start, const int MaxArrSize, - THitI* StsRestHitsStartIndex, unsigned int* realIHit) -{ - for (int iSta = 0; iSta < NStations - 1; iSta++) { - const int firstHitOnSta = StsRestHitsStartIndex[iSta]; - const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - THitI* staDupletsHits = &(Duplets_hits[iSta][0]); - map<THitI, THitI>& staDupletsStart = Duplets_start[iSta]; - - for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { - const int ilh = iRestLHit - firstHitOnSta; - const int iirhFirst = staDupletsStart[ilh]; - const int iirhLast = staDupletsStart[ilh + 1] - 1; - - for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { - const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta; - - const int iLHit = realIHit[iRestLHit]; - const int iRHit = realIHit[iRestRHit]; - - DrawDoublet(iLHit, iRHit); - } - } - } - - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawDoubletsOnSta(int iSta, THitI* Duplets_hits, THitI* Duplets_start, const int MaxArrSize, - THitI* StsRestHitsStartIndex, unsigned int* realIHit) -{ - const int firstHitOnSta = StsRestHitsStartIndex[iSta]; - const int firstHitOnNextSta = StsRestHitsStartIndex[iSta + 1]; - THitI* staDupletsHits = Duplets_hits + MaxArrSize * iSta; - THitI* staDupletsStart = Duplets_start + MaxArrSize * iSta; - - for (int iRestLHit = firstHitOnSta; iRestLHit < firstHitOnNextSta; iRestLHit++) { - const int ilh = iRestLHit - firstHitOnSta; - const int iirhFirst = staDupletsStart[ilh]; - const int iirhLast = staDupletsStart[ilh + 1] - 1; - - for (int iirh = iirhFirst; iirh <= iirhLast; iirh++) { - const int iRestRHit = staDupletsHits[iirh] + firstHitOnNextSta; - - const int iLHit = realIHit[iRestLHit]; - const int iRHit = realIHit[iRestRHit]; - - DrawDoublet(iLHit, iRHit); - } - } + vector<L1Hit> vStsHits {}; + int StsHitsStartIndex[20] {0}; + int StsHitsStopIndex[20] {0}; - YZ->cd(); - YZ->Update(); - XZ->cd(); - XZ->Update(); - YX->cd(); - YX->Update(); -}; - -void L1AlgoDraw::DrawDoublet(int il, int ir) -{ - TPolyLine pline; - pline.SetLineColor(kBlue); - TMarker marker; - marker.SetMarkerColor(kBlue); - marker.SetMarkerStyle(27); - marker.SetMarkerSize(HitSize * 2); - - vector<double> lx, ly, lz; - - Point coor; - - coor = GetHitCoor(il); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - coor = GetHitCoor(ir); - lx.push_back(coor.x); - ly.push_back(coor.y); - lz.push_back(coor.z); - - const int nHits = 2; - YZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(ly[0])); - marker.DrawMarker(lz[nHits - 1], ly[nHits - 1]); - XZ->cd(); - pline.DrawPolyLine(nHits, &(lz[0]), &(lx[0])); - marker.DrawMarker(lz[nHits - 1], lx[nHits - 1]); - YX->cd(); - pline.DrawPolyLine(nHits, &(lx[0]), &(ly[0])); - marker.DrawMarker(lx[nHits - 1], ly[nHits - 1]); -} - - -void L1AlgoDraw::DrawInfo() -{ - cout << " vStsHits.size = " << algo->vStsHits.size() << endl; - cout << " vRecoHits.size = " << algo->vRecoHits.size() << endl; - cout << " vTracks.size = " << algo->vTracks.size() << endl; -} - -void L1AlgoDraw::DrawTarget() -{ - - float x = 0, y = 0, z = 0; - float x_t, z_t; - - TVector3 v3(x, y, z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - x_t = v3.x(); - z_t = v3.z(); - - { - YZ->cd(); - - TMarker* marker = new TMarker(z, y, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - XZ->cd(); - - TMarker* marker = new TMarker(z, x, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - YX->cd(); - - TMarker* marker = new TMarker(x, y, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } - - { - XYZ->cd(); - - TMarker* marker = new TMarker(z_t, x_t, targetMStyle); - marker->SetMarkerColor(kRed); - marker->SetMarkerStyle(targetMStyle); - marker->SetMarkerSize(HitSize); - marker->Draw(); - } -} - -void L1AlgoDraw::DrawInputHits() -{ - - TLatex latex; - latex.SetTextFont(132); - latex.SetTextAlign(12); - latex.SetTextSize(0.035); - - YZ->cd(); - latex.DrawLatex(0.0, 45.0, "YZ Side View"); - YZ->Draw(); - XZ->cd(); - latex.DrawLatex(0.0, 45.0, "XZ Top View"); - XZ->Draw(); - YX->cd(); - latex.DrawLatex(-45.0, 45.0, "YX Front View"); - YX->Draw(); - - - int nhits = vStsHits.size(); - Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; - Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; - Double_t x_poly_turned[nhits], z_poly_turned[nhits]; - Double_t x_poly_fake_turned[nhits], z_poly_fake_turned[nhits]; - - - for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - L1Station& st = vStations[ista]; - Int_t n_poly = 0; - Int_t n_poly_fake = 0; - for (int ih = StsHitsStartIndex[ista]; ih < StsHitsStopIndex[ista]; ih++) { - L1StsHit& h = vStsHits[ih]; - int iMC = CbmL1::Instance()->vHitMCRef[ih]; - //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used - - float x, y, z; - float x_t, z_t; - algo->GetHitCoor(h, x, y, z, st); - - TVector3 v3(x, y, z); - v3.RotateX(TMath::Pi() / 5); - v3.RotateY(TMath::Pi() / 20); - v3.RotateZ(TMath::Pi() / 100); - x_t = v3.x(); - z_t = v3.z(); - - if (iMC >= 0) { - x_poly[n_poly] = x; - y_poly[n_poly] = y; - z_poly[n_poly] = z; - x_poly_turned[n_poly] = x_t; - z_poly_turned[n_poly] = z_t; - n_poly++; - } - else { - x_poly_fake[n_poly_fake] = x; - y_poly_fake[n_poly_fake] = y; - z_poly_fake[n_poly_fake] = z; - x_poly_fake_turned[n_poly_fake] = x_t; - z_poly_fake_turned[n_poly_fake] = z_t; - n_poly_fake++; - } - } - - YZ->cd(); - - TLine* line = new TLine(); - line->SetLineColor(StaColor); - line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); - - TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); - pmyz->SetMarkerColor(mcolor[ista]); - pmyz->SetMarkerStyle(hitsMStyle); - pmyz->SetMarkerSize(HitSize); - pmyz->Draw(); - - TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); - pmyz_fake->SetMarkerColor(mcolor[ista]); - pmyz_fake->SetMarkerStyle(fakesMStyle); - pmyz_fake->SetMarkerSize(HitSize); - pmyz_fake->Draw(); - - XZ->cd(); + int NStations {0}; + L1Station vStations[20] {}; - line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); + int mcolor[10] {5, 7, 3, 8, 6, 2, 4, 1, 9, 14}; // color for hits on i-station + int StaColor {17}; // color for stantions + int hitsMStyle {20}; // style for hits + int fakesMStyle {24}; // style for fakes + int targetMStyle {29}; // style for target - TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); - pmxz->SetMarkerColor(mcolor[ista]); - pmxz->SetMarkerStyle(hitsMStyle); - pmxz->SetMarkerSize(HitSize); - pmxz->Draw(); + double HitSize {1}; // size of hits - TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); - pmxz_fake->SetMarkerColor(mcolor[ista]); - pmxz_fake->SetMarkerStyle(fakesMStyle); - pmxz_fake->SetMarkerSize(HitSize); - pmxz_fake->Draw(); - - YX->cd(); - - TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]); - ellipse->SetLineColor(StaColor); - ellipse->SetFillStyle(0); - ellipse->Draw(); - - TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); - pmyx->SetMarkerColor(mcolor[ista]); - pmyx->SetMarkerStyle(hitsMStyle); - pmyx->SetMarkerSize(HitSize); - pmyx->Draw(); - - TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); - pmyx_fake->SetMarkerColor(mcolor[ista]); - pmyx_fake->SetMarkerStyle(fakesMStyle); - pmyx_fake->SetMarkerSize(HitSize); - pmyx_fake->Draw(); - - XYZ->cd(); - - TPolyMarker* pmxyz = new TPolyMarker(n_poly, z_poly_turned, x_poly_turned); - pmxyz->SetMarkerColor(mcolor[ista]); - pmxyz->SetMarkerStyle(hitsMStyle); - pmxyz->SetMarkerSize(HitSize); - pmxyz->Draw(); - - TPolyMarker* pmxyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake_turned, x_poly_fake_turned); - pmxyz_fake->SetMarkerColor(mcolor[ista]); - pmxyz_fake->SetMarkerStyle(fakesMStyle); - pmxyz_fake->SetMarkerSize(HitSize); - pmxyz_fake->Draw(); - } - -} // DrawInputHits - -void L1AlgoDraw::DrawRestHits(THitI* StsRestHitsStartIndex, THitI* StsRestHitsStopIndex, unsigned int* realIHit) -{ - - TLatex latex; - latex.SetTextFont(132); - latex.SetTextAlign(12); - latex.SetTextSize(0.035); - - YZ->cd(); - latex.DrawLatex(0.0, 45.0, "YZ Side View"); - YZ->Draw(); - XZ->cd(); - latex.DrawLatex(0.0, 45.0, "XZ Top View"); - XZ->Draw(); - YX->cd(); - latex.DrawLatex(-45.0, 45.0, "YX Front View"); - YX->Draw(); - - - int nhits = vStsHits.size(); - Double_t x_poly[nhits], y_poly[nhits], z_poly[nhits]; - Double_t x_poly_fake[nhits], y_poly_fake[nhits], z_poly_fake[nhits]; - - - for (int ista = NStations - 1; ista >= 0; ista--) { // //start downstream chambers - L1Station& st = vStations[ista]; - Int_t n_poly = 0; - Int_t n_poly_fake = 0; - for (int iRestHit = StsRestHitsStartIndex[ista]; iRestHit < StsRestHitsStopIndex[ista]; iRestHit++) { - int ih = realIHit[iRestHit]; - L1StsHit& h = vStsHits[ih]; - int iMC = CbmL1::Instance()->vHitMCRef[ih]; - //if( (vSFlag[h.f] | vSFlagB[h.b] )&0x02 ) continue; // if used - - float x, y, z; - algo->GetHitCoor(h, x, y, z, st); - if (iMC >= 0) { - x_poly[n_poly] = x; - y_poly[n_poly] = y; - z_poly[n_poly] = z; - n_poly++; - } - else { - x_poly_fake[n_poly_fake] = x; - y_poly_fake[n_poly_fake] = y; - z_poly_fake[n_poly_fake] = z; - n_poly_fake++; - } - } - - YZ->cd(); - - TLine* line = new TLine(); - line->SetLineColor(StaColor); - line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); - - TPolyMarker* pmyz = new TPolyMarker(n_poly, z_poly, y_poly); - pmyz->SetMarkerColor(mcolor[ista]); - pmyz->SetMarkerStyle(hitsMStyle); - pmyz->SetMarkerSize(HitSize); - pmyz->Draw(); - - TPolyMarker* pmyz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, y_poly_fake); - pmyz_fake->SetMarkerColor(mcolor[ista]); - pmyz_fake->SetMarkerStyle(fakesMStyle); - pmyz_fake->SetMarkerSize(HitSize); - pmyz_fake->Draw(); - - XZ->cd(); - - line->DrawLine(st.z[0], -st.Rmax[0], st.z[0], st.Rmax[0]); - - TPolyMarker* pmxz = new TPolyMarker(n_poly, z_poly, x_poly); - pmxz->SetMarkerColor(mcolor[ista]); - pmxz->SetMarkerStyle(hitsMStyle); - pmxz->SetMarkerSize(HitSize); - pmxz->Draw(); - - TPolyMarker* pmxz_fake = new TPolyMarker(n_poly_fake, z_poly_fake, x_poly_fake); - pmxz_fake->SetMarkerColor(mcolor[ista]); - pmxz_fake->SetMarkerStyle(fakesMStyle); - pmxz_fake->SetMarkerSize(HitSize); - pmxz_fake->Draw(); - - YX->cd(); - - TEllipse* ellipse = new TEllipse(0.0, 0.0, st.Rmax[0]); - ellipse->SetLineColor(StaColor); - ellipse->SetFillStyle(0); - ellipse->Draw(); - - TPolyMarker* pmyx = new TPolyMarker(n_poly, x_poly, y_poly); - pmyx->SetMarkerColor(mcolor[ista]); - pmyx->SetMarkerStyle(hitsMStyle); - pmyx->SetMarkerSize(HitSize); - pmyx->Draw(); - - TPolyMarker* pmyx_fake = new TPolyMarker(n_poly_fake, x_poly_fake, y_poly_fake); - pmyx_fake->SetMarkerColor(mcolor[ista]); - pmyx_fake->SetMarkerStyle(fakesMStyle); - pmyx_fake->SetMarkerSize(HitSize); - pmyx_fake->Draw(); - } - -} // DrawCurHits - -void L1AlgoDraw::DrawAsk() -{ - char symbol; - if (ask) { - std::cout << "ask>"; - do { - std::cin.get(symbol); - if (symbol == 'r') ask = false; - if (symbol == 'q') exit; - } while (symbol != '\n'); - std::cout << endl; - } -} - -void L1AlgoDraw::ClearVeiw() -{ - YZ->Clear(); - XZ->Clear(); - YX->Clear(); - XYZ->Clear(); -} - -L1AlgoDraw::Point L1AlgoDraw::GetHitCoor(int ih) -{ - L1StsHit& hit = vStsHits[ih]; - // find station - int ista = 0; - for (int i = 0; i < NStations; i++) { - if ((StsHitsStartIndex[i] <= ih) && (StsHitsStopIndex[i] > ih)) { - ista = i; - break; - } - } - L1Station& sta = vStations[ista]; - float x, y, z; - algo->GetHitCoor(hit, x, y, z, sta); - return Point(x, y, z); + int fVerbose {0}; + TCanvas* YZ {nullptr}; + TCanvas* YX {nullptr}; + TCanvas* XZ {nullptr}; + TCanvas* XYZ {nullptr}; + bool ask {true}; }; -void L1AlgoDraw::SaveCanvas(TString name) -{ - system("mkdir L1CADraw -p"); - chdir("L1CADraw"); - TString tmp = name; - tmp += "YXView.pdf"; - YX->cd(); - // YX->SaveAs("YXView.eps"); - YX->SaveAs(tmp); - - tmp = name; - tmp += "XZView.pdf"; - XZ->cd(); - // XZ->SaveAs("XZView.eps"); - XZ->SaveAs(tmp); - - tmp = name; - tmp += "YZView.pdf"; - YZ->cd(); - // YZ->SaveAs("YZView.eps"); - YZ->SaveAs(tmp); - - tmp = name; - tmp += "XYZView.pdf"; - XYZ->cd(); - XYZ->SaveAs(tmp); - // XYZ->SaveAs("XYZView.eps"); - // XYZ->SaveAs("XYZView.png"); - // XYZ->SaveAs("XYZView.pdf"); - chdir(".."); -} #endif diff --git a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h index 89223d609e..683da7e350 100644 --- a/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h +++ b/reco/L1/L1Algo/utils/L1AlgoEfficiencyPerformance.h @@ -19,8 +19,7 @@ #include <iostream> #include <vector> -#include "L1Algo/L1Algo.h" -#include "L1Algo/L1StsHit.h" +#include "L1Algo.h" using std::cout; using std::endl; diff --git a/reco/L1/L1Algo/utils/L1AlgoPulls.h b/reco/L1/L1Algo/utils/L1AlgoPulls.h index 9adb7339f0..ee34a33631 100644 --- a/reco/L1/L1Algo/utils/L1AlgoPulls.h +++ b/reco/L1/L1Algo/utils/L1AlgoPulls.h @@ -24,9 +24,8 @@ const int NStations = 0; #include <iostream> #include <vector> -#include "L1Algo/L1Algo.h" -#include "L1Algo/L1StsHit.h" -#include "L1Algo/L1TrackPar.h" +#include "L1Algo.h" +#include "L1TrackPar.h" using std::cout; using std::endl; diff --git a/reco/L1/L1AlgoInputData.cxx b/reco/L1/L1AlgoInputData.cxx index 3902e270e4..677221fba3 100644 --- a/reco/L1/L1AlgoInputData.cxx +++ b/reco/L1/L1AlgoInputData.cxx @@ -24,7 +24,7 @@ const L1AlgoInputData& L1AlgoInputData::operator=( const L1AlgoInputData& a) } -void L1AlgoInputData::SetData( const vector< L1StsHit > & StsHits_, +void L1AlgoInputData::SetData( const vector< L1Hit > & StsHits_, const vector< L1Strip > & StsStrips_, const vector< L1Strip > & StsStripsB_, const vector< fscal > & StsZPos_, @@ -141,8 +141,8 @@ bool L1AlgoInputData::ReadHitsFromFile(const char work_dir[100], const int maxNE int element_n; int element_iz; for (int i = 0; i < n; i++) { - L1StsHit element; - fadata >> element_f >> element_b >> element_n >> element_iz >> element.u >> element.v >> element.t_reco; + L1Hit element; + fadata >> element_f >> element_b >> element_n >> element_iz >> element.u >> element.v >> element.t; element.f = static_cast<THitI>(element_f); element.b = static_cast<THitI>(element_b); #ifdef USE_EVENT_NUMBER diff --git a/reco/L1/L1AlgoInputData.h b/reco/L1/L1AlgoInputData.h index 2314d133d7..7152a424fa 100644 --- a/reco/L1/L1AlgoInputData.h +++ b/reco/L1/L1AlgoInputData.h @@ -11,7 +11,7 @@ #include <iostream> #include <vector> -#include "L1StsHit.h" +#include "L1Hit.h" #include "L1Vector.h" using std::istream; @@ -31,7 +31,7 @@ public: } ~L1AlgoInputData() {}; - vector<L1StsHit>& GetStsHits() { return vStsHits; } + vector<L1Hit>& GetStsHits() { return vStsHits; } int GetNStsStrips() const { return NStsStrips; } const vector<fscal>& GetStsZPos() const { return vStsZPos; } L1Vector<unsigned char>& GetSFlag() { return fStripFlag; } @@ -80,7 +80,7 @@ public: { MaxNStations = 25 }; - vector<L1StsHit> vStsHits; // hits as a combination of front-, backstrips and z-position + vector<L1Hit> vStsHits; // hits as a combination of front-, backstrips and z-position int NStsStrips; // Number of strips in sts vector<fscal> vStsZPos; // all possible z-positions of hits -- GitLab