116 produces<std::vector<TriggerDecision>>();
127 clock_t start_T = clock();
129 std::unique_ptr<std::vector<TriggerDecision>>
130 trigger_decisions(
new std::vector<TriggerDecision>);
138 for (
unsigned i = 0;
i!= hits->size(); ++
i ) {
141 hl[
v].emplace_back((*hits)[i]);
146 e.
put(std::move(trigger_decisions));
156 for (
unsigned i = 0;
i!= hl[0].size(); ++
i ) {
165 for (
unsigned j = start_id;
j < stop_id; ++
j) {
172 s_PS.emplace_back(hx);
175 else if (!met) c_PS.emplace_back(hx);
186 unsigned x_con = c_PS.size();
187 if (x_con <
_minHits+2 || s_PS.size()<2) {
188 e.
put(std::move(trigger_decisions));
194 for (
unsigned i=0;
i<s_PS.size()-1 && !
result; ++
i) {
198 unsigned ci = entry.
Cell().
val;
207 for (
unsigned j=s_PS.size()-1;
j>
i && !
result; --
j) {
225 if (p_max < p_min+2*
_deltP)
continue;
228 float vpro = (Tf-Ti)/Distance;
236 if (fin<ini+Distance*
_hf_min)
continue;
242 emplace_back(Ti, Tf - Ti,
249 e.
put(std::move(trigger_decisions));
256 unsigned h_counts = 0;
258 float disCut = Distance*
_sigmaL;
259 unsigned h_cut = Distance*
_hf_min;
263 unsigned _dP = (p_max-p_min)*
_df;
265 else if (_dP>4) _dP=4;
266 float dt = (Tf-Ti)*
_df;
269 unsigned P_last =
pi;
270 unsigned C_last = ci;
272 for (
unsigned k=ini; k!=
fin;++k) {
273 DAQHit const& midP = c_PS[k];
277 if (pk>p_max)
continue;
278 if (pk<p_min)
continue;
279 if (ck>c_max)
continue;
280 if (ck<c_min)
continue;
284 if ( pk> P_last+_dP || pk < P_last){
285 if (Tk-T_last>dt)
break;
289 if (cf > ci && ck < C_last )
continue;
290 if (cf < ci && ck > C_last )
continue;
294 if (pk+_dP < P_last || pk > P_last ) {
295 if (Tk-T_last>dt)
break;
298 if (pk+_dP < P_last || pk > P_last || ck > C_last+
_deltC || ck+
_deltC<C_last)
continue;
299 if (cf > ci && ck < C_last )
continue;
300 if (cf < ci && ck > C_last )
continue;
303 float d1 =
Dist_(ci,ck,pi,pk);
304 float d2 =
Dist_(cf,ck,pf,pk);
306 if (d1+d2 > Distance+disCut)
continue;
311 if (t1 < d1*vpro + _sigmaT && t1 + _sigmaT > d1*vpro) {
321 if (t2 < d2*vpro + _sigmaT && t2 + _sigmaT > d2*vpro ) {
331 if (h_counts>h_cut && h_counts>
_minHits-2) {
348 e.
put(std::move(trigger_decisions));
368 if (T1>T2+
_deltaT)
return false;
369 if (T2>T1+
_deltaT)
return false;
371 if (p1-p2 <
_deltP)
return true;
373 else if (p2-p1 <
_deltP)
return true;
383 unsigned f = hl.size()-1;
389 unsigned m = (f+
i)/2;
390 if (T >= hl[m].
TDC().
val ) i = m;
400 return sqrt((p1-p2)*(p1-p2)*2.82072+(c1-c2)*(c1-c2));
T max(const caf::Proxy< T > &a, T b)
SlowMMTrigger(fhicl::ParameterSet const &p)
novaddt::Plane const & Plane() const
float Dist_(float c1, float c2, float p1, float p2)
novaddt::TDC const & TDC() const
std::vector< DAQHit > HitList
double Distance(double x1, double y1, double x2, double y2)
DEFINE_ART_MODULE(TestTMapFile)
Identifier for the Y measuring view of the detector (side)
ProductID put(std::unique_ptr< PROD > &&product)
unsigned long long value_type
bool SurfAssign(DAQHit const &hptr)
bool ViewCheck(unsigned p1, TDC::value_type T1, unsigned p2, TDC::value_type T2)
bool filter(art::Event &e) override
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
unsigned IndexLocator(HitList &hitlist, TDC::value_type T)
novaddt::Cell const & Cell() const
T min(const caf::Proxy< T > &a, T b)