Selecting entries hitting two detectors

Hello, I’ve this root file WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free
by this macro I can make a loop over all the hits

lemma.h (5.3 KB)
lemma.C (3.2 KB)

currently the macro just print for each hit the detector number and the particle id (PDG id)

now I should select entries making hits both (i.e. &&) on subdetector 37 and 51…

I.e. for example, I want to select electrons (PDG particle id=11) hitting first on subdetector=37 and later on subdetector = 51

How can I do it?
Thank you

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi @faca87 ,
sorry for the high latency, this must have slipped through the cracks.

I think you just have to add something like this at the beginning of lemma::Process:

if (!yourcondition)
  return false;

So, for every entry, you just return if you don’t “like” the entry. Otherwise you execute the rest of the code in lemma::Process.


Hello @eguiraud the problem is that if I write the condition

subdetector = 51 && subdetector = 37

it looks for particles hitting the 2 subdetectors at same time (impossible)…

I need to look for particles hitting first the subdetecto 37 and LATER the subdetector 51…so what condition should I write?

Hi @faca87 ,
does “later” mean “in a subsequent entry of the dataset”? If that’s the case, there is no direct interface to do that: Process is called once per entry. You will have to do something like store the result of the first selection in a data member of lemma, and then if you get a hit on subdetector 37 you can look back to see if the same particle also hit other subdetectors before.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.