Skip to content

Commit 3c5ceb0

Browse files
committed
clang format
1 parent 8ed8d3e commit 3c5ceb0

File tree

17 files changed

+130
-111
lines changed

17 files changed

+130
-111
lines changed

DataFormats/Detectors/TRD/include/DataFormatsTRD/CalGain.h

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,25 @@ class CalGain
3333

3434
void setMPVdEdx(int iDet, float mpv) { mMPVdEdx[iDet] = mpv; }
3535

36-
float getMPVdEdx(int iDet, bool defaultAvg = false) const {
36+
float getMPVdEdx(int iDet, bool defaultAvg = false) const
37+
{
3738
// if defaultAvg = false, we take the value stored whatever it is
3839
// if defaultAvg = true and we have default value or bad value stored, we take the average on all chambers instead
39-
if (!defaultAvg || isGoodGain(iDet)) return mMPVdEdx[iDet];
40-
else return getAverageGain();
40+
if (!defaultAvg || isGoodGain(iDet))
41+
return mMPVdEdx[iDet];
42+
else
43+
return getAverageGain();
4144
}
42-
43-
44-
float getAverageGain() const {
45+
46+
float getAverageGain() const
47+
{
4548
float averageGain = 0.;
4649
int ngood = 0;
47-
50+
4851
for (int iDet = 0; iDet < constants::MAXCHAMBER; iDet++) {
4952
if (isGoodGain(iDet)) {
5053
// The chamber has correct calibration
51-
ngood ++;
54+
ngood++;
5255
averageGain += mMPVdEdx[iDet];
5356
}
5457
}
@@ -59,10 +62,13 @@ class CalGain
5962
averageGain /= ngood;
6063
return averageGain;
6164
}
62-
63-
bool isGoodGain(int iDet) const {
64-
if (TMath::Abs(mMPVdEdx[iDet] - constants::MPVDEDXDEFAULT) > 1e-6) return true;
65-
else return false;
65+
66+
bool isGoodGain(int iDet) const
67+
{
68+
if (TMath::Abs(mMPVdEdx[iDet] - constants::MPVDEDXDEFAULT) > 1e-6)
69+
return true;
70+
else
71+
return false;
6672
}
6773

6874
private:

DataFormats/Detectors/TRD/include/DataFormatsTRD/CalVdriftExB.h

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,33 @@ class CalVdriftExB
3333

3434
void setVdrift(int iDet, float vd) { mVdrift[iDet] = vd; }
3535
void setExB(int iDet, float exb) { mExB[iDet] = exb; }
36-
37-
float getVdrift(int iDet, bool defaultAvg = false) const {
36+
37+
float getVdrift(int iDet, bool defaultAvg = false) const
38+
{
3839
// if defaultAvg = false, we take the value stored whatever it is
3940
// if defaultAvg = true and we have default value or bad value stored, we take the average on all chambers instead
40-
if (!defaultAvg || (isGoodExB(iDet) && isGoodVdrift(iDet))) return mVdrift[iDet];
41-
else return getAverageVdrift();
41+
if (!defaultAvg || (isGoodExB(iDet) && isGoodVdrift(iDet)))
42+
return mVdrift[iDet];
43+
else
44+
return getAverageVdrift();
4245
}
43-
float getExB(int iDet, bool defaultAvg = false) const {
44-
if (!defaultAvg || (isGoodExB(iDet) && isGoodVdrift(iDet))) return mExB[iDet];
45-
else return getAverageExB();
46+
float getExB(int iDet, bool defaultAvg = false) const
47+
{
48+
if (!defaultAvg || (isGoodExB(iDet) && isGoodVdrift(iDet)))
49+
return mExB[iDet];
50+
else
51+
return getAverageExB();
4652
}
47-
48-
float getAverageVdrift() const {
53+
54+
float getAverageVdrift() const
55+
{
4956
float averageVdrift = 0.;
5057
int ngood = 0;
51-
58+
5259
for (int iDet = 0; iDet < constants::MAXCHAMBER; iDet++) {
5360
if (isGoodExB(iDet) && isGoodVdrift(iDet)) {
5461
// Both values need to be correct to declare a chamber as well calibrated
55-
ngood ++;
62+
ngood++;
5663
averageVdrift += mVdrift[iDet];
5764
}
5865
}
@@ -64,14 +71,15 @@ class CalVdriftExB
6471
return averageVdrift;
6572
}
6673

67-
float getAverageExB() const {
74+
float getAverageExB() const
75+
{
6876
float averageExB = 0.;
6977
int ngood = 0;
70-
78+
7179
for (int iDet = 0; iDet < constants::MAXCHAMBER; iDet++) {
7280
if (isGoodExB(iDet) && isGoodVdrift(iDet)) {
7381
// Both values need to be correct to declare a chamber as well calibrated
74-
ngood ++;
82+
ngood++;
7583
averageExB += mExB[iDet];
7684
}
7785
}
@@ -83,26 +91,30 @@ class CalVdriftExB
8391
return averageExB;
8492
}
8593

86-
bool isGoodExB(int iDet) const {
94+
bool isGoodExB(int iDet) const
95+
{
8796
// check if value is well calibrated or not
8897
// default calibration if not enough entries
8998
// close to boundaries indicate a failed fit
9099
if (TMath::Abs(mExB[iDet] - constants::EXBDEFAULT) > 1e-6 &&
91100
TMath::Abs(mExB[iDet] - constants::EXBMIN) > 0.01 &&
92101
TMath::Abs(mExB[iDet] - constants::EXBMAX) > 0.01)
93102
return true;
94-
else return false;
103+
else
104+
return false;
95105
}
96106

97-
bool isGoodVdrift(int iDet) const {
107+
bool isGoodVdrift(int iDet) const
108+
{
98109
// check if value is well calibrated or not
99110
// default calibration if not enough entries
100111
// close to boundaries indicate a failed fit
101112
if (TMath::Abs(mVdrift[iDet] - constants::VDRIFTDEFAULT) > 1e-6 &&
102113
TMath::Abs(mVdrift[iDet] - constants::VDRIFTMIN) > 0.1 &&
103114
TMath::Abs(mVdrift[iDet] - constants::VDRIFTMAX) > 0.1)
104115
return true;
105-
else return false;
116+
else
117+
return false;
106118
}
107119

108120
private:

DataFormats/Detectors/TRD/include/DataFormatsTRD/Constants.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ constexpr int TIMEBINS = 30; ///< the number of time bins
7575
constexpr float MAXIMPACTANGLE = 25.f; ///< the maximum impact angle for tracks relative to the TRD detector plane to be considered for vDrift and ExB calibration
7676
constexpr int NBINSANGLEDIFF = 25; ///< the number of bins for the track angle used for the vDrift and ExB calibration based on the tracking
7777
constexpr double VDRIFTDEFAULT = 1.546; ///< default value for vDrift
78-
constexpr double VDRIFTMIN = 0.4; ///< min value for vDrift
79-
constexpr double VDRIFTMAX = 2.0; ///< max value for vDrift
78+
constexpr double VDRIFTMIN = 0.4; ///< min value for vDrift
79+
constexpr double VDRIFTMAX = 2.0; ///< max value for vDrift
8080
constexpr double EXBDEFAULT = 0.0; ///< default value for LorentzAngle
81-
constexpr double EXBMIN = -0.4; ///< min value for LorentzAngle
82-
constexpr double EXBMAX = 0.4; ///< max value for LorentzAngle
81+
constexpr double EXBMIN = -0.4; ///< min value for LorentzAngle
82+
constexpr double EXBMAX = 0.4; ///< max value for LorentzAngle
8383
constexpr int NBINSGAINCALIB = 320; ///< number of bins in the charge (Q0+Q1+Q2) histogram for gain calibration
8484
constexpr float MPVDEDXDEFAULT = 42.; ///< default Most Probable Value of TRD dEdx
8585
constexpr float T0DEFAULT = 1.2; ///< default value for t0

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ void BarrelAlignmentSpec::finaliseCCDB(o2::framework::ConcreteDataMatcher& match
312312
mTRDTransformer->setVdrift(iDet, ((const o2::trd::CalVdriftExB*)obj)->getVdrift(iDet, true));
313313
mTRDTransformer->setExB(iDet, ((const o2::trd::CalVdriftExB*)obj)->getExB(iDet, true));
314314
}
315-
//mTRDTransformer->setCalVdriftExB((const o2::trd::CalVdriftExB*)obj);
316315
return;
317316
}
318317
if (mTPCVDriftHelper.accountCCDBInputs(matcher, obj)) {

Detectors/TRD/base/include/TRDBase/TrackletTransformer.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ class TrackletTransformer
3030

3131
void init();
3232

33-
void setVdrift(int iDet, float vd) {mVdrift[iDet] = vd;}
34-
void setExB(int iDet, float exb) {mExB[iDet] = exb;}
33+
void setVdrift(int iDet, float vd) { mVdrift[iDet] = vd; }
34+
void setExB(int iDet, float exb) { mExB[iDet] = exb; }
3535
void setApplyXOR() { mApplyXOR = true; }
3636
void setApplyShift(bool f) { mApplyShift = f; }
3737
bool isShiftApplied() const { return mApplyShift; }
38-
39-
4038

4139
float calculateZ(int padrow, const PadPlane* padPlane) const;
4240

Detectors/TRD/base/src/TrackletTransformer.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ float TrackletTransformer::calculateDy(int detector, int slope, const PadPlane*
4040
{
4141
double padWidth = padPlane->getWidthIPad();
4242

43-
//float vDrift = mCalVdriftExB->getVdrift(detector, true);
44-
//float exb = mCalVdriftExB->getExB(detector, true);
43+
// float vDrift = mCalVdriftExB->getVdrift(detector, true);
44+
// float exb = mCalVdriftExB->getExB(detector, true);
4545
float vDrift = mVdrift[detector];
4646
float exb = mExB[detector];
4747

@@ -57,7 +57,7 @@ float TrackletTransformer::calculateDy(int detector, int slope, const PadPlane*
5757

5858
// assuming angle in Bailhache, fig. 4.17 would be positive in our calibration code
5959
double calibratedDy = rawDy - lorentzCorrection;
60-
60+
6161
return calibratedDy;
6262
}
6363

@@ -99,7 +99,7 @@ CalibratedTracklet TrackletTransformer::transformTracklet(Tracklet64 tracklet, b
9999
position = tracklet.getPositionBinSigned();
100100
slope = tracklet.getSlopeBinSigned();
101101
}
102-
102+
103103
// calculate raw local chamber space point
104104
const auto padPlane = mGeo->getPadPlane(detector);
105105

Detectors/TRD/calibration/include/TRDCalibration/CalibrationParams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ namespace trd
2525
/// VDrift and ExB calibration parameters.
2626
struct TRDCalibParams : public o2::conf::ConfigurableParamHelper<TRDCalibParams> {
2727
unsigned int nTrackletsMin = 5; ///< minimum amount of tracklets
28-
unsigned int nTrackletsMinLoose = 4; ///< minimum amount of tracklets if two layers with a large lever arm both have a hit
28+
unsigned int nTrackletsMinLoose = 4; ///< minimum amount of tracklets if two layers with a large lever arm both have a hit
2929
unsigned int chi2RedMax = 6; ///< maximum reduced chi2 acceptable for track quality
30-
size_t minEntriesChamber = 200; ///< minimum number of entries per chamber to fit single time slot
30+
size_t minEntriesChamber = 200; ///< minimum number of entries per chamber to fit single time slot
3131
size_t minEntriesTotal = 400'000; ///< minimum total required for meaningful fits
3232

3333
// For gain calibration

Detectors/TRD/calibration/include/TRDCalibration/CalibratorVdExB.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ class CalibratorVdExB final : public o2::calibration::TimeSlotCalibration<o2::tr
8888
private:
8989
bool mInitDone{false}; ///< flag to avoid creating the TProfiles multiple times
9090
const TRDCalibParams& mParams{TRDCalibParams::Instance()}; ///< reference to calibration parameters
91-
size_t mMinEntriesTotal{mParams.minEntriesTotal}; ///< minimum total number of angular deviations (on average ~3 entries per bin for each TRD chamber)
92-
size_t mMinEntriesChamber{mParams.minEntriesChamber}; ///< minimum number of angular deviations per chamber for accepting refitted value (~3 per bin)
91+
size_t mMinEntriesTotal{mParams.minEntriesTotal}; ///< minimum total number of angular deviations (on average ~3 entries per bin for each TRD chamber)
92+
size_t mMinEntriesChamber{mParams.minEntriesChamber}; ///< minimum number of angular deviations per chamber for accepting refitted value (~3 per bin)
9393
bool mEnableOutput{false}; ///< enable output of calibration fits and tprofiles in a root file instead of the ccdb
9494
std::unique_ptr<TFile> mOutFile{nullptr}; ///< output file
9595
std::unique_ptr<TTree> mOutTree{nullptr}; ///< output tree

Detectors/TRD/calibration/macros/manualCalibFit.C

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,23 @@ void manualCalibFit(int runNumber = 563335, bool usePreCorrFromCCDB = false)
6060
mNEntriesPerBinSum.fill(0);
6161
tree->SetBranchAddress("mHistogramEntries[13500]", &mHistogramEntries);
6262
tree->SetBranchAddress("mNEntriesPerBin[13500]", &mNEntriesPerBin);
63-
64-
// use precorr values from ccdb
63+
64+
// use precorr values from ccdb
6565
// necessary when the angular residuals were calculated already using ccdb calibration (e.g. in a local run)
66-
66+
6767
o2::trd::CalVdriftExB* calObject;
6868
if (usePreCorrFromCCDB) {
6969
auto& ccdbmgr = o2::ccdb::BasicCCDBManager::instance();
7070

7171
o2::ccdb::CcdbApi ccdb;
7272
ccdb.init("http://alice-ccdb.cern.ch");
7373
auto runDuration = ccdbmgr.getRunDuration(runNumber);
74-
74+
7575
std::map<std::string, std::string> metadata;
7676
std::map<std::string, std::string> headers;
77-
77+
7878
calObject = ccdb.retrieveFromTFileAny<o2::trd::CalVdriftExB>("TRD/Calib/CalVdriftExB", metadata, runDuration.first + 60000, &headers, "", "", "1689478811721");
7979
}
80-
8180

8281
//----------------------------------------------------
8382
// Configure Fitter
@@ -88,7 +87,8 @@ void manualCalibFit(int runNumber = 563335, bool usePreCorrFromCCDB = false)
8887
for (int iDet = 0; iDet < 540; ++iDet) {
8988
mFitFunctor.profiles[iDet] = std::make_unique<TProfile>(Form("profAngleDiff_%i", iDet), Form("profAngleDiff_%i", iDet), 25, -25.f, 25.f);
9089
if (usePreCorrFromCCDB) {
91-
if (calObject->isGoodExB(iDet)) counter++;
90+
if (calObject->isGoodExB(iDet))
91+
counter++;
9292
mFitFunctor.vdPreCorr[iDet] = calObject->getVdrift(iDet, true);
9393
mFitFunctor.laPreCorr[iDet] = calObject->getExB(iDet, true);
9494
}
@@ -137,13 +137,14 @@ void manualCalibFit(int runNumber = 563335, bool usePreCorrFromCCDB = false)
137137
printf("-------- Started fits\n");
138138
std::array<float, 540> laFitResults{};
139139
std::array<float, 540> vdFitResults{};
140-
140+
141141
TH1F* hVd = new TH1F("hVd", "v drift", 150, 0.5, 2.);
142142
TH1F* hLa = new TH1F("hLa", "lorentz angle", 200, -25., 25.);
143143
o2::trd::CalVdriftExB* calObjectOut = new o2::trd::CalVdriftExB();
144-
144+
145145
for (int iDet = 0; iDet < 540; ++iDet) {
146-
if (nEntriesDetTotal[iDet] < 75) continue;
146+
if (nEntriesDetTotal[iDet] < 75)
147+
continue;
147148
mFitFunctor.currDet = iDet;
148149
ROOT::Fit::Fitter fitter;
149150
double paramsStart[2];
@@ -165,19 +166,20 @@ void manualCalibFit(int runNumber = 563335, bool usePreCorrFromCCDB = false)
165166
auto fitResult = fitter.Result();
166167
laFitResults[iDet] = fitResult.Parameter(0);
167168
vdFitResults[iDet] = fitResult.Parameter(1);
168-
if (fitResult.MinFcnValue() > 0.03) continue;
169-
printf("Det %d: la=%.3f \tvd=%.3f \t100*minValue=%f \tentries=%d\n", iDet, laFitResults[iDet] * TMath::RadToDeg(), vdFitResults[iDet], 100*fitResult.MinFcnValue(), nEntriesDetTotal[iDet]);
169+
if (fitResult.MinFcnValue() > 0.03)
170+
continue;
171+
printf("Det %d: la=%.3f \tvd=%.3f \t100*minValue=%f \tentries=%d\n", iDet, laFitResults[iDet] * TMath::RadToDeg(), vdFitResults[iDet], 100 * fitResult.MinFcnValue(), nEntriesDetTotal[iDet]);
170172
hVd->Fill(vdFitResults[iDet]);
171-
hLa->Fill(laFitResults[iDet]* TMath::RadToDeg());
173+
hLa->Fill(laFitResults[iDet] * TMath::RadToDeg());
172174
calObjectOut->setVdrift(iDet, vdFitResults[iDet]);
173175
calObjectOut->setExB(iDet, laFitResults[iDet]);
174176
}
175177
printf("-------- Finished fits\n");
176-
177-
std::cout<<"number of chambers with enough entries: "<<hVd->GetEntries()<<std::endl;;
178-
std::cout<<"vdrift mean: "<<hVd->GetMean()<<" sigma: "<<hVd->GetStdDev()<<std::endl;
179-
std::cout<<"lorentz angle mean: "<<hLa->GetMean()<<" sigma: "<<hLa->GetStdDev()<<std::endl;
180-
178+
179+
std::cout << "number of chambers with enough entries: " << hVd->GetEntries() << std::endl;
180+
;
181+
std::cout << "vdrift mean: " << hVd->GetMean() << " sigma: " << hVd->GetStdDev() << std::endl;
182+
std::cout << "lorentz angle mean: " << hLa->GetMean() << " sigma: " << hLa->GetStdDev() << std::endl;
181183

182184
//----------------------------------------------------
183185
// Write
@@ -188,5 +190,4 @@ void manualCalibFit(int runNumber = 563335, bool usePreCorrFromCCDB = false)
188190
outFilePtr->WriteObjectAny(calObjectOut, "o2::trd::CalVdriftExB", "calObject");
189191
for (auto& p : mFitFunctor.profiles)
190192
p->Write();
191-
192193
}

Detectors/TRD/calibration/src/CalibratorVdExB.cxx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,19 @@ void CalibratorVdExB::initProcessing()
111111
float bz = o2::base::Propagator::Instance()->getNominalBz();
112112
// default angle with zero field is slightly shifted
113113
float lorentzAngleAvg = -1.f;
114-
if (TMath::Abs(bz - 2) < 0.1f) { lorentzAngleAvg = 3.f;}
115-
if (TMath::Abs(bz + 2) < 0.1f) { lorentzAngleAvg = -5.f;}
116-
if (TMath::Abs(bz - 5) < 0.1f) { lorentzAngleAvg = 7.f;}
117-
if (TMath::Abs(bz + 5) < 0.1f) { lorentzAngleAvg = -9.f;}
118-
114+
if (TMath::Abs(bz - 2) < 0.1f) {
115+
lorentzAngleAvg = 3.f;
116+
}
117+
if (TMath::Abs(bz + 2) < 0.1f) {
118+
lorentzAngleAvg = -5.f;
119+
}
120+
if (TMath::Abs(bz - 5) < 0.1f) {
121+
lorentzAngleAvg = 7.f;
122+
}
123+
if (TMath::Abs(bz + 5) < 0.1f) {
124+
lorentzAngleAvg = -9.f;
125+
}
126+
119127
LOGP(info, "b field: {} lorentz angle start: {}", bz, lorentzAngleAvg);
120128

121129
mFitFunctor.lowerBoundAngleFit = (80 + lorentzAngleAvg) * TMath::DegToRad();

0 commit comments

Comments
 (0)