-
Notifications
You must be signed in to change notification settings - Fork 3
Implementation of strip class and position for calibration v2 #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,3 +57,4 @@ macros/data | |
| .DS_Store | ||
| .nfs* | ||
| compiled/E20009Analysis/.NabinWorkDir/ | ||
| macro/Unpack_HDF5/E535_RCNP/trace.csv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,8 +53,8 @@ void AtSiEvent::Clear(Option_t *opt) | |
| fADCMaxFront2[i] = -1; | ||
| fADCMaxBack2[i] = -1; | ||
|
|
||
| fStripFront2[i] = -1; | ||
| fStripBack2[i] = -1; | ||
| fStripFront1[i] = -1; | ||
| fStripBack1[i] = -1; | ||
| fStripFront2[i] = -1; | ||
| fStripBack2[i] = -1; | ||
| } | ||
|
|
@@ -64,3 +64,85 @@ void AtSiEvent::Clear(Option_t *opt) | |
| fMultiplicityFront2 = 0; | ||
| fMultiplicityBack2 = 0; | ||
| } | ||
|
|
||
| void AtSiEvent::BuildHits() { //Returning strips to build physical map of Si detectors. For now focusing on multiplicity of 1 or 2 | ||
| bool valid1 = true; | ||
| if (fMultiplicityFront1 == 1) { //To-Do: there are many strips within the reaction runs that have a multiplicity>2. Might be beneficial to implement other combinations of multiplicities so we are not throwing out data. | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there are not many with multiplicity>2, maybe it's not such a big priority. However, it may be easy to generalize looking at what you do in mult=2 case. Something like the following maybe? Energy = 0 Of course, there would need to be a check to see if all hits are in consecutive strips and set the valid variable according to that. Maybe it is also worth considering adding a clustering step before this part of the analysis so that different clusters of hits can be analyzed separately. But maybe it is not a priority right now.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When looking at a run of the reaction data, there were <=500 counts for both multiplicity 3 and 4. I was and am still unsure if we should completely disregard this amount of data. For the calibration runs on the Si, I agree it might not be a priority right now but could definitely come up in the future in regards to the reaction data.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that we should not disregard this data, since it is still usable with an easy change to this part of the code. So in the following pull requests you can work on that. |
||
| //everything is easy | ||
| fXStrip1 = fStripFront1[0]%128; | ||
| fEnergyFront1 = fEFront1[0]; | ||
| } | ||
| else if (fMultiplicityFront1 == 2) { | ||
| if (abs(fStripFront1[0] - fStripFront1[1]) == 1) { //neighbours | ||
| fEnergyFront1 = fEFront1[0] + fEFront1[1]; | ||
| //take strip from whichever has larger energy | ||
| if (fEFront1[0] > fEFront1[1]) { fXStrip1 = fStripFront1[0]%128; } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may also be worth adding a center of gravity variable? I am not sure if it could be useful, but this would be the mean Strip value weighted by energy.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm this could be useful for exact positioning on the strips and also could be more useful for higher multiplicity values. |
||
| else { fXStrip1 = fStripFront1[1]%128; } | ||
| } | ||
| else { valid1 = false; } | ||
| } | ||
| else { valid1 = false; } | ||
|
|
||
| if (fMultiplicityBack1 == 1) { | ||
| //everything is easy | ||
| fYStrip1 = 128-fStripBack1[0]%128; | ||
| fEnergyBack1 = fEBack1[0]; | ||
| } | ||
| else if (fMultiplicityBack1 == 2) { | ||
| if (abs(fStripBack1[0] - fStripBack1[1]) == 1) { //neighbours | ||
| fEnergyBack1 = fEBack1[0] + fEBack1[1]; | ||
| //take strip from whichever has larger energy | ||
| if (fEBack1[0] > fEBack1[1]) { fYStrip1 = 128-fStripBack1[0]%128; } | ||
| else { fYStrip1 = 128-fStripBack1[1]%128; } | ||
| } | ||
| else { valid1 = false; } | ||
| } | ||
| else { valid1 = false; } | ||
|
|
||
| bool valid2 = true; | ||
| if (fMultiplicityFront2 == 1) { | ||
| //everything is easy | ||
| fXStrip2 = fStripFront2[0]%128; | ||
| fEnergyFront2 = fEFront2[0]; | ||
| } | ||
| else if (fMultiplicityFront2 == 2) { | ||
| if (abs(fStripFront2[0] - fStripFront2[1]) == 1) { //neighbours | ||
| fEnergyFront2 = fEFront2[0] + fEFront2[1]; | ||
| //take strip from whichever has larger energy | ||
| if (fEFront2[0] > fEFront2[1]) { fXStrip2 = fStripFront2[0]%128; } | ||
| else { fXStrip2 = fStripFront2[1]%128; } | ||
| } | ||
| else { valid2 = false; } | ||
| } | ||
| else { valid2 = false; } | ||
|
|
||
| if (fMultiplicityBack2 == 1) { | ||
| //everything is easy | ||
| fYStrip2 = 128-fStripBack2[0]%128; | ||
| fEnergyBack2 = fEBack2[0]; | ||
| } | ||
| else if (fMultiplicityBack2 == 2) { | ||
| if (abs(fStripBack2[0] - fStripBack2[1]) == 1) { //neighbours | ||
| fEnergyBack2 = fEBack2[0] + fEBack2[1]; | ||
| //take strip from whichever has larger energy | ||
| if (fEBack2[0] > fEBack2[1]) { fYStrip2 = 128-fStripBack2[0]%128; } | ||
| else { fYStrip2 = 128-fStripBack2[1]%128; } | ||
| } | ||
| else { valid2 = false; } | ||
| } | ||
| else { valid2 = false; } | ||
|
|
||
| if (valid1 == false) { | ||
| fYStrip1 = -1; | ||
| fXStrip1 = -1; | ||
| fEnergyFront1 = -1; | ||
| fEnergyBack1 = -1; | ||
| } | ||
| if (valid2 == false) { | ||
| fYStrip2 = -1; | ||
| fXStrip2 = -1; | ||
| fEnergyFront2 = -1; | ||
| fEnergyBack2 = -1; | ||
| } | ||
|
Comment on lines
+135
to
+146
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another way this can be done is by initializing all these to -1 at the beginning of the function. These would only be updated to the correct values in the cases where valid1(2) are kept true. This would make valid1(2) not needed anymore too. Minor detail, so it is fine as is. If we consider refactoring this part of the code in the future, then this could be changed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea behind this was that if either x or y doesn't have a valid value assigned, then all the values are marked as "invalid" - that way you can check any of them to see if a good hit has been reconstructed |
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,15 @@ class AtSiEvent : public AtBaseEvent { | |
| Int_t fMultiplicityFront2 = 0; | ||
| Int_t fMultiplicityBack2 = 0; | ||
|
|
||
| Int_t fXStrip1 = -1; //positioning of strips class | ||
| Int_t fXStrip2 = -1; | ||
| Int_t fYStrip1 = -1; | ||
| Int_t fYStrip2 = -1; | ||
| Double_t fEnergyFront1 = -1; //storing energy of strips | ||
| Double_t fEnergyFront2 = -1; | ||
| Double_t fEnergyBack1 = -1; | ||
| Double_t fEnergyBack2 = -1; | ||
|
Comment on lines
+38
to
+45
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you add these, I think you should take them into account in the swap function defined in line 54, in copy initializer in line 49 (the implementation is in the .cxx tho) and the Clear function in line 80 (implementation in the .cxx too). |
||
|
|
||
| public: | ||
| AtSiEvent(); | ||
| AtSiEvent(const AtSiEvent ©); | ||
|
|
@@ -110,6 +119,18 @@ class AtSiEvent : public AtBaseEvent { | |
| Int_t GetMultiplicityFront2() { return fMultiplicityFront2; } | ||
| Int_t GetMultiplicityBack2() { return fMultiplicityBack2; } | ||
|
|
||
| Int_t GetXStrip1() { return fXStrip1; } | ||
| Int_t GetXStrip2() { return fXStrip2; } | ||
| Int_t GetYStrip1() { return fYStrip1; } | ||
| Int_t GetYStrip2() { return fYStrip2; } | ||
|
|
||
| Double_t GetEnergyFront1() { return fEnergyFront1; } | ||
| Double_t GetEnergyFront2() { return fEnergyFront2; } | ||
| Double_t GetEnergyBack1() { return fEnergyBack1; } | ||
| Double_t GetEnergyBack2() { return fEnergyBack2; } | ||
|
|
||
| void BuildHits(); | ||
|
|
||
| ClassDefOverride(AtSiEvent, 1); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| #include "AtSiEvent.h" | ||
|
|
||
| #include "AtContainerManip.h" | ||
|
|
||
| #include <Rtypes.h> | ||
|
|
||
| #include <algorithm> | ||
| #include <string> // for string | ||
|
|
||
| ClassImp(AtSiEvent); | ||
|
|
||
| AtSiEvent::AtSiEvent() : AtBaseEvent("AtSiEvent") {} | ||
|
|
||
| AtSiEvent::AtSiEvent(const AtSiEvent ©) : AtBaseEvent(copy), | ||
| fMultiplicityFront1(copy.fMultiplicityFront1), fMultiplicityBack1(copy.fMultiplicityBack1), | ||
| fMultiplicityFront2(copy.fMultiplicityFront2), fMultiplicityBack2(copy.fMultiplicityBack2) | ||
| { | ||
| for (int i = 0; i < 4; i++) { | ||
| fEFront1[i] = copy.fEFront1[i]; | ||
| fEBack1[i] = copy.fEBack1[i]; | ||
| fEFront2[i] = copy.fEFront2[i]; | ||
| fEBack2[i] = copy.fEBack2[i]; | ||
|
|
||
| fADCMaxFront1[i] = copy.fADCMaxFront1[i]; | ||
| fADCMaxBack1[i] = copy.fADCMaxBack1[i]; | ||
| fADCMaxFront2[i] = copy.fADCMaxFront2[i]; | ||
| fADCMaxBack2[i] = copy.fADCMaxBack2[i]; | ||
|
|
||
| fStripFront1[i] = copy.fStripFront1[i]; | ||
| fStripBack1[i] = copy.fStripBack1[i]; | ||
| fStripFront2[i] = copy.fStripFront2[i]; | ||
| fStripBack2[i] = copy.fStripBack2[i]; | ||
| } | ||
| } | ||
|
|
||
| AtSiEvent &AtSiEvent::operator=(AtSiEvent object) | ||
| { | ||
| swap(*this, object); | ||
| return *this; | ||
| } | ||
|
|
||
| void AtSiEvent::Clear(Option_t *opt) | ||
| { | ||
| AtBaseEvent::Clear(opt); | ||
| for (int i = 0; i < 4; i++) { | ||
| fEFront1[i] = -1; | ||
| fEBack1[i] = -1; | ||
| fEFront2[i] = -1; | ||
| fEBack2[i] = -1; | ||
|
|
||
| fADCMaxFront1[i] = -1; | ||
| fADCMaxBack1[i] = -1; | ||
| fADCMaxFront2[i] = -1; | ||
| fADCMaxBack2[i] = -1; | ||
|
|
||
| fStripFront2[i] = -1; | ||
| fStripBack2[i] = -1; | ||
| fStripFront2[i] = -1; | ||
| fStripBack2[i] = -1; | ||
| } | ||
|
|
||
| fMultiplicityFront1 = 0; | ||
| fMultiplicityBack1 = 0; | ||
| fMultiplicityFront2 = 0; | ||
| fMultiplicityBack2 = 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #ifndef AtSIEVENT_H | ||
| #define AtSIEVENT_H | ||
|
|
||
| #include "AtBaseEvent.h" | ||
|
|
||
| #include <Rtypes.h> | ||
|
|
||
| #include <memory> | ||
| #include <type_traits> | ||
| #include <utility> | ||
| #include <vector> | ||
| class TBuffer; | ||
| class TClass; | ||
| class TMemberInspector; | ||
|
|
||
| class AtSiEvent : public AtBaseEvent { | ||
| private: | ||
| Double_t fEFront1[4] = {-1, -1, -1, -1}; | ||
| Double_t fEBack1[4] = {-1, -1, -1, -1}; | ||
| Double_t fEFront2[4] = {-1, -1, -1, -1}; | ||
| Double_t fEBack2[4] = {-1, -1, -1, -1}; | ||
|
|
||
| Double_t fADCMaxFront1[4] = {-1, -1, -1, -1}; | ||
| Double_t fADCMaxBack1[4] = {-1, -1, -1, -1}; | ||
| Double_t fADCMaxFront2[4] = {-1, -1, -1, -1}; | ||
| Double_t fADCMaxBack2[4] = {-1, -1, -1, -1}; | ||
|
|
||
| Int_t fStripFront1[4] = {-1, -1, -1, -1}; | ||
| Int_t fStripBack1[4] = {-1, -1, -1, -1}; | ||
| Int_t fStripFront2[4] = {-1, -1, -1, -1}; | ||
| Int_t fStripBack2[4] = {-1, -1, -1, -1}; | ||
|
|
||
| Int_t fMultiplicityFront1 = 0; | ||
| Int_t fMultiplicityBack1 = 0; | ||
| Int_t fMultiplicityFront2 = 0; | ||
| Int_t fMultiplicityBack2 = 0; | ||
|
|
||
| public: | ||
| AtSiEvent(); | ||
| AtSiEvent(const AtSiEvent ©); | ||
| AtSiEvent(const AtBaseEvent ©) : AtBaseEvent(copy) { SetName("AtSiEvent"); } | ||
| AtSiEvent &operator=(const AtSiEvent object); | ||
| virtual ~AtSiEvent() = default; | ||
|
|
||
| friend void swap(AtSiEvent &first, AtSiEvent &second) | ||
| { | ||
| using std::swap; | ||
| swap(dynamic_cast<AtBaseEvent &>(first), dynamic_cast<AtBaseEvent &>(second)); | ||
|
|
||
| swap(first.fEFront1, second.fEFront1); | ||
| swap(first.fEBack1, second.fEBack1); | ||
| swap(first.fEFront2, second.fEFront2); | ||
| swap(first.fEBack2, second.fEBack2); | ||
|
|
||
| swap(first.fADCMaxFront1, second.fADCMaxFront1); | ||
| swap(first.fADCMaxBack1, second.fADCMaxBack1); | ||
| swap(first.fADCMaxFront2, second.fADCMaxFront2); | ||
| swap(first.fADCMaxBack2, second.fADCMaxBack2); | ||
|
|
||
| swap(first.fStripFront1, second.fStripFront1); | ||
| swap(first.fStripBack1, second.fStripBack1); | ||
| swap(first.fStripFront2, second.fStripFront2); | ||
| swap(first.fStripBack2, second.fStripBack2); | ||
|
|
||
| swap(first.fMultiplicityFront1, second.fMultiplicityFront1); | ||
| swap(first.fMultiplicityBack1, second.fMultiplicityBack1); | ||
| swap(first.fMultiplicityFront2, second.fMultiplicityFront2); | ||
| swap(first.fMultiplicityBack2, second.fMultiplicityBack2); | ||
| } | ||
|
|
||
| void Clear(Option_t *opt = nullptr) override; | ||
|
|
||
| void SetEFront1(Int_t idx, Double_t value) { fEFront1[idx] = value; } | ||
| void SetEBack1(Int_t idx, Double_t value) { fEBack1[idx] = value; } | ||
| void SetEFront2(Int_t idx, Double_t value) { fEFront2[idx] = value; } | ||
| void SetEBack2(Int_t idx, Double_t value) { fEBack2[idx] = value; } | ||
|
|
||
| void SetADCMaxFront1(Int_t idx, Double_t value) { fADCMaxFront1[idx] = value; } | ||
| void SetADCMaxBack1(Int_t idx, Double_t value) { fADCMaxBack1[idx] = value; } | ||
| void SetADCMaxFront2(Int_t idx, Double_t value) { fADCMaxFront2[idx] = value; } | ||
| void SetADCMaxBack2(Int_t idx, Double_t value) { fADCMaxBack2[idx] = value; } | ||
|
|
||
| void SetStripFront1(Int_t idx, Int_t value) { fStripFront1[idx] = value; } | ||
| void SetStripBack1(Int_t idx, Int_t value) { fStripBack1[idx] = value; } | ||
| void SetStripFront2(Int_t idx, Int_t value) { fStripFront2[idx] = value; } | ||
| void SetStripBack2(Int_t idx, Int_t value) { fStripBack2[idx] = value; } | ||
|
|
||
| void SetMultiplicityFront1(Int_t value) { fMultiplicityFront1 = value; } | ||
| void SetMultiplicityBack1(Int_t value) { fMultiplicityBack1 = value; } | ||
| void SetMultiplicityFront2(Int_t value) { fMultiplicityFront2 = value; } | ||
| void SetMultiplicityBack2(Int_t value) { fMultiplicityBack2 = value; } | ||
|
|
||
| Double_t GetEFront1(Int_t idx) { return fEFront1[idx]; } | ||
| Double_t GetEBack1(Int_t idx) { return fEBack1[idx]; } | ||
| Double_t GetEFront2(Int_t idx) { return fEFront2[idx]; } | ||
| Double_t GetEBack2(Int_t idx) { return fEBack2[idx]; } | ||
|
|
||
| Double_t GetADCMaxFront1(Int_t idx) { return fADCMaxFront1[idx]; } | ||
| Double_t GetADCMaxBack1(Int_t idx) { return fADCMaxBack1[idx]; } | ||
| Double_t GetADCMaxFront2(Int_t idx) { return fADCMaxFront2[idx]; } | ||
| Double_t GetADCMaxBack2(Int_t idx) { return fADCMaxBack2[idx]; } | ||
|
|
||
| Int_t GetStripFront1(Int_t idx) { return fStripFront1[idx]; } | ||
| Int_t GetStripBack1(Int_t idx) { return fStripBack1[idx]; } | ||
| Int_t GetStripFront2(Int_t idx) { return fStripFront2[idx]; } | ||
| Int_t GetStripBack2(Int_t idx) { return fStripBack2[idx]; } | ||
|
|
||
| Int_t GetMultiplicityFront1() { return fMultiplicityFront1; } | ||
| Int_t GetMultiplicityBack1() { return fMultiplicityBack1; } | ||
| Int_t GetMultiplicityFront2() { return fMultiplicityFront2; } | ||
| Int_t GetMultiplicityBack2() { return fMultiplicityBack2; } | ||
|
|
||
| ClassDefOverride(AtSiEvent, 1); | ||
| }; | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ ${CMAKE_SOURCE_DIR}/AtEventDisplay/Deprecated | |
| ${CMAKE_SOURCE_DIR}/AtEventDisplay/AtTabs | ||
| ${CMAKE_SOURCE_DIR}/AtEventDisplay/AtSidebar | ||
| ${CMAKE_SOURCE_DIR}/AtEventDisplay/AtSidebar/PSA | ||
| ${CMAKE_SOURCE_DIR}/AtData | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this needed? Was there any warning when compiling regarding this? Just curious. |
||
| ) | ||
|
|
||
| set(SRCS | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed? Was there any warning when compiling regarding this? Just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and the AtData comment above) were one of the issues we were running into when trying to compile the Unpacker on my local server. Any time I attempted to build, it would warn me that no such type existed within AtTrack. We resolve the issue by including the AtData directory in AtEventDisplay