Skip to content

Commit ea6be64

Browse files
committed
add fill scheme info in TOF event time checker
1 parent ccbb2a0 commit ea6be64

File tree

6 files changed

+64
-9
lines changed

6 files changed

+64
-9
lines changed

Detectors/GlobalTrackingWorkflow/src/TOFEventTimeChecker.cxx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
// from TOF
3737
#include "TOFBase/Geo.h"
38+
#include "TOFBase/Utils.h"
3839
#include "DataFormatsTOF/Cluster.h"
3940
#include "TOFReconstruction/EventTimeMaker.h"
4041
//#include "GlobalTracking/MatchTOF.h"
@@ -75,7 +76,7 @@ using TimeSlewing = o2::dataformats::CalibTimeSlewingParamTOF;
7576

7677
bool MyFilter(const MyTrack& tr)
7778
{
78-
return (tr.mP < 2.0 && fabs(tr.mEta) < 0.8);
79+
return (tr.mP < 2.0 && tr.mEta > o2::tof::Utils::mEtaMin && tr.mEta < o2::tof::Utils::mEtaMax);
7980
} // accept all
8081

8182
namespace o2
@@ -150,12 +151,22 @@ void TOFEventTimeChecker::processEvent(std::vector<MyTrack>& tracks)
150151
{
151152
int nBC = int(tracks[0].tofSignalDouble() * o2::tof::Geo::BC_TIME_INPS_INV);
152153
for (auto& track : tracks) {
153-
track.mSignal = float(track.mSignalDouble - double(o2::tof::Geo::BC_TIME_INPS) * nBC);
154+
if (!o2::tof::Utils::hasFillScheme()) {
155+
track.mSignal = float(track.mSignalDouble - double(o2::tof::Geo::BC_TIME_INPS) * nBC);
156+
} else {
157+
double localTime = track.mSignalDouble;
158+
159+
// get into orbit
160+
int bcStarOrbit = int(localTime * o2::tof::Geo::BC_TIME_INPS_INV);
161+
bcStarOrbit = (bcStarOrbit / o2::constants::lhc::LHCMaxBunches) * o2::constants::lhc::LHCMaxBunches; // truncation
162+
localTime -= bcStarOrbit * o2::tof::Geo::BC_TIME_INPS;
163+
track.mSignal = o2::tof::Utils::subtractInteractionBC(localTime);
164+
}
154165
}
155166

156167
auto evtime = o2::tof::evTimeMaker<std::vector<MyTrack>, MyTrack, MyFilter>(tracks);
157168

158-
if (evtime.eventTime < -2000 || evtime.eventTime > 2000) {
169+
if (evtime.eventTime - o2::tof::Utils::mLHCPhase < -2000 || evtime.eventTime - o2::tof::Utils::mLHCPhase > 2000) {
159170
return;
160171
}
161172
//
@@ -437,14 +448,14 @@ void TOFEventTimeChecker::run(ProcessingContext& pc)
437448
tracks.emplace_back(mMyTracks[i]);
438449
for (; i < mMyTracks.size(); i++) {
439450
double timeCurrent = mMyTracks[i].tofSignalDouble();
440-
if (timeCurrent - time > 25E3) {
451+
if (timeCurrent - time > 100E3) {
441452
i--;
442453
break;
443454
}
444455
tracks.emplace_back(mMyTracks[i]);
445456
ntrk++;
446457
}
447-
if (ntrk > 2) { // good candidate with time
458+
if (ntrk > 0) { // good candidate with time
448459
processEvent(tracks);
449460
}
450461
}

Detectors/GlobalTrackingWorkflow/src/tof-eventtime-checker-workflow.cxx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "DetectorsRaw/HBFUtilsInitializer.h"
2727
#include "Framework/CallbacksPolicy.h"
2828
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
29+
#include "TOFBase/Utils.h"
2930

3031
using namespace o2::framework;
3132
using DetID = o2::detectors::DetID;
@@ -45,6 +46,11 @@ void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
4546
{"disable-root-input", o2::framework::VariantType::Bool, false, {"disable root-files input reader"}},
4647
{"disable-root-output", o2::framework::VariantType::Bool, false, {"disable root-files output writer"}},
4748
{"track-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use: allowed TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF (all)"}},
49+
{"event-time-spread", o2::framework::VariantType::Float, 200.0f, {"Event time spread"}},
50+
{"lhc-phase", o2::framework::VariantType::Float, 0.0f, {"LHCp phase"}},
51+
{"eta-min", o2::framework::VariantType::Float, -0.8f, {"min tof eta"}},
52+
{"eta-max", o2::framework::VariantType::Float, 0.8f, {"max tof eta"}},
53+
{"fill-mask", o2::framework::VariantType::String, "", {"fill scheme, collision bunches"}},
4854
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}}};
4955

5056
std::swap(workflowOptions, options);
@@ -67,6 +73,33 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6773
auto disableRootIn = configcontext.options().get<bool>("disable-root-input");
6874
auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
6975

76+
auto spread = configcontext.options().get<float>("event-time-spread");
77+
auto phase = configcontext.options().get<float>("lhc-phase");
78+
auto minEta = configcontext.options().get<float>("eta-min");
79+
auto maxEta = configcontext.options().get<float>("eta-max");
80+
auto fillscheme = configcontext.options().get<std::string>("fill-mask");
81+
82+
o2::tof::Utils::mEventTimeSpread = spread;
83+
o2::tof::Utils::mLHCPhase = phase;
84+
o2::tof::Utils::mEtaMin = minEta;
85+
o2::tof::Utils::mEtaMax = maxEta;
86+
87+
while (fillscheme.size()) {
88+
int bc;
89+
int res = sscanf(fillscheme.c_str(), "%d", &bc);
90+
if (res) {
91+
o2::tof::Utils::addInteractionBC(bc);
92+
} else {
93+
fillscheme.clear();
94+
}
95+
int next = fillscheme.find(",");
96+
if (next < fillscheme.size()) {
97+
fillscheme.erase(0, next + 1);
98+
} else {
99+
fillscheme.clear();
100+
}
101+
}
102+
70103
LOG(DEBUG) << "TOF EVENTTIME CHECKER WORKFLOW configuration";
71104
LOG(DEBUG) << "TOF track inputs = " << configcontext.options().get<std::string>("track-sources");
72105
LOG(DEBUG) << "TOF disable-mc = " << configcontext.options().get<std::string>("disable-mc");

Detectors/TOF/base/include/TOFBase/Utils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ class Utils
3939
static void init();
4040
static void printFillScheme();
4141

42+
// info can be tuned
43+
static float mEventTimeSpread;
44+
static float mEtaMin;
45+
static float mEtaMax;
46+
static float mLHCPhase;
47+
4248
private:
4349
static std::vector<int> mFillScheme;
4450
static int mBCmult[o2::constants::lhc::LHCMaxBunches];

Detectors/TOF/base/src/Utils.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ int Utils::mBCmult[o2::constants::lhc::LHCMaxBunches];
2929
int Utils::mNautodet = 0;
3030
int Utils::mMaxBC = 0;
3131
bool Utils::mIsInit = false;
32+
float Utils::mEventTimeSpread = 200;
33+
float Utils::mEtaMin = -0.8;
34+
float Utils::mEtaMax = 0.8;
35+
float Utils::mLHCPhase = 0;
3236

3337
void Utils::init()
3438
{

Detectors/TOF/reconstruction/include/TOFReconstruction/EventTimeMaker.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "TRandom.h"
1919
#include "TMath.h"
20+
#include "TOFBase/Utils.h"
2021

2122
namespace o2
2223
{
@@ -68,7 +69,7 @@ struct eventTimeTrackTest : eventTimeTrack {
6869
int mHypo = 0;
6970
};
7071

71-
void generateEvTimeTracks(std::vector<eventTimeTrackTest>& tracks, int ntracks, float evTime = 0.f);
72+
void generateEvTimeTracks(std::vector<eventTimeTrackTest>& tracks, int ntracks, float evTime = Utils::mLHCPhase);
7273

7374
template <typename trackType>
7475
bool filterDummy(const trackType& tr)
@@ -80,7 +81,7 @@ void computeEvTime(const std::vector<eventTimeTrack>& tracks, const std::vector<
8081
int getStartTimeInSet(const std::vector<eventTimeTrack>& tracks, std::vector<int>& trackInSet, unsigned long& bestComb);
8182

8283
template <typename trackTypeContainer, typename trackType, bool (*trackFilter)(const trackType&)>
83-
eventTimeContainer evTimeMaker(const trackTypeContainer& tracks, float diamond = 6. /* spread of primary verdex in cm */)
84+
eventTimeContainer evTimeMaker(const trackTypeContainer& tracks, float diamond = Utils::mEventTimeSpread * 0.029979246 /* spread of primary verdex in cm */)
8485
{
8586
static std::vector<eventTimeTrack> trkWork;
8687
trkWork.clear();

Detectors/TOF/reconstruction/src/Decoder.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ void Decoder::InsertDigit(int icrate, int itrm, int itdc, int ichain, int channe
127127
{
128128
DigitInfo digitInfo;
129129

130-
if (icrate % 2 == 1 && itrm == 3 && itdc / 3 > 0) { // Signal not coming from a TOF pad but -probably- from a TOF OR signal
131-
// add operation on LTM (Trigger) if needed (not used)
130+
if (itrm == 3 && ((icrate % 2 == 0) || (itdc / 3 > 0))) { // Signal not coming from a TOF pad but -probably- from a TOF OR signal
131+
// add operation on LTM (Trigger) if needed (not used) if (crate % 2 == 1)
132132
return;
133133
}
134134

0 commit comments

Comments
 (0)