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

Comparing UserCode/Morgan/src/JetAnalyzer.cc (file contents):
Revision 1.3 by lethuill, Mon Dec 15 19:08:52 2008 UTC vs.
Revision 1.6 by lethuill, Thu Jan 8 15:43:30 2009 UTC

# Line 96 | Line 96 | void JetAnalyzer::Process(const edm::Eve
96                          ,jet->vx()
97                          ,jet->vy()
98                          ,jet->vz()
99 <                        ,abs(jet->pdgId())
99 >                        ,jet->pdgId()
100                          ,jet->charge()
101                  );
102  
# Line 234 | Line 234 | void JetAnalyzer::Process(const edm::Eve
234                          // Matched genParticle
235                          if (useMC_)
236                          {
237 <                                if ( patJet->genParton() != NULL )
238 <                                {
239 <                                        localJet.setMomentumMCParton(TLorentzVector(patJet->genParton()->px(),patJet->genParton()->py(),patJet->genParton()->pz(),patJet->genParton()->energy()));
240 <                                        localJet.setVertexMCParton(TVector3(patJet->genParton()->vx(),patJet->genParton()->vy(),patJet->genParton()->vz() ) );
241 <                                        localJet.setPdgIdMCParton(patJet->genParton()->pdgId());
237 >                                // MC truth associator index
238 >                                if ((patJet->genParticleRef()).isNonnull()) {
239 >                                        localJet.setGenParticleIndex((patJet->genParticleRef()).index());
240 >                                } else {
241 >                                        localJet.setGenParticleIndex(-1);
242                                  }
243  
244 +                                // Matched generated jet
245 +                                // FIXME - Keep genJet index or UID instead
246 +                                // genJet stocked in MCParticles branch
247 +                                /*
248                                  if ( patJet->genJet() != NULL )
249                                  {
250                                          localJet.setMomentumMCJet(TLorentzVector(patJet->genJet()->px(),patJet->genJet()->py(),patJet->genJet()->pz(),patJet->genJet()->energy()));
251                                          localJet.setVertexMCJet(TVector3(patJet->genJet()->vx(),patJet->genJet()->vy(),patJet->genJet()->vz() ));
252                                          localJet.setPdgIdMCJet(patJet->genJet()->pdgId());
253                                  }
254 +                                */
255 +
256 +                                // check if jet comes from a top
257 +                                bool IsTopJet =  false;
258 +                                if(patJet->genParton())
259 +                                {
260 +                                        const reco::Candidate* gen = patJet->genParton();
261 +                                        while(gen->mother())
262 +                                        {
263 +                                                if(abs((gen->mother())->pdgId()) == 6)
264 +                                                {
265 +                                                        IsTopJet =  true;
266 +                                                        break;
267 +                                                }
268 +                                                else
269 +                                                {
270 +                                                        gen = (gen->mother() );
271 +                                                }
272 +                                        }
273 +                                }
274 +                                localJet.setIsTopJet(IsTopJet);
275                          }
276                  }
277  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines