Difference: EduardoCmsMonteCarlo (7 vs. 8)

Revision 82019-06-09 - gregores

Line: 1 to 1
 
META TOPICPARENT name="EduardoGregores"

Monte Carlo Production

Changed:
<
<

Fast Simulation on CMSSW_10_2_11_patch1

>
>

Fast Simulation on CMSSW_10_2_15

 

Preparation

$ ssh lxplus.cern.ch
Changed:
<
<
$ export SCRAM_ARCH=slc7_amd64_gcc700 $ cmsrel CMSSW_10_2_11_patch1 $ cd CMSSW_10_2_11_patch1/src
>
>
$ cmsrel CMSSW_10_2_15 $ cd CMSSW_10_2_15/src
 $ cmsenv $ mkdir -p Configuration/GenProduction/ $ git clone git@github.com:cms-sw/genproductions.git Configuration/GenProduction/
Line: 318 to 317
 $ python pp2mumu_Analysis.py
Added:
>
>

ROOT Analyzer

Example using TTreeReader

NanoReader.cc

#include "ostream"
#include "TFile.h"
#include "TTreeReader.h"
#include "TTreeReaderArray.h"
#include "TLorentzVector.h"

void NanoReader(){
    TFile *file = new TFile("PPto2Mu_MG5_10k_NANO.root");
    TTreeReader reader("Events", file);
    TTreeReaderArray<Float_t>   Muon_pt(reader, "Muon_pt"    );
    TTreeReaderArray<Float_t>  Muon_eta(reader, "Muon_eta"   );
    TTreeReaderArray<Float_t>  Muon_phi(reader, "Muon_phi"   );
    TTreeReaderArray<Float_t> Muon_mass(reader, "Muon_mass"  );
    TTreeReaderArray<UInt_t>      nMuon(reader, "nMuon"      );
    TTreeReaderArray<Int_t> Muon_charge(reader, "Muon_charge");

    Int_t nEvents = reader.GetEntries(0);
    Double_t ptCut = 0;
    Int_t nMuonCut = 3;
    Int_t count = 0;
    while(reader.Next()){
        int n = nMuon[0];
        Float_t ptMax = Muon_pt[0];
        if(ptMax < ptCut || n < nMuonCut ){continue;}
        count++;
        std::cout << "==============================================" << std::endl;
        std::cout << "Event Number: " << reader.GetCurrentEntry() << std::endl;
        std::cout << "Number of Muons: " << n << std::endl;
        TLorentzVector pMuon[n];
        for (Int_t i=0; i<n; i++) {
           pMuon[i].SetPtEtaPhiM(Muon_pt[i],Muon_eta[i],Muon_phi[i],Muon_mass[i]);
            std::cout << Muon_charge[i]     << "       ";
            std::cout << Muon_pt[i]         << "       ";
            std::cout << pMuon[i].E()       << "       ";
            std::cout << pMuon[i].Px()      << "       ";
            std::cout << pMuon[i].Py()      << "       ";
            std::cout << pMuon[i].Pz()      << std::endl;
        }
    }
    Float_t eff = float(count)/float(nEvents);
    std::cout << "==============================================" << std::endl;
    std::cout << "Number of events on the dataset: " << nEvents << std::endl;
    std::cout << "Number of events that passed the cut Pt > " << ptCut
              << " GeV and number of muons > "<< nMuonCut-1 <<": "<< count << std::endl;
    std::cout << "Cut efficiency: " << eff << std::endl;
    std::cout << "==============================================" << std::endl;
}

Run it:

$ root -b -q NanoReader.cc
 

-- gregores - 2019-04-01

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback

antalya escort bursa escort eskisehir escort istanbul escort izmir escort