Skip to content

Commit 6fbd692

Browse files
authored
Merge branch 'star-bnl:main' into main
2 parents 534f115 + f4d4b69 commit 6fbd692

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4095
-1723
lines changed

.github/copilot-instructions.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Instructions for Code Reviews
2+
3+
You will analyze the files which have been added and/or changed in this pull request. You will consider correctness,
4+
best practice, and the Coding Standards provided below. Where there are
5+
conflicts between best practice and the Coding Standards, you will use the Coding Standards.
6+
7+
These standards represent guidelines. Deviations from them are permitted, if there is a reasonable
8+
justification provided in comments. Such deviations should only be permitted if it makes the code
9+
easier to understand.
10+
11+
You will diligently analyze each of the files which are touched by the pull request. You will review the
12+
changes (diff hunks) submitted in the pull request, considering their correctness, best practice, and adherence to the Coding Standards.
13+
14+
You will consider every bullet point in the Coding Standards. You will note all discrepancies in your review.
15+
You will provide the minimal set of changes which will bring the code into compliance with best practice and
16+
the Coding Standards. Your proposed changes should conform to best practice and the Coding Standards.
17+
18+
For each change you propose, you should explain why you are proposing that change. Be concise in your response.
19+
20+
You will create a table summarizing the code review. For each file touched in the pull request, explicitly state the nature
21+
of the changes which were made, whether they conform to best practice, and whether they conform to the Coding
22+
Standards enumerated below. Where they fail the coding standards, indicate each of the standards which were violated.
23+
24+
Recommended changes should always follow the Coding Standards.
25+
26+
# Coding Standards
27+
28+
Applicable languages: c++11, C99, FORTRAN 77, python 2.7, perl 5, XML.
29+
30+
Where guidance applies to a specific language, it will be noted in square brackets. e.g. [c++].
31+
32+
Follow the principle of least surprise. Software and interfaces should behave in a way that is most predictable and intuitive for developers
33+
and users, minimizing unexpected or surprising actions.
34+
35+
Formatting style not mandated except for fixed-format (FORTRAN77, python).
36+
37+
Follow best practices unless overridden below.
38+
39+
Unit tests may deviate from these conventions.
40+
41+
## File/Class Naming [c++]
42+
* `.h` for headers, `.cxx` for implementations.
43+
* One class/struct or related group per header.
44+
* Classes start with `St`, prefer CamelCase (legacy snake_case allowed).
45+
46+
## Headers [c++]
47+
* Each implementation has a header.
48+
* Use include guards: `__FILEBASENAME_H__`.
49+
* Define functions in implementation files, except short `inline` after class.
50+
* Don't inline virtuals.
51+
* Use angle brackets for external, quotes for project headers.
52+
* Use only necessary includes; minimize dependencies with forward declarations where appropriate.
53+
54+
## Namespaces [c++]
55+
* Avoid namespaces in STAR; use STAR file/class naming conventions to prevent collisions.
56+
57+
## Scoping [general]
58+
* Declare variables in narrowest scope possible.
59+
* Init all variables.
60+
* Prefer brace initialization (except single-argument assignment) [c++].
61+
* Never brace-initialize with `auto` [c++].
62+
* No global vars; static class/namespace variables are discouraged. [c++]
63+
* If global variables are necessary, initialize them statically.
64+
65+
66+
## Classes [c++]
67+
* Every class must declare at least one ctor, even if defaulted with `= default;`.
68+
* Every class must declare a ctor which can be called with no parameters. A ctor with all default parameters is allowed.
69+
* Classes which allocate memory and retain ownership should deallocate memory in the dtor.
70+
* Initialize all data members.
71+
* Don't call virtuals in ctors/dtors.
72+
* Implement/delete assignment/copy ctors (compiler defaults OK if no heap).
73+
* Use delegating/inheriting ctors to avoid duplication.
74+
* Use `struct` only for plain-old-data (POD) types.
75+
* Prefer composition over inheritance.
76+
* Classes which use inheritance should only use public inheritance
77+
* Only one concrete base; others must be pure interfaces (no concrete methods).
78+
* Mark overrides as `override` or `final`.
79+
* Follow the principle of least surprise: preserve operator semantics.
80+
* Explicitly use public/protected/private; list public first.
81+
* Hide internals; don't return handles to internal data.
82+
* Avoid `friend`.
83+
84+
## ROOT [c++]
85+
* Prefer C++ types over ROOT types, except persistent classes.
86+
* e.g. prefer int, float, double, char, bool over Int_t, Float_t, Double_t, Char_t, Bool_t.
87+
* Prefer `<cmath>` over ROOT math (TMath::*).
88+
89+
## Introspection [c++]
90+
* Prefer `auto` over `decltype`.
91+
* Avoid macros.
92+
* Avoid dynamic_cast except for error detection.
93+
94+
## General
95+
* Avoid magic numbers.
96+
* Keep functions small/focused.
97+
* Avoid exceptions/asserts unless necessary [c++].
98+
99+
## Miscellaneous [c++]
100+
* Prefer strong enums.
101+
* Avoid lambdas for frequent calls or reference capture.
102+
* Use `const` for logically constant objects; design const-correct interfaces.
103+
* Use `constexpr` for true constants or constant init.
104+
* Avoid smart pointers (ROOT ownership).
105+
* Avoid casting; use `static_cast` if needed, avoid `const_cast`, `reinterpret_cast`, and C-casts.
106+
* No variable-length arrays or `alloca()`.
107+
* Prefer prefix ++/--.
108+
* Switch: cover all cases, use default if needed.
109+
* No empty loop bodies; use `continue` or empty block.
110+
* Declare iteration vars in loop conditions.
111+
* Use range-for and (const) reference where possible.
112+
* Prefer iterator if index needed.
113+
* Use `int` unless fixed size needed (`<cstdint>`).
114+
* Ensure portability (printing, comparison, alignment).
115+
* Use `nullptr` for pointers.
116+
* Prefer `sizeof(var)` to `sizeof(type)`.
117+
* Use `auto` for local vars if it improves readability.
118+
* Use non-member `begin()`/`end()`.
119+
120+
## Non-Conformant Code
121+
* Deviations allowed for legacy code.
122+
* Refactor incrementally, one deviation at a time, preserving behavior.
123+
124+
125+
126+
127+

StRoot/StBFChain/BigFullChain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,7 @@ Bfc_st BFC[] = { // standard chains
19491949
{"PicoVtxVpdOrDefault","","","-PicoVtxDefault" ,"","","pico Vtx cut on Tof and VPD or default",kFALSE},
19501950
{"PicoVtxFXT" ,"","","-PicoVtxDefault" ,"" ,"","pico Vtx constraint on FXT [198,202] mode",kFALSE},
19511951
{"PicoVtxMtd" ,"","","-PicoVtxDefault" ,"" ,"","pico Vtx using MTD matching mode",kFALSE},
1952+
{"PicoVtxless" ,"","","-PicoVtxDefault" ,"" ,"","pico Vtx NOT required for FWD" ,kFALSE},
19521953
{"PicoCovMtxSkip" ,"","","" ,"" ,"","Do not write covariance matrices to picoDst (default)",kFALSE},
19531954
{"PicoCovMtxWrite","","","-PicoCovMtxSkip" ,"" ,"","Write track covariance matrices to picoDst",kFALSE},
19541955
{"PicoBEmcSmdSkip" ,"","","" ,"" ,"","Do not write BSMD to picoDst (default)",kFALSE},

StRoot/StBFChain/StBFChain.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ Int_t StBFChain::Instantiate()
696696
else if ( GetOption("PicoVtxMtd")) mk->SetAttr("PicoVtxMode", "PicoVtxMtd");
697697
else if ( GetOption("PicoVtxVpdOrDefault")) mk->SetAttr("PicoVtxMode", "PicoVtxVpdOrDefault");
698698
else if ( GetOption("PicoVtxDefault")) mk->SetAttr("PicoVtxMode", "PicoVtxDefault");
699+
else if ( GetOption("PicoVtxless")) mk->SetAttr("PicoVtxMode", "PicoVtxless");
699700
if ( GetOption("PicoCovMtxWrite")) mk->SetAttr("PicoCovMtxMode", "PicoCovMtxWrite");
700701
else if ( GetOption("PicoCovMtxSkip")) mk->SetAttr("PicoCovMtxMode", "PicoCovMtxSkip"); // Default mode
701702
if ( GetOption("PicoBEmcSmdWrite")) mk->SetAttr("PicoBEmcSmdMode", "PicoBEmcSmdWrite");

StRoot/StEvent/StTrackTopologyMap.cxx

Lines changed: 89 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@
8282
* 50 18 TPC row=43
8383
* 51 19 TPC row=44
8484
* 52 20 TPC row=45
85-
* 53 21 Mwpc
85+
* 53 21 Mwpc / TPC prompt hit
8686
* 54 22 CTB
8787
* 55 23 ToF
8888
* 56 24 RICH
8989
* 57 25 Barrel EMC/SMD
9090
* 58 26 Endcap EMC/SMD
91-
* 59 27
92-
* 60 28
91+
* 59 27 Post-crossing track
92+
* 60 28 Central-membrane crossing track
9393
* 61 29 HFT Format (case 3) - TPC tracks
9494
* 62 30 turn around flag (flags that track spirals back)
9595
* 63 31 FTPC Format (flags TOC or FTPC)
@@ -318,6 +318,86 @@ StTrackTopologyMap::hasHitInSsdLayer(unsigned int layer) const
318318
}
319319
}
320320

321+
bool
322+
StTrackTopologyMap::hasHitInMwpc() const
323+
{
324+
if(ftpcFormat())
325+
return false;
326+
else {
327+
return bit(53);
328+
}
329+
}
330+
331+
bool
332+
StTrackTopologyMap::hasHitInCtb() const
333+
{
334+
if(ftpcFormat())
335+
return false;
336+
else {
337+
return bit(54);
338+
}
339+
}
340+
341+
bool
342+
StTrackTopologyMap::hasHitInTof() const
343+
{
344+
if(ftpcFormat())
345+
return false;
346+
else {
347+
return bit(55);
348+
}
349+
}
350+
351+
bool
352+
StTrackTopologyMap::hasHitInRich() const
353+
{
354+
if(ftpcFormat())
355+
return false;
356+
else {
357+
return bit(56);
358+
}
359+
}
360+
361+
bool
362+
StTrackTopologyMap::hasHitInBemc() const
363+
{
364+
if(ftpcFormat())
365+
return false;
366+
else {
367+
return bit(57);
368+
}
369+
}
370+
371+
bool
372+
StTrackTopologyMap::hasHitInEemc() const
373+
{
374+
if(ftpcFormat())
375+
return false;
376+
else {
377+
return bit(58);
378+
}
379+
}
380+
381+
bool
382+
StTrackTopologyMap::postXTrack() const
383+
{
384+
if(ftpcFormat())
385+
return false;
386+
else {
387+
return bit(59);
388+
}
389+
}
390+
391+
bool
392+
StTrackTopologyMap::membraneCrossingTrack() const
393+
{
394+
if(ftpcFormat())
395+
return false;
396+
else {
397+
return bit(60);
398+
}
399+
}
400+
321401
bool
322402
StTrackTopologyMap::hasHitInRow(StDetectorId id, unsigned int row) const
323403
{
@@ -389,28 +469,28 @@ StTrackTopologyMap::numberOfHits(StDetectorId id) const
389469
break;
390470
case kMwpcWestId:
391471
case kMwpcEastId:
392-
if (bit(53)) n++;
472+
if (hasHitInMwpc()) n++;
393473
break;
394474
case kCtbId:
395-
if (bit(54)) n++;
475+
if (hasHitInCtb()) n++;
396476
break;
397477
case kTofId:
398-
if (bit(55)) n++;
478+
if (hasHitInTof()) n++;
399479
break;
400480
case kRichId:
401-
if (bit(56)) n++;
481+
if (hasHitInRich()) n++;
402482
break;
403483
case kBarrelEmcTowerId:
404484
case kBarrelEmcPreShowerId:
405485
case kBarrelSmdEtaStripId:
406486
case kBarrelSmdPhiStripId:
407-
if (bit(57)) n++;
487+
if (hasHitInBemc()) n++;
408488
break;
409489
case kEndcapEmcTowerId:
410490
case kEndcapEmcPreShowerId:
411491
case kEndcapSmdUStripId:
412492
case kEndcapSmdVStripId:
413-
if (bit(58)) n++;
493+
if (hasHitInEemc()) n++;
414494
break;
415495
default:
416496
n = 0;

StRoot/StEvent/StTrackTopologyMap.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ class StTrackTopologyMap : public StObject {
8787
bool hasHitInIstLayer(unsigned int) const; // first layer = 1
8888
bool hasHitInSsdLayer(unsigned int) const; // first layer = 1
8989
bool hasHitInSstLayer(unsigned int) const;
90+
bool hasHitInMwpc() const;
91+
bool hasHitInTpcPrompt() const;
92+
bool hasHitInCtb() const;
93+
bool hasHitInTof() const;
94+
bool hasHitInRich() const;
95+
bool hasHitInBemc() const;
96+
bool hasHitInEemc() const;
97+
bool postXTrack() const;
98+
bool membraneCrossingTrack() const;
9099

91100
bool trackTpcOnly() const;
92101
bool trackSvtOnly() const;
@@ -121,4 +130,9 @@ inline bool StTrackTopologyMap::hasHitInSstLayer(unsigned int val) const
121130
return hasHitInSsdLayer(val);
122131
}
123132

133+
inline bool StTrackTopologyMap::hasHitInTpcPrompt() const
134+
{
135+
return hasHitInMwpc();
136+
}
137+
124138
#endif

StRoot/StEventUtilities/StuFixTopoMap.cxx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
* map[1] Bit number Quantity
3636
* ------ ---------- --------
3737
* 0-20 TPC, remaining 21 padrows
38-
* 21 Track extrapolates to MWC (no=0, yes=1)
38+
* 21 Track extrapolates to MWC (no=0, yes=1) (or has prompt hits)
3939
* 22 Track extrapolates to CTB (no=0, yes=1)
4040
* 23 Track extrapolates to TOF (no=0, yes=1)
4141
* 24 Track extrapolates to RCH (no=0, yes=1)
4242
* 25 Track extrapolates to EMCB (no=0, yes=1)
4343
* 26 Track extrapolates to EMCEC (no=0, yes=1)
44-
* 27-29 reserved for future use
44+
* 27 Track post-crossing (no=0, yes=1)
45+
* 28 Track crosses TPC central membrane (no=0, yes=1)
46+
* 29 reserved for future use
4547
* 30 Turn around flag, some elements used >1
4648
* 31 Format interpreter; (SVT/SSD/TPC=0,FTPC=1)
4749
*
@@ -68,7 +70,8 @@
6870
* 24 Track extrapolates to RCH (no=0, yes=1)
6971
* 25 Track extrapolates to EMCB (no=0, yes=1)
7072
* 26 Track extrapolates to EMCEC (no=0, yes=1)
71-
* 27-28 reserved for future use
73+
* 27 Track post-crossing (no=0, yes=1)
74+
* 28 Track crosses TPC central membrane (no=0, yes=1)
7275
* 29 HFT flag (HFT=1, SVT/SSD=0)
7376
* 30 Turn around flag, some elements used >1
7477
* 31 Format interpreter; (SVT/SSD/TPC=0,FTPC=1)
@@ -142,6 +145,18 @@ bool StuFixTopoMap(StTrack* track)
142145
}
143146
else {
144147

148+
// Tracks with hits on other detectors
149+
if (track->isPromptTrack()) word2 |= 1U<<21; // Prompt hit is an MWPC hit
150+
if (track->isCtbMatched()) word2 |= 1U<<22;
151+
if (track->isToFMatched() ||
152+
track->isBToFMatched()) word2 |= 1U<<23;
153+
if (track->isBemcMatched()) word2 |= 1U<<25;
154+
if (track->isEemcMatched()) word2 |= 1U<<26;
155+
156+
// Tracks with helpful pile-up rejection flags
157+
if (track->isPostXTrack()) word2 |= 1U<<27;
158+
if (track->isMembraneCrossingTrack()) word2 |= 1U<<28;
159+
145160
// ???
146161
if (info->numberOfReferencedPoints(kPxlId) ||
147162
info->numberOfReferencedPoints(kSstId) ||

0 commit comments

Comments
 (0)