63 theSeedPropagatorName = updatorPar.
getParameter<
string>(
"Propagator");
87 if (theService)
delete theService;
99 dirName+=algo.
label()+
"_";
102 if (dirName.find(
"Tracks")<dirName.length()){
103 dirName.replace(dirName.find(
"Tracks"),6,
"");
110 simName+=
"/SimTracks";
122 hRecoSeedInner =
new HTrack(dirName.c_str(),
"RecoSeed",
"Inner");
123 hRecoSeedPCA =
new HTrack(dirName.c_str(),
"RecoSeed",
"PCA");
126 if(doTracksAnalysis){
129 hRecoTracksPCA =
new HTrack(dirName.c_str(),
"RecoTracks",
"PCA");
130 hRecoTracksInner =
new HTrack(dirName.c_str(),
"RecoTracks",
"Inner");
131 hRecoTracksOuter =
new HTrack(dirName.c_str(),
"RecoTracks",
"Outer");
140 hChi2VsEta =
dbe_->
book2D(
"chi2VsEta",
"#chi^2 VS #eta",120,-3.,3.,200,0,200);
142 hChi2Norm =
dbe_->
book1D(
"chi2Norm",
"Normalized #chi^2",400,0,100);
143 hChi2NormVsEta =
dbe_->
book2D(
"chi2NormVsEta",
"Normalized #chi^2 VS #eta",120,-3.,3.,400,0,100);
145 hHitsPerTrack =
dbe_->
book1D(
"HitsPerTrack",
"Number of hits per track",55,0,55);
146 hHitsPerTrackVsEta =
dbe_->
book2D(
"HitsPerTrackVsEta",
"Number of hits per track VS #eta",
149 hDof =
dbe_->
book1D(
"dof",
"Number of Degree of Freedom",55,0,55);
150 hDofVsEta =
dbe_->
book2D(
"dofVsEta",
"Number of Degree of Freedom VS #eta",120,-3.,3.,55,0,55);
152 hChi2Prob =
dbe_->
book1D(
"chi2Prob",
"#chi^2 probability",200,0,1);
153 hChi2ProbVsEta =
dbe_->
book2D(
"chi2ProbVsEta",
"#chi^2 probability VS #eta",120,-3.,3.,200,0,1);
155 hNumberOfTracks =
dbe_->
book1D(
"NumberOfTracks",
"Number of reconstructed tracks per event",200,0,200);
156 hNumberOfTracksVsEta =
dbe_->
book2D(
"NumberOfTracksVsEta",
157 "Number of reconstructed tracks per event VS #eta",
160 hChargeVsEta =
dbe_->
book2D(
"ChargeVsEta",
"Charge vs #eta gen",120,-3.,3.,4,-2.,2.);
161 hChargeVsPt =
dbe_->
book2D(
"ChargeVsPt",
"Charge vs P_{T} gen",250,0,200,4,-2.,2.);
162 hPtRecVsPtGen =
dbe_->
book2D(
"PtRecVsPtGen",
"P_{T} rec vs P_{T} gen",250,0,200,250,0,200);
164 hDeltaPtVsEta =
dbe_->
book2D(
"DeltaPtVsEta",
"#Delta P_{t} vs #eta gen",120,-3.,3.,500,-250.,250.);
165 hDeltaPt_In_Out_VsEta =
dbe_->
book2D(
"DeltaPt_In_Out_VsEta_",
"P^{in}_{t} - P^{out}_{t} vs #eta gen",120,-3.,3.,500,-250.,250.);
172 LogInfo(
"MuonTrackAnalyzer")<<
"Number of Sim tracks: " << numberOfSimTracks;
174 LogInfo(
"MuonTrackAnalyzer") <<
"Number of Reco tracks: " << numberOfRecTracks;
177 if(doTracksAnalysis){
178 double eff = hRecoTracksPCA->computeEfficiency(hSimTracks);
179 LogInfo(
"MuonTrackAnalyzer") <<
" *Track Efficiency* = "<< eff <<
"%";
183 double eff = hRecoSeedInner->computeEfficiency(hSimTracks);
184 LogInfo(
"MuonTrackAnalyzer")<<
" *Seed Efficiency* = "<< eff <<
"%";
192 LogDebug(
"MuonTrackAnalyzer") <<
"Run: " <<
event.id().run() <<
" Event: " <<
event.id().event();
195 theService->update(eventSetup);
198 event.getByLabel(
"g4SimHits",simTracks);
199 fillPlots(event,simTracks);
203 tracksAnalysis(event,eventSetup,simTracks);
206 seedsAnalysis(event,eventSetup,simTracks);
218 event.getByLabel(theSeedsLabel, seeds);
220 LogTrace(
"MuonTrackAnalyzer")<<
"Number of reconstructed seeds: " << seeds->size()<<endl;
222 for(TrajectorySeedCollection::const_iterator seed = seeds->begin();
223 seed != seeds->end(); ++seed){
225 pair<SimTrack,double>
sim = getSimTrack(seedTSOS,simTracks);
226 fillPlots(seedTSOS, sim.first,
227 hRecoSeedInner, debug);
229 std::pair<bool,FreeTrajectoryState> propSeed =
230 theUpdator->propagateToNominalLine(seedTSOS);
232 fillPlots(propSeed.second, sim.first,
233 hRecoSeedPCA, debug);
235 LogTrace(
"MuonTrackAnalyzer")<<
"Error in seed propagation"<<endl;
248 event.getByLabel(theTracksLabel, tracks);
250 LogTrace(
"MuonTrackAnalyzer")<<
"Reconstructed tracks: " << tracks->size() << endl;
251 hNumberOfTracks->Fill(tracks->size());
253 if(tracks->size()) numberOfRecTracks++;
256 for(reco::TrackCollection::const_iterator
t = tracks->begin();
t != tracks->end(); ++
t) {
264 pair<SimTrack,double>
sim = getSimTrack(pcaTSOS,simTracks);
266 hNumberOfTracksVsEta->Fill(simTrack.
momentum().eta(), tracks->size());
267 fillPlots(track,simTrack);
269 LogTrace(
"MuonTrackAnalyzer") <<
"State at the outer surface: " << endl;
270 fillPlots(outerTSOS,simTrack,hRecoTracksOuter,debug);
272 LogTrace(
"MuonTrackAnalyzer") <<
"State at the inner surface: " << endl;
273 fillPlots(innerTSOS,simTrack,hRecoTracksInner,debug);
275 LogTrace(
"MuonTrackAnalyzer") <<
"State at PCA: " << endl;
276 fillPlots(pcaTSOS,simTrack,hRecoTracksPCA,debug);
278 double deltaPt_in_out = innerTSOS.
globalMomentum().
perp()-outerTSOS.globalMomentum().perp();
279 hDeltaPt_In_Out_VsEta->Fill(simTrack.
momentum().eta(),deltaPt_in_out);
282 hDeltaPtVsEta->Fill(simTrack.
momentum().eta(),deltaPt_pca_sim);
290 LogTrace(
"MuonTrackAnalyzer")<<
"--------------------------------------------"<<endl;
298 if(!checkMuonSimHitPresence(event,simTracks))
return;
301 SimTrackContainer::const_iterator simTrack;
302 LogTrace(
"MuonTrackAnalyzer")<<
"Simulated tracks: "<<simTracks->size()<<endl;
304 for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack)
305 if (
abs((*simTrack).type()) == 13) {
307 if( !isInTheAcceptance( (*simTrack).momentum().eta()) )
continue;
311 LogTrace(
"MuonTrackAnalyzer")<<
"Simualted muon:"<<endl;
312 LogTrace(
"MuonTrackAnalyzer")<<
"Sim pT: "<<
sqrt((*simTrack).momentum().perp2())<<endl;
313 LogTrace(
"MuonTrackAnalyzer")<<
"Sim Eta: "<<(*simTrack).momentum().eta()<<endl;
315 hSimTracks->Fill((*simTrack).momentum().mag(),
316 sqrt((*simTrack).momentum().perp2()),
317 (*simTrack).momentum().eta(),
318 (*simTrack).momentum().phi(),
319 -(*simTrack).type()/
abs((*simTrack).type()) );
320 LogTrace(
"MuonTrackAnalyzer") <<
"hSimTracks filled" << endl;
323 LogTrace(
"MuonTrackAnalyzer") << endl;
329 LogTrace(
"MuonTrackAnalyzer")<<
"Analizer: New track, chi2: "<<track.
chi2()<<
" dof: "<<track.
ndof()<<endl;
331 hDof->Fill(track.
ndof());
337 hChi2VsEta->Fill(simTrack.
momentum().eta(),track.
chi2());
341 hDofVsEta->Fill(simTrack.
momentum().eta(),track.
ndof());
349 histo->
Fill(recoTSOS);
353 double deltaRVal = deltaR<double>(
reco.eta(),
reco.phi(),
365 histo->
Fill(recoFTS);
369 double deltaRVal = deltaR<double>(
reco.eta(),
reco.phi(),
395 SimTrackContainer::const_iterator simTrack;
399 double bestDeltaR = 10e5;
400 for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
401 if (
abs((*simTrack).type()) != 13)
continue;
406 double newDeltaR = deltaR<double>(vect.eta(),vect.phi(),
407 simTrack->momentum().eta(),simTrack->momentum().phi());
409 if ( newDeltaR < bestDeltaR ) {
410 LogTrace(
"MuonTrackAnalyzer") <<
"Matching Track with DeltaR = " << newDeltaR<<endl;
411 bestDeltaR = newDeltaR;
415 return pair<SimTrack,double>(
result,bestDeltaR);
422 return (
abs(eta) <= 2.4 ) ?
true :
false;
424 return (
abs(eta) < 1.1 ) ?
true :
false;
426 return (
abs(eta) >= 1.1 &&
abs(eta) <= 2.4 ) ?
true :
false;
428 {
LogTrace(
"MuonTrackAnalyzer")<<
"No correct Eta range selected!! "<<endl;
return false;}
437 event.getByLabel(theDTSimHitLabel.instance(),theDTSimHitLabel.label(), dtSimHits);
440 event.getByLabel(theCSCSimHitLabel.instance(),theCSCSimHitLabel.label(), cscSimHits);
443 event.getByLabel(theRPCSimHitLabel.instance(),theRPCSimHitLabel.label(), rpcSimHits);
445 map<unsigned int, vector<const PSimHit*> > mapOfMuonSimHits;
447 for(PSimHitContainer::const_iterator simhit = dtSimHits->begin();
448 simhit != dtSimHits->end(); ++simhit) {
449 if (
abs(simhit->particleType()) != 13)
continue;
450 mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
453 for(PSimHitContainer::const_iterator simhit = cscSimHits->begin();
454 simhit != cscSimHits->end(); ++simhit) {
455 if (
abs(simhit->particleType()) != 13)
continue;
456 mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
459 for(PSimHitContainer::const_iterator simhit = rpcSimHits->begin();
460 simhit != rpcSimHits->end(); ++simhit) {
461 if (
abs(simhit->particleType()) != 13)
continue;
462 mapOfMuonSimHits[simhit->trackId()].push_back(&*simhit);
465 bool presence =
false;
467 for (SimTrackContainer::const_iterator simTrack = simTracks->begin();
468 simTrack != simTracks->end(); ++simTrack){
470 if (
abs(simTrack->type()) != 13)
continue;
472 map<unsigned int, vector<const PSimHit*> >::const_iterator mapIterator =
473 mapOfMuonSimHits.find(simTrack->trackId());
475 if (mapIterator != mapOfMuonSimHits.end())
492 const GeomDet* gdet = theService->trackingGeometry()->idToDet( seedDetId );
497 const DetLayer *initialLayer = theService->detLayerGeometry()->idToLayer( seedDetId );
502 vector<const DetLayer*> detLayers;
503 detLayers = initialLayer->compatibleLayers( *initialState.
freeState(),detLayerOrder);
506 if(detLayers.size()){
507 const DetLayer* finalLayer = detLayers.back();
510 result = propagatedState;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
void computeResolutionAndPull(TrajectoryStateOnSurface &vtx, SimTrack &simTrack)
TrackCharge charge() const
virtual ~MuonTrackAnalyzer()
Destructor.
std::pair< SimTrack, double > getSimTrack(TrajectoryStateOnSurface &tsos, edm::Handle< edm::SimTrackContainer > simTracks)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
bool checkMuonSimHitPresence(const edm::Event &event, edm::Handle< edm::SimTrackContainer > simTracks)
void cd(void)
go to top directory (ie. root)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
size_t recHitsSize() const
number of RecHits
TrajectoryStateOnSurface getSeedTSOS(const TrajectorySeed &seed)
void seedsAnalysis(const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
double chi2() const
chi-squared of the fit
MuonTrackAnalyzer(const edm::ParameterSet &pset)
Constructor.
std::string dumpFTS(const FreeTrajectoryState &fts) const
std::string dumpTSOS(const TrajectoryStateOnSurface &tsos) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
FreeTrajectoryState * freeState(bool withErrors=true) const
bool isInTheAcceptance(double eta)
tuple MuonUpdatorAtVertex
float ChiSquaredProbability(double chiSquared, double nrDOF)
unsigned int detId() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void Fill(TrajectoryStateOnSurface &)
GlobalVector momentum() const
PTrajectoryStateOnDet const & startingState() const
double normalizedChi2() const
chi-squared divided by n.d.o.f.
double ndof() const
number of degrees of freedom of the fit
void tracksAnalysis(const edm::Event &event, const edm::EventSetup &eventSetup, edm::Handle< edm::SimTrackContainer > simTracks)
GlobalVector globalMomentum() const
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
const math::XYZTLorentzVectorD & momentum() const
particle info...
void showDirStructure(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void fillPlots(const edm::Event &event, edm::Handle< edm::SimTrackContainer > &simTracks)
void setCurrentFolder(const std::string &fullpath)