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

Clock jump defaults #719

Merged
merged 46 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9a72c75
ClockJump_correction update and new method for Hit manipulation on co…
Dec 5, 2022
9889653
added missing etofHelperFunctions
Dec 6, 2022
ffa9088
addressed suggested changes
Dec 15, 2022
febf3f7
Merge branch 'main' into ClockJumpCorrection-and-CounterMod-update
plexoos Dec 17, 2022
c62c0a9
Merge branch 'main' into ClockJumpCorrection-and-CounterMod-update
plexoos Dec 20, 2022
8551432
2nd round of comments
Dec 21, 2022
0923a14
Merge branch 'ClockJumpCorrection-and-CounterMod-update' of https://g…
Dec 21, 2022
b9dcf39
change white space
plexoos Dec 21, 2022
7cd0372
3d round of comments
Dec 28, 2022
fa5e2c5
Merge branch 'ClockJumpCorrection-and-CounterMod-update' of https://g…
Dec 28, 2022
9a8fd38
4th round of comments
Jan 4, 2023
a38037f
Merge branch 'main' into ClockJumpCorrection-and-CounterMod-update
plexoos Jan 4, 2023
eda3e89
5th round of comments
Jan 5, 2023
e10c291
Merge branch 'ClockJumpCorrection-and-CounterMod-update' of https://g…
Jan 5, 2023
79f22f2
bug fix in HitMaker
Jan 5, 2023
ef9e5b6
Clean up white space according to coding guidelines
plexoos Jan 3, 2023
98f1101
remove undefined class method
plexoos Jan 10, 2023
7139608
Revert "bug fix in HitMaker"
plexoos Jan 10, 2023
fa6331e
Tweak StETofGeometry::init() default params
plexoos Jan 10, 2023
4c77e07
renamed variables and replaced 6.25 by etofConstant
Jan 10, 2023
591ab4e
Merge branch 'ClockJumpCorrection-and-CounterMod-update' of https://g…
Jan 10, 2023
9e25945
removed unused variable
Jan 10, 2023
b9b1559
adjusted default electronics dead-time
Jan 11, 2023
63f2ad4
Merge remote-tracking branch 'origin' into MaskCountersForProduction
May 24, 2023
fdd2424
add set method in MatchMaker, fix HitMaker for masking counters
Jun 1, 2023
84cd1e5
fixed PulserCorrection, added set method for AfterpulseCorrection
Jul 6, 2023
e5e1adf
StatusFlag Fix and implementation of SingleSidedMatches
Feb 28, 2024
a86d3ad
incremented ClassDef
Mar 5, 2024
b7b6d86
Merge branch 'main' into MatchUpdate-and-EventFlagFix
plexoos Mar 6, 2024
32cb6b6
removed unnecessary if statement
Mar 13, 2024
ab90434
Merge branch 'main' into MatchUpdate-and-EventFlagFix
YannickSoehngen Mar 13, 2024
ac94c47
removed unused variable
Mar 13, 2024
d92ae2b
adressed compiler warnings
Mar 15, 2024
cb80b34
fix match flag and efficiency
Aug 12, 2024
37deacc
clock jump calibration update
Sep 22, 2024
b93bd0e
get4Pair default jump state
Nov 22, 2024
b8f3a14
Merge branch 'main' into clock-jump-defaults
YannickSoehngen Nov 22, 2024
1e43cbe
Update StETofCalibMaker.cxx
YannickSoehngen Nov 22, 2024
8740219
Update StETofCalibMaker.cxx
YannickSoehngen Nov 24, 2024
1b66851
Update StRoot/StETofHitMaker/StETofHitMaker.cxx
YannickSoehngen Nov 27, 2024
1a2b0c3
Update StRoot/StETofCalibMaker/StETofCalibMaker.cxx
YannickSoehngen Nov 27, 2024
e155cd6
Update StRoot/StETofHitMaker/StETofHitMaker.cxx
YannickSoehngen Nov 27, 2024
8f7d238
Update StRoot/StETofCalibMaker/StETofCalibMaker.cxx
YannickSoehngen Nov 27, 2024
936e8b8
Update StRoot/StETofCalibMaker/StETofCalibMaker.h
YannickSoehngen Nov 27, 2024
959f595
Update StRoot/StETofCalibMaker/StETofCalibMaker.cxx
YannickSoehngen Nov 27, 2024
cd0bd6b
Update StETofCalibMaker.cxx
YannickSoehngen Dec 18, 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
109 changes: 96 additions & 13 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(false)


{
/// 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 @@ -2168,7 +2175,10 @@ StETofCalibMaker::applyCalibration( StETofDigi* aDigi, StETofHeader* etofHeader
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;

// only calibrate here if flag is set
if(!mCalState) stateCorr = 0;


double calibTime = aDigi->rawTime() - mResetTime
- resetTimeCorr()
Expand Down Expand Up @@ -2689,12 +2699,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 +2753,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 , mGet4StateMap , mGet4ZeroStateMap , startVec , mMasterStartVec , stateVec , get4IdVec, mGet4DefaultStateMap);
YannickSoehngen marked this conversation as resolved.
Show resolved Hide resolved

// 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 @@ -2858,9 +2868,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::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, std::map<int , short>& mGet4DefaultStateMap){
YannickSoehngen marked this conversation as resolved.
Show resolved Hide resolved

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 +2885,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){
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(stateInt1 < 6912){
if(stateInt1 < eTofConst::nChannelsInSystem){

Get4Id1 = stateInt1 % (eTofConst::nGet4sInSystem/2);
get4state1 = stateInt1 / (eTofConst::nGet4sInSystem/2);
}
if(stateInt2 < 6912){
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if(stateInt2 < 6912){
if(stateInt1 < eTofConst::nChannelsInSystem){

Get4Id2 = stateInt2 % (eTofConst::nGet4sInSystem/2);
get4state2 = stateInt2 / (eTofConst::nGet4sInSystem/2);
}

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

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 +2938,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 +2950,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 +2992,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< 1728;i++){
YannickSoehngen marked this conversation as resolved.
Show resolved Hide resolved

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);
}
}
}
23 changes: 21 additions & 2 deletions StRoot/StETofCalibMaker/StETofCalibMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ class StETofCalibMaker: public StMaker {
void setFileNameResetTimeCorr( const char* fileName );
void setFileNamePulserTotPeak( const char* fileName );
void setFileNamePulserTimeDiffGbtx( const char* fileName );
void setCalState( const bool calTrue );
bool calState();

void setDoQA( const bool doQA );
void setDebug( const bool debug );
void setStrictPulserHandling( const bool debug );
void setReferencePulserIndex( const int index );

short GetState(int);
short GetDefaultState(int);


//moved to public to avoid problem with root6
struct StructStuckFwDigi{
Expand All @@ -103,6 +107,12 @@ class StETofCalibMaker: public StMaker {
}
};

struct stateStruct{
int get4Id;
unsigned long int evtId;
Double_t state;
};


private:
bool isFileExisting( const std::string fileName );
Expand Down Expand Up @@ -206,19 +216,28 @@ class StETofCalibMaker: public StMaker {
std::vector<unsigned long int> mMasterStartVec;
std::map<int , short> mGet4StateMap;
std::map<int , short> mGet4ZeroStateMap;
std::map<int , short> mGet4DefaultStateMap;

unsigned long int mStateMapStart;
unsigned long int mStateMapStop;
unsigned long int mDbEntryStart;
unsigned long int mDbEntryStop;
int mGlobalCounter;
bool mCalState;

void 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, std::map<int , short>& mGet4DefaultStateMap);
YannickSoehngen marked this conversation as resolved.
Show resolved Hide resolved

void 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);

virtual const Char_t *GetCVS() const { static const char cvs[]="Tag $Name: $Id: built " __DATE__ " " __TIME__ ; return cvs; }

ClassDef( StETofCalibMaker, 0 )
};
inline short StETofCalibMaker::GetState( int get4 ) { return mGet4StateMap.at(get4); }

inline bool StETofCalibMaker::calState( ) { return mCalState; }
inline short StETofCalibMaker::GetDefaultState( int get4 ) { return mGet4DefaultStateMap.at(get4); }
inline short StETofCalibMaker::GetState( int get4 ) { return mGet4StateMap.at(get4); }
inline void StETofCalibMaker::setCalState( const bool calTrue ) { mCalState = calTrue; }

inline void StETofCalibMaker::setFileNameCalibParam( const char* fileName ) { mFileNameCalibParam = fileName; }
inline void StETofCalibMaker::setFileNameElectronicsMap( const char* fileName ) { mFileNameElectronicsMap = fileName; }
inline void StETofCalibMaker::setFileNameStatusMap( const char* fileName ) { mFileNameStatusMap = fileName; }
Expand Down
Loading
Loading