Skip to content

Commit

Permalink
Detectors/CPV,CTF,FIT,HMPID: make readability-braces-around-statement…
Browse files Browse the repository at this point in the history
…s happy
  • Loading branch information
anerokhi authored and sawenzel committed Oct 29, 2020
1 parent 99c695a commit ef71fd2
Show file tree
Hide file tree
Showing 27 changed files with 207 additions and 108 deletions.
3 changes: 2 additions & 1 deletion Detectors/CPV/calib/src/BadChannelMap.cxx
Expand Up @@ -79,8 +79,9 @@ void BadChannelMap::PrintStream(std::ostream& stream) const
// first sort bad channel IDs
stream << "Number of bad cells: " << mBadCells.count() << "\n";
for (int cellID = 0; cellID < mBadCells.size(); cellID++) {
if (mBadCells.test(cellID))
if (mBadCells.test(cellID)) {
stream << cellID << "\n";
}
}
}

Expand Down
12 changes: 8 additions & 4 deletions Detectors/CPV/reconstruction/src/Clusterer.cxx
Expand Up @@ -40,8 +40,9 @@ void Clusterer::process(gsl::span<const Digit> digits, gsl::span<const TriggerRe
{
clusters->clear(); //final out list of clusters
trigRec->clear();
if (cluMC)
if (cluMC) {
cluMC->clear();
}

for (const auto& tr : dtr) {
mFirstDigitInEvent = tr.getFirstEntry();
Expand Down Expand Up @@ -103,8 +104,9 @@ void Clusterer::makeClusters(gsl::span<const Digit> digits)
int iFirst = mFirstDigitInEvent; // first index of digit which potentially can be a part of cluster

for (int i = iFirst; i < mLastDigitInEvent; i++) {
if (digitsUsed[i - mFirstDigitInEvent])
if (digitsUsed[i - mFirstDigitInEvent]) {
continue;
}

const Digit& digitSeed = digits[i];
float digitSeedEnergy = calibrate(digitSeed.getAmplitude(), digitSeed.getAbsId());
Expand Down Expand Up @@ -134,8 +136,9 @@ void Clusterer::makeClusters(gsl::span<const Digit> digits)
short digitSeedAbsId = clu->getDigitAbsId(index);
index++;
for (Int_t j = iFirst; j < mLastDigitInEvent; j++) {
if (digitsUsed[j - mFirstDigitInEvent])
if (digitsUsed[j - mFirstDigitInEvent]) {
continue; // look through remaining digits
}
const Digit* digitN = &(digits[j]);
float digitNEnergy = calibrate(digitN->getAmplitude(), digitN->getAbsId());
if (isBadChannel(digitN->getAbsId())) { //remove digit
Expand Down Expand Up @@ -251,8 +254,9 @@ void Clusterer::unfoldOneCluster(FullCluster& iniClu, char nMax, gsl::span<int>
a[iclu] += mfij[idig][iclu] * mfij[idig][iclu];
b[iclu] += it.energy * mfij[idig][iclu];
for (int kclu = 0; kclu < nMax; kclu++) {
if (iclu == kclu)
if (iclu == kclu) {
continue;
}
c[iclu] += eMax[kclu] * mfij[idig][iclu] * mfij[idig][kclu];
}
}
Expand Down
Expand Up @@ -41,17 +41,20 @@ class GeometryParams final : public TNamed

void GetModuleAngle(int module, float angle[3][2]) const
{
for (int i = 0; i < 3; i++)
for (int ian = 0; ian < 2; ian++)
for (int i = 0; i < 3; i++) {
for (int ian = 0; ian < 2; ian++) {
angle[i][ian] = mModuleAngle[module][i][ian];
}
}
}

float GetCPVAngle(Int_t index) const { return mCPVAngle[index - 1]; }

void GetModuleCenter(int module, float* pos) const
{
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++) {
pos[i] = mModuleCenter[module][i];
}
}

int GetNModules() const { return mNModules; }
Expand Down
3 changes: 2 additions & 1 deletion Detectors/CPV/workflow/src/RecoWorkflow.cxx
Expand Up @@ -95,8 +95,9 @@ o2::framework::WorkflowSpec getWorkflow(bool propagateMC,
o2::framework::OutputSpec{"CPV", "DIGITSMCTR"}},
propagateMC));

if (enableDigitsPrinter)
if (enableDigitsPrinter) {
specs.emplace_back(o2::cpv::reco_workflow::getPhosDigitsPrinterSpec());
}

if (isEnabled(OutputType::Clusters)) {
// add clusterizer
Expand Down
3 changes: 2 additions & 1 deletion Detectors/CTF/test/test_ctf_io_tof.cxx
Expand Up @@ -67,8 +67,9 @@ BOOST_AUTO_TEST_CASE(CompressedClustersTest)
[](const Digit& a, const Digit& b) {
int strip1 = a.getChannel() / Geo::NPADS, strip2 = b.getChannel() / Geo::NPADS;
if (strip1 == strip2) {
if (a.getBC() == b.getBC())
if (a.getBC() == b.getBC()) {
return a.getTDC() < b.getTDC();
}
return a.getBC() < b.getBC();
}
return strip1 < strip2;
Expand Down
6 changes: 4 additions & 2 deletions Detectors/FIT/FDD/reconstruction/src/Reconstructor.cxx
Expand Up @@ -28,11 +28,13 @@ void Reconstructor::process(const o2::fdd::Digit& digitBC, gsl::span<const o2::f
Float_t adc = channel.mChargeADC;
Float_t time = channel.mTime;
//LOG(INFO) <<adc <<" "<<time;
if (time == o2::InteractionRecord::DummyTime)
if (time == o2::InteractionRecord::DummyTime) {
continue;
}
Float_t timeErr = 1;
if (adc > 1)
if (adc > 1) {
timeErr = 1 / adc;
}
if (channel.mPMNumber < 8) {
timeFDC += time / (timeErr * timeErr);
weightFDC += 1. / (timeErr * timeErr);
Expand Down
Expand Up @@ -52,8 +52,9 @@ class Detector : public o2::base::DetImpl<Detector>

std::vector<o2::fdd::Hit>* getHits(Int_t iColl)
{
if (iColl == 0)
if (iColl == 0) {
return mHits;
}
return nullptr;
}

Expand Down
25 changes: 16 additions & 9 deletions Detectors/FIT/FDD/simulation/src/Digitizer.cxx
Expand Up @@ -90,17 +90,19 @@ void Digitizer::createPulse(int nPhE, int parID, double timeHit, std::array<o2::

double time0 = cachedIR[0].bc2ns(); // start time of the 1st cashed BC
float timeDiff = time0 - timeHit;
if (channel < 9)
if (channel < 9) {
timeDiff += parameters.TimeDelayFDC;
else
} else {
timeDiff += parameters.TimeDelayFDA;
}

//LOG(INFO) <<"Ch = "<<channel<<" NphE = " << nPhE <<" timeDiff "<<timeDiff;
float charge = TMath::Qe() * parameters.PmGain * mBinSize / (mPmtTimeIntegral * ChargePerADC);

Bool_t added[nCachedIR];
for (int ir = 0; ir < nCachedIR; ir++)
for (int ir = 0; ir < nCachedIR; ir++) {
added[ir] = kFALSE;
}

constexpr float BinSizeInv = 1.0 / mBinSize;
for (int iPhE = 0; iPhE < nPhE; ++iPhE) {
Expand Down Expand Up @@ -195,8 +197,9 @@ void Digitizer::storeBC(const BCCache& bc,
int nBC = digitsBC.size();
digitsBC.emplace_back(first, 16, bc, mTriggers);

for (const auto& lbl : bc.labels)
for (const auto& lbl : bc.labels) {
labels.addElement(nBC, lbl);
}
}

//_____________________________________________________________________________
Expand All @@ -221,10 +224,11 @@ float Digitizer::simulateTimeCFD(const ChannelBCDataF& pulse)
int binShift = TMath::Nint(parameters.TimeShiftCFD / mBinSize);
for (int iBin = 0; iBin < NTimeBinsPerBC; ++iBin) {
//if (mTime[channel][iBin] != 0) std::cout << mTime[channel][iBin] / parameters.mChargePerADC << ", ";
if (iBin >= binShift)
if (iBin >= binShift) {
mTimeCFD[iBin] = 5.0 * pulse[iBin - binShift] - pulse[iBin];
else
} else {
mTimeCFD[iBin] = -1.0 * pulse[iBin];
}
}
for (int iBin = 1; iBin < NTimeBinsPerBC; ++iBin) {
if (mTimeCFD[iBin - 1] < 0 && mTimeCFD[iBin] >= 0) {
Expand Down Expand Up @@ -328,8 +332,9 @@ void Digitizer::finish() {}
int Digitizer::simulateLightYield(int pmt, int nPhot)
{
const float p = parameters.LightYield * PhotoCathodeEfficiency;
if (p == 1.0f || nPhot == 0)
if (p == 1.0f || nPhot == 0) {
return nPhot;
}
const int n = int(nPhot < 100 ? gRandom->Binomial(nPhot, p) : gRandom->Gaus(p * nPhot + 0.5, TMath::Sqrt(p * (1 - p) * nPhot)));
return n;
}
Expand All @@ -350,8 +355,9 @@ Double_t Digitizer::SinglePhESpectrum(Double_t* x, Double_t*)
{
// this function describes the PM amplitude response to a single photoelectron
Double_t y = x[0];
if (y < 0)
if (y < 0) {
return 0;
}
return (TMath::Poisson(y, PMNbOfSecElec) + PMTransparency * TMath::Poisson(y, 1.0));
}
//______________________________________________________________
Expand All @@ -361,8 +367,9 @@ void Digitizer::BCCache::print() const
for (int ic = 0; ic < 16; ic++) {
printf("Ch[%d] | ", ic);
for (int ib = 0; ib < NTimeBinsPerBC; ib++) {
if (ib % 10 == 0)
if (ib % 10 == 0) {
printf("%f ", pulse[ic][ib]);
}
}
printf("\n");
}
Expand Down
6 changes: 4 additions & 2 deletions Detectors/FIT/FT0/base/src/Geometry.cxx
Expand Up @@ -90,8 +90,10 @@ Geometry::Geometry() : mMCP{{0, 0, 0}}
gc[i] = -1 * ac[i];
}
// Set coordinate
for (int ipmt = 0; ipmt < 24; ipmt++)
for (int ipmt = 0; ipmt < 24; ipmt++) {
mMCP[ipmt].SetXYZ(xa[ipmt], xa[ipmt], zDetA);
for (int ipmt = 24; ipmt < 52; ipmt++)
}
for (int ipmt = 24; ipmt < 52; ipmt++) {
mMCP[ipmt].SetXYZ(xc2[ipmt - 24], yc2[ipmt - 24], zc2[ipmt - 24]);
}
}
3 changes: 2 additions & 1 deletion Detectors/FIT/FT0/raw/include/FT0Raw/DataBlockFT0.h
Expand Up @@ -55,8 +55,9 @@ class DataBlockPM : public DataBlockBase<DataBlockPM, RawHeaderPM, RawDataPM>
// put here code for raw data checking
void sanityCheck(bool& flag)
{
if (DataBlockWrapper<RawDataPM>::mNelements % 2 == 0 && DataBlockWrapper<RawDataPM>::mData[DataBlockWrapper<RawDataPM>::mNelements - 1].channelID == 0)
if (DataBlockWrapper<RawDataPM>::mNelements % 2 == 0 && DataBlockWrapper<RawDataPM>::mData[DataBlockWrapper<RawDataPM>::mNelements - 1].channelID == 0) {
DataBlockWrapper<RawDataPM>::mNelements--; //in case of half GBT-word filling
}
//TODO, Descriptor checking, Channel range
}
};
Expand Down
Expand Up @@ -60,9 +60,11 @@ class ReadRaw
static o2::ft0::LookUpTable linear()
{
std::vector<o2::ft0::Topo> lut_data(Nchannels_PM * NPMs);
for (int link = 0; link < NPMs; ++link)
for (int mcp = 0; mcp < Nchannels_PM; ++mcp)
for (int link = 0; link < NPMs; ++link) {
for (int mcp = 0; mcp < Nchannels_PM; ++mcp) {
lut_data[link * Nchannels_PM + mcp] = o2::ft0::Topo{link, mcp};
}
}

return o2::ft0::LookUpTable{lut_data};
}
Expand Down
6 changes: 4 additions & 2 deletions Detectors/FIT/FT0/reconstruction/src/ReadRaw.cxx
Expand Up @@ -173,8 +173,9 @@ void ReadRaw::readData(const std::string fileRaw, const o2::ft0::LookUpTable& lu
void ReadRaw::close()
{
LOG(INFO) << " CLOSE ";
if (mFileDest.is_open())
if (mFileDest.is_open()) {
mFileDest.close();
}
}
//_____________________________________________________________________________
void ReadRaw::writeDigits(std::string fileDataOut)
Expand All @@ -196,8 +197,9 @@ void ReadRaw::writeDigits(std::string fileDataOut)
std::vector<o2::ft0::ChannelData> chDataVec;
digitVec.reserve(mDigitAccum.size());
size_t numberOfChData = 0;
for (auto const& [intrec, digit] : mDigitAccum)
for (auto const& [intrec, digit] : mDigitAccum) {
numberOfChData += digit.getChDgData().size();
}
chDataVec.reserve(numberOfChData);
for (auto& [intrec, digit] : mDigitAccum) {
int first = gsl::narrow_cast<int>(chDataVec.size());
Expand Down
Expand Up @@ -94,8 +94,9 @@ class Digitizer
protected:
inline float signalForm(float x) const
{ // table lookup for the signal shape
if (x <= 0.0f)
if (x <= 0.0f) {
return 0.0f;
}
float const y = x / mParameters.bunchWidth * DP::SIGNAL_TABLE_SIZE;
int const index = std::floor(y);
if (index + 1 >= DP::SIGNAL_TABLE_SIZE) {
Expand All @@ -112,8 +113,9 @@ class Digitizer
auto const rem = y - index;
Vc::float_v val(0);
for (size_t i = 0; i < float_v::size(); ++i) {
if (y[i] < 0.0f)
if (y[i] < 0.0f) {
continue;
}
if (index[i] + 1 < DP::SIGNAL_TABLE_SIZE) {
val[i] = mSignalTable[index[i]] + rem[i] * (mSignalTable[index[i] + 1] - mSignalTable[index[i]]);
} else {
Expand Down Expand Up @@ -170,8 +172,9 @@ inline float signalForm_integral(float x)
using namespace std;
double const a = -0.45458;
double const b = -0.83344945;
if (x < 0)
if (x < 0) {
x = 0;
}
return -(exp(b * x) / b - exp(a * x) / a) / 7.8446501;
};

Expand Down
Expand Up @@ -59,9 +59,11 @@ class Digits2Raw
static o2::ft0::LookUpTable linear()
{
std::vector<o2::ft0::Topo> lut_data(Nchannels_PM * (NPMs - 1));
for (int link = 0; link < NPMs - 1; ++link)
for (int mcp = 0; mcp < Nchannels_PM; ++mcp)
for (int link = 0; link < NPMs - 1; ++link) {
for (int mcp = 0; mcp < Nchannels_PM; ++mcp) {
lut_data[link * Nchannels_PM + mcp] = o2::ft0::Topo{link, mcp};
}
}

return o2::ft0::LookUpTable{lut_data};
}
Expand Down
6 changes: 4 additions & 2 deletions Detectors/FIT/FT0/simulation/src/Detector.cxx
Expand Up @@ -478,8 +478,9 @@ void Detector::DefineOpticalProperties()
// Path of the optical properties input file
TString inputDir;
const char* aliceO2env = std::getenv("O2_ROOT");
if (aliceO2env)
if (aliceO2env) {
inputDir = aliceO2env;
}
inputDir += "/share/Detectors/FT0/files/";

TString optPropPath = inputDir + "quartzOptProperties.txt";
Expand Down Expand Up @@ -560,8 +561,9 @@ Bool_t Detector::RegisterPhotoE(float energy)
{
float eff = mPMTeff->Eval(energy);
float p = gRandom->Rndm();
if (p > eff)
if (p > eff) {
return kFALSE;
}

return kTRUE;
}
Expand Down
18 changes: 12 additions & 6 deletions Detectors/FIT/FT0/simulation/src/Digitizer.cxx
Expand Up @@ -161,15 +161,17 @@ void Digitizer::process(const std::vector<o2::ft0::HitType>* hits,

Int_t parent = -10;
for (auto const& hit : *hits) {
if (hit.GetEnergyLoss() > 0)
if (hit.GetEnergyLoss() > 0) {
continue;
}

Int_t hit_ch = hit.GetDetectorID();
Bool_t is_A_side = (hit_ch < 4 * mParameters.nCellsA);
Float_t time_compensate = is_A_side ? mParameters.A_side_cable_cmps : mParameters.C_side_cable_cmps;
Double_t hit_time = hit.GetTime() - time_compensate;
if (hit_time > 250)
if (hit_time > 250) {
continue; //not collect very slow particles
}
auto relBC = o2::InteractionRecord{hit_time};
if (mCache.size() <= relBC.bc) {
mCache.resize(relBC.bc + 1);
Expand All @@ -189,8 +191,9 @@ void Digitizer::storeBC(BCCache& bc,
std::vector<o2::ft0::ChannelData>& digitsCh,
o2::dataformats::MCTruthContainer<o2::ft0::MCLabel>& labels)
{
if (bc.hits.empty())
if (bc.hits.empty()) {
return;
}
int n_hit_A = 0, n_hit_C = 0, mean_time_A = 0, mean_time_C = 0;
int summ_ampl_A = 0, summ_ampl_C = 0;
int vertex_time;
Expand All @@ -216,14 +219,16 @@ void Digitizer::storeBC(BCCache& bc,
mDeadTimes[ipmt].intrec = firstBCinDeque;
mDeadTimes[ipmt].deadTime = cfd.deadTime;

if (!cfd.particle)
if (!cfd.particle) {
continue;
}
int smeared_time = 1000. * (*cfd.particle - mParameters.mCfdShift) * mParameters.ChannelWidthInverse;
bool is_time_in_signal_gate = (smeared_time > -mParameters.mTime_trg_gate && smeared_time < mParameters.mTime_trg_gate);
float charge = measure_amplitude(channel_times) * mParameters.charge2amp;
float amp = is_time_in_signal_gate ? mParameters.mV_2_Nchannels * charge : 0;
if (amp > 4095)
if (amp > 4095) {
amp = 4095;
}
LOG(DEBUG) << mEventID << " bc " << firstBCinDeque.bc << " orbit " << firstBCinDeque.orbit << ", ipmt " << ipmt << ", smeared_time " << smeared_time << " nStored " << nStored;
digitsCh.emplace_back(ipmt, smeared_time, int(amp), chain);
nStored++;
Expand Down Expand Up @@ -264,8 +269,9 @@ void Digitizer::storeBC(BCCache& bc,

digitsBC.emplace_back(first, nStored, firstBCinDeque, triggers, mEventID - 1);
size_t const nBC = digitsBC.size();
for (auto const& lbl : bc.labels)
for (auto const& lbl : bc.labels) {
labels.addElement(nBC - 1, lbl);
}
}
// Debug output -------------------------------------------------------------

Expand Down

0 comments on commit ef71fd2

Please sign in to comment.