コード例 #1
0
  //// MAIN ////
  int main(int argc, char* argv[]){
    gROOT->ProcessLine("#include <vector>"); // allow branches of vectors

    //// Configuration Parameters ////
    string pdfset = pdfset_default; //  cteq6ll.LHpdf, cteq6m.LHpdf, CT10.LHgrid, MSTW2008nlo68cl.LHgrid
    float changefacscale=1.0;
    float changerenscale=1.0;
    string output_filename = output_filename_default;
    vector<string> fs;  // Input Blackhat files
    int min_jet_n = AUTO_MIN_JET_N; // will determine cut from file name if not changed
    mettype met_from = VISIBLEMCPARTICLES;
    bool use_only_leading_clep = 1;
    
    //// Selection Cuts ////
    // Jet cuts
    double R = 0.5;  // R for jet clustering
    double dress_clep_R = 0.1;  // deltaR to use for dressing leptons (doesn't actually matter because leptons are from ME)
    JetDefinition jet_def(antikt_algorithm, R);
    double min_jet_pt = 30;  // minimum pt of any jet
    double max_jet_eta = 2.4;  // maximum eta of any jet
    double min_dR_jet_clep = 0.5;  // minimum deltaR between and jet and the charged lepton
    // Other cuts
    double min_clep_pt = 25;  // minimum pt of charged lepton
    double max_clep_eta = 2.1;  // maximum eta of charged lepton
    double min_MT = 50;  // minimum MT
    double max_MT = 1e6; // maximim MT  Should I have an upper bound at 110 GeV?    

    string arg;
    for(int i=1; i<argc; ++i){
      arg = argv[i];

      if(arg == "-o" ||
	 arg == "-out" ||
	 arg == "-output" ||
	 arg == "-outfile" ){
	if(argc>i){
	  ++i;
	  output_filename = argv[i];
	}else{
	  cout<<"You did not specify an output file name after "<<arg<<endl;
	  return print_help(1);
	}
	
      }else if(arg == "-pdf" ||
	       arg == "-PDF" ||
	       arg == "-pdfset" ){
	if(argc>i){
	  ++i;
	  pdfset = argv[i];
	}else{
	  cout<<"You did not specify a PDF set after "<<arg<<endl;
	  return print_help(1);
	}

      }else if(arg == "-ren" ){
	if(argc>i){
	  ++i;
	  istringstream ss(argv[i]);
	  if((ss >> changerenscale).fail()){
	    return print_help(2);
	  }
	}else{
	  cout<<"You did not specify a value after "<<arg<<endl;
	  return print_help(1);
	}

      }else if(arg == "-fac" ){
コード例 #2
0
void JetPythiaAnalysis::Loop()
{
  
  if (fChain == 0) return;
  
  Long64_t nentries = fChain->GetEntriesFast();
  Long64_t nbytes = 0, nb = 0;
  
  //Definir el tipo de Algoritmo para reconstruir Jets y pasarle el parametro requerido
  double R = 0.7;
  fastjet::JetDefinition jet_def(fastjet::kt_algorithm, R);

  //Definir un histograma para el momento transversal de los Jets
  TH1F * h_JetPt = new TH1F("JetsPt","Momento transversal de Jets ",50, 0, 100);
  
  //Inicia el Ciclo sobre eventos simulados
  for (Long64_t jentry=0; jentry<nentries;jentry++) { 
    
    Long64_t ientry = LoadTree(jentry);
    if (ientry < 0) break;
    nb = fChain->GetEntry(jentry);   nbytes += nb;
    
    int np = 0;
    int max_part = particles_; //Maximo numero de particulas

    // Definit un contenedor de Particulas para pasarle a FastJet
    std::vector<fastjet::PseudoJet> particles;
    
    //Implementar aqui el analisis
    while ( np < max_part )  {
      
      //llenar aqui con las particulas estables: estas particulas serian aquellas que no tienen hijas

      if ( (particles_fDaughter[np][0] == -1) && (particles_fDaughter[np][1] == -1) ) 
      {

        bool isDetectable = true;

        // tenemos que saltarnos aquellas particulas que aun siendo estables, no serian detectables directables
	// 12 = nu_e ; 14 = nu_mu ; 16 = nu_tau ; 10000022 = SUSY LSP / neutrinalino

        if ( abs (particles_fPdgCode[np]) == 12 || 
	     abs (particles_fPdgCode[np]) == 14 || 
	     abs (particles_fPdgCode[np]) == 16 || 
	     abs (particles_fPdgCode[np]) == 10000022 )
			isDetectable = false;

        // lenamos el contenedor con particulas estables
        if( isDetectable ) particles.push_back( fastjet::PseudoJet( particles_fPx[np], 
                          	                                    particles_fPy[np],
                          	                                    particles_fPz[np],
                          	                                    particles_fE[np] ) );
      
      }
      
      ++np;
      
    }
     
    
    if ( particles.size() <= 0 )
      continue;
    
    // Corremos ahora FastJet: hacer sobre las particulas la identificacion de Jets
    fastjet::ClusterSequence Cluster(particles, jet_def);

    // Objeto Cluster contiene los jets: podemos guardarlos en un contenedor de Jets
    std::vector<fastjet::PseudoJet> jets = Cluster.inclusive_jets();
    
    // Ahora podemos hacer un ciclo sobre los jets reconstruidos y extraer el momento transversal
    // - llenar histograma

    for (unsigned i = 0; i < jets.size(); i++) {

      h_JetPt->Fill( jets[i].perp() );
      
    }

    jets.clear(); //Limpiar el contenedor de jets y particulas en preparacion para el proximo evento
    particles.clear();

    
  }//cierra loop sobre eventos  

  // Dibujar la distribucion de momento transversal
  h_JetPt->Draw();
    
  //termina Loop() limpiar memoria

  

}
コード例 #3
0
ファイル: Analysis.C プロジェクト: francescorubbo/VariableR
Bool_t Analysis::Process(Long64_t entry)
{

  jpt  ->clear();    
  jeta ->clear(); 
  jphi ->clear(); 
  jmass->clear();
  jconst->clear();
  toppt->clear();
  jhasb->clear();
  jhasq->clear();
  
  if (entry%1==0) cout << "\r Events  " << entry << "\r" << flush;
  this->GetEntry(entry);
    
  double rho = 2*173.5;
  double min_r = 0.4;
  double max_r = 1.5;
  double ptmin = 200.;

  // fill jets
  //-----------------------------------------------
  vector<fastjet::PseudoJet> pseudojets; pseudojets.clear();
  for (int ijet=0;ijet<jets_n;++ijet){
    if(jets_isBad->at(ijet)!=0) return kFALSE;
    if(jets_pt->at(ijet)<20.) continue;
    if(fabs(jets_eta->at(ijet))>2.8) continue;
    TLorentzVector tvit = TLorentzVector();
    tvit.SetPtEtaPhiE(jets_pt->at(ijet),
		      jets_eta->at(ijet),
		      jets_phi->at(ijet),
		      jets_e->at(ijet));
    pseudojets.push_back( fastjet::PseudoJet(tvit.Px(), tvit.Py(), 
					     tvit.Pz(), tvit.E()) );
  }

  // fill truth
  //----------------------------------------------
  vector<int> tops;
  vector<int> Wq1s;
  vector<int> Wq2s;
  vector<int> bs;
  for (int imc=0;imc<mc_n;++imc)
    if (fabs(mc_pdgId->at(imc))==6){
      int windex = mc_children_index->at(imc)[0];
      int bindex = mc_children_index->at(imc)[1];
      int wq1 = mc_children_index->at(windex)[0];
      int wq2 = mc_children_index->at(windex)[1];
      if(fabs(mc_pdgId->at(wq1))>5 || fabs(mc_pdgId->at(wq2))>5) continue;
      tops.push_back( imc );
      Wq1s.push_back( wq1 );
      Wq2s.push_back( wq2 );
      bs.push_back( bindex );
      toppt->push_back( mc_pt->at(imc) );
    }//endif

  for (int it=0;it<tops.size();++it){
    fastjet::PseudoJet wq1; wq1.reset_PtYPhiM(1e-10,mc_eta->at(Wq1s[it]),mc_phi->at(Wq1s[it]));
    fastjet::PseudoJet wq2; wq2.reset_PtYPhiM(1e-10,mc_eta->at(Wq2s[it]),mc_phi->at(Wq2s[it]));
    fastjet::PseudoJet bq; bq.reset_PtYPhiM(1e-10,mc_eta->at(bs[it]),mc_phi->at(bs[it]));
    wq1.set_user_info(new MyUserInfo(it, false));
    wq1.set_user_info(new MyUserInfo(it, false));
    bq.set_user_info(new MyUserInfo(it, true));
    pseudojets.push_back( wq1 );
    pseudojets.push_back( wq2 );
    pseudojets.push_back( bq );
  }// top loop

  fastjet::contrib::VariableRPlugin lvjet_pluginAKT(rho, min_r, max_r, fastjet::contrib::VariableRPlugin::AKTLIKE);
  fastjet::JetDefinition jet_def(&lvjet_pluginAKT);
  fastjet::ClusterSequence clust_seqAKT(pseudojets, jet_def);
  vector<fastjet::PseudoJet> inclusive_jetsAKT = clust_seqAKT.inclusive_jets(ptmin);

  for (int ijet=0;ijet<inclusive_jetsAKT.size();++ijet){
    fastjet::PseudoJet *jet = &(inclusive_jetsAKT[ijet]);
    jpt->push_back( jet->pt() );
    jeta->push_back( jet->eta() );
    jphi->push_back( jet->phi() );
    jmass->push_back( jet->m() );
    int ntruth=0;
    vector<int> hasb;
    vector<int> hasq;
    for (int iconst=0;iconst<jet->constituents().size();++iconst){
      fastjet::PseudoJet *jetconst = &(jet->constituents()[iconst]);
      if (jetconst->has_user_info<MyUserInfo>()){
	ntruth++;
	int topid = jetconst->user_info<MyUserInfo>().top();
	bool isbq = jetconst->user_info<MyUserInfo>().isbq();
	if(isbq) hasb.push_back(topid);
	else hasq.push_back(topid);
      }//endif is truth
    }//loop constituents
    jconst->push_back( jet->constituents().size()-ntruth );
    jhasb->push_back( hasb );
    jhasq->push_back( hasq );
  }// loop reclustered jets

  outtree->Fill();

  return kTRUE;
}