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

New attempt to remove shadow variables from UpstreamTaggerHit class #358

Merged
merged 2 commits into from
Jun 19, 2020

Conversation

CelsoFCF
Copy link
Contributor

@CelsoFCF CelsoFCF commented Jun 8, 2020

No description provided.

@@ -30,21 +30,22 @@ UpstreamTaggerHit::UpstreamTaggerHit()


// ----- constructor from TimeDetPoint from TimeDetHit-------------------------------
UpstreamTaggerHit::UpstreamTaggerHit(UpstreamTaggerPoint* p, Double_t t0)
UpstreamTaggerHit::UpstreamTaggerHit(UpstreamTaggerPoint* p, UpstreamTagger* c, Double_t t0)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be a const reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works fine as a pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

It may work, but this way it allows (accidental) modification of the UpstreamTagger by the hit. As there is no good reason I can think of for this to happen, it's useful to have the compiler enforce this by making it const.

Whether it's a const reference or const pointer, I frankly don't care, but conventionally const reference are usually used for this purpose.

@@ -103,9 +102,7 @@ class UpstreamTagger: public FairDetector
virtual void BeginEvent() {;}

Double_t module[11][3];

private:

Copy link
Contributor

Choose a reason for hiding this comment

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

Making the UpstreamTagger and its hits friends might be a better solution than making the members public.

@@ -9,14 +9,14 @@
#include "TGeoPhysicalNode.h"


class UpstreamTaggerHit : public ShipHit
class UpstreamTaggerHit : public ShipHit, UpstreamTagger
Copy link
Contributor

Choose a reason for hiding this comment

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

This inheritance doesn't make sense.


Double_t point_final[3]; //[3]
const Double_t * mom[3]; //!
UpstreamTagger* c0;
Copy link
Contributor

Choose a reason for hiding this comment

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

An UpstreamTagger object as a member of the Hit doesn't make sense. Also, it needs to be //! to make sure it's not serialised.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The UpstreamTagger object is required to access its members inside GetNode() from UpstreamTaggerHit.cxx

Copy link
Contributor

Choose a reason for hiding this comment

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

There are several other ways to do this.
UpstreamTaggerHit is the same format that will be used from data and for storage on disk. Having an UpstreamTagger member of this class (and serialising it), is unnecessary.

Again, I would suggest having a look at the implementation of similar methods for the strawtubes.

@olantwin
Copy link
Contributor

olantwin commented Jun 8, 2020

General comment: Please use commit messages.

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020

I suggest that the pull request be accepted as it is. Then, you can make the small modifications you consider necessary.

@ThomasRuf
Copy link
Contributor

Please have a look what I suggested here: #356 . Until the issue with unique IDs is not fixed, it makes no sense for me to accept anything about the hit class.

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020 via email

@ThomasRuf
Copy link
Contributor

Maybe I am missing something. What is created in UpstreamTagger.cxx? Only some unstructured sensitive planes, or a detailed detector layout with sensitive volumes, modules, passive material, support structure etc.
Is the UpstreamTaggerHit class suppossed to make the granulation or is this done in UpstreamTagger?
In any case, the hit class should mimick what is send by the DAQ to the eventbuilder. So, some ADC/TDC value and an unique ID. Definetely not MC position and momentum, and details about the

@ThomasRuf
Copy link
Contributor

detector segmention:

Double_t point_final[3];
const Double_t * mom[3];

Float_t flag;     ///< flag
Float_t t_1,t_2;  ///< TDC on both sides
Int_t RpcModule; //Rpc module
Int_t RpcGlass;  //Rpc glass
Int_t RpcStrip;  //Rpc Strip
Int_t RpcDetector;  //Rpc detector 1 or 2
Int_t Rpc_NeighbourStrip; //Neighbour strip likely to be activated
Double_t det_zdet1;     //!  z-position of veto station

@ThomasRuf
Copy link
Contributor

Assume I read events from a file, and look at an UpstreamTaggerHit object and what to know its xyz position. The method provided for this, TVector3 UpstreamTaggerHit::GetXYZ(), will completely fail. It will call
TGeoNavigator* nav = gGeoManager->GetCurrentNavigator();
TGeoNode* node = GetNode(hit_final, mod);
which then tries to access MC truth information about hit position and particle momentum. This can never work with real data.

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020 via email

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020 via email

@ThomasRuf
Copy link
Contributor

Could you tell me which is the volume which corresponds to a readout channel? Is it simulated in Geant4 and correspond to a node, or is it something virtuell, only simulated when creating an UpstreamTaggerHit?

The hit class will be used as input for the reconstruction and for modelling the DAQ. It should therefore mimick the reality as much as possible.

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020 via email

@ThomasRuf
Copy link
Contributor

OK, good. Am I right that most of the code in UpstreamTaggerHit::GetNode is a cut and paste of the same code in UpstreamTagger.cxx? Second, you are not using in any way the detID created in UpstreamTagger::ProcessHits. You try to bypass it by using the x,y,z of the point class and re-engineer the name of the detector volume. If you would use properly the detID, UpstreamTaggerHit::GetNode would shrink to two lines. It would not be necessary to make any MC information persistent. If you have a one to one relation, each point object corresponds to a hit object, then the index for a hit object could also be used to access a point object with full MC information.

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 8, 2020 via email

@ThomasRuf
Copy link
Contributor

I would assume that particles hitting strips will not produce a signal. A signal is caused by particles passing through gas and making ionization, electrons and ions are collected on the strips making an electronic signal. Simulating electrons and ions in Geant4 would be too CPU intensive. This part is then simulated in the digitization step. In order to know which strips are related to which active material, it would be a great advantage if this is encoded in the numbering scheme.
In your detector, what is the relation between strips (readout channels?) and active volume? One active volume is readout by one strip, by many strips, strips are sharing different active volumes, ...?

@CelsoFCF
Copy link
Contributor Author

CelsoFCF commented Jun 9, 2020 via email

@ThomasRuf
Copy link
Contributor

So, do you have a model (from testbeam for example) which describes which strips and what amount of charge is seen for a particle traversing the active part at given x and y?

@ThomasRuf ThomasRuf merged commit 30c372b into ShipSoft:master Jun 19, 2020
@ThomasRuf
Copy link
Contributor

This is work in progress. Needs modifications before it can be used in production. Will disable running UpstreamTagger digitization until better solution is found.

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.

3 participants