testdockerwcsim / XTriggerApplication

Other
2 stars 3 forks source link

Mask hits #49

Closed tdealtry closed 4 years ago

tdealtry commented 4 years ago

The basis of this pull request is adding to the SubSample class two new vectors

  /// Stores the trigger readout windows each hit is associated with
  std::vector<std::vector<int> > m_trigger_readout_windows;
  /// Is each hit masked from future trigger decisions?
  std::vector<bool> m_masked;

The idea is then that after every trigger tool has found its triggers, SubSample::TellMeAboutTheTriggers() is run, which sets these variables

Triggers should also check the m_masked bit for each digit, to see if they should use it in their trigger decision. I've implemented this for NHits CPU (unfortunately I had to change the algorithm to handle ignored digits, and the new algorithm appears slower in this test of 100 500 MeV mu- (note these times fluctuate by about a factor 2 on my laptop) but the new algorithm gives identical results to the #30 algorithm - do contribute if you can see any speed increases!)

New code (without calling TellMeAboutTheTriggers())
[2]: nhits::Execute() run timing stats:
 CPU Time (s): Total = 0.08
             Average = 0.0008 over 100 runs
  Range of 0 to 0.01
 Real Time (s): Total = 0.0938721
              Average = 0.000938721 over 100 runs
  Range of 0.000643015 to 0.00166392

Old code
[2]: nhits::Execute() run timing stats:
 CPU Time (s): Total = 0.01
             Average = 0.0001 over 100 runs
  Range of 0 to 0.01
 Real Time (s): Total = 0.0706971
              Average = 0.000706971 over 100 runs
  Range of 0.000478983 to 0.00110912

DataOut, BONSAI, etc. should use m_trigger_readout_windows, but they are due a rewrites (to be less dependent on WCSim classes), so that will happen in a future PR

I've also removed TriggerInfo::SortByStartTime() because we don't want trigger numbers changing

brichards64 commented 4 years ago

So the log command is basically a wrapper for the cout stream anyway and just using cout is as if its of verbosity level zero.

so i would suggest faking the same operation by doing the following

 if(messagelevel<=verbose){    
      std::stringstream tmp;
      tmp<<"["<<messagelevel<<"] "<<message;
      std::cout<<tmp.str()<<std::endl;

    }