Commit e906a614 authored by Sergey Gorbunov's avatar Sergey Gorbunov Committed by Florian Uhlig
Browse files

L1: remove "using *" from the headers

parent bdf67354
......@@ -94,10 +94,10 @@ void CbmStsTracksConverter::Init()
// TODO misleading name, move field filling somewhere else?
float CbmStsTracksConverter::ExtrapolateToVertex(CbmStsTrack* sts_track, AnalysisTree::Track& track, int pdg)
{
vector<CbmStsTrack> tracks = {*sts_track};
std::vector<CbmStsTrack> tracks = {*sts_track};
CbmL1PFFitter fitter;
vector<float> chi2_to_vtx;
vector<L1FieldRegion> field;
std::vector<float> chi2_to_vtx;
std::vector<L1FieldRegion> field;
CbmKFVertex kfVertex = CbmKFVertex(*cbm_prim_vertex_);
if (is_reproduce_cbmkfpf_) {
std::vector<int> pdgVector = {pdg};
......@@ -210,15 +210,15 @@ bool CbmStsTracksConverter::IsGoodCovMatrix(const CbmStsTrack* sts_track) const
}
// Cuts, coded in MZ's CbmKFParticleFinder.cxx
bool ok = true;
ok = ok && isfinite(sts_track->GetParamFirst()->GetX());
ok = ok && isfinite(sts_track->GetParamFirst()->GetY());
ok = ok && isfinite(sts_track->GetParamFirst()->GetZ());
ok = ok && isfinite(sts_track->GetParamFirst()->GetTx());
ok = ok && isfinite(sts_track->GetParamFirst()->GetTy());
ok = ok && isfinite(sts_track->GetParamFirst()->GetQp());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetX());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetY());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetZ());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetTx());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetTy());
ok = ok && std::isfinite(sts_track->GetParamFirst()->GetQp());
for (auto element : cov_matrix) {
ok = ok && isfinite(element);
ok = ok && std::isfinite(element);
}
ok = ok && (cov_matrix[0] < 1. && cov_matrix[0] > 0.) && (cov_matrix[2] < 1. && cov_matrix[2] > 0.)
&& (cov_matrix[5] < 1. && cov_matrix[5] > 0.) && (cov_matrix[9] < 1. && cov_matrix[9] > 0.)
......
......@@ -523,7 +523,7 @@ public:
<< " | "
<< " N MC " << std::endl;
int NCounters = mc.NCounters;
int NCounters = mc.GetNcounters();
for (int iC = 0; iC < NCounters; iC++) {
std::cout << names[iC] << " : " << std::setw(6) << ratio_reco.counters[iC] << " / " << std::setw(6)
<< ratio_ghost.counters[iC] // particles w\o MCParticle
......
......@@ -1579,7 +1579,7 @@ void CbmL1::WriteSTAPGeoData(const L1Vector<float>& geo_)
{
// write geo in file
TString fgeo_name = fSTAPDataDir + "geo_algo.txt";
ofstream fgeo(fgeo_name);
std::ofstream fgeo(fgeo_name);
fgeo.setf(ios::scientific, ios::floatfield);
fgeo.precision(20);
int size = geo_.size();
......@@ -1595,15 +1595,15 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent
{
// write algo data in file
static int vNEvent = 1;
fstream fadata;
std::fstream fadata;
TString fadata_name = fSTAPDataDir + "data_algo.txt";
// if ( vNEvent <= maxNEvent ) {
if (1) {
if (vNEvent == 1) fadata.open(fadata_name, fstream::out); // begin new file
if (vNEvent == 1) fadata.open(fadata_name, std::fstream::out); // begin new file
else
fadata.open(fadata_name, fstream::out | fstream::app);
fadata.open(fadata_name, std::fstream::out | std::fstream::app);
fadata << "Event:"
<< " ";
......@@ -1675,8 +1675,8 @@ void CbmL1::WriteSTAPAlgoData() // must be called after ReadEvent
void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent
{
fstream fpdata;
fpdata << setprecision(8);
std::fstream fpdata;
fpdata << std::setprecision(8);
static int vNEvent = 1;
......@@ -1685,9 +1685,9 @@ void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent
// if ( vNEvent <= maxNEvent ) {
if (1) {
if (vNEvent == 1) fpdata.open(fpdata_name, fstream::out); // begin new file
if (vNEvent == 1) fpdata.open(fpdata_name, std::fstream::out); // begin new file
else
fpdata.open(fpdata_name, fstream::out | fstream::app);
fpdata.open(fpdata_name, std::fstream::out | std::fstream::app);
fpdata << "Event: ";
fpdata << vNEvent << endl;
......@@ -1822,7 +1822,7 @@ void CbmL1::WriteSTAPPerfData() // must be called after ReadEvent
vNEvent++;
} // void CbmL1::WriteSTAPPerfData()
istream& CbmL1::eatwhite(istream& is) // skip spaces
std::istream& CbmL1::eatwhite(std::istream& is) // skip spaces
{
char c;
while (is.get(c)) {
......@@ -1839,7 +1839,7 @@ istream& CbmL1::eatwhite(istream& is) // skip spaces
void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& geo_, int& size)
{
TString fgeo_name = fSTAPDataDir + "geo_algo.txt";
ifstream fgeo(fgeo_name);
std::ifstream fgeo(fgeo_name);
cout << "-I- CbmL1: Read geometry from file " << fgeo_name << endl;
int i;
......@@ -1856,11 +1856,11 @@ void CbmL1::ReadSTAPGeoData(L1Vector<fscal>& geo_, int& size)
void CbmL1::ReadSTAPAlgoData()
{
static int nEvent = 1;
static fstream fadata;
static std::fstream fadata;
TString fadata_name = fSTAPDataDir + "data_algo.txt";
// if (nEvent <= maxNEvent){
if (1) {
if (nEvent == 1) fadata.open(fadata_name, fstream::in);
if (nEvent == 1) fadata.open(fadata_name, std::fstream::in);
if (algo->vStsHits) algo->vStsHits->clear();
algo->NStsStrips = 0;
......@@ -1931,11 +1931,11 @@ void CbmL1::ReadSTAPAlgoData()
void CbmL1::ReadSTAPPerfData()
{
static int nEvent = 1;
static fstream fpdata;
static std::fstream fpdata;
TString fpdata_name = fSTAPDataDir + "data_perfo.txt";
// if (nEvent <= maxNEvent){
if (1) {
if (nEvent == 1) { fpdata.open(fpdata_name, fstream::in); };
if (nEvent == 1) { fpdata.open(fpdata_name, std::fstream::in); };
vMCPoints.clear();
vMCTracks.clear();
......@@ -2113,10 +2113,10 @@ void CbmL1::WriteSIMDKFData()
if (first) {
FairField* dMF = CbmKF::Instance()->GetMagneticField();
fstream FileGeo;
std::fstream FileGeo;
FileGeo.open("geo.dat", ios::out);
fstream FieldCheck;
std::fstream FieldCheck;
FieldCheck.open("field.dat", ios::out);
Double_t bfg[3], rfg[3];
......@@ -2277,19 +2277,19 @@ void CbmL1::WriteSIMDKFData()
///Write Tracks and MC Tracks
static int TrNumber = 0;
fstream Tracks, McTracksCentr, McTracksIn, McTracksOut;
std::fstream Tracks, McTracksCentr, McTracksIn, McTracksOut;
if (first) {
Tracks.open("tracks.dat", fstream::out);
McTracksCentr.open("mctrackscentr.dat", fstream::out);
McTracksIn.open("mctracksin.dat", fstream::out);
McTracksOut.open("mctracksout.dat", fstream::out);
Tracks.open("tracks.dat", std::fstream::out);
McTracksCentr.open("mctrackscentr.dat", std::fstream::out);
McTracksIn.open("mctracksin.dat", std::fstream::out);
McTracksOut.open("mctracksout.dat", std::fstream::out);
first = 0;
}
else {
Tracks.open("tracks.dat", fstream::out | fstream::app);
McTracksCentr.open("mctrackscentr.dat", fstream::out | fstream::app);
McTracksIn.open("mctracksin.dat", fstream::out | fstream::app);
McTracksOut.open("mctracksout.dat", fstream::out | fstream::app);
Tracks.open("tracks.dat", std::fstream::out | std::fstream::app);
McTracksCentr.open("mctrackscentr.dat", std::fstream::out | std::fstream::app);
McTracksIn.open("mctracksin.dat", std::fstream::out | std::fstream::app);
McTracksOut.open("mctracksout.dat", std::fstream::out | std::fstream::app);
}
for (L1Vector<CbmL1Track>::iterator RecTrack = vRTracks.begin(); RecTrack != vRTracks.end(); ++RecTrack) {
......
......@@ -11,39 +11,32 @@
#include <iomanip>
#include <iostream>
#include <map>
#include <vector>
using std::ios;
using std::map;
using std::setw;
using std::vector;
#include "L1Vector.h"
/// counters used for efficiency calculation
template<typename T>
struct TL1TracksCatCounters // counters for different tracks categories
{
TL1TracksCatCounters() : NCounters(0), counters() { counters.clear(); };
TL1TracksCatCounters(int nCounters) : NCounters(nCounters), counters() { counters.resize(NCounters, T(0)); };
TL1TracksCatCounters() { counters.reserve(20); }
void AddCounter()
{
NCounters++;
counters.push_back(T(0));
};
void AddCounters(int nCounters)
{
NCounters += nCounters;
counters.resize(NCounters, T(0));
};
TL1TracksCatCounters(int nCounters) { counters.reset(nCounters, T(0)); };
int GetNcounters() const { return counters.size(); }
void AddCounter() { counters.push_back_no_warning(T(0)); };
void AddCounters(int nCounters) { counters.enlarge(GetNcounters() + nCounters, T(0)); };
TL1TracksCatCounters& operator+=(TL1TracksCatCounters& a)
{
if (NCounters != a.NCounters) {
if (GetNcounters() != a.GetNcounters()) {
std::cout << " TL1TracksCatCounters: Error. Addition of counters of "
"different sizes: "
<< NCounters << " " << a.NCounters << std::endl;
<< GetNcounters() << " " << a.GetNcounters() << std::endl;
}
else {
for (int iC = 0; iC < NCounters; iC++) {
for (int iC = 0; iC < GetNcounters(); iC++) {
counters[iC] += a.counters[iC];
}
}
......@@ -60,14 +53,14 @@ struct TL1TracksCatCounters // counters for different tracks categories
template<typename T2>
TL1TracksCatCounters<double> operator/(TL1TracksCatCounters<T2>& a)
{
TL1TracksCatCounters<double> b(NCounters);
if (NCounters != a.NCounters) {
TL1TracksCatCounters<double> b(GetNcounters());
if (GetNcounters() != a.GetNcounters()) {
std::cout << " TL1TracksCatCounters: Error. Addition of counters of "
"different sizes: "
<< NCounters << " " << a.NCounters << std::endl;
<< GetNcounters() << " " << a.GetNcounters() << std::endl;
}
else {
for (int iC = 0; iC < NCounters; iC++) {
for (int iC = 0; iC < GetNcounters(); iC++) {
b.counters[iC] = Div(counters[iC], a.counters[iC]);
}
}
......@@ -77,8 +70,8 @@ struct TL1TracksCatCounters // counters for different tracks categories
template<typename T2>
TL1TracksCatCounters<T2> operator/(double a)
{
TL1TracksCatCounters<T2> b(NCounters);
for (int iC = 0; iC < NCounters; iC++) {
TL1TracksCatCounters<T2> b(GetNcounters());
for (int iC = 0; iC < GetNcounters(); iC++) {
b.counters[iC] = static_cast<T2>(Div(counters[iC], a));
}
return b;
......@@ -86,7 +79,7 @@ struct TL1TracksCatCounters // counters for different tracks categories
friend std::fstream& operator<<(std::fstream& strm, const TL1TracksCatCounters<T>& a)
{
strm << a.NCounters << " " << a.counters.size() << " ";
strm << a.GetNcounters() << " " << a.counters.size() << " ";
for (unsigned int iV = 0; iV < a.counters.size(); iV++)
strm << a.counters[iV] << " ";
strm << std::endl;
......@@ -95,7 +88,7 @@ struct TL1TracksCatCounters // counters for different tracks categories
friend std::ostream& operator<<(std::ostream& strm, const TL1TracksCatCounters<T>& a)
{
strm << a.NCounters << " " << a.counters.size() << " ";
strm << a.counters.size() << " ";
for (unsigned int iV = 0; iV < a.counters.size(); iV++)
strm << a.counters[iV] << " ";
strm << std::endl;
......@@ -106,9 +99,8 @@ struct TL1TracksCatCounters // counters for different tracks categories
{
int tmp;
strm >> tmp;
a.NCounters = tmp;
strm >> tmp;
a.counters.resize(tmp, T(0));
a.counters.clear();
a.counters.reset(tmp, T(0));
for (int iV = 0; iV < tmp; iV++) {
T tmp1;
strm >> tmp1;
......@@ -121,8 +113,7 @@ private:
double Div(double a, double b) { return (b > 0) ? a / b : -1.; };
public:
int NCounters;
vector<T> counters;
L1Vector<T> counters {"TL1TracksCatCounters::counters"};
};
struct TL1Efficiencies {
......@@ -153,8 +144,8 @@ struct TL1Efficiencies {
void PrintEff();
vector<TString> names; // names counters indexed by index of counter
map<TString, int> indices; // indices of counters indexed by a counter shortname
std::vector<TString> names; // names counters indexed by index of counter
std::map<TString, int> indices; // indices of counters indexed by a counter shortname
TL1TracksCatCounters<double> ratio_reco;
double ratio_ghosts;
......@@ -212,16 +203,16 @@ inline void TL1Efficiencies::Inc(bool isReco, TString name)
inline void TL1Efficiencies::PrintEff()
{
std::cout.setf(ios::fixed);
std::cout.setf(ios::showpoint);
std::cout.setf(std::ios::fixed);
std::cout.setf(std::ios::showpoint);
std::cout.precision(3);
std::cout.setf(ios::right);
std::cout.setf(std::ios::right);
std::cout << "Track category : "
<< " Eff "
<< " | "
<< "All MC" << std::endl;
int NCounters = mc.NCounters;
int NCounters = mc.GetNcounters();
for (int iC = 0; iC < NCounters; iC++) {
std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " | " << mc.counters[iC] << std::endl;
}
......
......@@ -5,22 +5,20 @@
#ifndef _CbmL1Hit_h_
#define _CbmL1Hit_h_
#include <vector>
using std::vector;
#include "L1Vector.h"
///
/// hits with hit-mcpoint match information
///
class CbmL1Hit {
public:
CbmL1Hit() {};
struct CbmL1Hit {
CbmL1Hit() = default;
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
......@@ -29,6 +27,7 @@ public:
int ID = 0; // TODO: check if this ID is redundant
int file = 0; // TODO: ??
int event = 0; // TODO: ??
L1Vector<int> mcPointIds {"CbmL1Hit::mcPointIds"}; // indices of CbmL1MCPoint in L1->vMCPoints array
};
#endif
......@@ -21,53 +21,12 @@
#ifndef CbmL1MCPoint_H
#define CbmL1MCPoint_H
#include <vector>
using std::vector;
#include "L1Vector.h"
struct CbmL1MCPoint {
CbmL1MCPoint()
: x(0)
, y(0)
, z(0)
, px(0)
, py(0)
, pz(0)
, xIn(0)
, yIn(0)
, zIn(0)
, pxIn(0)
, pyIn(0)
, pzIn(0)
, xOut(0)
, yOut(0)
, zOut(0)
, pxOut(0)
, pyOut(0)
, pzOut(0)
, p(0)
, q(0)
, mass(0)
, time(0)
, pdg(0)
, ID(0)
, mother_ID(0)
, iStation(0)
, pointId(-1)
, file(-1)
, event(-1)
, hitIds()
{
}
double x, y, z, px, py, pz;
double xIn, yIn, zIn, pxIn, pyIn, pzIn;
double xOut, yOut, zOut, pxOut, pyOut, pzOut;
double p, q, mass, time;
int pdg, ID, mother_ID;
int iStation;
int pointId;
int file;
int event;
CbmL1MCPoint() = default;
static bool compareIDz(const CbmL1MCPoint& a, const CbmL1MCPoint& b)
{
return (a.ID < b.ID) || ((a.ID == b.ID) && (a.z < b.z));
......@@ -78,7 +37,36 @@ struct CbmL1MCPoint {
return (a->ID < b->ID) || ((a->ID == b->ID) && (a->z < b->z));
}
vector<int> hitIds; // indices of CbmL1Hits in L1->vStsHits array
double x = 0.;
double y = 0.;
double z = 0.;
double px = 0.;
double py = 0.;
double pz = 0.;
double xIn = 0.;
double yIn = 0.;
double zIn = 0.;
double pxIn = 0.;
double pyIn = 0.;
double pzIn = 0.;
double xOut = 0.;
double yOut = 0.;
double zOut = 0.;
double pxOut = 0.;
double pyOut = 0.;
double pzOut = 0.;
double p = 0.;
double q = 0.;
double mass = 0.;
double time = 0.;
int pdg = 0;
int ID = 0;
int mother_ID = 0;
int iStation = 0;
int pointId = -1;
int file = -1;
int event = -1;
L1Vector<int> hitIds {"CbmL1MCPoint::hitIds"}; // indices of CbmL1Hits in L1->vStsHits array
};
#endif
......@@ -29,41 +29,18 @@
CbmL1MCTrack::CbmL1MCTrack(double mass_, double q_, TVector3 vr, TLorentzVector vp, int _ID, int _mother_ID, int _pdg)
: mass(mass_)
, q(q_)
, p(0)
, x(0)
, y(0)
, z(0)
, px(0)
, py(0)
, pz(0)
, time(0)
, p(vp.P())
, x(vr.X())
, y(vr.Y())
, z(vr.Z())
, px(vp.Px())
, py(vp.Py())
, pz(vp.Pz())
, ID(_ID)
, iFile(0)
, iEvent(0)
, mother_ID(_mother_ID)
, pdg(_pdg)
, Points()
, StsHits()
, nMCContStations(0)
, nHitContStations(0)
, maxNStaMC(0)
, maxNSensorMC(0)
, maxNStaHits(0)
, nStations(0)
, nMCStations(0)
, isReconstructable(0)
, isAdditional()
, rTracks()
, tTracks()
{
x = vr.X();
y = vr.Y();
z = vr.Z();
px = vp.Px();
py = vp.Py();
pz = vp.Pz();
p = sqrt(fabs(px * px + py * py + pz * pz));
};
}
// CbmL1MCTrack::CbmL1MCTrack(TmpMCPoints &mcPoint, TVector3 vr, TLorentzVector vp, int ID, int mother_ID):
// ID(_ID), mother_ID(_mother_ID)
......@@ -90,7 +67,7 @@ void CbmL1MCTrack::Init()
CbmL1MCPoint* point = &(L1->vMCPoints[Points[iP]]);
for (unsigned int iH = 0; iH < point->hitIds.size(); iH++) {
const int iih = point->hitIds[iH];
if (std::find(StsHits.begin(), StsHits.end(), iih) == StsHits.end()) StsHits.push_back(iih);
if (std::find(StsHits.begin(), StsHits.end(), iih) == StsHits.end()) StsHits.push_back_no_warning(iih);
}
}
......@@ -146,9 +123,9 @@ void CbmL1MCTrack::CalculateHitCont()
int istaold = -1, ncont = 0;
{
for (int ih = 0; ih < nhits; ih++) {
int jh = StsHits[ih];
const L1Hit& h = (*algo->vStsHits)[jh];
int ista = (*algo->fStripFlag)[h.f] / 4;
int jh = StsHits[ih];
const L1Hit& h = (*algo->vStsHits)[jh];
int ista = (*algo->fStripFlag)[h.f] / 4;
if (ista - istaold == 1) ncont++;
else if (ista - istaold > 1) {
......
......@@ -27,77 +27,17 @@
#include "TVector3.h"
#include <iostream>
#include <vector>
using std::vector;
#include "L1Vector.h"
class CbmL1Track;
class CbmL1MCTrack {
public:
double mass, q, p, x, y, z, px, py, pz, time;
int ID, iFile, iEvent, mother_ID, pdg;
vector<int> Points; // indices of pints in L1::vMCPoints
vector<int> StsHits; // indices of hits in algo->vStsHits or L1::vStsHits
CbmL1MCTrack()
: mass(0.)
, q(0.)
, p(0.)
, x(0.)
, y(0.)
, z(0.)
, px(0.)
, py(0.)
, pz(0.)
, time(0.)
, ID(-1)
, iFile(-1)
, iEvent(-1)
, mother_ID(-1)
, pdg(-1)
, Points()
, StsHits()
, nMCContStations(0)
, nHitContStations(0)
, maxNStaMC(0)
, maxNSensorMC(0)
, maxNStaHits(0)
, nStations(0)
, nMCStations(0)
, isReconstructable(0)
, isAdditional(0)
, rTracks()
, tTracks() {};
CbmL1MCTrack(int _ID)
: mass(0.)
, q(0.)
, p(0.)
, x(0.)
, y(0.)
, z(0.)
, px(0.)
, py(0.)
, pz(0.)
, time(0.)
, ID(_ID)
, iFile(-1)