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.3 by lethuill, Tue Dec 2 17:55:01 2008 UTC vs.
Revision 1.4 by lethuill, Mon Dec 15 19:08:52 2008 UTC

# Line 4 | Line 4 | using namespace std;
4   using namespace reco;
5   using namespace edm;
6  
7 < MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0)
7 > MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):verbosity_(0),useMC_(false)
8   {
9          dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
10          muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
11   }
12  
13 < MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, int verbosity):verbosity_(verbosity)
13 > MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):verbosity_(verbosity)
14   {
15          dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
16          muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
17 +        useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC");
18   }
19  
20   MuonAnalyzer::~MuonAnalyzer()
# Line 60 | Line 61 | void MuonAnalyzer::Process(const edm::Ev
61                          ,muon->charge()
62                  );
63  
64 +                // Variables from reco::Muon
65                  sintheta = sin( localMuon.Theta() );
66  
67                  localMuon.setCaloEnergy(
# Line 124 | Line 126 | void MuonAnalyzer::Process(const edm::Ev
126                          //
127                          // leptonID apparently not initialised in PAT...
128                          // cout << "Valeur pourrie du leptonID=" << patMuon->leptonID() << endl;
127                }
129  
130 +                        if(useMC_)
131 +                        {
132 +                                // MC truth associator index
133 +                                if ((patMuon->genParticleRef()).isNonnull()) {
134 +                                        localMuon.setMuonMCIndex((patMuon->genParticleRef()).index());
135 +                                } else {
136 +                                        localMuon.setMuonMCIndex(-1);
137 +                                }
138 +
139 +                                if ( patMuon->genLepton() != NULL ) {
140 +                                        localMuon.setMomentumMCMuon(patMuon->genLepton()->px(),patMuon->genLepton()->py(),patMuon->genLepton()->pz(),patMuon->genLepton()->energy());
141 +                                        localMuon.setVertexMCMuon(TVector3(patMuon->genLepton()->vx(),patMuon->genLepton()->vy(),patMuon->genLepton()->vz()));
142 +                                        localMuon.setPdgIdMCMuon(patMuon->genLepton()->pdgId());
143 +                                }
144 +                        }
145 +                }
146 +                
147                  new( (*rootMuons)[j] ) TRootMuon(localMuon);
148                  if(verbosity_>2) cout << "   ["<< setw(3) << j << "] " << localMuon << endl;
149          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines