bool TeenyVandleProcessor::PreProcess(RawEvent &event) { data_.clear(); if (!EventProcessor::PreProcess(event)) return(false); static const vector<ChanEvent*> & events = event.GetSummary("tvandle")->GetList(); for(vector<ChanEvent*>::const_iterator it = events.begin(); it != events.end(); it++) { unsigned int location = (*it)->GetChanID().GetLocation(); string subType = (*it)->GetChanID().GetSubtype(); TimingDefs::TimingIdentifier id(location, subType); data_.insert(make_pair(id, HighResTimingData(*it))); } if(data_.size() != 2) return(false); HighResTimingData right = (*data_.find(make_pair(0,"right"))).second; HighResTimingData left = (*data_.find(make_pair(0,"left"))).second; double timeDiff = left.GetHighResTime() - right.GetHighResTime(); double corTimeDiff = left.GetCorrectedTime() - right.GetCorrectedTime(); plot(DD_QDCVSMAX, right.GetMaximumValue(), right.GetTraceQdc()); if(right.GetIsValid() && left.GetIsValid()) { double timeRes = 50; //20 ps/bin double timeOff = 500; plot(D_TIMEDIFF, timeDiff*timeRes + timeOff); plot(DD_PVSP, right.GetPhase()*timeRes, left.GetPhase()*timeRes); plot(DD_MAXRIGHTVSTDIFF, timeDiff*timeRes+timeOff, right.GetMaximumValue()); plot(DD_MAXLEFTVSTDIFF, timeDiff*timeRes+timeOff, left.GetMaximumValue()); plot(DD_MAX, right.GetMaximumValue(), 0); plot(DD_MAX, left.GetMaximumValue(), 1); plot(DD_TQDC, right.GetTraceQdc(), 0); plot(DD_TQDC, left.GetTraceQdc(), 1); plot(DD_SNRANDSDEV, right.GetSignalToNoiseRatio()+50, 0); plot(DD_SNRANDSDEV, right.GetStdDevBaseline()*timeRes+timeOff, 1); plot(DD_SNRANDSDEV, left.GetSignalToNoiseRatio()+50, 2); plot(DD_SNRANDSDEV, left.GetStdDevBaseline()*timeRes+timeOff, 3); double ampDiff = fabs(right.GetMaximumValue()-left.GetMaximumValue()); if(ampDiff <=50) plot(DD_MAXLVSTDIFFAMP, timeDiff*timeRes+timeOff, left.GetMaximumValue()); plot(DD_MAXLCORGATE, corTimeDiff*timeRes+timeOff, left.GetMaximumValue()); if(right.GetMaximumValue() > 2500) { plot(DD_MAXLVSTDIFFGATE, timeDiff*timeRes+timeOff, left.GetMaximumValue()); } } return(true); }
bool TwoChanTimingProcessor::Process(RawEvent &event) { if (!EventProcessor::Process(event)) return false; //Define a map to hold the information TimingMap pulserMap; //plot the number of times we called the function codes->Fill(PROCESS_CALLED); static const vector<ChanEvent *> &pulserEvents = event.GetSummary("pulser")->GetList(); for (vector<ChanEvent *>::const_iterator itPulser = pulserEvents.begin(); itPulser != pulserEvents.end(); itPulser++) { int location = (*itPulser)->GetChanID().GetLocation(); string subType = (*itPulser)->GetChanID().GetSubtype(); TimingDefs::TimingIdentifier key(location, subType); pulserMap.insert(make_pair(key, HighResTimingData(*itPulser))); } if (pulserMap.empty() || pulserMap.size() % 2 != 0) { //If the map is empty or size isn't even we return and increment // error code codes->Fill(WRONG_NUM); EndProcess(); return false; } HighResTimingData start = (*pulserMap.find(make_pair(0, "start"))).second; HighResTimingData stop = (*pulserMap.find(make_pair(0, "stop"))).second; static int trcCounter = 0; int bin; for(vector<int>::const_iterator it = start.GetTrace()->begin(); it != start.GetTrace()->end(); it++) { bin = (int)(it-start.GetTrace()->begin()); traces->Fill(bin, trcCounter, *it); //Only output the 500th trace to make sure that we are not at the // beginning of the file and we're a ways into the data. if(trcCounter == 500) trcfile << bin << " " << *it << " " << sqrt(*it) << endl; } trcCounter++; //We only plot and analyze the data if the data is validated if (start.GetIsValid() && stop.GetIsValid()) { start.FillRootStructure(rstart); stop.FillRootStructure(rstop); tree->Fill(); start.ZeroRootStructure(rstart); stop.ZeroRootStructure(rstop); } EndProcess(); return true; }