Exemple #1
0
/*
 * infrom:
 *	reads a card, supposedly in hand, accepting unambiguous brief
 *	input, returns the index of the card found...
 */
int
infrom(CARD hand[], int n, char *prompt)
{
	int i, j;
	CARD crd;

	if (n < 1) {
		bye();
		printf("\nINFROM: %d = n < 1!!\n", n);
		exit(74);
	}
	for (;;) {
		msg("%s", prompt);
		if (incard(&crd)) {	/* if card is full card */
			if (!isone(crd, hand, n))
				msg("That's not in your hand");
			else {
				for (i = 0; i < n; i++)
					if (hand[i].rank == crd.rank &&
					    hand[i].suit == crd.suit)
						break;
				if (i >= n) {
					bye();
			printf("\nINFROM: isone or something messed up\n");
					exit(77);
				}
				return (i);
			}
		} else			/* if not full card... */
			if (crd.rank != EMPTY) {
				for (i = 0; i < n; i++)
					if (hand[i].rank == crd.rank)
						break;
				if (i >= n)
					msg("No such rank in your hand");
				else {
					for (j = i + 1; j < n; j++)
						if (hand[j].rank == crd.rank)
							break;
					if (j < n)
						msg("Ambiguous rank");
					else
						return (i);
				}
			} else
				msg("Sorry, I missed that");
	}
	/* NOTREACHED */
}
Exemple #2
0
void plotNormSingle(TString inj,int jet, int mH, TString dir, TString ana, int ntoys) {
  
  gROOT->Reset();
  gStyle->SetOptStat(1);
  gStyle->SetOptFit(1);
  TGaxis::SetMaxDigits(1);
  bool debug = false;

  // prefit yields
  float yield_ZH(0.), yield_WH(0.), yield_qqH(0.), yield_ggH(0.);
  float yield_qqWW(0.), yield_ggWW(0.), yield_VV(0.), yield_Top(0.0), yield_Zjets(0.0), yield_WjetsE(0.), yield_Wgamma(0.0), yield_Wg3l(0.0), yield_Ztt(0.), yield_WjetsM(0.); 
  
  TString dir_cards="cards_def";
  TString datacardName = Form("%s/%i/%sof_%ij_shape_8TeV.txt",dir_cards.Data(),mH,ana.Data(),jet);
  std::cout << datacardName << "\n";
  ifstream incard (datacardName);
  string line;
  
  if (incard.is_open()) {
    while ( incard.good() ) {
      getline (incard,line);
      size_t found=line.find("rate");
      if (found!=string::npos) {
	std::cout << line << std::endl;
	stringstream stream(line);
	string rate;
	stream >> rate ;
	stream >> yield_ZH; 
	stream >> yield_WH;
	stream >> yield_qqH;
	stream >> yield_ggH;
	stream >> yield_qqWW;
	stream >> yield_ggWW;
	stream >> yield_VV;    
	stream >> yield_Top;
	stream >> yield_Zjets;
	stream >> yield_WjetsE;
	stream >> yield_Wgamma;
	stream >> yield_Wg3l;
	stream >> yield_Ztt;
	stream >> yield_WjetsM;
      }
    }
    incard.close();
  }