16 for(
unsigned int i = 0;
i <
n; ++
i) {
18 if(fabs(d->
pdgId())==13)
return d;
24 ZSelector(
double ptMin,
double etaDau0Min,
double etaDau0Max,
double etaDau1Min,
double etaDau1Max,
double massMin,
double massMax,
double massMinZMC,
double massMaxZMC) :
25 ptMin_(ptMin), etaDau0Min_(etaDau0Min),etaDau0Max_(etaDau0Max), etaDau1Min_(etaDau1Min),etaDau1Max_(etaDau1Max),
26 massMin_(massMin), massMax_(massMax), massMinZMC_(massMinZMC), massMaxZMC_(massMaxZMC) { }
39 if( ( fabs(d0->
eta()) > etaDau0Min_ && fabs(d1->
eta())>etaDau1Min_ && fabs(d0->
eta()) < etaDau0Max_ && fabs(d1->
eta()) <etaDau1Max_ ) || ( fabs(d0->
eta()) > etaDau1Min_ && fabs(d1->
eta())>etaDau0Min_ && fabs(d0->
eta()) < etaDau1Max_ && fabs(d1->
eta()) <etaDau0Max_ ) ) {
41 if(d0->
pt() > ptMin_ && d1->
pt() > ptMin_) {
44 if(m > massMin_ && m < massMax_) temp_cut=3;
45 if (c.
mass()> massMinZMC_ && c.
mass() < massMaxZMC_) temp_cut =4;
51 double ptMin_, etaDau0Min_, etaDau0Max_, etaDau1Min_, etaDau1Max_, massMin_, massMax_, massMinZMC_, massMaxZMC_;
59 void endJob()
override;
64 long nZToMuMu_, selZToMuMu_, nZToMuMuMC_, selZToMuMuMC_, nZToMuMuMCMatched_,
selZToMuMuMCMatched_, nZToMuMuMCDen_;
69 zToMuMu_(cfg.getParameter<
InputTag>(
"zToMuMu")),
70 zToMuMuMC_(cfg.getParameter<
InputTag>(
"zToMuMuMC")),
71 zToMuMuMatched_(cfg.getParameter<
InputTag>(
"zToMuMuMatched")),
75 nZToMuMu_(0), selZToMuMu_(0),
76 nZToMuMuMC_(0), selZToMuMuMC_(0),
77 nZToMuMuMCMatched_(0), selZToMuMuMCMatched_(0), nZToMuMuMCDen_(0),
78 select_(cfg.getParameter<double>(
"ptMin"), cfg.getParameter<double>(
"etaDau0Min"), cfg.getParameter<double>(
"etaDau0Max"), cfg.getParameter<double>(
"etaDau1Min"), cfg.getParameter<double>(
"etaDau1Max"),cfg.getParameter<double>(
"massMin"), cfg.getParameter<double>(
"massMax"), cfg.getParameter<double>(
"massMinZMC"), cfg.getParameter<double>(
"massMaxZMC") ),
79 select_OnlyMassCut_(-1, -9999,9999 , -9999, 9999,0, 0, cfg.getParameter<double>(
"massMinZMC"), cfg.getParameter<double>(
"massMaxZMC") )
91 long nZToMuMuMC = zToMuMuMC->
size();
92 long nZToMuMuMatched = zToMuMuMatched->
size();
102 for(
long i = 0;
i < nZToMuMuMC; ++
i) {
110 for(
long i = 0;
i < nZToMuMuMatched; ++
i) {
126 int selectMC =
select_(*mcRef);
130 if(selectZ != selectMC) {
131 cout <<
">>> select reco: " << selectZ <<
", select mc: " << selectMC << endl;
132 if ((selectZ * selectMC) ==0 )
break;
135 if (mcRef->numberOfDaughters()>1){
138 double m = z.
mass(), mcm = (mcd0->
p4()+mcd1->p4()).
mass();
139 cout <<
">>> reco pt1, eta1: " << d0->
pt() <<
", " << d0->
eta()
140 <<
", 2: " << d1->pt() <<
", " << d1->eta()
141 <<
", mass = " << m << endl;
142 cout <<
">>> mc pt1, eta1: " << mcd0->
pt() <<
", " << mcd0->
eta()
143 <<
", 2: " << mcd1->pt() <<
", " << mcd1->eta()
144 <<
", mass = " << mcm << endl;
150 if ((selectZ==3) && (selectMC==3))
break;
158 double errZToMuMu =
sqrt(effZToMuMu*(1. - effZToMuMu)/
nZToMuMu_);
160 double errZToMuMuMC =
sqrt(effZToMuMuMC*(1. - effZToMuMuMC)/
nZToMuMuMC_);
166 <<
" = " << effZToMuMu <<
" +/- " << errZToMuMu << endl;
168 <<
" = " << effZToMuMuMCMatched <<
" +/- " << errZToMuMuMCMatched << endl;
169 cout <<
" if the two numbers above are the same we can neglete resolution effect and quote the acceptance as the number below.... " << endl;
170 cout <<
"********* acceptance m>sampleMCMassCut (usually 20 or 40) ******** " << endl;
172 <<
" = " << effZToMuMuMC <<
" +/- " << errZToMuMuMC << endl;
173 cout <<
"********* acceptance in the given mass range ******** " << endl;
175 <<
" = " << effZToMuMuMCDen <<
" +/- " << errZToMuMuMCDen << endl;
bool isNonnull() const
Checks for non-null.
long selZToMuMuMCMatched_
EDGetTokenT< GenParticleMatch > zToMuMuMatchedToken_
EDGetTokenT< CandidateView > zToMuMuToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
def analyze(function, filename, filter=None)
#define DEFINE_FWK_MODULE(type)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
RefToBase< value_type > refAt(size_type i) const
ZSelector select_OnlyMassCut_
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
const Candidate * mcMuDaughter(const Candidate *c)
void analyze(const Event &, const EventSetup &) override
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
int operator()(const Candidate &c) const
virtual double mass() const =0
mass
EDGetTokenT< CandidateView > zToMuMuMCToken_
MCAcceptanceAnalyzer(const ParameterSet &cfg)
virtual size_type numberOfDaughters() const =0
number of daughters
ZSelector(double ptMin, double etaDau0Min, double etaDau0Max, double etaDau1Min, double etaDau1Max, double massMin, double massMax, double massMinZMC, double massMaxZMC)