//====================================== void runMCTnPTriggerEff(Char_t *fileNameOut = "MCTnPTriggerEff_HLTMu0TkMu0OSTJpsi_23May2011.root", Int_t effSample = MC, //DATA, MC, MCTRUTH Char_t *trigLabel = "HLT_Mu0_TkMu0_OST_Jpsi", //"HLT_DoubleMu0", "HLT_Mu0_TkMu0_OST_Jpsi", Char_t *fileNameIn = "/Users/hwoehri/CMS/CMSSW/hWoehri/Polarization/macros/JPsiToMuMu_Fall10-START38_V12-HLTrereco-WithAllMCEvents.root", //Char_t *fileNameIn = "/Users/hwoehri/CMS/Work/Polarization/Ilse/3April2011/JPsiToMuMu_pol_Fall10_noDimuVtxCut_1April2011.root", // Char_t *fileNameIn = "/home/hermine/CMS/CMSSW/hWoehri/Polarization/macros/JPsiToMuMu_Fall10-START38_V12-v1-Onia2MuMu-v6-WithAllMCEvents_merged.root", Char_t *oniaLabel = "J/#psi" //"J/#psi", "#psi'", "Ups(1S)", "Ups(2S)", "Ups(3S)" ){ TFile *fIn = new TFile(fileNameIn); TTree *treeData = (TTree*)fIn->Get("data"); TFile *fOut = new TFile(fileNameOut, "RECREATE"); printf("initializing tree\n"); MCTnPTriggerEff tree(treeData); printf("...done\n"); for(int iEff = 0; iEff < kNbEff; iEff++) LoadEfficiencies(iEff, effSample); printf("efficiencies loaded\n"); BookHistos(oniaLabel); tree.Loop(effSample, trigLabel); DivideHistos(); fOut->cd(); WriteHistos(); fOut->Close(); }
//====================================== void runDataTnPTriggerEff(Char_t *fileNameOut = "DataTnPTriggerEff_HLTDoubleMu0_RunA_14May2011.root", Char_t *trigLabel = "HLT_DoubleMu0", //"HLT_DoubleMu0", "HLT_Mu0_TkMu0_OST_Jpsi" ... universal name for all of its instances Int_t effSample = DATA, //DATA, MC, MCTRUTH Char_t *oniaLabel = "J/#psi" //"J/#psi", "#psi'", "Ups(1S)", "Ups(2S)", "Ups(3S)" ){ // TFile *fIn = new TFile(fileNameIn); // TTree *treeData = (TTree*)fIn->Get("data"); TChain *treeData = new TChain("data"); treeData->Add("/Users/hwoehri/CMS/Work/TriggerEfficiency/OrthogonalPDs2010/Ilse/12April2011/Jet_Nov4th_merged_OniaMuMuv7.root"); treeData->Add("/Users/hwoehri/CMS/Work/TriggerEfficiency/OrthogonalPDs2010/Ilse/12April2011/JetMET_Nov4th_merged_OniaMuMuv7.root"); treeData->Add("/Users/hwoehri/CMS/Work/TriggerEfficiency/OrthogonalPDs2010/Roberto/10May2011/TTree_MuOnia_MultiJet2010.root"); treeData->Add("/Users/hwoehri/CMS/Work/TriggerEfficiency/OrthogonalPDs2010/Roberto/10May2011/TTree_MuOnia_BTau2010.root"); TFile *fOut = new TFile(fileNameOut, "RECREATE"); printf("initializing tree\n"); DataTnPTriggerEff tree(treeData); printf("...done\n"); for(int iEff = 0; iEff < kNbEff; iEff++) LoadEfficiencies(iEff, effSample); printf("efficiencies loaded\n"); BookHistos(oniaLabel); tree.Loop(effSample, trigLabel); fOut->cd(); printf("writing out the histos\n"); WriteHistos(); fOut->Close(); }
void myana::Loop() { // In a ROOT session, you can do: if (fChain == 0) return; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; cout << "Booking pTmax histograms..." << endl; BookHistos(); // Booking pTmax histograms // Making only the desired branches visible // fChain->SetBranchStatus("*", 0); fChain->SetBranchStatus("njets", 1); fChain->SetBranchStatus("jgood", 1); fChain->SetBranchStatus("evtgood", 1); fChain->SetBranchStatus("jy", 1); fChain->SetBranchStatus("jpt", 1); fChain->SetBranchStatus("jphi", 1); fChain->SetBranchStatus("jt15", 1); fChain->SetBranchStatus("jt25", 1); fChain->SetBranchStatus("jt45", 1); fChain->SetBranchStatus("jt65", 1); fChain->SetBranchStatus("jt95", 1); fChain->SetBranchStatus("jt125", 1); //events processing for p17data for (Long64_t jentry=0; jentry<nentries;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); if (jentry > 0 && jentry%100000 == 0) cout << jentry << " events processed." << endl; Float_t JET_PT_CUT =30.0; // PT CUT 30 GEV //applying jet cuts if (evtgood && njets >=2 && (jgood[0] && jgood[1]) && (jpt[0] >= JET_PT_CUT && jpt[1] >= JET_PT_CUT)) { // pT1 > pT2 always => pT2 > 40 GeV is enough. double pTmax, absY1 = fabs(jy[0]), absY2 = fabs(jy[1]); if (jpt[0] >= jpt[1]) pTmax = jpt[0]; // pTmax is always the first jet. else pTmax = jpt[1]; // This is never encountered. if (absY1 < 0.5 && absY2 < 0.5) { // Both jets are in central region if (jt15) trigJT015y1->Fill(pTmax); if (jt25) trigJT025y1->Fill(pTmax); if (jt45) trigJT045y1->Fill(pTmax); if (jt65) trigJT065y1->Fill(pTmax); if (jt95) trigJT095y1->Fill(pTmax); if (jt125) trigJT125y1->Fill(pTmax); } else if ((absY1 > 0.5 && absY1 < 1.5) && (absY2 > 0.5 && absY2 < 1.5) && (jy[0]*jy[1] < 0)) { // Both jets are in ICR and on opposite sides if (jt15) trigJT015y2->Fill(pTmax); if (jt25) trigJT025y2->Fill(pTmax); if (jt65) trigJT065y2->Fill(pTmax); if (jt95) trigJT095y2->Fill(pTmax); if (jt125) trigJT125y2->Fill(pTmax); } else if ((absY1 > 1.5 && absY1 < 2.5) && (absY2 > 1.5 && absY2 < 2.5) && (jy[0]*jy[1] < 0)) { // Both jets are in forward region and on opposite sides if (jt15) trigJT015y3->Fill(pTmax); if (jt25) trigJT025y3->Fill(pTmax); if (jt45) trigJT045y3->Fill(pTmax); if (jt65) trigJT065y3->Fill(pTmax); if (jt95) trigJT095y3->Fill(pTmax); if (jt125) trigJT125y3->Fill(pTmax); } } } cout << "Writing all histograms..." << endl; WriteHistos(); cout << "Histograms written to file. Cleaning up now..." << endl; // Cleaning up all pointers // Cleanup(); }