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.10 by lethuill, Fri Apr 17 15:17:38 2009 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):LeptonAnalyzer(producersNames),useMC_(false),doPrimaryVertex_(false)
8   {
9 <        dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
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):LeptonAnalyzer(producersNames, verbosity)
14   {
15 <        dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
15 >        //dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
16          muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
17 +        useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC");
18 +        doPrimaryVertex_ = myConfig.getUntrackedParameter<bool>("doPrimaryVertex");
19   }
20  
21   MuonAnalyzer::~MuonAnalyzer()
# Line 56 | Line 58 | void MuonAnalyzer::Process(const edm::Ev
58                          ,muon->vx()
59                          ,muon->vy()
60                          ,muon->vz()
61 <                        ,13
61 >                        ,muon->pdgId()
62                          ,muon->charge()
63                  );
64  
65 +                // Variables from reco::Muon
66                  sintheta = sin( localMuon.Theta() );
67  
68                  localMuon.setCaloEnergy(
# Line 108 | Line 111 | void MuonAnalyzer::Process(const edm::Ev
111                          ,int(muon->isGood(reco::Muon::TM2DCompatibilityTight))
112                  );
113  
114 +                // Variables from reco::Track
115 +                reco::TrackRef track = muon->innerTrack();
116 +                if ( track.isNonnull() )
117 +                {
118 +                        const reco::HitPattern& hit = track->hitPattern();
119 +                        localMuon.setPixelLayersWithMeasurement(hit.pixelLayersWithMeasurement());
120 +                        localMuon.setStripLayersWithMeasurement(hit.stripLayersWithMeasurement());
121 +                        // FIXME - replace with double dxy(const Point& myBeamSpot) method ?
122 +                        localMuon.setD0(track->d0());
123 +                        localMuon.setD0Error(track->d0Error());
124 +                        // FIXME - replace with double dsz(const Point& myBeamSpot) method ?
125 +                        localMuon.setDsz(track->dsz());
126 +                        localMuon.setDszError(track->dszError());
127 +                        localMuon.setNormalizedChi2(track->normalizedChi2());
128 +                        localMuon.setPtError(track->ptError());
129 +                        localMuon.setEtaError(track->etaError());
130 +                        localMuon.setPhiError(track->phiError());
131 +                        
132 +                        if(doPrimaryVertex_)
133 +                        {
134 +                                const reco::TransientTrack transtrack = trackBuilder_->build( track ) ;
135 +                                float sig3d = IP3DSignificance(transtrack);
136 +                                localMuon.setIP3DSignificance(sig3d);
137 +                        }
138 +                }
139 +
140 +
141                  if( dataType_=="RECO" || dataType_=="AOD" )
142                  {
143                          // Some specific methods requiring  RECO / AOD format
# Line 124 | Line 154 | void MuonAnalyzer::Process(const edm::Ev
154                          //
155                          // leptonID apparently not initialised in PAT...
156                          // cout << "Valeur pourrie du leptonID=" << patMuon->leptonID() << endl;
157 +
158 +                        if(useMC_)
159 +                        {
160 +                                // MC truth associator index
161 +                                if ((patMuon->genParticleRef()).isNonnull()) {
162 +                                        localMuon.setGenParticleIndex((patMuon->genParticleRef()).index());
163 +                                } else {
164 +                                        localMuon.setGenParticleIndex(-1);
165 +                                }
166 +                        }
167                  }
168  
169                  new( (*rootMuons)[j] ) TRootMuon(localMuon);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines