ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/Utils/src/CheckEventContent.cc
(Generate patch)

Comparing UserCode/LJMet/Utils/src/CheckEventContent.cc (file contents):
Revision 1.1 by kukartse, Tue Oct 27 23:24:12 2009 UTC vs.
Revision 1.2 by kukartse, Wed Nov 4 14:12:22 2009 UTC

# Line 32 | Line 32
32   using namespace edm;
33  
34   CheckEventContent::CheckEventContent(const edm::ParameterSet& iConfig){
35 +  std::cout << "=======>: CheckEventContent::CheckEventContent()" << std::endl;
36   }
37  
38  
39   CheckEventContent::~CheckEventContent()
40   {
41 +  std::cout << "=======>: CheckEventContent::~CheckEventContent()" << std::endl;
42   }
43  
44  
45   void
46   CheckEventContent::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
47   {
48 +  std::cout << "=======>: CheckEventContent::analyze()" << std::endl;
49 +  //
50 +  //_____ event book keeping
51 +  //
52 +  unsigned int irun   = (unsigned int)iEvent.id().run();
53 +  // this will work starting with CMSSW_340:
54 +  //unsigned int ilumi  = (unsigned int)iEvent.id().luminosityBlock();
55 +  unsigned int ilumi  = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock();
56 +  unsigned int ievent = (unsigned int)iEvent.id().event();
57 +  cout << std::endl << "===> Provenance: " << std::endl;
58 +  cout << "Run, lumi, event: " << irun << ", " << ilumi << ", "<< ievent << std::endl;
59    //
60    //_____ check trigger
61    //
# Line 65 | Line 78 | CheckEventContent::analyze(const edm::Ev
78    cout << std::endl << "===> Check PAT muons: " << std::endl;
79    Handle< vector< pat::Muon > > muons;
80    iEvent . getByLabel( "selectedLayer1Muons", muons );
81 <  for ( vector<pat::Muon>::const_iterator mu = muons -> begin(); mu != muons -> end(); mu++){
82 <    cout << "Global muon selector: " << mu->isGlobalMuon() << std::endl;
81 >  int muon_coll_size = muons->size();
82 >  cout << "muon collection size: "<< muon_coll_size << endl;
83 >  if (muon_coll_size>0){
84 >    cout << "Global muon selector: " << (*muons)[0].isGlobalMuon() << std::endl;
85 >    double _pt = (*muons)[0].pt();
86 >    double _eta = (*muons)[0].eta();
87 >    double _d0 = (*muons)[0].dB(); // global track
88 >    double _chi2ndof = (*muons)[0].normChi2();
89 >    int _nhits = (*muons)[0].numberOfValidHits();
90 >    cout << "pT= " << _pt << ", eta=" << _eta << std::endl;
91 >    cout << "PAT d0= " << _d0 << ", PAT norm chi2=" << _chi2ndof << std::endl;
92 >    cout << "PAT n of hits on track= " << _nhits << std::endl;
93 >    //
94 >    //_____ check that there is a track
95 >    reco::TrackRef _track = (*muons)[0].track();
96 >    reco::TrackRef _innertrack = (*muons)[0].innerTrack();
97 >    if(_track.isNull()){
98 >      cout << "there is no pat::muon::track()" << endl;
99 >    }
100 >    else{
101 >      cout << "there is a pat::muon::track()" << endl;
102 >    }
103 >    if(_innertrack.isNull()){
104 >      cout << "there is no pat::muon::innerTrack()" << endl;
105 >    }
106 >    else{
107 >      cout << "there is a pat::muon::innerTrack()" << endl;
108 >    }
109 >    //
110 >    //_____ check isolation
111 >    if ( !((*muons)[0].isIsolationValid()) ) {
112 >      cout << "Isolation info is invalid" << endl;
113 >    }
114 >    else{
115 >      cout << "Isolation info is valid..." << endl;
116 >      double _emveto = (*muons)[0].isolationR03().emVetoEt;
117 >      double _hadveto = (*muons)[0].isolationR03().hadVetoEt;
118 >      double _trackiso = (*muons)[0].isolationR03().sumPt;
119 >      double _emcaloiso = (*muons)[0].isolationR03().emEt;
120 >      double _hadcaloiso = (*muons)[0].isolationR03().hadEt;
121 >      cout << "EM veto= " << _emveto << ", Had veto=" << _hadveto << std::endl;
122 >      cout << "Track iso= " << _trackiso << std::endl;
123 >      cout << "EM calo iso= " << _emcaloiso << ", Had calo iso=" << _hadcaloiso << std::endl;
124 >    }
125    }
126    //
127    //_____ check Beam spot _____________________________________________________
# Line 84 | Line 139 | CheckEventContent::analyze(const edm::Ev
139        << "No beam spot available in the event \n";
140    }
141    cout << beamSpot.x0() << "   " << beamSpot.y0() << "   " << beamSpot.z0() << std::endl;
142 +  //
143 +  //_____ check PAT electrons _______________________________________________
144 +  //
145 +  std::cout << std::endl << "===> Check PAT electrons: " << std::endl;
146 +  Handle< vector< pat::Electron > > electrons;
147 +  iEvent . getByLabel( "selectedLayer1Electrons", electrons );
148 +  int electron_coll_size = electrons->size();
149 +  cout << "electron collection size: "<< electron_coll_size << endl;
150 +  if (electron_coll_size>0){
151 +    cout << "Robust tight electron selector: " << (*electrons)[0].electronID("eidRobustTight") << std::endl;
152 +    double _pt = (*electrons)[0].pt();
153 +    double _eta = (*electrons)[0].eta();
154 +    double _d0 = (*electrons)[0].dB();
155 +    cout << "pT= " << _pt << ", eta=" << _eta << std::endl;
156 +    cout << "PAT d0= " << _d0 << std::endl;
157 +    //
158 +    //_____ check that there is a track
159 +    /*
160 +    reco::TrackRef _track = (*electrons)[0].track();
161 +    if(_track.isNull()){
162 +      cout << "there is no pat::electron::track()" << endl;
163 +    }
164 +    else{
165 +      cout << "there is a pat::electron::track()" << endl;
166 +    }
167 +    */
168 +    reco::GsfTrackRef _gsfTrack = (*electrons)[0].gsfTrack();
169 +    if(_gsfTrack.isNull()){
170 +      cout << "there is no pat::electron::gsfTrack()" << endl;
171 +    }
172 +    else{
173 +      cout << "there is a pat::electron::gsfTrack()" << endl;
174 +    }
175 +    //
176 +    //_____ check isolation
177 +      cout << "Isolation info is valid..." << endl;
178 +      double _trackiso = (*electrons)[0].trackIso();
179 +      double _emcaloiso = (*electrons)[0].ecalIso();
180 +      double _hadcaloiso = (*electrons)[0].hcalIso();
181 +      double _caloiso = (*electrons)[0].caloIso();
182 +      cout << "Track iso= " << _trackiso << std::endl;
183 +      cout << "EM calo iso= " << _emcaloiso << ", Had calo iso=" << _hadcaloiso << std::endl;
184 +      cout << "Calo iso= " << _caloiso << std::endl;
185 +  }
186 +  //
187 +  //_____ check PAT jets _______________________________________________
188 +  //
189 +  std::cout << std::endl << "===> Check PAT jets: " << std::endl;
190 +  Handle< vector< pat::Jet > > jets;
191 +  iEvent . getByLabel( "selectedLayer1Jets", jets );
192 +  int jet_coll_size = jets->size();
193 +  cout << "jet collection size: "<< jet_coll_size << endl;
194 +  if (jet_coll_size>0){
195 +    double _pt = (*jets)[0].pt();
196 +    double _eta = (*jets)[0].eta();
197 +    //float _bDiscriminator = (*jets)[0].bDiscriminator("");
198 +    const std::vector<std::pair<std::string, float> > & btag = (*jets)[0].getPairDiscri();
199 +    cout << "B-tagging discriminators: " << endl;
200 +    for (std::vector<std::pair<std::string, float> >::const_iterator _d = btag.begin();
201 +         _d != btag.end();
202 +         ++_d){
203 +      cout << _d->first << " = " << _d->second << endl;
204 +    }
205 +    cout << "pT= " << _pt << ", eta=" << _eta << std::endl;
206 +  }
207   }
208  
209  
210   void
211   CheckEventContent::beginJob()
212   {
213 +  std::cout << "=======>: CheckEventContent::beginJob()" << std::endl;
214   }
215  
216  
217   void
218   CheckEventContent::endJob() {
219 +  std::cout << "=======>: CheckEventContent::endJob()" << std::endl;
220   }
221  
222  
# Line 128 | Line 250 | bool CheckEventContent::is_muon(std::str
250    double _reliso = 10000.0;
251    MeanCounter passed_muons("");
252    for ( vector<pat::Muon>::const_iterator mu = muons -> begin(); mu != muons -> end(); mu++){
131    //_____ check that the muon is global
132    if( !(mu->isGlobalMuon()) ) continue;
133    _pt = mu->pt();
134    _abseta = fabs(mu->eta());
135    //_d0 = mu->dB(); // global track
136    _d0 = -(mu->innerTrack()->dxy(_bs));
137    _chi2ndof = mu->normChi2();
138    _nhits = mu->numberOfValidHits();
139    reco::TrackRef _track = mu->track();
140    //_____ check that there is a track
141    if(_track.isNull()) continue;
142    //_nhits = _track->numberOfValidHits();
143    //_d0 = -(_track->dxy(_bs));
144    //_chi2ndof = _track->normalizedChi2();
145    //_chi2ndof = (_track->chi2())/(_track->ndof());
146    //_____ check that isolation is valid
147    if ( !(mu->isIsolationValid()) ) continue;
148    _emveto = mu->isolationR03().emVetoEt;
149    _hadveto = mu->isolationR03().hadVetoEt;
150    _trackiso = mu->isolationR03().sumPt;
151    _caloiso = mu->isolationR03().emEt + mu->isolationR03().hadEt;
253      _reliso = (_trackiso + _caloiso)/_pt;
254      if (_pt > mPt &&
255          _abseta < mEta &&

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines