#include #include #include using namespace std; #include #include #include #include #include #include #include #include #include #include using namespace RAT; using namespace RAT::PDFs; using namespace RAT::DS; void PartialET1D::Initialise( const std::string& param ) { fIndex = param; } void PartialET1D::BeginOfRun( DS::Run& ) { DB *db = DB::Get(); string index = fIndex; if( fIndex.empty() ) index = db->GetLink("GEO", "inner_av")->GetS("material_top"); // Set PDF to labppo_scintillator as default string defaultIndex = "labppo_scintillator"; RAT::DBLinkPtr promptTimingTable = RAT::DB::Get()->GetLink( "ET1D", defaultIndex ); // then check for material specific PDF DBLinkGroup grp=db->GetLinkGroup("ET1D"); DBLinkGroup::iterator it; for(it=grp.begin(); it != grp.end(); ++it){ if(index == it->first){ promptTimingTable = RAT::DB::Get()->GetLink("ET1D",index); break; } } vector times; vector probability; try { times = promptTimingTable->GetDArray( "time" ); probability = promptTimingTable->GetDArray( "probability" ); } catch ( RAT::DBNotFoundError &e) { RAT::Log::Die( "PartialET1D::Initialise: Cannot Find Prompt PDF Parameters" ); } fProbability = new G4PhysicsOrderedFreeVector( &(times[0]), &(probability[0]), times.size() ); fLightPath = DU::Utility::Get()->GetLightPathCalculator(); return; } double PartialET1D::GetProbability( const FitterPMT& pmt, const FitVertex& vertex ) { TVector3 startPos; double eventTime; try { startPos = vertex.GetPosition(); eventTime = vertex.GetTime(); } catch( FitVertex::NoValueError& error ) { warn << "PartialET1D::GetProbability: This PDF does nothing without a proposed position & time" << newline; return 0.0; } fLightPath.CalcByPositionPartial( startPos, DU::Utility::Get()->GetPMTInfo().GetPosition( pmt.GetID() ) ); double distInUpperTarget = fLightPath.GetDistInUpperTarget(); double distInLowerTarget = fLightPath.GetDistInLowerTarget(); double distInAV = fLightPath.GetDistInAV(); double distInWater = fLightPath.GetDistInWater(); const double transitTime = DU::Utility::Get()->GetEffectiveVelocity().CalcByDistance( distInUpperTarget, distInAV, distInWater+distInLowerTarget ); const double correctedTime = pmt.GetTime() - transitTime - eventTime; return fProbability->Value( correctedTime ); }