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.4 by lethuill, Mon Dec 15 19:08:52 2008 UTC vs.
Revision 1.13 by lethuill, Tue Apr 21 17:08:53 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),useMC_(false)
7 > MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames):LeptonAnalyzer(producersNames),useMC_(false)
8   {
9        dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
9          muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
10   }
11  
12 < MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):verbosity_(verbosity)
12 > MuonAnalyzer::MuonAnalyzer(const edm::ParameterSet& producersNames, const edm::ParameterSet& myConfig, int verbosity):LeptonAnalyzer(producersNames, myConfig, verbosity)
13   {
15        dataType_ = producersNames.getUntrackedParameter<string>("dataType","unknown");
16        muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
14          useMC_ = myConfig.getUntrackedParameter<bool>("doMuonMC");
15 +        muonProducer_ = producersNames.getParameter<edm::InputTag>("muonProducer");
16   }
17  
18   MuonAnalyzer::~MuonAnalyzer()
19   {
20   }
21  
22 < void MuonAnalyzer::Process(const edm::Event& iEvent, TClonesArray* rootMuons)
22 > void MuonAnalyzer::Process(const edm::Event& iEvent, TRootBeamSpot* rootBeamSpot, TClonesArray* rootMuons)
23   {
24  
25          Float_t sintheta = 0.;
# Line 57 | Line 55 | void MuonAnalyzer::Process(const edm::Ev
55                          ,muon->vx()
56                          ,muon->vy()
57                          ,muon->vz()
58 <                        ,13
58 >                        ,muon->pdgId()
59                          ,muon->charge()
60                  );
61  
# Line 110 | Line 108 | void MuonAnalyzer::Process(const edm::Ev
108                          ,int(muon->isGood(reco::Muon::TM2DCompatibilityTight))
109                  );
110  
111 +                // Variables from reco::Track
112 +                
113 +                // Track in muon detector only
114 +                reco::TrackRef outerTK = muon->outerTrack();
115 +                if ( outerTK.isNonnull() )
116 +                {
117 +                        //cout << "outerTK (px,py,pz)=" << outerTK->px() <<" , " << outerTK->py() <<" , " << outerTK->pz() <<" )" << endl;
118 +                        localMuon.setXYZTOuterTrack( outerTK->px(), outerTK->py(), outerTK->pz(), outerTK->p() );
119 +                }
120 +
121 +                // Track in tracker + muon detector
122 +                reco::TrackRef globalTK = muon->globalTrack();
123 +                if ( globalTK.isNonnull() )
124 +                {
125 +                        //cout << "globalTK (px,py,pz)=" << globalTK->px() <<" , " << globalTK->py() <<" , " << globalTK->pz() <<" )" << endl;
126 +                        localMuon.setXYZTGlobalTrack( globalTK->px(), globalTK->py(), globalTK->pz(), globalTK->p() );
127 +                }
128 +
129 +                // Track in tracker only
130 +                reco::TrackRef track = muon->innerTrack();
131 +                if ( track.isNonnull() )
132 +                {
133 +                        //cout << "innerTK (px,py,pz)=" << track->px() <<" , " << track->py() <<" , " << track->pz() <<" )" << endl;
134 +                        localMuon.setXYZTInnerTrack( track->px(), track->py(), track->pz(), track->p() );
135 +                        const reco::HitPattern& hit = track->hitPattern();
136 +                        localMuon.setNumberOfValidPixelHits(hit.numberOfValidPixelHits());
137 +                        localMuon.setNumberOfValidTrackerHits(hit.numberOfValidTrackerHits());
138 +                        localMuon.setPixelLayersWithMeasurement(hit.pixelLayersWithMeasurement());
139 +                        localMuon.setStripLayersWithMeasurement(hit.stripLayersWithMeasurement());
140 +
141 +                        if (doBeamSpot_)
142 +                        {
143 +                                if ( rootBeamSpot->sigmaZ() > 0. ) // Check beam spot was correctly initialised
144 +                                {
145 +                                        const reco::TrackBase::Point point( rootBeamSpot->x(), rootBeamSpot->y(), rootBeamSpot->z() );
146 +                                        localMuon.setD0( -1.*(track->dxy(point)) );
147 +                                        localMuon.setDsz( track->dsz(point) );
148 +                                }
149 +                                else
150 +                                {
151 +                                        localMuon.setD0( -1.*(track->dxy()) );
152 +                                        localMuon.setDsz( track->dsz() );
153 +                                }
154 +                        }
155 +                        else
156 +                        {
157 +                                localMuon.setD0( -1.*(track->dxy()) );
158 +                                localMuon.setDsz( track->dsz() );
159 +                        }
160 +                        
161 +                        localMuon.setD0Error(track->d0Error());
162 +                        localMuon.setDszError(track->dszError());
163 +        
164 +                        localMuon.setNormalizedChi2(track->normalizedChi2());
165 +                        localMuon.setPtError(track->ptError());
166 +                        localMuon.setEtaError(track->etaError());
167 +                        localMuon.setPhiError(track->phiError());
168 +                        
169 +                        if(doPrimaryVertex_)
170 +                        {
171 +                                // FIXME - Should be Tracker track... what if STA muon ?
172 +                                const reco::TransientTrack transtrack = trackBuilder_->build( track ) ;
173 +                                float sig3d = IP3DSignificance(transtrack);
174 +                                localMuon.setIP3DSignificance(sig3d);
175 +                        }
176 +                }
177 +
178 +
179                  if( dataType_=="RECO" || dataType_=="AOD" )
180                  {
181                          // Some specific methods requiring  RECO / AOD format
# Line 131 | Line 197 | void MuonAnalyzer::Process(const edm::Ev
197                          {
198                                  // MC truth associator index
199                                  if ((patMuon->genParticleRef()).isNonnull()) {
200 <                                        localMuon.setMuonMCIndex((patMuon->genParticleRef()).index());
200 >                                        localMuon.setGenParticleIndex((patMuon->genParticleRef()).index());
201                                  } else {
202 <                                        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());
202 >                                        localMuon.setGenParticleIndex(-1);
203                                  }
204                          }
205                  }
206 <                
206 >
207                  new( (*rootMuons)[j] ) TRootMuon(localMuon);
208                  if(verbosity_>2) cout << "   ["<< setw(3) << j << "] " << localMuon << endl;
209          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines