#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 ET1D::Initialise( const std::string& param ) { fIndex = param; } void ET1D::BeginOfRun( DS::Run& ) { DB *db = DB::Get(); string index; if( fIndex.empty() == true ) { index = db->GetLink("GEO", "inner_av")->GetS("material"); } else index = fIndex; // 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( "ET1D::Initialise: Cannot Find Prompt PDF Parameters" ); } fProbability = new G4PhysicsOrderedFreeVector( &(times[0]), &(probability[0]), times.size() ); fLightPath = DU::Utility::Get()->GetLightPathCalculator(); } void ET1D::EndOfRun( DS::Run& ) { delete fProbability; } double ET1D::GetProbability( const FitterPMT& pmt, const FitVertex& vertex ) { TVector3 startPos; double eventTime; try { startPos = vertex.GetPosition(); eventTime = vertex.GetTime(); } catch( FitVertex::NoValueError& error ) { warn << "ET1D::GetProbability: This PDF does nothing without a proposed position & time" << newline; return 0.0; } fLightPath.CalcByPosition( startPos, DU::Utility::Get()->GetPMTInfo().GetPosition( pmt.GetID() ) ); double distInInnerAV = fLightPath.GetDistInInnerAV(); double distInAV = fLightPath.GetDistInAV(); double distInWater = fLightPath.GetDistInWater(); const double transitTime = DU::Utility::Get()->GetEffectiveVelocity().CalcByDistance( distInInnerAV, distInAV, distInWater ); const double correctedTime = pmt.GetTime() - transitTime - eventTime; return fProbability->Value( correctedTime ); }