@@ -32,7 +32,6 @@ using namespace o2::framework::expressions;
3232using namespace std ;
3333
3434using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Qvectors>;
35-
3635using MyTracks = aod::Tracks;
3736
3837struct jEPFlowAnalysis {
@@ -53,6 +52,10 @@ struct jEPFlowAnalysis {
5352 Configurable<bool > cfgAddEvtSel{" cfgAddEvtSel" , true , " Use event selection" };
5453 Configurable<int > cfgnTotalSystem{" cfgnTotalSystem" , 7 , " Total number of detectors in qVectorsTable" };
5554
55+ Configurable<bool > cfgShiftCorr{" cfgShiftCorr" , false , " additional shift correction" };
56+ Configurable<std::string> cfgShiftPath{" cfgShiftPath" , " Users/j/junlee/Qvector/QvecCalib/Shift" , " Path for Shift" };
57+ Configurable<bool > cfgSPmethod{" cfgSPmethod" , false , " flag for scalar product" };
58+
5659 Configurable<std::string> cfgDetName{" cfgDetName" , " FT0C" , " The name of detector to be analyzed" };
5760 Configurable<std::string> cfgRefAName{" cfgRefAName" , " TPCPos" , " The name of detector for reference A" };
5861 Configurable<std::string> cfgRefBName{" cfgRefBName" , " TPCNeg" , " The name of detector for reference B" };
@@ -64,6 +67,12 @@ struct jEPFlowAnalysis {
6467 int RefBId;
6568 int harmInd;
6669
70+ int currentRunNumber = -999 ;
71+ int lastRunNumber = -999 ;
72+
73+ std::vector<TProfile3D*> shiftprofile{};
74+ std::string fullCCDBShiftCorrPath;
75+
6776 template <typename T>
6877 int GetDetId (const T& name)
6978 {
@@ -96,20 +105,64 @@ struct jEPFlowAnalysis {
96105 epAnalysis.CreateHistograms ();
97106 }
98107
99- void process (MyCollisions::iterator const & coll, soa::Filtered<MyTracks> const & tracks)
108+ void process (MyCollisions::iterator const & coll, soa::Filtered<MyTracks> const & tracks, aod::BCsWithTimestamps const & )
100109 {
101110 if (cfgAddEvtSel && (!coll.sel8 () || !coll.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ) || !coll.selection_bit (aod::evsel::kNoSameBunchPileup )))
102111 return ;
103112
104113 Float_t cent = coll.cent ();
105114 EPFlowHistograms.fill (HIST (" FullCentrality" ), cent);
106115 Float_t EPs[3 ] = {0 .};
116+
117+ if (cfgShiftCorr) {
118+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
119+ currentRunNumber = bc.runNumber ();
120+ if (currentRunNumber != lastRunNumber) {
121+ shiftprofile.clear ();
122+ for (int i = 2 ; i < 5 ; i++) {
123+ fullCCDBShiftCorrPath = cfgShiftPath;
124+ fullCCDBShiftCorrPath += " /v" ;
125+ fullCCDBShiftCorrPath += std::to_string (i);
126+ auto objshift = ccdb->getForTimeStamp <TProfile3D>(fullCCDBShiftCorrPath, bc.timestamp ());
127+ shiftprofile.push_back (objshift);
128+ }
129+ lastRunNumber = currentRunNumber;
130+ }
131+ }
132+
107133 for (int i = 2 ; i < 5 ; i++) { // loop over different harmonic orders
108134 harmInd = cfgnTotalSystem * 4 * (i - 2 ) + 3 ; // harmonic index to access corresponding Q-vector as all Q-vectors are in same vector
109135 EPs[0 ] = helperEP.GetEventPlane (coll.qvecRe ()[DetId + harmInd], coll.qvecIm ()[DetId + harmInd], i);
110136 EPs[1 ] = helperEP.GetEventPlane (coll.qvecRe ()[RefAId + harmInd], coll.qvecIm ()[RefAId + harmInd], i);
111137 EPs[2 ] = helperEP.GetEventPlane (coll.qvecRe ()[RefBId + harmInd], coll.qvecIm ()[RefBId + harmInd], i);
112138
139+ auto deltapsiDet = 0.0 ;
140+ auto deltapsiRefA = 0.0 ;
141+ auto deltapsiRefB = 0.0 ;
142+
143+ float weight = 1.0 ;
144+
145+ if (cfgShiftCorr) {
146+ for (int ishift = 1 ; ishift <= 10 ; ishift++) {
147+ auto coeffshiftxDet = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 0.5 , ishift - 0.5 ));
148+ auto coeffshiftyDet = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 1.5 , ishift - 0.5 ));
149+ auto coeffshiftxRefA = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 2.5 , ishift - 0.5 ));
150+ auto coeffshiftyRefA = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 3.5 , ishift - 0.5 ));
151+ auto coeffshiftxRefB = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 4.5 , ishift - 0.5 ));
152+ auto coeffshiftyRefB = shiftprofile.at (i - 2 )->GetBinContent (shiftprofile.at (i - 2 )->FindBin (centrality, 5.5 , ishift - 0.5 )); // currently only FT0C/TPCpos/TPCneg
153+
154+ deltapsiDet += ((1 / (1.0 * ishift)) * (-coeffshiftxDet * TMath::Cos (ishift * static_cast <float >(i) * EPs[0 ]) + coeffshiftyDet * TMath::Sin (ishift * static_cast <float >(i) * EPs[0 ])));
155+ deltapsiRefA += ((1 / (1.0 * ishift)) * (-coeffshiftxRefA * TMath::Cos (ishift * static_cast <float >(i) * EPs[1 ]) + coeffshiftyRefA * TMath::Sin (ishift * static_cast <float >(i) * EPs[1 ])));
156+ deltapsiRefB += ((1 / (1.0 * ishift)) * (-coeffshiftxRefB * TMath::Cos (ishift * static_cast <float >(i) * EPs[2 ]) + coeffshiftyRefB * TMath::Sin (ishift * static_cast <float >(i) * EPs[2 ])));
157+ }
158+
159+ EPs[0 ] += deltapsiDet;
160+ EPs[1 ] += deltapsiRefA;
161+ EPs[2 ] += deltapsiRefB;
162+ }
163+
164+ if (cfgSPmethod) weight *= sqrt (pow (coll.qvecRe ()[DetId + harmInd], 2 ) + pow (coll.qvecIm ()[DetId + harmInd], 2 ));
165+
113166 Float_t resNumA = helperEP.GetResolution (EPs[0 ], EPs[1 ], i);
114167 Float_t resNumB = helperEP.GetResolution (EPs[0 ], EPs[2 ], i);
115168 Float_t resDenom = helperEP.GetResolution (EPs[1 ], EPs[2 ], i);
@@ -118,7 +171,7 @@ struct jEPFlowAnalysis {
118171 for (auto & track : tracks) {
119172 Float_t vn = TMath::Cos ((i) * (track.phi () - EPs[j]));
120173 Float_t vn_sin = TMath::Sin ((i) * (track.phi () - EPs[j]));
121- epAnalysis.FillVnHistograms (i, cent, static_cast <float >(j + 1 ), track.pt (), vn, vn_sin);
174+ epAnalysis.FillVnHistograms (i, cent, static_cast <float >(j + 1 ), track.pt (), vn * weight , vn_sin * weight );
122175 }
123176 }
124177 }
0 commit comments