Ejemplo n.º 1
0
void TaskE::fillTOFvsDeltaIDhisto(int delta_ID, int thr, const JPetHit & hit1, const JPetHit & hit2){
	int layer_number = fBarrelMap.getLayerNumber(hit1.getBarrelSlot().getLayer());
	const char * histo_name = Form("TOF_vs_Delta_ID_layer_%d_thr_%d",
				       fBarrelMap.getLayerNumber(hit1.getBarrelSlot().getLayer()),
				       thr);
	
	double tof = fabs( JPetHitUtils::getTimeAtThr(hit1, thr) -
	JPetHitUtils::getTimeAtThr(hit2, thr)
	);
	
	tof /= 1000.; // to have the TOF in ns instead of ps
	
	getStatistics().getHisto2D(histo_name).Fill(delta_ID, tof);
}
Ejemplo n.º 2
0
bool TaskE::isGoodTimeDiff(const JPetHit & hit, int thr){
	double mean_timediff = getAuxilliaryData().getValue("timeDiffAB mean values",
							    formatUniqueSlotDescription(hit.getBarrelSlot(),
								    thr, "timeDiffAB_")
	);
	double this_hit_timediff = JPetHitUtils::getTimeDiffAtThr(hit, thr) / 1000.; // [ns]
	return( fabs( this_hit_timediff - mean_timediff ) < 2.4 );
}
Ejemplo n.º 3
0
void TaskE::fillTOTwithCoin(int delta_ID, int thr,const JPetHit& hit,char side)
{
        int n_slots_in_half_layer = fBarrelMap.getNumberOfSlots(hit.getBarrelSlot().getLayer()) / 2;
	if( delta_ID != n_slots_in_half_layer )return; // skip non-opposite coincidences
        double tot = hit.getSignalA().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr);
        char* histo_name;
        switch(side){
                case 'A':
                        histo_name = Form("TOT_layer_%d_slot_%d_thr%d_side_A_coin", fBarrelMap.getLayerNumber(hit.getBarrelSlot().getLayer()), hit.getBarrelSlot().getID(), thr);
                        getStatistics().getHisto1D(histo_name).Fill(tot/1000.);
                        break;
                case 'B':
                        histo_name = Form("TOT_layer_%d_slot_%d_thr%d_side_B", fBarrelMap.getLayerNumber(hit.getBarrelSlot().getLayer()), hit.getBarrelSlot().getID(), thr);
                        getStatistics().getHisto1D(histo_name).Fill(tot/1000.);
                        break;
        }

}
Ejemplo n.º 4
0
void TaskE::fillDeltaTvsTOT( int thr, const JPetHit& hit)
{
	double tot = hit.getSignalA().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr) / 1000.0;
	double timediff = JPetHitUtils::getTimeDiffAtThr(hit, thr) / 1000.0;

	char* histo_name = Form("#DeltaT_vs_TOT_layer_%d_slot_%d_thr%d_side_A_noCoin", fBarrelMap.getLayerNumber(hit.getBarrelSlot().getLayer()), hit.getBarrelSlot().getID(), thr);
	getStatistics().getHisto2D(histo_name).Fill(tot, timediff);

	
	histo_name = Form("#DeltaT_vs_1/TOT_layer_%d_slot_%d_thr%d_side_A_noCoin", fBarrelMap.getLayerNumber(hit.getBarrelSlot().getLayer()), hit.getBarrelSlot().getID(), thr);
	getStatistics().getHisto2D(histo_name).Fill(1.0/tot, timediff);

}
Ejemplo n.º 5
0
void TaskE::fillDeltaT(int delta_ID, int thr,const JPetHit& hit)
{
//        int n_slots_in_half_layer = fBarrelMap.getNumberOfSlots(hit.getBarrelSlot().getLayer()) / 2;
//        if( delta_ID != n_slots_in_half_layer )return; // skip non-opposite coincidences
	double tot = hit.getSignalA().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr)/1000.0;
	for(unsigned int j = 0; j < TOTcuts.size(); j++){
		if( !( tot > TOTcuts[j] ) ) continue;
		double timediff = JPetHitUtils::getTimeDiffAtThr(hit, thr) / 1000.;
	        char* histo_name;
        	histo_name = Form("#DeltaT_layer_%d_slot_%d_thr%d_cutOn%f", fBarrelMap.getLayerNumber(hit.getBarrelSlot().getLayer()), hit.getBarrelSlot().getID(), thr, TOTcuts[j]);
	        getStatistics().getHisto1D(histo_name).Fill( timediff );
        }

}
Ejemplo n.º 6
0
void TaskE::fillTOTvsTOThisto(int delta_ID, int thr, const JPetHit & hit1, const JPetHit & hit2){
	int n_slots_in_half_layer = fBarrelMap.getNumberOfSlots(hit1.getBarrelSlot().getLayer()) / 2;
	if( delta_ID != n_slots_in_half_layer )return; // skip non-opposite coincidences
	double totA1 = hit1.getSignalA().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr);
	double totB1 = hit1.getSignalB().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr);
	double totA2 = hit2.getSignalA().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr);
	double totB2 = hit2.getSignalB().getRecoSignal().getRawSignal().getTOTsVsThresholdNumber().at(thr);
	char * histo_name;
	
	// fill side A
	histo_name = Form("TOT_vs_TOT_layer_%d_thr_%d_side_A",
			  fBarrelMap.getLayerNumber(hit1.getBarrelSlot().getLayer()), thr);  
	getStatistics().getHisto2D(histo_name).Fill(totA1/1000., totA2/1000.);
	
	// fill side B
	histo_name = Form("TOT_vs_TOT_layer_%d_thr_%d_side_B",
			  fBarrelMap.getLayerNumber(hit1.getBarrelSlot().getLayer()), thr);  
	getStatistics().getHisto2D(histo_name).Fill(totB1/1000., totB2/1000.);
	
}
vector<JPetHit> TaskC::createHits(const vector<JPetRawSignal>& signals)
{
  vector<JPetHit> hits;
  for (auto i = signals.begin(); i != signals.end(); ++i) {
    for (auto j = i; ++j != signals.end();) {
      if (i->getPM().getScin() == j->getPM().getScin()) {
        // found 2 signals from the same scintillator
        // wrap the RawSignal objects into RecoSignal and PhysSignal
        // for now this is just wrapping opne object into another
        // in the future analyses it will involve more logic like
        // reconstructing the signal's shape, charge, amplitude etc.
        JPetRecoSignal recoSignalA;
        JPetRecoSignal recoSignalB;
        JPetPhysSignal physSignalA;
        JPetPhysSignal physSignalB;
        // assign sides A and B properly
        if (
          (i->getPM().getSide() == JPetPM::SideA)
          && (j->getPM().getSide() == JPetPM::SideB)
        ) {
          recoSignalA.setRawSignal(*i);
          recoSignalB.setRawSignal(*j);
        } else if (
          (j->getPM().getSide() == JPetPM::SideA)
          && (i->getPM().getSide() == JPetPM::SideB)
        ) {
          recoSignalA.setRawSignal(*j);
          recoSignalB.setRawSignal(*i);
        } else {
          // if two hits on the same side, ignore
          WARNING("TWO hits on the same scintillator side we ignore it");
          continue;
        }

        if ( recoSignalA.getRawSignal().getNumberOfPoints(JPetSigCh::Leading) < 4 ) continue;
        if ( recoSignalB.getRawSignal().getNumberOfPoints(JPetSigCh::Leading) < 4 ) continue;

        bool thresholds_ok = true;
        for (int i = 1; i <= 4; ++i) {
          if ( recoSignalA.getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading).count(i) < 1 ) {
            thresholds_ok = false;
          }
          if ( recoSignalB.getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading).count(i) < 1 ) {
            thresholds_ok = false;
          }
        }
        if (thresholds_ok == false) {
          continue;
        }

        physSignalA.setRecoSignal(recoSignalA);
        physSignalB.setRecoSignal(recoSignalB);
        auto leading_points_a = physSignalA.getRecoSignal().getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading);
        auto leading_points_b = physSignalB.getRecoSignal().getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading);

        //skip signals with no information on 1st threshold
        // if(leading_points_a.count(1) == 0) continue;
        // if(leading_points_b.count(1) == 0) continue;

        physSignalA.setTime(leading_points_a.at(1));
        physSignalB.setTime(leading_points_b.at(1));


        JPetHit hit;
        hit.setSignalA(physSignalA);
        hit.setSignalB(physSignalB);
        hit.setScintillator(i->getPM().getScin());
        hit.setBarrelSlot(i->getPM().getScin().getBarrelSlot());

        physSignalA.setTime(physSignalA.getRecoSignal().getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading).at(1));
        physSignalB.setTime(physSignalB.getRecoSignal().getRawSignal().getTimesVsThresholdNumber(JPetSigCh::Leading).at(1));

        hit.setTime( 0.5 * ( hit.getSignalA().getTime() + hit.getSignalB().getTime()) );

        hits.push_back(hit);
        getStatistics().getCounter("No. found hits")++;
      }
    }
  }
  return hits;
}
std::vector<JPetHit> TaskD::createHits(std::vector<JPetPhysSignal>& signals)
{
  std::vector<JPetHit> hits;
  for (auto i = signals.begin(); i != signals.end(); ++i) {
    for (auto j = i; ++j != signals.end(); /**/) {
      if (i->getPM().getScin() == j->getPM().getScin()) {
        // found 2 signals from the same scintillator
        JPetHit hit;
        if (i->getPM().getSide() == JPetPM::SideA
            && j->getPM().getSide() == JPetPM::SideB) {
          hit.setSignalA(*i);
          hit.setSignalB(*j);
        } else if (j->getPM().getSide() == JPetPM::SideA
                   && i->getPM().getSide() == JPetPM::SideB) {
          hit.setSignalA(*j);
          hit.setSignalB(*i);
        } else {
          WARNING("TWO hits on the same scintillator side we ignore it");
          // if two hits on the same side, ignore
          continue;
        }

        hit.setScintillator(i->getPM().getScin());

        getStatistics().getHisto1D("Scins multiplicity").Fill((*i).getPM().getScin().getID());

        double dt = hit.getSignalA().getTime() - hit.getSignalB().getTime();
        hit.setTimeDiff(dt);

        double t = 0.5
                   * (hit.getSignalA().getTime() + hit.getSignalB().getTime());
        hit.setTime(t);

	// fill the appropriate dt histogram for this scintillator                                                   
	getStatistics().getHisto1D( 
				   Form("dt for scin %d", hit.getScintillator().getID())
				    ).Fill(hit.getTimeDiff());


        hits.push_back(hit);
	// increment the counter of found hits
	getStatistics().getCounter("No. found hits")++;
      }
    }
  }
  return hits;
}