Ejemplo n.º 1
0
void StageManager::shakeFloor()
{
	m_VisitedStageNums.clear();
	m_VisitedStageNums.push_back( m_CurrentStageNum );
	GET_DATA_MANAGER()->getShakeFloorData( m_CurrentFloorNum , &m_FloorData ,&m_CurrentFloorStagesData);
	makeStaticData();
	for( int i = 1; i <= m_FloorData.stageNum; ++i )
	{
		m_WorldScenes[i]->getGameLayer()->setIsVisited( false );
	}
}
Ejemplo n.º 2
0
bool StageManager::initFloor( int floorNum )
{
	initData();
	m_CurrentFloorNum = floorNum;
	GET_DATA_MANAGER()->getFloorData( m_CurrentFloorNum , &m_FloorData , &m_CurrentFloorStagesData );
	makeStaticData();
	for( int stageNum = 1; stageNum <= m_FloorData.stageNum; ++stageNum )
	{
		m_CurrentStageNum = stageNum;
		m_CurrentWorldScene = WorldScene::createScene();
		int StageMaxWidthIdx = m_CurrentFloorStagesData[stageNum].width;
		int StageMaxHeightIdx = m_CurrentFloorStagesData[stageNum].height;
		std::map<int , ObjectType> data = m_CurrentFloorStagesData[stageNum].data;
		m_CurrentWorldScene->initCurrentSceneWithData( Vec2( StageMaxWidthIdx , StageMaxHeightIdx ) ,
													   m_BoxSize , data , "background.png" );
		m_CurrentWorldScene->retain();
		m_WorldScenes[stageNum] = m_CurrentWorldScene;
	}
	m_CurrentWorldScene = nullptr;
	m_CurrentStageNum = 0;
	return true;
}
Ejemplo n.º 3
0
user_mass() {

    //Add a user-defined particle with mass = 1.25 GeV
    pid_resonance = makeStaticData()->AddParticle(-1,"MyResonance", 1.25);
    //Set the width (important to enable the m1-decay model for the production)
    makeStaticData()->SetParticleTotalWidth("MyResonance",0.25);
    //It must be a hadron:
    makeStaticData()->SetParticleBaryon("MyResonance",1);

    //Add some user-defined decays:
    decay_index = makeStaticData()->AddDecay("MyResonance --> p + pi-", "MyResonance",
                  "p,pi-", .5 );
    makeStaticData()->AddDecay("MyResonance --> n + pi0", "MyResonance",
                               "n,pi0", .5 );
    makeStaticData()->AddDecay("MyResonance --> n + pi0 + pi0", "MyResonance",
                               "n,pi0,pi0", 1 );
    //N.B.: Branching ratios are re-normalized

    listParticle("MyResonance"); //List the data base content

    //Add a user-defined mass distribution:
    PMassSampling * model = new PMassSampling("mymodel@MyResonance","My model",-1);
    model->SetSamplingFunction(new TF1("mass_function",f_my_function,0.,10.,1));
    makeDistributionManager()->Add(model);

    //Create the reaction and a control histogram
    TH1F *histo = new TH1F("histo", "MyResonance mass", 100, 1., 1.6);
    PReaction r("1.25", "p", "p", "p MyResonance [p pi-]");
    //(Try what happens if you increase the beam energy!)
    r.Do(histo,"_x = [MyResonance]->M()");
    r.Print();
    r.Loop(10000);

    histo->Draw();

}
Ejemplo n.º 4
0
fermi_rescattering() {

    gErrorIgnoreLevel=kWarning;

    makeDistributionManager()->Exec("nucleus_fermi:proton");
    Double_t fragment_mass = makeStaticData()->GetParticleMass("6Li") -
        makeStaticData()->GetParticleMass("n");
    makeStaticData()->AddParticle(999, "fragment",fragment_mass);

    //Now we have to do some preparation:
    PFermiDistributions* model = 
        new PFermiDistributions("6Li_fermi@6Li/fermi","Fermi momentum of 6Li",-1);
    model->SetRange(0,2.);
    makeDistributionManager()->Add(model);

    //This is the real reaction:
    PParticle * beam  =new PParticle("p",3.5);
    PParticle * target=new PParticle("7Li");
    PParticle * s= new PParticle(*beam+*target);

    //Quasi-free sub-reaction:
    PParticle * beam2  =new PParticle("p");
    PParticle * target2=new PParticle("n");
    PParticle * s2= new PParticle(*beam2+*target2);

    PParticle * spectator=new PParticle("6Li");
    PParticle * cc1[]={s,s2,spectator};

    //The outgoing products of the p-n scattering:
    PParticle * p1  =new PParticle("p");
    PParticle * p2  =new PParticle("n");
    PParticle * phi =new PParticle("phi");

    PParticle * cc2[]={s2,p1,p2,phi};

    //decay of the phi:
    PParticle * kp  =new PParticle("K+");
    PParticle * km  =new PParticle("K-");

    PParticle * cc3[]={phi,kp,km};

    //scatter the K+ again, this is like treating it as a "beam particle"
    //the "real reaction" in this case is K+ + 6Li
    //Use the "Scatter" method to keep the original pointers
    PParticle * rescatter= new PParticle("dummy");
    rescatter->Scatter(kp,spectator);

    //Next quasi-free sub-reaction:
    PParticle * beam3  =new PParticle("K+");
    PParticle * target3=new PParticle("n");
    PParticle * s3= new PParticle(*beam3+*target3);

    PParticle * spectator3=new PParticle("fragment");
    PParticle * cc4[]={rescatter,s3,spectator3};

   //The outgoing products of the final re-scattering:
    PParticle * final_kp  =new PParticle("K+");
    PParticle * final_n  =new PParticle("n");

    PParticle * cc5[]={s3,final_kp,final_n};

    //after this point our new particles and decays are pre-defined

    PFermiMomentumGA *pmodel = 
        new PFermiMomentumGA("K+n_in_6Li@K+ + 6Li_to_K+ + n_fragment",
                             "Quasi-free particle production",-1);      
    // Now add all particles
    // Define spectators and final decay products (the granddaughters)
    pmodel->Add("q,parent");                                       
    pmodel->Add("K+,grandparent,beam");                            
    pmodel->Add("6Li,grandparent,target");
    pmodel->Add("fragment,daughter,spectator");
    pmodel->Add("q,daughter,composite");
    pmodel->Add("n,granddaughter,participant"); 
    pmodel->Add("K+,granddaughter,p2"); 
    makeDistributionManager()->Add(pmodel);


    //Add a dummy angular distribution
    //In this case it is just a step function, it is without any physical meaning!
    PAngularDistribution *ang = new PAngularDistribution("my_angle","My angular dist");
    ang->Add("q,parent,reference");
    ang->Add("n,daughter");
    ang->Add("K+,daughter,primary");
    ang->Add("n,grandparent,base_reference");
    TF1 *angles2=new TF1("angles2",f_my_function,-1,1,1);
    ang->SetAngleFunction(angles2);
    makeDistributionManager()->Add(ang);


    PChannel *c1=new PChannel(cc1,2);
    PChannel *c2=new PChannel(cc2,3);
    PChannel *c3=new PChannel(cc3,2);
    PChannel *c4=new PChannel(cc4,2);
    PChannel *c5=new PChannel(cc5,2);

    PChannel *cc[]={c1,c2,c3,c4,c5};


    //Some online histograms: compare the undistorted phi shape with
    //the reconstructed one
    PReaction *r=new PReaction(cc,"fermi_rescattering",5);
    TH1F * histo1 = new TH1F ("histo1","phi mass",100,0.9,1.2);
    r->Do(histo1,"_x = [phi]->M()");
    TH1F * histo2 = new TH1F ("histo2","phi mass (scatter)",100,0.9,1.2);
    r->Do(histo2,"_x = ([K+,2] + [K-])->M()");

    r->Print();


    r->loop(10000);

    histo1->Draw();
    histo2->Draw("same");

}