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

Comparing UserCode/Morgan/src/MuonAnalyzer.cc (file contents):
Revision 1.2 by lethuill, Mon Dec 1 15:58:05 2008 UTC vs.
Revision 1.3 by lethuill, Tue Dec 2 17:55:01 2008 UTC

# Line 44 | Line 44 | void MuonAnalyzer::Process(const edm::Ev
44  
45          for (unsigned int j=0; j<nMuons; j++)
46          {
47 <                const reco::Candidate* muon = 0;        
48 <                if( dataType_=="RECO" || dataType_=="AOD" ) muon = (const reco::Candidate*) ( & ((*recoMuons)[j]) );
49 <                if( dataType_=="PAT" || dataType_=="PATAOD" ) muon = (const reco::Candidate*) ( & ((*patMuons)[j]) );
47 >                const reco::Muon* muon = 0;    
48 >                if( dataType_=="RECO" || dataType_=="AOD" ) muon =  &((*recoMuons)[j]);
49 >                if( dataType_=="PAT" || dataType_=="PATAOD" ) muon = (const reco::Muon*) ( & ((*patMuons)[j]) );
50  
51                  TRootMuon localMuon(
52 <                                muon->px()
53 <                                ,muon->py()
54 <                                ,muon->pz()
55 <                                ,muon->energy()
56 <                                ,muon->vx()
57 <                                ,muon->vy()
58 <                                ,muon->vz()
59 <                                ,13
60 <                                ,muon->charge()
52 >                        muon->px()
53 >                        ,muon->py()
54 >                        ,muon->pz()
55 >                        ,muon->energy()
56 >                        ,muon->vx()
57 >                        ,muon->vy()
58 >                        ,muon->vz()
59 >                        ,13
60 >                        ,muon->charge()
61                  );
62  
63                  sintheta = sin( localMuon.Theta() );
64  
65 <                if( dataType_=="RECO" || dataType_=="AOD" || dataType_=="PATAOD")
66 <                {
67 <                        // Some specific methods to reco::Muon
68 <                        const reco::Muon *recoMuon = dynamic_cast<const reco::Muon*>(&*muon);
69 <                        localMuon.setCaloEnergy(
70 <                                recoMuon->calEnergy().em * sintheta
71 <                                ,recoMuon->calEnergy().emS9 * sintheta
72 <                                ,recoMuon->calEnergy().had * sintheta
73 <                                ,recoMuon->calEnergy().hadS9 * sintheta
74 <                                ,recoMuon->calEnergy().ho * sintheta
75 <                                ,recoMuon->calEnergy().hoS9 * sintheta
76 <                                ,recoMuon->caloCompatibility()
77 <                        );
78 <
79 <                        localMuon.setIsoR03(
80 <                                recoMuon->isolationR03().emEt
81 <                                ,recoMuon->isolationR03().hadEt
82 <                                ,recoMuon->isolationR03().hoEt
83 <                                ,recoMuon->isolationR03().sumPt
84 <                                ,recoMuon->isolationR03().nTracks
85 <                                ,recoMuon->isolationR03().nJets
86 <                        );
87 <
88 <                        localMuon.setIsoR05(
89 <                                recoMuon->isolationR05().emEt
90 <                                ,recoMuon->isolationR05().hadEt
91 <                                ,recoMuon->isolationR05().hoEt
92 <                                ,recoMuon->isolationR05().sumPt
93 <                                ,recoMuon->isolationR05().nTracks
94 <                                ,recoMuon->isolationR05().nJets
95 <                        );
96 <
97 <                        //localMuon.setTime( recoMuon->time() );
65 >                localMuon.setCaloEnergy(
66 >                        muon->calEnergy().em * sintheta
67 >                        ,muon->calEnergy().emS9 * sintheta
68 >                        ,muon->calEnergy().had * sintheta
69 >                        ,muon->calEnergy().hadS9 * sintheta
70 >                        ,muon->calEnergy().ho * sintheta
71 >                        ,muon->calEnergy().hoS9 * sintheta
72 >                        ,muon->caloCompatibility()
73 >                );
74 >
75 >                localMuon.setIsoR03(
76 >                        muon->isolationR03().emEt
77 >                        ,muon->isolationR03().hadEt
78 >                        ,muon->isolationR03().hoEt
79 >                        ,muon->isolationR03().sumPt
80 >                        ,muon->isolationR03().nTracks
81 >                        ,muon->isolationR03().nJets
82 >                );
83 >
84 >                localMuon.setIsoR05(
85 >                        muon->isolationR05().emEt
86 >                        ,muon->isolationR05().hadEt
87 >                        ,muon->isolationR05().hoEt
88 >                        ,muon->isolationR05().sumPt
89 >                        ,muon->isolationR05().nTracks
90 >                        ,muon->isolationR05().nJets
91 >                );
92 >
93 >                localMuon.setValidity(
94 >                        muon->isEnergyValid()
95 >                        ,muon->isMatchesValid()
96 >                        ,muon->isIsolationValid()
97 >                );
98 >
99 >                localMuon.setDirection( muon->time().direction() );
100 >                localMuon.setAlgo( muon->type() );
101 >                localMuon.setID(
102 >                        int(muon->isGood(reco::Muon::TrackerMuonArbitrated))
103 >                        ,int(muon->isGood(reco::Muon::AllArbitrated))
104 >                        ,int(muon->isGood(reco::Muon::GlobalMuonPromptTight))
105 >                        ,int(muon->isGood(reco::Muon::TMLastStationLoose))
106 >                        ,int(muon->isGood(reco::Muon::TMLastStationTight))
107 >                        ,int(muon->isGood(reco::Muon::TM2DCompatibilityLoose))
108 >                        ,int(muon->isGood(reco::Muon::TM2DCompatibilityTight))
109 >                );
110  
111 +                if( dataType_=="RECO" || dataType_=="AOD" )
112 +                {
113 +                        // Some specific methods requiring  RECO / AOD format
114 +                        // Do association to genParticle ?
115 +                        // Add InnerTrack, OuterTrack, GlobalTrack infos ?
116                  }
117  
118 <                if( dataType_=="PAT"  )
118 >                if( dataType_=="PATAOD" || dataType_=="PAT" )
119                  {
120                          // Some specific methods to pat::Muon
121                          const pat::Muon *patMuon = dynamic_cast<const pat::Muon*>(&*muon);
122 +                        // Use existing reference to genParticle [ pat::PATObject::genParticleRef() ] ?
123 +                        // Alternative methode for isolation (isoDeposit) ?
124 +                        //
125 +                        // leptonID apparently not initialised in PAT...
126 +                        // cout << "Valeur pourrie du leptonID=" << patMuon->leptonID() << endl;
127                  }
128  
107
129                  new( (*rootMuons)[j] ) TRootMuon(localMuon);
130                  if(verbosity_>2) cout << "   ["<< setw(3) << j << "] " << localMuon << endl;
131          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines