Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weā€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

šŸ’„DO NOT MERGEšŸ’„ ā— add new TPC alignment, hit errors and slewing corrections for 2024 #702

Open
wants to merge 52 commits into
base: main
Choose a base branch
from

Conversation

fisyak
Copy link
Member

@fisyak fisyak commented Aug 8, 2024

new TPC Alignment 24
new TPC hit errors and slewing correction
The detailed description can be found at
https://drupal.star.bnl.gov/STAR/system/files/TPC24c.Export.Mini_.pdf

StRoot/StDbUtilities/StTpcCoordinate.cxx Show resolved Hide resolved
@@ -21,6 +22,8 @@ ostream& operator<<(ostream& os, const StTpcCoordinate& a) {
return os << OS;
}
//________________________________________________________________________________
void StTpcCoordinate::Print(Option_t *option) const {cout << *this << endl;}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the use of cout and endl prompt the inclusion of Stiostream.h? If so, just add using std::cout; using std::endl; somewhere in this file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignored

@@ -213,9 +213,9 @@ Bfc_st BFC[] = { // standard chains
, "","","",kFALSE},
{"RC.pp.y2005" ,"","","pp2005a,tofdat,OSpaceZ2,OGridLeak3D" ,"","","",kFALSE},
{"RC.pp.y2006" ,"","","pp2006b,OSpaceZ2,OGridLeak3D" ,"","","",kFALSE},
{"RC.y2007" ,"","","DbV20080418,B2007g,IAna,KeepSvtHit,hitfilt,VFMinuit3,emcDY2,ftpc,trgd,"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes have been merged in #709. Does this imply that StHitFilterMaker was never actually amending the output?

StRoot/Sti/StiHit.cxx Outdated Show resolved Hide resolved
StRoot/Sti/StiHit.cxx Show resolved Hide resolved
Copy link
Contributor

@klendathu2k klendathu2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Several MagFactor tables added and/or modified. It looks like most just implement the ideal magnetic field for a given year. But MagFactor.y2016.C sets a non-ideal value of -1.002. Why this value when everything else is an ideal +/-1 ?

  2. StEvent/StTpcHit.h / cxx extends the data stored and should result in a ID passed to the ClassDef macro. Unless there is a good reason to, we should keep these IDs consecutive, so the next value is 11 not 13 as per the PR.

There is a helper function defined in the proposed StTpcHit to return a format string for building a ROOT/TGeo of one of our geometry models of the TPC. This should go into a helper function somewhere other than StEvent.

  1. MDF4 Hit Error Model

This should be enabled / disabled by a BFC option, not a compile time flag.

This should use the standard Sti interface... you should not need to modify StiDetector to apply this. A wrapper class which inherits from StiHitErrorCalculator can forward the calculateError call to your StiHitErrorMDF4 class. (calculateError will need to be modified to accept an StiHit).

With that change, I think that the changes to StiTrackNodeHelper lines 1117 to 1136 can be moved into the wrapper class's calculateError function.

The easiest way to do this is with a wrapper function which inherits from StiHitErrorCalculator (or maybe StiTpcHitErrorCalculator). The wrapper class will forward the calculateError call to the MDF4 model.

mgr/ConsDefs.pm Show resolved Hide resolved
StarDb/tpc/tsspars/tsspar.year_1a.C Show resolved Hide resolved
@@ -7,7 +9,7 @@ TDataSet *CreateTable() {
memset(&row,0,tableSet->GetRowSize());
row.runNumber = 2214033; // run number ;
row.time = 996787667; // unix time of entry ;
row.frequency = 9383160; // frequency in Hz ;
row.frequency = 9399962; // local clock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confused by this change. There are starClockOnl.y2001.C ... starClockOnl.y2014.C as well, which I though take precedence over this file. The frequency is set to 9399970 there.

Or is this change in effect for all years that don't have a corresponding y20xx file? If so, why is it appropriate to change those past runs?

Copy link
Member

@fgeurts fgeurts Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to understand this. @fisyak, can you comment on this question?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We start run with cosmics (local clock) and sometime data base is not populated. This allows to use proper clock for laser runs at the very begin on run.

St_MagFactor *tableSet = new St_MagFactor("MagFactor",1);
//
memset(&row,0,tableSet->GetRowSize());
row.ScaleFactor = -1.002; // ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing the magnetic field in 2016?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fisyak, can you answer this question? The proposed changes should only affect 2019+ productions.

mJoinPars.hz() = mTargetHz;
}

mJoinPars.hz()=mTargetHz;//////////////////////???????????????????????????????????????????????????
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//////////////////////???????????????????????????????????????????????????

Not very informative comment here. This change can impact past productions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignred

StRoot/Sti/StiHit.h Show resolved Hide resolved
StRoot/StiTpc/StiTpcDetectorBuilder.cxx Outdated Show resolved Hide resolved
StRoot/StTpcDb/StTpcDbMaker.cxx Show resolved Hide resolved
@@ -65,6 +72,10 @@ void StiTrackNodeHelper::set(StiKalmanTrackNode *pNode,StiKalmanTrackNode *sNode
mParentNode = pNode;
mTargetNode = sNode;
mTargetHz = mTargetNode->getHz();
assert(mTargetHz);
if (! sNode->fitPars().hz()) sNode->fitPars().hz() = mTargetHz;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering what condition leads to this... Does this mean that in fixed target we are seeing nodes w/out a magnetic field?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some times node is created with zero filed. This is check to avoid assert.

StRoot/Sti/StiTrackNodeHelper.cxx Show resolved Hide resolved
@fgeurts
Copy link
Member

fgeurts commented Aug 28, 2024

Hi Yuri, I see several comments were made by STAR software experts. Can you follow up on these as your earliest convenience so that we can get the merger and new library set up by early next week? Thanks!!

@fgeurts
Copy link
Member

fgeurts commented Sep 5, 2024

Hi Yuri, I see several comments were made by STAR software experts. Can you follow up on these as your earliest convenience so that we can get the merger and new library set up by early next week? Thanks!!

Thanks, @fisyak. Aside from some programming related comments there were a few more specific comments regarding functionality changes that may be beyond the 2019+ alignment. It would be good to understand the motivation.

mgr/ConsDefs.pm Show resolved Hide resolved
@genevb
Copy link
Contributor

genevb commented Sep 11, 2024

I ran the nightly test suite on SDCC using this TFG24c.Export.Mini branch. The first finding is that all the *_embed jobs failed with the following assertion:

StChain:WARN  - StDbSql::QueryDb(table,time) line=439 tpcTimeBucketCor  has No data for query
root4star: .sl73_gcc485/obj/StRoot/StDetectorDbMaker/StDetectorDbChairs.cxx:530: static St_tpcTimeBucketCorC* St_tpcTimeBucketCorC::instance(): Assertion `table' failed.

An example such log file is here:

/star/rcf/test/gitdev/daq_sl302.ittf/Wed/year_2012/UU193_embed/st_physics_adc_13115004_raw_2510001.log

The 64-bit jobs also all failed, unable to open libCore.so.5. That may have been something I missed, so I may try it again for tomorrow if I spot my mistake.

Other jobs generally ran (a few are still running), and people can compare the output between yesterday's dev jobs at:

/star/rcf/test/dev/*/Tue/

and today's jobs with this PR's code branch:

/star/rcf/test/gitdev/*/Wed/

-Gene

@fisyak
Copy link
Member Author

fisyak commented Sep 11, 2024

To use nightly test is very good idea. To make track by track comparison I need event.root files in both dev and girder.

@fisyak
Copy link
Member Author

fisyak commented Sep 11, 2024

Event root files are needed with hits, i.e. without "hitfilt".

@genevb
Copy link
Contributor

genevb commented Sep 12, 2024

Event root files are needed with hits, i.e. without "hitfilt".

Many such event.root files are available from the nightly test suite I ran...at least 48 of them. See the outputs of:

ls -l /star/rcf/test/gitdev/*/Wed/year*/*/*.event.root | grep "Sep 11"
ls -l /star/rcf/test/dev/*/Tue/year*/*/*.event.root | grep "Sep 1"

...and pretty much all the chains have -hitfilt, so they are generally without hitfilt.

@fisyak
Copy link
Member Author

fisyak commented Sep 17, 2024

I have posted comparison of dev and SL24y productions to answer the question on the effect of code modification on production of old (before iTPC) data with old chains.
https://drupal.star.bnl.gov/STAR/blog/fisyak/Track-track-and-hit-hit-analyses-dev-and-SL24y-Alignment2024-AuAu2002016-sample

I don't see any show stoppers to start the calibration production with SL24l for all fixed target samples from 2019-2021 with new alignment (CorrZ).

Comment on lines +1120 to +1126
if (tpcHit) {
if ((tpcHit->detector() == kTpcId || tpcHit->detector() == kiTpcId)) {
if (tpcHit->flag() == 2) {
fudgeFactor = 16.;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuri suggested that these lines of code in Sti/StiTrackNodeHelper.cxx, modifying some TPC hit errors, might be responsible for the differences seen in nightly tests with this PR vs. DEV for pre-iTPC datasets where the alignment should be unaffected. Processing a few events with and without this bit of code is quite easy, and comparing the log files obviates that the bulk of the difference in track counts does disappear when removing this section of code.

However....from looking at the log file, I see that the new alignment scheme appears to alter TPC distortion corrections for these old, pre-iTPC datasets without any change to the reconstruction chain. This is in addition to the modification to TPC distortion corrections ("OSectorAlign") that Yuri wants to impose with the "CorrZ" chain option he has proposed for iTPC-era datasets for which I have expressed an interest in seeing a justification (through data, not anecdotally).

< StMagUtilities::XTWIST        =  -0.38 mrad
< StMagUtilities::YTWIST        =  0.25 mrad
---
> StMagUtilities::XTWIST        =  0 mrad
> StMagUtilities::YTWIST        =  0 mrad

< StMagUtilities::WestClock     =  -0.43 mrad
---
> StMagUtilities::WestClock     =  0 mrad

I do not recall this being discussed before, neither in the context of pre-iTPC datasets, nor with the new alignment. If the TPC alignment calibration was truly performed without any correction for the distortions due to the misalignment of the E and B fields (represented by the XTWIST & YTWIST numbers), I have significant concerns about this TPC alignment. Hopefully I am missing something and this is not the case.


I have placed output of the nightly test without this particular code (but including the rest of this PR) at this location:

This PR minus hit error change :
/star/rcf/test/gitdev/daq_sl302.stica/Mon/year_2016/AuAu200_production_2016_64bit/

This is for comparison with other iterations:

DEV :
/star/rcf/test/dev/daq_sl302.stica/Sat/year_2016/AuAu200_production_2016_64bit/
This PR :
/star/rcf/test/gitdev/daq_sl302.stica/Tue/year_2016/AuAu200_production_2016_64bit/
This PR before the Sept. 11th commits :
/star/rcf/test/gitdev/daq_sl302.stica/Wed/year_2016/AuAu200_production_2016_64bit/

I am making note of the last two in particular because Yuri's study involved the output from the last one (those jobs were started on September 11th before the time of Yuri's last commits), even though data with those commits was available. (Side note, please pay no heed to the "Tue" or "Mon" in the gitdev paths, as I moved files there from other days to avoid them being over-written.) I will note that I didn't see any effective impact of those commits on this particular test's track counts (i.e. the last two outputs may be identical).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuri has corrected me:
The "Twist" and "Clock" distortion corrections have not actually been used for the past decade, beginning with the prior "New Tpc Alignment" that was introduced around that time. StMagUtilities prints these numbers, but there has been no distortion correction applied. The alignment work introduced in this PR has resulted in the printed values being zero, but no actual effect on the applied distortion corrections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants