void VandleProcessor::AnalyzeStarts(void) { for (BarMap::iterator it = bars_.begin(); it != bars_.end(); it++) { TimingDefs::TimingIdentifier barId = (*it).first; BarDetector bar = (*it).second; if(!bar.GetHasEvent()) continue; unsigned int histTypeOffset = ReturnOffset(bar.GetType()); unsigned int barLoc = barId.first; TimingCalibration cal = bar.GetCalibration(); for(TimingMap::iterator itStart = starts_.begin(); itStart != starts_.end(); itStart++) { if(!(*itStart).second.GetIsValidData()) continue; unsigned int startLoc = (*itStart).first.first; unsigned int barPlusStartLoc = barLoc*numStarts_ + startLoc; HighResTimingData start = (*itStart).second; double tofOffset = cal.GetTofOffset(startLoc); double tof = bar.GetWalkCorTimeAve() - start.GetWalkCorrectedTime() + tofOffset; double corTof = CorrectTOF(tof, bar.GetFlightPath(), cal.GetZ0()); plot(DD_TOFBARS+histTypeOffset, tof*plotMult_+plotOffset_, barPlusStartLoc); plot(DD_TQDCAVEVSTOF+histTypeOffset, tof*plotMult_+plotOffset_, bar.GetQdc()); plot(DD_CORTOFBARS, corTof*plotMult_+plotOffset_, barPlusStartLoc); plot(DD_TQDCAVEVSCORTOF+histTypeOffset, corTof*plotMult_+plotOffset_, bar.GetQdc()); if (geSummary_) { if (geSummary_->GetMult() > 0) { const vector<ChanEvent *> &geList = geSummary_->GetList(); for (vector<ChanEvent *>::const_iterator itGe = geList.begin(); itGe != geList.end(); itGe++) { double calEnergy = (*itGe)->GetCalEnergy(); plot(DD_GAMMAENERGYVSTOF+histTypeOffset, calEnergy, tof); } } else { plot(DD_TQDCAVEVSTOF_VETO+histTypeOffset, tof, bar.GetQdc()); plot(DD_TOFBARS_VETO+histTypeOffset, tof, barPlusStartLoc); } } } // for(TimingMap::iterator itStart } //(BarMap::iterator itBar } //void VandleProcessor::AnalyzeData
BarDetector::BarDetector(const HighResTimingData &Left, const HighResTimingData &Right, const TimingCalibration &cal, const std::string &type) { left_ = Left; right_ = Right; cal_ = cal; type_ = type; timeDiff_ = (Left.GetHighResTime()-Right.GetHighResTime()) + cal.GetLeftRightTimeOffset(); CalcFlightPath(); BarEventCheck(); qdc_ = sqrt(Right.GetTraceQdc()*Left.GetTraceQdc()); theta_ = acos(cal.GetZ0()/flightPath_); timeAve_ = (Right.GetHighResTime() + Left.GetHighResTime())*0.5; walkCorTimeDiff_ = (Left.GetWalkCorrectedTime() - Right.GetWalkCorrectedTime()) + cal.GetLeftRightTimeOffset(); walkCorTimeAve_ = (Left.GetWalkCorrectedTime() + Right.GetWalkCorrectedTime())*0.5; }
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; }
bool WalkVandleBetaProcessor::Process(RawEvent &event) { if (!EventProcessor::Process(event)) return (false); if (!VandleProcessor::Process(event)) return (false); for (BarMap::iterator it = bars_.begin(); it != bars_.end(); it++) { TimingDefs::TimingIdentifier barId = (*it).first; BarDetector bar = (*it).second; if (!bar.GetHasEvent()) continue; unsigned int barLoc = barId.first; bool isLower = barLoc > 6 && barLoc < 16; if (!isLower) continue; TimingCalibration cal = bar.GetCalibration(); if (barLoc == 12) { plot(DD_DEBUGGING4, bar.GetLeftSide().GetTraceQdc(), 0); plot(DD_DEBUGGING4, bar.GetRightSide().GetTraceQdc(), 1); if (bar.GetLeftSide().GetTraceQdc() > 1500) plot(DD_DEBUGGING5, bar.GetWalkCorTimeDiff() * plotMult_ + plotOffset_, bar.GetRightSide().GetTraceQdc()); if (bar.GetRightSide().GetTraceQdc() > 1500) plot(DD_DEBUGGING6, bar.GetWalkCorTimeDiff() * plotMult_ + plotOffset_, bar.GetLeftSide().GetTraceQdc()); plot(DD_DEBUGGING7, bar.GetWalkCorTimeDiff() * plotMult_ + plotOffset_, bar.GetRightSide().GetTraceQdc()); plot(DD_DEBUGGING8, bar.GetTimeDifference() * plotMult_ + plotOffset_, bar.GetRightSide().GetTraceQdc()); } for (TimingMap::iterator itStart = starts_.begin(); itStart != starts_.end(); itStart++) { HighResTimingData start = (*itStart).second; if (!start.GetIsValidData()) continue; unsigned int startLoc = (*itStart).first.first; double tofOffset = cal.GetTofOffset(startLoc); double tofBarWalkCor = bar.GetWalkCorTimeAve() - start.GetWalkCorrectedTime() + tofOffset; double tofBarAve = bar.GetTimeAverage() - start.GetWalkCorrectedTime() + tofOffset; double thresh = 1500; if (startLoc == 0) { plot(DD_DEBUGGING2, tofBarWalkCor * plotMult_ + plotOffset_, bar.GetQdc()); plot(DD_DEBUGGING3, tofBarAve * plotMult_ + plotOffset_, bar.GetQdc()); if (bar.GetQdc() > thresh) { plot(DD_DEBUGGING0, tofBarWalkCor * plotMult_ + plotOffset_, start.GetPixieEnergy()); plot(DD_DEBUGGING1, tofBarAve * plotMult_ + plotOffset_, start.GetPixieEnergy()); } } }//loop over starts }//loop over bars EndProcess(); return (true); }