本文整理汇总了C++中Events::ht方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::ht方法的具体用法?C++ Events::ht怎么用?C++ Events::ht使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::ht方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]){
/////////////////////////////////////
if (argc != 6)
{
std::cout << "Please enter something like: ./run \"filelist_WJets_PU20bx25_100_200.txt\" \"WJets_PU20bx25_100_200\" \"Results\" \"00\" \"0\" " << std::endl;
return EXIT_FAILURE;
}
//get the inputs from user
const string InRootList = argv[1];
const string subSampleKey = argv[2];
const string Outdir = argv[3];
const string inputnumber = argv[4];
const string verbosity = argv[5];
//////////////////////////////////////
int verbose = atoi(verbosity.c_str());
//some varaibles
char filenames[500];
vector<string> filesVec;
ifstream fin(InRootList.c_str());
TChain *sample_AUX = new TChain("TreeMaker2/PreSelection");
char tempname[200];
vector<TH1D > vec;
map<int, string> eventType;
map<string , vector<TH1D> > cut_histvec_map;
map<string, map<string , vector<TH1D> > > map_map;
map<string, histClass> histobjmap;
histClass histObj;
//build a vector of histograms
TH1D weight_hist = TH1D("weight", "Weight Distribution", 5,0,5);
vec.push_back(weight_hist);
TH1D RA2HT_hist = TH1D("HT","HT Distribution",50,0,5000);
RA2HT_hist.Sumw2();
vec.push_back(RA2HT_hist);
TH1D RA2MHT_hist = TH1D("MHT","MHT Distribution",100,0,5000);
RA2MHT_hist.Sumw2();
vec.push_back(RA2MHT_hist);
TH1D RA2NJet_hist = TH1D("NJet","Number of Jets Distribution",20,0,20);
RA2NJet_hist.Sumw2();
vec.push_back(RA2NJet_hist);
TH1D RA2NBtag_hist = TH1D("NBtag","Number of Btag Distribution",20,0,20);
RA2NBtag_hist.Sumw2();
vec.push_back(RA2NBtag_hist);
int Nhists=((int)(vec.size())-1);//-1 is because weight shouldn't be counted.
///read the file names from the .txt files and load them to a vector.
while(fin.getline(filenames, 500) ){filesVec.push_back(filenames);}
cout<< "\nProcessing " << subSampleKey << " ... " << endl;
for(unsigned int in=0; in<filesVec.size(); in++){ sample_AUX->Add(filesVec.at(in).c_str()); }
// --- Analyse the events --------------------------------------------
// Interface to the event content
Events * evt = new Events(sample_AUX, subSampleKey,verbose);
// Get a pointer to the Selection class
Selection2 * sel = new Selection2();
// For each selection, cut, make a vector containing the same histograms as those in vec
for(int i=0; i<(int) sel->cutName().size();i++){
cut_histvec_map[sel->cutName()[i]]=vec;
}
// Define different event categories
eventType[0]="allEvents";
//initialize a map between string and maps. copy the map of histvecs into each
for(int i=0; i< eventType.size();i++){
map_map[eventType[i]]=cut_histvec_map;
}
//initialize histobjmap
for(map<string , vector<TH1D> >::iterator it=cut_histvec_map.begin(); it!=cut_histvec_map.end();it++){
histobjmap[it->first]=histObj;
}
TH1D* TauIDhist = new TH1D("yield_tauId","Yield after tau Id",200,0.,200.);
TH1D* TauIDhist_trk = new TH1D("yield_tauId_trk","Yield after trk veto and tau Id",200,0.,200.);
map <int,string> idMap;
int IdNum_=0;
for(int iPile=0;iPile<4;iPile++){
for(int iIso=0;iIso<4;iIso++){
for(int iMu=0;iMu<3;iMu++){
for(int iElec=0;iElec<4;iElec++){
IdNum_++;
ostringstream binS_;
binS_ << (1+iPile)+10*(1+iIso)+100*(1+iMu)+1000*(1+iElec);
idMap[IdNum_]=binS_.str();
TauIDhist->GetXaxis()->SetBinLabel(IdNum_,binS_.str().c_str());
TauIDhist_trk->GetXaxis()->SetBinLabel(IdNum_,binS_.str().c_str());
}
}
}
}
//.........这里部分代码省略.........
示例2: main
int main(int argc, char *argv[]){
/////////////////////////////////////
if (argc != 6)
{
std::cout << "Please enter something like: ./run \"filelist_WJets_PU20bx25_100_200.txt\" \"WJets_PU20bx25_100_200\" \"Results\" \"00\" \"0\" " << std::endl;
return EXIT_FAILURE;
}
//get the inputs from user
const string InRootList = argv[1];
const string subSampleKey = argv[2];
const string Outdir = argv[3];
const string inputnumber = argv[4];
const string verbosity = argv[5];
//////////////////////////////////////
int verbose = atoi(verbosity.c_str());
//some varaibles
char filenames[500];
vector<string> filesVec;
ifstream fin(InRootList.c_str());
TChain *sample_AUX = new TChain("TreeMaker2/PreSelection");
char tempname[200];
char histname[200];
const double deltaRMax = 0.1;
const double deltaPtMax = 0.2;
map<string,int> binMap = utils2::BinMap_NoB();
int totNbins=binMap.size();
map<string,int> binMap_mht_nj = utils2::BinMap_mht_nj();
int totNbins_mht_nj=binMap_mht_nj.size();
TH1* hAccAll = new TH1D("hAccAll","Acceptance -- All",totNbins_mht_nj,1,totNbins_mht_nj+1);
TH1* hIsoRecoAll = new TH1D("hIsoRecoAll","Efficiency -- All",totNbins,1,totNbins+1);
TH1* hAccPass = new TH1D("hAccPass","Acceptance -- Pass",totNbins_mht_nj,1,totNbins_mht_nj+1);
TH1* hIsoRecoPass = new TH1D("hIsoRecoPass","Efficiency -- Pass",totNbins,1,totNbins+1);
hAccAll->Sumw2();
hIsoRecoAll->Sumw2();
hAccPass->Sumw2();
hIsoRecoPass->Sumw2();
int TauResponse_nBins=4;
vector<TH1*> vec_resp;
TFile * resp_file = new TFile("TauHad/HadTau_TauResponseTemplates_TTbar_Elog195WithDirectionalTemplates.root","R");
for(int i=0; i<TauResponse_nBins; i++){
sprintf(histname,"hTauResp_%d",i);
vec_resp.push_back( (TH1D*) resp_file->Get( histname )->Clone() );
}
///read the file names from the .txt files and load them to a vector.
while(fin.getline(filenames, 500) ){filesVec.push_back(filenames);}
cout<< "\nProcessing " << subSampleKey << " ... " << endl;
for(unsigned int in=0; in<filesVec.size(); in++){ sample_AUX->Add(filesVec.at(in).c_str()); }
// --- Analyse the events --------------------------------------------
Selection * sel = new Selection();
Utils * utils = new Utils();
// Interface to the event content
Events * evt = new Events(sample_AUX, subSampleKey,verbose);
// Loop over the events (tree entries)
int eventN=0;
while( evt->loadNext() ){
// if(eventN>10000)break;
eventN++;
// Through out an event that contains HTjets with bad id
if(evt->JetId()==0)continue;
//printf("\[email protected]@@@@@@@@@@@@@@@@@@@@@@@@@ \n event: %d \n Njet: %d HT: %g MHT: %g dphi1: %g dphi2: %g dphi3: %g \n ",eventN-1,evt->nJets(),evt->ht(),evt->mht(),evt->deltaPhi1(),evt->deltaPhi2(),evt->deltaPhi3()); //Ahmad3
// Apply the NJets baseline-cut
if( !sel->Njet_4(evt->nJets()) ) continue;
// Apply the HT and MHT baseline-cuts
if( !sel->ht_500(evt->ht()) ) continue;
if( !sel->mht_200(evt->mht()) ) continue;
// Apply the delta-phi cuts
// if( !sel->dphi(evt->nJets(),evt->minDeltaPhiN()) ) continue;
if( !sel->dphi(evt->nJets(),evt->deltaPhi1(),evt->deltaPhi2(),evt->deltaPhi3(),evt->deltaPhi4()) ) continue;
if(verbose!=0)printf("\n############ \n event: %d \n ",eventN-1);
double genMuPt=0.;
double genMuEta=-99.;
double genMuPhi=-99.;
int firstMuId=0;
vector<TVector3> genMuonVec;
TVector3 temp3vec;
genMuonVec.clear();
bool isMuon = false;
for(int i=0; i< evt->GenMuPtVec_().size(); i++){
if(evt->GenMuFromTauVec_()[i]==0){
genMuPt = evt->GenMuPtVec_().at(i);
genMuEta = evt->GenMuEtaVec_().at(i);
genMuPhi = evt->GenMuPhiVec_().at(i);
isMuon=true;
temp3vec.SetPtEtaPhi(genMuPt,genMuEta,genMuPhi);
genMuonVec.push_back(temp3vec);
}
//.........这里部分代码省略.........