Skip to content

Commit

Permalink
Merge branch 'star-bnl:main' into fst-tracking-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbrice authored Jan 9, 2025
2 parents b90b057 + eac1ee1 commit 5c4fc21
Show file tree
Hide file tree
Showing 19 changed files with 536 additions and 59 deletions.
39 changes: 37 additions & 2 deletions StRoot/StBFChain/BigFullChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,15 @@ Bfc_st BFC[] = { // standard chains
"B2018a,ITTF,UseXgeom,BAna,VFMinuit,beamline3D,l3onl,emcDY2,epdHit,fpd,trgd,ZDCvtx,analysis"
, "","","Base chain for year 2018 AA data - no Corr (+ l3, bcc/fpd, e/b-emc)",kFALSE},

// 2018 updated chains
{"B2018c" ,"","",
"ry2018c,in,tpcX,UseXgeom,CorrX,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite,picoVtxDefault,picoCovMtxWrite","",""
, "Base chain for run 2018 data (tpc)",kFALSE},

{"P2018c","" ,"",
"B2018c,ITTF,BAna,VFMinuit,beamline3D,btof,mtd,l3onl,emcDY2,epdHit,fpd,trgd,ZDCvtx,analysis"
, "","","Base chain for year 2018 AA data - no Corr (+ l3, bcc/fpd, e/b-emc)",kFALSE},

// 2019 chains, BES
{"B2019a" ,"","","ry2019a,in,tpcX,UseXgeom,iTpcIT,CorrX,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite",
"","", "Base chain for run 2019 data (tpc)",kFALSE},
Expand All @@ -1001,6 +1010,14 @@ Bfc_st BFC[] = { // standard chains
"B2019a,ITTF,BAna,iTpcIT,VFMinuit,beamline3D,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2019 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2019 updated chains
{"B2019b" ,"","",
"ry2019b,in,tpcX,UseXgeom,iTpcIT,CorrY,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite,picoVtxDefault,picoCovMtxWrite",
"","", "Base chain for run 2019 data (tpc)",kFALSE},

{"P2019b","" ,"",
"B2019b,ITTF,BAna,VFMinuit,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2019 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2020 initial chains
{"B2020a" ,"","",
Expand All @@ -1011,14 +1028,32 @@ Bfc_st BFC[] = { // standard chains
"B2020a,ITTF,BAna,iTpcIT,VFMinuit,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2020 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2020 updated chains
{"B2020b" ,"","",
"ry2020b,in,tpcX,UseXgeom,iTpcIT,CorrY,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite,picoVtxDefault,picoCovMtxWrite",
"","", "Base chain for run 2020 data (tpc)",kFALSE},

{"P2020b","" ,"",
"B2020b,ITTF,BAna,VFMinuit,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2020 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2021 initial chains
{"B2021a" ,"","",
"ry2021a,in,tpcX,UseXgeom,iTpcIT,CorrY,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite,picoVtxDefault,picoCovMtxWrite",
"","", "Base chain for run 2020 data (tpc)",kFALSE},
"","", "Base chain for run 2021 data (tpc)",kFALSE},

{"P2021a","" ,"",
"B2021a,ITTF,BAna,iTpcIT,VFMinuit,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2020 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},
, "","", "Base chain for year 2021 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2021 updated chains
{"B2021b" ,"","",
"ry2021b,in,tpcX,UseXgeom,iTpcIT,CorrY,AgML,tpcDB,TpcHitMover,Idst,tags,Tree,picoWrite,picoVtxDefault,picoCovMtxWrite",
"","", "Base chain for run 2021 data (tpc)",kFALSE},

{"P2021b","" ,"",
"B2021b,ITTF,BAna,VFMinuit,etofa,btof,mtd,l3onl,emcDY2,epdHit,trgd,ZDCvtx,analysis"
, "","", "Base chain for year 2021 AA data - no Corr (+ l3, epd, mtd, b/etof, b-emc)",kFALSE},

// 2022 initial chains
{"B2022" ,"","",
Expand Down
1 change: 1 addition & 0 deletions StRoot/StBFChain/StBFChain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ Int_t StBFChain::Instantiate()
if (GetOption("usePct4Vtx" ) ) mk->SetAttr("PCT" , kTRUE);
if (GetOption("useBTOF4Vtx") ) mk->SetAttr("BTOF" , kTRUE);
if (GetOption("useBTOFmatchOnly") ) mk->SetAttr("useBTOFmatchOnly", kTRUE);
if (GetOption("FXT" ) ) mk->SetAttr("FXT" , kTRUE);

// X-tended works only for VFPPV, VFPPVnoCTB, VFPPVev for now but could be re-used
// However, we will change this to a more flexible arbitrarry setting later
Expand Down
37 changes: 30 additions & 7 deletions StRoot/StBbcSimulationMaker/StBbcSimulationMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,31 @@ const float SinglePhotoElectronResolution = 0.3; // according to Les Bland
/* Numbering: the real PMT numbering (used in the map) starts from 1.
ALL OTHERS start from 0 !
*/


// Note: BBC new factors are calibrated by 2017 p+p runs
const short ADCBin = 4096;

const float LightFactor[NPMT2] = {1., 1., 0.95, 0.92, 1., 1., 1., 1., 0.9, 0.96, 0.95, 1., 0.95, 0.97, 1., 1., // East small
0.33, 0.298, 0.25, 0.26, 0.22, 0.4, 0.24, 0.26, // East large
1.2, 0.9, 1., 0.6, 1., 1., 1.2, 1.2, 1.25, 0.4, 1., 1., 0.95, 0.95, 0.94, 0.95, // West small
0., 0.243, 0., 0.2, 0.24, 0.18, 0.19, 0.2}; // West large

const float TileResolution[NPMT2] = {0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, // East small
0.6, 0.6, 0.4, 0.5, 0.5, 0.6, 0.4, 0.5, // East large
0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.5, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, // West small
0., 0.5, 0., 0.5, 0.6, 0.6, 0.4, 0.65}; // West large

const float pC_per_ADCBins[NPMT2] = {0.03, 0.03, 0.033, 0.033, 0.03, 0.03, 0.022, 0.03, 0.021, 0.022, 0.024, 0.03, 0.024, 0.024, 0.025, 0.027, // East small
0.0226, 0.028, 0.021, 0.023, 0.014, 0.0125, 0.012, 0.0125, // East large
0.031, 0.03, 0.03, 0.018, 0.03, 0.03, 0.023, 0.024, 0.028, 0.005, 0.03, 0.03, 0.028, 0.023, 0.022, 0.028, // West small
0., 0.027, 0., 0.06, 0.013, 0.014, 0.0129, 0.02}; // West large

const int shift_ADC0[NPMT2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // East small
0, 0, 0, 0, -15, 0, -15, 0, // East large
0, 0, 0, 0, 0, 0, 0, 0, 0, -60, 0, 0, 0, 0, 0, 0, // West small
0, 0, 0, 0, -10, -7, -15, -10}; // West large

//____________________________________________________________________________

bool IsSmall(short iPMT)
Expand Down Expand Up @@ -118,27 +143,25 @@ the response based on that + noise.
~BbcDE(){};
void AddDE(uint16_t ipmt, float de)
{
if (!IsSmall(ipmt)) {de *= OuterFactor;}
de *= LightFactor[ipmt];
dE[ipmt] += de;
}
float GetDE(uint16_t ipmt)
{
/// returns DE in pC of PMT signal

float PoissonMean = dE[ipmt]/dE_1MIP*NPhotoelectrons_1MIP;
short NPhotoelectrons = BbcRndm.Poisson(PoissonMean);
float Q = pC_per_Photoelectron*
(1+BbcRndm.Gaus(0.,SinglePhotoElectronResolution))*
NPhotoelectrons;
(1+BbcRndm.Gaus(0.,TileResolution[ipmt]))*NPhotoelectrons;
return Q;
}
short GetADC(uint16_t ipmt)
{
/// returns digitized (ADC) amplitude
float A = this->GetDE(ipmt);
if (A<ADC0) {return 0;}
short N = (short)((A-ADC0)/pC_perADCbin);
if (N>=NADCbins) {return NADCbins-1;}
short N = (short)(A/pC_per_ADCBins[ipmt] + shift_ADC0[ipmt]);
if (N>=ADCBin) {return ADCBin-1;}
if (N<0){return 0;}
return N;
}
};
Expand Down
11 changes: 9 additions & 2 deletions StRoot/StChain/GeometryDbAliases.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,23 +147,30 @@ static const DbAlias_t fDbAlias[] = {// geometry Comment old

{"y2019", 20181215, 0, "y2019", "y2019 development geometry, AgML,xgeometry"},
{"y2019a", 20181215, 1, "y2019a", "y2019a first production release geometry, AgML,xgeometry"},
{"y2019b", 20181215, 1, "y2019b", "y2019a production geometry (FXT @ 200.7cm), AgML,xgeometry"},
{"y2019b", 20181215, 2, "y2019b", "y2019a production geometry (FXT @ 200.0cm), AgML,xgeometry"},

{"y2020", 20191120, 0, "y2020", "y2020 development geometry, AgML,xgeometry"},
{"y2020a", 20191120, 1, "y2020a", "y2020 fast-offline geometry, AgML,xgeometry"},
{"y2020b", 20191120, 2, "y2020b", "y2020 production geometry (FXT @ 200.7 cm), AgML,xgeometry"},
{"y2020b", 20191120, 2, "y2020b", "y2020 production geometry (FXT @ 200.0 cm), AgML,xgeometry"},

{"y2021", 20201215, 0, "y2021", "y2021 development geometry, AgML,xgeometry"},
{"y2021a", 20201215, 1, "y2021a", "y2021 first production geometry, AgML,xgeometry"},
{"y2021b", 20201215, 2, "y2021b", "y2021 production geometry (FXT @ 200.0 cm), AgML,xgeometry"},


{"y2022", 20211015, 0, "y2022", "y2022 first cut geometry, AgML,xgeometry"},
{"y2022a", 20211015, 1, "y2022a", "y2022 production geometry, AgML,xgeometry"},
{"y2022b", 20211015, 2, "y2022b", "y2022 production geometry (FXT @ 200.0 cm), AgML,xgeometry"},

{ "y2023", 20230410, 0, "y2023", "y2023 first cut geometry, AgML,xgeometry"},
{ "y2023a", 20230410, 1, "y2023a", "y2023a production geometry, AgML,xgeometry"},
{ "y2023b", 20230410, 2, "y2023b", "y2023a production geometry (FXT @ 200.0 cm), AgML,xgeometry"},

{ "y2024", 20231210, 0, "y2024", "y2024 first cut geometry, AgML,xgeometry"},
{ "y2024a", 20231210, 1, "y2024a", "y2024a production geometry, AgML,xgeometry"},
{ "y2024b", 20231210, 2, "y2024b", "y2024b production geometry (FXT @ 200.0 cm), AgML,xgeometry"},

{ "y2024", 20241210, 0, "y2024", "y2024 first cut geometry, AgML,xgeometry"},

{"dev2021", 21201210, 1, "dev2021", "-deprecated- geometry for 2021+ forward program,AgML,xgeometry"},
{"dev2022", 21211210, 1, "dev2022", "development geometry for 2022+ forward program,AgML,xgeometry"},
Expand Down
122 changes: 106 additions & 16 deletions StRoot/StETofCalibMaker/StETofCalibMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ StETofCalibMaker::StETofCalibMaker( const char* name )
mStateMapStop(0),
mDbEntryStart(0),
mDbEntryStop(0),
mGlobalCounter(1)
mGlobalCounter(1),
mCalState(true)


{
/// default constructor
Expand Down Expand Up @@ -201,7 +203,12 @@ StETofCalibMaker::InitRun( Int_t runnumber )
// --------------------------------------------------------------------------------------------

//Get4 status map

for(int i=0; i < eTofConst::nGet4sInSystem; i++){
mGet4StateMap[i] = 0;
if(i < (eTofConst::nGet4sInSystem/2)){
mGet4DefaultStateMap[i] = 0;
}
}
readGet4State(mGlobalCounter , 0);

// electronics-to-hardware map
Expand Down Expand Up @@ -1459,7 +1466,7 @@ StETofCalibMaker::processMuDst()
if (hasPulsersVec.size() == 108){
etofHeader->setHasPulsersVec(hasPulsersVec);
}

//fill good event flag into header
for( unsigned int iGet4 = 0; iGet4 < 1728; iGet4++){
goodEventFlagVec.push_back(!etofHeader->missMatchFlagVec().at(iGet4));
Expand Down Expand Up @@ -2166,9 +2173,18 @@ StETofCalibMaker::applyCalibration( StETofDigi* aDigi, StETofHeader* etofHeader
int get4Id = 144 * ( aDigi->sector() - 13 ) + 48 * ( aDigi->zPlane() -1 ) + 16 * ( aDigi->counter() - 1 ) + 8 * ( aDigi->side() - 1 ) + ( ( aDigi->strip() - 1 ) / 4 );

double stateCorr =0;
if(mGet4StateMap[get4Id] == 1) stateCorr = 6.25;
else if(mGet4StateMap[get4Id] == 2) stateCorr = -6.25;
// else if(mGet4StateMap[get4Id] == 3) stateCorr = 0.0;
if(mGet4StateMap[get4Id] == 1){
stateCorr = 6.25;
}else if(mGet4StateMap[get4Id] == 2){
stateCorr = -6.25;
}else if(mGet4StateMap[get4Id] == 3){
stateCorr = 6.25;
}else if(mGet4StateMap[get4Id] == 4){
stateCorr = -6.25;
}
// only calibrate here if flag is set
if(!mCalState) stateCorr = 0;


double calibTime = aDigi->rawTime() - mResetTime
- resetTimeCorr()
Expand All @@ -2178,7 +2194,7 @@ StETofCalibMaker::applyCalibration( StETofDigi* aDigi, StETofHeader* etofHeader
+ stateCorr;


if(mGet4StateMap[get4Id] == 3){
if(mGet4StateMap[get4Id] == 5){
calibTime = 0; // mask digis with undefined state (e.g. one hit with jump and one without in same event)

}
Expand Down Expand Up @@ -2689,12 +2705,12 @@ void StETofCalibMaker::readGet4State(int fileNr, short forward){
std::vector< unsigned long int > intVec;

//first read
if(forward == 0) mGlobalCounter = 1;
if(forward == 0) mGlobalCounter = 0;
//jump forward
else if(forward > 0) mGlobalCounter++;
else if(forward > 0){ mGlobalCounter++;
//jump backward
else mGlobalCounter--; // forward < 0
}else {mGlobalCounter--;} // forward < 0

if(mGlobalCounter == 0){
mGlobalCounter++;
fileZero = true;
Expand Down Expand Up @@ -2743,7 +2759,7 @@ void StETofCalibMaker::readGet4State(int fileNr, short forward){
std::map<unsigned long int,vector<int>> stateVec;
std::map<unsigned long int ,vector<int>> get4IdVec;

decodeInt(intVec , mGet4StateMap , mGet4ZeroStateMap , startVec , mMasterStartVec , stateVec , get4IdVec);
decodeInt(intVec , startVec , stateVec , get4IdVec);

// fill stateMap & steering vecs with EvtZero entries: read in first 1728 states & times
for(int i = 0; i< eTofConst::nGet4sInSystem;i++){
Expand Down Expand Up @@ -2772,6 +2788,7 @@ void StETofCalibMaker::readGet4State(int fileNr, short forward){

if(fileZero){
mDbEntryStart = 0;
mDbEntryStop = 99999999;
}

sort( mMasterStartVec.begin(), mMasterStartVec.end() );
Expand Down Expand Up @@ -2858,9 +2875,11 @@ void StETofCalibMaker::checkGet4State(unsigned long int eventNr){

}
//-----------------------------------------------------
void StETofCalibMaker::decodeInt( std::vector<unsigned long int> intVec ,std::map<int , short>& mGet4StateMap ,std::map<int , short>& mGet4ZeroStateMap ,std::vector<unsigned long int>& startVec ,std::vector<unsigned long int>& mMasterStartVec ,std::map<unsigned long int,vector<int>>& stateVec ,std::map<unsigned long int,vector<int>>& get4IdVec){
void StETofCalibMaker::decodeInt( std::vector<unsigned long int>& intVec ,std::vector<unsigned long int>& startVec ,std::map<unsigned long int,vector<int>>& stateVec ,std::map<unsigned long int,vector<int>>& get4IdVec){

unsigned long int lastEvtId =0;
std::map<int, std::vector< stateStruct > > stateMap;


for(unsigned int i = 0; i < intVec.size(); i++){

Expand All @@ -2873,9 +2892,40 @@ void StETofCalibMaker::decodeInt( std::vector<unsigned long int> intVec ,std::ma
int Get4Id2;
int get4state2;

// decode nonZero/stateChange ints ( int = 42.xxx.xxx.xxx = 2 states only)
stateStruct struct1;
stateStruct struct2;

switch (intVec.at(i) / 100000000) {


//decode default jump states
case 39 :

tmp = intVec.at(i) % 3900000000;
stateInt1 = tmp / 10000;
stateInt2 = tmp % 10000;

Get4Id1 = -1;
get4state1 = -1;
Get4Id2 = -1;
get4state2 = -1;

if(stateInt1 < 6912){
Get4Id1 = stateInt1 % (eTofConst::nGet4sInSystem/2);
get4state1 = stateInt1 / (eTofConst::nGet4sInSystem/2);
}
if(stateInt2 < 6912){
Get4Id2 = stateInt2 % (eTofConst::nGet4sInSystem/2);
get4state2 = stateInt2 / (eTofConst::nGet4sInSystem/2);
}

if(i < (eTofConst::nGet4sInSystem/4) ){
mGet4DefaultStateMap[Get4Id1] = get4state1 + 1; // counting from 1 here
mGet4DefaultStateMap[Get4Id2] = get4state2 + 1; // counting from 1 here
}

break;

// decode nonZero/stateChange ints ( int = 42.xxx.xxx.xxx = 2 states only)
case 42 :
tmp = intVec.at(i) % 4200000000;
stateInt1 = tmp / 10000;
Expand All @@ -2895,7 +2945,8 @@ void StETofCalibMaker::decodeInt( std::vector<unsigned long int> intVec ,std::ma
get4state2 = stateInt2 / eTofConst::nGet4sInSystem;
}

if(i < 864){
if(i >= (eTofConst::nGet4sInSystem/4) && i < ((eTofConst::nGet4sInSystem/4) + (eTofConst::nGet4sInSystem/2))){

mGet4StateMap[Get4Id1] = get4state1;
mGet4StateMap[Get4Id2] = get4state2;
mGet4ZeroStateMap[Get4Id1] = get4state1;
Expand All @@ -2906,6 +2957,18 @@ void StETofCalibMaker::decodeInt( std::vector<unsigned long int> intVec ,std::ma
stateVec[lastEvtId].push_back(get4state2);
get4IdVec[lastEvtId].push_back(Get4Id2);

//stateStruct struct1;
struct1.get4Id = Get4Id1;
struct1.state = get4state1;
struct1.evtId = lastEvtId;
//stateStruct struct2;
struct2.get4Id = Get4Id2;
struct2.state = get4state2;
struct2.evtId = lastEvtId;

stateMap[Get4Id1].push_back(struct1);
stateMap[Get4Id2].push_back(struct2);

break;

//decode eventnumber ( int = 40.xxx.xxx.xxx = event number )
Expand Down Expand Up @@ -2936,10 +2999,37 @@ void StETofCalibMaker::decodeInt( std::vector<unsigned long int> intVec ,std::ma
stateVec[lastEvtId].push_back(get4state1);
get4IdVec[lastEvtId].push_back(Get4Id1);

//stateStruct struct1;
struct1.get4Id = Get4Id1;
struct1.state = get4state1;
struct1.evtId = lastEvtId;

stateMap[Get4Id1].push_back(struct1);

break;

default:
LOG_ERROR << "Get4 state not well defined -> Check db / state file !" << endm;
}
}

//sort vecs (necessary due to get4 splitting)
std::sort(startVec.begin(), startVec.end());
std::sort(mMasterStartVec.begin(), mMasterStartVec.end());

for(unsigned int i=0; i< eTofConst::nGet4sInSystem;i++){

std::vector<stateStruct> tmpVec = stateMap.at(i);

for(unsigned int j=0; j < stateMap.at(i).size();j++){
tmpVec.push_back(stateMap.at(i).at(j));
}
std::sort(tmpVec.begin(), tmpVec.end(), [] (stateStruct x, stateStruct y) { return x.evtId < y.evtId; } );

for(unsigned int j=0; j< tmpVec.size();j++){

stateVec[tmpVec.at(j).evtId].push_back(tmpVec.at(j).state);
get4IdVec[tmpVec.at(j).evtId].push_back(tmpVec.at(j).get4Id);
}
}
}
Loading

0 comments on commit 5c4fc21

Please sign in to comment.