コード例 #1
0
ファイル: smartschoolTest.cpp プロジェクト: yvanvds/yATools
void smartschoolTest::testSaveUser() {
  y::ldap::server Server;
  y::ldap::account & a = Server.getAccount(UID("unitTest"));
  if(!a.isNew()) {
    CPPUNIT_ASSERT(false);
  }
  a.role(ROLE(ROLE::NONE));
  a.uid(UID("unitTest"));
  a.gender(GENDER(GENDER::MALE));
  a.street(STREET("my street"));
  a.houseNumber(HOUSENUMBER(42));
  a.houseNumberAdd(HOUSENUMBER_ADD("a"));
  a.birthDay(DATE(DAY(9), MONTH(8), YEAR(1972)));
  a.wisaID(WISA_ID(111111111));
  a.password(PASSWORD("ABcd!eGf"));
  a.ssPassword("ABcd!eGf");
  a.cn(CN("unit"));
  a.sn(SN("test"));
  a.birthPlace(BIRTHPLACE("brussels"));
  a.postalCode(POSTAL_CODE("1000"));
  a.city(CITY("brussels"));
  a.country(COUNTRY("belgie"));
  a.mail(MAIL("*****@*****.**"));
  
  // role is not set!
  if(y::Smartschool().saveUser(a)) {
    CPPUNIT_ASSERT(false);
  }
  
  a.role(ROLE(ROLE::STUDENT));
  if(!y::Smartschool().saveUser(a)) {
    CPPUNIT_ASSERT(false);
  }
  
}
コード例 #2
0
void example(double E0 = 50, int nevents = 100000)
{
   TStopwatch timer;

   // compound nucleus = carbon
   KVNucleus CN(6, 12);
   CN.SetExcitEnergy(E0);

   // decay products
   KVEvent decay;
   KVNucleus* n = decay.AddParticle();
   n->SetZandA(1, 2);
   n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(3, 6);

   MicroStat::mdweight gps;
   Double_t etot = E0 + decay.GetChannelQValue();
   Double_t total_mass = decay.GetSum("GetMass");

   if (etot <= 0) {
      printf("Break-up channel is not allowed\n");
      return;
   }
   gps.SetWeight(&decay, etot);
   gps.initGenerateEvent(&decay);

   std::cout << "Edisp = " << etot << " MeV" << std::endl;
   KVHashList histos;
   TH1F* h;

   while ((n = decay.GetNextParticle())) {
      Double_t kappa = total_mass / (total_mass - n->GetMass());
      std::cout << n->GetSymbol() << " : max KE = " << 1. / kappa << " * " << etot << " MeV" << std::endl;
      std::cout << n->GetSymbol() << " : m/M = " << n->GetMass() / total_mass << " k = " << kappa << std::endl;
      histos.Add(h = new TH1F(n->GetSymbol(), Form("Kinetic energy of %s", n->GetSymbol()), 200, 0, etot));
      h->Sumw2();
   }
   KVEvent event;

   while (nevents--) {
      gps.GenerateEvent(&decay, &event);
      while ((n = event.GetNextParticle()))((TH1F*)histos.FindObject(n->GetSymbol()))->Fill(n->GetE());
      gps.resetGenerateEvent();
   }

   TIter it(&histos);

   while ((h = (TH1F*)it())) {

      KVNucleus part(h->GetName());
      new TCanvas;
      FitEDist(h, etot, decay.GetMult(), total_mass, part.GetMass());

   }

   timer.Print();
}
コード例 #3
0
ファイル: smartschoolTest.cpp プロジェクト: yvanvds/yATools
void smartschoolTest::testSaveClass() {
  y::ldap::server Server;
  y::ldap::schoolClass & group = Server.getClass(CN("1X"));
  group.cn(CN("1X"));
  group.description(DESCRIPTION("1e leerjaar X (test)"));
  group.schoolID(SCHOOL_ID(125261));
  group.adminGroup(ADMINGROUP(6246));
  
  if(!y::Smartschool().saveClass(group)) {
    CPPUNIT_ASSERT(false);
  }
  
  if(!y::Smartschool().deleteClass(group)) {
    CPPUNIT_ASSERT(false);
  }
  
}
コード例 #4
0
ファイル: nstream_proactor.cpp プロジェクト: sbunce/p2p
void net::nstream_proactor::conn_listener::read()
{
	while(boost::shared_ptr<nstream> N = Listener.accept()){
		boost::shared_ptr<conn_nstream> CN(new conn_nstream(Dispatcher,
			Conn_Container, N));
		Conn_Container.add(CN);
	}
}
コード例 #5
0
void RegisterLayer::clickRegister(CCObject* pSender)
{
	map<string,string> post;
	post["api"] = "sign_up";
	post["username"] = usernameText->getString();
	post["password"] = passwordText->getString();
	post["role_type"] = Utils::int2str((int)USER->getRoleType());
	post["level"] = Utils::int2str(USER->getLevel());
	post["exp"] = Utils::int2str(USER->getExp());
	post["basic_agi"] = Utils::int2str(USER->getBasicAGI());
	post["basic_str"] = Utils::int2str(USER->getBasicSTR());
	post["basic_def"] = Utils::int2str(USER->getBasicDEF());
	post["current_weapon"] = Utils::int2str((int)USER->getEquipment().getWeapon());
	post["current_base"] = Utils::int2str((int)USER->getEquipment().getBase());
	post["current_plate"] = Utils::int2str((int)USER->getEquipment().getPlate());
	post["open_chapters_number"] = Utils::int2str(USER->getOpenChaptersNumber());
	post["win_online_game_number"] = Utils::int2str(USER->getWinOnlineGamesNumber());
	post["play_online_game_number"] = Utils::int2str(USER->getPlayOnlineGamesNumber());
	post["money"] = Utils::int2str(USER->getMoney());
	post["honor"] = Utils::int2str(USER->getHonor());

	std::string jsonStr = POST(post);
	
	JsonBox::Value data;
	CCLOG(jsonStr.c_str());
	data.loadFromString(jsonStr);
	if(data["result"].getString()=="OK"){
		USER->setUsername(usernameText->getString());
		USER->setPassword(passwordText->getString());
		USER->setHasSignin(true);
		USER->setIsBeginner(false);
		CCNode* parent = this->getParent();
		this->removeFromParentAndCleanup();
		INFORMATION_BOX(CN("register_and_login_successfully"),parent);
	}
	else if(data["result"].getString()=="Username existed"){
		INFORMATION_BOX(CN("username_existed"),this);
	}
	else{
		INFORMATION_BOX(CN("register_failed"),this);
	}
}
コード例 #6
0
ファイル: studentPasswords.cpp プロジェクト: yvanvds/yATools
void studentPasswords::showClass(string schoolClass) {
  currentClass = schoolClass;
  
  table->clear();
  table->elementAt(0,0)->addWidget(new Wt::WText("Naam"));
  table->elementAt(0,1)->addWidget(new Wt::WText("HoofdAccount"));
  table->elementAt(0,2)->addWidget(new Wt::WText("CoAccount 1"));
  table->elementAt(0,3)->addWidget(new Wt::WText("CoAccount 2"));
  table->elementAt(1,0)->addWidget(new Wt::WText("Select all"));
  
  Wt::WCheckBox * checkMain = new Wt::WCheckBox();
  table->elementAt(1,1)->addWidget(checkMain);
  checkMain->clicked().connect(std::bind([=] () {
    for(int i = 2; i < table->rowCount(); i++) {
      ((Wt::WCheckBox*)(table->elementAt(i, 1)->widget(0)))->setChecked(checkMain->isChecked());
    }
  }));
  
  Wt::WCheckBox * checkCo1 = new Wt::WCheckBox();
  table->elementAt(1,2)->addWidget(checkCo1);
  checkCo1->clicked().connect(std::bind([=] () {
    for(int i = 2; i < table->rowCount(); i++) {
      ((Wt::WCheckBox*)(table->elementAt(i, 2)->widget(0)))->setChecked(checkCo1->isChecked());
    }
  }));
  
  Wt::WCheckBox * checkCo2 = new Wt::WCheckBox();
  table->elementAt(1,3)->addWidget(checkCo2);
  checkCo2->clicked().connect(std::bind([=] () {
    for(int i = 2; i < table->rowCount(); i++) {
      ((Wt::WCheckBox*)(table->elementAt(i, 3)->widget(0)))->setChecked(checkCo2->isChecked());
    }
  }));
  
  table->setHeaderCount(2, Wt::Orientation::Horizontal);
  
  y::ldap::schoolClass & sc = server->getClass(CN(schoolClass));
  int row = 0;
  for(auto it = sc.students().begin(); it != sc.students().end(); ++it) {
    y::ldap::account & student = server->getAccount(DN(*it));
    table->elementAt(2+row,0)->addWidget(new Wt::WText(student.fullName().get().wt()));
    table->elementAt(2+row,1)->addWidget(new Wt::WCheckBox());
    table->elementAt(2+row,2)->addWidget(new Wt::WCheckBox());
    table->elementAt(2+row,3)->addWidget(new Wt::WCheckBox());
    row++;
  }
  
  for(int i = 0; i < table->rowCount(); i++) {
    for(int j = 0; j < table->columnCount(); j++) {
      table->elementAt(i, j)->setPadding(5);
      table->elementAt(i, j)->setVerticalAlignment(Wt::AlignMiddle);
    }
  }
}
コード例 #7
0
void example(double E0 = 50, int nevents = 100000)
{
   TStopwatch timer;

   // 12C* -> 3(4He)
   // compound nucleus = carbon
   KVNucleus CN(6, 12);
   CN.SetExcitEnergy(E0);

   // decay products
   KVEvent decay;
   KVNucleus* n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);

   MicroStat::mdweight gps;
   Double_t etot = E0 + decay.GetChannelQValue();

   if (etot <= 0) {
      printf("Break-up channel is not allowed\n");
      return;
   }
   gps.SetWeight(&decay, etot);
   gps.initGenerateEvent(&decay);

   TH1F* h1 = new TH1F("h1", "Kinetic energy of alpha particle 3", 200, 0, etot * 2. / 3.);
   h1->Sumw2();

   KVEvent event;

   while (nevents--) {
      gps.GenerateEvent(&decay, &event);
      h1->Fill(event.GetParticle(3)->GetKE());
      gps.resetGenerateEvent();
   }

   h1->Draw();
   TF1* EDis = new TF1("EDis", edist, 0., etot, 3);
   EDis->SetNpx(500);
   EDis->SetParLimits(0, 0, 1.e+08);
   EDis->SetParLimits(1, 0, 2 * etot);
   EDis->FixParameter(2, 3);
   gStyle->SetOptFit(1);
   h1->Fit(EDis, "EM");

   timer.Print();
}
コード例 #8
0
//Cumulative Normale
double CN(double x){
	static double a[5] = {0.319381530, -0.356563782, 1.781477937, -1.821255978, 1.330274429};
    double result;

	if(x<-7.0) result = NormalDensity(x) / sqrt(1.+x*x); 
	else{
	   if(x>7.0) result = 1.0 - CN(-x);
	   else{
	       double tmp = 1.0 / (1.0+0.2316419*fabs(x));
		   result = 1 - NormalDensity(x)* (tmp*(a[0]+tmp*(a[1]+tmp*(a[2]+tmp*(a[3]+tmp*a[4])))));
		   if(x<=0.0) result = 1.0 - result;
	   }
	}
	return result;
}
コード例 #9
0
void example(double E0 = 50, int nevents = 100000)
{
   // 12C* -> 3(4He)
   // compound nucleus = carbon
   KVNucleus CN(6, 12);
   CN.SetExcitEnergy(E0);

   // decay products
   KVEvent decay;
   KVNucleus* n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);
   n = decay.AddParticle();
   n->SetZandA(2, 4);

   KVGenPhaseSpace gps;
   if (!gps.SetBreakUpChannel(CN, &decay)) {
      printf("Break-up channel is not allowed\n");
      return;
   }

   TFile* out = new TFile("ThreeAlphaDecay.root", "recreate");
   TTree* tri = new TTree("ThreeAlphaDecay", Form("12C(E*=%lf.2MeV) -> 3(4He)", E0));
   Int_t mult;
   Double_t wgt;
   tri->Branch("mult", &mult);
   tri->Branch("wgt", &wgt);
   AddArrBrI(Int_t, Z);
   AddArrBrI(Int_t, A);
   AddArrBrD(Double_t, E);
   AddArrBrD(Double_t, Theta);
   AddArrBrD(Double_t, Phi);


   while (nevents--) {
      wgt = gps.Generate();
      decay.FillArraysEThetaPhi(mult, Z, A, E, Theta, Phi);
      tri->Fill();
   }

   out->Write();
   delete out;
}
コード例 #10
0
ファイル: account.cpp プロジェクト: yvanvds/yATools
y::ldap::account::account(y::ldap::server * server) :
  server(server),
  // var          name in ldap          type and init    is int?      
  _uidNumber     (TYPE_UIDNUMBER      , UID_NUMBER (0 )),
  _uid           (TYPE_UID            , UID        ("")),
  _dn            ("DN"                , DN         ("")),
  _cn            (TYPE_CN             , CN         ("")),
  _sn            ("sn"                , SN         ("")),
  _fullName      ("displayName"       , FULL_NAME  ("")),
  _homeDir       ("homeDirectory"     , HOMEDIR    ("")),
  _wisaID        ("wisaID"            , WISA_ID    (0 )),
  _wisaName      (TYPE_WISANAME       , WISA_NAME  ("")),
  _mail          ("mail"              , MAIL       ("")),
  _mailAlias     ("mailAlias"         , MAIL_ALIAS ("")),
  _birthDay      ("birthday"          , DATE(DAY(1), MONTH(1), YEAR(1))),
  _password      ("gMailPassword"     , PASSWORD   ("")),
  _role          ("schoolRole"        , ROLE(ROLE::NONE)),
  _groupID       ("gidNumber"         , GID_NUMBER (0 )),
  _schoolClass   ("class"             , SCHOOLCLASS("")),
  _classChange   ("classChangeDate"   , DATE(DAY(1), MONTH(1), YEAR(1))),
  _birthPlace    ("placeOfBirth"      , BIRTHPLACE ("")),
  _gender        ("gender"            , GENDER(GENDER::MALE) ),
  _adminGroup    ("adminGroupID"      , ADMINGROUP (0 )),
  _registerID    ("nationalRegisterID", REGISTER_ID("")),
  _nationality   ("nationality"       , NATION     ("")),
  _stemID        ("stemID"            , STEM_ID    (0 )),
  _schoolID      ("schoolID"          , SCHOOL_ID  (0 )),   
  _houseNumber   ("houseNumber"       , HOUSENUMBER(0 )),
  _houseNumberAdd("houseNumberAdd"    , HOUSENUMBER_ADD("")  ),
  _city          ("location"          , CITY       ("")),
  _postalCode    ("postalCode"        , POSTAL_CODE("")),
  _street        ("street"            , STREET     ("")),
  _country       ("co"                , COUNTRY    ("")),

  _new(true),
  _hasKrbName(false),
  _hasSchoolPersonClass(false),
  _importStatus(WI_NOT_ACCOUNTED),
  _flaggedForRemoval(false)
  {}
コード例 #11
0
ファイル: account.cpp プロジェクト: yvanvds/yATools
void y::ldap::account::clear() {
  _new = true;
  _hasKrbName = false;
  _hasSchoolPersonClass = false;
  _uidNumber     .reset(UID_NUMBER (0 ));
  _uid           .reset(UID        (""));
  _dn            .reset(DN         (""));
  _cn            .reset(CN         (""));
  _sn            .reset(SN         (""));
  _fullName      .reset(FULL_NAME  (""));
  _homeDir       .reset(HOMEDIR    (""));
  _wisaID        .reset(WISA_ID    (0 ));
  _wisaName      .reset(WISA_NAME  (""));
  _mail          .reset(MAIL       (""));
  _mailAlias     .reset(MAIL_ALIAS (""));
  _birthDay      .reset(DATE(DAY(1), MONTH(1), YEAR(1)));
  _password      .reset(PASSWORD   (""));
  _role          .reset(ROLE(ROLE::NONE));
  _groupID       .reset(GID_NUMBER (0 ));
  _schoolClass   .reset(SCHOOLCLASS(""));
  _birthPlace    .reset(BIRTHPLACE (""));
  _gender        .reset(GENDER(GENDER::MALE));
  _adminGroup    .reset(ADMINGROUP (0 ));
  _registerID    .reset(REGISTER_ID(""));
  _nationality   .reset(NATION     (""));
  _stemID        .reset(STEM_ID    (0 ));
  _schoolID      .reset(SCHOOL_ID  (0 ));
  _street        .reset(STREET     (""));  
  _houseNumber   .reset(HOUSENUMBER(0 ));
  _houseNumberAdd.reset(HOUSENUMBER_ADD(""));
  _city          .reset(CITY       (""));
  _postalCode    .reset(POSTAL_CODE(""));
  _country       .reset(COUNTRY    (""));
  _ssPassword.clear();
  _flaggedForRemoval = false;
}
コード例 #12
0
ファイル: RunAlpha.cpp プロジェクト: jdfrankland/gemini
CRunAlpha::CRunAlpha(int iZ, int iA, double Elab, int Nevents)
{
  CAlphaOM om((double)iZ,(double)iA,Elab);

  int iZCN = iZ + 2;
  int iACN = iA + 4;

  CNucleus CN(iZCN,iACN);
  CLevelDensity::setLittleA(12.);
  CN.setEvapMode(1);

  CN.printParameters();

  CMass * mass = CMass::instance();
  


  float Ecm = Elab*(float)iA/(float)(iACN);

  float Q = mass->getExpMass(iZ,iA) + 2.242 - mass->getExpMass(iZCN,iACN);
  cout << "Q = " << Q << " MeV" << endl;

  float Ex = Ecm + Q;
  cout << "Ex = " << Ex << " MeV" << endl;

  int xn[20]={0};
  int Nfission = 0;


  for (int i=0;i<Nevents;i++)
    {
      float fL = (float)om.getL(CN.ran->Rndm());
      CN.setCompoundNucleus(Ex,fL);
      CN.decay();
     if (CN.abortEvent)
       {
	 CN.reset();
         continue;
       }


     if (CN.isSymmetricFission()) Nfission++;
     else
       {
        int iStable = CN.getNumberOfProducts();

        CNucleus *productER = CN.getProducts(iStable-1);
	if (productER->iZ == iZCN)
	  {
            int x = iACN - productER->iA;
            if (x < 20) xn[x]++;
	  }
       }

   CN.reset();

  }
  cout << "tot x sec = " << om.getXsec() << " mb" << endl;

  float konst = om.getXsec()/(float)Nevents;

  cout << "sigFission = " << (float)Nfission*konst << " mb " << 
    sqrt((float)Nfission)*konst << endl;

  for (int i=0;i<10;i++)
    {
      cout << i << " " << (float)xn[i]*konst << " " <<
	sqrt((float)xn[i])*konst << endl;
    }

}
コード例 #13
0
ファイル: RunThick.cpp プロジェクト: jdfrankland/gemini
/**
 * this constructor is everything at the moment.
/param iZcn - CN proton number
/param iAcn is the mass number
/param fEx is the excitation energy in MeV
/param l0 is the critical spin , specifying the max spin in fusion (unit hbar)
/param d0 is the diffuseness of the spin distribution (units hbar)
/param lmax is the maximum spin value considered. (<l0 for just er info)
/param plb is pi-lambda-bar squared in mb
/param numTot is number of Monte Carlo simulations
/param title0 is name of output root file (without ".root" extension)

 */
CRunThick::CRunThick(int iZcn, int iAcn, float fEx_min,float fEx_max,float l0_min, 
	   float l0_max, float d0, int lmax, float plb,int nBins,
	   int numTot,string title0,float vcm/*=0.*/, float thetaDetMin/*=0.*/,
           float thetaDetMax/*=360*/)
{

  cout << title0 << endl;
  string title = title0 + ".root";
  bool residue;
  bool residueDet;


  float ExArray[nBins];
  for (int i=0;i<nBins;i++) ExArray[i] = fEx_min + (fEx_max-fEx_min)/
    ((float) nBins)*((float)i+0.5);




  float prob[nBins][lmax+1];
  for (int i=0;i<nBins;i++)
    {
      float l0 = l0_min + (l0_max-l0_min)/((float)nBins)*((float)i+0.5);

     float sum = 0.;
     for (int l=0;l<=lmax;l++)
       {
         prob[i][l] =  (float)(2*l+1);
         if (d0 > 0.) prob[i][l] /= (1.+exp(((float)l-l0)/d0));
         else if ( l > l0) prob[i][l] = 0.;
         sum += prob[i][l];
       }
     for (int l=0;l<=lmax;l++)
       {
         prob[i][l] /= sum;
         if (l > 0) prob[i][l] += prob[i][l-1];
       }
    }


  float sum = 0.;
     for (int l=0;l<=lmax;l++)
       {
         float fact =  (float)(2*l+1);
         if (d0 > 0.) fact /= (1.+exp(((float)l-(l0_min+l0_max)/2.)/d0));
         else if ( l > (l0_min+l0_max)/2.) fact = 0.;
         sum += fact;
       }


  TFile *f = new TFile(title.c_str(),"RECREATE");
  CNucleus CN(iZcn,iAcn);

  //CNucleus::setSolution(1);
  //CNucleus::setFissionScaleFactor(7.38);
  //CNucleus::setAddToFisBarrier(-1.);
  //CNucleus::setNoIMF();
  //  CNucleus::setAddToFisBarrier(4.);
  //CNucleus::setLestone();
  //CLevelDensity::setAfAn(1.036);
  //CLevelDensity::setAimfAn(1.05);
  //CNucleus::setTimeTransient(1.);
  //CTlBarDist::setBarWidth(1.);
  //CTlBarDist::setBarWidth(0.);
  //CYrast::forceSierk();


  CN.setVelocityCartesian((float)0.,(float)0.,(float)0.);
  CAngle spin((float)0.,(float)0.);
  CN.setSpinAxis(spin);

  CN.printParameters();
  
  float asy[20]={0.};
  float asyMultPre[20] = {0.};
  float asyMultPost[20] = {0.};
  float asyMultTot[20] = {0.};
  float Nres = 0.;
  float NresDet = 0.;
  float sumAres = 0.;
  float sumAresDet = 0.;
  float Nfiss = 0.;
  float NfissLost = 0.;
  float LfissLost = 0.;
  float NpreSad = 0.;
  float NpreScis = 0.;
  float Npost = 0.;
  float Nalpha = 0.;
  float Nproton = 0.;  
  float Nneutron = 0.;
  float NLi6 = 0.;
  float NLi7 = 0.;
  float NBe7 = 0.;
  float Mfis = 0;
  float M2fis = 0.;
  float M0fis = 0.;
  double numberA = 0;
  double averageA = 0;

  TH1F histEgamma("Egamma","",100,0,50);
  histEgamma.GetXaxis()->SetTitle("E_{#gamma} [MeV]");
  histEgamma.GetYaxis()->SetTitle("#sigma(E_{#gamma}) [mb]");
  histEgamma.SetTitle("distribution of total gamma energy for all events");

  TH1F histER("histER","",91,-0.5,90.5);
  histER.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histER.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histER.SetTitle("spin distribution of events that form residues");

  TH1F histERxn("histERxn","",91,-0.5,90.5);
  histERxn.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histERxn.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histERxn.SetTitle("spin distribution of residue that decay by neutrons only");

  TH1F histFis("histFis","",91,-0.5,90.5);
  histFis.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histFis.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histFis.SetTitle("spin distribution of events that fission");

  TH1F histFus("histFus","",91,-0.5,90.5);
  histFus.GetXaxis()->SetTitle("J [hbar]");
  histFus.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histFus.SetTitle("spin distribution of all fusion events");


  TH1F histA("histA","",231,-0.5,230.5);
  histA.GetXaxis()->SetTitle("A");
  histA.GetYaxis()->SetTitle("#sigma(A) [mb]");
  histA.SetTitle(" inclusive mass distribution");

  TH2F histAA("histAA","",200,0,200,200,0,200);
  TH1F histAFis("histAFis","",231,-0.5,230.5);
  TH1F histAFisPrimary("histAFisPrimary","",231,-0.5,230.5);
  TH1F histAFisPrimaryVel("histAFisPrimaryVel","",231,-0.5,230.5);

  TH1F histZ("histZ","",93,-0.5,92.5);
  histZ.GetXaxis()->SetTitle("Z");
  histZ.GetYaxis()->SetTitle("#sigma(Z) [mb]");
  histZ.SetTitle(" inclusive charge distribution");

  TH1F histZ_fis("histZ_fis","",93,-0.5,92.5);
  histZ_fis.GetXaxis()->SetTitle("Z");
  histZ_fis.GetYaxis()->SetTitle("#sigma(Z) [mb]");
  histZ_fis.SetTitle("charge distribution for fission events");

  TH1F histZ_nofis("histZ_nofis","",93,-0.5,92.5);
  TH1F histN("histN","",133,-0.5,132.5);
  histN.GetXaxis()->SetTitle("N");
  histN.GetYaxis()->SetTitle("#sigma(N) [mb]");
  histN.SetTitle(" inclusive neutron-number distribution");


  TH1F angle("angle","",180,0,180);
  TH2F histZN("histZN","",152,-0.5,151.5,152,-0.5,151.5);
  TH1F keFF("keFF","",150,0,150);
  TH1F kePreSad("kePreSad","",100,0,30);
  TH1F kePreSS("keSS","",100,0,30);
  TH1F kePreSc("kePreSc","",100,0,30);
  TH1F kePost("kePost","",100,0,30);
  TH1F keEvap("keEvap","",100,0,30);
  TH1F velFF("velFF","",100,0,4.);
  TH1F keAlpha("keAlpha","",50,0,50);
  TH1F keProton("keProton","",50,0,50);
  TH1F keNeutron("keNeutron","",50,0,50);
  TH1F keLi6("keLi6","",60,0,60);
  TH1F keLi7("keLi7","",60,0,60);
  TH1F keBe7("keBe7","",60,0,60);
  TH1F histFis2("histFis2","",100,0,7000);

  TH2F histAL("histAL","",251,-0.5,250.5,101,-0.5,100.5);
  histAL.GetXaxis()->SetTitle("A");
  histAL.GetYaxis()->SetTitle("J_{CN} [hbar]");
  histAL.SetTitle("inclusive mass and CN spin distribution");

  TH2F histxnEx("histxnEx","",50,0,50,50,0,20);
  TH2F histxnExA("histxnExA","",16,200,216,50,0,20);

  bool f14=1;
  bool f12=1;
  bool f34=1;
  for (int i=0;i<numTot;i++)
    {
      float weight = 1.;
      //cout <<"event= " <<  i << endl;
      if (i > numTot*.25 && f14)
	{
	  cout << " 25%" << flush;
          f14 = 0;
	} 
      if (i > numTot*.5 && f12)
	{
	  cout << '\xd' << " 50%" << flush;
          f12 = 0;
	} 
      if (i > numTot*.75 && f34)
	{
	  cout << '\xd' << " 75%" << endl;
          f34 = 0;
	} 
      int mbin = nBins+1;
      for (;;)
	{
	  mbin= (int)floor(CN.ran->Rndm()*(float)nBins);
	  if (mbin < nBins) break;
	}

      float fEx = ExArray[mbin];


      float ran = CN.ran->Rndm();
      int l = 0;
      for (;;)
	{
	  if (ran < prob[mbin][l]) break;
          l++;
	}
      //l = 2; //rjc
      //fEx = 77.83;

      /*
      if (i==60) //rjc
	{
	  cout << "here" << endl;
	}
      */

      CN.setCompoundNucleus(fEx,(float)l);      

	{
	  //if (i%100==0)cout << "l= "<< l  << " i= " << i << endl;
	  CN.setWeightIMF();
         CN.decay();

        if (CN.abortEvent)
          {
	    CN.reset();
            continue;
          }

	histEgamma.Fill(CN.getSumGammaEnergy());
         int iStable = CN.getNumberOfProducts();

         CNucleus *productER = CN.getProducts(iStable-1);
	 weight *= productER->getWeightFactor();

	 if(productER->iZ == iZcn)
	   {
	     averageA += (double)productER->iA*(double)weight;
             numberA += (double)weight;
	   }

         int iZres = productER->iZ;
         float resEx = productER->fEx;
         float resJ = productER->fJ;
         int iAres = productER->iA;
         int multTot = 0;
         int iZ, iA;

         CNucleus * product = CN.getProducts(0);
         histFus.Fill(l,weight);

         if (CN.isResidue()) 
	   {
             float * vv;
             vv = productER->getVelocityVector();
             vv[2] += vcm;
             float vvv = sqrt(pow(vv[0],2)+pow(vv[1],2)+pow(vv[2],2));
             float AngleDeg = acos(vv[2]/vvv)*180./3.14159;
             if (AngleDeg > thetaDetMin && AngleDeg < thetaDetMax) 
	       residueDet = 1;
             else residueDet = 0;
	     residue = 1;
             histER.Fill(l,weight);
	     if (iZres == iZcn)
	         {
                    histERxn.Fill(l,weight);
		    histxnEx.Fill(resJ,resEx,weight);
		    histxnExA.Fill(iAres,resEx,weight);
	          }

             Nres += weight;
             sumAres += weight*(float)productER->iA;
             if (residueDet) 
	       {
               NresDet += weight;
               sumAresDet += weight*(float)productER->iA;
	       }
	   }
	 else 
	   {
	     residue = 0;
             residueDet = 0;
	     Nfiss += weight;
             histFis.Fill(l,weight);
             histFis2.Fill(l*l,weight);
	   }


         int iAmax = 0;
         int iAnext = 0;
         float vmax = 0.;
         float vnext = 0.;
         float emax = 0.;
         float enext = 0.;
         for (int j=0;j<iStable;j++)
	   {
             iZ = product->iZ;
             iA = product->iA;
	     //if (CN.SymmetricisFission())cout << iZ << " " << iA << endl;  //rjc
             if (iA > iAmax) 
	       {
                 iAnext = iAmax;
                 vnext = vmax;
                 enext = emax;
                 iAmax = iA;
		 emax = product->getKE();
		 vmax = product->getVelocity();
	       }
	     else if (iA > iAnext)
	       {
                 iAnext = iA;
                 enext = product->getKE();
                 vnext = product->getVelocity();
	       }
             //cout << iZ << " " << iA << endl;
             if (product->getTime() < 0.) 
	       {
		 cout << "negative time" << endl;
                 cout << iZ << " " << iA << " " << 
		   product->getParent()->iZ << " " << 
		   product->getParent()->iA << " " 
		      << product->getParent()->fEx << " " 
		      << product->getParent()->fJ << endl;
	       }

             histZ.Fill(iZ,weight);
             if (CN.isSymmetricFission())histZ_fis.Fill(iZ,weight);
             else histZ_nofis.Fill(iZ,weight);
             histA.Fill(iA,weight);

             histAL.Fill(iA,l,weight);
             histN.Fill(iA-iZ,weight);
             histZN.Fill(iA-iZ,iZ,weight);
             if (iZ == 0 && iA == 1) 
	       {
		 if (residueDet) //iARes >= Ares)
		   {
   		   keNeutron.Fill(product->getKE(),weight);
                   Nneutron += weight;
		   }
                 multTot++;
                 if (CN.isSymmetricFission())
		   {
                    if (product->origin == 0)
		      { 
		      kePreSad.Fill(product->getKE(),weight);
		      NpreSad += weight;
		      }
                    if (product->origin == 1) 
                      kePreSS.Fill(product->getKE(),weight);
                    if (product->origin <= 1) 
		      {
			NpreScis += weight;
                      kePreSc.Fill(product->getKE(),weight);
		      }
		    if (product->origin > 1) 
		      {
			Npost += weight;
                      kePost.Fill(product->getKE(),weight);
		      }
		   }
		 else keEvap.Fill(product->getKE(),weight);
	       }
	     else if (iZ == 1 && iA == 1 && residueDet) //iARes >= Ares)
	       {
		keProton.Fill(product->getKE(),weight);
                Nproton += weight;
	       }
	     else if (iZ == 2 && iA == 4)
	       {
		 if(residueDet) //iARes >=Ares )
		   {

		     /*
                    //rjc
                     if (product->getKE() < 15.)
		       {
                       cout << " i = " << i << endl;
		       cout << product->getParent()->iZ << " " <<
			 product->getParent()->iA << " " <<
			 product->getParent()->fEx << " " <<
			 product->getParent()->fJ << " " <<
			 product->getKE() << " " <<
			 product->getParent()->daughterHeavy->fJ  << " " <<
                         product->getParent()->daughterHeavy->fEx << endl;
		       }
		     */
		     //cout << "alpha " << product->getKE() << endl; //rjc
	             keAlpha.Fill(product->getKE(),weight);
                     Nalpha += weight;
		   }
		 }
	     else if (iZ == 3 && iA == 6)
	       {
		 if(residueDet) //iARes >=Ares )
		   {

	             keLi6.Fill(product->getKE(),weight);
                     NLi6 += weight;
		   }
		 }
	     else if (iZ == 3 && iA == 7)
	       {
		 if(residueDet) //iARes >=Ares )
		   {

	             keLi7.Fill(product->getKE(),weight);
                     NLi7 += weight;
		   }
		 }
	     else if (iZ == 4 && iA == 7)
	       {
		 if(residueDet) //iARes >=Ares )
		   {

	             keBe7.Fill(product->getKE(),weight);
                     NBe7 += weight;
		   }
		 }
             if (iZ > 1 && iZ < 5)
	       {
                 angle.Fill(product->getThetaDegrees(),weight);
	       }
             if (iZ > 5 && CN.isSymmetricFission()) 
	       {
                 keFF.Fill(product->getKE(),weight);
                 velFF.Fill(product->getVelocity(),weight);
                 Mfis += (float)product->iA;
                 M2fis += pow((float)product->iA,2);
                 M0fis += 1.;
                 histAFis.Fill(product->iA,weight);
	       }
	     product=CN.getProducts();
	    }
         if (CN.isSymmetricFission())
	   {
             if ((float)iAmax > 0.77*(float)CN.iA)
	       {
                NfissLost += weight;
                LfissLost += weight*CN.fJ;
	       }                
             float A2 = emax/(emax+enext)*(float)CN.iA;
             float A1 = (float)CN.iA - A2;

             histAFisPrimary.Fill(A1,weight);
             histAFisPrimary.Fill(A2,weight);
             
             A2 = vmax/(vmax+vnext)*(float)CN.iA;
             A1 = (float)CN.iA - A2;

             histAFisPrimaryVel.Fill(A1,weight);
             histAFisPrimaryVel.Fill(A2,weight);
             //cout << iAmax << " " << iAnext << " " << A2 << " " << A1 << endl;
	     histAA.Fill((float)iAnext,A2,weight);
	     histAA.Fill((float)iAmax,A1,weight);
	   }

         float Amax = (float)iAmax/(float)(iAmax+iAnext)*162.;
         float Anext = (float)iAnext/(float)(iAmax+iAnext)*162.;
	 int iasy = (int)(Amax/10);
         asy[iasy] += weight;
         asyMultPre[iasy] += weight*(float)CN.getMultPre();
         asyMultPost[iasy] += weight*(float)CN.getMultPost();
         asyMultTot[iasy] += weight*(float)multTot;
	 iasy = (int)(Anext/10);
         asy[iasy] += weight;
         asyMultPre[iasy] += weight*(float)CN.getMultPre();
         asyMultPost[iasy] += weight*(float)CN.getMultPost();
         asyMultTot[iasy] += weight*(float)multTot;
   

        CN.reset();
	}
      }

  title = title0+"M.dat";
  ofstream ofFile(title.c_str());
  for (int i=0;i<20;i++)
    {
      if (asy[i] == 0) continue;
      ofFile << i*10 + 5 << " " << asyMultPre[i]/asy[i] << " " <<
	asyMultPost[i]/asy[i] << " " << asyMultTot[i]/asy[i] << endl;
    }

  histA.Scale(plb/(float)numTot*sum);
  histZ.Scale(plb/(float)numTot*sum);
  histZ_fis.Scale(plb/(float)numTot*sum);
  histZ_nofis.Scale(plb/(float)numTot*sum);
  histN.Scale(plb/(float)numTot*sum);
  histAFis.Scale(plb/(float)numTot*sum);
  histAFisPrimary.Scale(plb/(float)numTot*sum);
  histAFisPrimaryVel.Scale(plb/(float)numTot*sum);
  histZN.Scale(plb/(float)numTot*sum);

  keAlpha.Scale(1./NresDet);
  keProton.Scale(1./NresDet);
  keNeutron.Scale(1./NresDet);
  keLi6.Scale(1./NresDet);
  keLi7.Scale(1./NresDet);
  keBe7.Scale(1./NresDet);

  f->Write();
  cout << "NresDet= " << NresDet << " Nneut= " << Nneutron << " NProt= " <<
    Nproton << " Nalpha= " << Nalpha << " NLi6= " << NLi6 << " NLi7= " << NLi7
       << " NBe7= " << NBe7 << endl;
  cout << "Li6 mult = " << NLi6/NresDet << endl;
  cout << "Li7 mult = " << NLi7/NresDet << endl;
  cout << "Be7 mult = " << NBe7/NresDet << endl;
  cout << "neutron mult= " << Nneutron/NresDet << endl;
  cout << "proton mult= " << Nproton/NresDet << endl;
  cout << "alpha mult= " << Nalpha/NresDet << endl;

  cout << " mean ER A = " << sumAres/Nres << endl;
  cout << " for det res = " << sumAresDet/NresDet << endl;

  float xER = Nres/(float)numTot*sum*plb;
  float xFiss2 = Nfiss/(float)numTot*sum*plb;
  if (NfissLost > 0) LfissLost /= NfissLost;
  float xFissLost = NfissLost/(float)numTot*sum*plb;
  cout << "sigmaER = " << xER << " mb " << endl;

  float xFus = 0.;
  for (int l=0;l<200;l++)
    {
      float xx =  (float)(2*l+1);
      if (d0 > 0.) xx /=(1.+exp(((float)l-(l0_max+l0_min)/2.)/d0));
      else if (l > (l0_min+l0_max)/2.) break;
      xFus += xx;
    }
  xFus *= plb;
  float xFis = xFus - xER;

  cout << "fusion xsec= " << xFus << " mb" << endl;
  cout << "fission xsec= " << xFis << " mb " << xFiss2 <<  " " 
       << xFissLost << " " << LfissLost<<   endl;

  if (Nfiss > 0.) 
    {
     cout << "preSaddle neut mult = " << NpreSad/Nfiss << endl;
     cout << "preScis neut mult = " << NpreScis/Nfiss << endl;
     cout << "post neut mult = " << Npost/Nfiss << endl;

     float Mav = Mfis/M0fis;
     cout << "mean fission mass = " << Mav << endl;
     float sigma2 = M2fis/(M0fis-1) - M0fis/(M0fis-1)*pow(Mav,2);
     //float sigma = sqrt(sigma2);
     cout << "sigma2M= " << sigma2 << endl;
    }
  if (numberA > 0) cout << "average x for xn products is " << (float)iAcn-
   averageA/numberA << endl;
}
コード例 #14
0
ファイル: studentPasswords.cpp プロジェクト: yvanvds/yATools
void studentPasswords::changePasswords() {
  buttons->hide();
  table->hide();
 
  
  
  pfile.clear(string("wachtwoorden ") + currentClass);
  
  y::ldap::schoolClass & sc = server->getClass(CN(currentClass));
  
  progress->setRange(0, sc.students().size());
  progress->show();
  
  bool csv = false;
  if(((Wt::WCheckBox*)(table->elementAt(1,1)->widget(0)))->isChecked()) csv = true;
  if(((Wt::WCheckBox*)(table->elementAt(1,2)->widget(0)))->isChecked()) csv = true;
  if(((Wt::WCheckBox*)(table->elementAt(1,3)->widget(0)))->isChecked()) csv = true;
  
  int row = 0;
  for(auto it = sc.students().begin(); it != sc.students().end(); ++it) {
    y::ldap::account & a = server->getAccount(DN(*it));
    
    // check main account
    if(((Wt::WCheckBox*)(table->elementAt(row+2, 1)->widget(0)))->isChecked()) {
      pfile.addLine(a.fullName().get());
      {
        if(!csv) {
          string s("Klas: ");
          s += a.schoolClass().get();
          pfile.addLine(s);
        } else {
          pfile.addCsv(a.schoolClass().get());
        }
      }
      {
        if(!csv) {
          string s("Login: "******"Nieuw wachtwoord: ");
          s += a.getPasswordText();
          pfile.addLine(s);
          string s2("Eenmalig Smartschool Wachtwoord: ");
          s2 += sspassword;
          pfile.addLine(s2);
        } else {
          pfile.addCsv(a.getPasswordText());
          pfile.addCsv(sspassword);
        }
      }
      if(!csv) {
        pfile.addLine(" ");
        pfile.addLine("Laat je wachtwoord niet rondslingeren! Je bent verantwoordelijk voor je account. Indien je dit wachtwoord niet kan onthouden, pas dan je wachtwoord zelf aan via http://apps.sanctamaria-aarschot.be");
        pfile.addLine(" ");
      }
    }
    
    // check co-account 1
    if(((Wt::WCheckBox*)(table->elementAt(row+2, 2)->widget(0)))->isChecked()) {
      {
        if(!csv) {
          string s("Wachtwoord voor ");
          s += a.fullName().get();
          pfile.addLine(s);
        } else {
          pfile.addLine(a.fullName().get());
          pfile.addCsv("1ste co-account");
        }
      }
      
      if (!csv) {
        string s(a.street().get());
        s += " ";
        s += string(a.houseNumber().get());
        s += " ";
        s += a.houseNumberAdd().get();
        pfile.addLine(s);
      }
      
      if (!csv) {
        string s(a.postalCode().get());
        s += " ";
        s += string(a.city().get());
        pfile.addLine(s);
      }
      
      {
        if(!csv) {
          string s("Klas: ");
          s += a.schoolClass().get();
          pfile.addLine(s);
        } else {
          pfile.addCsv(a.schoolClass().get());
        }
      }
      {
        if(!csv) {
          string s("Login: "******"Wachtwoord 1ste Co-account: ");
          s += password;         
          pfile.addLine(s);
        } else {
          pfile.addCsv(password);
        }
      }
      
      if(!csv) {
        pfile.addLine(" ");
        pfile.addLine("Met dit wachtwoord kan je als ouder inloggen op http://sanctamaria-aarschot.smartschool.be");
        pfile.addLine(" ");
      }
    }
    
    // check co-account 2
    if(((Wt::WCheckBox*)(table->elementAt(row+2, 3)->widget(0)))->isChecked()) {
      {
        if(!csv) {
          string s("Wachtwoord voor ");
          s += a.fullName().get();
          pfile.addLine(s);
        } else {
          pfile.addLine(a.fullName().get());
          pfile.addCsv("2de co-account");
        }
      }
      
      if(!csv) {
        string s(a.street().get());
        s += " ";
        s += string(a.houseNumber().get());
        s += " ";
        s += a.houseNumberAdd().get();
        pfile.addLine(s);
      }
      
      if(!csv) {
        string s(a.postalCode().get());
        s += " ";
        s += string(a.city().get());
        pfile.addLine(s);
      }
      
      {
        if(!csv) {
          string s("Klas: ");
          s += a.schoolClass().get();
          pfile.addLine(s);
        } else {
          pfile.addCsv(a.schoolClass().get());
        }
      }
      {
        if(!csv) {
          string s("Login: "******"Wachtwoord 2de Co-account: ");
          s += password;
          pfile.addLine(s);
        } else {
          pfile.addCsv(password);
        }
      }
      if(!csv) {
        pfile.addLine(" ");
        pfile.addLine("Met dit wachtwoord kan je als ouder inloggen op http://sanctamaria-aarschot.smartschool.be");
        pfile.addLine(" ");
      }
    }
    
    progress->setValue(row);
    row++;
  }
  server->commitChanges();
  
  progress->hide();  
  anchor->show();
}
コード例 #15
0
ファイル: account.cpp プロジェクト: yvanvds/yATools
y::ldap::account & y::ldap::account::schoolClass(const SCHOOLCLASS & value) {
  server->getClass(CN(_schoolClass().get())).removeStudent(_dn());
  _schoolClass(value);
  server->getClass(CN(_schoolClass().get())).addStudent(_dn());
  return *this;
}
コード例 #16
0
ファイル: Run.cpp プロジェクト: jdfrankland/gemini
/**
 * this constructor is everything at the moment.
/param iZcn - CN proton number
/param iAcn is the mass number
/param fEx is the excitation energy in MeV
/param l0 is the critical spin , specifying the max spin in fusion (unit hbar)
/param d0 is the diffuseness of the spin distribution (units hbar)
/param lmax is the maximum spin value considered. (<l0 for just er info)
/param plb is pi-lambda-bar squared in mb
/param numTot is number of Monte Carlo simulations
/param title0 is name of output root file (without ".root" extension)

 */
CRun::CRun(int iZcn, int iAcn, float fEx, float l0, float d0, int lmax, float plb,
	   int numTot,string title0,float vcm/*=0.*/, float thetaDetMin/*=0.*/,
           float thetaDetMax/*=360*/)
{

  cout << title0 << endl;
  string title = title0 + ".root";
  bool residue;
  bool residueDet;

  // calculate the CN spin distribution
  float prob[lmax+1];
  float sum = 0.;
  for (int l=0;l<=lmax;l++)
    {
      prob[l] =  (float)(2*l+1);

      //select either a fermi distribution of the erfc distribution
      //if (d0 > 0.) prob[l] /= (1.+exp(((float)l-l0)/d0));
      if (d0 > 0.) prob[l] *= erfc(((float)l-l0)/d0/4.*sqrt(3.14159))/2.;
      else if ( l > l0) prob[l] = 0.;
      sum += prob[l];
    }
  //normalise to unity
  for (int l=0;l<=lmax;l++)
    {
      prob[l] /= sum;
      if (l > 0) prob[l] += prob[l-1];
    }

  //root file for output
  TFile *f = new TFile(title.c_str(),"RECREATE");

  //crerate compound nucleus
  CNucleus CN(iZcn,iAcn);

  CNucleus::setUserGDR();
  //set GEMINI++ parameters
  //CNucleus::setSolution(1);
  //CNucleus::setFissionScaleFactor(7.38);
  //CNucleus::setAddToFisBarrier(7.);
  //CNucleus::setNoIMF();
  //CNucleus::setAddToFisBarrier(4.);
  //CNucleus::setLestone();
  //CLevelDensity::setAfAn(1.036);
  //CLevelDensity::setAimfAn(1.0);
  //CNucleus::setTimeTransient(1.);
  //CTlBarDist::setBarWidth(1.);
  //CTlBarDist::setBarWidth(0.);
  //CYrast::forceSierk();


  CN.setVelocityCartesian((float)0.,(float)0.,(float)0.);
  CAngle spin((float)0.,(float)0.);
  CN.setSpinAxis(spin);

  CN.printParameters();
  
  float asy[20]={0.};
  float asyMultPre[20] = {0.};
  float asyMultPost[20] = {0.};
  float asyMultTot[20] = {0.};

  float Nres = 0.;
  float NresDet = 0.;
  float sumAres = 0.;
  float sumAresDet = 0.;
  float Nfiss = 0.;
  float NpreSad = 0.;
  float NpreScis = 0.;
  float Npost = 0.;
  float Nalpha = 0.;
  float Nproton = 0.;  
  float Nneutron = 0.;
  float NLi6 = 0.;
  float NLi7 = 0.;
  float NBe7 = 0.;
  float Mfis = 0;
  float M2fis = 0.;
  float M0fis = 0.;
  double numberA = 0.;
  double averageA = 0.;

  TH1F histEgammaTot("EgammaTot","",100,0,50);
  histEgammaTot.GetXaxis()->SetTitle("E_{#gamma} [MeV]");
  histEgammaTot.GetYaxis()->SetTitle("#sigma(E_{#gamma}) [mb/MeV]");
  histEgammaTot.SetTitle("distribution of total gamma energy for all events");


  TH1F histEgamma("Egamma","",100,0,50);
  histEgamma.GetXaxis()->SetTitle("E_{#gamma} [MeV]");
  histEgamma.GetYaxis()->SetTitle("#sigma(E_{#gamma}) [mb/MeV]");
  histEgamma.SetTitle("distribution of total gamma energy for all events");

  TH1F histEgammaER("EgammaER","",100,0,50);
  histEgammaER.GetXaxis()->SetTitle("E_{#gamma} [MeV] for residues");
  histEgammaER.GetYaxis()->SetTitle("#sigma(E_{#gamma}) [mb/MeV]");
  histEgammaER.SetTitle("distribution of total gamma energy for all events");

  TH1F histER("histER","",91,-0.5,90.5);
  histER.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histER.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histER.SetTitle("spin distribution of events that form residues");

  TH1F histERxn("histERxn","",91,-0.5,90.5);
  histERxn.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histERxn.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histERxn.SetTitle("spin distribution of residue that decay by neutrons only");
  TH1F histFis("histFis","",91,-0.5,90.5);
  histFis.GetXaxis()->SetTitle("J_{CN} [hbar]");
  histFis.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histFis.SetTitle("spin distribution of events that fission");

  TH1F histFus("histFus","",91,-0.5,90.5);
  histFus.GetXaxis()->SetTitle("J [hbar]");
  histFus.GetYaxis()->SetTitle("#sigma(J) [mb]");
  histFus.SetTitle("spin distribution of all fusion events");

  TH1F histA("histA","",231,-0.5,230.5);
  histA.GetXaxis()->SetTitle("A");
  histA.GetYaxis()->SetTitle("#sigma(A) [mb]");
  histA.SetTitle(" inclusive mass distribution");


  TH1F histZ("histZ","",93,-0.5,92.5);
  histZ.GetXaxis()->SetTitle("Z");
  histZ.GetYaxis()->SetTitle("#sigma(Z) [mb]");
  histZ.SetTitle(" inclusive charge distribution");


  TH1F histZ_fis("histZ_fis","",93,-0.5,92.5);
  histZ_fis.GetXaxis()->SetTitle("Z");
  histZ_fis.GetYaxis()->SetTitle("#sigma(Z) [mb]");
  histZ_fis.SetTitle("charge distribution for fission events");

  TH1F histZ_nofis("histZ_nofis","",93,-0.5,92.5);
  histZ_nofis.GetXaxis()->SetTitle("Z");
  histZ_nofis.GetYaxis()->SetTitle("#sigma(Z) [mb]");
  histZ_nofis.SetTitle("charge distribution for non-fission events");

  TH1F histN("histN","",133,-0.5,132.5);
  histN.GetXaxis()->SetTitle("N");
  histN.GetYaxis()->SetTitle("#sigma(N) [mb]");
  histN.SetTitle(" inclusive neutron-number distribution");

  //the following are differential multiplicity 
  TH1F keNeutron("keNeutron","",50,0,50);
  keNeutron.GetXaxis()->SetTitle("E_{k} [MeV]");
  keNeutron.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  keNeutron.SetTitle("neutron energy spectra in coincidence with residues");

  TH1F keAlpha("keAlpha","",50,0,50);
  keAlpha.GetXaxis()->SetTitle("E_{k} [MeV]");
  keAlpha.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  keAlpha.SetTitle("#alpha particle energy spectra in coincidence with residues");


  TH1F keProton("keProton","",50,0,50);
  keProton.GetXaxis()->SetTitle("E_{k} [MeV]");
  keProton.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  keProton.SetTitle("proton energy spectra in coincidence with residues");


  TH1F keLi6("keLi6","",60,0,60);
  keLi6.GetXaxis()->SetTitle("E_{k} [MeV]");
  keLi6.GetYaxis()->SetTitle("dm/dE [MeV^{_1}]");
  keLi6.SetTitle("^{6}Li energy spectra in coincidence with residues");


  TH1F keLi7("keLi7","",60,0,60);
  keLi7.GetXaxis()->SetTitle("E_{k} [MeV]");
  keLi7.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  keLi7.SetTitle("^{7}Li energy spectra in coincidence with residues");


  TH1F keBe7("keBe7","",60,0,60);
  keBe7.GetXaxis()->SetTitle("E_{k} [MeV]");
  keBe7.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  keBe7.SetTitle("^{7}Be energy spectra in coincidence with residues");



  //the following are differential cross sections 
  TH1F sigNeutron("sigNeutron","",50,0,50);
  sigNeutron.GetXaxis()->SetTitle("E_{k} [MeV]");
  sigNeutron.GetYaxis()->SetTitle("d#sigma/dE [mb/MeV]");
  sigNeutron.SetTitle("inclusive neutron energy spectra");

  TH1F sigAlpha("sigAlpha","",50,0,50);
  sigAlpha.GetXaxis()->SetTitle("E_{k} [MeV]");
  sigAlpha.GetYaxis()->SetTitle("d#sigma/dE [mb/MeV]");
  sigAlpha.SetTitle("inclusive #alpha-particle energy spectra");


  TH1F sigProton("sigProton","",50,0,50);
  sigProton.GetXaxis()->SetTitle("E_{k} [MeV]");
  sigProton.GetYaxis()->SetTitle("d#sigma/dE [mb/MeV]");
  sigProton.SetTitle("inclusive proton energy spectra");

  TH2F histAL("histAL","",251,-0.5,250.5,100,0,100);
  histAL.GetXaxis()->SetTitle("A");
  histAL.GetYaxis()->SetTitle("J_{CN} [hbar]");
  histAL.SetTitle("inclusive mass and CN spin distribution");


  TH2F histZN("histZN","",152,-0.5,151.5,152,-0.5,151.5);
  histZN.GetXaxis()->SetTitle("N");
  histZN.GetYaxis()->SetTitle("Z");
  histZN.SetTitle("inclusive joint N_Z distributions of all fragments");



  TH1F keFF("keFF","",150,0,150);
  keFF.GetXaxis()->SetTitle("E_{k} [MeV]");
  keFF.GetYaxis()->SetTitle("d#sigma/dE [mb/MeV]");
  keFF.SetTitle("Fission Fragment kinetic-energy spectrum");


  TH1F velFF("velFF","",100,0,4.);
  velFF.GetXaxis()->SetTitle("v [cm/ns]");
  velFF.GetYaxis()->SetTitle("d#sigma/dv [mb/cm/ns]");
  velFF.SetTitle("Fission Fragment velocity spectrum");



  TH1F kePreSad("kePreSad","",100,0,30);
  kePreSad.GetXaxis()->SetTitle("E_{k} [MeV]");
  kePreSad.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  kePreSad.SetTitle("pre-saddle neutron multiplicity spectrum");

  TH1F kePreSS("keSS","",100,0,30);
  kePreSS.GetXaxis()->SetTitle("E_{k} [MeV]");
  kePreSS.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  kePreSS.SetTitle("saddle-to-scission neutron multiplicity spectrum");


  TH1F kePreSc("kePreSc","",100,0,30);
  kePreSc.GetXaxis()->SetTitle("E_{k} [MeV]");
  kePreSc.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  kePreSc.SetTitle("pre-scission neutron multiplicity spectrum");

  TH1F kePost("kePost","",100,0,30);
  kePost.GetXaxis()->SetTitle("E_{k} [MeV]");
  kePost.GetYaxis()->SetTitle("dm/dE [MeV^{-1}]");
  kePost.SetTitle("post scission neutron spectrum");


  bool f14=1;
  bool f12=1;
  bool f34=1;
  for (int i=0;i<numTot;i++)
    {
      float weight = 1.;
      //cout <<"event= " <<  i << endl;
      if (i > numTot*.25 && f14)
	{
	  cout << " 25%" << flush;
          f14 = 0;
	} 
      if (i > numTot*.5 && f12)
	{
	  cout << '\xd' << " 50%" << flush;
          f12 = 0;
	} 
      if (i > numTot*.75 && f34)
	{
	  cout << '\xd'<< " 75%" << endl;
          f34 = 0;
	} 
      float ran = CN.ran->Rndm();
      int l = 0;
      for (;;)
	{
	  if (ran < prob[l]) break;
          l++;
	}
      // l = 43; //rjc
      //fEx = 77.83;

      CN.setCompoundNucleus(fEx,(float)l);      

	{
	  //if (i%100==0)cout << "l= "<< l  << " i= " << i << endl;
	 CN.setWeightIMF(); //turn on enhanced IMF emission
         CN.decay();

        if (CN.abortEvent)
          {
	    CN.reset();
            continue;
          }

	histEgammaTot.Fill(CN.getSumGammaEnergy());
        for(int i =0; i<CN.getnGammaRays(); i++)
	  {
	    histEgamma.Fill(CN.getGammaRayEnergy(i));
	    if (CN.isResidue())histEgammaER.Fill(CN.getGammaRayEnergy(i));
	  }

         int iStable = CN.getNumberOfProducts();

         CNucleus *productER = CN.getProducts(iStable-1);
	 weight *= productER->getWeightFactor();

	 if(productER->iZ == iZcn)
	   {
	     averageA += (double)productER->iA*(double)weight;
             numberA += (double)weight;
	   }

         int iZres = productER->iZ;
         //int iAres = productER->iA;
         int multTot = 0;
         int iZ, iA;

         CNucleus * product = CN.getProducts(0);
         histFus.Fill(l,weight);

         if (CN.isResidue()) 
	   {
             float * vv;
             vv = productER->getVelocityVector();
             vv[2] += vcm;
             float vvv = sqrt(pow(vv[0],2)+pow(vv[1],2)+pow(vv[2],2));
             float AngleDeg = acos(vv[2]/vvv)*180./3.14159;
             if (AngleDeg > thetaDetMin && AngleDeg < thetaDetMax) 
	       residueDet = 1;
             else residueDet = 0;
	     residue = 1;
             histER.Fill(l,weight);
	     if (iZres == iZcn)
	         {
                    histERxn.Fill(l,weight);
	          }

             Nres += weight;
             sumAres += weight*(float)productER->iA;
             if (residueDet) 
	       {
               NresDet += weight;
               sumAresDet += weight*(float)productER->iA;
	       }
	   }
	 else
	   {
	     residue = 0;
             residueDet = 0;
	   }

	 if (CN.isSymmetricFission())
	   {
	     Nfiss += weight;
             histFis.Fill(l,weight);
	   }


         int iAmax = 0;
         int iAnext = 0;
         float vmax = 0.;
         float vnext = 0.;
         float emax = 0.;
         float enext = 0.;
         for (int j=0;j<iStable;j++)
	   {
             iZ = product->iZ;
             iA = product->iA;

             if (iA > iAmax) 
	       {
                 iAnext = iAmax;
                 vnext = vmax;
                 enext = emax;
                 iAmax = iA;
		 emax = product->getKE();
		 vmax = product->getVelocity();
	       }
	     else if (iA > iAnext)
	       {
                 iAnext = iA;
                 enext = product->getKE();
                 vnext = product->getVelocity();
	       }
             //cout << iZ << " " << iA << endl;
             if (product->getTime() < 0.) 
	       {
		 cout << "negative time" << endl;
                 cout << iZ << " " << iA << " " << 
		   product->getParent()->iZ << " " << 
		   product->getParent()->iA << " " 
		      << product->getParent()->fEx << " " 
		      << product->getParent()->fJ << endl;
	       }

             histZ.Fill(iZ,weight);

             if (CN.isSymmetricFission())histZ_fis.Fill(iZ,weight);
             else histZ_nofis.Fill(iZ,weight);
             histA.Fill(iA,weight);

             histAL.Fill(iA,l,weight);
             histN.Fill(iA-iZ,weight);
             histZN.Fill(iA-iZ,iZ,weight);
             if (iZ == 0 && iA == 1) 
	       {
		 if (residueDet) //iARes >= Ares)
		   {
   		   keNeutron.Fill(product->getKE(),weight);
                   Nneutron += weight;
		   }
   		   sigNeutron.Fill(product->getKE(),weight);
                 multTot++;
                 if (CN.isSymmetricFission())
		   {
                    if (product->origin == 0)
		      { 
		      kePreSad.Fill(product->getKE(),weight);
		      NpreSad += weight;
		      }
                    if (product->origin == 1) 
                      kePreSS.Fill(product->getKE(),weight);
                    if (product->origin <= 1) 
		      {
			NpreScis += weight;
                      kePreSc.Fill(product->getKE(),weight);
		      }
		    if (product->origin > 1) 
		      {
			Npost += weight;
                      kePost.Fill(product->getKE(),weight);
		      }
		   }
	       }
	     else if (iZ == 1 && iA == 1)
	       {
	        if(residueDet) 
	          {
		   keProton.Fill(product->getKE(),weight);
                   Nproton += weight;
	          }
		   sigProton.Fill(product->getKE(),weight);
	       }
	     else if (iZ == 2 && iA == 4)
	       {
		 if(residueDet) 
		   {
	             keAlpha.Fill(product->getKE(),weight);
                     Nalpha += weight;
		   }
	          sigAlpha.Fill(product->getKE(),weight);
		 }
	     else if (iZ == 3 && iA == 6)
	       {
		 if(residueDet) 
		   {

	             keLi6.Fill(product->getKE(),weight);
                     NLi6 += weight;
		   }
		 }
	     else if (iZ == 3 && iA == 7)
	       {
		 if(residueDet) 
		   {

	             keLi7.Fill(product->getKE(),weight);
                     NLi7 += weight;
		   }
		 }
	     else if (iZ == 4 && iA == 7)
	       {
		 if(residueDet) 
		   {

	             keBe7.Fill(product->getKE(),weight);
                     NBe7 += weight;
		   }
		 }

             if (iZ > 5 && CN.isSymmetricFission()) 
	       {
                 keFF.Fill(product->getKE(),weight);
                 velFF.Fill(product->getVelocity(),weight);
                 Mfis += (float)product->iA;
                 M2fis += pow((float)product->iA,2);
                 M0fis += 1.;
	       }
	     product=CN.getProducts();
	    }


         float Amax = (float)iAmax/(float)(iAmax+iAnext)*162.;
         float Anext = (float)iAnext/(float)(iAmax+iAnext)*162.;
	 int iasy = (int)(Amax/10);
         asy[iasy] += weight;
         asyMultPre[iasy] += weight*(float)CN.getMultPre();
         asyMultPost[iasy] += weight*(float)CN.getMultPost();
         asyMultTot[iasy] += weight*(float)multTot;
	 iasy = (int)(Anext/10);
         asy[iasy] += weight;
         asyMultPre[iasy] += weight*(float)CN.getMultPre();
         asyMultPost[iasy] += weight*(float)CN.getMultPost();
         asyMultTot[iasy] += weight*(float)multTot;
   

        CN.reset();
	}
      }

  title = title0+"M.dat";
  ofstream ofFile(title.c_str());
  for (int i=0;i<20;i++)
    {
      if (asy[i] == 0) continue;
      ofFile << i*10 + 5 << " " << asyMultPre[i]/asy[i] << " " <<
	asyMultPost[i]/asy[i] << " " << asyMultTot[i]/asy[i] << endl;
    }



  histA.Scale(plb/(float)numTot*sum);
  histZ.Scale(plb/(float)numTot*sum);
  histZ_fis.Scale(plb/(float)numTot*sum);
  histZ_nofis.Scale(plb/(float)numTot*sum);
  histN.Scale(plb/(float)numTot*sum);
  histZN.Scale(plb/(float)numTot*sum);
  velFF.Scale(plb/(float)numTot*sum/velFF.GetBinWidth(1));
  keFF.Scale(plb/(float)numTot*sum/keFF.GetBinWidth(1));



  //for multiplicity spectrra in coincidence with fission

  kePreSad.Scale(1./Nfiss/kePreSad.GetBinWidth(1));
  kePreSS.Scale(1./Nfiss/kePreSS.GetBinWidth(1));
  kePreSc.Scale(1./Nfiss/kePreSc.GetBinWidth(1));
  kePost.Scale(1./Nfiss/kePost.GetBinWidth(1));




  //for multiplicity spectra in coincidence with residues
  keAlpha.Scale(1./NresDet/keAlpha.GetBinWidth(1));
  keProton.Scale(1./NresDet/keProton.GetBinWidth(1));
  keNeutron.Scale(1./NresDet/keNeutron.GetBinWidth(1));
  keLi6.Scale(1./NresDet/keLi6.GetBinWidth(1));
  keLi7.Scale(1./NresDet/keLi7.GetBinWidth(1));
  keBe7.Scale(1./NresDet/keBe7.GetBinWidth(1));
  sigNeutron.Scale(plb/(float)numTot*sum/sigNeutron.GetBinWidth(1));
  sigProton.Scale(plb/(float)numTot*sum/sigProton.GetBinWidth(1));
  sigAlpha.Scale(plb/(float)numTot*sum/sigAlpha.GetBinWidth(1));

  histEgamma.Scale(plb/(float)numTot*sum/histEgamma.GetBinWidth(1));  
  histEgammaER.Scale(plb/(float)numTot*sum/histEgammaER.GetBinWidth(1));  
  histEgammaTot.Scale(plb/(float)numTot*sum/histEgammaTot.GetBinWidth(1));  

  f->Write();
  cout << "NresDet= " << NresDet << " Nneut= " << Nneutron << " NProt= " <<
    Nproton << " Nalpha= " << Nalpha << " NLi6= " << NLi6 << " NLi7= " << NLi7
       << " NBe7= " << NBe7 << endl;
  cout << "Li6 mult = " << NLi6/NresDet << endl;
  cout << "Li7 mult = " << NLi7/NresDet << endl;
  cout << "Be7 mult = " << NBe7/NresDet << endl;
  cout << "neutron mult= " << Nneutron/NresDet << endl;
  cout << "proton mult= " << Nproton/NresDet << endl;
  cout << "alpha mult= " << Nalpha/NresDet << endl;

  cout << " mean ER A = " << sumAres/Nres << endl;
  cout << " for det res = " << sumAresDet/NresDet << endl;

  float xER = Nres/(float)numTot*sum*plb;
  float xFiss2 = Nfiss/(float)numTot*sum*plb;
  cout << "sigmaER = " << xER << " mb " << endl;

  float xFus = 0.;
  for (int l=0;l<200;l++)
    {
      float xx =  (float)(2*l+1);
      if (d0 > 0.) xx /=(1.+exp(((float)l-l0)/d0));
      else if (l > l0) break;
      xFus += xx;
    }
  xFus *= plb;
  float xFis = xFus - xER;

  cout << "fusion xsec= " << xFus << " mb" << endl;
  cout << "fission xsec= " << xFis << " mb " << xFiss2 <<  " mb " <<   endl;

  if (Nfiss > 0.)
    {
     cout << "preSaddle neut mult = " << NpreSad/Nfiss << endl;
     cout << "preScis neut mult = " << NpreScis/Nfiss << endl;
     cout << "post neut mult = " << Npost/Nfiss << endl;

     float Mav = Mfis/M0fis;
     cout << "mean fission mass = " << Mav << endl;
     float sigma2 = M2fis/(M0fis-1) - M0fis/(M0fis-1)*pow(Mav,2);
     //float sigma = sqrt(sigma2);
     cout << "sigma2M= " << sigma2 << endl;
    }
  if (numberA > 0) cout << "average x for xn products is " << (float)iAcn-
   averageA/numberA << endl;



}
コード例 #17
0
ファイル: jackknife.cpp プロジェクト: Cryomics-Lab/mothur
EstOutput Jackknife::getValues(SAbundVector* rank){
	try {
		//EstOutput jackData(3,0);
		data.resize(3,0);
	
		double jack, jacklci, jackhci;
	
		int maxRank = (double)rank->getMaxRank();
		int S = rank->getNumBins();

		double N[maxOrder+1];
		double variance[maxOrder+1];
		double p[maxOrder+1];
	
		int k = 0;

		for(int i=0;i<=maxOrder;i++){
			N[i]=0.0000;
			variance[i]=0.0000;
			for(int j=1;j<=maxRank;j++){
				if(j<=i){
					N[i] += aMat[i][j]*rank->get(j);
					variance[i] += aMat[i][j]*aMat[i][j]*rank->get(j);
				}
				else{
					N[i] += rank->get(j);
					variance[i] += rank->get(j);
				}
			}
			variance[i] = variance[i]-N[i];
			double var = 0.0000;
			if(i>0){
				for(int j=1;j<=maxRank;j++){
					if(j<=i){	var += rank->get(j)*pow((aMat[i][j]-aMat[i-1][j]),2.0);	}
					else	{	var += 0.0000;	}
				}
				var -= ((N[i]-N[i-1])*(N[i]-N[i-1]))/S;
				var = var * S / (S-1);
				double T = (N[i]-N[i-1])/sqrt(var);
				if(T<=0.00){	p[i-1] = 1.00000;		}
				else{			p[i-1] = CN(T);			}
			
				if(p[i-1]>=0.05){
					k = i-1;
					break;
				}
			}
			if(i == maxOrder){	k=1;	}
		}

		double ci = 0;
	
		if(k>1){
			double c = (0.05-p[k-1])/(p[k]-p[k-1]);
			ci = 0.0000;
			jack = c*N[k]+(1-c)*N[k-1];
			for(int j=1;j<=maxRank;j++){
				if(j<=k){	ci += rank->get(j)*pow((c*aMat[k][j]+(1-c)*aMat[k-1][j]),2.0);	}
				else	{	ci += rank->get(j);	}
			}
			ci = 1.96 * sqrt(ci - jack);
		}
		else if(k==1){
			jack = N[1];
			ci = 1.96*sqrt(variance[1]);
		}else{
			jack = 0.0;
			ci = 0.0;
		}
	
		jacklci = jack-ci;
		jackhci = jack+ci;
		
		data[0] = jack;
		data[1] = jacklci;
		data[2] = jackhci;
		
		if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
		if (isnan(data[1]) || isinf(data[1])) { data[1] = 0; }
		if (isnan(data[2]) || isinf(data[2])) { data[2] = 0; }
	
		return data;
	}
	catch(exception& e) {
		m->errorOut(e, "Jackknife", "getValues");
		exit(1);
	}
}