Skip to content

Commit

Permalink
Move the stop pulse to be the start pulse for each window
Browse files Browse the repository at this point in the history
  • Loading branch information
benkrikler committed Aug 19, 2014
1 parent 67ef21d commit 6823be4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion analyzer/rootana/src/TME_generators/FixedWindowMEGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "FixedWindowMEGenerator.h"
#include "TDetectorPulse.h"
#include "TMuonEvent.h"
#define ALCAP_NO_DEBUG
#include "debug_tools.h"

#include <iostream>
using std::cout;
Expand Down Expand Up @@ -74,7 +76,8 @@ int FixedWindowMEGenerator::ProcessPulses(MuonEventList& muonEventsOut,
}
void FixedWindowMEGenerator::AddPulsesInWindow(
TMuonEvent* tme, double window, Detector_t& detector){
// Get the central time for this event
DEBUG_VALUE(*detector.source);
// Get the central time for this event;
double central_time=tme->GetTime();
double early_edge=central_time-window;
double late_edge=central_time+window;
Expand All @@ -84,14 +87,18 @@ void FixedWindowMEGenerator::AddPulsesInWindow(
DetectorPulseList::const_iterator& start=detector.start_window;
DetectorPulseList::const_iterator& stop=detector.end_window;
const DetectorPulseList::const_iterator& end=detector.pulses->end();
const DetectorPulseList::const_iterator& begin=detector.pulses->begin();

// skip empty lists
if(start==end) return;

DEBUG_VALUE(start-begin,stop-begin,end-begin);

// Move the iteator for the start of the window
int look_ahead=1;
while((start+look_ahead!=end) && (start!=end) ){
double time = (*(start+look_ahead))->GetTime();
DEBUG_VALUE(time, early_edge, time>early_edge);
if(time==definitions::DefaultValue){
// If time is DefaultValue then we're looking at an unpaired
// detector which we should ignore
Expand All @@ -103,11 +110,14 @@ void FixedWindowMEGenerator::AddPulsesInWindow(
start+=look_ahead;
}
// Move the iteator for the end of the window
stop=start;
while( stop!=end ){
double time = (*stop)->GetTime();
DEBUG_VALUE(time, late_edge, time>late_edge);
if(time>late_edge) break;
++stop;
}
DEBUG_VALUE(start-begin,stop-begin,end-begin);

// Add all pulses in the current window to the tme
tme->AddPulses(*detector.source,start,stop);
Expand Down

0 comments on commit 6823be4

Please sign in to comment.