Exemplo n.º 1
0
void skim_2j_gammalep_3lep(string inpath = "/nfs-6/userdata/mt2/V00-00-03", string outpath = "/nfs-6/userdata/mt2/V00-00-03_skim_nj2_ht450_mt2gt50", string tag = "ttall_msdecays") {
  
  //--------------------------------------------------
  // cut for output files
  //--------------------------------------------------

  // NOTE: string below doesn't work correctly, implicitly requires all events to have 2 leptons
  //  const char* sel = "((njets >= 2 || njets_up >= 2 || njets_dn >= 2) || (evt_type == 2 && nlep > 0 && abs(lep_pdgId[0]) == 13) || (nlep > 2 && lep_pt[0] > 25 && lep_pt[1] > 20)) ";
  
  const char* sel = "((njets >= 2 || njets_up >= 2 || njets_dn >= 2) || (evt_type == 2 && nlep > 0) || (nlep > 2)) ";

  cout << "Skimming with selection : "<<sel<<endl;

  //--------------------------------------------------
  // input and output file
  //--------------------------------------------------
  
  const char* infilename = Form("%s/%s*.root",inpath.c_str(),tag.c_str());
  const char* outfilename = Form("%s/%s.root",outpath.c_str(),tag.c_str());
  
  //--------------------------------------------------
  // cout stuff
  //--------------------------------------------------
  
  cout << "Reading in : " << infilename << endl;
  cout << "Writing to : " << outfilename << endl;
  cout << "Selection : " << sel << endl;
  
  //--------------------------------------------------
  // read input file, write to output files
  //--------------------------------------------------
  
  //long long max_tree_size = 5000000000LL; // 5GB
  long long max_tree_size = 2500000000LL; // 2.5GB
  TTree::SetMaxTreeSize(max_tree_size);
  
  TChain *chain = new TChain("t");
  chain->Add(infilename);

  unsigned int input_entries = chain->GetEntries();
  cout << "Input tree has entries: " << input_entries << endl;
  
  //-------------------
  // skim
  //-------------------
  
  TFile *outfile = TFile::Open(outfilename, "RECREATE");
  assert( outfile != 0 );
  TTree* outtree = chain->CopyTree( sel );
  unsigned int output_entries = outtree->GetEntries();
  cout << "Output tree has entries: " << output_entries << endl
       << "Reduction factor of: " << double(input_entries)/double(output_entries) << endl;
  outtree->Write();
  outfile->Close();

}
Exemplo n.º 2
0
void skim_RS(const char* indir, const char* outdir, const char* sample){

    // long long max_tree_size = 5000000000LL;
    // TTree::SetMaxTreeSize(max_tree_size);
    
    TChain *c = new TChain("mt2");
    c->Add(Form("%s/%s*.root",indir,sample));
    
    TFile fout(Form("%s/%s.root",outdir,sample), "RECREATE");
    TTree *t = c->CopyTree("(ht > 250. && met_pt>30 && ((nJet30 >= 2 && mt2 > 100.) || (nJet30>=1 && nJet30<=2 && met_pt>250))) || (zll_ht > 200. && nJet30 >= 2 && zll_mt2 > 100. && zll_met_pt > 30.)");

    t->Write();
    fout.Close();

}
Exemplo n.º 3
0
void skimMET2016DataSet()
{
  TChain* chain = new TChain("cutFlowAnalyzer_Data/Events");
  // B-v2 missing
  // H missing
  // F missing

  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0002/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0003/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0004/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0005/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016B-23Sep2016-v3-20170213/170213_161511/0006/out_ana*.root");
  
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016C-23Sep2016-v1-20170213/170213_161533/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016C-23Sep2016-v1-20170213/170213_161533/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016C-23Sep2016-v1-20170213/170213_161533/0002/out_ana*.root");

  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016D-23Sep2016-v1-20170213/170213_161605/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016D-23Sep2016-v1-20170213/170213_161605/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016D-23Sep2016-v1-20170213/170213_161605/0002/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016D-23Sep2016-v1-20170213/170213_161605/0003/out_ana*.root");

  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016E-23Sep2016-v1-20170213/170213_161626/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016E-23Sep2016-v1-20170213/170213_161626/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016E-23Sep2016-v1-20170213/170213_161626/0002/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016E-23Sep2016-v1-20170213/170213_161626/0003/out_ana*.root");
    
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016F-23Sep2016-v1-20170213/170213_161647/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016F-23Sep2016-v1-20170213/170213_161647/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016F-23Sep2016-v1-20170213/170213_161647/0002/out_ana*.root");

  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0000/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0001/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0002/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0003/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0004/out_ana*.root");
  chain->Add("/fdata/hepx/store/user/dildick/MET/crab_MET-Run2016G-23Sep2016-v1-20170213/170213_161713/0005/out_ana*.root");

  TFile* newFile = TFile::Open("out_ana_selected_170213_161713.root","RECREATE"); 
  TTree* newChain = chain->CopyTree("nRecoMu>=3");
  newChain->AutoSave();
  newFile->Close();
}
Exemplo n.º 4
0
// main
int main(int argc, char *argv[]){
  
  TString fileNameTree = argv[1];
  TString minMass = argv[2];
  TString maxMass = argv[3];

  Int_t maxEntries = atoi(argv[4]);


  //std::cout << "maxEntries = " << maxEntries << std::endl;

  TChain *chain = new TChain("T");
  chain->Add(fileNameTree);
  chain->GetEntry(0); 
  
  int nentries = int(chain->GetEntries());
  cout << "+++++ No. of entries in the input tree: " << nentries << endl;

  // string for the cut on the selected invariant mass windowm    
  TString mass_cut=minMass+"*"+minMass+"<2*(event.mu1.fP4.fCoordinates.fT*event.mu2.fP4.fCoordinates.fT-event.mu1.fP4.fCoordinates.fX*event.mu2.fP4.fCoordinates.fX-event.mu1.fP4.fCoordinates.fY*event.mu2.fP4.fCoordinates.fY-event.mu1.fP4.fCoordinates.fZ*event.mu2.fP4.fCoordinates.fZ) && 2*(event.mu1.fP4.fCoordinates.fT*event.mu2.fP4.fCoordinates.fT-event.mu1.fP4.fCoordinates.fX*event.mu2.fP4.fCoordinates.fX-event.mu1.fP4.fCoordinates.fY*event.mu2.fP4.fCoordinates.fY-event.mu1.fP4.fCoordinates.fZ*event.mu2.fP4.fCoordinates.fZ)<"+maxMass+"*"+maxMass;
  //std::cout<<"String for cut: "+mass_cut<<std::endl;
  
  TString outFileName =  ((TObjString*)((((TObjString*)(fileNameTree.Tokenize("/"))->Last())->String().Tokenize("."))->At(0)))->String();


  TFile* fileTreeOut = TFile::Open(outFileName+"_Mass_"+minMass+"_"+maxMass+".root","RECREATE");
  fileTreeOut->cd();
  
  TTree *newtree = chain->CopyTree(mass_cut,"",maxEntries); // use a sub-sample this when debugging
  //TTree *newtree = chain->CopyTree(mass_cut);
  newtree->AutoSave();

  nentries = int(newtree->GetEntries());
  cout << "+++++ No. of entries in the output tree: " << nentries << endl;

  fileTreeOut->Write();
  fileTreeOut->Close();

  delete chain;

  
  return 0;
}
Exemplo n.º 5
0
std::vector<Event> readEvents(const config::RunConfig& runConf) {
  Float_t hsxfp, hsyfp, hsxpfp, hsypfp, frx_cm, fry_cm;

  TChain* chain = new TChain("h9010");
  for (const auto& fileName : runConf.fileList) {
    chain->Add(fileName.c_str());
  }

  TTree* tree = chain->CopyTree(runConf.cuts.c_str());

  tree->SetBranchAddress("hsxfp", &hsxfp);
  tree->SetBranchAddress("hsyfp", &hsyfp);
  tree->SetBranchAddress("hsxpfp", &hsxpfp);
  tree->SetBranchAddress("hsypfp", &hsypfp);
  tree->SetBranchAddress("frx_cm", &frx_cm);
  tree->SetBranchAddress("fry_cm", &fry_cm);

  Long64_t nEntries = tree->GetEntries();
  //nEntries = 10000;  // TMP
  std::vector<Event> events(static_cast<std::size_t>(nEntries));
  std::vector<Event>::iterator it = events.begin();

  for (Long64_t iEntry=0; iEntry<nEntries; ++iEntry) {
    tree->GetEntry(iEntry);

    it->xFp = hsxfp;
    it->yFp = hsyfp;
    it->xpFp = hsxpfp;
    it->ypFp = hsypfp;

    it->xVer = -(runConf.beam.x0 - frx_cm);
    it->yVer = runConf.beam.y0 - fry_cm;

    ++it;
  }

  delete tree;
  delete chain;

  return events;
}
void Main(TString sFile, TString sFolder, TString sTree) {
TString sOutput = "D2hMuMu11_MagD_2PiMuMuSS_NTuple_Reduced.root";
 
  // Get the data files
  TChain* Data = new TChain(sFolder+"/"+sTree);
  
  Data->Add(sFile);
     
	 Data->SetBranchStatus("D_ENDVERTEX_X", 0);
   Data->SetBranchStatus("D_ENDVERTEX_Y", 0);
   Data->SetBranchStatus("D_ENDVERTEX_Z", 0);
   Data->SetBranchStatus("D_ENDVERTEX_XERR", 0);
   Data->SetBranchStatus("D_ENDVERTEX_YERR", 0);
   Data->SetBranchStatus("D_ENDVERTEX_ZERR", 0);
   //Data->SetBranchStatus("D_ENDVERTEX_CHI2", 0);
   Data->SetBranchStatus("D_ENDVERTEX_NDOF", 0);
   Data->SetBranchStatus("D_ENDVERTEX_COV_", 0);
   Data->SetBranchStatus("D_OWNPV_X", 0);
   Data->SetBranchStatus("D_OWNPV_Y", 0);
   Data->SetBranchStatus("D_OWNPV_Z", 0);
   Data->SetBranchStatus("D_OWNPV_XERR", 0);
   Data->SetBranchStatus("D_OWNPV_YERR", 0);
   Data->SetBranchStatus("D_OWNPV_ZERR", 0);
   Data->SetBranchStatus("D_OWNPV_CHI2", 0);
   Data->SetBranchStatus("D_OWNPV_NDOF", 0);
   Data->SetBranchStatus("D_OWNPV_COV_", 0);
   /*Data->SetBranchStatus("D_IP_OWNPV", 0);
   Data->SetBranchStatus("D_IPCHI2_OWNPV", 0);
   Data->SetBranchStatus("D_FD_OWNPV", 0);
   Data->SetBranchStatus("D_FDCHI2_OWNPV", 0);
   Data->SetBranchStatus("D_DIRA_OWNPV", 0);
   Data->SetBranchStatus("D_P", 0);
   Data->SetBranchStatus("D_PT", 0);*/
   Data->SetBranchStatus("D_PE", 0);
   Data->SetBranchStatus("D_PX", 0);
   Data->SetBranchStatus("D_PY", 0);
   Data->SetBranchStatus("D_PZ", 0);
   /*Data->SetBranchStatus("D_MM", 0);
   Data->SetBranchStatus("D_MMERR", 0);
   Data->SetBranchStatus("D_M", 0);
   Data->SetBranchStatus("D_ID", 0);
   Data->SetBranchStatus("D_TAU", 0);
   Data->SetBranchStatus("D_TAUERR", 0);
   Data->SetBranchStatus("D_TAUCHI2", 0);*/
   /* Data->SetBranchStatus("D_L0Global_Dec", 0); */
   /* Data->SetBranchStatus("D_L0Global_TIS", 0); */
   /* Data->SetBranchStatus("D_L0Global_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1Global_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1Global_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1Global_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1Phys_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1Phys_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1Phys_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2Global_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2Global_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2Global_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2Phys_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2Phys_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2Phys_TOS", 0); */
   /* Data->SetBranchStatus("D_L0DiMuonDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_L0DiMuonDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_L0DiMuonDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_L0MuonDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_L0MuonDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_L0MuonDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_L0MuonHighDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_L0MuonHighDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_L0MuonHighDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonHighMassDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonHighMassDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonHighMassDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonLowMassDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonLowMassDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1DiMuonLowMassDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1SingleMuonHighPTDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1SingleMuonHighPTDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1SingleMuonHighPTDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackMuonDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackMuonDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackMuonDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackAllL0Decision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackAllL0Decision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt1TrackAllL0Decision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY1Decision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY1Decision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY1Decision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY2Decision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY2Decision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY2Decision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY3Decision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY3Decision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY3Decision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY4Decision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY4Decision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDY4Decision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedHeavyDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedHeavyDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDetachedHeavyDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonBDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonBDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonBDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonLowMassDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonLowMassDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonLowMassDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2DiMuonDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuDecision_TOS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuWideMassDecision_Dec", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuWideMassDecision_TIS", 0); */
   /* Data->SetBranchStatus("D_Hlt2CharmSemilepD2HMuMuWideMassDecision_TOS", 0); */
   Data->SetBranchStatus("D_cpx_0.50", 0);
   Data->SetBranchStatus("D_cpy_0.50", 0);
   Data->SetBranchStatus("D_cpz_0.50", 0);
   Data->SetBranchStatus("D_cpt_0.50", 0);
   Data->SetBranchStatus("D_cp_0.50", 0);
   Data->SetBranchStatus("D_cmult_0.50", 0);
   Data->SetBranchStatus("D_cpx_0.60", 0);
   Data->SetBranchStatus("D_cpy_0.60", 0);
   Data->SetBranchStatus("D_cpz_0.60", 0);
   Data->SetBranchStatus("D_cpt_0.60", 0);
   Data->SetBranchStatus("D_cp_0.60", 0);
   Data->SetBranchStatus("D_cmult_0.60", 0);
   Data->SetBranchStatus("D_cpx_0.70", 0);
   Data->SetBranchStatus("D_cpy_0.70", 0);
   Data->SetBranchStatus("D_cpz_0.70", 0);
   Data->SetBranchStatus("D_cpt_0.70", 0);
   Data->SetBranchStatus("D_cp_0.70", 0);
   Data->SetBranchStatus("D_cmult_0.70", 0);
   Data->SetBranchStatus("D_cpx_0.80", 0);
   Data->SetBranchStatus("D_cpy_0.80", 0);
   Data->SetBranchStatus("D_cpz_0.80", 0);
   Data->SetBranchStatus("D_cpt_0.80", 0);
   Data->SetBranchStatus("D_cp_0.80", 0);
   Data->SetBranchStatus("D_cmult_0.80", 0);
   Data->SetBranchStatus("D_cpx_0.90", 0);
   Data->SetBranchStatus("D_cpy_0.90", 0);
   Data->SetBranchStatus("D_cpz_0.90", 0);
   Data->SetBranchStatus("D_cpt_0.90", 0);
   Data->SetBranchStatus("D_cp_0.90", 0);
   Data->SetBranchStatus("D_cmult_0.90", 0);
   Data->SetBranchStatus("D_cpx_1.00", 0);
   Data->SetBranchStatus("D_cpy_1.00", 0);
   Data->SetBranchStatus("D_cpz_1.00", 0);
   Data->SetBranchStatus("D_cpt_1.00", 0);
   Data->SetBranchStatus("D_cp_1.00", 0);
   Data->SetBranchStatus("D_cmult_1.00", 0);
   Data->SetBranchStatus("D_NumVtxWithinChi2WindowOneTrack", 0);
   Data->SetBranchStatus("D_SmallestDeltaChi2OneTrack", 0);
   Data->SetBranchStatus("D_SmallestDeltaChi2MassOneTrack", 0);
   Data->SetBranchStatus("D_SmallestDeltaChi2TwoTracks", 0);
   Data->SetBranchStatus("D_SmallestDeltaChi2MassTwoTracks", 0);
 /*  Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNe", 0);
   Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNmu", 0);
   Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNpi", 0);
   Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNk", 0);
   Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNp", 0);
   Data->SetBranchStatus("piminus_MC12TuneV2_ProbNNghost", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNe", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNmu", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNpi", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNk", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNp", 0);
   Data->SetBranchStatus("piminus_MC12TuneV3_ProbNNghost", 0);
   Data->SetBranchStatus("piminus_CosTheta", 0);*/
   Data->SetBranchStatus("piminus_OWNPV_X", 0);
   Data->SetBranchStatus("piminus_OWNPV_Y", 0);
   Data->SetBranchStatus("piminus_OWNPV_Z", 0);
   Data->SetBranchStatus("piminus_OWNPV_XERR", 0);
   Data->SetBranchStatus("piminus_OWNPV_YERR", 0);
   Data->SetBranchStatus("piminus_OWNPV_ZERR", 0);
   Data->SetBranchStatus("piminus_OWNPV_CHI2", 0);
   Data->SetBranchStatus("piminus_OWNPV_NDOF", 0);
   Data->SetBranchStatus("piminus_OWNPV_COV_", 0);
   /*Data->SetBranchStatus("piminus_IP_OWNPV", 0);
   Data->SetBranchStatus("piminus_IPCHI2_OWNPV", 0);*/
   Data->SetBranchStatus("piminus_ORIVX_X", 0);
   Data->SetBranchStatus("piminus_ORIVX_Y", 0);
   Data->SetBranchStatus("piminus_ORIVX_Z", 0);
   Data->SetBranchStatus("piminus_ORIVX_XERR", 0);
   Data->SetBranchStatus("piminus_ORIVX_YERR", 0);
   Data->SetBranchStatus("piminus_ORIVX_ZERR", 0);
   Data->SetBranchStatus("piminus_ORIVX_CHI2", 0);
   Data->SetBranchStatus("piminus_ORIVX_NDOF", 0);
   Data->SetBranchStatus("piminus_ORIVX_COV_", 0);
   //Data->SetBranchStatus("piminus_P", 0);
   //Data->SetBranchStatus("piminus_PT", 0);
   Data->SetBranchStatus("piminus_PE", 0);
   Data->SetBranchStatus("piminus_PX", 0);
   Data->SetBranchStatus("piminus_PY", 0);
   Data->SetBranchStatus("piminus_PZ", 0);
   Data->SetBranchStatus("piminus_M", 0);
   Data->SetBranchStatus("piminus_ID", 0);
   /*Data->SetBranchStatus("piminus_PIDe", 0);
   Data->SetBranchStatus("piminus_PIDmu", 0);
   Data->SetBranchStatus("piminus_PIDK", 0);
   Data->SetBranchStatus("piminus_PIDp", 0);
   Data->SetBranchStatus("piminus_ProbNNe", 0);
   Data->SetBranchStatus("piminus_ProbNNk", 0);
   Data->SetBranchStatus("piminus_ProbNNp", 0);
   Data->SetBranchStatus("piminus_ProbNNpi", 0);
   Data->SetBranchStatus("piminus_ProbNNmu", 0);
   Data->SetBranchStatus("piminus_ProbNNghost", 0);*/
   Data->SetBranchStatus("piminus_hasMuon", 0);
   //Data->SetBranchStatus("piminus_isMuon", 0);
   Data->SetBranchStatus("piminus_hasRich", 0);
   Data->SetBranchStatus("piminus_hasCalo", 0);
   Data->SetBranchStatus("piminus_L0Global_Dec", 0);
   Data->SetBranchStatus("piminus_L0Global_TIS", 0);
   Data->SetBranchStatus("piminus_L0Global_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1Global_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1Global_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1Global_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1Phys_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1Phys_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1Phys_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2Global_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2Global_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2Global_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2Phys_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2Phys_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2Phys_TOS", 0);
   Data->SetBranchStatus("piminus_L0DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("piminus_L0DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("piminus_L0DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("piminus_L0MuonDecision_Dec", 0);
   Data->SetBranchStatus("piminus_L0MuonDecision_TIS", 0);
   Data->SetBranchStatus("piminus_L0MuonDecision_TOS", 0);
   Data->SetBranchStatus("piminus_L0MuonHighDecision_Dec", 0);
   Data->SetBranchStatus("piminus_L0MuonHighDecision_TIS", 0);
   Data->SetBranchStatus("piminus_L0MuonHighDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonHighMassDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonHighMassDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonHighMassDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1SingleMuonHighPTDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1SingleMuonHighPTDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1SingleMuonHighPTDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackMuonDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackMuonDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackMuonDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackAllL0Decision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackAllL0Decision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt1TrackAllL0Decision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY1Decision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY1Decision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY1Decision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY2Decision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY2Decision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY2Decision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY3Decision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY3Decision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY3Decision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY4Decision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY4Decision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDY4Decision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedHeavyDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedHeavyDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDetachedHeavyDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonBDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonBDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonBDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuDecision_TOS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuWideMassDecision_Dec", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuWideMassDecision_TIS", 0);
   Data->SetBranchStatus("piminus_Hlt2CharmSemilepD2HMuMuWideMassDecision_TOS", 0);
   Data->SetBranchStatus("piminus_TRACK_Type", 0);
   Data->SetBranchStatus("piminus_TRACK_Key", 0);
   //Data->SetBranchStatus("piminus_TRACK_CHI2NDOF", 0);
   Data->SetBranchStatus("piminus_TRACK_PCHI2", 0);
   Data->SetBranchStatus("piminus_TRACK_MatchCHI2", 0);
   //Data->SetBranchStatus("piminus_TRACK_GhostProb", 0);
   Data->SetBranchStatus("piminus_TRACK_CloneDist", 0);
   Data->SetBranchStatus("piminus_TRACK_Likelihood", 0);
   Data->SetBranchStatus("piminus_cpx_0.50", 0);
   Data->SetBranchStatus("piminus_cpy_0.50", 0);
   Data->SetBranchStatus("piminus_cpz_0.50", 0);
   Data->SetBranchStatus("piminus_cpt_0.50", 0);
   Data->SetBranchStatus("piminus_cp_0.50", 0);
   Data->SetBranchStatus("piminus_cmult_0.50", 0);
   Data->SetBranchStatus("piminus_cpx_0.60", 0);
   Data->SetBranchStatus("piminus_cpy_0.60", 0);
   Data->SetBranchStatus("piminus_cpz_0.60", 0);
   Data->SetBranchStatus("piminus_cpt_0.60", 0);
   Data->SetBranchStatus("piminus_cp_0.60", 0);
   Data->SetBranchStatus("piminus_cmult_0.60", 0);
   Data->SetBranchStatus("piminus_cpx_0.70", 0);
   Data->SetBranchStatus("piminus_cpy_0.70", 0);
   Data->SetBranchStatus("piminus_cpz_0.70", 0);
   Data->SetBranchStatus("piminus_cpt_0.70", 0);
   Data->SetBranchStatus("piminus_cp_0.70", 0);
   Data->SetBranchStatus("piminus_cmult_0.70", 0);
   Data->SetBranchStatus("piminus_cpx_0.80", 0);
   Data->SetBranchStatus("piminus_cpy_0.80", 0);
   Data->SetBranchStatus("piminus_cpz_0.80", 0);
   Data->SetBranchStatus("piminus_cpt_0.80", 0);
   Data->SetBranchStatus("piminus_cp_0.80", 0);
   Data->SetBranchStatus("piminus_cmult_0.80", 0);
   Data->SetBranchStatus("piminus_cpx_0.90", 0);
   Data->SetBranchStatus("piminus_cpy_0.90", 0);
   Data->SetBranchStatus("piminus_cpz_0.90", 0);
   Data->SetBranchStatus("piminus_cpt_0.90", 0);
   Data->SetBranchStatus("piminus_cp_0.90", 0);
   Data->SetBranchStatus("piminus_cmult_0.90", 0);
   Data->SetBranchStatus("piminus_cpx_1.00", 0);
   Data->SetBranchStatus("piminus_cpy_1.00", 0);
   Data->SetBranchStatus("piminus_cpz_1.00", 0);
   Data->SetBranchStatus("piminus_cpt_1.00", 0);
   Data->SetBranchStatus("piminus_cp_1.00", 0);
   Data->SetBranchStatus("piminus_cmult_1.00", 0);
   /*Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNe", 0);
   Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNmu", 0);
   Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNpi", 0);
   Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNk", 0);
   Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNp", 0);
   Data->SetBranchStatus("muplus_MC12TuneV2_ProbNNghost", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNe", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNmu", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNpi", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNk", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNp", 0);
   Data->SetBranchStatus("muplus_MC12TuneV3_ProbNNghost", 0);
   Data->SetBranchStatus("muplus_CosTheta", 0);*/
   Data->SetBranchStatus("muplus_OWNPV_X", 0);
   Data->SetBranchStatus("muplus_OWNPV_Y", 0);
   Data->SetBranchStatus("muplus_OWNPV_Z", 0);
   Data->SetBranchStatus("muplus_OWNPV_XERR", 0);
   Data->SetBranchStatus("muplus_OWNPV_YERR", 0);
   Data->SetBranchStatus("muplus_OWNPV_ZERR", 0);
   Data->SetBranchStatus("muplus_OWNPV_CHI2", 0);
   Data->SetBranchStatus("muplus_OWNPV_NDOF", 0);
   Data->SetBranchStatus("muplus_OWNPV_COV_", 0);
   //Data->SetBranchStatus("muplus_IP_OWNPV", 0);
   //Data->SetBranchStatus("muplus_IPCHI2_OWNPV", 0);
   Data->SetBranchStatus("muplus_ORIVX_X", 0);
   Data->SetBranchStatus("muplus_ORIVX_Y", 0);
   Data->SetBranchStatus("muplus_ORIVX_Z", 0);
   Data->SetBranchStatus("muplus_ORIVX_XERR", 0);
   Data->SetBranchStatus("muplus_ORIVX_YERR", 0);
   Data->SetBranchStatus("muplus_ORIVX_ZERR", 0);
   Data->SetBranchStatus("muplus_ORIVX_CHI2", 0);
   Data->SetBranchStatus("muplus_ORIVX_NDOF", 0);
   Data->SetBranchStatus("muplus_ORIVX_COV_", 0);
   //Data->SetBranchStatus("muplus_P", 0);
   //Data->SetBranchStatus("muplus_PT", 0);
   Data->SetBranchStatus("muplus_PE", 0);
   //Data->SetBranchStatus("muplus_PX", 0);
   //Data->SetBranchStatus("muplus_PY", 0);
   //Data->SetBranchStatus("muplus_PZ", 0);
   Data->SetBranchStatus("muplus_M", 0);
   Data->SetBranchStatus("muplus_ID", 0);
   /*Data->SetBranchStatus("muplus_PIDe", 0);
   Data->SetBranchStatus("muplus_PIDmu", 0);
   Data->SetBranchStatus("muplus_PIDK", 0);
   Data->SetBranchStatus("muplus_PIDp", 0);
   Data->SetBranchStatus("muplus_ProbNNe", 0);
   Data->SetBranchStatus("muplus_ProbNNk", 0);
   Data->SetBranchStatus("muplus_ProbNNp", 0);
   Data->SetBranchStatus("muplus_ProbNNpi", 0);
   Data->SetBranchStatus("muplus_ProbNNmu", 0);
   Data->SetBranchStatus("muplus_ProbNNghost", 0);*/
   Data->SetBranchStatus("muplus_hasMuon", 0);
   //Data->SetBranchStatus("muplus_isMuon", 0);
   Data->SetBranchStatus("muplus_hasRich", 0);
   Data->SetBranchStatus("muplus_hasCalo", 0);
   Data->SetBranchStatus("muplus_L0Global_Dec", 0);
   Data->SetBranchStatus("muplus_L0Global_TIS", 0);
   Data->SetBranchStatus("muplus_L0Global_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1Global_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1Global_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1Global_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1Phys_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1Phys_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1Phys_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2Global_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2Global_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2Global_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2Phys_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2Phys_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2Phys_TOS", 0);
   Data->SetBranchStatus("muplus_L0DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus_L0DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus_L0DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus_L0MuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus_L0MuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus_L0MuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus_L0MuonHighDecision_Dec", 0);
   Data->SetBranchStatus("muplus_L0MuonHighDecision_TIS", 0);
   Data->SetBranchStatus("muplus_L0MuonHighDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonHighMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonHighMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonHighMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1SingleMuonHighPTDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1SingleMuonHighPTDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1SingleMuonHighPTDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackAllL0Decision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackAllL0Decision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt1TrackAllL0Decision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY1Decision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY1Decision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY1Decision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY2Decision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY2Decision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY2Decision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY3Decision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY3Decision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY3Decision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY4Decision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY4Decision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDY4Decision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedHeavyDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedHeavyDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDetachedHeavyDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonBDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonBDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonBDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuWideMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuWideMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus_Hlt2CharmSemilepD2HMuMuWideMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus_TRACK_Type", 0);
   Data->SetBranchStatus("muplus_TRACK_Key", 0);
   //Data->SetBranchStatus("muplus_TRACK_CHI2NDOF", 0);
   Data->SetBranchStatus("muplus_TRACK_PCHI2", 0);
   Data->SetBranchStatus("muplus_TRACK_MatchCHI2", 0);
   //Data->SetBranchStatus("muplus_TRACK_GhostProb", 0);
   Data->SetBranchStatus("muplus_TRACK_CloneDist", 0);
   Data->SetBranchStatus("muplus_TRACK_Likelihood", 0);
   Data->SetBranchStatus("muplus_cpx_0.50", 0);
   Data->SetBranchStatus("muplus_cpy_0.50", 0);
   Data->SetBranchStatus("muplus_cpz_0.50", 0);
   Data->SetBranchStatus("muplus_cpt_0.50", 0);
   Data->SetBranchStatus("muplus_cp_0.50", 0);
   Data->SetBranchStatus("muplus_cmult_0.50", 0);
   Data->SetBranchStatus("muplus_cpx_0.60", 0);
   Data->SetBranchStatus("muplus_cpy_0.60", 0);
   Data->SetBranchStatus("muplus_cpz_0.60", 0);
   Data->SetBranchStatus("muplus_cpt_0.60", 0);
   Data->SetBranchStatus("muplus_cp_0.60", 0);
   Data->SetBranchStatus("muplus_cmult_0.60", 0);
   Data->SetBranchStatus("muplus_cpx_0.70", 0);
   Data->SetBranchStatus("muplus_cpy_0.70", 0);
   Data->SetBranchStatus("muplus_cpz_0.70", 0);
   Data->SetBranchStatus("muplus_cpt_0.70", 0);
   Data->SetBranchStatus("muplus_cp_0.70", 0);
   Data->SetBranchStatus("muplus_cmult_0.70", 0);
   Data->SetBranchStatus("muplus_cpx_0.80", 0);
   Data->SetBranchStatus("muplus_cpy_0.80", 0);
   Data->SetBranchStatus("muplus_cpz_0.80", 0);
   Data->SetBranchStatus("muplus_cpt_0.80", 0);
   Data->SetBranchStatus("muplus_cp_0.80", 0);
   Data->SetBranchStatus("muplus_cmult_0.80", 0);
   Data->SetBranchStatus("muplus_cpx_0.90", 0);
   Data->SetBranchStatus("muplus_cpy_0.90", 0);
   Data->SetBranchStatus("muplus_cpz_0.90", 0);
   Data->SetBranchStatus("muplus_cpt_0.90", 0);
   Data->SetBranchStatus("muplus_cp_0.90", 0);
   Data->SetBranchStatus("muplus_cmult_0.90", 0);
   Data->SetBranchStatus("muplus_cpx_1.00", 0);
   Data->SetBranchStatus("muplus_cpy_1.00", 0);
   Data->SetBranchStatus("muplus_cpz_1.00", 0);
   Data->SetBranchStatus("muplus_cpt_1.00", 0);
   Data->SetBranchStatus("muplus_cp_1.00", 0);
   Data->SetBranchStatus("muplus_cmult_1.00", 0);
   /*Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNe", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNmu", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNpi", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNk", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNp", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV2_ProbNNghost", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNe", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNmu", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNpi", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNk", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNp", 0);
   Data->SetBranchStatus("muplus0_MC12TuneV3_ProbNNghost", 0);
   Data->SetBranchStatus("muplus0_CosTheta", 0);*/
   Data->SetBranchStatus("muplus0_OWNPV_X", 0);
   Data->SetBranchStatus("muplus0_OWNPV_Y", 0);
   Data->SetBranchStatus("muplus0_OWNPV_Z", 0);
   Data->SetBranchStatus("muplus0_OWNPV_XERR", 0);
   Data->SetBranchStatus("muplus0_OWNPV_YERR", 0);
   Data->SetBranchStatus("muplus0_OWNPV_ZERR", 0);
   Data->SetBranchStatus("muplus0_OWNPV_CHI2", 0);
   Data->SetBranchStatus("muplus0_OWNPV_NDOF", 0);
   Data->SetBranchStatus("muplus0_OWNPV_COV_", 0);
   //Data->SetBranchStatus("muplus0_IP_OWNPV", 0);
   //Data->SetBranchStatus("muplus0_IPCHI2_OWNPV", 0);
   Data->SetBranchStatus("muplus0_ORIVX_X", 0);
   Data->SetBranchStatus("muplus0_ORIVX_Y", 0);
   Data->SetBranchStatus("muplus0_ORIVX_Z", 0);
   Data->SetBranchStatus("muplus0_ORIVX_XERR", 0);
   Data->SetBranchStatus("muplus0_ORIVX_YERR", 0);
   Data->SetBranchStatus("muplus0_ORIVX_ZERR", 0);
   Data->SetBranchStatus("muplus0_ORIVX_CHI2", 0);
   Data->SetBranchStatus("muplus0_ORIVX_NDOF", 0);
   Data->SetBranchStatus("muplus0_ORIVX_COV_", 0);
   //Data->SetBranchStatus("muplus0_P", 0);
   //Data->SetBranchStatus("muplus0_PT", 0);
   Data->SetBranchStatus("muplus0_PE", 0);
   Data->SetBranchStatus("muplus0_PX", 0);
   Data->SetBranchStatus("muplus0_PY", 0);
   Data->SetBranchStatus("muplus0_PZ", 0);
   Data->SetBranchStatus("muplus0_M", 0);
   Data->SetBranchStatus("muplus0_ID", 0);
   /*Data->SetBranchStatus("muplus0_PIDe", 0);
   Data->SetBranchStatus("muplus0_PIDmu", 0);
   Data->SetBranchStatus("muplus0_PIDK", 0);
   Data->SetBranchStatus("muplus0_PIDp", 0);
   Data->SetBranchStatus("muplus0_ProbNNe", 0);
   Data->SetBranchStatus("muplus0_ProbNNk", 0);
   Data->SetBranchStatus("muplus0_ProbNNp", 0);
   Data->SetBranchStatus("muplus0_ProbNNpi", 0);
   Data->SetBranchStatus("muplus0_ProbNNmu", 0);
   Data->SetBranchStatus("muplus0_ProbNNghost", 0);*/
   Data->SetBranchStatus("muplus0_hasMuon", 0);
   //Data->SetBranchStatus("muplus0_isMuon", 0);
   Data->SetBranchStatus("muplus0_hasRich", 0);
   Data->SetBranchStatus("muplus0_hasCalo", 0);
   Data->SetBranchStatus("muplus0_L0Global_Dec", 0);
   Data->SetBranchStatus("muplus0_L0Global_TIS", 0);
   Data->SetBranchStatus("muplus0_L0Global_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1Global_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1Global_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1Global_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1Phys_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1Phys_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1Phys_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2Global_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2Global_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2Global_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2Phys_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2Phys_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2Phys_TOS", 0);
   Data->SetBranchStatus("muplus0_L0DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_L0DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_L0DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_L0MuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_L0MuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_L0MuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_L0MuonHighDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_L0MuonHighDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_L0MuonHighDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonHighMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonHighMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonHighMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1SingleMuonHighPTDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1SingleMuonHighPTDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1SingleMuonHighPTDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackAllL0Decision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackAllL0Decision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt1TrackAllL0Decision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2PiMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilep3bodyD2KMuMuSSDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY1Decision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY1Decision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY1Decision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY2Decision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY2Decision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY2Decision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY3Decision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY3Decision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY3Decision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY4Decision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY4Decision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDY4Decision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedHeavyDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedHeavyDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDetachedHeavyDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonBDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonBDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonBDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonLowMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonLowMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonLowMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2DiMuonDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuWideMassDecision_Dec", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuWideMassDecision_TIS", 0);
   Data->SetBranchStatus("muplus0_Hlt2CharmSemilepD2HMuMuWideMassDecision_TOS", 0);
   Data->SetBranchStatus("muplus0_TRACK_Type", 0);
   Data->SetBranchStatus("muplus0_TRACK_Key", 0);
   //Data->SetBranchStatus("muplus0_TRACK_CHI2NDOF", 0);
   Data->SetBranchStatus("muplus0_TRACK_PCHI2", 0);
   Data->SetBranchStatus("muplus0_TRACK_MatchCHI2", 0);
   //Data->SetBranchStatus("muplus0_TRACK_GhostProb", 0);
   Data->SetBranchStatus("muplus0_TRACK_CloneDist", 0);
   Data->SetBranchStatus("muplus0_TRACK_Likelihood", 0);
   Data->SetBranchStatus("muplus0_cpx_0.50", 0);
   Data->SetBranchStatus("muplus0_cpy_0.50", 0);
   Data->SetBranchStatus("muplus0_cpz_0.50", 0);
   Data->SetBranchStatus("muplus0_cpt_0.50", 0);
   Data->SetBranchStatus("muplus0_cp_0.50", 0);
   Data->SetBranchStatus("muplus0_cmult_0.50", 0);
   Data->SetBranchStatus("muplus0_cpx_0.60", 0);
   Data->SetBranchStatus("muplus0_cpy_0.60", 0);
   Data->SetBranchStatus("muplus0_cpz_0.60", 0);
   Data->SetBranchStatus("muplus0_cpt_0.60", 0);
   Data->SetBranchStatus("muplus0_cp_0.60", 0);
   Data->SetBranchStatus("muplus0_cmult_0.60", 0);
   Data->SetBranchStatus("muplus0_cpx_0.70", 0);
   Data->SetBranchStatus("muplus0_cpy_0.70", 0);
   Data->SetBranchStatus("muplus0_cpz_0.70", 0);
   Data->SetBranchStatus("muplus0_cpt_0.70", 0);
   Data->SetBranchStatus("muplus0_cp_0.70", 0);
   Data->SetBranchStatus("muplus0_cmult_0.70", 0);
   Data->SetBranchStatus("muplus0_cpx_0.80", 0);
   Data->SetBranchStatus("muplus0_cpy_0.80", 0);
   Data->SetBranchStatus("muplus0_cpz_0.80", 0);
   Data->SetBranchStatus("muplus0_cpt_0.80", 0);
   Data->SetBranchStatus("muplus0_cp_0.80", 0);
   Data->SetBranchStatus("muplus0_cmult_0.80", 0);
   Data->SetBranchStatus("muplus0_cpx_0.90", 0);
   Data->SetBranchStatus("muplus0_cpy_0.90", 0);
   Data->SetBranchStatus("muplus0_cpz_0.90", 0);
   Data->SetBranchStatus("muplus0_cpt_0.90", 0);
   Data->SetBranchStatus("muplus0_cp_0.90", 0);
   Data->SetBranchStatus("muplus0_cmult_0.90", 0);
   Data->SetBranchStatus("muplus0_cpx_1.00", 0);
   Data->SetBranchStatus("muplus0_cpy_1.00", 0);
   Data->SetBranchStatus("muplus0_cpz_1.00", 0);
   Data->SetBranchStatus("muplus0_cpt_1.00", 0);
   Data->SetBranchStatus("muplus0_cp_1.00", 0);
   Data->SetBranchStatus("muplus0_cmult_1.00", 0);
   //Data->SetBranchStatus("nCandidate", 0);
   //Data->SetBranchStatus("totCandidates", 0);
   //Data->SetBranchStatus("EventInSequence", 0);
   //Data->SetBranchStatus("runNumber", 0);
   //Data->SetBranchStatus("eventNumber", 0);
   Data->SetBranchStatus("BCID", 0);
   Data->SetBranchStatus("BCType", 0);
   Data->SetBranchStatus("OdinTCK", 0);
   Data->SetBranchStatus("L0DUTCK", 0);
   Data->SetBranchStatus("HLTTCK", 0);
   Data->SetBranchStatus("GpsTime", 0);
   //Data->SetBranchStatus("Polarity", 0);
   //Data->SetBranchStatus("nPV", 0);
   Data->SetBranchStatus("PVX", 0);
   Data->SetBranchStatus("PVY", 0);
   Data->SetBranchStatus("PVZ", 0);
   Data->SetBranchStatus("PVXERR", 0);
   Data->SetBranchStatus("PVYERR", 0);
   Data->SetBranchStatus("PVZERR", 0);
   Data->SetBranchStatus("PVCHI2", 0);
   Data->SetBranchStatus("PVNDOF", 0);
   Data->SetBranchStatus("PVNTRACKS", 0);
   //Data->SetBranchStatus("nPVs", 0);
   //Data->SetBranchStatus("nTracks", 0);
   Data->SetBranchStatus("nLongTracks", 0);
   Data->SetBranchStatus("nDownstreamTracks", 0);
   Data->SetBranchStatus("nUpstreamTracks", 0);
   Data->SetBranchStatus("nVeloTracks", 0);
   Data->SetBranchStatus("nTTracks", 0);
   Data->SetBranchStatus("nBackTracks", 0);
   Data->SetBranchStatus("nRich1Hits", 0);
   Data->SetBranchStatus("nRich2Hits", 0);
   Data->SetBranchStatus("nVeloClusters", 0);
   Data->SetBranchStatus("nITClusters", 0);
   Data->SetBranchStatus("nTTClusters", 0);
   Data->SetBranchStatus("nOTClusters", 0);
   //Data->SetBranchStatus("nSPDHits", 0);
   Data->SetBranchStatus("nMuonCoordsS0", 0);
   Data->SetBranchStatus("nMuonCoordsS1", 0);
   Data->SetBranchStatus("nMuonCoordsS2", 0);
   Data->SetBranchStatus("nMuonCoordsS3", 0);
   Data->SetBranchStatus("nMuonCoordsS4", 0);
   Data->SetBranchStatus("nMuonTracks", 0);
   Data->SetBranchStatus("L0Global", 0);
   Data->SetBranchStatus("Hlt1Global", 0);
   Data->SetBranchStatus("Hlt2Global", 0); 
	 
   // TString cut = "(B_s0_Hlt1Phys_TIS == 1 || B_s0_Hlt1DiMuonHighMassDecision_TOS == 1 || B_s0_Hlt1SingleMuonNoIPDecision_TOS == 1 || B_s0_Hlt1SingleMuonHighPTDecision_TOS == 1) && ( B_s0_Hlt2Phys_TIS == 1 || B_s0_Hlt2DiMuonBDecision_TOS == 1 || B_s0_Hlt2DiMuonDY2Decision_TOS == 1 ) && B_s0_TAU > -0.005";

  // Write to a new file
  TFile *New_File = new TFile(sOutput,"recreate");
  New_File->mkdir(sFolder);
  New_File->cd(sFolder);
  
  TTree *New_Tree = Data->CopyTree("");//, "", 1000);
  New_Tree->AutoSave();
  New_File->Close();

} 
Exemplo n.º 7
0
void SkimRegression(TString process="ZnnH125", Long64_t skimentries=1000000000)
{
    //gROOT->LoadMacro("HelperFunctions.h" );  // make functions visible to TTreeFormula
    gROOT->SetBatch(1);

    TChain * chain  = new TChain("tree");
    TString fname   = "";
    TString dijet   = "DiJetPt_";
#ifndef XROOTD
    //TString dirMC   = "dcache:/pnfs/cms/WAX/resilient/jiafu/ZnunuHbb/" + tagMC + "/";
    //TString dirData = "dcache:/pnfs/cms/WAX/resilient/jiafu/ZnunuHbb/" + tagData + "/";
    TString dirMC   = "dcache:/pnfs/cms/WAX/11/store/user/lpchbb/apana/" + tagMC + "/";
    TString dirData = "dcache:/pnfs/cms/WAX/11/store/user/lpchbb/apana/" + tagData + "/";
#else
    TString dirMC   = "root://xrootd.ba.infn.it//store/user/arizzi/" + tagMC + "/";
    TString dirData = "root://xrootd.ba.infn.it//store/user/arizzi/" + tagData + "/";
#endif
    TString outdir  = "skim_ZnnH_regression/";
    TString prefix  = "skim_";
    TString suffix  = ".root";

    // ZbbHinv
    if (process == "ZbbHinv105") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-105_8TeV_pythia6" + suffix;
        chain->Add(fname);
    } else if (process == "ZbbHinv115") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-115_8TeV_pythia6" + suffix;
        chain->Add(fname);
    } else if (process == "ZbbHinv125") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-125_8TeV_pythia6" + suffix;
        chain->Add(fname);
    } else if (process == "ZbbHinv135") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-135_8TeV_pythia6" + suffix;
        chain->Add(fname);
    } else if (process == "ZbbHinv145") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-145_8TeV_pythia6" + suffix;
        chain->Add(fname);
    } else if (process == "ZbbHinv150") {
        fname = dirMC + dijet + "ZH_ZToBB_HToInv_M-150_8TeV_pythia6" + suffix;
        chain->Add(fname);

    // ZnnH
    } else if (process == "ZnnH110") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-110_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH115") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-115_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH120") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-120_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH125") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-125_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH130") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-130_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH135") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-135_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH140") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-140_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH145") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-145_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZnnH150") {
        fname = dirMC + dijet + "ZH_ZToNuNu_HToBB_M-150_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);

    // WlnH
    } else if (process == "WlnH110") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-110_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH115") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-115_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH120") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-120_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH125") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-125_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH130") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-130_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH135") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-135_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH140") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-140_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH145") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-145_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "WlnH150") {
        fname = dirMC + dijet + "WH_WToLNu_HToBB_M-150_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);

    // ZllH
    } else if (process == "ZllH110") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-110_8TeV-powheg-herwigpp3" + suffix;  // NOTE: '3' in name
        chain->Add(fname);
    } else if (process == "ZllH115") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-115_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH120") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-120_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH125") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-125_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH130") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-130_8TeV-powheg-herwigpp3" + suffix;  // NOTE: '3' in name
        chain->Add(fname);
    } else if (process == "ZllH135") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-135_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH140") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-140_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH145") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-145_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);
    } else if (process == "ZllH150") {
        fname = dirMC + dijet + "ZH_ZToLL_HToBB_M-150_8TeV-powheg-herwigpp" + suffix;
        chain->Add(fname);

    } else {
        std::cout << "Error: Unrecognized process. I quit!" << std::endl;
        return;
    }

    TCut selection = regression.c_str();
    
    // Make output directory if it doesn't exist
    if (gSystem->AccessPathName(outdir))
        gSystem->mkdir(outdir);
    TString outname = outdir + prefix + Form("%s.root", process.Data());

    TFile* f1 = TFile::Open(outname, "RECREATE");
    TTree* t1 = (TTree*) chain->CopyTree(selection);

    if (t1->GetEntriesFast() > skimentries){
        TTree* t2 = t1->CopyTree("", "", skimentries);
        t2->SetName(TString(t1->GetName())+"_train");
        TTree* t3 = t1->CopyTree("", "", 1000000000, skimentries);
        t3->SetName(TString(t1->GetName())+"_test");
        t2->Write();
        t3->Write();
        assert(t1->GetEntriesFast() == t2->GetEntriesFast() + t3->GetEntriesFast());
        delete t1;
        std::clog << process << ": skimmed from " << chain->GetEntriesFast() << " to " << t2->GetEntriesFast() << " (training) and " << t3->GetEntriesFast() << " (test) entries." << std::endl;
    } else {
        t1->Write();
        std::clog << process << ": skimmed from " << chain->GetEntriesFast() << " to " << t1->GetEntriesFast() << " entries." << std::endl;
    }
    
    f1->Close();

    return;
}
Exemplo n.º 8
0
void splitStopSamples(){

  char* path = "/tas/cms2/stop/MiniBabies/V00-02-s18b20__V00-03-01__BDT007__4jetsMET100MT150_all";

  //-------------------------------------
  // declare input file, tree, etc.
  //-------------------------------------

  //char* infilename = Form("%s/T2tt_*.root" , path);
  //char* infilename = Form("%s/T2bw_*75.root" , path);
  //char* infilename = Form("%s/T2bw_*50.root" , path);
  char* infilename = Form("%s/T2bw_*25.root" , path);
  long long max_tree_size = 20000000000000000LL;
  TTree::SetMaxTreeSize(max_tree_size);

  TChain *chain = new TChain("t");
  chain->Add(infilename);

  //-------------------------------------
  // which grid points to skim?
  //-------------------------------------
  
  vector<string> filenames;
  vector<int> mg;
  vector<int> ml;

  // mg.push_back(350);   ml.push_back(100);
  // mg.push_back(450);   ml.push_back(100);
  // mg.push_back(250);   ml.push_back(75);
  // mg.push_back(250);   ml.push_back(100);
  // mg.push_back(400);   ml.push_back(150);
  // mg.push_back(500);   ml.push_back(100);
  // mg.push_back(600);   ml.push_back(0);
  // mg.push_back(550);   ml.push_back(0);
  // mg.push_back(650);   ml.push_back(50);
  // mg.push_back(750);   ml.push_back(100);
  // mg.push_back(500);   ml.push_back(100);
  // mg.push_back(600);   ml.push_back(200);
  // mg.push_back(650);   ml.push_back(250);
  // mg.push_back(75000);   ml.push_back(100);
  // mg.push_back(350);   ml.push_back(50);
  // mg.push_back(450);   ml.push_back(50);
  // mg.push_back(500);   ml.push_back(50);
  // mg.push_back(400);   ml.push_back(50);

  // T2bw 75 R1
  // mg.push_back(350);   ml.push_back(125);
  // mg.push_back(350);   ml.push_back(175);
  // mg.push_back(400);   ml.push_back(175);

  // T2bw 75 R2
  // mg.push_back(425);   ml.push_back(75);
  // mg.push_back(450);   ml.push_back(100);
  // mg.push_back(500);   ml.push_back(125);

  // T2bw 75 R3
  // mg.push_back(500);   ml.push_back(0);
  // mg.push_back(550);   ml.push_back(0);
  // mg.push_back(525);   ml.push_back(75);

  // T2bw 75 R4
  // mg.push_back(150);      ml.push_back(0);
  // mg.push_back(200);      ml.push_back(0);
  // mg.push_back(200);      ml.push_back(50);

  // T2bw 50 R1
  // mg.push_back(225);      ml.push_back(0);
  // mg.push_back(275);      ml.push_back(50);
  // mg.push_back(325);      ml.push_back(100);

  // T2bw 50 R2
  // mg.push_back(350);      ml.push_back(0);
  // mg.push_back(375);      ml.push_back(50);
  // mg.push_back(400);      ml.push_back(100);

  // T2bw 50 R3
  // mg.push_back(450);      ml.push_back(0);
  // mg.push_back(500);      ml.push_back(50);
  // mg.push_back(550);      ml.push_back(100);

  // T2bw 25 R2
  // mg.push_back(400);      ml.push_back(0);
  // mg.push_back(500);      ml.push_back(100);
  // mg.push_back(600);      ml.push_back(200);

  // T2bw 25 R3
  mg.push_back(500);      ml.push_back(0);
  mg.push_back(550);      ml.push_back(50);
  mg.push_back(600);      ml.push_back(100);

  // cut-and-count T2tt
  // mg.push_back(600);   ml.push_back(25);
  // mg.push_back(500);   ml.push_back(200);
  // mg.push_back(300);   ml.push_back(100);

  // R4
  // mg.push_back(200);   ml.push_back(100);
  // mg.push_back(300);   ml.push_back(200);
  // mg.push_back(400);   ml.push_back(300);

  // R4
  // mg.push_back(550);   ml.push_back(25);
  // mg.push_back(650);   ml.push_back(50);
  // mg.push_back(750);   ml.push_back(100);

  // R3
  // mg.push_back(500);   ml.push_back(100);
  // mg.push_back(600);   ml.push_back(200);
  // mg.push_back(650);   ml.push_back(250);

  // R2
  // mg.push_back(350);   ml.push_back(75);
  // mg.push_back(400);   ml.push_back(125);
  // mg.push_back(450);   ml.push_back(175);

  // R1
  //mg.push_back(250);   ml.push_back(25);
  //mg.push_back(300);   ml.push_back(25);
  //mg.push_back(300);   ml.push_back(75);

  const unsigned int npoints = mg.size();

  //-------------------------------------
  // skim grid points
  //-------------------------------------

  TFile *file[npoints];
  TTree *tree[npoints];

  TChain* pretest = new TChain("t");
  TChain* posttest = new TChain("t");

  for( unsigned int i = 0 ; i < npoints ; ++i ){

    //char* filename = Form("%s/T2ttPoint_%i_%i.root",path,mg.at(i),ml.at(i));
    //char* filename = Form("%s/T2bw75Point_%i_%i.root",path,mg.at(i),ml.at(i));
    //char* filename = Form("%s/T2bw50Point_%i_%i.root",path,mg.at(i),ml.at(i));
    char* filename = Form("%s/T2bw25Point_%i_%i.root",path,mg.at(i),ml.at(i));

    TCut cut(Form("mg==%i && ml==%i",mg.at(i),ml.at(i)));

    cout << endl;
    cout << "Skimming input file  : " << infilename << endl;
    cout << "Using selection      : " << cut.GetTitle() << endl;
    cout << "Skim filename        : " << filename << endl;


    file[i] = TFile::Open(filename, "RECREATE");
    assert( file[i] != 0 );
    tree[i] = chain->CopyTree( cut );

    tree[i]->Write();
    file[i]->Close();

    pretest->Add(infilename);
    posttest->Add(filename);
    
    cout << "Pre  total           : " << pretest->GetEntries() << endl;
    cout << "Pre  skim            : " << pretest->GetEntries(cut) << endl;
    cout << "Post total           : " << posttest->GetEntries() << endl;
    cout << "Post skim            : " << posttest->GetEntries(cut) << endl;

    pretest->Reset();
    posttest->Reset();


  }

}
Exemplo n.º 9
0
void D3PDSkimmer_DATA(void)
{
	TChain *chain = new TChain("physics");

	chain->Add("/quark1/tiouchi/data11_7TeV.00185856.physics_Egamma.merge.NTUP_HSG2.r2713_p705_p996_p997_tid786148_00/NTUP_HSG2.786148._000002.root.2");

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("*", 0);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("RunNumber", 1);
	chain->SetBranchStatus("EventNumber", 1);
	chain->SetBranchStatus("lbn", 1);
	chain->SetBranchStatus("larError", 1);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("actualIntPerXing", 1);
	chain->SetBranchStatus("averageIntPerXing", 1);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("vxp_n", 1);
	chain->SetBranchStatus("vxp_nTracks", 1);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("mc_n", 1);
	chain->SetBranchStatus("mc_pdgId", 1);
	chain->SetBranchStatus("mc_children", 1);
	chain->SetBranchStatus("mc_child_index", 1);
	chain->SetBranchStatus("mc_channel_number", 1);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("mcevt_weight", 1);

	/*-----------------------------------------------------------------*/
	/* ELECTRONS GSF						   */
	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("el_GSF_author", 1);
	chain->SetBranchStatus("el_GSF_charge", 1);
	chain->SetBranchStatus("el_GSF_cl_E", 1);
	chain->SetBranchStatus("el_GSF_cl_E_uc", 1);
	chain->SetBranchStatus("el_GSF_cl_eta", 1);
	chain->SetBranchStatus("el_GSF_cl_eta_s2", 1);
	chain->SetBranchStatus("el_GSF_cl_phi", 1);
	chain->SetBranchStatus("el_GSF_cl_pt", 1);
	chain->SetBranchStatus("el_GSF_EF_index", 1);
	chain->SetBranchStatus("el_GSF_etap", 1);
	chain->SetBranchStatus("el_GSF_etas2", 1);
	chain->SetBranchStatus("el_GSF_Etcone20", 1);
	chain->SetBranchStatus("el_GSF_Etcone30", 1);
	chain->SetBranchStatus("el_GSF_loosePP", 1);
	chain->SetBranchStatus("el_GSF_medium", 1);
	chain->SetBranchStatus("el_GSF_n", 1);
	chain->SetBranchStatus("el_GSF_nPixHits", 1);
	chain->SetBranchStatus("el_GSF_nSCTHits", 1);
	chain->SetBranchStatus("el_GSF_OQ", 1);
	chain->SetBranchStatus("el_GSF_type", 1);
	chain->SetBranchStatus("el_GSF_typebkg", 1);
	chain->SetBranchStatus("el_GSF_origin", 1);
	chain->SetBranchStatus("el_GSF_originbkg", 1);
	chain->SetBranchStatus("el_GSF_ptcone20", 1);
	chain->SetBranchStatus("el_GSF_ptcone30", 1);
	chain->SetBranchStatus("el_GSF_tight", 1);
	chain->SetBranchStatus("el_GSF_trackd0", 1);
	chain->SetBranchStatus("el_GSF_trackd0pvunbiased", 1);
	chain->SetBranchStatus("el_GSF_tracketa", 1);
	chain->SetBranchStatus("el_GSF_trackphi", 1);
	chain->SetBranchStatus("el_GSF_trackpt", 1);
	chain->SetBranchStatus("el_GSF_trackqoverp", 1);
	chain->SetBranchStatus("el_GSF_tracksigd0pvunbiased", 1);
	chain->SetBranchStatus("el_GSF_tracktheta", 1);
	chain->SetBranchStatus("el_GSF_trackz0", 1);
	chain->SetBranchStatus("el_GSF_trackz0pvunbiased", 1);
	chain->SetBranchStatus("el_GSF_Ethad", 1);
	chain->SetBranchStatus("el_GSF_Ethad1", 1);
	chain->SetBranchStatus("el_GSF_reta", 1);
	chain->SetBranchStatus("el_GSF_rphi", 1);
	chain->SetBranchStatus("el_GSF_weta2", 1);
	chain->SetBranchStatus("el_GSF_f1", 1);
	chain->SetBranchStatus("el_GSF_wstot", 1);
	chain->SetBranchStatus("el_GSF_emaxs1", 1);
	chain->SetBranchStatus("el_GSF_Emax2", 1);
	chain->SetBranchStatus("el_GSF_deltaeta1", 1);
	chain->SetBranchStatus("el_GSF_nBLHits", 1);
	chain->SetBranchStatus("el_GSF_nBLayerOutliers", 1);
	chain->SetBranchStatus("el_GSF_nSiHits", 1);
	chain->SetBranchStatus("el_GSF_nPixelOutliers", 1);
	chain->SetBranchStatus("el_GSF_nSCTOutliers", 1);
	chain->SetBranchStatus("el_GSF_nTRTHits", 1);
	chain->SetBranchStatus("el_GSF_nTRTOutliers", 1);
	chain->SetBranchStatus("el_GSF_nTRTHighTHits", 1);
	chain->SetBranchStatus("el_GSF_nTRTHighTOutliers", 1);
	chain->SetBranchStatus("el_GSF_truth_mothertype", 1);
	chain->SetBranchStatus("el_GSF_truth_type", 1);


	/*-----------------------------------------------------------------*/
	/* MUONS STACO							   */
	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("mu_staco_author", 1);
	chain->SetBranchStatus("mu_staco_charge", 1);
	chain->SetBranchStatus("mu_staco_E", 1);
	chain->SetBranchStatus("mu_staco_EFCB_index", 1);
	chain->SetBranchStatus("mu_staco_eta", 1);
	chain->SetBranchStatus("mu_staco_etcone20", 1);
	chain->SetBranchStatus("mu_staco_etcone30", 1);
	chain->SetBranchStatus("mu_staco_expectBLayerHit", 1);
	chain->SetBranchStatus("mu_staco_id_d0", 1);
	chain->SetBranchStatus("mu_staco_id_phi", 1);
	chain->SetBranchStatus("mu_staco_id_qoverp", 1);
	chain->SetBranchStatus("mu_staco_id_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_staco_id_theta", 1);
	chain->SetBranchStatus("mu_staco_id_theta_exPV", 1);
	chain->SetBranchStatus("mu_staco_id_z0", 1);
	chain->SetBranchStatus("mu_staco_isStandAloneMuon", 1);
	chain->SetBranchStatus("mu_staco_isCombinedMuon", 1);
	chain->SetBranchStatus("mu_staco_isSegmentTaggedMuon", 1);
	chain->SetBranchStatus("mu_staco_me_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_staco_me_theta_exPV", 1);
	chain->SetBranchStatus("mu_staco_n", 1);
	chain->SetBranchStatus("mu_staco_nBLHits", 1);
	chain->SetBranchStatus("mu_staco_nPixelDeadSensors", 1);
	chain->SetBranchStatus("mu_staco_nPixHits", 1);
	chain->SetBranchStatus("mu_staco_nPixHoles", 1);
	chain->SetBranchStatus("mu_staco_nSCTDeadSensors", 1);
	chain->SetBranchStatus("mu_staco_nSCTHits", 1);
	chain->SetBranchStatus("mu_staco_nSCTHoles", 1);
	chain->SetBranchStatus("mu_staco_nTRTHits", 1);
	chain->SetBranchStatus("mu_staco_nTRTOutliers", 1);
	chain->SetBranchStatus("mu_staco_nCSCEtaHits", 1);
	chain->SetBranchStatus("mu_staco_nCSCPhiHits", 1);
	chain->SetBranchStatus("mu_staco_nMDTEMHits", 1);
	chain->SetBranchStatus("mu_staco_nMDTEOHits", 1);
	chain->SetBranchStatus("mu_staco_phi", 1);
	chain->SetBranchStatus("mu_staco_pt", 1);
	chain->SetBranchStatus("mu_staco_ptcone20", 1);
	chain->SetBranchStatus("mu_staco_ptcone30", 1);
	chain->SetBranchStatus("mu_staco_tight", 1);
	chain->SetBranchStatus("mu_staco_d0_exPV", 1);
	chain->SetBranchStatus("mu_staco_z0_exPV", 1);
	chain->SetBranchStatus("mu_staco_trackIPEstimate_d0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_staco_trackIPEstimate_sigd0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_staco_truth_mothertype", 1);
	chain->SetBranchStatus("mu_staco_truth_type", 1);

	/*-----------------------------------------------------------------*/
	/* MUONS muid							   */
	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("mu_muid_author", 1);
	chain->SetBranchStatus("mu_muid_charge", 1);
	chain->SetBranchStatus("mu_muid_E", 1);
	chain->SetBranchStatus("mu_muid_EFCB_index", 1);
	chain->SetBranchStatus("mu_muid_eta", 1);
	chain->SetBranchStatus("mu_muid_etcone20", 1);
	chain->SetBranchStatus("mu_muid_etcone30", 1);
	chain->SetBranchStatus("mu_muid_expectBLayerHit", 1);
	chain->SetBranchStatus("mu_muid_id_d0", 1);
	chain->SetBranchStatus("mu_muid_id_phi", 1);
	chain->SetBranchStatus("mu_muid_id_qoverp", 1);
	chain->SetBranchStatus("mu_muid_id_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_muid_id_theta", 1);
	chain->SetBranchStatus("mu_muid_id_theta_exPV", 1);
	chain->SetBranchStatus("mu_muid_id_z0", 1);
	chain->SetBranchStatus("mu_muid_isStandAloneMuon", 1);
	chain->SetBranchStatus("mu_muid_isCombinedMuon", 1);
	chain->SetBranchStatus("mu_muid_isSegmentTaggedMuon", 1);
	chain->SetBranchStatus("mu_muid_me_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_muid_me_theta_exPV", 1);
	chain->SetBranchStatus("mu_muid_n", 1);
	chain->SetBranchStatus("mu_muid_nBLHits", 1);
	chain->SetBranchStatus("mu_muid_nPixelDeadSensors", 1);
	chain->SetBranchStatus("mu_muid_nPixHits", 1);
	chain->SetBranchStatus("mu_muid_nPixHoles", 1);
	chain->SetBranchStatus("mu_muid_nSCTDeadSensors", 1);
	chain->SetBranchStatus("mu_muid_nSCTHits", 1);
	chain->SetBranchStatus("mu_muid_nSCTHoles", 1);
	chain->SetBranchStatus("mu_muid_nTRTHits", 1);
	chain->SetBranchStatus("mu_muid_nTRTOutliers", 1);
	chain->SetBranchStatus("mu_muid_nCSCEtaHits", 1);
	chain->SetBranchStatus("mu_muid_nCSCPhiHits", 1);
	chain->SetBranchStatus("mu_muid_nMDTEMHits", 1);
	chain->SetBranchStatus("mu_muid_nMDTEOHits", 1);
	chain->SetBranchStatus("mu_muid_phi", 1);
	chain->SetBranchStatus("mu_muid_pt", 1);
	chain->SetBranchStatus("mu_muid_ptcone20", 1);
	chain->SetBranchStatus("mu_muid_ptcone30", 1);
	chain->SetBranchStatus("mu_muid_tight", 1);
	chain->SetBranchStatus("mu_muid_d0_exPV", 1);
	chain->SetBranchStatus("mu_muid_z0_exPV", 1);
	chain->SetBranchStatus("mu_muid_trackIPEstimate_d0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_muid_trackIPEstimate_sigd0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_muid_truth_mothertype", 1);
	chain->SetBranchStatus("mu_muid_truth_type", 1);

	/*-----------------------------------------------------------------*/
	/* MUONS calo							   */
	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("mu_calo_author", 1);
	chain->SetBranchStatus("mu_calo_caloMuonIdTag", 1);
	chain->SetBranchStatus("mu_calo_caloLRLikelihood", 1);
	chain->SetBranchStatus("mu_calo_charge", 1);
	chain->SetBranchStatus("mu_calo_E", 1);
	chain->SetBranchStatus("mu_calo_eta", 1);
	chain->SetBranchStatus("mu_calo_etcone20", 1);
	chain->SetBranchStatus("mu_calo_etcone30", 1);
	chain->SetBranchStatus("mu_calo_expectBLayerHit", 1);
	chain->SetBranchStatus("mu_calo_id_d0", 1);
	chain->SetBranchStatus("mu_calo_id_phi", 1);
	chain->SetBranchStatus("mu_calo_id_qoverp", 1);
	chain->SetBranchStatus("mu_calo_id_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_calo_id_theta", 1);
	chain->SetBranchStatus("mu_calo_id_theta_exPV", 1);
	chain->SetBranchStatus("mu_calo_id_z0", 1);
	chain->SetBranchStatus("mu_calo_isStandAloneMuon", 1);
	chain->SetBranchStatus("mu_calo_isCombinedMuon", 1);
	chain->SetBranchStatus("mu_calo_isSegmentTaggedMuon", 1);
	chain->SetBranchStatus("mu_calo_me_qoverp_exPV", 1);
	chain->SetBranchStatus("mu_calo_me_theta_exPV", 1);
	chain->SetBranchStatus("mu_calo_n", 1);
	chain->SetBranchStatus("mu_calo_nBLHits", 1);
	chain->SetBranchStatus("mu_calo_nPixelDeadSensors", 1);
	chain->SetBranchStatus("mu_calo_nPixHits", 1);
	chain->SetBranchStatus("mu_calo_nPixHoles", 1);
	chain->SetBranchStatus("mu_calo_nSCTDeadSensors", 1);
	chain->SetBranchStatus("mu_calo_nSCTHits", 1);
	chain->SetBranchStatus("mu_calo_nSCTHoles", 1);
	chain->SetBranchStatus("mu_calo_nTRTHits", 1);
	chain->SetBranchStatus("mu_calo_nTRTOutliers", 1);
	chain->SetBranchStatus("mu_calo_nCSCEtaHits", 1);
	chain->SetBranchStatus("mu_calo_nCSCPhiHits", 1);
	chain->SetBranchStatus("mu_calo_nMDTEMHits", 1);
	chain->SetBranchStatus("mu_calo_nMDTEOHits", 1);
	chain->SetBranchStatus("mu_calo_phi", 1);
	chain->SetBranchStatus("mu_calo_pt", 1);
	chain->SetBranchStatus("mu_calo_ptcone20", 1);
	chain->SetBranchStatus("mu_calo_ptcone30", 1);
	chain->SetBranchStatus("mu_calo_d0_exPV", 1);
	chain->SetBranchStatus("mu_calo_z0_exPV", 1);
	chain->SetBranchStatus("mu_calo_trackIPEstimate_d0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_calo_trackIPEstimate_sigd0_unbiasedpvunbiased", 1);
	chain->SetBranchStatus("mu_calo_truth_mothertype", 1);
	chain->SetBranchStatus("mu_calo_truth_type", 1);

	/*-----------------------------------------------------------------*/
	/* TRIGGER							   */
	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("EF_2e12_medium", 1);
	chain->SetBranchStatus("EF_2e12T_medium", 1);
	chain->SetBranchStatus("EF_2e12Tvh_medium", 1);
	chain->SetBranchStatus("EF_2e15_medium", 1);
	chain->SetBranchStatus("EF_2mu10_loose", 1);
	chain->SetBranchStatus("EF_e10_medium_mu10", 1);
	chain->SetBranchStatus("EF_e10_medium_mu6", 1);
	chain->SetBranchStatus("EF_e20_medium", 1);
	chain->SetBranchStatus("EF_e22_medium", 1);
	chain->SetBranchStatus("EF_e22_medium1", 1);
	chain->SetBranchStatus("EF_e22vh_medium1", 1);
	chain->SetBranchStatus("EF_mu10", 1);
	chain->SetBranchStatus("EF_mu15_mu10_EFFS", 1);
	chain->SetBranchStatus("EF_mu15_mu10_EFFS_medium", 1);
	chain->SetBranchStatus("EF_mu18", 1);
	chain->SetBranchStatus("EF_mu18_MG", 1);
	chain->SetBranchStatus("EF_mu18_MG_medium", 1);
	chain->SetBranchStatus("EF_mu20", 1);
	chain->SetBranchStatus("EF_mu20_MG", 1);
	chain->SetBranchStatus("EF_mu20_MG_medium", 1);
	chain->SetBranchStatus("EF_mu22", 1);
	chain->SetBranchStatus("EF_mu22_MG", 1);
	chain->SetBranchStatus("EF_mu22_MG_medium", 1);

	/*-----------------------------------------------------------------*/

	chain->SetBranchStatus("trig_DB_SMK");
	chain->SetBranchStatus("trig_Nav_n");
	chain->SetBranchStatus("trig_Nav_chain_ChainId");
	chain->SetBranchStatus("trig_Nav_chain_RoIType");
	chain->SetBranchStatus("trig_Nav_chain_RoIIndex");

	chain->SetBranchStatus("trig_RoI_EF_e_egammaContainer_egamma_Electrons");
	chain->SetBranchStatus("trig_RoI_EF_e_egammaContainer_egamma_ElectronsStatus");
	chain->SetBranchStatus("trig_EF_el_n");
	chain->SetBranchStatus("trig_EF_el_eta");
	chain->SetBranchStatus("trig_EF_el_phi");

	chain->SetBranchStatus("trig_RoI_EF_mu_Muon_ROI");
	chain->SetBranchStatus("trig_RoI_EF_mu_TrigMuonEFInfoContainer");
	chain->SetBranchStatus("trig_RoI_EF_mu_TrigMuonEFInfoContainerStatus");
	chain->SetBranchStatus("trig_RoI_EF_mu_TrigMuonEFInfoContainer_eMuonEFInfoStatus");
	chain->SetBranchStatus("trig_RoI_EF_mu_TrigMuonEFInfoContainer_eMuonEFInfo");
	chain->SetBranchStatus("trig_RoI_L2_mu_CombinedMuonFeature");
	chain->SetBranchStatus("trig_RoI_L2_mu_CombinedMuonFeatureStatus");
	chain->SetBranchStatus("trig_RoI_L2_mu_MuonFeature");
	chain->SetBranchStatus("trig_RoI_L2_mu_Muon_ROI");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_CB_pt");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_CB_eta");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_CB_phi");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_SA_pt");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_SA_eta");
	chain->SetBranchStatus("trig_EF_trigmuonef_track_SA_phi");
	chain->SetBranchStatus("trig_EF_trigmugirl_track_CB_pt");
	chain->SetBranchStatus("trig_EF_trigmugirl_track_CB_eta");
	chain->SetBranchStatus("trig_EF_trigmugirl_track_CB_phi");
	chain->SetBranchStatus("trig_L2_combmuonfeature_eta");
	chain->SetBranchStatus("trig_L2_combmuonfeature_phi");
	chain->SetBranchStatus("trig_L2_muonfeature_eta");
	chain->SetBranchStatus("trig_L2_muonfeature_phi");
	chain->SetBranchStatus("trig_L1_mu_eta");
	chain->SetBranchStatus("trig_L1_mu_phi");
	chain->SetBranchStatus("trig_L1_mu_thrName");

	/*-----------------------------------------------------------------*/

	TFile *f = new TFile("result.root", "recreate");

	TTree *t = chain->CopyTree("", "", 10);

	t->Write();

	delete t;
	delete f;

	/*-----------------------------------------------------------------*/

	TFile *f = TFile::Open("result.root");

	((TTree *) f->Get("physics"))->MakeClass("THiggsD3PD");

	delete f;

	/*-----------------------------------------------------------------*/

	system("sed -i -e \"s/vector/std::vector/g\" THiggsD3PD.h");
	system("sed -i -e \"s/string/std::string/g\" THiggsD3PD.h");

	system("sed -i -e \"s/*el_GSF/*el/g\" THiggsD3PD.h");
	system("sed -i -e \"s/\\&el_GSF/\\&el/g\" THiggsD3PD.h");

	system("sed -i -e \"s/*b_el_GSF/*b_el/g\" THiggsD3PD.h");
	system("sed -i -e \"s/\\&b_el_GSF/\\&b_el/g\" THiggsD3PD.h");

	system("sed -i -e \"s/   el_GSF/   el/g\" THiggsD3PD.h");

	system("sed -i -e \"s/#include <TFile.h>/&\\n\\n#define __IS_DATA/g\" THiggsD3PD.h");

	/*-----------------------------------------------------------------*/

	remove("THiggsD3PD.C");
//	remove("THiggsD3PD.root");

	/*-----------------------------------------------------------------*/
}
Exemplo n.º 10
0
void Skim(TString fname="ZnnH125", TString outputname = "")
{
    gROOT->LoadMacro("HelperFunctions.h" );  // make functions visible to TTreeFormula
    gROOT->SetBatch(1);

    TChain * chain  = new TChain("tree");
    TString dijet   = "";
    TString outdir  = "/afs/cern.ch/work/d/degrutto/public/MiniAOD/ZnnHbb_Phys14_PU20bx25/skimV11_v2/";
    TString prefix  = "skim_";
    TString suffix  = "tree*.root";
    


    TCut selection = baseline.c_str();
    // Different baseline for dimuons
    // MET filters
    selection += metfilter.c_str();

    // JSON & trigger
    if (fname.Contains("Data")) {
        TCut trigger = mettrigger.c_str();
        selection += trigger;
        //selection.Print();
      }
      /*
    } else if (process == "Data_METBTag_R" || process == "Data_METBTag_P") {
        TCut trigger = metbtagtrigger.c_str();
        selection += trigger;
        //selection.Print();
    } else if (process == "Data_SingleMu_R" || process == "Data_SingleMu_P") {
        TCut trigger = singlemutrigger.c_str();
        selection += trigger;
        //selection.Print();
    } else if (process == "Data_SingleEl_R" || process == "Data_SingleEl_P") {
        TCut trigger = singleeltrigger.c_str();
        selection += trigger;
        //selection.Print();
    }
      */


    chain->Add(fname);

    // Sum Count, CountWithPU, CountWithPUP, CountWithPUM
    TObjArray * files = chain->GetListOfFiles();
    TIter next(files);
    TChainElement * chainElem = 0;
    TFile * f2 = 0;
    TH1D * h1 = new TH1D("Count", ";Counts", 16, 0, 16);
    TH1F * htemp = 0;

    while ((chainElem = (TChainElement*) next())) {
      //#ifndef XROOTD
      //      f2 = TFile::Open("dcache:" + TString(chainElem->GetTitle()));
      //#else
      std::cout << "chainElem->GetTitle() " << chainElem->GetTitle() << std::endl; 
        f2 = TFile::Open( TString(chainElem->GetTitle()));
	//#endif
        htemp = (TH1F*) f2->Get("Count");
        h1->SetBinContent(1, h1->GetBinContent(1)+htemp->GetBinContent(1));
	/*
        htemp = (TH1F*) f2->Get("CountWithPU");
        h1->SetBinContent(2, h1->GetBinContent(2)+htemp->GetBinContent(1));
        htemp = (TH1F*) f2->Get("CountWithPUP");
        h1->SetBinContent(3, h1->GetBinContent(3)+htemp->GetBinContent(1));
        htemp = (TH1F*) f2->Get("CountWithPUM");
        h1->SetBinContent(4, h1->GetBinContent(4)+htemp->GetBinContent(1));
        htemp = (TH1F*) f2->Get("CountWithMCProd");
        h1->SetBinContent(5, h1->GetBinContent(5)+htemp->GetBinContent(1));
        htemp = (TH1F*) f2->Get("CountWithPUMCProd");
        h1->SetBinContent(6, h1->GetBinContent(6)+htemp->GetBinContent(1));
        htemp = (TH1F*) f2->Get("countWithSignalQCDcorrections");
        h1->SetBinContent(7, h1->GetBinContent(7)+htemp->GetBinContent(1));
        */
        std::clog << fname << ": skimmed from " << chainElem->GetTitle() << std::endl;
    }
    
    // LHE Count
    
    TH1D * h2 = new TH1D("LHECount", ";LHE Counts", 16, 0, 16);
    TString process_lhe = fname;
    if (process_lhe.BeginsWith("WJets"))
        process_lhe = "WJets";
    else if (process_lhe.BeginsWith("ZJets"))
        process_lhe = "ZJets";
    else 
        process_lhe = "";
    const std::vector<std::string>& lhecuts = GetLHECuts(process_lhe.Data());
    for (unsigned int i=0; i < lhecuts.size(); i++) {
        TCut cut2 = lhecuts.at(i).c_str();
        h2->SetBinContent(i+1, chain->GetEntries(cut2));
    }
    
    

    // Make output directory if it doesn't exist
    if (gSystem->AccessPathName(outdir))
        gSystem->mkdir(outdir);
    TString outname = outdir + prefix + Form("%s.root", outputname.Data());
    std::cout << "outname is " << outname << std::endl;

    TFile* f1 = TFile::Open(outname, "RECREATE");
    TTree* t1 = (TTree*) chain->CopyTree(selection);
    std::clog << fname << ": skimmed from " << chain->GetEntriesFast() << " to " << t1->GetEntriesFast() << " entries." << std::endl;
    
    t1->Write();
    h1->Write();
     h2->Write();
    f1->Close();

    return;
}
Exemplo n.º 11
0
void makeTree(string sample = "DY", string selection = "", float Lumi = 1){

  vector<pair<string,float> > files;
  vector< TH1F* > histos;

  vector<string> directories;
  
  if(sample.find("DY")!=string::npos){
    files.push_back( make_pair("DY-madgraph-10to50.root",      (310*0.19*Lumi)  ) );
    files.push_back( make_pair("DY-madgraph-50.root",          (2289*0.56*Lumi)  ) );
  }
  
  if(sample.find("Wjets")!=string::npos){
    files.push_back( make_pair("W1Jets_ptW-0to100.root",       (3.693e+03*0.44*Lumi)  ) );
    files.push_back( make_pair("W1Jets_ptW-100to300.root",     (7.197e+01*0.58*Lumi)  ) );
    files.push_back( make_pair("W1Jets_ptW-300to800.root",     (5.658e-01*0.73*Lumi)  ) );
    files.push_back( make_pair("W2Jets_ptW-0to100.root",       (9.434e+02*0.46*Lumi)  ) );
    files.push_back( make_pair("W2Jets_ptW-100to300.root",     (6.718e+01*0.59*Lumi)  ) );
    files.push_back( make_pair("W2Jets_ptW-300to800.root",     (8.553e-01*0.75*Lumi)  ) );
    files.push_back( make_pair("W3Jets_ptW-0to100.root",       (2.087e+02*0.48*Lumi)  ) );
    files.push_back( make_pair("W3Jets_ptW-100to300.root",     (3.243e+01*0.60*Lumi)  ) );
    files.push_back( make_pair("W3Jets_ptW-300to800.root",     (6.229e-01*0.76*Lumi)  ) );
    files.push_back( make_pair("W4Jets_ptW-0to100.root",       (4.446e+01*0.50*Lumi)  ) );
    files.push_back( make_pair("W4Jets_ptW-100to300.root",     (1.138e+01*0.61*Lumi)  ) );
    files.push_back( make_pair("W4Jets_ptW-300to800.root",     (2.950e-01*0.77*Lumi)  ) );
    files.push_back( make_pair("W5Jets_ptW-0to100.root",       (1.111e+01*0.53*Lumi)  ) );
    files.push_back( make_pair("W5Jets_ptW-100to300.root",     (3.789e+00*0.65*Lumi)  ) );
    files.push_back( make_pair("W5Jets_ptW-300to800.root",     (1.565e-01*0.79*Lumi)  ) );
  }
  if(sample.find("TT")!=string::npos){
    files.push_back( make_pair("TT.root",                      (94*Lumi)  ) );
  }
  if(sample.find("QCD")!=string::npos){
    files.push_back( make_pair("QCD_Pt-0to5.root",             (4.84e+10*6.07E-07*Lumi)) );
    files.push_back( make_pair("QCD_Pt-5to15.root",            (3.68e+10*1.82E-06*Lumi)) );
    files.push_back( make_pair("QCD_Pt-15to30.root",           (8.16e+08*0.000113*Lumi)) );
    files.push_back( make_pair("QCD_Pt-30to50.root",           (5.31e+07*0.00388126*Lumi)) );
    files.push_back( make_pair("QCD_Pt-50to80.root",           (6.36e+06*0.02321727*Lumi)) );
    files.push_back( make_pair("QCD_Pt-80to120.root",          (7.84e+05*0.06100585*Lumi)) );
    files.push_back( make_pair("QCD_Pt-120to170.root",         (1.15e+05*0.11389810*Lumi)) );
    files.push_back( make_pair("QCD_Pt-170to300.root",         (2.43e+04*0.13732413*Lumi)) );
    files.push_back( make_pair("QCD_Pt-300to470.root",         (1.17e+03*0.317390358*Lumi)) );
    files.push_back( make_pair("QCD_Pt_470to600.root",         (7.02e+01*0.431763719*Lumi)) );
    files.push_back( make_pair("QCD_Pt_600to800.root",         (1.56e+01*0.508048972*Lumi)) );
    files.push_back( make_pair("QCD_Pt_800to1000.root",        (1.84e+00*0.385363968*Lumi)) );
    files.push_back( make_pair("QCD_Pt_1000to1400.root",       (3.32e-01*0.661857989*Lumi)) );
    //files.push_back( make_pair("QCD_Pt_1400to1800.root",       (1.09e-02*0.784767648*Lumi)) );
  }

  
  directories.push_back("etoTauMargLooseNoCracks80");
  directories.push_back("etoTauMargLooseNoCracks70");
  directories.push_back("etoTauMargLooseNoCracks60");
  directories.push_back("etoTauMargMediumNoCracks80");
  directories.push_back("etoTauMargMediumNoCracks70");
  directories.push_back("etoTauMargMediumNoCracks60");
  directories.push_back("etoTauMargTightNoCracks80");
  directories.push_back("etoTauMargTightNoCracks70");
  directories.push_back("etoTauMargTightNoCracks60");

  directories.push_back("etoTauSCMargNoCracks80");
  directories.push_back("etoTauSCMargNoCracks70");
  directories.push_back("etoTauSCMargNoCracks60");
    

  TFile *outFile = new TFile(("testNewWriteFromPAT_soup"+selection+".root").c_str(),"RECREATE");
  
  int numFiles = 0;

  for(unsigned int j = 0; j<directories.size(); j++){

    numFiles = 0;

    histos.clear();

    for(unsigned int i = 0; i<files.size();i++){
      histos.push_back( new TH1F(Form("h_%d",i),Form("file %s",(files[i].first).c_str()),20,40,120) );
    }

    THStack* aStack = new THStack("aStack","");
    TLegend* leg = new TLegend(0.1331269,0.5926573,0.3622291,0.8671329,NULL,"brNDC");
    leg->SetFillStyle(4000);
    leg->SetBorderSize(0);
    leg->SetFillColor(10);
    leg->SetTextSize(0.03);

    cout << "Directory " <<  directories[j] << endl;

    TChain* outChain = new TChain((directories[j]+"/fitter_tree").c_str());

    int counter = 0;
    for(unsigned int i = 0; i<files.size();i++){

      TFile *file = new TFile(("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first).c_str(),"READ");
      if(file->IsZombie()){
	cout << "No file " << files[i].first << " is found" << endl;
	continue;
      }

      file->cd("allEventsFilter");
      TH1F* totalEvents = (TH1F*)gDirectory->Get("totalEvents");
      float readEvents = totalEvents->GetBinContent(1);

      file->cd(directories[j].c_str());
      TTree *oldTree = (TTree*) gDirectory->Get("fitter_tree");

      float scaleToNNLO = 1.0;
      if((files[i].first).find("DY")!=string::npos)    scaleToNNLO = 1.33;
      if((files[i].first).find("W")!=string::npos)     scaleToNNLO = 1.23;
      if((files[i].first).find("TT")!=string::npos)    scaleToNNLO = 1.75;
     
      int entries = std::min( (int)oldTree->GetEntries(),  
			      (int)(((files[i].second*scaleToNNLO)/readEvents)*oldTree->GetEntries()) );

      TFile *newFile = new TFile( ("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first+"new").c_str(), "RECREATE");
      TDirectory* dir = (TDirectory*) newFile->mkdir(directories[j].c_str());
      TTree *tree = oldTree->CloneTree( entries );

      // weight for the tree: 1 if you require less than the overall tree entries, otherwise set it to L*sigma/processed 
      //float weight = std::max((double)files[i].second,1.0);
      //tree->SetWeight( weight );
      double weight;
      tree->Branch("weight", &weight,"weight/D");
      weight = std::max((double)(files[i].second/readEvents),1.0);
      tree->Fill();

      TH1F* h = new TH1F("h","",20,40,120);
      tree->Draw("mass>>h",("weight*("+selection+")").c_str());
      histos[i]->Add(h,1);
      histos[i]->SetFillColor(i+1);
      histos[i]->SetLineColor(i+1);
      //setUpHisto(histos[i],Lumi, directories[j]);
      aStack->Add( histos[i] );
      leg->AddEntry( histos[i], (files[i].first).c_str(),"F");

      dir->cd();
      tree->Write();
      newFile->Write();

      counter+=entries;

      cout << files[i].first 
	   << " ==> total entries " << oldTree->GetEntries() 
	   << " --- Required " <<  (int)(files[i].second/readEvents*oldTree->GetEntries())
	   << " --- Provided " << entries
	   <<  endl;
      std::cout << "The tree will have weight: " << weight << std::endl; 
      //outTree->CopyEntries(tree,entries);

      if(entries>0){
	int isOK =  outChain->AddFile( ("/data_CMS/cms/lbianchini/35pb/testNewWriteFromPAT_"+files[i].first+"new").c_str());
	if( isOK == 0) cout << "No linked file" << endl;
	numFiles += isOK;
      }
      cout << " outChain has " << outChain->GetEntries() 
	   << " and attached files " << numFiles
	   << endl;

      file->Close();
      newFile->Close();
      //delete h;
      delete file;
      delete newFile;
    } // file

    //outFile->cd();
    TDirectory* dir = (TDirectory*) outFile->mkdir(directories[j].c_str());
    
    TTree* outTree = (TTree*) outChain->CopyTree("");
  
    //outTree->Draw("mass");

    cout<< "Total events copied in output directory " << outTree->GetEntries() << " from requested " << counter << endl;

    dir->cd();
    outTree->Write("", TObject::kOverwrite);

    TCanvas *c1 = new TCanvas("c1","stacked mass",10,30,650,600);
    c1->SetGrid(0,0);
    c1->SetFillStyle(4000);
    c1->SetFillColor(10);
    c1->SetTicky();
    c1->SetObjectStat(0);

    aStack->Draw("HIST");

    setUpHisto( (TH1F*)aStack->GetHistogram(), Lumi, directories[j] );
    leg->SetHeader(directories[j].c_str());
    leg->Draw(); 
    c1->Write();

    for(int i = 0; i<histos.size(); i++){
      delete histos[i];
    }
    delete aStack;
    delete leg;

  }//directories

  


  outFile->Write();
  outFile->Close();
  delete outFile;

}
Exemplo n.º 12
0
void makeT2ttSkims(){

  char* path = "/home/users/dalfonso/CMSSW_5_3_2_patch4_V05-03-21/src/SingleLepton2012/macros/MiniBabyMaker/output";

  //--------------------------------------------------
  // path and input file
  //--------------------------------------------------

  const unsigned int n = 5;

  char* cuts[n];
  char* names[n];

  cuts[0] = "mg < 340 && mg-ml > 160";                   names[0] = "T2tt_1";
  cuts[1] = "mg > 340 && mg-ml > 160 && mg-ml < 280";    names[1] = "T2tt_2";
  cuts[2] = "mg > 340 && mg-ml > 280 && mg-ml < 480";    names[2] = "T2tt_3";
  cuts[3] = "mg > 340 && mg-ml > 480";                   names[3] = "T2tt_4";
  cuts[4] = "mg-ml < 160";                               names[4] = "T2tt_5";

  //--------------------------------------------------
  // cut for output files
  //--------------------------------------------------
  
  for (int i=3; i<4;++i) {

    //--------------------------------------------------
    // input and output file
    //--------------------------------------------------
  
    char* infilename  = Form("%s/merged*root",path);
    char* outfilename = Form("T2ttSkims/%s.root",names[i]);
    TCut sel = TCut(cuts[i]);

    //--------------------------------------------------
    // cout stuff
    //--------------------------------------------------
    
    cout << "Reading in : " << infilename << endl;
    cout << "Writing to : " << outfilename << endl;
    cout << "Selection  : " << sel << endl;
    
    //--------------------------------------------------
    // read input file, write to output files
    //--------------------------------------------------
    
    long long max_tree_size = 20000000000000000LL;
    TTree::SetMaxTreeSize(max_tree_size);
    
    TChain *chain = new TChain("t");
    chain->Add(infilename);

    cout << "Input tree has entries                   : " << chain->GetEntries() << endl;
    cout << "Input tree has entries after selection   : " << chain->GetEntries(TCut(sel)) << endl;

    //-------------------
    // skim
    //-------------------
    
    TFile *outfile = TFile::Open(outfilename, "RECREATE");
    assert( outfile != 0 );
    TTree* outtree = chain->CopyTree( sel );
    cout << "Output tree has entries                  : " << outtree->GetEntries() << endl;
    cout << "Output tree has entries after selection  : " << outtree->GetEntries(TCut(sel)) << endl;
    outtree->Write();
    outfile->Close();

  }  
}