void combineAndWeightAnalysisFiles(){
  // ---------------------------------------
  // !!! choose your samples and scaling factors !!!
  // ---------------------------------------
  std::vector<TString> name_; 
  // W systematics
  name_.push_back("L1CorrPU/muonDiffXSecWjetsMadD6TFall10PileUpPF"   );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWjetsMadD6TFall10MatchUpPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWjetsMadD6TFall10MatchDownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWjetsMadD6TFall10ScaleUpPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWjetsMadD6TFall10ScaleDownPF");
  // ttbar systematics
  // a) Sig
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10ISRFSRdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10ISRFSRupPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10MatchDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10MatchUpPF"   );
  name_.push_back("L1CorrPU/muonDiffXSecSigMadD6TFall10PileUpPF"    );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10ScaleDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecSigMadD6TFall10ScaleUpPF"   );
  // b) Bkg
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10ISRFSRdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10ISRFSRupPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10MatchDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10MatchUpPF"   );
  name_.push_back("L1CorrPU/muonDiffXSecBkgMadD6TFall10PileUpPF"    );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10ScaleDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecBkgMadD6TFall10ScaleUpPF"   );
  // c) All
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10ISRFSRdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10ISRFSRupPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10MatchDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10MatchUpPF"   );
  name_.push_back("L1CorrPU/muonDiffXSecAllMadD6TFall10PileUpPF"    );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10ScaleDownPF" );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecAllMadD6TFall10ScaleUpPF"   );
  // DY systematics
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZjetsMadD6TFall10MatchDownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZjetsMadD6TFall10MatchUpPF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZjetsMadD6TFall10ScaleDownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZjetsMadD6TFall10ScaleUpPF"  );
  name_.push_back("L1CorrPU/muonDiffXSecZjetsMadD6TFall10PileUpPF"   );
  // single top PU
  // a) s-channel
  name_.push_back("L1CorrPU/muonDiffXSecSingleTopSchannelMadZ2Fall10PileUpPF");
  // a) t-channel
  name_.push_back("L1CorrPU/muonDiffXSecSingleTopTchannelMadZ2Fall10PileUpPF");
  // a) tw-channel
  name_.push_back("L1CorrPU/muonDiffXSecSingleTopTWchannelMadZ2Fall10PileUpPF");
  // VV sample -> scale to 50 / pb
  // WZ
  // a) std
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWZPytia6Z2Fall10PF"       );
  // b) systematics	   
  name_.push_back("L1Corr/muonDiffXSecWZPytia6Z2Fall10JES09PF"  );
  name_.push_back("L1Corr/muonDiffXSecWZPytia6Z2Fall10JES11PF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWZPytia6Z2Fall10JERdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWZPytia6Z2Fall10JERupPF"  );
  name_.push_back("L1CorrPU/muonDiffXSecWZPytia6Z2Fall10PileUpPF" );
  // WW	
  // a) std
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWWPytia6Z2Fall10PF"       );
  // b) systematics	   
  name_.push_back("L1Corr/muonDiffXSecWWPytia6Z2Fall10JES09PF"  );
  name_.push_back("L1Corr/muonDiffXSecWWPytia6Z2Fall10JES11PF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWWPytia6Z2Fall10JERdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecWWPytia6Z2Fall10JERupPF"  );
  name_.push_back("L1CorrPU/muonDiffXSecWWPytia6Z2Fall10PileUpPF" );
  // ZZ		
  // a) std
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZZPytia6Z2Fall10PF"       );
  // b) systematics	   
  name_.push_back("L1Corr/muonDiffXSecZZPytia6Z2Fall10JES09PF"  );
  name_.push_back("L1Corr/muonDiffXSecZZPytia6Z2Fall10JES11PF"  );
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZZPytia6Z2Fall10JERdownPF");
  name_.push_back("diffXSecFromSignal/analysisRootFilesPFVetoJets/muonDiffXSecZZPytia6Z2Fall10JERupPF"  );
  name_.push_back("L1CorrPU/muonDiffXSecZZPytia6Z2Fall10PileUpPF" );

  std::vector<double> scalingFactor_;
  // W+jets
  scalingFactor_.push_back(472.809/471.559);
  scalingFactor_.push_back(472.809/331.174);
  scalingFactor_.push_back(472.809/86.447 );
  scalingFactor_.push_back(472.809/195.384);
  scalingFactor_.push_back(472.809/154.634);
  //ttbar
  // a) Sig
  scalingFactor_.push_back(8293.219/7756.597);
  scalingFactor_.push_back(8293.219/8850.857);
  scalingFactor_.push_back(8293.219/5955.587);
  scalingFactor_.push_back(8293.219/6580.902);
  scalingFactor_.push_back(8293.219/8134.838);
  scalingFactor_.push_back(8293.219/6977.594);
  scalingFactor_.push_back(8293.219/7322.133);
  // b) Bkg
  scalingFactor_.push_back(8293.219/7756.597);
  scalingFactor_.push_back(8293.219/8850.857);
  scalingFactor_.push_back(8293.219/5955.587);
  scalingFactor_.push_back(8293.219/6580.902);
  scalingFactor_.push_back(8293.219/8134.838);
  scalingFactor_.push_back(8293.219/6977.594);
  scalingFactor_.push_back(8293.219/7322.133);
  // c) All
  scalingFactor_.push_back(8293.219/7756.597);
  scalingFactor_.push_back(8293.219/8850.857);
  scalingFactor_.push_back(8293.219/5955.587);
  scalingFactor_.push_back(8293.219/6580.902);
  scalingFactor_.push_back(8293.219/8134.838);
  scalingFactor_.push_back(8293.219/6977.594);
  scalingFactor_.push_back(8293.219/7322.133);
  // DY
  scalingFactor_.push_back(834.556/545.566);
  scalingFactor_.push_back(834.556/547.036);
  scalingFactor_.push_back(834.556/471.178);
  scalingFactor_.push_back(834.556/436.033);
  scalingFactor_.push_back(834.556/833.287);
  // single top PU
  // a) s-channel
  scalingFactor_.push_back(332103.462/332103.462);
  // a) t-channel
  scalingFactor_.push_back(23127.126/23127.126);
  // a) tw-channel
  scalingFactor_.push_back(144118.623/144118.623);
  // WZ
  // a) std
  scalingFactor_.push_back(0.000414625);
  // b) systematics
  scalingFactor_.push_back(0.000414625);
  scalingFactor_.push_back(0.000414625);
  scalingFactor_.push_back(0.000414625);
  scalingFactor_.push_back(0.000414625);
  scalingFactor_.push_back(0.000416349);
  // WW
  // a) std
  scalingFactor_.push_back(0.001042798);
  // b) systematics
  scalingFactor_.push_back(0.001042798);
  scalingFactor_.push_back(0.001042798);
  scalingFactor_.push_back(0.001042798);
  scalingFactor_.push_back(0.001042798);
  scalingFactor_.push_back(0.001042798);
  // ZZ
  // a) std
  scalingFactor_.push_back(0.000139588);
  // b) systematics
  scalingFactor_.push_back(0.000139588);
  scalingFactor_.push_back(0.000139588);
  scalingFactor_.push_back(0.000139588);
  scalingFactor_.push_back(0.000139588);
  scalingFactor_.push_back(0.000139588);

  // do the job
  for(unsigned int idx=0; idx<name_.size(); ++idx){
    singleFile(name_[idx], scalingFactor_[idx]);
  }

}
Exemple #2
0
int main() {
	//std::string stringtest = "3:hogAB";
	//std::string numbertest = "i30eA";
	//std::string numbertest2 = "i00e";
	//std::string listtest= "l3:hogi30el2:bi3:bioi1eee";
	//std::string ltest = "l3:hog2:go5:abcdee";
	//std::string ltest2 = "l3:hog2:go5:abcdei10ee";
    //std::string dic1= "d3:cow3:moo4:spam4:eggse"; // represents the dictionary { "cow" => "moo", "spam" => "eggs" }
    //std::string dic2="d4:spaml1:a1:bee"; // represents the dictionary { "spam" => [ "a", "b" ] }
    //std::string dic3="d9:publisher3:bob17:publisher-webpage15:www.example.com18:publisher.location4:homee"; // represents { "publisher" => "bob", "publisher-webpage" => "www.example.com", "publisher.location" => "home" }
    //std::string dic4="de"; // represents an empty dictionary {} 
	
	// String test	
	//BDecoder t1(stringtest, 0);
	//t1.decode();
	//std::cout << boost::any_cast<std::string>(t1.get()) << std::endl;
	
	// Integer test
	//BDecoder t2(numbertest,0);
	//std::cout << t2.decode() << std::endl;
	//std::cout << boost::any_cast<int>(t2.get()) << std::endl;

	//BDecoder t3(numbertest2,0);
	//std::cout << t3.decode() << std::endl;

	// List test
	//BDecoder t4(listtest,0);
	//t4.decode();
	//std::vector<boost::any> list = boost::any_cast<std::vector<boost::any>>(t4.get());
	//std::cout << list.size() << std::endl;
	//std::cout << (list[0].type() == typeid(std::string)) << std::endl;
	
	// Dictionary test
	//BDecoder t5(dic1,0);
	//std::cout << t5.decode() << std::endl;
	//std::unordered_map<std::string,boost::any> dict = boost::any_cast<std::unordered_map<std::string,boost::any>>(t5.get());
	////std::cout << dict.size() << std::endl;
	//std::unordered_map<std::string,boost::any>::const_iterator got = dict.find ("cow");
	//std::cout << boost::any_cast<std::string>(got->second) << std::endl;
	
	//BDecoder t6(dic2,0);
	//std::cout << t6.decode() << std::endl;
	//std::unordered_map<std::string,boost::any> dict = boost::any_cast<std::unordered_map<std::string,boost::any>>(t6.get());
	////std::cout << dict.size() << std::endl;
	//std::unordered_map<std::string,boost::any>::const_iterator got = dict.find ("spam");
	//std::vector<boost::any> dictlist = boost::any_cast<std::vector<boost::any>>(got->second);
	//std::cout << boost::any_cast<std::string>(dictlist[1]) << std::endl;
	
	//BDecoder t7(dic4,0);
	//std::cout << t7.decode() << std::endl;
	//std::unordered_map<std::string,boost::any> dict = boost::any_cast<std::unordered_map<std::string,boost::any>>(t7.get());
	//std::cout << dict.size() << std::endl;
	
	std::string singleFile("test.torrent");
	TorrentFileParser single(singleFile);
	//std::cout << "getPieces: " << single.info.getPieces() << std::endl;
	//std::cout << "getPieceLength: " << single.info.getPieceLength() << std::endl;
	//std::cout << "getName: " << single.info.getName() << std::endl;
	//std::cout << "getPrivate: " << single.info.getPrivate() << std::endl;
	//std::cout << "getLength: " << single.info.getLength() << std::endl;
	//std::cout << "getMD5: " << single.info.getMD5() << std::endl;
	//std::cout << "getNumberOfFiles: " << single.info.getNumberOfFiles() << std::endl;
	//std::cout << "getRawInfoDict: " << single.info.string << std::endl;
	//std::cout << "Info: getHash: " << single.info.getHash() << " of length " << single.info.getHash().length() << std::endl;
	std::string testURL("test");
	std::string infoHash = single.info.getHash();
	//Tracker trackHandler(testURL, infoHash);
	//std::cout << "URL encoded hash: " <<  trackHandler.urlEncode(single.info.getHash()) << std::endl;

	std::string multipleFile("multi.torrent");
	TorrentFileParser multi(multipleFile);
	std::cout << "getPieces: " << multi.info.getPieces() << std::endl;
	std::cout << "getPieceLength: " << multi.info.getPieceLength() << std::endl;
	std::cout << "getName: " << multi.info.getName() << std::endl;
	std::cout << "getPrivate: " << multi.info.getPrivate() << std::endl;
	std::cout << "getLength: " << multi.info.getLength() << std::endl;
	std::cout << "getMD5: " << multi.info.getMD5() << std::endl;
	std::cout << "getNumberOfFiles: " << multi.info.getNumberOfFiles() << std::endl;

	//int i=1;
	//for(boost::any file : multi.info.files) {
		//std::cout << "File " << i++ << std::endl;
		//std::unordered_map<std::string, boost::any> dict = boost::any_cast<std::unordered_map<std::string, boost::any>>(file);
		//std::cout << "length=" << InfoParser::fileLength(dict) << std::endl;
		//std::cout << "path=" << InfoParser::filePath(dict) << std::endl;
		//std::cout << "md5=" << InfoParser::fileMD5(dict) << std::endl;
	//}
	
}