29 outputFileName_ = pset.
getParameter<
string>(
"OutputFileName");
32 useTriggerFiltering_ = pset.
getParameter<
bool>(
"useTriggerFiltering");
34 photonProducer_ = pset.
getParameter<
string>(
"phoProducer");
35 photonCollection_ = pset.
getParameter<
string>(
"photonCollection");
37 barrelRecHitProducer_ = pset.
getParameter<
string>(
"barrelRecHitProducer");
38 barrelRecHitCollection_ = pset.
getParameter<
string>(
"barrelRecHitCollection");
40 endcapRecHitProducer_ = pset.
getParameter<
string>(
"endcapRecHitProducer");
41 endcapRecHitCollection_ = pset.
getParameter<
string>(
"endcapRecHitCollection");
43 muonProducer_ = pset.
getParameter<
string>(
"muonProducer");
44 muonCollection_ = pset.
getParameter<
string>(
"muonCollection");
47 minPixStripHits_ = pset.
getParameter<
int>(
"minPixStripHits");
52 validMuonHits_ = pset.
getParameter<
int>(
"validMuonHits");
53 muonTrackIso_ = pset.
getParameter<
double>(
"muonTrackIso");
54 muonTightEta_ = pset.
getParameter<
double>(
"muonTightEta");
56 minMumuInvMass_ = pset.
getParameter<
double>(
"minMumuInvMass");
57 maxMumuInvMass_ = pset.
getParameter<
double>(
"maxMumuInvMass");
60 photonMaxEta_ = pset.
getParameter<
double>(
"photonMaxEta");
61 photonTrackIso_ = pset.
getParameter<
double>(
"photonTrackIso");
64 nearMuonHcalIso_ = pset.
getParameter<
double>(
"nearMuonHcalIso");
65 farMuonEcalIso_ = pset.
getParameter<
double>(
"farMuonEcalIso");
66 farMuonTrackIso_ = pset.
getParameter<
double>(
"farMuonTrackIso");
67 farMuonMinPt_ = pset.
getParameter<
double>(
"farMuonMinPt");
68 minMumuGammaInvMass_ = pset.
getParameter<
double>(
"minMumuGammaInvMass");
69 maxMumuGammaInvMass_ = pset.
getParameter<
double>(
"maxMumuGammaInvMass");
95 double etMin = parameters_.getParameter<
double>(
"etMin");
96 double etMax = parameters_.getParameter<
double>(
"etMax");
97 int etBin = parameters_.getParameter<
int>(
"etBin");
172 h1_mumuInvMass_ =
dbe_->
book1D(
"mumuInvMass",
"Two muon invariant mass: M (GeV)",etBin/2,etMin,etMax/2);
173 h1_mumuGammaInvMass_ =
dbe_->
book1D(
"mumuGammaInvMass",
"Two-muon plus gamma invariant mass: M (GeV)",etBin/2,etMin,etMax/2);
188 if (nEvt_% prescaleFactor_ )
return;
190 LogInfo(
"ZToMuMuGammaAnalyzer") <<
"ZToMuMuGammaAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " << nEvt_ <<
"\n";
194 bool validTriggerEvent=
true;
197 e.
getByLabel(triggerEvent_,triggerEventHandle);
198 if(!triggerEventHandle.isValid()) {
199 edm::LogInfo(
"PhotonAnalyzer") <<
"Error! Can't get the product "<< triggerEvent_.label() << endl;
200 validTriggerEvent=
false;
202 if(validTriggerEvent) triggerEvent = *(triggerEventHandle.product());
206 bool validPhotons=
true;
209 e.
getByLabel(photonProducer_, photonCollection_ , photonHandle);
210 if ( !photonHandle.isValid()) {
211 edm::LogInfo(
"ZToMuMuGammaAnalyzer") <<
"Error! Can't get the product "<< photonCollection_ << endl;
214 if(validPhotons) photonCollection = *(photonHandle.product());
217 bool validloosePhotonID=
true;
220 e.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDLoose", loosePhotonFlag);
221 if ( !loosePhotonFlag.isValid()) {
222 edm::LogInfo(
"ZToMuMuGammaAnalyzer") <<
"Error! Can't get the product "<<
"PhotonCutBasedIDLoose" << endl;
223 validloosePhotonID=
false;
225 if (validloosePhotonID) loosePhotonID = *(loosePhotonFlag.product());
227 bool validtightPhotonID=
true;
230 e.
getByLabel(
"PhotonIDProd",
"PhotonCutBasedIDTight", tightPhotonFlag);
231 if ( !tightPhotonFlag.isValid()) {
232 edm::LogInfo(
"ZToMuMuGammaAnalyzer") <<
"Error! Can't get the product "<<
"PhotonCutBasedIDTight" << endl;
233 validtightPhotonID=
false;
235 if (validtightPhotonID) tightPhotonID = *(tightPhotonFlag.product());
238 bool validMuons=
true;
241 e.
getByLabel(muonProducer_, muonCollection_ , muonHandle);
242 if ( !muonHandle.isValid()) {
243 edm::LogInfo(
"ZToMuMuGammaAnalyzer") <<
"Error! Can't get the product "<< muonCollection_ << endl;
246 if(validMuons) muonCollection = *(muonHandle.product());
251 if (!bsHandle.isValid()) {
252 edm::LogError(
"TrackerOnlyConversionProducer") <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
262 for(uint filterIndex=0;filterIndex<triggerEvent.sizeFilters();++filterIndex){
263 string label = triggerEvent.filterTag(filterIndex).label();
264 if(label.find(
"Photon" ) != string::npos ) {
265 for(uint filterKeyIndex=0;filterKeyIndex<triggerEvent.filterKeys(filterIndex).size();++filterKeyIndex){
266 Keys.push_back(triggerEvent.filterKeys(filterIndex)[filterKeyIndex]);
274 for ( uint
i=0 ;
i<
Keys.size() ; )
276 if (
i!=(
Keys.size()-1))
287 if ( muonCollection.size() < 2 )
return;
289 for( reco::MuonCollection::const_iterator iMu = muonCollection.begin(); iMu != muonCollection.end(); iMu++) {
290 if ( !basicMuonSelection (*iMu) )
continue;
292 for( reco::MuonCollection::const_iterator iMu2 = iMu+1; iMu2 != muonCollection.end(); iMu2++) {
293 if ( !basicMuonSelection (*iMu2) )
continue;
294 if ( iMu->charge()*iMu2->charge() > 0)
continue;
296 if ( !muonSelection(*iMu,thebs) && !muonSelection(*iMu2,thebs) )
continue;
300 float mumuMass = mumuInvMass(*iMu,*iMu2) ;
301 if ( mumuMass < minMumuInvMass_ || mumuMass > maxMumuInvMass_ )
continue;
303 h1_mumuInvMass_ ->
Fill (mumuMass);
305 if ( photonCollection.size() < 1 )
continue;
309 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
310 if ( !photonSelection (*iPho) )
continue;
314 double dr1 =
deltaR(*iMu, *iPho);
315 double dr2 =
deltaR(*iMu2,*iPho);
318 nearMuon =*iMu ; farMuon = *iMu2; drNear = dr1;
320 nearMuon = *iMu2; farMuon = *iMu; drNear = dr2;
326 if ( farMuon.
pt() < farMuonMinPt_ )
continue;
327 if ( drNear > nearMuonDr_)
continue;
330 float mumuGammaMass = mumuGammaInvMass(*iMu,*iMu2,*iPho) ;
331 if ( mumuGammaMass < minMumuGammaInvMass_ || mumuGammaMass > maxMumuGammaInvMass_ )
continue;
333 h1_mumuGammaInvMass_ ->Fill (mumuGammaMass);
374 if ( mu.
pt() < muonMinPt_ ) result=
false;
375 if ( fabs(mu.
eta())>2.4 ) result=
false;
380 pixHits=mu.
innerTrack()->hitPattern().numberOfValidPixelHits();
381 tkHits=mu.
innerTrack()->hitPattern().numberOfValidStripHits();
384 if ( pixHits+tkHits < minPixStripHits_ ) result=
false;
392 if ( mu.
globalTrack()->normalizedChi2() > muonMaxChi2_ ) result=
false;
393 if ( fabs( mu.
globalTrack()->dxy(beamSpot)) > muonMaxDxy_ ) result=
false;
396 if ( mu.
track()-> hitPattern().numberOfValidPixelHits() < validPixHits_ ) result=
false;
397 if ( mu.
globalTrack()->hitPattern().numberOfValidMuonHits() < validMuonHits_ ) result=
false;
401 if ( fabs(mu.
eta())> muonTightEta_ ) result=
false;
410 if ( pho.
pt() < photonMinEt_ ) result=
false;
411 if ( fabs(pho.
eta())> photonMaxEta_ ) result=
false;
424 float mumuMass2 = p12.Dot(p12) ;
425 float invMass =
sqrt(mumuMass2) ;
432 float Mass2 = p12.Dot(p12) ;
433 float invMass =
sqrt(Mass2) ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
float sumPt
sum-pt of tracks
bool muonSelection(const reco::Muon &m, const reco::BeamSpot &bs)
The single EDProduct to be saved for each event (AOD case)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
virtual TrackRef innerTrack() const
bool isTrackerMuon() const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
bool isEBEEGap() const
true if photon is in boundary between EB and EE
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
virtual double eta() const
momentum pseudorapidity
std::vector< Muon > MuonCollection
collection of Muon objects
virtual void analyze(const edm::Event &, const edm::EventSetup &)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool isNonnull() const
Checks for non-null.
const LorentzVector & p4(P4type type) const
virtual ~ZToMuMuGammaAnalyzer()
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
float mumuInvMass(const reco::Muon &m1, const reco::Muon &m2)
ZToMuMuGammaAnalyzer(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
bool etMin(const PFCandidate &cand, double cut)
double deltaR(double eta1, double eta2, double phi1, double phi2)
bool photonSelection(const reco::Photon &p)
virtual double pt() const
transverse momentum
std::vector< size_type > Keys
std::vector< Photon > PhotonCollection
collectin of Photon objects
bool basicMuonSelection(const reco::Muon &m)
virtual void endRun(const edm::Run &, const edm::EventSetup &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
float mumuGammaInvMass(const reco::Muon &mu1, const reco::Muon &mu2, const reco::Photon &pho)
void setCurrentFolder(const std::string &fullpath)
const MuonIsolation & isolationR03() const
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector