@@ -95,7 +95,7 @@ class TrackingStudySpec : public Task
9595 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut ;
9696 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOutVtx ;
9797 std::unique_ptr<o2::gpu::GPUO2InterfaceRefit> mTPCRefitter ; // /< TPC refitter used for TPC tracks refit during the reconstruction
98- std::vector<float > mTBinClOccAft , mTBinClOccBef , mTBinClOccWgh ; // /< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting/preceding from the TB = i*mNTPCOccBinLength
98+ std::vector<float > mMltHistTB , mTBinClOccAft , mTBinClOccBef , mTBinClOccWgh ; // /< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting/preceding from the TB = i*mNTPCOccBinLength
9999 std::unique_ptr<TF1> mOccWghFun ;
100100 float mITSROFrameLengthMUS = 0 .f;
101101 float mTPCTBinMUS = 0 .f; // TPC bin in microseconds
@@ -107,6 +107,7 @@ class TrackingStudySpec : public Task
107107 float mMinX = 46 .;
108108 float mMaxEta = 0.8 ;
109109 float mMinPt = 0.1 ;
110+ int mNOccBinsDrift = 10 ;
110111 int mMinTPCClusters = 60 ;
111112 int mNTPCOccBinLength = 0 ; // /< TPC occ. histo bin length in TBs
112113 int mNHBPerTF = 0 ;
@@ -142,6 +143,10 @@ void TrackingStudySpec::init(InitContext& ic)
142143 mDCAYFormula = ic.options ().get <std::string>(" dcay-vs-pt" );
143144 mDCAZFormula = ic.options ().get <std::string>(" dcaz-vs-pt" );
144145 mDoPairsCorr = ic.options ().get <bool >(" pair-correlations" );
146+ mNOccBinsDrift = ic.options ().get <int >(" noccbins" );
147+ if (mNOccBinsDrift < 3 ) {
148+ mNOccBinsDrift = 3 ;
149+ }
145150 auto str = ic.options ().get <std::string>(" occ-weight-fun" );
146151 if (!str.empty ()) {
147152 mOccWghFun = std::make_unique<TF1>(" occFun" , str.c_str (), -100 ., 100 .);
@@ -172,42 +177,23 @@ void TrackingStudySpec::run(ProcessingContext& pc)
172177 mTBinClOccAft .resize (nTPCOccBins);
173178 mTBinClOccBef .resize (nTPCOccBins);
174179 float sm = 0 ., tb = 0.5 * mNTPCOccBinLength ;
175- /* // at the moment not used
176- if (mOccWghFun) {
177- mTBinClOccWgh.resize(nTPCBins);
178- float occBin2MUS = 8 * o2::constants::lhc::LHCBunchSpacingMUS;
179- int covWghTB = TMath::NInt(100./occBin2MUS); // coverage of weighted occ. in TBins
180- for (int i = 0; i < nTPCBins; i++) {
181- sm = 0.;
182- for (int j=-covWghTB;j<covWghTB;j++) {
183- if (j+i<0 || j+i>=nTPCBins) {
184- continue;
185- }
186- sm += mOccWghFun->Eval(j*occBin2MUS)*mTPCRefitter->getParam()->GetUnscaledMult(j+i);
187- }
188- mTBinClOccWgh[i] = sm;
189- }
190- } else {
191- mTBinClOccWgh.resize(1);
192- }
193- */
194- std::vector<float > mltHistTB (nTPCOccBins);
180+ mMltHistTB .resize (nTPCOccBins);
195181 for (int i = 0 ; i < nTPCOccBins; i++) {
196- mltHistTB [i] = mTPCRefitter ->getParam ()->GetUnscaledMult (tb);
182+ mMltHistTB [i] = mTPCRefitter ->getParam ()->GetUnscaledMult (tb);
197183 tb += mNTPCOccBinLength ;
198184 }
199185 for (int i = nTPCOccBins; i--;) {
200- sm += mltHistTB [i];
186+ sm += mMltHistTB [i];
201187 if (i + sumBins < nTPCOccBins) {
202- sm -= mltHistTB [i + sumBins];
188+ sm -= mMltHistTB [i + sumBins];
203189 }
204190 mTBinClOccAft [i] = sm;
205191 }
206192 sm = 0 ;
207193 for (int i = 0 ; i < nTPCOccBins; i++) {
208- sm += mltHistTB [i];
194+ sm += mMltHistTB [i];
209195 if (i - sumBins > 0 ) {
210- sm -= mltHistTB [i - sumBins];
196+ sm -= mMltHistTB [i - sumBins];
211197 }
212198 mTBinClOccBef [i] = sm;
213199 }
@@ -271,13 +257,17 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
271257 o2::dataformats::PrimaryVertexExt pveDummy;
272258 o2::dataformats::PrimaryVertexExt vtxDummy (mMeanVtx .getPos (), {}, {}, 0 );
273259 std::vector<o2::dataformats::PrimaryVertexExt> pveVec (nv);
260+ std::vector<float > tpcOccAftV, tpcOccBefV;
274261 pveVec.back () = vtxDummy;
275262 const auto & alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance ();
276263 float tBiasITS = alpParams.roFrameBiasInBC * o2::constants::lhc::LHCBunchSpacingMUS;
277264 const o2::ft0::InteractionTag& ft0Params = o2::ft0::InteractionTag::Instance ();
278265 std::vector<o2::dataformats::TrackInfoExt> trcExtVec;
279266 std::vector<o2::trackstudy::TrackPairInfo> trcPairsVec;
280- auto vdrit = mTPCVDriftHelper .getVDriftObject ().getVDrift ();
267+ auto vdrift = mTPCVDriftHelper .getVDriftObject ().getVDrift ();
268+ float maxDriftTB = 250 .f / vdrift / (o2::constants::lhc::LHCBunchSpacingMUS * 8 );
269+ int groupOcc = std::ceil (maxDriftTB / mNOccBinsDrift / mNTPCOccBinLength );
270+
281271 bool tpcTrackOK = recoData.isTrackSourceLoaded (GTrackID::TPC);
282272
283273 auto fillTPCClInfo = [&recoData, this ](const o2::tpc::TrackTPC& trc, o2::dataformats::TrackInfoExt& trExt, float timestampTB = -1e9 ) {
@@ -391,6 +381,8 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
391381 }
392382 }
393383 };
384+ tpcOccAftV.resize (mNOccBinsDrift );
385+ tpcOccBefV.resize (mNOccBinsDrift );
394386
395387 for (int iv = 0 ; iv < nv; iv++) {
396388 LOGP (debug, " processing PV {} of {}" , iv, nv);
@@ -455,7 +447,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
455447 continue ;
456448 }
457449 if (iv < nv - 1 && is == GTrackID::TPC && tpcTr && !tpcTr->hasBothSidesClusters ()) { // for unconstrained TPC tracks correct track Z
458- float corz = vdrit * (tpcTr->getTime0 () * mTPCTBinMUS - pvvec[iv].getTimeStamp ().getTimeStamp ());
450+ float corz = vdrift * (tpcTr->getTime0 () * mTPCTBinMUS - pvvec[iv].getTimeStamp ().getTimeStamp ());
459451 if (tpcTr->hasASideClustersOnly ()) {
460452 corz = -corz; // A-side
461453 }
@@ -500,7 +492,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
500492 } else {
501493 o2::track::TrackParCov tmpTPC (*tpcTr);
502494 if (iv < nv - 1 && is == GTrackID::TPC && tpcTr && !tpcTr->hasBothSidesClusters ()) { // for unconstrained TPC tracks correct track Z
503- float corz = vdrit * (tpcTr->getTime0 () * mTPCTBinMUS - pvvec[iv].getTimeStamp ().getTimeStamp ());
495+ float corz = vdrift * (tpcTr->getTime0 () * mTPCTBinMUS - pvvec[iv].getTimeStamp ().getTimeStamp ());
504496 if (tpcTr->hasASideClustersOnly ()) {
505497 corz = -corz; // A-side
506498 }
@@ -554,10 +546,35 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
554546 int tb = pveVec[iv].getTimeStamp ().getTimeStamp () * mTPCTBinMUSInv * mNTPCOccBinLengthInv ;
555547 tpcOccBef = tb < 0 ? mTBinClOccBef [0 ] : (tb >= mTBinClOccBef .size () ? mTBinClOccBef .back () : mTBinClOccBef [tb]);
556548 tpcOccAft = tb < 0 ? mTBinClOccAft [0 ] : (tb >= mTBinClOccAft .size () ? mTBinClOccAft .back () : mTBinClOccAft [tb]);
549+ int tbc = pveVec[iv].getTimeStamp ().getTimeStamp () * mTPCTBinMUSInv * mNTPCOccBinLengthInv - groupOcc / 2 .;
550+ for (int iob = 0 ; iob < mNOccBinsDrift ; iob++) {
551+ float sm = 0 ;
552+ for (int ig = 0 ; ig < groupOcc; ig++) {
553+ int ocb = tbc + ig + groupOcc * iob;
554+ if (ocb < 0 || ocb >= (int )mMltHistTB .size ()) {
555+ sm = -1 ;
556+ break ;
557+ }
558+ sm += mMltHistTB [ocb];
559+ }
560+ tpcOccAftV[iob] = sm;
561+ //
562+ sm = 0 ;
563+ for (int ig = 0 ; ig < groupOcc; ig++) {
564+ int ocb = tbc + ig - groupOcc * iob;
565+ if (ocb < 0 || ocb >= (int )mMltHistTB .size ()) {
566+ sm = -1 ;
567+ break ;
568+ }
569+ sm += mMltHistTB [ocb];
570+ }
571+ tpcOccBefV[iob] = sm;
572+ }
557573 }
558574 (*mDBGOut ) << " trpv"
559575 << " orbit=" << recoData.startIR .orbit << " tfID=" << TFCount
560576 << " tpcOccBef=" << tpcOccBef << " tpcOccAft=" << tpcOccAft
577+ << " tpcOccBefV=" << tpcOccBefV << " tpcOccAftV=" << tpcOccAftV
561578 << " pve=" << pveVec[iv] << " trc=" << trcExtVec << " \n " ;
562579
563580 if (mDoPairsCorr ) {
@@ -752,6 +769,7 @@ DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mas
752769 {" with-its-only" , VariantType::Bool, false , {" Store tracks with ITS only" }},
753770 {" pair-correlations" , VariantType::Bool, false , {" Do pairs correlation" }},
754771 {" occ-weight-fun" , VariantType::String, " (x>=-40&&x<-5) ? (1./1225*pow(x+40,2)) : ((x>-5&&x<15) ? 1. : ((x>=15&&x<40) ? (-0.4/25*x+1.24 ) : ( (x>40&&x<100) ? -0.4/60*x+0.6+0.8/3 : 0)))" , {" Occupancy weighting f-n vs time in musec" }},
772+ {" noccbins" , VariantType::Int, 10 , {" Number of occupancy bins per full drift time" }},
755773 {" min-x-prop" , VariantType::Float, 100 .f , {" track should be propagated to this X at least" }},
756774 };
757775 o2::tpc::VDriftHelper::requestCCDBInputs (dataRequest->inputs );
0 commit comments