Skip to content

Commit b1ca536

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents 847793b + 577a7f0 commit b1ca536

File tree

108 files changed

+3334
-916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+3334
-916
lines changed

DataFormats/Detectors/TOF/include/DataFormatsTOF/Cluster.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,19 @@ class Cluster : public o2::BaseCluster<float>
4949
kDownRight = 4, // 2^4, 5th bit
5050
kDown = 5, // 2^5, 6th bit
5151
kDownLeft = 6, // 2^6, 7th bit
52-
kLeft = 7 }; // 2^7, 8th bit
52+
kLeft = 7, // 2^7, 8th bit
53+
//
54+
FrameBit = 6 }; // this bit set means that the cluster is in the nominal (alpha=20*sector+10 deg.) sector frame rather than aligned
5355

5456
Cluster() = default;
5557

5658
Cluster(std::int16_t sensid, float x, float y, float z, float sy2, float sz2, float syz, double timeRaw, double time, float tot, int L0L1latency, int deltaBC, float geanttime = 0.0, double t0 = 0.0);
5759

5860
~Cluster() = default;
5961

62+
bool isInNominalSector() const { return isBitSet(FrameBit); }
63+
void setInNominalSector() { setBit(FrameBit); }
64+
6065
std::int8_t getSector() const { return getCount(); }
6166
void setSector(std::int8_t value) { setCount(value); }
6267

DataFormats/Detectors/TPC/src/DCS.cxx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,27 @@ void fillBuffer(std::pair<std::vector<float>, std::vector<TimeStampType>>& buffe
329329
}
330330
}
331331

332-
std::pair<std::vector<float>, std::vector<TimeStampType>> buffTmp{
333-
std::vector<float>(buffer.first.begin() + idxStartBuffer, buffer.first.end()),
334-
std::vector<TimeStampType>(buffer.second.begin() + idxStartBuffer, buffer.second.end())};
335-
336-
buffTmp.first.insert(buffTmp.first.end(), values.first.begin(), values.first.end());
337-
buffTmp.second.insert(buffTmp.second.end(), values.second.begin(), values.second.end());
332+
std::pair<std::vector<float>, std::vector<TimeStampType>> buffTmp;
333+
auto& [buffVals, buffTimes] = buffTmp;
334+
335+
// Preallocate enough capacity to avoid reallocations
336+
buffVals.reserve(buffer.first.size() - idxStartBuffer + values.first.size());
337+
buffTimes.reserve(buffer.second.size() - idxStartBuffer + values.second.size());
338+
// Insert the kept part of the old buffer
339+
buffVals.insert(buffVals.end(), buffer.first.begin() + idxStartBuffer, buffer.first.end());
340+
buffTimes.insert(buffTimes.end(), buffer.second.begin() + idxStartBuffer, buffer.second.end());
341+
// Insert the new values
342+
buffVals.insert(buffVals.end(), values.first.begin(), values.first.end());
343+
buffTimes.insert(buffTimes.end(), values.second.begin(), values.second.end());
344+
345+
// this should not happen
346+
if (!std::is_sorted(buffTimes.begin(), buffTimes.end())) {
347+
LOGP(info, "Pressure buffer not sorted after filling - sorting it");
348+
std::vector<size_t> idx(buffTimes.size());
349+
o2::math_utils::SortData(buffTimes, idx);
350+
o2::math_utils::Reorder(buffVals, idx);
351+
o2::math_utils::Reorder(buffTimes, idx);
352+
}
338353

339354
buffer = std::move(buffTmp);
340355
}

DataFormats/Headers/include/Headers/Stack.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ struct Stack {
3636

3737
private:
3838
struct freeobj {
39-
freeobj(memory_resource* mr) : resource(mr) {}
39+
freeobj(memory_resource* mr, size_t s) : resource(mr), size(s) {}
4040
memory_resource* resource{nullptr};
41-
void operator()(std::byte* ptr) { resource->deallocate(ptr, 0, 0); }
41+
size_t size{0};
42+
void operator()(std::byte* ptr) { resource->deallocate(ptr, size, alignof(std::max_align_t)); }
4243
};
4344

4445
public:
@@ -99,7 +100,7 @@ struct Stack {
99100
Stack(const allocator_type allocatorArg, Headers&&... headers)
100101
: allocator{allocatorArg},
101102
bufferSize{calculateSize(std::forward<Headers>(headers)...)},
102-
buffer{static_cast<std::byte*>(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource()}}
103+
buffer{static_cast<std::byte*>(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource(), bufferSize}}
103104
{
104105
if constexpr (sizeof...(headers) > 1) {
105106
injectAll(buffer.get(), std::forward<Headers>(headers)...);
@@ -142,7 +143,7 @@ struct Stack {
142143
private:
143144
allocator_type allocator{fair::mq::pmr::new_delete_resource()};
144145
size_t bufferSize{0};
145-
BufferType buffer{nullptr, freeobj{allocator.resource()}};
146+
BufferType buffer{nullptr, freeobj{allocator.resource(), 0}};
146147

147148
//______________________________________________________________________________________________
148149
template <typename T>

DataFormats/Reconstruction/include/ReconstructionDataFormats/MatchInfoTOF.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ class MatchInfoTOF
8686
hasT0_1BCbefore = 0x1 << 8,
8787
hasT0_2BCbefore = 0x1 << 9 };
8888

89+
void setFT0Best(double val, float res = 200.)
90+
{
91+
mFT0Best = val;
92+
mFT0BestRes = res;
93+
}
94+
double getFT0Best() const { return mFT0Best; }
95+
float getFT0BestRes() const { return mFT0BestRes; }
96+
8997
private:
9098
int mIdLocal; // track id in sector of the pair track-TOFcluster
9199
float mChi2; // chi2 of the pair track-TOFcluster
@@ -106,7 +114,10 @@ class MatchInfoTOF
106114
float mTgeant = 0.0; ///< geant time in MC
107115
double mT0true = 0.0; ///< t0true
108116

109-
ClassDefNV(MatchInfoTOF, 8);
117+
double mFT0Best = 0.0; //< best info for collision time
118+
float mFT0BestRes = 200.0; //< resolution (in ps) of the best info for collision time
119+
120+
ClassDefNV(MatchInfoTOF, 9);
110121
};
111122
} // namespace dataformats
112123
} // namespace o2

DataFormats/common/include/CommonDataFormat/InteractionRecord.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ struct InteractionRecord {
281281
return tmp;
282282
}
283283

284-
#ifndef GPUCA_ALIGPUCODE
284+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
285285
void print() const;
286286
std::string asString() const;
287287
friend std::ostream& operator<<(std::ostream& stream, InteractionRecord const& ir);
@@ -359,7 +359,7 @@ struct InteractionTimeRecord : public InteractionRecord {
359359
return !((*this) > other);
360360
}
361361

362-
#ifndef GPUCA_ALIGPUCODE
362+
#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
363363
void print() const;
364364
std::string asString() const;
365365
friend std::ostream& operator<<(std::ostream& stream, InteractionTimeRecord const& ir);

Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ int main(int argc, char** argv)
125125
} else {
126126
std::cout << "Storing:" << ccdbPath << " tmin:" << tmin << " tmax:" << tmax << " ts:" << tt << std::endl;
127127
std::string filename = "orbitReset.root";
128-
TClass* tcls = TClass::GetClass(typeid(vect));
129-
auto ti = tcls->GetTypeInfo();
130128
auto classname = "std::vector<int64_t>";
131129
metadata["adjustableEOV"] = "true";
132-
ret = api.storeAsTFile_impl(&(vect), *ti, ccdbPath, metadata, tmin, tmax);
130+
ret = api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax);
133131
o2::ccdb::CcdbObjectInfo oi(ccdbPath, classname, filename, metadata, tmin, tmax);
134132
adjustOverriddenEOV(api, oi);
135133
}

Detectors/CTP/workflowScalers/src/ctpCCDBManager.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,14 @@ int ctpCCDBManager::saveOrbitReset(long timeStamp)
157157
o2::ccdb::CcdbApi api;
158158
std::map<std::string, std::string> metadata; // can be empty
159159
api.init(mCCDBHost.c_str()); // or http://localhost:8080 for a local installation
160-
161-
// store abitrary user object in strongly typed manner
162-
int ret = api.storeAsTFileAny(&vect, mCCDBPathOrbitReset, metadata, tmin, tmax);
160+
// int ret = api.storeAsTFileAny(&vect, mCCDBPathOrbitReset, metadata, tmin, tmax);
161+
std::cout << "Storing:" << mCCDBPathOrbitReset << " tmin:" << tmin << " tmax:" << tmax << " ts:" << timeStamp << std::endl;
162+
std::string filename = "orbitReset.root";
163+
auto classname = "std::vector<int64_t>";
164+
metadata["adjustableEOV"] = "true";
165+
int ret = api.storeAsTFileAny(&(vect), mCCDBPathOrbitReset, metadata, tmin, tmax);
166+
o2::ccdb::CcdbObjectInfo oi(mCCDBPathOrbitReset, classname, filename, metadata, tmin, tmax);
167+
adjustOverriddenEOV(api, oi);
163168
if (ret == 0) {
164169
LOG(info) << "Orbit reset saved in ccdb:" << mCCDBHost << " tmin:" << tmin << " tmax:" << tmax;
165170
} else {

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,8 @@ void MatchTOF::doMatchingForTPC(int sec)
15811581
//______________________________________________
15821582
int MatchTOF::findFITIndex(int bc, const gsl::span<const o2::ft0::RecPoints>& FITRecPoints, unsigned long firstOrbit)
15831583
{
1584+
const auto& FT0Params = o2::ft0::InteractionTag::Instance();
1585+
15841586
if ((!mHasFillScheme) && o2::tof::Utils::hasFillScheme()) {
15851587
mHasFillScheme = true;
15861588
for (int ibc = 0; ibc < o2::tof::Utils::getNinteractionBC(); ibc++) {
@@ -1598,6 +1600,10 @@ int MatchTOF::findFITIndex(int bc, const gsl::span<const o2::ft0::RecPoints>& FI
15981600
const int distThr = 8;
15991601

16001602
for (unsigned int i = 0; i < FITRecPoints.size(); i++) {
1603+
const auto& ft = FITRecPoints[i];
1604+
if (!FT0Params.isSelected(ft)) {
1605+
continue;
1606+
}
16011607
const o2::InteractionRecord ir = FITRecPoints[i].getInteractionRecord();
16021608
if (mHasFillScheme && !mFillScheme[ir.bc]) {
16031609
continue;
@@ -1702,8 +1708,8 @@ void MatchTOF::BestMatches(std::vector<o2::dataformats::MatchInfoTOFReco>& match
17021708
matchingPair.setT0true(TOFClusWork[matchingPair.getTOFClIndex()].getT0true());
17031709

17041710
// let's check if cluster has multiple-hits (noferini)
1705-
if (TOFClusWork[matchingPair.getTOFClIndex()].getNumOfContributingChannels() > 1) {
1706-
const auto& tofcl = TOFClusWork[matchingPair.getTOFClIndex()];
1711+
const auto& tofcl = TOFClusWork[matchingPair.getTOFClIndex()];
1712+
if (tofcl.getNumOfContributingChannels() > 1) {
17071713
// has an additional hit Up or Down (Z-dir)
17081714
matchingPair.setHitPatternUpDown(tofcl.isAdditionalChannelSet(o2::tof::Cluster::kUp) ||
17091715
tofcl.isAdditionalChannelSet(o2::tof::Cluster::kUpLeft) ||
@@ -1719,6 +1725,19 @@ void MatchTOF::BestMatches(std::vector<o2::dataformats::MatchInfoTOFReco>& match
17191725
tofcl.isAdditionalChannelSet(o2::tof::Cluster::kDownRight) ||
17201726
tofcl.isAdditionalChannelSet(o2::tof::Cluster::kUpRight));
17211727
}
1728+
1729+
// estimate collision time using FT0 info if available
1730+
ULong64_t bclongtofCal = (matchingPair.getSignal() - 10000) * o2::tof::Geo::BC_TIME_INPS_INV;
1731+
double t0Best = bclongtofCal * o2::tof::Geo::BC_TIME_INPS; // here just BC
1732+
float t0BestRes = 200;
1733+
if (FITRecPoints.size() > 0) {
1734+
int index = findFITIndex(bclongtofCal, FITRecPoints, mFirstTForbit);
1735+
if (index > -1 && FITRecPoints[index].isValidTime(1) && FITRecPoints[index].isValidTime(2)) { // require A and C
1736+
t0Best += FITRecPoints[index].getCollisionTime(0);
1737+
t0BestRes = 15;
1738+
}
1739+
}
1740+
matchingPair.setFT0Best(t0Best, t0BestRes);
17221741
matchedTracks[trkTypeSplitted].push_back(matchingPair); // array of MatchInfoTOF
17231742

17241743
// get fit info

Detectors/GlobalTrackingWorkflow/src/tof-matcher-workflow.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
114114
}
115115
}
116116

117-
if (!writecalib) {
118-
useFIT = false;
119-
}
117+
// if (!writecalib) {
118+
// useFIT = false;
119+
// }
120120

121121
LOG(debug) << "TOF MATCHER WORKFLOW configuration";
122122
LOG(debug) << "TOF track inputs = " << configcontext.options().get<std::string>("track-sources");

Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCInterpolationSpec.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ namespace tpc
3838
class TPCInterpolationDPL : public Task
3939
{
4040
public:
41-
TPCInterpolationDPL(std::shared_ptr<o2::globaltracking::DataRequest> dr, o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC, bool processITSTPConly, bool sendTrackData, bool debugOutput) : mDataRequest(dr), mSources(src), mSourcesMap(srcMap), mGGCCDBRequest(gr), mUseMC(useMC), mProcessITSTPConly(processITSTPConly), mSendTrackData(sendTrackData), mDebugOutput(debugOutput) {}
41+
TPCInterpolationDPL(std::shared_ptr<o2::globaltracking::DataRequest> dr, o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC,
42+
bool processITSTPConly, bool sendTrackData, bool debugOutput, bool extDetResid) : mDataRequest(dr), mSources(src), mSourcesMap(srcMap), mGGCCDBRequest(gr), mUseMC(useMC), mProcessITSTPConly(processITSTPConly), mSendTrackData(sendTrackData), mDebugOutput(debugOutput), mExtDetResid(extDetResid) {}
4243
~TPCInterpolationDPL() override = default;
4344
void init(InitContext& ic) final;
4445
void run(ProcessingContext& pc) final;
@@ -58,14 +59,16 @@ class TPCInterpolationDPL : public Task
5859
bool mProcessITSTPConly{false}; ///< should also tracks without outer point (ITS-TPC only) be processed?
5960
bool mProcessSeeds{false}; ///< process not only most complete track, but also its shorter parts
6061
bool mDebugOutput{false}; ///< add more information to the output (track points of ITS, TRD and TOF)
62+
bool mExtDetResid{true}; ///< produce unbinned residuals for external detectors
6163
bool mSendTrackData{false}; ///< if true, not only the clusters but also corresponding track data will be sent
6264
uint32_t mSlotLength{600u}; ///< the length of one calibration slot required to calculate max number of tracks per TF
6365
int mMatCorr{2}; ///< the material correction to be used for track interpolation
6466
TStopwatch mTimer;
6567
};
6668

6769
/// create a processor spec
68-
framework::DataProcessorSpec getTPCInterpolationSpec(o2::dataformats::GlobalTrackID::mask_t srcCls, o2::dataformats::GlobalTrackID::mask_t srcVtx, o2::dataformats::GlobalTrackID::mask_t srcTrk, o2::dataformats::GlobalTrackID::mask_t srcTrkMap, bool useMC, bool processITSTPConly, bool sendTrackData, bool debugOutput);
70+
framework::DataProcessorSpec getTPCInterpolationSpec(o2::dataformats::GlobalTrackID::mask_t srcCls, o2::dataformats::GlobalTrackID::mask_t srcVtx, o2::dataformats::GlobalTrackID::mask_t srcTrk,
71+
o2::dataformats::GlobalTrackID::mask_t srcTrkMap, bool useMC, bool processITSTPConly, bool sendTrackData, bool debugOutput, bool extDetResid);
6972

7073
} // namespace tpc
7174
} // namespace o2

0 commit comments

Comments
 (0)