Ejemplo n.º 1
0
bool jets_RA5(EasyChain* tree,vector<int>& goodJets){

	static ConfigReader config;
	// static since we read only once
	static float jet_pt_min  = config.getFloat("jet_pt_min",   30);
	static float jet_eta_max = config.getDouble("jet_eta_max",2.4);
	static bool  quick       = config.getBool("quick");

	// static to get the cut flow for all events
	static CutSet jetFlow("good jet selection");
	// print at end of program and dump into histogram file
	jetFlow.autoprint=true;
	jetFlow.autodump=true;

	vector<int>&       JetID = tree->Get(&JetID,"ak5JetPFPFJetIDloosePat");
	vector<LorentzM>&   Jets = tree->Get(&Jets, "ak5JetPFCorrectedP4Pat");
	int cntJets=0;

	for(int k = 0; k<Jets.size(); k++){
		if( !jetFlow.keepIf("pt>=jet_min",              Jets[k].pt()   >= jet_pt_min  ) && quick) continue;
		if( !jetFlow.keepIf("eta<=eta_max",        fabs(Jets[k].eta()) <= jet_eta_max ) && quick) continue;
		if( !jetFlow.keepIf("ak5JetPFPFJetIDloosePat", JetID[k]!=0 )                    && quick) continue;
		goodJets.push_back(k);
	}

	return goodJets.size() >= 2;
}
Ejemplo n.º 2
0
bool cleaningFilters::goodVertices(EasyChain* tree, vector<int>& goodVert){

  ConfigReader config;
  bool isData=config.getBool("isData");

  float Z_Data    = config.getFloat( "VertexZ_Data",   24.);
  float Rho_Data  = config.getFloat( "VertexRho_Data",  2.);
  float NDOF_Data = config.getFloat( "VertexNDOF_Data", 4.);

  float Z_MC    = config.getFloat( "VertexZ_MC",   24.);
  float Rho_MC  = config.getFloat( "VertexRho_MC",  2.);
  float NDOF_MC = config.getFloat( "VertexNDOF_MC", 4.);

  if(pcp)cout<<"================INSIDE THE VERTICES PROGRAM===================="<<endl;
  if(pcp)cout<<"getting the Vertices from the tree"<<endl;

  vector<XYZPointF>& vertices       = tree->Get( &vertices,      "vertexPosition");
  vector<int>&       vertex_isFake  = tree->Get( &vertex_isFake, "vertexIsFake"  );
  vector<float>&     vertex_ndof    = tree->Get( &vertex_ndof,   "vertexNdof"    );
  vector<int>&       vertex_nTracks = tree->Get( &vertex_nTracks,"vertexNtrks"   );

  if( vertices.size() == 0 ) return false;

  if(pcp)cout<<"loop over the vertices"<<endl;
  for( unsigned vx=0; vx < vertices.size(); ++vx ) {

    if( vertex_isFake.at(vx) ) continue;

    if( isData ){
      // data
      if( fabs(vertices.at(vx).z()) > Z_Data )     continue;
      if( fabs(vertices.at(vx).rho()) > Rho_Data ) continue;
      if( vertex_ndof.at(vx) <= NDOF_Data )        continue;
      goodVert.push_back(vx);
    } else {
      // MC
      if( fabs(vertices.at(vx).z()) > Z_MC ) continue;
      if( vertices.at(vx).rho() > Rho_MC )   continue;
      if( vertex_ndof.at(vx) <= NDOF_MC )    continue;
      goodVert.push_back(vx);
    }
  }

  return goodVert.size()>0;
}