CMS 3D CMS Logo

ZMuMuAnalyzer Class Reference

Inheritance diagram for ZMuMuAnalyzer:

edm::EDAnalyzer

List of all members.

Public Member Functions

 ZMuMuAnalyzer (const edm::ParameterSet &pset)

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
virtual void endJob ()

Private Attributes

double etacut_
TH1D * h_zMuMu_mass_
TH1D * h_zMuMuMatched_mass_
TH1D * h_zMuSingleStandAlone_mass_
TH1D * h_zMuSingleStandAloneMatched_mass_
TH1D * h_zMuSingleStandAloneOverlap_mass_
TH1D * h_zMuSingleStandAloneOverlapMatched_mass_
TH1D * h_zMuSingleTrack_mass_
TH1D * h_zMuSingleTrackMatched_mass_
double isocut_
double maxZmass_
double minZmass_
InputTag muIso_
OverlapChecker overlap_
double ptcut_
double ptSTAcut_
InputTag standAloneIso_
InputTag trackIso_
InputTag zMuMu_
InputTag zMuMuMap_
InputTag zMuStandAlone_
InputTag zMuStandAloneMap_
InputTag zMuTrack_
InputTag zMuTrackMap_


Detailed Description

Definition at line 41 of file ZMuMuAnalyzer.cc.


Constructor & Destructor Documentation

ZMuMuAnalyzer::ZMuMuAnalyzer ( const edm::ParameterSet pset  ) 

Definition at line 62 of file ZMuMuAnalyzer.cc.

References h_zMuMu_mass_, h_zMuMuMatched_mass_, h_zMuSingleStandAlone_mass_, h_zMuSingleStandAloneMatched_mass_, h_zMuSingleStandAloneOverlap_mass_, h_zMuSingleStandAloneOverlapMatched_mass_, h_zMuSingleTrack_mass_, and h_zMuSingleTrackMatched_mass_.

00062                                                         : 
00063   zMuMu_( pset.getParameter<InputTag>( "zMuMu" ) ),
00064   zMuTrack_( pset.getParameter<InputTag>( "zMuTrack" ) ),
00065   zMuStandAlone_( pset.getParameter<InputTag>( "zMuStandAlone" ) ),
00066   muIso_( pset.getParameter<InputTag>( "muIso" ) ),
00067   trackIso_( pset.getParameter<InputTag>( "trackIso" ) ),
00068   standAloneIso_( pset.getParameter<InputTag>( "standAloneIso" ) ),
00069   zMuMuMap_( pset.getParameter<InputTag>( "zMuMuMap" ) ),
00070   zMuTrackMap_( pset.getParameter<InputTag>( "zMuTrackMap" ) ),
00071   zMuStandAloneMap_( pset.getParameter<InputTag>( "zMuStandAloneMap" ) ),
00072   isocut_( pset.getParameter<double>( "isocut" ) ),
00073   etacut_( pset.getParameter<double>( "etacut" ) ),
00074   ptcut_( pset.getParameter<double>( "ptcut" ) ),
00075   ptSTAcut_( pset.getParameter<double>( "ptSTAcut" ) ),
00076   
00077   minZmass_( pset.getParameter<double>( "minZmass" )),
00078   maxZmass_( pset.getParameter<double>( "maxZmass" )) {
00079   
00080   Service<TFileService> fs;
00081   h_zMuMu_mass_ = fs->make<TH1D>( "ZMuMumass", "ZMuMu mass(GeV)", 200,  0., 200. );
00082   h_zMuSingleTrack_mass_ = fs->make<TH1D>( "ZMuSingleTrackmass", "ZMuSingleTrack mass(GeV)", 100,  0., 200. );
00083   h_zMuSingleStandAlone_mass_ = fs->make<TH1D>( "ZMuSingleStandAlonemass", "ZMuSingleStandAlone mass(GeV)", 50,  0., 200. );
00084   h_zMuSingleStandAloneOverlap_mass_ = fs->make<TH1D>( "ZMuSingleStandAloneOverlapmass", "ZMuSingleStandAloneOverlap  mass(GeV)", 50,  0., 200. );
00085   
00086   
00087   h_zMuMuMatched_mass_ = fs->make<TH1D>( "ZMuMuMatchedmass", "ZMuMu Matched  mass(GeV)", 200,  0., 200. );
00088   h_zMuSingleTrackMatched_mass_ = fs->make<TH1D>( "ZMuSingleTrackmassMatched", "ZMuSingleTrackMatched mass(GeV)", 100,  0., 200. );
00089   h_zMuSingleStandAloneMatched_mass_ = fs->make<TH1D>( "ZMuSingleStandAlonemassMatched", "ZMuSingleStandAloneMatched mass(GeV)", 50,  0., 200. );
00090   h_zMuSingleStandAloneOverlapMatched_mass_ = fs->make<TH1D>( "ZMuSingleStandAloneOverlapmassMatched", "ZMuSingleStandAloneMatched Overlap  mass(GeV)", 50,  0., 200. );
00091 }


Member Function Documentation

void ZMuMuAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 93 of file ZMuMuAnalyzer.cc.

References edm::RefToBase< T >::castTo(), reco::Candidate::daughter(), etacut_, h_zMuMu_mass_, h_zMuMuMatched_mass_, h_zMuSingleStandAlone_mass_, h_zMuSingleStandAloneMatched_mass_, h_zMuSingleStandAloneOverlap_mass_, h_zMuSingleStandAloneOverlapMatched_mass_, h_zMuSingleTrack_mass_, h_zMuSingleTrackMatched_mass_, i, edm::Ref< C, T, F >::id(), edm::Handle< T >::id(), edm::ProductID::id(), iso1, isocut_, j, edm::Ref< C, T, F >::key(), m, m1, reco::Particle::mass(), reco::Candidate::masterClone(), maxZmass_, minZmass_, muIso_, overlap_, ptcut_, ptSTAcut_, standAloneIso_, trackIso_, zMuMu_, zMuMuMap_, zMuStandAlone_, zMuStandAloneMap_, zMuTrack_, and zMuTrackMap_.

00093                                                                              {
00094   Handle<CandidateCollection> zMuMu;
00095   event.getByLabel(zMuMu_, zMuMu);
00096   Handle<CandidateCollection> zMuTrack;
00097   event.getByLabel( zMuTrack_, zMuTrack );
00098   Handle<CandidateCollection> zMuStandAlone;
00099   event.getByLabel( zMuStandAlone_, zMuStandAlone );  
00100 
00101   size_t nZMuMu = zMuMu->size();
00102   size_t nZTrackMu = zMuTrack->size();
00103   size_t nZStandAloneMu = zMuStandAlone->size();
00104   static const double zMass = 91.1876; // PDG Z mass
00105 
00106   //  cout << "nZMuMu = " << nZMuMu << endl;
00107   //  cout << "nZTrackMu = " << nZTrackMu << endl;
00108   //  cout << "nZStandAloneMu = " << nZStandAloneMu << endl;
00109  
00110   Handle<CandMatchMap> zMuMuMap;
00111   if( nZMuMu > 0 ) {
00112     event.getByLabel(zMuMuMap_, zMuMuMap);
00113   }
00114 
00115   Handle<CandMatchMap> zMuTrackMap;
00116   if( nZTrackMu > 0 ) {
00117     event.getByLabel( zMuTrackMap_, zMuTrackMap );
00118   }
00119 
00120   Handle<CandMatchMap> zMuStandAloneMap;
00121   if( nZStandAloneMu > 0 ) {
00122     event.getByLabel( zMuStandAloneMap_, zMuStandAloneMap );  
00123   }    
00124 
00125   Handle<IsolationCollection> muIso;
00126   event.getByLabel(muIso_, muIso);
00127   ProductID muIsoId = muIso->keyProduct().id();
00128   Handle<IsolationCollection> trackIso;
00129   event.getByLabel(trackIso_, trackIso);
00130   ProductID trackIsoId = trackIso->keyProduct().id();
00131   
00132   Handle<IsolationCollection> standAloneIso;
00133   event.getByLabel(standAloneIso_, standAloneIso);
00134   ProductID standAloneIsoId = standAloneIso->keyProduct().id();
00135   
00136   if (nZMuMu > 0) {
00137     double mass = 1000000.;
00138     for( size_t i = 0; i < nZMuMu; i++ ) {
00139       const Candidate & zmmCand = (*zMuMu)[ i ];
00140       CandidateRef CandRef(zMuMu,i);
00141       CandidateRef lep1 = zmmCand.daughter( 0 )->masterClone().castTo<CandidateRef>();
00142       CandidateRef lep2 = zmmCand.daughter( 1 )->masterClone().castTo<CandidateRef>();
00143       
00144       const  double iso1 = muIso->value( lep1.key() );  
00145       const  double iso2 = muIso->value( lep2.key() );  
00146       
00147       double m = zmmCand.mass();
00148       if (lep1->pt()>ptcut_ && lep2->pt()>ptcut_ &&    
00149           fabs(lep1->eta())<etacut_ && fabs(lep2->eta())<etacut_ &&
00150           m>minZmass_ && m<maxZmass_ && iso1 < isocut_ && iso2 <isocut_) {
00151         if ( fabs( mass - zMass ) > fabs( m - zMass ) ) {
00152           mass = m;
00153         }
00154         
00155         h_zMuMu_mass_->Fill( mass );      
00156         CandMatchMap::const_iterator m0 = zMuMuMap->find(CandRef);
00157         if( m0 != zMuMuMap->end()) {
00158             h_zMuMuMatched_mass_->Fill( mass );
00159         }
00160       }
00161     }
00162   }
00163   
00164   //ZmuSingleTRack
00165   if (nZMuMu ==0 && nZTrackMu>0) {
00166     for( size_t j = 0; j < nZTrackMu; j++ ) {
00167       const Candidate & ztmCand = (*zMuTrack)[ j ];
00168       CandidateRef CandRef(zMuTrack,j);
00169       CandidateRef lep1 = ztmCand.daughter( 0 )->masterClone().castTo<CandidateRef>();
00170       CandidateRef lep2 = ztmCand.daughter( 1 )->masterClone().castTo<CandidateRef>();
00171       
00172       ProductID id1 = lep1.id();
00173       ProductID id2 = lep2.id();
00174       double iso1 = -1;
00175       double iso2 = -1;
00176       
00177       if( id1 == muIsoId ) 
00178         iso1 = muIso->value( lep1.key() );      
00179       else if ( id1 == trackIsoId )
00180         iso1 = trackIso->value( lep1.key() );   
00181       
00182       if( id2 == muIsoId ) 
00183               iso2 = muIso->value( lep2.key() );        
00184       else if ( id2 == trackIsoId )
00185         iso2 = trackIso->value( lep2.key() );   
00186  
00187       double mt = ztmCand.mass();
00188       if (lep1->pt()>ptcut_ && lep2->pt()>ptcut_ &&    
00189           fabs(lep1->eta())<etacut_ && fabs(lep2->eta())<etacut_ &&
00190           mt>minZmass_ && mt<maxZmass_ && iso1<isocut_ && iso2 <isocut_) {
00191         h_zMuSingleTrack_mass_->Fill( mt );
00192         CandMatchMap::const_iterator m0 = zMuTrackMap->find(CandRef);
00193         if( m0 != zMuTrackMap->end()) {
00194           h_zMuSingleTrackMatched_mass_->Fill( mt );
00195         }
00196       }
00197     }
00198   }   
00199   
00200   //ZmuSingleStandAlone
00201   if (nZMuMu ==0 && nZStandAloneMu>0) {
00202     //      size_t index = 1000;
00203     for( size_t j = 0; j < nZStandAloneMu; j++ ) {
00204       const Candidate & zsmCand = (*zMuStandAlone)[ j ];
00205       CandidateRef CandRef(zMuStandAlone,j);
00206       CandidateRef lep1 = zsmCand.daughter( 0 )->masterClone().castTo<CandidateRef>();
00207       CandidateRef lep2 = zsmCand.daughter( 1 )->masterClone().castTo<CandidateRef>();
00208       
00209       ProductID id1 = lep1.id();
00210       ProductID id2 = lep2.id();
00211       double iso1 = -1;
00212       double iso2 = -1;
00213       
00214       if( id1 == muIsoId ) 
00215         iso1 = muIso->value( lep1.key() );      
00216       else if ( id1 == standAloneIsoId )
00217         iso1 = standAloneIso->value( lep1.key() );      
00218       
00219       if( id2 == muIsoId ) 
00220         iso2 = muIso->value( lep2.key() );      
00221       else if ( id2 == standAloneIsoId )
00222         iso2 = standAloneIso->value( lep2.key() );      
00223       
00224       double ms = zsmCand.mass();
00225       if (lep1->pt()>ptSTAcut_ && lep2->pt()>ptSTAcut_ &&    
00226           fabs(lep1->eta())<etacut_ && fabs(lep2->eta())<etacut_ &&
00227           ms>minZmass_ && ms<maxZmass_ && iso1<isocut_ && iso2 <isocut_) {
00228         h_zMuSingleStandAlone_mass_->Fill( ms );
00229         CandMatchMap::const_iterator m0 = zMuStandAloneMap->find(CandRef);
00230         if( m0 != zMuStandAloneMap->end()) {
00231           h_zMuSingleStandAloneMatched_mass_->Fill( ms );
00232         }
00233         
00234         bool noOverlap = true;
00235         for( size_t j = 0; j < zMuTrack->size(); j++ ) {
00236           const Candidate & ztmCand = (*zMuTrack)[ j ];
00237           CandidateRef CandReft(zMuTrack,j);
00238           
00239           CandidateRef lep1 = ztmCand.daughter( 0 )->masterClone().castTo<CandidateRef>();
00240           CandidateRef lep2 = ztmCand.daughter( 1 )->masterClone().castTo<CandidateRef>();
00241           
00242           ProductID id1 = lep1.id();
00243           ProductID id2 = lep2.id();
00244           double iso1 = -1;
00245           double iso2 = -1;
00246           
00247           if( id1 == muIsoId ) 
00248             iso1 = muIso->value( lep1.key() );  
00249           else if ( id1 == trackIsoId )
00250             iso1 = trackIso->value( lep1.key() );       
00251           
00252           if( id2 == muIsoId ) 
00253             iso2 = muIso->value( lep2.key() );  
00254           else if ( id2 == trackIsoId )
00255             iso2 = trackIso->value( lep2.key() );       
00256           
00257           double mt = ztmCand.mass();
00258           if (lep1->pt()>ptcut_ && lep2->pt()>ptcut_ &&    
00259               fabs(lep1->eta())<etacut_ && fabs(lep2->eta())<etacut_ &&
00260               mt>minZmass_ && mt<maxZmass_ && iso1<isocut_ && iso2 <isocut_) {
00261             
00262             if ( overlap_( ztmCand, zsmCand ) ) {
00263               noOverlap = false; 
00264               break;
00265             }
00266             if (!noOverlap ) {
00267               h_zMuSingleStandAloneOverlap_mass_->Fill( ms ); 
00268               CandMatchMap::const_iterator m1 = zMuTrackMap->find(CandReft);
00269               CandMatchMap::const_iterator m2 = zMuStandAloneMap->find(CandRef);
00270               
00271               if( m1 != zMuTrackMap->end()  && m2 != zMuStandAloneMap->end()  ) {
00272                 h_zMuSingleStandAloneOverlapMatched_mass_->Fill( ms );
00273               }
00274             }
00275           }         
00276         }
00277       }
00278     }
00279   }
00280 }  

void ZMuMuAnalyzer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 282 of file ZMuMuAnalyzer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), h_zMuMu_mass_, h_zMuMuMatched_mass_, h_zMuSingleStandAlone_mass_, h_zMuSingleStandAloneMatched_mass_, h_zMuSingleStandAloneOverlap_mass_, h_zMuSingleStandAloneOverlapMatched_mass_, h_zMuSingleTrack_mass_, and h_zMuSingleTrackMatched_mass_.

00282                            {
00283   double Nzmm = h_zMuMu_mass_->GetEntries() ;
00284   double Nzsm = h_zMuSingleStandAlone_mass_->GetEntries()  ;
00285   double Nzsnom = h_zMuSingleStandAloneOverlap_mass_->GetEntries()  ;
00286   double Nztm = h_zMuSingleTrack_mass_->GetEntries();
00287   
00288   double NzmmMatch = h_zMuMuMatched_mass_->GetEntries() ;
00289   double NzsmMatch = h_zMuSingleStandAloneMatched_mass_->GetEntries()  ;
00290   double NzsnomMatch = h_zMuSingleStandAloneOverlapMatched_mass_->GetEntries()  ;
00291   double NztmMatch = h_zMuSingleTrackMatched_mass_->GetEntries();
00292 
00293   cout<<"-- N SingleTrackMu = "<<Nztm<<endl;
00294   cout<<"-----N SinglStandAloneMu = "<<Nzsm<<endl;
00295   cout<<"-----N SingleStandAloneOverlapMu = "<<Nzsnom<<endl;
00296   cout<<"------- N MuMu = "<<Nzmm<<endl;
00297   
00298   cout<<"-- N SingleTrackMuMatched = "<<NztmMatch<<endl;
00299   cout<<"-----N SinglStandAloneMuMatched = "<<NzsmMatch<<endl;
00300   cout<<"-----N SingleStandAloneOverlapMuMatched  = "<<NzsnomMatch<<endl;
00301   cout<<"------- N MuMu Matched  = "<<NzmmMatch<<endl;
00302 }


Member Data Documentation

double ZMuMuAnalyzer::etacut_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

TH1D* ZMuMuAnalyzer::h_zMuMu_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuMuMatched_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleStandAlone_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleStandAloneMatched_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleStandAloneOverlap_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleStandAloneOverlapMatched_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleTrack_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

TH1D * ZMuMuAnalyzer::h_zMuSingleTrackMatched_mass_ [private]

Definition at line 55 of file ZMuMuAnalyzer.cc.

Referenced by analyze(), endJob(), and ZMuMuAnalyzer().

double ZMuMuAnalyzer::isocut_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

double ZMuMuAnalyzer::maxZmass_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

double ZMuMuAnalyzer::minZmass_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::muIso_ [private]

Definition at line 52 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

OverlapChecker ZMuMuAnalyzer::overlap_ [private]

Definition at line 48 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

double ZMuMuAnalyzer::ptcut_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

double ZMuMuAnalyzer::ptSTAcut_ [private]

Definition at line 54 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::standAloneIso_ [private]

Definition at line 52 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::trackIso_ [private]

Definition at line 52 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuMu_ [private]

Definition at line 49 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuMuMap_ [private]

Definition at line 53 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuStandAlone_ [private]

Definition at line 51 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuStandAloneMap_ [private]

Definition at line 53 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuTrack_ [private]

Definition at line 50 of file ZMuMuAnalyzer.cc.

Referenced by analyze().

InputTag ZMuMuAnalyzer::zMuTrackMap_ [private]

Definition at line 53 of file ZMuMuAnalyzer.cc.

Referenced by analyze().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:36:07 2009 for CMSSW by  doxygen 1.5.4