#include #define ICETRAY #include "ppc.cxx" I3_MODULE(i3ppc); i3ppc::i3ppc(const I3Context& ctx) : I3Module(ctx){ AddOutBox("OutBox"); verbose=false; } void i3ppc::Physics(I3FramePtr frame){ log_trace("Entering i3ppc::Physics()"); static bool ini=false; if (frame->GetStop() == I3Frame::Geometry || !ini){ if(verbose) cout<<"Geometry frame"<Get(); if(verbose){ if(!geo) cout<<" --> empty"< contains "<omgeo.size()<<" entries"<omgeo.size()>0){ ppc::load(geo); ini=true; } } for (I3Frame::const_iterator iter=frame->begin(); iter!=frame->end(); iter++){ I3MMCTrackListConstPtr mmclist = dynamic_pointer_cast(iter->second); if(mmclist){ if(verbose) cout<<" --> This is an I3MMCTrackList: "<first<begin(); it!=mmclist->end(); ++it){ const I3MMCTrack& m=*it; const I3Particle& p=it->GetI3Particle(); int minor = p.GetMinorID(); unsigned long long major = p.GetMajorID(); if(verbose) cout<<" MMCTrack info added for particle with id: ("<erase(ppc::mchits->begin(), ppc::mchits->end()); bool trees=false, lists=false; for (I3Frame::const_iterator iter=frame->begin(); iter!=frame->end(); iter++){ I3MCTreeConstPtr mctree = dynamic_pointer_cast(iter->second); if(mctree){ if(verbose) cout<<" --> This is an I3MCTree: "<first<(iter->second); if(mclist){ if(verbose) cout<<" --> This is an I3MCList: "<first< Converted to I3MCTree: "<first<& primaries = I3MCTreeUtils::GetPrimaries(mctree); for(vector::const_iterator it=primaries.begin(); it!=primaries.end(); ++it, num++){ const I3Particle& p=*it; if(verbose) cout<<"extracting a particle "<,const I3MMCTrack *>(); frame->Put("MCHitSeriesMap", ppc::mchits); log_debug("Pushing the frame"); PushFrame(frame,"OutBox"); } double i3ppc::res(double x, double mod){ return x-mod*int(x/mod); } void i3ppc::pparticle(const I3Particle& p, int n, I3MCTreeConstPtr tree){ int num=0; pair id = make_pair(p.GetMinorID(), p.GetMajorID()); static int level=0; int type=p.GetType(); if(verbose){ for(int i=0; i particle # "<& secondaries = I3MCTreeUtils::GetDaughters(tree, p); level++; for(vector::const_iterator it=secondaries.begin(); it!=secondaries.end(); ++it, num++) pparticle(*it, num, tree); level--; if(type==5 || type==6){ map strings; { const double sol=0.299792458; double E0=p.GetEnergy()/I3Units::GeV; double t0=p.GetTime()/I3Units::ns; double ll=p.GetLength()/I3Units::m; double Ei, Ef, ti, tf; if(i3mmctracks.find(id)!=i3mmctracks.end()){ const I3MMCTrack * i3mmctrack = i3mmctracks[id]; ti=i3mmctrack->GetTi()/I3Units::ns; Ei=i3mmctrack->GetEi()/I3Units::GeV; tf=i3mmctrack->GetTf()/I3Units::ns; Ef=i3mmctrack->GetEf()/I3Units::GeV; if(Ei==0){ ti=t0; Ei=E0; } if(Ef<0){ tf=t0+ll/sol; Ef=0; } if(Ei>0){ if(verbose) cout<<"extracting a muon Ei="<::const_iterator it=secondaries.begin(); it!=secondaries.end(); ++it){ double t=it->GetTime()/I3Units::ns; if(t>=ti && t<=tf) totE+=it->GetEnergy()/I3Units::GeV; } double sl0=tf>ti?((Ef-Ei+totE)/(ti-tf)):0; double slmax=(0.21+8.8e-3*log(Ei)/log(10.))*sol; // for ice only at Ecut=500 MeV double sl=min(sl0, slmax); double x=p.GetX()/I3Units::m; double y=p.GetY()/I3Units::m; double z=p.GetZ()/I3Units::m+ppc::zoff; double t=ti; double l=sol*(tf-ti); double E=Ei; double Type=p.GetType(); double type=Type; double new_t=tf; for(vector::const_iterator it=secondaries.begin(); it!=secondaries.end(); ++it){ new_t=it->GetTime()/I3Units::ns; if(new_t>=ti && new_t<=tf){ l=sol*(new_t-t); if(verbose) cout<<"muon at z="<