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_;
61 long nZToMuMu_, selZToMuMu_, nZToMuMuMC_, selZToMuMuMC_, nZToMuMuMCMatched_,
selZToMuMuMCMatched_, nZToMuMuMCDen_;
66 zToMuMu_(cfg.getParameter<
InputTag>(
"zToMuMu")),
67 zToMuMuMC_(cfg.getParameter<
InputTag>(
"zToMuMuMC")),
68 zToMuMuMatched_(cfg.getParameter<
InputTag>(
"zToMuMuMatched")),
69 nZToMuMu_(0), selZToMuMu_(0),
70 nZToMuMuMC_(0), selZToMuMuMC_(0),
71 nZToMuMuMCMatched_(0), selZToMuMuMCMatched_(0), nZToMuMuMCDen_(0),
72 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") ),
73 select_OnlyMassCut_(-1, -9999,9999 , -9999, 9999,0, 0, cfg.getParameter<double>(
"massMinZMC"), cfg.getParameter<double>(
"massMaxZMC") )
85 long nZToMuMuMC = zToMuMuMC->size();
86 long nZToMuMuMatched = zToMuMuMatched->size();
96 for(
long i = 0;
i < nZToMuMuMC; ++
i) {
104 for(
long i = 0;
i < nZToMuMuMatched; ++
i) {
120 int selectMC =
select_(*mcRef);
124 if(selectZ != selectMC) {
125 cout <<
">>> select reco: " << selectZ <<
", select mc: " << selectMC << endl;
126 if ((selectZ * selectMC) ==0 )
break;
129 if (mcRef->numberOfDaughters()>1){
132 double m = z.
mass(), mcm = (mcd0->
p4()+mcd1->p4()).
mass();
133 cout <<
">>> reco pt1, eta1: " << d0->
pt() <<
", " << d0->
eta()
134 <<
", 2: " << d1->pt() <<
", " << d1->eta()
135 <<
", mass = " << m << endl;
136 cout <<
">>> mc pt1, eta1: " << mcd0->
pt() <<
", " << mcd0->
eta()
137 <<
", 2: " << mcd1->pt() <<
", " << mcd1->eta()
138 <<
", mass = " << mcm << endl;
144 if ((selectZ==3) && (selectMC==3))
break;
152 double errZToMuMu =
sqrt(effZToMuMu*(1. - effZToMuMu)/
nZToMuMu_);
154 double errZToMuMuMC =
sqrt(effZToMuMuMC*(1. - effZToMuMuMC)/
nZToMuMuMC_);
160 <<
" = " << effZToMuMu <<
" +/- " << errZToMuMu << endl;
162 <<
" = " << effZToMuMuMCMatched <<
" +/- " << errZToMuMuMCMatched << endl;
163 cout <<
" if the two numbers above are the same we can neglete resolution effect and quote the acceptance as the number below.... " << endl;
164 cout <<
"********* acceptance m>sampleMCMassCut (usually 20 or 40) ******** " << endl;
166 <<
" = " << effZToMuMuMC <<
" +/- " << errZToMuMuMC << endl;
167 cout <<
"********* acceptance in the given mass range ******** " << endl;
169 <<
" = " << effZToMuMuMCDen <<
" +/- " << errZToMuMuMCDen << endl;
void analyze(const Event &, const EventSetup &)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
long selZToMuMuMCMatched_
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
virtual double mass() const =0
mass
ZSelector select_OnlyMassCut_
bool isNonnull() const
Checks for non-null.
virtual size_type numberOfDaughters() const =0
number of daughters
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const Candidate * mcMuDaughter(const Candidate *c)
virtual int pdgId() const =0
PDG identifier.
int operator()(const Candidate &c) const
MCAcceptanceAnalyzer(const ParameterSet &cfg)
virtual double eta() const =0
momentum pseudorapidity
ZSelector(double ptMin, double etaDau0Min, double etaDau0Max, double etaDau1Min, double etaDau1Max, double massMin, double massMax, double massMinZMC, double massMaxZMC)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector