コード例 #1
0
void VandleProcessor::AnalyzeBarStarts(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(BarMap::iterator itStart = barStarts_.begin();
        itStart != barStarts_.end(); itStart++) {
            unsigned int startLoc = (*itStart).first.first;
            unsigned int barPlusStartLoc = barLoc*numStarts_ + startLoc;

            BarDetector start = (*itStart).second;

            double tofOffset = cal.GetTofOffset(startLoc);
            double tof = bar.GetWalkCorTimeAve() -
                start.GetWalkCorTimeAve() + tofOffset;

            double corTof =
                CorrectTOF(tof, bar.GetFlightPath(), cal.GetZ0());

            plot(DD_TOFBARS+histTypeOffset, tof*plotMult_+plotOffset_,
                 barPlusStartLoc);
            plot(DD_CORTOFBARS, corTof*plotMult_+plotOffset_, barPlusStartLoc);

            if(tofOffset != 0) {
                plot(DD_TQDCAVEVSTOF+histTypeOffset, tof*plotMult_+plotOffset_,
                     bar.GetQdc());
                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
コード例 #2
0
ファイル: BarDetector.cpp プロジェクト: gottardo7/pixie_scan
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;
}
コード例 #3
0
ファイル: IS600Processor.cpp プロジェクト: pixie16/paass
bool IS600Processor::Process(RawEvent &event) {
    if (!EventProcessor::Process(event))
        return(false);
    double plotMult_ = 2;
    double plotOffset_ = 1000;

    BarMap vbars, betas;
    map<unsigned int, pair<double,double> > lrtBetas;
    vector<ChanEvent*> geEvts;
    vector<vector<AddBackEvent> > geAddback;

    if(event.GetSummary("vandle")->GetList().size() != 0)
        vbars = ((VandleProcessor*)DetectorDriver::get()->
            GetProcessor("VandleProcessor"))->GetBars();
    if(event.GetSummary("beta:double")->GetList().size() != 0) {
        betas = ((DoubleBetaProcessor*)DetectorDriver::get()->
            GetProcessor("DoubleBetaProcessor"))->GetBars();
        lrtBetas = ((DoubleBetaProcessor*)DetectorDriver::get()->
            GetProcessor("DoubleBetaProcessor"))->GetLowResBars();
    }
    if(event.GetSummary("ge")->GetList().size() != 0) {
        geEvts = ((GeProcessor*)DetectorDriver::get()->
            GetProcessor("GeProcessor"))->GetGeEvents();
        geAddback = ((GeProcessor*)DetectorDriver::get()->
            GetProcessor("GeProcessor"))->GetAddbackEvents();
    }
    static const vector<ChanEvent*> &labr3Evts =
	event.GetSummary("labr3:mrbig")->GetList();

#ifdef useroot
    vsize_->Fill(vbars.size());
#endif

    //Obtain some useful logic statuses
    double lastProtonTime =
	TreeCorrelator::get()->place("logic_t1_0")->last().time;
    bool isTapeMoving = TreeCorrelator::get()->place("TapeMove")->status();

    int bananaNum = 2;
    bool hasMultOne = vbars.size() == 1;
    bool hasMultTwo = vbars.size() == 2;
    //bool isFirst = true;

    plot(DD_DEBUGGING3, vbars.size());

    //Begin processing for VANDLE bars
    for (BarMap::iterator it = vbars.begin(); it !=  vbars.end(); it++) {
        TimingDefs::TimingIdentifier barId = (*it).first;
        BarDetector bar = (*it).second;

        if(!bar.GetHasEvent() || bar.GetType() == "small")
            continue;

        unsigned int barLoc = barId.first;
        TimingCalibration cal = bar.GetCalibration();

        for(BarMap::iterator itStart = betas.begin();
	    itStart != betas.end(); itStart++) {
	    unsigned int startLoc = (*itStart).first.first;
            BarDetector start = (*itStart).second;
            if(!start.GetHasEvent())
                continue;

            double tofOffset = cal.GetTofOffset(startLoc);
            double tof = bar.GetCorTimeAve() -
                start.GetCorTimeAve() + tofOffset;

            double corTof =
                ((VandleProcessor*)DetectorDriver::get()->
		 GetProcessor("VandleProcessor"))->
		CorrectTOF(tof, bar.GetFlightPath(), cal.GetZ0());

	    bool inPeel = histo.BananaTest(bananaNum,
            corTof*plotMult_+plotOffset_,
            bar.GetQdc());
	    bool isLowStart = start.GetQdc() < 300;

	    *outstream << tof << " " << bar.GetQdc() << endl;
#ifdef useroot
        qdctof_->Fill(tof,bar.GetQdc());
        qdc_ = bar.GetQdc();
        tof_ = tof;
        roottree_->Fill();
        qdc_ = tof_ = -9999;
#endif

	    plot(DD_DEBUGGING1, tof*plotMult_+plotOffset_, bar.GetQdc());
	    if(!isTapeMoving && !isLowStart)
		plot(DD_DEBUGGING0, corTof*plotMult_+plotOffset_,bar.GetQdc());
	    if(hasMultOne)
		plot(DD_DEBUGGING4, corTof*plotMult_+plotOffset_, bar.GetQdc());

	    ///Starting to look for 2n coincidences in VANDLE
	    BarMap::iterator itTemp = it;
	    itTemp++;

	    for (BarMap::iterator it2 = itTemp; it2 !=  vbars.end(); it2++) {
		TimingDefs::TimingIdentifier barId2 = (*it2).first;
		BarDetector bar2 = (*it2).second;

		if(!bar.GetHasEvent())
		    continue;

		unsigned int barLoc2 = barId2.first;

		bool isAdjacent = abs((int)barLoc2 - (int)barLoc) < 1;

		TimingCalibration cal2 = bar2.GetCalibration();

		double tofOffset2 = cal2.GetTofOffset(startLoc);
		double tof2 = bar2.GetCorTimeAve() -
		    start.GetCorTimeAve() + tofOffset2;

		double corTof2 =
		    ((VandleProcessor*)DetectorDriver::get()->
		     GetProcessor("VandleProcessor"))->
		    CorrectTOF(tof2, bar2.GetFlightPath(), cal2.GetZ0());

		bool inPeel2 = histo.BananaTest(bananaNum,
						corTof2*plotMult_+plotOffset_,
						bar2.GetQdc());

		if(hasMultTwo && inPeel && inPeel2 && !isAdjacent) {
		    plot(DD_DEBUGGING5, corTof*plotMult_+plotOffset_,
			 corTof2*plotMult_+plotOffset_);
		    plot(DD_DEBUGGING5, corTof2*plotMult_+plotOffset_,
			 corTof*plotMult_+plotOffset_);
		}
	    }
	    ///End 2n coincidence routine

	    // if (geSummary_ && notPrompt && hasMultOne) {
            //     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_DEBUGGING2, calEnergy, corTof*plotMult_+plotOffset_);
            //         }
            //     } else {
	    // 	  //plot(DD_TQDCAVEVSTOF_VETO+histTypeOffset, tof, bar.GetQdc());
	    // 	  //plot(DD_TOFBARS_VETO+histTypeOffset, tof, barPlusStartLoc);
            //     }
            //}
        } // for(TimingMap::iterator itStart
    } //(BarMap::iterator itBar
    //End processing for VANDLE bars

    //-------------- LaBr3 Processing ---------------
    for(vector<ChanEvent*>::const_iterator it = labr3Evts.begin();
	it != labr3Evts.end(); it++)
	plot(DD_DEBUGGING6, (*it)->GetEnergy());


    //------------------ Double Beta Processing --------------
    for(map<unsigned int, pair<double,double> >::iterator it = lrtBetas.begin();
	it != lrtBetas.end(); it++)
	plot(DD_PROTONBETA2TDIFF_VS_BETA2EN, it->second.second,
	     (it->second.first - lastProtonTime) /
	     (10e-3/Globals::get()->clockInSeconds()) );


    //----------------- GE Processing -------------------
    bool hasBeta = TreeCorrelator::get()->place("Beta")->status();
    double clockInSeconds = Globals::get()->clockInSeconds();
    // plot with 10 ms bins
    const double plotResolution = 10e-3 / clockInSeconds;

    for (vector<ChanEvent*>::iterator it1 = geEvts.begin();
	 it1 != geEvts.end(); ++it1) {
        ChanEvent *chan = *it1;

        double gEnergy = chan->GetCalEnergy();
        double gTime   = chan->GetCorrectedTime();
        if (gEnergy < 10.) //hard coded fix later.
            continue;

        plot(D_ENERGY, gEnergy);
	if(hasBeta)
	    plot(D_ENERGYBETA, gEnergy);
	plot(DD_PROTONGAMMATDIFF_VS_GAMMAEN, gEnergy ,
	     (gTime - lastProtonTime) / plotResolution) ;
    }

    EndProcess();
    return(true);
}
コード例 #4
0
/**
 * WARNING!
 * This part was the LiquidAnalysis function in the old ScintProcessor.
 * It looks like written for some older version of code.
 * Before using, examine it carefully!
 */
bool LiquidScintProcessor::Process(RawEvent &event) {
    if (!EventProcessor::Process(event))
        return false;

    static const vector<ChanEvent *> &liquidEvents =
            event.GetSummary("liquid_scint:liquid")->GetList();
    static const vector<ChanEvent *> &betaStartEvents =
            event.GetSummary("liquid_scint:beta:start")->GetList();
    static const vector<ChanEvent *> &liquidStartEvents =
            event.GetSummary("liquid_scint:liquid:start")->GetList();

    vector<ChanEvent *> startEvents;
    startEvents.insert(startEvents.end(), betaStartEvents.begin(),
                       betaStartEvents.end());
    startEvents.insert(startEvents.end(), liquidStartEvents.begin(),
                       liquidStartEvents.end());

    for (vector<ChanEvent *>::const_iterator itLiquid = liquidEvents.begin();
         itLiquid != liquidEvents.end(); itLiquid++) {
        unsigned int loc = (*itLiquid)->GetChanID().GetLocation();
        HighResTimingData liquid(*(*itLiquid));

        if (liquid.GetDiscrimination() == 0) {
            for (Trace::const_iterator i = liquid.GetTrace().begin();
                 i != liquid.GetTrace().end(); i++)
                histo.Plot(DD_TRCLIQUID, int(i - liquid.GetTrace().begin()),
                     counter, int(*i) - liquid.GetAveBaseline());
            counter++;
        }

        if (liquid.GetIsValid()) {
            histo.Plot(DD_TQDCLIQUID, liquid.GetTraceQdc(), loc);
            histo.Plot(DD_MAXLIQUID, liquid.GetMaximumValue(), loc);

            double discrimNorm =
                    liquid.GetDiscrimination() / liquid.GetTraceQdc();

            double discRes = 1000;
            double discOffset = 100;

            TimingCalibration cal =
                    TimingCalibrator::get()->GetCalibration(
                            make_pair(loc, "liquid"));

            if (discrimNorm > 0)
                histo.Plot(DD_DISCRIM, discrimNorm * discRes + discOffset, loc);
            histo.Plot(DD_TQDCVSDISCRIM, discrimNorm * discRes + discOffset,
                 liquid.GetTraceQdc());

            if ((*itLiquid)->GetChanID().HasTag("start"))
                continue;

            for (vector<ChanEvent *>::iterator itStart = startEvents.begin();
                 itStart != startEvents.end(); itStart++) {
                unsigned int startLoc = (*itStart)->GetChanID().GetLocation();
                HighResTimingData start(*(*itStart));
                int histLoc = loc + startLoc;
                const int resMult = 2;
                const int resOffset = 2000;

                if (start.GetIsValid()) {
                    double tofOffset = cal.GetTofOffset(startLoc);
                    double TOF = liquid.GetHighResTimeInNs() -
                                 start.GetHighResTimeInNs() - tofOffset;

                    histo.Plot(DD_TOFLIQUID, TOF * resMult + resOffset, histLoc);
                    histo.Plot(DD_TOFVSDISCRIM + histLoc,
                         discrimNorm * discRes + discOffset,
                         TOF * resMult + resOffset);
                    histo.Plot(DD_TQDCVSLIQTOF + histLoc, TOF * resMult + resOffset,
                         liquid.GetTraceQdc());
                }
            }
        }
    }
    EndProcess();
    return true;
}
コード例 #5
0
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);
}