コード例 #1
0
ファイル: testTDime.C プロジェクト: alisw/AliRoot
void testTDime(Int_t nev = 100) {

  gSystem->Load("libEVGEN");
  gSystem->Load("libTDime");
  gSystem->Load("libdime");

  TDime* dime = new TDime();
  dime->SetEnergyCMS(7000.0);
  dime->SetYRange(-2.0, 2.0);   // Set rapidity range of mesons
  dime->SetMinPt(0.1);          // Minimum pT of mesons
  dime->Initialize();

  // (pi+pi-) histograms
  TH1* hM = new TH1D("hM", "DIME #pi^{+}#pi^{-};M_{#pi^{+}#pi^{-}} #[]{GeV/#it{c}^{2}}", 100,  0.0, 5.0);

  TClonesArray* particles = new TClonesArray("TParticle", 6);
  TParticle* part = NULL;
  TLorentzVector v[2];
  TLorentzVector vSum;

  // Event loop
  for (Int_t i = 0; i < nev; ++i) {

    dime->GenerateEvent();
    Int_t np = dime->ImportParticles(particles, "All");
    printf("\n DIME Event %d: Imported %3d particles \n", i, np);

    Int_t nPrimary = 0;

    // Loop over pion (j = 4,5) tracks
    for (Int_t j = 4; j < 6; ++j) {
      part = (TParticle*) particles->At(j); // Choose the particle
      part->Print();
      part->Momentum(v[nPrimary]);          // Copy content to v
      nPrimary++;
    }
    //particles.Clear();

    // 4-vector sum
    vSum = v[0] + v[1];

    // Fill pi+pi- histograms
    hM->Fill(vSum.M());
  }

  // Save plots as pdf
  hM->Draw();    c1->SaveAs("massTDime.pdf");

}
コード例 #2
0
ファイル: Kin2Txt.C プロジェクト: alisw/AliRoot
void Kin2Txt() {
  AliRunLoader* rl = AliRunLoader::Open("galice.root");
  rl->LoadKinematics();
  rl->LoadHeader();

  TH1* hM  = new TH1D("hM",  "TreeK;M#(){#pi^{+}#pi^{-}} #(){GeV/#it{c}^{2}}", 100, 0., 2.);
  TH1* hPt = new TH1D("hPt", "TreeK;P_{T}#(){#pi^{+}#pi^{-}} #(){GeV/#it{c}}", 100, 0., 1.);
  TH1* hY  = new TH1D("hY",  "TreeK;Y#(){#pi^{+}#pi^{-}}",                     160,-8., 8.);
  std::ofstream ofs("rho0.txt");
  
  AliStack *stack = NULL;
  TParticle *part = NULL;
  TLorentzVector v[2], vSum;
  for (Int_t i=0, n(rl->GetNumberOfEvents()); i<n; ++i) {
    rl->GetEvent(i);
    stack = rl->Stack();

    Int_t nPrimary(0);
    for (Int_t j(0), m(stack->GetNtrack()); j<m; ++j) {
      part = stack->Particle(j);
      if (part->IsPrimary())
	part->Momentum(v[nPrimary++]);
    }
    if (nPrimary != 2) {
      Printf("Error: nPrimary=%d != 2", nPrimary);
      continue;
    }
    vSum = v[0] + v[1];
    hM->Fill(vSum.M());
    hPt->Fill(vSum.Perp());
    hY->Fill(vSum.Rapidity());
    ofs << std::fixed << std::setprecision(4)
	<< vSum.M() << " " << vSum.Perp() << " " << vSum.Rapidity() << " "
	<< v[0].Eta() << " " << v[0].Px() << " " << v[0].Py() << " " << v[0].Pz() << " "
	<< v[1].Eta() << " " << v[1].Px() << " " << v[1].Py() << " " << v[1].Pz()
	<< std::endl;
  }
  hM->Draw();
  c1->SaveAs("TreeK.pdf(");
  hPt->Draw();
  c1->SaveAs("TreeK.pdf");
  hY->Draw();
  c1->SaveAs("TreeK.pdf)");
}
コード例 #3
0
ファイル: plots.C プロジェクト: alisw/AliRoot
void plots() {

  gSystem->Load("libEVGEN"); // Needs to be!

  AliRunLoader* rl = AliRunLoader::Open("galice.root");
  rl->LoadKinematics();
  rl->LoadHeader();

  // 4pi histograms
  TH1* hM    = new TH1D("hM",  "DIME #rho#rho;M_{4#pi} #(){GeV/#it{c}^{2}}", 100,  1.0, 3.0);
  TH1* hPt   = new TH1D("hPt", "DIME #rho#rho;p_{T}#(){4#pi} #(){GeV/#it{c}}", 100,  0.0, 3.0);

  // pi+- histograms
  TH1* hPt1   = new TH1D("hPt1", "DIME #rho#rho;p_{T}#(){#pi^{#pm}} #(){Gev/#it{c}}",  100, 0.0, 3.0);

  AliStack* stack = NULL;
  TParticle* part = NULL;
  TLorentzVector v[4];
  TLorentzVector vSum;

  // Loop over events
  for (Int_t i = 0; i < rl->GetNumberOfEvents(); ++i) {

    rl->GetEvent(i);
    stack = rl->Stack();
    Int_t nPrimary = 0;

    // Loop over all particles
    for (Int_t j = 0; j < stack->GetNtrack(); ++j) {
      part = stack->Particle(j);           // Get particle
      part->Print();                       // Print contents

      if (abs(part->GetPdgCode()) == 211   // Is pi+ or pi-
          & part->GetStatusCode() == 1     // Is stable final state
          & stack->IsPhysicalPrimary(j)) { // Is from generator level

        part->Momentum(v[nPrimary]);       // Set content of v
        ++nPrimary;
      }
    }
    if (nPrimary != 4) {
      printf("Error: nPrimary=%d != 4 \n", nPrimary);
      continue;
    }

    // 4-vector sum
    vSum = v[0] + v[1] + v[2] + v[3];

    // Fill 4pi histograms
    hM->Fill(vSum.M());
    hPt->Fill(vSum.Perp());

    // Fill pi+- histograms
    for (Int_t k = 0; k < 4; ++k) {
      hPt1->Fill(v[k].Perp());
    }
    printf("\n");
  }

  // Save plots as pdf
  hM->Draw();    c1->SaveAs("plotM.pdf");
  hPt->Draw();   c1->SaveAs("plotPt.pdf");
  hPt1->Draw();  c1->SaveAs("plotPt1.pdf");

}
コード例 #4
0
ファイル: Flaggator_H4j.cpp プロジェクト: Bicocca/UserCode
//!PG main function
int 
  selector (TChain * tree, histos & plots, int if_signal)
{
 
 plots.v_Jet_1_Pt = -99;
 plots.v_Jet_2_Pt = -99;
 plots.v_Jet_3_Pt = -99;
 plots.v_Jet_4_Pt = -99;
 plots.v_Jet_5_Pt = -99;
 plots.v_Jet_6_Pt = -99;

 plots.v_Jet_1_x = -99;
 plots.v_Jet_2_x = -99;
 plots.v_Jet_3_x = -99;
 plots.v_Jet_4_x = -99;
 plots.v_Jet_5_x = -99;
 plots.v_Jet_6_x = -99;

 plots.v_Jet_1_y = -99;
 plots.v_Jet_2_y = -99;
 plots.v_Jet_3_y = -99;
 plots.v_Jet_4_y = -99;
 plots.v_Jet_5_y = -99;
 plots.v_Jet_6_y = -99;

 plots.v_Jet_1_z = -99;
 plots.v_Jet_2_z = -99;
 plots.v_Jet_3_z = -99;
 plots.v_Jet_4_z = -99;
 plots.v_Jet_5_z = -99;
 plots.v_Jet_6_z = -99;

 plots.v_Jet_1_e = -99;
 plots.v_Jet_2_e = -99;
 plots.v_Jet_3_e = -99;
 plots.v_Jet_4_e = -99;
 plots.v_Jet_5_e = -99;
 plots.v_Jet_6_e = -99;
 
 plots.v_Jet_1_eta = -99;
 plots.v_Jet_2_eta = -99;
 plots.v_Jet_3_eta = -99;
 plots.v_Jet_4_eta = -99;
 plots.v_Jet_5_eta = -99;
 plots.v_Jet_6_eta = -99;
 
 plots.v_Jet_1_phi = -99;
 plots.v_Jet_2_phi = -99;
 plots.v_Jet_3_phi = -99;
 plots.v_Jet_4_phi = -99;
 plots.v_Jet_5_phi = -99;
 plots.v_Jet_6_phi = -99;
 
 plots.v_Jet_1_DR = -99;
 plots.v_Jet_2_DR = -99;
 plots.v_Jet_3_DR = -99;
 plots.v_Jet_4_DR = -99;
 plots.v_Jet_5_DR = -99;
 plots.v_Jet_6_DR = -99;
 
 plots.v_numEle = -99;
 plots.v_numMu = -99;
 plots.v_numJets = -99;
 plots.v_totNumJets = -99;
  
 
//  TClonesArray * tagJets = new TClonesArray ("TLorentzVector") ; 
//  tree->SetBranchAddress ("tagJets", &tagJets) ;
 TClonesArray * otherJets_temp = new TClonesArray ("TLorentzVector") ;
 tree->SetBranchAddress (g_KindOfJet.c_str(), &otherJets_temp) ;
//  tree->SetBranchAddress ("otherJets", &otherJets_temp) ;
 
 
 TClonesArray * electrons = new TClonesArray ("TLorentzVector") ;
 tree->SetBranchAddress ("electrons", &electrons) ;
 TClonesArray * muons = new TClonesArray ("TLorentzVector") ;
 tree->SetBranchAddress ("muons", &muons) ;
 TClonesArray * MET = new TClonesArray ("TLorentzVector") ;
 tree->SetBranchAddress ("MET", &MET) ;
 TClonesArray * tracks = new TClonesArray ("TLorentzVector") ;
 tree->SetBranchAddress ("tracks", &tracks) ;
 
 TClonesArray * tagJets = new TClonesArray ("TLorentzVector") ; 
 TClonesArray * otherJets = new TClonesArray ("TLorentzVector") ;
 
 
 TClonesArray * HiggsParticle = new TClonesArray ("TParticle") ;
 tree->SetBranchAddress ("HiggsParticle", &HiggsParticle) ;
 
  
 int EleId[100];
 float IsolEleSumPt_VBF[100];
 int nEle;
 tree->SetBranchAddress ("nEle", &nEle) ;
 tree->SetBranchAddress ("EleId",EleId ) ;
 tree->SetBranchAddress ("IsolEleSumPt_VBF",IsolEleSumPt_VBF ) ;

 float IsolMuTr[100];
 int nMu ;
 tree->SetBranchAddress ("nMu", &nMu) ;
 tree->SetBranchAddress ("IsolMuTr",IsolMuTr ) ;

 int IdEvent;
 tree->SetBranchAddress ("IdEvent", &IdEvent) ;
 
 
 int nentries = (int) tree->GetEntries () ;

 
 plots.passedJetAndLepNumberSelections = 0;
 plots.analyzed = 0;
 
 //PG loop over the events
//  std::cerr << " --- nentries = " << nentries << std::endl;
//  nentries = std::min(10000,nentries);
//  nentries = 10000;
 
 if (g_numEvents!= -1) nentries = std::min(g_numEvents,nentries);

 std::cerr << " --- nentries = " << nentries << std::endl;
 
 for (int evt = 0 ; evt < nentries ; ++evt)
 {
  if (!(evt%1000)) std::cerr << " --- evt = " << evt << std::endl;
  
  plots.v_Jet_1_Pt = -99;
  plots.v_Jet_2_Pt = -99;
  plots.v_Jet_3_Pt = -99;
  plots.v_Jet_4_Pt = -99;
  plots.v_Jet_5_Pt = -99;
  plots.v_Jet_6_Pt = -99;
  plots.v_Jet_7_Pt = -99;
  plots.v_Jet_8_Pt = -99;
  
  plots.v_Jet_1_x = -99;
  plots.v_Jet_2_x = -99;
  plots.v_Jet_3_x = -99;
  plots.v_Jet_4_x = -99;
  plots.v_Jet_5_x = -99;
  plots.v_Jet_6_x = -99;
  plots.v_Jet_7_x = -99;
  plots.v_Jet_8_x = -99;

  plots.v_Jet_1_y = -99;
  plots.v_Jet_2_y = -99;
  plots.v_Jet_3_y = -99;
  plots.v_Jet_4_y = -99;
  plots.v_Jet_5_y = -99;
  plots.v_Jet_6_y = -99;
  plots.v_Jet_7_y = -99;
  plots.v_Jet_8_y = -99;

  plots.v_Jet_1_z = -99;
  plots.v_Jet_2_z = -99;
  plots.v_Jet_3_z = -99;
  plots.v_Jet_4_z = -99;
  plots.v_Jet_5_z = -99;
  plots.v_Jet_6_z = -99;
  plots.v_Jet_7_z = -99;
  plots.v_Jet_8_z = -99;

  plots.v_Jet_1_e = -99;
  plots.v_Jet_2_e = -99;
  plots.v_Jet_3_e = -99;
  plots.v_Jet_4_e = -99;
  plots.v_Jet_5_e = -99;
  plots.v_Jet_6_e = -99;
  plots.v_Jet_7_e = -99;
  plots.v_Jet_8_e = -99;
  
  plots.v_Jet_1_eta = -99;
  plots.v_Jet_2_eta = -99;
  plots.v_Jet_3_eta = -99;
  plots.v_Jet_4_eta = -99;
  plots.v_Jet_5_eta = -99;
  plots.v_Jet_6_eta = -99;
  plots.v_Jet_7_eta = -99;
  plots.v_Jet_8_eta = -99;
 
  plots.v_Jet_1_phi = -99;
  plots.v_Jet_2_phi = -99;
  plots.v_Jet_3_phi = -99;
  plots.v_Jet_4_phi = -99;
  plots.v_Jet_5_phi = -99;
  plots.v_Jet_6_phi = -99;
  plots.v_Jet_7_phi = -99;
  plots.v_Jet_8_phi = -99;

  plots.v_Jet_1_DR = -99;
  plots.v_Jet_2_DR = -99;
  plots.v_Jet_3_DR = -99;
  plots.v_Jet_4_DR = -99;
  plots.v_Jet_5_DR = -99;
  plots.v_Jet_6_DR = -99;
  plots.v_Jet_7_DR = -99;
  plots.v_Jet_8_DR = -99;
 
  plots.v_numEle = -99;
  plots.v_numMu = -99;
  plots.v_numJets = -99;
  plots.v_totNumJets = -99;
  
  tree->GetEntry (evt) ;
  
  tagJets -> Clear () ;  
  otherJets -> Clear () ;    
  
  
  
    //---- check if signal ----
  if (if_signal && (IdEvent!=123 && IdEvent!=124)) continue;
  plots.analyzed++;
  
  
  //---- MC data ----
  std::vector<TLorentzVector*> MCJets ;
  
  TLorentzVector* MCJets_temp[6] ;
  int counter = 0;
  
  if (if_signal && (IdEvent==123 || IdEvent==124)){
   for(int ii=0; ii<9; ii++){
//     if (ii==0 || ii==1){
//     if (ii!=0 && ii!=1 && ii!=2 && ii!=3 && ii!=6){
    if (ii!=2 && ii!=3 && ii!=6){
     TParticle* myparticle = (TParticle*) HiggsParticle->At(ii);
//      std::cerr << "pdg = " << ii << " = " << myparticle->GetPdgCode() << std::endl;
     MCJets_temp[counter] = new TLorentzVector;
     myparticle->Momentum(*(MCJets_temp[counter]));
     MCJets.push_back((MCJets_temp[counter]));
     counter++;
    }
   }
  }
  

  
   //---- find Tagging Jets ----
 
  double m_jetPtMin = 15.;
  double m_jetEtaMax = 5.;
  double m_jetDEtaMin = -1;
  double m_jetMjjMin = -1;
 
  

  std::vector<myJet> goodJets ;

//   std::cerr << std::endl << std::endl << std::endl << std::endl << std::endl;
  
  for (int l=0; l<otherJets_temp->GetEntries (); l++ ){
   TLorentzVector* jet_temp = (TLorentzVector*) otherJets_temp->At(l);
   if (jet_temp->Pt()<m_jetPtMin) continue;
   //---- Eta max threshold ----
   if (jet_temp->Eta()>m_jetEtaMax) continue;
   //---- pt min threshold ----
   myJet dummy (jet_temp, 0, 0) ;
   goodJets.push_back (dummy) ;
  }
  
//   for (int gg=0; gg<goodJets.size(); gg++ ) std::cerr << " goodJets[" << gg << "] = " << &(goodJets.at(gg)) << std::endl;
  
  sort (goodJets.rbegin (), goodJets.rend (), lessThan ()) ;
  
  
  std::vector<std::pair<TLorentzVector*,TLorentzVector*> > Vect_PairQuark_RecoJet;
  std::vector<double> Map2D_PairQuark_RecoJet;

  int counter_map = 0;
    
  for (int rr=0; rr<std::min(g_numJet,static_cast<int>(goodJets.size())); rr++ ){ //--- loop over recoJets ----
   for (int k=0; k<MCJets.size(); k++ ){ //--- loop over quarks ----
    TLorentzVector* quark_temp = MCJets.at(k);
    TLorentzVector* jet_temp = goodJets.at(rr).m_kine;
    double DR = ROOT::Math::VectorUtil::DeltaR(quark_temp->BoostVector(),jet_temp->BoostVector());
    Map2D_PairQuark_RecoJet.push_back(DR);
    counter_map++;
   } //--- end loop over recoJet ----
  } //--- end loop over quarks ----

  

  int selected_pair_jet[6] ;
  int selected_pair_quark[6] ;
  for (int jj=0; jj<MCJets.size(); jj++ ){  
   selected_pair_jet[jj] = -1;
   selected_pair_quark[jj] = -1;
  }
  
  for (int jj=0; jj<MCJets.size(); jj++ ){  
   double DR_min = 1000;
   counter_map = 0;
   int temp_selected_pair_jet = -1;
   int temp_selected_pair_quark = -1;
   for (int rr=0; rr<std::min(g_numJet,static_cast<int>(goodJets.size())); rr++ ){ //--- loop over recoJets ----
    for (int k=0; k<MCJets.size(); k++ ){ //--- loop over quarks ----
     bool already_done = false;
     for (int qq=0; qq<MCJets.size(); qq++) {
      if ((selected_pair_jet[qq] == rr) || (selected_pair_quark[qq] == k)) already_done = true;
     }
     if (!already_done){
      double DR_temp = Map2D_PairQuark_RecoJet.at(counter_map);
      if (DR_temp<DR_min) {
       DR_min = DR_temp;
       temp_selected_pair_jet = rr;
       temp_selected_pair_quark = k;
      }
     }
     counter_map++;
    }
   }
   selected_pair_jet[jj] = temp_selected_pair_jet;
   selected_pair_quark[jj] = temp_selected_pair_quark;
  }  
  
  
  for (int rr=0; rr<std::min(g_numJet,static_cast<int>(goodJets.size())); rr++ ){ //--- loop over recoJets ----
   for (int k=0; k<MCJets.size(); k++ ){ //--- loop over quarks ----
    bool used_one = false;
    for (int qq=0; qq<MCJets.size(); qq++) {
     if ((selected_pair_jet[qq] == rr) && (selected_pair_quark[qq] == k)) used_one = true;
    }
    if (used_one){
     TLorentzVector* quark_temp = MCJets.at(k);
     TLorentzVector* jet_temp = goodJets.at(rr).m_kine;
     std::pair<TLorentzVector*,TLorentzVector*> PairQuark_RecoJet(quark_temp,jet_temp);
     Vect_PairQuark_RecoJet.push_back(PairQuark_RecoJet);
    }
   } //--- end loop over recoJet ----
  } //--- end loop over quarks ----

  
    
    
  for (int iJet=0; iJet<std::min(g_numJet,static_cast<int>(goodJets.size())); iJet++){
   
   double minDR = -1000;
   double eta_reco_temp = goodJets.at (iJet).m_kine->Eta () ;
   double phi_reco_temp = goodJets.at (iJet).m_kine->Phi () ;  
    
   for (int pp=0; pp<static_cast<int>(Vect_PairQuark_RecoJet.size()); pp++ ){
    double eta_1 = Vect_PairQuark_RecoJet.at(pp).second->Eta();
    double phi_1 = Vect_PairQuark_RecoJet.at(pp).second->Phi();

    double DR_temp = deltaR(phi_1,eta_1,phi_reco_temp,eta_reco_temp);
    if (DR_temp<0.001) {
     double eta_2 = Vect_PairQuark_RecoJet.at(pp).first->Eta();
     double phi_2 = Vect_PairQuark_RecoJet.at(pp).first->Phi();
     minDR = deltaR(phi_1,eta_1,phi_2,eta_2);
     break;
    }
   }
    
    
   if (iJet==0) {
    plots.v_Jet_1_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_1_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_1_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_1_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_1_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_1_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_1_DR = minDR;
   }
   if (iJet==1) {
    plots.v_Jet_2_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_2_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_2_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_2_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_2_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_2_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_2_DR = minDR;
   }
   if (iJet==2) {
    plots.v_Jet_3_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_3_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_3_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_3_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_3_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_3_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_3_DR = minDR;
   }
   if (iJet==3) {
    plots.v_Jet_4_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_4_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_4_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_4_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_4_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_4_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_4_DR = minDR;
   }
   if (iJet==4) {
    plots.v_Jet_5_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_5_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_5_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_5_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_5_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_5_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_5_DR = minDR;
   }
   if (iJet==5) {
    plots.v_Jet_6_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_6_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_6_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_6_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_6_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_6_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_6_DR = minDR;
   }
   if (iJet==6) {
    plots.v_Jet_7_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_7_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_7_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_7_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_7_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_7_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_7_DR = minDR;
   }
   if (iJet==7) {
    plots.v_Jet_8_Pt = goodJets.at (iJet).m_kine->Pt () ;
    plots.v_Jet_8_x = goodJets.at (iJet).m_kine->X () ;
    plots.v_Jet_8_y = goodJets.at (iJet).m_kine->Y () ;
    plots.v_Jet_8_z = goodJets.at (iJet).m_kine->Z () ;
    plots.v_Jet_8_eta = goodJets.at (iJet).m_kine->Eta () ;
    plots.v_Jet_8_phi = goodJets.at (iJet).m_kine->Phi () ;
    plots.v_Jet_8_DR = minDR;
   }
  }  
  
  
  int numJets = goodJets.size();
  plots.v_numJets = numJets;
  plots.v_totNumJets = static_cast<double>(otherJets_temp->GetEntries ());
 
  
  
  //---- leptons ----
  
  plots.v_numEle = 0;
  plots.v_numMu = 0;
 
  std::vector<lepton> leptons ;
            
  //---- AM ---- loop over electrons
  for (int iele = 0; iele < electrons->GetEntries () ; ++iele)
  {
   TLorentzVector * theEle = (TLorentzVector*) (electrons->At (iele)) ;
   lepton dummy (theEle, 0, iele) ;
   leptons.push_back (dummy) ;
  } 

  //---- AM ---- loop over muons
  for (int imu = 0 ; imu < nMu ; ++imu)
  {
   TLorentzVector * theMu = (TLorentzVector*) (muons->At (imu)) ;
   lepton dummy (theMu, 1, imu) ;
   leptons.push_back (dummy) ;
  }
  

  for (int ilep=0 ; ilep < leptons.size () ; ++ilep){
   if (leptons.at (ilep).m_flav == 0) {//PG electron
    plots.v_numEle += 1;
   }
   if (leptons.at (ilep).m_flav == 1) {//PG muon
    plots.v_numMu += 1;
   }
  }
  
  
  plots.m_tree_selections->Fill();
  if (numJets >=6 ) plots.passedJetAndLepNumberSelections++;
  

  for (int hh=0; hh<counter; hh++) delete MCJets_temp[hh];
  
 } //PG loop over the events

//  std::cerr << "---- Finishes ----" << std::endl;
 
 g_OutputFile->cd(0);
 plots.m_efficiency->Fill();
 plots.m_efficiency->Write();
 plots.m_tree_selections->Write();

//  std::cerr << "---- Written ----" << std::endl;
 
 delete otherJets_temp ;
 delete tagJets  ;  
 delete otherJets  ;
 delete electrons  ;
 delete muons  ;    
 delete MET  ;      
 delete tracks  ;   

//  std::cerr << "---- Deleted ----" << std::endl;
 
 return 0;
  
}
コード例 #5
0
ファイル: testsl.C プロジェクト: alisw/AliRoot
void testsl() {
  gSystem->Load("libStarLight");
  gSystem->Load("libAliStarLight");

  TStarLight* sl = new TStarLight("starlight generator", "title", "");

  sl->SetParameter("baseFileName = slight	#suite of output files will be saved with this base name");
  sl->SetParameter("BEAM_1_Z = 82    #Z of projectile");
  sl->SetParameter("BEAM_1_A = 208   #A of projectile");
  sl->SetParameter("BEAM_2_Z = 82   #Z of target");
  sl->SetParameter("BEAM_2_A = 208   #A of target");
  sl->SetParameter("BEAM_1_GAMMA = 1470.0 #Gamma of the colliding ion 1");
  sl->SetParameter("BEAM_2_GAMMA = 1470.0 #Gamma of the colliding ion 2");
  sl->SetParameter("W_MAX = -1   #Max value of w");
  sl->SetParameter("W_MIN = -1    #Min value of w");
  sl->SetParameter("W_N_BINS = 50    #Bins i w");
  sl->SetParameter("RAP_MAX = 9.    #max y");
  sl->SetParameter("RAP_N_BINS = 200    #Bins i y");
  sl->SetParameter("CUT_PT = 0 #Cut in pT? 0 = (no, 1 = yes)");
  sl->SetParameter("PT_MIN = 1.0 #Minimum pT in GeV");
  sl->SetParameter("PT_MAX = 3.0 #Maximum pT in GeV");
  sl->SetParameter("CUT_ETA = 0 #Cut in pseudorapidity? (0 = no, 1 = yes)");
  sl->SetParameter("ETA_MIN = -10 #Minimum pseudorapidity");
  sl->SetParameter("ETA_MAX = 10 #Maximum pseudorapidity");
  sl->SetParameter("PROD_MODE = 2     #gg or gP switch (1 = 2-photon, 2 = coherent vector meson (narrow), 3 = coherent vector meson (wide), 4 = incoherent vector meson)");
  sl->SetParameter("N_EVENTS = 1000   #Number of events");
  sl->SetParameter("PROD_PID = 443013   #Channel of interest; this is j/psi --> mu+ mu-");
  sl->SetParameter("RND_SEED = 5574533 #Random number seed");
  sl->SetParameter("BREAKUP_MODE = 5     #Controls the nuclear breakup; a 5 here makes no requirement on the breakup of the ions");
  sl->SetParameter("INTERFERENCE = 0     #Interference (0 = off, 1 = on)");
  sl->SetParameter("IF_STRENGTH = 1.    #percent of intefernce (0.0 - 0.1)");
  sl->SetParameter("INT_PT_MAX = 0.24  #Maximum pt considered, when interference is turned on");
  sl->SetParameter("INT_PT_N_BINS =120   #Number of pt bins when interference is turned on");
  sl->SetParameter("XSEC_METHOD = 1 # Set to 0 to use old method for calculating gamma-gamma luminosity");
  sl->SetParameter("PYTHIA_FULL_EVENTRECORD = 0 # Write full pythia information to output (vertex, parents, daughter etc).");

  sl->InitStarLight();
  sl->PrintInputs(std::cout);
  TClonesArray tca("TParticle", 100);

  TLorentzVector v[2], vSum;
  TH1* hM  = new TH1D("hM",  "STARLIGHT;M#(){#pi^{+}#pi^{-}}",    200, 3.0, 3.2);
  TH1* hPt = new TH1D("hPt", "STARLIGHT;P_{T}#(){#pi^{+}#pi^{-}}", 80, 0., 2.);
  TH1* hY  = new TH1D("hY",  "STARLIGHT;Y#(){#pi^{+}#pi^{-}}",    100,-10., 10.);

  std::ofstream ofs("sl.txt");
  TParticle *p;
  for (Int_t counter(0); counter<20000; ) {
    sl->GenerateEvent();
    sl->BoostEvent();
    sl->ImportParticles(&tca, "ALL");
    Bool_t genOK = kTRUE;
    TLorentzVector vSum;
    for (Int_t i=0; i<tca.GetEntries() && genOK; ++i) {
      p = (TParticle*)tca.At(i);
      p->Momentum(v[i]);
      vSum += v[i];
//       genOK = TMath::Abs(v[i].Rapidity()) <= 1.5;
    }
    tca.Clear();
    if (!genOK) continue;
    Printf("%5d %d", counter, genOK);
    ++counter;
    vSum = v[0] + v[1];
    ofs << std::fixed << std::setprecision(4)
	<< vSum.M() << " " << vSum.Perp() << " " << vSum.Rapidity() << " "
	<< v[0].Eta() << " " << v[0].Px() << " " << v[0].Py() << " " << v[0].Pz() << " "
	<< v[1].Eta() << " " << v[1].Px() << " " << v[1].Py() << " " << v[1].Pz()
	<< std::endl;
    hM->Fill(vSum.M());
    hPt->Fill(vSum.Perp());
    hY->Fill(vSum.Rapidity());
  }
  TFile::Open("sl.root", "RECREATE");
  sl->Write();
  gFile->Write();

  hM->Draw();
  c1->SaveAs("SL.pdf(");
  hPt->Draw();
  c1->SaveAs("SL.pdf");
  hY->Draw();
  c1->SaveAs("SL.pdf)");
}