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
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f24b000
Add defalt values
fisyak Jul 29, 2024
b9352bd
Clean up
fisyak Jul 31, 2024
9aae93c
Add switch off color for batch mode
fisyak Aug 7, 2024
d152e4f
Alignment2024
fisyak Aug 7, 2024
24316ac
TpcRS hit errors base on MDF4 parameterization
fisyak Aug 7, 2024
921b24e
new Tpc hit errors
fisyak Aug 7, 2024
1fe7ee9
make them visible in standard library
fisyak Aug 7, 2024
282c28f
back to bfore HFT era
fisyak Aug 7, 2024
5b2ecc5
Clean up
fisyak Aug 7, 2024
2be2cf8
set ideal
fisyak Aug 7, 2024
d04a560
Warn off
fisyak Aug 7, 2024
701026a
new TPc hit error parameterization
fisyak Aug 7, 2024
ae31ad3
new errors and shifts from Alignment2024, supress asserts
fisyak Aug 7, 2024
550ae69
new Tpc Hit errors, supress asserts
fisyak Aug 7, 2024
5c66e08
new errors
fisyak Aug 7, 2024
10bda9e
add color
fisyak Aug 7, 2024
ea24401
Add Alignment2024 and TFG flavor for it
fisyak Aug 7, 2024
8828f60
Add Alignment2024, remove obsolete hitfit from chain options
fisyak Aug 7, 2024
b6046fe
Add default handler for logger
fisyak Aug 7, 2024
12fa9ff
Add ideal parameters
fisyak Aug 7, 2024
8496cf4
reduce no. of committed files
fisyak Aug 8, 2024
1088b8f
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 8, 2024
eee260b
Add default
fisyak Aug 11, 2024
85e5ff6
Add dependence StiCA from DbUtil, fix typo
fisyak Aug 11, 2024
470757a
Add protection agaist illegal clusters at pad = 0 or time = 0
fisyak Aug 11, 2024
a3bfe16
Merge branch 'TFG24c.Export.Mini' of github.com:star-bnl/star-sw intoā€¦
fisyak Aug 11, 2024
cfd375d
Add DbUtil for StiCA
fisyak Aug 11, 2024
883bc88
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 14, 2024
92933ae
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 15, 2024
65ad613
move Bfc.xml
fisyak Aug 15, 2024
df6a290
move Bfc.xml
fisyak Aug 15, 2024
d2d77f6
Merge branch 'TFG24c.Export.Mini' of github.com:star-bnl/star-sw intoā€¦
fisyak Aug 15, 2024
03176b3
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 17, 2024
d21c128
Resolve conflicts with PR#709
fisyak Aug 22, 2024
15106c7
comment out ibreak count to catch assert case
fisyak Aug 23, 2024
1d9e062
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 24, 2024
2f52e6c
Merge branch 'main' into TFG24c.Export.Mini
fisyak Aug 31, 2024
cac6321
fix bug with padpitch, add const
fisyak Sep 1, 2024
69abeeb
add const
fisyak Sep 1, 2024
46576ea
add correction to fixedTarget runs, update calculation of cms energy
fisyak Sep 1, 2024
bbaaf85
remove ifdef StiTpcHitErrorMDF4_h
fisyak Sep 1, 2024
66b02fe
Fix typo
fisyak Sep 1, 2024
709d840
Add space before -DEVTGEN_EXTERNAL=1
fisyak Sep 10, 2024
987442b
use St_tpcTimeBucketCor only for new schema
fisyak Sep 11, 2024
75eaec9
Switch: ! NoTFGLDbTag => TFGDbTag
fisyak Sep 11, 2024
36ca1de
Merge branch 'main' into TFG24c.Export.Mini
fisyak Sep 13, 2024
d919c1d
Merge branch 'main' into TFG24c.Export.Mini
fisyak Oct 5, 2024
77be6db
Merge branch 'main' into TFG24c.Export.Mini
fisyak Oct 9, 2024
8acdf8e
Merge branch 'main' into TFG24c.Export.Mini
fisyak Oct 18, 2024
dc447f4
Merge branch 'main' into TFG24c.Export.Mini
fisyak Nov 19, 2024
8bc3333
Merge branch 'main' into TFG24c.Export.Mini
plexoos Dec 18, 2024
8a19542
Merge branch 'main' into TFG24c.Export.Mini
plexoos Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 62 additions & 57 deletions StRoot/StBFChain/BigFullChain.h

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions StRoot/StBFChain/StBFChain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ Int_t StBFChain::Instantiate()
// Determine flavors
TString flavors = "ofl"; // default flavor for offline

// TFG specific Db tag
if (! GetOption("NoTFGLDbTag")) flavors += "+TFG";
// fixed target flavor
if (GetOption("FXT")) flavors.Prepend("FXT+");

Expand Down Expand Up @@ -761,6 +763,8 @@ Int_t StBFChain::Instantiate()
if ( GetOption("useLDV") ) mk->SetAttr("useLDV",kTRUE) ;// uses laserDV database
if ( GetOption("useCDV") ) mk->SetAttr("useCDV",kTRUE) ;// uses ofl database
if ( GetOption("useNewLDV") ) mk->SetAttr("useNewLDV",kTRUE);// uses new laserDV
if ( GetOption("Alignment2024") ) mk->SetAttr("Alignment2024",kTRUE);// uses new Alignment2024
if ( GetOption("Cosmics") ) mk->SetAttr("Cosmics" ,kTRUE);
if ( GetOption("shadow") ) mk->SetAttr("NoReset",kTRUE);// no resetting ExB
if ( GetOption("ExB")){
mk->SetAttr("ExB", kTRUE); // bit 0 is ExB ON or OFF
Expand Down Expand Up @@ -1922,6 +1926,18 @@ void StBFChain::SetDbOptions(StMaker *mk){
if (GetOption("NoSsdIt")) {mk->SetAttr("blacklist", "ssd"); gMessMgr->QAInfo() << "blacklist ssd" << endm;}
if (GetOption("NoSstIt")) {mk->SetAttr("blacklist", "sst"); gMessMgr->QAInfo() << "blacklist sst" << endm;}
}
if (GetOption("TFGdbOpt")) {
const Char_t *TFGTables[] = {"tpcSectorT0offset", "starTriggerDelay",
"TpcPosition", "TpcHalfPosition", "TpcWheelPosition",
"TpcSuperSectorPositionB", "TpcSuperSectorPositionD",
"TpcInnerSectorPositionB", "TpcOuterSectorPositionB",
"tpcBXT0CorrEPD", "tpcTimeBucketCor", 0};
LOG_INFO << "TFG version for TPC alignment parameters" << endm;
for (Int_t i = 0; TFGTables[i]; i++) {
LOG_INFO << "SetFlavor(\"TFG\",\"" << TFGTables[i] << "\"); // disable sim+ofl" << endm;
mk->SetFlavor("TFG",TFGTables[i]);
}
}
}
//_____________________________________________________________________
/// Creates output-tree branches
Expand Down
4 changes: 2 additions & 2 deletions StRoot/StDbUtilities/StGlobalDirection.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class StGlobalDirection : public StGlobalCoordinate {
public:
StGlobalDirection() : StGlobalCoordinate() {}
StGlobalDirection(const double x, const double y, const double z) :
StGlobalCoordinate(x,y,z) {}
StGlobalDirection(const double x, const double y, const double z) : StGlobalCoordinate(x,y,z) {}
StGlobalDirection(const double *x) : StGlobalCoordinate(x) { }
StGlobalDirection(const StThreeVector<double>& xyz) : StGlobalCoordinate(xyz) {}
StGlobalDirection(const StThreeVectorF& xyz) : StGlobalCoordinate(xyz) {}
virtual ~StGlobalDirection() {};
Expand Down
3 changes: 3 additions & 0 deletions StRoot/StDbUtilities/StTpcCoordinate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "StTpcLocalSectorAlignedCoordinate.hh"
#include "StTpcLocalSectorDirection.hh"
#include "StTpcLocalSectorCoordinate.hh"
#include "Stiostream.h"
fisyak marked this conversation as resolved.
Show resolved Hide resolved
//________________________________________________________________________________
StTpcLocalCoordinate::StTpcLocalCoordinate(double x, double y, double z) : StTpcCoordinate(x,y,z,0,0) {}
//________________________________________________________________________________
Expand All @@ -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

//________________________________________________________________________________
ostream& operator<<(ostream& os, const StTpcLocalDirection& a) {
return os << "TPC_Local Direction( (" << OS;
}
Expand Down
2 changes: 1 addition & 1 deletion StRoot/StDbUtilities/StTpcCoordinate.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
#ifndef ST_TPC_COORDINATE_H
#define ST_TPC_COORDINATE_H
#include "Stiostream.h"
#include "StThreeVector.hh"

class StTpcCoordinate {
Expand All @@ -27,6 +26,7 @@ class StTpcCoordinate {
virtual void setPosition(StThreeVector<double>& position) { mPosition = position; }
virtual void setSector(Int_t sector) { mFromSector = sector; }
virtual void setRow(Int_t row) { mFromRow = row; }
virtual void Print(Option_t *option="") const;
protected:
StThreeVector<double> mPosition;
Int_t mFromSector;
Expand Down
198 changes: 133 additions & 65 deletions StRoot/StDbUtilities/StTpcCoordinateTransform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
#include "StDetectorDbMaker/St_tpcPadPlanesC.h"
#include "StDetectorDbMaker/St_iTPCSurveyC.h"
#include "StDetectorDbMaker/St_starTriggerDelayC.h"
#include "StDetectorDbMaker/St_CosmicsDelayC.h"
#include "TMath.h"
#include "StThreeVectorD.hh"
#if defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x500
Expand All @@ -275,25 +276,15 @@ StTpcCoordinateTransform::StTpcCoordinateTransform(StTpcDb* /* globalDbPointer *
{
if (St_tpcPadConfigC::instance()
&& StTpcDb::instance()->Electronics()
#if 0
&& StTpcDb::instance()->GlobalPosition()
#endif
) {
mTimeBinWidth = 1./StTpcDb::instance()->Electronics()->samplingFrequency();
mInnerSectorzOffset = StTpcDb::instance()->Dimensions()->zInnerOffset();
mOuterSectorzOffset = StTpcDb::instance()->Dimensions()->zOuterOffset();
#if 0
mInnerSectorzOffset_West = StTpcDb::instance()->Dimensions()->zInnerOffset_West();
mOuterSectorzOffset_West = StTpcDb::instance()->Dimensions()->zOuterOffset_West();
#endif
}
else {
gMessMgr->Error() << "StTpcDb IS INCOMPLETE! Cannot contstruct Coordinate transformation." << endm;
assert(St_tpcPadConfigC::instance());
assert(StTpcDb::instance()->Electronics());
#if 0
assert(StTpcDb::instance()->GlobalPosition());
#endif
}
}
//________________________________________________________________________________
Expand All @@ -311,9 +302,6 @@ void StTpcCoordinateTransform::operator()(const StTpcLocalSectorCoordinate& a, S
#else
Double_t zoffset = (row>St_tpcPadConfigC::instance()->innerPadRows(sector)) ? mOuterSectorzOffset :mInnerSectorzOffset;
#endif /* Don't apply zOffSet for prompt hits */
#if 0
if (sector <= 12) zoffset+= (row>St_tpcPadConfigC::instance()->innerPadRows(sector)) ? mOuterSectorzOffset_West :mInnerSectorzOffset_West;
#endif
Double_t t0offset = (useT0 && sector>=1&&sector<=24) ? St_tpcPadGainT0BC::instance()->T0(sector,row,TMath::Nint (probablePad)) : 0;
t0offset *= mTimeBinWidth;
if (! useT0 && useTau) // for cluster
Expand All @@ -333,9 +321,6 @@ void StTpcCoordinateTransform::operator()(const StTpcPadCoordinate& a, StTpcLoc
#else
Double_t zoffset = (a.row()>St_tpcPadConfigC::instance()->innerPadRows(sector)) ? mOuterSectorzOffset : mInnerSectorzOffset;
#endif /* Don't apply zOffSet for prompt hits */
#if 0
if (a.sector() <= 12) zoffset+= (a.row() > St_tpcPadConfigC::instance()->innerPadRows(sector)) ? mOuterSectorzOffset_West :mInnerSectorzOffset_West;
#endif
Double_t t0offset = useT0 ? St_tpcPadGainT0BC::instance()->T0(a.sector(),a.row(),TMath::Nint(a.pad())) : 0;
t0offset *= mTimeBinWidth;
if (! useT0 && useTau) // for cluster
Expand Down Expand Up @@ -424,12 +409,12 @@ Double_t StTpcCoordinateTransform::zFromTB(Double_t tb, Int_t sector, Int_t row,
if (! St_starTriggerDelayC::instance()->Table()->IsMarked()) {// new scheme: offset = clocks*timebin + t0
trigT0 = St_starTriggerDelayC::instance()->clocks()*mTimeBinWidth;
elecT0 = St_starTriggerDelayC::instance()->tZero();
if (StTpcDb::IsCosmics()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what the relevance for this PR is.

trigT0 += St_CosmicsDelayC::instance()->clocks()*mTimeBinWidth;
elecT0 += St_CosmicsDelayC::instance()->tZero();
}
} else { // old scheme
trigT0 = StTpcDb::instance()->triggerTimeOffset()*1e6; // units are s
#if 0
if ((sector <= 12 && tb <= 350) || // extra West laser off set, membrane cluster with time bucket > 350
(sector > 12 && tb > 350)) {trigT0 += StTpcDb::instance()->triggerTimeOffsetWest()*1e6;}
#endif
elecT0 = StTpcDb::instance()->Electronics()->tZero(); // units are us
}
Double_t sectT0 = St_tpcPadrowT0C::instance()->T0(sector,row);// units are us
Expand All @@ -452,12 +437,12 @@ Double_t StTpcCoordinateTransform::tBFromZ(Double_t z, Int_t sector, Int_t row,
if (! St_starTriggerDelayC::instance()->Table()->IsMarked()) {// new scheme: offset = clocks*timebin + t0
trigT0 = St_starTriggerDelayC::instance()->clocks()*mTimeBinWidth;
elecT0 = St_starTriggerDelayC::instance()->tZero();
if (StTpcDb::IsCosmics()) {
trigT0 += St_CosmicsDelayC::instance()->clocks()*mTimeBinWidth;
elecT0 += St_CosmicsDelayC::instance()->tZero();
}
} else { // old scheme
trigT0 = StTpcDb::instance()->triggerTimeOffset()*1e6; // units are s
#if 0
if ((sector <= 12 && z < 195) || // extra West laser off set, membrane cluster with time z < 195
(sector > 12 && z > 195)) {trigT0 += StTpcDb::instance()->triggerTimeOffsetWest()*1e6;}
#endif
elecT0 = StTpcDb::instance()->Electronics()->tZero(); // units are us
}
Double_t sectT0 = St_tpcPadrowT0C::instance()->T0(sector,row);// units are us
Expand All @@ -471,37 +456,19 @@ Double_t StTpcCoordinateTransform::tBFromZ(Double_t z, Int_t sector, Int_t row,
}
//________________________________________________________________________________
// FOR SECTOR 12 ONLY!!!! (Local coordinate);
Int_t StTpcCoordinateTransform::rowFromLocal(const StThreeVector<Double_t>& a, Int_t sector) {
if (! StTpcDb::Alignment2024()) return rowFromLocalY(a.x(), sector);
return rowFromLocalY(a.y(), sector);
}
Int_t StTpcCoordinateTransform::rowFromLocalY(Double_t y, Int_t sector) {
static Int_t Nrows = 0;
static Int_t NrowsOld = 0;
static Double_t *Radii = 0;
#ifndef __OLD__
if (Nrows != St_tpcPadConfigC::instance()->padRows(sector)) {
Nrows = St_tpcPadConfigC::instance()->padRows(sector);
Int_t Nrows = St_tpcPadConfigC::instance()->numberOfRows(sector);
if (Nrows != NrowsOld) {
if (Radii) delete [] Radii;
Radii = new Double_t[Nrows+1];
for (Int_t i = 1; i <= Nrows+1; i++) {
if (i == 1) {
Radii[i-1] = (3*St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i)
- St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i+1))/2;
} else if (i == Nrows + 1) {
Radii[i-1] = (3*St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i-1)
- St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i-2))/2;
} else {
Radii[i-1] = (St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i-1) +
St_tpcPadConfigC::instance()->radialDistanceAtRow(sector,i))/2;
}
}
}
Long64_t row = TMath::BinarySearch(Nrows+1, Radii, y) + 1;
if (row <= 0) row = 1;
if (row > Nrows) row = Nrows;
return row;
#else
if (! Nrows) {
Nrows = St_tpcPadPlanesC::instance()->padRows();
Radii = new Double_t[Nrows];
for (Int_t i = 1; i <= Nrows; i++) {
Radii[i-1] = St_tpcPadPlanesC::instance()->radialDistanceAtRow(i);
Radii[i-1] = St_tpcPadConfigC::instance()->radialDistanceAtRow(sector, i);
}
}
if (y < Radii[0]) return 1;
Expand All @@ -512,7 +479,20 @@ Int_t StTpcCoordinateTransform::rowFromLocalY(Double_t y, Int_t sector) {
}
row++;
return row;
#endif
}
//________________________________________________________________________________
TGeoHMatrix &StTpcCoordinateTransform::Sub2Tpc(Int_t sector, Int_t row, Double_t drift) {
static TGeoHMatrix rotA;
StBeamDirection part = east;
if (sector <= 12) part = west;
TGeoTranslation GG(0, 0, - drift);
// TGeoHMatrix rotA = StTpcDb::instance()->Sup12S2Tpc(sector) * GG.Inverse() * StTpcDb::instance()->Wheel(part) * StTpcDb::instance()->SubS2Sup12S(sector,row) * GG;
rotA = StTpcDb::instance()->Sup12S2Tpc(sector);
rotA *= GG.Inverse();
rotA *= StTpcDb::instance()->Wheel(part);
rotA *= StTpcDb::instance()->SubS2Sup12S(sector,row);
rotA *= GG;
return *&rotA;
}
//________________________________________________________________________________
void StTpcCoordinateTransform::operator()(const StTpcLocalSectorCoordinate& a, StTpcLocalCoordinate& b )
Expand All @@ -521,25 +501,113 @@ void StTpcCoordinateTransform::operator()(const StTpcLocalSectorCoordina
Int_t row = a.fromRow();
Int_t sector = a.fromSector();
if (row < 1 || row > St_tpcPadConfigC::instance()->numberOfRows(sector)) row = rowFromLocal(a);
StTpcDb::instance()->Pad2Tpc(a.sector(),row).LocalToMasterVect(a.position().xyz(),xGG.xyz());
const Double_t *trans = StTpcDb::instance()->Pad2Tpc(sector,row).GetTranslation(); // 4
TGeoTranslation GG2TPC(trans[0],trans[1],trans[2]);
GG2TPC.LocalToMaster(xGG.xyz(), b.position().xyz());
b.setSector(a.sector()); b.setRow(row);
if (! StTpcDb::Alignment2024()) {
StTpcDb::instance()->Pad2Tpc(sector,row).LocalToMasterVect(a.position().xyz(),xGG.xyz());
const Double_t *trans = StTpcDb::instance()->Pad2Tpc(sector,row).GetTranslation(); // 4
TGeoTranslation GG2TPC(trans[0],trans[1],trans[2]);
GG2TPC.LocalToMaster(xGG.xyz(), b.position().xyz());
} else {// new alignment with drift along z in Super sector coordinate system
Double_t drift = a.position().z() + StTpcDb::instance()->SubS2Sup12S(sector,row).GetTranslation()[2];
TGeoHMatrix &rotA = Sub2Tpc(sector, row, drift);
rotA.LocalToMaster(a.position().xyz(), b.position().xyz());
}
b.setSector(sector); b.setRow(row);
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I missing something, or does this introduce a change in the old behavior? Looking at the code on the left...

b.setSector(a.sector()); b.setRow(row);

From this version

Int_t sector = a.fromSector();
...
b.setSector(sector); b.setRow(row);

}
//________________________________________________________________________________
void StTpcCoordinateTransform::operator()(const StTpcLocalSectorDirection& a, StTpcLocalDirection& b)
{
Int_t sector = a.fromSector();
Int_t row = a.fromRow();
if (! StTpcDb::Alignment2024()) {
StTpcDb::instance()->Pad2Tpc(sector,a.row()).LocalToMasterVect(a.position().xyz(),b.position().xyz());
} else {
TGeoHMatrix &rotA = Sub2Tpc(sector, row);
rotA.LocalToMasterVect(a.position().xyz(), b.position().xyz());
}
b.setSector(sector); b.setRow(row);
}
//________________________________________________________________________________
void StTpcCoordinateTransform::operator()(const StTpcLocalCoordinate& a, StTpcLocalSectorCoordinate& b )
{
Int_t sector = a.fromSector();
if (! sector) sector = ((StTpcLocalCoordinate *) &a)->setSectorFromCoordinates();
Int_t row = a.fromRow();
StThreeVectorD xGG;
if (! StTpcDb::Alignment2024()) {
if ( ! (row >= 1 && row <= St_tpcPadConfigC::instance()->numberOfRows(sector))) {
StThreeVectorD xyzS;
StTpcDb::instance()->SupS2Tpc(sector).MasterToLocalVect(a.position().xyz(),xyzS.xyz());
row = rowFromLocalY(xyzS[0], sector);
}
const Double_t *trans = StTpcDb::instance()->Pad2Tpc(sector,row).GetTranslation(); // 4
TGeoTranslation GG2TPC(trans[0],trans[1],trans[2]);
GG2TPC.MasterToLocal(a.position().xyz(), xGG.xyz());
StTpcDb::instance()->Pad2Tpc(sector,row).MasterToLocalVect(xGG.xyz(),b.position().xyz()); b.setSector(sector); b.setRow(row);
} else {
if ( ! (row >= 1 && row <= St_tpcPadConfigC::instance()->numberOfRows(sector))) {
StThreeVectorD xyzS;
StTpcDb::instance()->Sup12S2Tpc(sector).MasterToLocalVect(a.position().xyz(),xyzS.xyz());
row = rowFromLocalY(xyzS[1], sector);
}
StThreeVectorD xyzLS;
StTpcDb::instance()->Sup12S2Tpc(sector).MasterToLocal(a.position().xyz(),xyzLS.xyz());
Double_t drift = xyzLS.z();
TGeoHMatrix &rotA = Sub2Tpc(sector, row, drift);
rotA.MasterToLocal(a.position().xyz(), b.position().xyz());
}
b.setSector(sector); b.setRow(row);
}
//________________________________________________________________________________
void StTpcCoordinateTransform::operator()(const StTpcLocalDirection& a, StTpcLocalSectorDirection& b )
{
Int_t sector = a.fromSector();
if ( ! (row >= 1 && row <= St_tpcPadConfigC::instance()->numberOfRows(sector))) {
StThreeVectorD xyzS;
StTpcDb::instance()->SupS2Tpc(sector).MasterToLocalVect(a.position().xyz(),xyzS.xyz());
row = rowFromLocalY(xyzS[0], sector);
Int_t row = a.fromRow();
if (! StTpcDb::Alignment2024()) {
StTpcDb::instance()->Pad2Tpc(sector,a.row()).MasterToLocalVect(a.position().xyz(),b.position().xyz());
} else {
TGeoHMatrix &rotA = Sub2Tpc(sector, row);
rotA.MasterToLocalVect(a.position().xyz(), b.position().xyz());
}
b.setSector(sector);
b.setRow(row);
}
//________________________________________________________________________________
void StTpcCoordinateTransform::testTpcCoordinateTransform(Int_t sector, Int_t row, Int_t pad, Int_t time, Int_t kase) {
if (kase >= 0) StTpcDb::SetAlignment2024(kase);
else StTpcDb::SetAlignment2024(kFALSE);
static StTpcCoordinateTransform transform(StTpcDb::instance());
cout << "Coordinates ============================" << endl;
StTpcPadCoordinate coorP(sector, row, pad, time); cout << coorP << endl;
StTpcLocalSectorCoordinate coorLS;
StTpcLocalSectorCoordinate coorLST;
StTpcLocalSectorCoordinate coorLSF;
StTpcLocalCoordinate coorTPC;
StGlobalCoordinate coorG;
StTpcPadCoordinate coorP2;
cout << "coorP \t" << coorP << endl;
#if 0
transform(coorP,coorLS); cout << "Default \t" << coorLS << endl;
transform(coorP,coorLS ,kFALSE, kTRUE); cout << "Cluster without T0, with tau\t" << coorLS << endl;
transform(coorP,coorLST,kFALSE,kFALSE); cout << "Pixel with T0, without tau\t" << coorLST << endl;
transform(coorP,coorLST, kTRUE,kFALSE); cout << "Pixel without T0, without tau\t" << coorLST << endl;
transform(coorP,coorG, kTRUE,kFALSE); cout << "Pixel without T0, without tau\t" << coorG << endl;
#endif

cout << "coorP input \t" << coorP << endl;
Int_t k1 = 1, k2 = 0;
if (kase >= 0) {k1 = k2 = kase;}
for (Int_t k = k1; k >= k2; k--) {
if (k1 != k2) StTpcDb::SetAlignment2024(k);
if (! StTpcDb::Alignment2024() ) cout << "Tpc to Sub Sector ======= Old ========" << endl;
else cout << "Tpc to Sub Sector ======= New ========" << endl;
transform(coorP,coorLS); cout << "coorP => coorLS \t" << coorLS << endl;
transform(coorLS, coorP2); cout << "coorLS => coorP2 \t" << coorP2 << endl;
transform(coorLS, coorTPC); cout << "coorLS => coorTPC \t" << coorTPC << endl;
transform(coorTPC, coorLS); cout << "coorTPC => coorLS \t" << coorLS << endl;
transform(coorP,coorTPC); cout << "coorP => coorTPC \t" << coorTPC << endl;
transform(coorTPC,coorP2); cout << "coorTPC => coorP2 \t" << coorP2 << endl;
transform(coorP,coorG); cout << "coorP => coorG \t" << coorG << endl;
transform(coorG,coorP2, sector, row); cout << "coorG => coorP2 \t" << coorP2 << endl;
transform(coorLS,coorP2); cout << "coorLS => coorP2 \t" << coorP2 << endl;
}
const Double_t *trans = StTpcDb::instance()->Pad2Tpc(a.sector(),row).GetTranslation(); // 4
TGeoTranslation GG2TPC(trans[0],trans[1],trans[2]);
StThreeVectorD xGG;
GG2TPC.MasterToLocal(a.position().xyz(), xGG.xyz());
StTpcDb::instance()->Pad2Tpc(a.sector(),row).MasterToLocalVect(xGG.xyz(),b.position().xyz()); b.setSector(a.sector()); b.setRow(row);
}
Loading
Loading