Skip to content

Conversation

@parshadkp
Copy link

@parshadkp parshadkp commented Jan 18, 2026

ShieldTrigger and StripTrigger updated with ASIC and ADC dead time. Changed GeD names to GeD_0, GeD_1 ... and BGO to ACS_X0_0, ACS_X0_1, ACS_X1_0, ACS_X1_1 ...

Still need to add GR vetoes, dead strips, trigger thresholds for both shields and strips and possible telemetry dead time.

ACS energy correction commented out for now. @vfioretti will update and add it back in.

double m_ASICDeadTimePerChannel;

// Shield state tracking
int m_NumShieldHitCounts;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is for the whole file? It could be very large, do:
unsigned long


// Shield state tracking
int m_NumShieldHitCounts;
int m_ShieldVetoCounter;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is for the whole file? It could be very large, do:
unsigned long

Why not Num / NumberOf in front?

// Shield state tracking
int m_NumShieldHitCounts;
int m_ShieldVetoCounter;
int m_NumBGOHitsErased;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is for the whole file? It could be very large, do:
unsigned long

//! Bool to store if ASIC is dead or not
bool m_IsGeDDead;

//! Strip deadtime parameters
Copy link
Collaborator

Choose a reason for hiding this comment

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

Explain all of them

double m_LastTime;

//! Number of detectors
static const int nDets = 12;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why 12 and not 16

vector<vector<vector<double>>> m_TempEvtTimes;

//! Stores trigger rates (number of events) for each detector
vector<int> m_TriggerRates;
Copy link
Collaborator

Choose a reason for hiding this comment

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

A number of events is not a rate. Rate is counts per time


// Read deadtime parameters from file if provided
if (m_DeadtimeFileName != "" && ParseDeadtimeFile() == false) {
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check if we shpuld print an error message here

int countUnique = 0;

if (CrystalIDs.empty()) {
return 0.0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Error message needed?

cout << m_Name << ": Warning - shield detector " << DetectorID
<< " not found in any panel group" << endl;
}
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

check indent

continue;
}

// Check deadtime conditions
Copy link
Collaborator

Choose a reason for hiding this comment

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

The if's here scare me.
First reverse them:
If EventTime > LastHitTime + ShieldDeadTime
--> new veto window
else if EventTime < LastHitTime + ShieldDelay
--> In coincidence window
else if EventTime < LastHitTime + ShieldDeadTime
--> In dead time

Why do I need the last if? Shouldn't all the remaining cases be in dead time? Did I miss soemthing?

}

// Check if event is within veto window
if (((m_ShieldVetoTime + m_ShieldVetoWindowSize) >= m_EventTime) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again, can you reverse it, for readability
if eventTime < VetoTime + VetoWindow...

if (SomeTagNode != 0) {
m_SomeTagValue = SomeTagNode->GetValue();
MXmlNode* DeadtimeFileNode = Node->GetNode("DeadtimeFileName");
if (DeadtimeFileNode != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nullptr

// Initialize the module

// Read deadtime parameters from file
if (m_DeadtimeFileName != "" && ParseDeadtimeFile() == false) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need an error message

for (int ID : ASICChannels) {
if (ID == 64) {
if (g_Verbosity >= c_Warning) {
cout << m_Name << ": Warning - Strip ID is 64; should not happen" << endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not? What about the guard ring which has ID 64

{
// Calculate deadtime for GeD ASICs including nearest neighbor readout
double deadtime = 0;
int countUnique = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's just a temporary variable, define that below

int temp_size = ASICChannelsSet.size();

if (ID == 64) {
if (g_Verbosity >= c_Warning) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about guard ring

ASICChannelsSet.insert(ID + 1);
}

int new_size = ASICChannelsSet.size();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might give warnings: you truncate size_t / unsigned long to int

// Loop through each channel ID
for (size_t i = 0; i < ASICChannels.size(); i++) {
int ID = ASICChannels[i];
int temp_size = ASICChannelsSet.size();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should give a warning: you truncate size_t / unsigend long to int

int h = 0;
for (int k : ASICChannelsSet) {
m_EventStripIDs.push_back(k);
m_EventTimes.push_back(CountTimeVec[h]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this named properly, since it is strip related?
m_EventStrip...Time?

if (!Hit.m_IsGuardRing) {
int DetID = Hit.m_ROE.GetDetectorID();
if (DetID >= 0 && DetID < nDets) {
xExists[DetID] = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you just use 0 and 1, shouldn't it be vector ?

list<MDEEStripHit>& HVHits = Event->GetDEEStripHitHVListReference();

// Process all hits and track deadtime
auto ProcessHits = [&](list<MDEEStripHit>& Hits) {
Copy link
Collaborator

@zoglauer zoglauer Jan 21, 2026

Choose a reason for hiding this comment

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

Usually lambda functions should be something short and not ~70 lines of code...

Copy link
Collaborator

Choose a reason for hiding this comment

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

At a minimum add some explanation what the lambda does

}

// Check deadtime status
if (m_ASICLastHitTime + m_StripsCurrentDeadtime < m_EventTime) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as in the above code. Do
If EventTime > ...

check if the last elseif is not just an else

if (SomeTagNode != 0) {
m_SomeTagValue = SomeTagNode->GetValue();
MXmlNode* DeadtimeFileNode = Node->GetNode("DeadtimeFileName");
if (DeadtimeFileNode != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nullptr

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.

2 participants