Beispiel #1
0
inline Partition
partition_sub_part(Partition *data, i32_4tech size){
    Partition result = {};
    void *d = partition_allocate(data, size);
    if (d != 0){
        result = make_part(d, size);
    }
    return(result);
}
Beispiel #2
0
inline Tail_Temp_Partition
begin_tail_part(Partition *data, i32_4tech size){
    Tail_Temp_Partition result = {0};
    if (data->pos + size <= data->max){
        result.handle = data;
        result.old_max = data->max;
        data->max -= size;
        result.part = make_part(data->base + data->max, size);
    }
    return(result);
}
Beispiel #3
0
void do_hellblades( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    CHAR_DATA *victim;
    OBJ_DATA *obj;
    int cost = 0;
    argument = one_argument( argument, arg1);

    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }

    if ( arg1[0] == '\0' )
    {
        stc("#CUse #RHell#LBlades#C on who?\n\r",ch);
        return;
    }

    if ((victim = get_char_room(ch, arg1)) == NULL)
    {
        stc("#CThey aren't here.\n\r", ch);
        return;
    }

    if (victim == ch)
    {
        stc("#CYeah ok..... #sd#so#sr#sk#C....\n\r",ch);
        return;
    }

    if (!IS_CLASS(ch, CLASS_WIZARD))
    {
        stc("#CHuh?\n\r",ch);
        return;

    }

    if (ch->pcdata->stats[WL_SPELLS] < 7)
    {
        stc("#RYou do not yet have mastery of this spell.\n\r",ch);
        return;
    }

    if (is_safe(ch,victim)) return;

    if (ch->pcdata->powers[WL_SKILLS] < 4) cost = 20000;
    if (ch->pcdata->powers[WL_SKILLS] > 3) cost = 10000;

    if (ch->mana < 20000 && ch->pcdata->powers[WL_SKILLS] < 4)
    {
        stc("#CYou do not have the #c20000#C required mana.\r\n",ch);
        return;
    }
    else if (ch->mana < 10000 && ch->pcdata->powers[WL_SKILLS] > 3)
    {
        stc("#CYou do not have the #c10000#C required mana.\r\n",ch);
        return;
    }

    if (ch->pcdata->powers[WL_SKILLS] > 3 && number_range(1, 100) < 10)
    {
        if (IS_LEG_L(victim,LOST_LEG))
        {
            sprintf( buf, "#7%s#C has already lost their left leg.\n\r", victim->name);
            stc( buf, ch);
            return;
        }

        if (!IS_LEG_L(victim,LOST_LEG))
            SET_BIT(victim->loc_hp[4],LOST_LEG);
        else
        {
            sprintf( buf, "#7%s#C has already lost theit left leg.\n\r", victim->name);
            stc( buf, ch);
            return;
        }

        if (!IS_BLEEDING(victim,BLEEDING_LEG_L))
            SET_BIT(victim->loc_hp[6],BLEEDING_LEG_L);
        if (IS_BLEEDING(victim,BLEEDING_FOOT_L))
            REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_L);
        act("#CYour hellblades spin around you, cutting off #7$N's#C left leg!",ch,NULL,victim,TO_CHAR);
        act("#7$n's#C hellblades spin around them, cutting off #7$N's#C left leg!",ch,NULL,victim,TO_NOTVICT);
        act("#7$n's#C hellblades spin around them, cutting off your left leg!",ch,NULL,victim,TO_VICT);
        make_part(victim,"leg");
        if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
        {
            if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL)
                take_item(victim,obj);
        }
        if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL)
            take_item(victim,obj);

        if (IS_LEG_R(victim,LOST_LEG))
        {
            sprintf( buf, "#7%s#C has already lost their right leg.\n\r", victim->name);
            stc( buf, ch);
            return;
        }

        if (!IS_LEG_R(victim,LOST_LEG))
            SET_BIT(victim->loc_hp[5],LOST_LEG);
        else
        {
            sprintf( buf, "#7%s#C has already lost their right leg.\n\r", victim->name);
            stc( buf, ch);
            return;
        }

        if (!IS_BLEEDING(victim,BLEEDING_LEG_R))
            SET_BIT(victim->loc_hp[6],BLEEDING_LEG_R);
        if (IS_BLEEDING(victim,BLEEDING_FOOT_R))
            REMOVE_BIT(victim->loc_hp[6],BLEEDING_FOOT_R);
        act("#CYour hellblades spin around you, cutting off #7$N's#C right leg!",ch,NULL,victim,TO_CHAR);
        act("#7$n's#C hellblades spin around them, cutting off #7$N's#C right leg!",ch,NULL,victim,TO_NOTVICT);
        act("#7$n's#C hellblades spin around him, cutting off your right leg!",ch,NULL,victim,TO_VICT);
        make_part(victim,"leg");
        if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
        {
            if ((obj = get_eq_char( victim, WEAR_LEGS )) != NULL)
                take_item(victim,obj);
        }
        if ((obj = get_eq_char( victim, WEAR_FEET )) != NULL)
            take_item(victim,obj);

    }

    /*                if (ch->pcdata->powers[WL_SKILLS] > 3 && number_range(1, 75) < 5 && !IS_NPC(victim))
                    {
                            behead( victim );
                            sprintf( buf, "#7%s#C is cut to pieces by #7%s's#C hellblades.\n\r", victim->name, ch->name);
                            do_info( ch, buf);
                            ch->pkill ++;
                            victim->pdeath -= 1;
                            ch->race ++;
                            return;
                    }*/
    WAIT_STATE(ch, 17);
    victim->hit *= .95;
    ch->mana -= cost;
    return;
}
Beispiel #4
0
int main(){

  RooFitResult f1 = getRes();

  RooArgList final_std_list = f1.floatParsFinal();

  Float_t a_std[14];
  a_std[0] = ((RooAbsReal*)final_std_list.find("Kst2z1430_amp"))->getVal();
  a_std[1] = ((RooAbsReal*)final_std_list.find("Kst2z1430_phase"))->getVal();
  a_std[2] = ((RooAbsReal*)final_std_list.find("Kstm1430_amp"))->getVal();
  a_std[3] = ((RooAbsReal*)final_std_list.find("Kstm1430_phase"))->getVal();
  a_std[4] = ((RooAbsReal*)final_std_list.find("Kstminus_amp"))->getVal();
  a_std[5] = ((RooAbsReal*)final_std_list.find("Kstminus_phase"))->getVal();
  a_std[6] = ((RooAbsReal*)final_std_list.find("Kstz1430_amp"))->getVal();
  a_std[7] = ((RooAbsReal*)final_std_list.find("Kstz1430_phase"))->getVal();
  a_std[8] = ((RooAbsReal*)final_std_list.find("Kstzero_amp"))->getVal();
  a_std[9] = ((RooAbsReal*)final_std_list.find("Kstzero_phase"))->getVal();
  a_std[10] = ((RooAbsReal*)final_std_list.find("Rho1700_amp"))->getVal();
  a_std[11] = ((RooAbsReal*)final_std_list.find("Rho1700_phase"))->getVal();
  a_std[12] = ((RooAbsReal*)final_std_list.find("c1"))->getVal();
  a_std[13] = ((RooAbsReal*)final_std_list.find("c2"))->getVal();

  Float_t err_std[14];
  err_std[0] = ((RooRealVar*)final_std_list.find("Kst2z1430_amp"))->getError();
  err_std[1] = ((RooRealVar*)final_std_list.find("Kst2z1430_phase"))->getError();
  err_std[2] = ((RooRealVar*)final_std_list.find("Kstm1430_amp"))->getError();
  err_std[3] = ((RooRealVar*)final_std_list.find("Kstm1430_phase"))->getError();
  err_std[4] = ((RooRealVar*)final_std_list.find("Kstminus_amp"))->getError();
  err_std[5] = ((RooRealVar*)final_std_list.find("Kstminus_phase"))->getError();
  err_std[6] = ((RooRealVar*)final_std_list.find("Kstz1430_amp"))->getError();
  err_std[7] = ((RooRealVar*)final_std_list.find("Kstz1430_phase"))->getError();
  err_std[8] = ((RooRealVar*)final_std_list.find("Kstzero_amp"))->getError();
  err_std[9] = ((RooRealVar*)final_std_list.find("Kstzero_phase"))->getError();
  err_std[10] = ((RooRealVar*)final_std_list.find("Rho1700_amp"))->getError();
  err_std[11] = ((RooRealVar*)final_std_list.find("Rho1700_phase"))->getError();
  err_std[12] = ((RooRealVar*)final_std_list.find("c1"))->getError();
  err_std[13] = ((RooRealVar*)final_std_list.find("c2"))->getError();

  Float_t stat_matrix[14][14];
  Float_t TOT_matrix[14][14];
  Float_t TOT_syst_matrix[14][14];

  for(Int_t j=0;j<14;j++){
    for(Int_t k=0;k<14;k++){
      stat_matrix[j][k] = f1.correlation( *((RooAbsReal*)final_std_list.at(j)) , *((RooAbsReal*)final_std_list.at(k)) )*err_std[j]*err_std[k];
      TOT_matrix[j][k] = stat_matrix[j][k];
      TOT_syst_matrix[j][k] = 0.;
    }
  }

  /*
  TFile f("toynomix_theRes.root");
  RooFitResult *toyres = (RooFitResult*)f.Get("nll");
  RooArgList toy_std_list = toyres->floatParsFinal();
  Float_t toy_std[14];
  toy_std[0] = ((RooAbsReal*)toy_std_list.find("Kst2z1430_amp"))->getVal();
  toy_std[1] = ((RooAbsReal*)toy_std_list.find("Kst2z1430_phase"))->getVal();
  toy_std[2] = ((RooAbsReal*)toy_std_list.find("Kstm1430_amp"))->getVal();
  toy_std[3] = ((RooAbsReal*)toy_std_list.find("Kstm1430_phase"))->getVal();
  toy_std[4] = ((RooAbsReal*)toy_std_list.find("Kstminus_amp"))->getVal();
  toy_std[5] = ((RooAbsReal*)toy_std_list.find("Kstminus_phase"))->getVal();
  toy_std[6] = ((RooAbsReal*)toy_std_list.find("Kstz1430_amp"))->getVal();
  toy_std[7] = ((RooAbsReal*)toy_std_list.find("Kstz1430_phase"))->getVal();
  toy_std[8] = ((RooAbsReal*)toy_std_list.find("Kstzero_amp"))->getVal();
  toy_std[9] = ((RooAbsReal*)toy_std_list.find("Kstzero_phase"))->getVal();
  toy_std[10] = ((RooAbsReal*)toy_std_list.find("Rho1700_amp"))->getVal();
  toy_std[11] = ((RooAbsReal*)toy_std_list.find("Rho1700_phase"))->getVal();
  toy_std[12] = ((RooAbsReal*)toy_std_list.find("c1"))->getVal();
  toy_std[13] = ((RooAbsReal*)toy_std_list.find("c2"))->getVal();

  Float_t err_toy_std[14];
  err_toy_std[0] = ((RooRealVar*)toy_std_list.find("Kst2z1430_amp"))->getError();
  err_toy_std[1] = ((RooRealVar*)toy_std_list.find("Kst2z1430_phase"))->getError();
  err_toy_std[2] = ((RooRealVar*)toy_std_list.find("Kstm1430_amp"))->getError();
  err_toy_std[3] = ((RooRealVar*)toy_std_list.find("Kstm1430_phase"))->getError();
  err_toy_std[4] = ((RooRealVar*)toy_std_list.find("Kstminus_amp"))->getError();
  err_toy_std[5] = ((RooRealVar*)toy_std_list.find("Kstminus_phase"))->getError();
  err_toy_std[6] = ((RooRealVar*)toy_std_list.find("Kstz1430_amp"))->getError();
  err_toy_std[7] = ((RooRealVar*)toy_std_list.find("Kstz1430_phase"))->getError();
  err_toy_std[8] = ((RooRealVar*)toy_std_list.find("Kstzero_amp"))->getError();
  err_toy_std[9] = ((RooRealVar*)toy_std_list.find("Kstzero_phase"))->getError();
  err_toy_std[10] = ((RooRealVar*)toy_std_list.find("Rho1700_amp"))->getError();
  err_toy_std[11] = ((RooRealVar*)toy_std_list.find("Rho1700_phase"))->getError();
  err_toy_std[12] = ((RooRealVar*)toy_std_list.find("c1"))->getError();
  err_toy_std[13] = ((RooRealVar*)toy_std_list.find("c2"))->getError();

  Float_t stat_toy_matrix[14][14];

  for(Int_t j=0;j<14;j++){
    for(Int_t k=0;k<14;k++){
      stat_toy_matrix[j][k] = toyres->correlation( *((RooAbsReal*)toy_std_list.at(j)) , *((RooAbsReal*)toy_std_list.at(k)) )*err_toy_std[j]*err_toy_std[k];
    }
  }
  */

  //create the systematics matrx, the last element is the number of systematics scenarios
  Float_t sys_matrix[14][14][TOT_syst];
  Int_t index = 0;

  //loop over all the systematics and fill the matrix
  for(Int_t i=0;i<numsyst;i++){

    if(i < first_alone && i % 2 != 0) continue;

    RooFitResult fsyst = getRes(i);
    RooArgList final_syst_list = fsyst.floatParsFinal();

    Float_t a_syst[14];
    Float_t a_syst_plus[14];

    a_syst[0] = ((RooAbsReal*)final_syst_list.find("Kst2z1430_amp"))->getVal();
    a_syst[1] = ((RooAbsReal*)final_syst_list.find("Kst2z1430_phase"))->getVal();
    if(i != slot_LASS){
      a_syst[2] = ((RooAbsReal*)final_syst_list.find("Kstm1430_amp"))->getVal();
      a_syst[3] = ((RooAbsReal*)final_syst_list.find("Kstm1430_phase"))->getVal();
      a_syst[6] = ((RooAbsReal*)final_syst_list.find("Kstz1430_amp"))->getVal();
      a_syst[7] = ((RooAbsReal*)final_syst_list.find("Kstz1430_phase"))->getVal();
    }
    else{
      a_syst[2] = a_std[2];
      a_syst[3] = a_std[3];
      a_syst[6] = a_std[6];
      a_syst[7] = a_std[7];
    }
    a_syst[4] = ((RooAbsReal*)final_syst_list.find("Kstminus_amp"))->getVal();
    a_syst[5] = ((RooAbsReal*)final_syst_list.find("Kstminus_phase"))->getVal();
    a_syst[8] = ((RooAbsReal*)final_syst_list.find("Kstzero_amp"))->getVal();
    a_syst[9] = ((RooAbsReal*)final_syst_list.find("Kstzero_phase"))->getVal();
    if(i != slot_rho){
      a_syst[10] = ((RooAbsReal*)final_syst_list.find("Rho1700_amp"))->getVal();
      a_syst[11] = ((RooAbsReal*)final_syst_list.find("Rho1700_phase"))->getVal();
    }
    else{
      a_syst[10] = a_std[10];
      a_syst[11] = a_std[11];
    }
    a_syst[12] = ((RooAbsReal*)final_syst_list.find("c1"))->getVal();
    a_syst[13] = ((RooAbsReal*)final_syst_list.find("c2"))->getVal();
    
    if(i<first_alone){
      RooFitResult fsyst_plus = getRes(i+1);
      RooArgList final_syst_plus_list = fsyst_plus.floatParsFinal();
      a_syst_plus[0] = ((RooAbsReal*)final_syst_plus_list.find("Kst2z1430_amp"))->getVal();
      a_syst_plus[1] = ((RooAbsReal*)final_syst_plus_list.find("Kst2z1430_phase"))->getVal();
      a_syst_plus[2] = ((RooAbsReal*)final_syst_plus_list.find("Kstm1430_amp"))->getVal();
      a_syst_plus[3] = ((RooAbsReal*)final_syst_plus_list.find("Kstm1430_phase"))->getVal();
      a_syst_plus[6] = ((RooAbsReal*)final_syst_plus_list.find("Kstz1430_amp"))->getVal();
      a_syst_plus[7] = ((RooAbsReal*)final_syst_plus_list.find("Kstz1430_phase"))->getVal();
      a_syst_plus[4] = ((RooAbsReal*)final_syst_plus_list.find("Kstminus_amp"))->getVal();
      a_syst_plus[5] = ((RooAbsReal*)final_syst_plus_list.find("Kstminus_phase"))->getVal();
      a_syst_plus[8] = ((RooAbsReal*)final_syst_plus_list.find("Kstzero_amp"))->getVal();
      a_syst_plus[9] = ((RooAbsReal*)final_syst_plus_list.find("Kstzero_phase"))->getVal();
      a_syst_plus[10] = ((RooAbsReal*)final_syst_plus_list.find("Rho1700_amp"))->getVal();
      a_syst_plus[11] = ((RooAbsReal*)final_syst_plus_list.find("Rho1700_phase"))->getVal();
      a_syst_plus[12] = ((RooAbsReal*)final_syst_plus_list.find("c1"))->getVal();
      a_syst_plus[13] = ((RooAbsReal*)final_syst_plus_list.find("c2"))->getVal();
    }
    
    for(Int_t l=0;l<14;l++){
      for(Int_t m=0;m<14;m++){
	if(i<first_alone){
	  sys_matrix[l][m][index] = (a_syst[l] - a_std[l])*(a_syst[m] - a_std[m])/2. + (a_syst_plus[l] - a_std[l])*( a_syst_plus[m] - a_std[m])/2.;
	  TOT_matrix[l][m] += sys_matrix[l][m][index];
	  TOT_syst_matrix[l][m] += sys_matrix[l][m][index];
	}
	else{
	  sys_matrix[l][m][index] = (a_syst[l]-a_std[l])*(a_syst[m]-a_std[m]);
	  TOT_matrix[l][m] += sys_matrix[l][m][index];
	  TOT_syst_matrix[l][m] += sys_matrix[l][m][index];
	}
      }
    }

    index++;
  } //end of loop over the systematics

  //for(Int_t l=0;l<14;l++){
  //  cov_matrix[l][l] += 0.03*0.03*err_std[l]*err_std[l];
  //}

  //statistical covariance matrix
  makeStatMatrix(stat_matrix);
  //systematics covariance matrix
  makeStatMatrix(TOT_syst_matrix);
  //total covariance matrix
  makeStatMatrix(TOT_matrix);

  //summary table of all systematics contributions
  makeTable(sys_matrix,err_std);
  //summary of the sum of all systematics
  makeTable_TOT(TOT_syst_matrix,err_std);

  //write for toy generation
  writeMatrix(stat_matrix,TOT_matrix);
  make_part(sys_matrix,err_std);

  return 0;
}