00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023 #include <vector>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "FWCore/Utilities/interface/InputTag.h"
00034 #include "DataFormats/TrackReco/interface/Track.h"
00035 #include "SimTracker/TrackAssociation/interface/TrackAssociatorByHits.h"
00036 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
00037 #include "SimTracker/Records/interface/TrackAssociatorRecord.h"
00038 #include <TH1.h>
00039 #include <TH2.h>
00040 #include <TFile.h>
00041 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00042 #include "TrackingTools/PatternTools/interface/TSCPBuilderNoMaterial.h"
00043 #include "MagneticField/Engine/interface/MagneticField.h"
00044 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00045 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00046 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00047 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00048 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
00049 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00050 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
00051 #include "CommonTools/RecoAlgos/interface/RecoTrackSelector.h"
00052 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00053
00054
00055
00056
00057
00058 class TestOutliers : public edm::EDAnalyzer {
00059 public:
00060 explicit TestOutliers(const edm::ParameterSet&);
00061 ~TestOutliers();
00062
00063
00064 private:
00065 virtual void beginRun(edm::Run & run, const edm::EventSetup&) ;
00066 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00067 virtual void endJob() ;
00068
00069
00070 edm::InputTag trackTagsOut_;
00071 edm::InputTag trackTagsOld_;
00072 edm::InputTag tpTags_;
00073 TrackAssociatorBase * theAssociatorOld;
00074 TrackAssociatorBase * theAssociatorOut;
00075
00076 TrackerHitAssociator* hitAssociator;
00077 edm::ESHandle<TrackerGeometry> theG;
00078 std::string out;
00079 TFile * file;
00080 TH1F *histoPtOut, *histoPtOld ;
00081 TH1F *histoQoverpOut,*histoQoverpOld;
00082 TH1F *histoPhiOut,*histoPhiOld;
00083 TH1F *histoD0Out,*histoD0Old;
00084 TH1F *histoDzOut,*histoDzOld;
00085 TH1F *histoLambdaOut,*histoLambdaOld;
00086 TH1F *deltahits,*deltahitsAssocGained,*deltahitsAssocLost,*hitsPerTrackLost,*hitsPerTrackAssocLost,*hitsPerTrackGained,*hitsPerTrackAssocGained,*deltahitsOK,*deltahitsNO;
00087 TH1F *okcutsOut,*okcutsOld;
00088 TH1F *tracks, *goodbadhits, *process, *goodcluster, *goodprocess, *badcluster, *badprocess;
00089 TH1F *goodhittype, *goodlayer, *goodhittype_clgteq4, *goodlayer_clgteq4, *goodhittype_cllt4, *goodlayer_cllt4, *badhittype, *badlayer;
00090 TH2F *posxy, *poszr;
00091 TH1F *goodpixgteq4_simvecsize, *goodpixlt4_simvecsize;
00092 TH1F *goodst1gteq4_simvecsize, *goodst1lt4_simvecsize;
00093 TH1F *goodst2gteq4_simvecsize, *goodst2lt4_simvecsize;
00094 TH1F *goodprjgteq4_simvecsize, *goodprjlt4_simvecsize;
00095 TH1F *goodpix_clustersize;
00096 TH1F *goodst1_clustersize;
00097 TH1F *goodst2_clustersize;
00098 TH1F *goodprj_clustersize;
00099 TH1F *goodpix_simvecsize;
00100 TH1F *goodst1_simvecsize;
00101 TH1F *goodst2_simvecsize;
00102 TH1F *goodprj_simvecsize;
00103 TH1F *goodhittype_simvecsmall, *goodlayer_simvecsmall, *goodhittype_simvecbig, *goodlayer_simvecbig, *goodbadmerged, *goodbadmergedLost, *goodbadmergedGained;
00104 TH1F *energyLoss,*energyLossMax,*energyLossRatio, *nOfTrackIds, *mergedPull, *mergedlayer, *mergedcluster, *mergedhittype;
00105 TH1F *sizeOut, *sizeOld, *sizeOutT, *sizeOldT;
00106 TH1F *countOutA, *countOutT, *countOldT;
00107 TH1F *gainedhits,*gainedhits2;
00108 TH1F *probXgood,*probXbad,*probXdelta,*probXshared,*probXnoshare;
00109 TH1F *probYgood,*probYbad,*probYdelta,*probYshared,*probYnoshare;
00110 edm::ParameterSet psetold,psetout;
00111 };
00112
00113
00114
00115
00116
00117
00118
00119
00120 using namespace edm;
00121
00122
00123
00124
00125 TestOutliers::TestOutliers(const edm::ParameterSet& iConfig)
00126 :
00127 trackTagsOut_(iConfig.getUntrackedParameter<edm::InputTag>("tracksOut")),
00128 trackTagsOld_(iConfig.getUntrackedParameter<edm::InputTag>("tracksOld")),
00129 tpTags_(iConfig.getUntrackedParameter<edm::InputTag>("tp")),
00130 out(iConfig.getParameter<std::string>("out"))
00131 {
00132 LogTrace("TestOutliers") <<"constructor";
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 psetold = iConfig.getParameter<ParameterSet>("TrackAssociatorByHitsPSetOld");
00143 psetout = iConfig.getParameter<ParameterSet>("TrackAssociatorByHitsPSetOut");
00144 LogTrace("TestOutliers") <<"end constructor";
00145 }
00146
00147
00148 TestOutliers::~TestOutliers()
00149 {
00150
00151
00152
00153
00154 }
00155
00156
00157
00158
00159
00160
00161
00162 void
00163 TestOutliers::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00164
00165 edm::ESHandle<TrackerTopology> tTopo;
00166 iSetup.get<IdealGeometryRecord>().get(tTopo);
00167
00168
00169
00170 using namespace edm;
00171 using namespace std;
00172 using reco::TrackCollection;
00173
00174 LogTrace("TestOutliers") <<"analyze event #" << iEvent.id();
00175
00176 edm::Handle<edm::View<reco::Track> > tracksOut;
00177 iEvent.getByLabel(trackTagsOut_,tracksOut);
00178 edm::Handle<edm::View<reco::Track> > tracksOld;
00179 iEvent.getByLabel(trackTagsOld_,tracksOld);
00180 Handle<TrackingParticleCollection> tps;
00181 iEvent.getByLabel(tpTags_,tps);
00182 edm::Handle<reco::BeamSpot> beamSpot;
00183 iEvent.getByLabel("offlineBeamSpot",beamSpot);
00184
00185 hitAssociator = new TrackerHitAssociator(iEvent);
00186
00187 theAssociatorOld = new TrackAssociatorByHits(psetold);
00188 theAssociatorOut = new TrackAssociatorByHits(psetout);
00189 reco::RecoToSimCollection recSimCollOut=theAssociatorOut->associateRecoToSim(tracksOut, tps, &iEvent,&iSetup);
00190 reco::RecoToSimCollection recSimCollOld=theAssociatorOld->associateRecoToSim(tracksOld, tps, &iEvent,&iSetup);
00191 sizeOut->Fill(recSimCollOut.size());
00192 sizeOld->Fill(recSimCollOld.size());
00193 sizeOutT->Fill(tracksOut->size());
00194 sizeOldT->Fill(tracksOld->size());
00195
00196 LogTrace("TestOutliers") << "tOld size=" << tracksOld->size() << " tOut size=" << tracksOut->size()
00197 << " aOld size=" << recSimCollOld.size() << " aOut size=" << recSimCollOut.size();
00198
00199 #if 0
00200 LogTrace("TestOutliers") << "recSimCollOld.size()=" << recSimCollOld.size() ;
00201 for(reco::TrackCollection::size_type j=0; j<tracksOld->size(); ++j){
00202 reco::TrackRef trackOld(tracksOld, j);
00203
00204 LogTrace("TestOutliers") << "trackOld->pt()=" << trackOld->pt() << " trackOld->numberOfValidHits()=" << trackOld->numberOfValidHits();
00205 std::vector<pair<TrackingParticleRef, double> > tpOld;
00206 if(recSimCollOld.find(trackOld) != recSimCollOld.end()){
00207 tpOld = recSimCollOld[trackOld];
00208 if (tpOld.size()!=0) LogTrace("TestOutliers") << " associated" ;
00209 else LogTrace("TestOutliers") << " NOT associated" ;
00210 } else LogTrace("TestOutliers") << " NOT associated" ;
00211 }
00212 LogTrace("TestOutliers") << "recSimCollOut.size()=" << recSimCollOut.size() ;
00213 for(reco::TrackCollection::size_type j=0; j<tracksOut->size(); ++j){
00214 reco::TrackRef trackOut(tracksOut, j);
00215
00216 LogTrace("TestOutliers") << "trackOut->pt()=" << trackOut->pt() << " trackOut->numberOfValidHits()=" << trackOut->numberOfValidHits();
00217 std::vector<pair<TrackingParticleRef, double> > tpOut;
00218 if(recSimCollOut.find(trackOut) != recSimCollOut.end()){
00219 tpOut = recSimCollOut[trackOut];
00220 if (tpOut.size()!=0) LogTrace("TestOutliers") << " associated" ;
00221 else LogTrace("TestOutliers") << " NOT associated" ;
00222 } else LogTrace("TestOutliers") << " NOT associated" ;
00223 }
00224 #endif
00225
00226 LogTrace("TestOutliers") <<"tracksOut->size()="<<tracksOut->size();
00227 LogTrace("TestOutliers") <<"tracksOld->size()="<<tracksOld->size();
00228
00229 std::vector<unsigned int> outused;
00230 for(unsigned int j=0; j<tracksOld->size(); ++j) {
00231 countOldT->Fill(1);
00232 edm::RefToBase<reco::Track> trackOld(tracksOld, j);
00233 LogTrace("TestOutliers") << "now track old with id=" << j << " seed ref=" << trackOld->seedRef().get() << " pt=" << trackOld->pt()
00234 << " eta=" << trackOld->eta() << " chi2=" << trackOld->normalizedChi2()
00235 << " tip= " << fabs(trackOld->dxy(beamSpot->position()))
00236 << " lip= " << fabs(trackOld->dsz(beamSpot->position()));
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251 std::vector<unsigned int> outtest;
00252 for(unsigned int k=0; k<tracksOut->size(); ++k) {
00253 edm::RefToBase<reco::Track> tmpOut = edm::RefToBase<reco::Track>(tracksOut, k);
00254 if ( tmpOut->seedRef() == trackOld->seedRef() ) {
00255 outtest.push_back(k);
00256 }
00257 }
00258
00259 edm::RefToBase<reco::Track> trackOut;
00260 if (outtest.size()==1) {
00261 trackOut = edm::RefToBase<reco::Track>(tracksOut, outtest[0]);
00262 LogTrace("TestOutliers") << "now track out with id=" << outtest[0] << " seed ref=" << trackOut->seedRef().get() << " pt=" << trackOut->pt();
00263 outused.push_back(outtest[0]);
00264 } else if (outtest.size()>1) {
00265 for(unsigned int p=0; p<outtest.size(); ++p) {
00266 edm::RefToBase<reco::Track> tmpOut = edm::RefToBase<reco::Track>(tracksOut, outtest[p]);
00267 bool allhits = true;
00268 for (trackingRecHit_iterator itOut = tmpOut->recHitsBegin(); itOut!=tmpOut->recHitsEnd(); itOut++) {
00269 if ((*itOut)->isValid()) {
00270 bool thishit = false;
00271 for (trackingRecHit_iterator itOld = trackOld->recHitsBegin(); itOld!=trackOld->recHitsEnd(); itOld++) {
00272 if ((*itOld)->isValid()) {
00273 const TrackingRecHit* kt = &(**itOld);
00274 if ( (*itOut)->sharesInput(kt,TrackingRecHit::some) ) {
00275 thishit = true;
00276 break;
00277 }
00278 }
00279 }
00280 if (!thishit) allhits = false;
00281 }
00282 }
00283 if (allhits) {
00284 trackOut = edm::RefToBase<reco::Track>(tracksOut, outtest[p]);
00285 LogTrace("TestOutliers") << "now track out with id=" << outtest[p] << " seed ref=" << trackOut->seedRef().get() << " pt=" << trackOut->pt();
00286 outused.push_back(outtest[p]);
00287 }
00288 }
00289 }
00290
00291 if (outtest.size()==0 || trackOut.get()==0 ) {
00292 if(recSimCollOld.find(trackOld) != recSimCollOld.end()){
00293 vector<pair<TrackingParticleRef, double> > tpOld;
00294 tpOld = recSimCollOld[trackOld];
00295 if (tpOld.size()!=0) {
00296 LogTrace("TestOutliers") <<"no match: old associated and out lost! old has #hits=" << trackOld->numberOfValidHits()
00297 << " and fraction=" << tpOld.begin()->second;
00298 if (tpOld.begin()->second>0.5) hitsPerTrackLost->Fill(trackOld->numberOfValidHits());
00299 }
00300 }
00301 LogTrace("TestOutliers") <<"...skip to next old track";
00302 continue;
00303 }
00304
00305
00306 LogTrace("TestOutliers") <<"trackOut->seedRef()=" << trackOut->seedRef().get() << " trackOld->seedRef()=" << trackOld->seedRef().get();
00307 bool oldAssoc = recSimCollOld.find(trackOld) != recSimCollOld.end();
00308 bool outAssoc = recSimCollOut.find(trackOut) != recSimCollOut.end();
00309 LogTrace("TestOutliers") <<"outAssoc=" << outAssoc <<" oldAssoc=" << oldAssoc;
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327 countOutT->Fill(1);
00328
00329
00330
00331 tracks->Fill(0);
00332
00333 TrackingParticleRef tpr;
00334 TrackingParticleRef tprOut;
00335 TrackingParticleRef tprOld;
00336 double fracOut;
00337 std::vector<unsigned int> tpids;
00338 std::vector<std::pair<TrackingParticleRef, double> > tpOut;
00339 std::vector<pair<TrackingParticleRef, double> > tpOld;
00340
00341
00342 if(outAssoc) {
00343 tpOut = recSimCollOut[trackOut];
00344 if (tpOut.size()!=0) {
00345 countOutA->Fill(1);
00346 tprOut = tpOut.begin()->first;
00347 fracOut = tpOut.begin()->second;
00348 for (TrackingParticle::g4t_iterator g4T=tprOut->g4Track_begin(); g4T!=tprOut->g4Track_end(); ++g4T) {
00349 tpids.push_back(g4T->trackId());
00350 }
00351 }
00352 }
00353
00354 if(oldAssoc){
00355 tpOld = recSimCollOld[trackOld];
00356 if (tpOld.size()!=0) {
00357 tprOld = tpOld.begin()->first;
00358
00359
00360
00361 if (tpOut.size()==0) {
00362 for (TrackingParticle::g4t_iterator g4T=tprOld->g4Track_begin(); g4T!=tprOld->g4Track_end(); ++g4T) {
00363 tpids.push_back(g4T->trackId());
00364 }
00365 }
00366 }
00367 }
00368
00369 if (tprOut.get()!=0 || tprOld.get()!=0) {
00370
00371 tpr = tprOut.get()!=0 ? tprOut : tprOld;
00372
00373 const SimTrack * assocTrack = &(*tpr->g4Track_begin());
00374
00375
00376 if ( trackOut->numberOfValidHits() != trackOld->numberOfValidHits() ||
00377 !trackOut->recHitsBegin()->get()->sharesInput(trackOld->recHitsBegin()->get(),TrackingRecHit::some) ||
00378 !(trackOut->recHitsEnd()-1)->get()->sharesInput((trackOld->recHitsEnd()-1)->get(),TrackingRecHit::some) )
00379 {
00380 LogTrace("TestOutliers") << "outliers for track with #hits=" << trackOut->numberOfValidHits();
00381 tracks->Fill(1);
00382 LogTrace("TestOutliers") << "Out->pt=" << trackOut->pt() << " Old->pt=" << trackOld->pt()
00383 << " tp->pt=" << sqrt(tpr->momentum().perp2())
00384
00385 << " Old->validHits=" << trackOld->numberOfValidHits() << " Out->validHits=" << trackOut->numberOfValidHits()
00386 << " fracOut=" << fracOut
00387 << " deltaHits=" << trackOld->numberOfValidHits()-trackOut->numberOfValidHits();
00388
00389
00390 double PtPullOut = (trackOut->pt()-sqrt(tpr->momentum().perp2()))/trackOut->ptError();
00391 double PtPullOld = (trackOld->pt()-sqrt(tpr->momentum().perp2()))/trackOld->ptError();
00392 histoPtOut->Fill( PtPullOut );
00393 histoPtOld->Fill( PtPullOld );
00394
00395
00396 edm::ESHandle<MagneticField> theMF;
00397 iSetup.get<IdealMagneticFieldRecord>().get(theMF);
00398 FreeTrajectoryState
00399 ftsAtProduction(GlobalPoint(tpr->vertex().x(),tpr->vertex().y(),tpr->vertex().z()),
00400 GlobalVector(assocTrack->momentum().x(),assocTrack->momentum().y(),assocTrack->momentum().z()),
00401 TrackCharge(trackOld->charge()),
00402 theMF.product());
00403 TSCPBuilderNoMaterial tscpBuilder;
00404 TrajectoryStateClosestToPoint tsAtClosestApproach
00405 = tscpBuilder(ftsAtProduction,GlobalPoint(0,0,0));
00406 GlobalPoint v = tsAtClosestApproach.theState().position();
00407 GlobalVector p = tsAtClosestApproach.theState().momentum();
00408
00409
00410 double qoverpSim = tsAtClosestApproach.charge()/p.mag();
00411 double lambdaSim = M_PI/2-p.theta();
00412 double phiSim = p.phi();
00413 double dxySim = (-v.x()*sin(p.phi())+v.y()*cos(p.phi()));
00414 double dszSim = v.z()*p.perp()/p.mag() - (v.x()*p.x()+v.y()*p.y())/p.perp() * p.z()/p.mag();
00415 double d0Sim = -dxySim;
00416 double dzSim = dszSim*p.mag()/p.perp();
00417
00418
00419 double qoverpPullOut=(trackOut->qoverp()-qoverpSim)/trackOut->qoverpError();
00420 double qoverpPullOld=(trackOld->qoverp()-qoverpSim)/trackOld->qoverpError();
00421 double lambdaPullOut=(trackOut->lambda()-lambdaSim)/trackOut->thetaError();
00422 double lambdaPullOld=(trackOld->lambda()-lambdaSim)/trackOld->thetaError();
00423 double phi0PullOut=(trackOut->phi()-phiSim)/trackOut->phiError();
00424 double phi0PullOld=(trackOld->phi()-phiSim)/trackOld->phiError();
00425 double d0PullOut=(trackOut->d0()-d0Sim)/trackOut->d0Error();
00426 double d0PullOld=(trackOld->d0()-d0Sim)/trackOld->d0Error();
00427 double dzPullOut=(trackOut->dz()-dzSim)/trackOut->dzError();
00428 double dzPullOld=(trackOld->dz()-dzSim)/trackOld->dzError();
00429
00430
00431 histoQoverpOut->Fill(qoverpPullOut);
00432 histoQoverpOld->Fill(qoverpPullOld);
00433 histoPhiOut->Fill(phi0PullOut);
00434 histoPhiOld->Fill(phi0PullOld);
00435 histoD0Out->Fill(d0PullOut);
00436 histoD0Old->Fill(d0PullOld);
00437 histoDzOut->Fill(dzPullOut);
00438 histoDzOld->Fill(dzPullOld);
00439 histoLambdaOut->Fill(lambdaPullOut);
00440 histoLambdaOld->Fill(lambdaPullOld);
00441
00442
00443 LogTrace("TestOutliers") << "deltahits=" << trackOld->numberOfValidHits()-trackOut->numberOfValidHits();
00444 deltahits->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00445
00446 if(tprOut.get()!=0 && tprOld.get()==0) {
00447 if (tpOld.size()!=0 && tpOld.begin()->second<=0.5) {
00448 deltahitsAssocGained->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00449 hitsPerTrackAssocGained->Fill(trackOut->numberOfValidHits());
00450 LogTrace("TestOutliers") << "a) gained (assoc) track out #hits==" << trackOut->numberOfValidHits() << " old #hits=" << trackOld->numberOfValidHits();
00451 } else {
00452 deltahitsAssocGained->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00453 hitsPerTrackAssocGained->Fill(trackOut->numberOfValidHits());
00454 LogTrace("TestOutliers") << "b) gained (assoc) track out #hits==" << trackOut->numberOfValidHits() << " old #hits=" << trackOld->numberOfValidHits();
00455 }
00456 } else if(tprOut.get()==0 && tprOld.get()!=0) {
00457 LogTrace("TestOutliers") <<"old associated and out not! old has #hits=" << trackOld->numberOfValidHits()
00458 << " and fraction=" << tpOld.begin()->second;
00459 if (tpOld.begin()->second>0.5) {
00460 hitsPerTrackAssocLost->Fill(trackOld->numberOfValidHits());
00461 deltahitsAssocLost->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00462 }
00463 }
00464
00465 if ( fabs(PtPullOut) < fabs(PtPullOld) )
00466 deltahitsOK->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00467 else
00468 deltahitsNO->Fill(trackOld->numberOfValidHits()-trackOut->numberOfValidHits());
00469
00470
00471
00472
00473
00474 LogTrace("TestOutliers") << "track old";
00475 for (trackingRecHit_iterator itOld = trackOld->recHitsBegin(); itOld!=trackOld->recHitsEnd() ; itOld++){
00476 LogTrace("TestOutliers") << (*itOld)->isValid() << " " << (*itOld)->geographicalId().rawId();
00477 }
00478 LogTrace("TestOutliers") << "track out";
00479 for (trackingRecHit_iterator itOut = trackOut->recHitsBegin(); itOut!=trackOut->recHitsEnd() ; itOut++){
00480 LogTrace("TestOutliers") << (*itOut)->isValid() << " " << (*itOut)->geographicalId().rawId();
00481 }
00482
00483
00484
00485 vector<pair<int, trackingRecHit_iterator> > gainedlostoutliers;
00486
00487 for (trackingRecHit_iterator itOut = trackOut->recHitsBegin(); itOut!=trackOut->recHitsEnd(); itOut++){
00488 bool gained = true;
00489 if ((*itOut)->isValid()) {
00490 for (trackingRecHit_iterator itOld = trackOld->recHitsBegin(); itOld!=trackOld->recHitsEnd() ; itOld++){
00491 if ( (*itOld)->geographicalId().rawId()==(*itOut)->geographicalId().rawId() ) gained = false;
00492 }
00493 if (gained) {
00494 gainedlostoutliers.push_back(pair<int, trackingRecHit_iterator>(1,itOut));
00495 LogTrace("TestOutliers") << "broken trajectory during old fit... gained hit " << (*itOut)->geographicalId().rawId();
00496 gainedhits->Fill(1);
00497 }
00498 }
00499 }
00500
00501
00502 for (trackingRecHit_iterator itOld = trackOld->recHitsBegin(); itOld!=trackOld->recHitsEnd() ; itOld++){
00503
00504 bool outlier = false;
00505 bool lost = true;
00506
00507 for (trackingRecHit_iterator itOut = trackOut->recHitsBegin(); itOut!=trackOut->recHitsEnd(); itOut++){
00508 if ( (*itOld)->geographicalId().rawId()==(*itOut)->geographicalId().rawId() ) {
00509 lost=false;
00510 if ( (*itOld)->isValid() && !(*itOut)->isValid() && (*itOld)->geographicalId().rawId()==(*itOut)->geographicalId().rawId() ) {
00511 LogTrace("TestOutliers") << (*itOld)->isValid() << " " << (*itOut)->isValid() << " "
00512 << (*itOld)->geographicalId().rawId() << " " << (*itOut)->geographicalId().rawId();
00513 outlier=true;
00514 }
00515 }
00516 }
00517 if (lost) gainedlostoutliers.push_back(pair<int, trackingRecHit_iterator>(2,itOld));
00518 if (lost) LogTrace("TestOutliers") << "lost";
00519 else if (outlier) gainedlostoutliers.push_back(pair<int, trackingRecHit_iterator>(3,itOld));
00520 }
00521
00522 for (std::vector<pair<int, trackingRecHit_iterator> >::iterator it = gainedlostoutliers.begin(); it!=gainedlostoutliers.end();++it) {
00523 LogTrace("TestOutliers") << "type of processed hit:" <<it->first;
00524 trackingRecHit_iterator itHit = it->second;
00525 bool gained = false;
00526 bool lost = false;
00527 bool outlier = false;
00528 if (it->first==1) gained = true;
00529 else if (it->first==2) lost = true;
00530 else if (it->first==3) outlier = true;
00531
00532 if (outlier||lost||gained) {
00533
00534
00535 if (lost && (*itHit)->isValid()==false) {
00536 goodbadmergedLost->Fill(0);
00537 LogTrace("TestOutliers") << "lost invalid";
00538 continue;
00539 }
00540 else if (gained && (*itHit)->isValid()==false) {
00541 goodbadmergedGained->Fill(0);
00542 LogTrace("TestOutliers") << "gained invalid";
00543 continue;
00544 }
00545
00546
00547
00548 std::vector<SimHitIdpr> simTrackIds = hitAssociator->associateHitId(**itHit);
00549 bool goodhit = false;
00550 for(size_t j=0; j<simTrackIds.size(); j++){
00551 for (size_t jj=0; jj<tpids.size(); jj++){
00552 if (simTrackIds[j].first == tpids[jj]) goodhit = true;
00553 break;
00554 }
00555 }
00556
00557
00558 int clustersize = 0;
00559 int hittypeval = 0;
00560 int layerval = 0 ;
00561 if (dynamic_cast<const SiPixelRecHit*>(&**itHit)){
00562 LogTrace("TestOutliers") << "SiPixelRecHit";
00563 clustersize = ((const SiPixelRecHit*)(&**itHit))->cluster()->size() ;
00564 hittypeval = 1;
00565 }
00566 else if (dynamic_cast<const SiStripRecHit2D*>(&**itHit)){
00567 LogTrace("TestOutliers") << "SiStripRecHit2D";
00568 clustersize = ((const SiStripRecHit2D*)(&**itHit))->cluster()->amplitudes().size() ;
00569 hittypeval = 2;
00570 }
00571 else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&**itHit)){
00572 LogTrace("TestOutliers") << "SiStripMatchedRecHit2D";
00573 int clsize1 = ((const SiStripMatchedRecHit2D*)(&**itHit))->monoCluster().amplitudes().size();
00574 int clsize2 = ((const SiStripMatchedRecHit2D*)(&**itHit))->stereoCluster().amplitudes().size();
00575 if (clsize1>clsize2) clustersize = clsize1;
00576 else clustersize = clsize2;
00577 hittypeval = 3;
00578 }
00579 else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&**itHit)){
00580 LogTrace("TestOutliers") << "ProjectedSiStripRecHit2D";
00581 clustersize = ((const ProjectedSiStripRecHit2D*)(&**itHit))->originalHit().cluster()->amplitudes().size();
00582 hittypeval = 4;
00583 }
00584
00585
00586 int subdetId = (*itHit)->geographicalId().subdetId();
00587 DetId id = (*itHit)->geographicalId();
00588 int layerId = tTopo->layer(id);
00589 layerval = subdetId*10+layerId;
00590
00591
00592 GlobalPoint gpos = theG->idToDet((*itHit)->geographicalId())->surface().toGlobal((*itHit)->localPosition());
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608 double energyLoss_ = 0.;
00609 unsigned int monoId = 0;
00610 std::vector<double> energyLossM;
00611 std::vector<double> energyLossS;
00612 std::vector<PSimHit> assSimHits = hitAssociator->associateHit(**itHit);
00613 if (assSimHits.size()==0) continue;
00614 PSimHit shit;
00615 std::vector<unsigned int> trackIds;
00616 energyLossS.clear();
00617 energyLossM.clear();
00618
00619 for(std::vector<PSimHit>::const_iterator m=assSimHits.begin(); m<assSimHits.end(); m++){
00620 if (outlier) energyLoss->Fill(m->energyLoss());
00621 unsigned int tId = m->trackId();
00622 if (find(trackIds.begin(),trackIds.end(),tId)==trackIds.end()) trackIds.push_back(tId);
00623 LogTrace("TestOutliers") << "id=" << tId;
00624 if (m->energyLoss()>energyLoss_) {
00625 shit=*m;
00626 energyLoss_ = m->energyLoss();
00627 }
00628 if (hittypeval==3) {
00629 if (monoId==0) monoId = m->detUnitId();
00630 if (monoId == m->detUnitId()){
00631 energyLossM.push_back(m->energyLoss());
00632 }
00633 else {
00634 energyLossS.push_back(m->energyLoss());
00635 }
00636
00637 } else {
00638 energyLossM.push_back(m->energyLoss());
00639 }
00640 }
00641 unsigned int nIds = trackIds.size();
00642
00643 if (outlier) {
00644 goodbadhits->Fill(goodhit);
00645 posxy->Fill(fabs(gpos.x()),fabs(gpos.y()));
00646 poszr->Fill(fabs(gpos.z()),sqrt(gpos.x()*gpos.x()+gpos.y()*gpos.y()));
00647 process->Fill(shit.processType());
00648 energyLossMax->Fill(energyLoss_);
00649 }
00650
00651
00652 bool shared = true;
00653 bool ioniOnly = true;
00654 unsigned int idc = 0;
00655 for (size_t jj=0; jj<tpids.size(); jj++){
00656 idc += std::count(trackIds.begin(),trackIds.end(),tpids[jj]);
00657 }
00658 if (idc==trackIds.size()) {
00659 shared = false;
00660 }
00661 for(std::vector<PSimHit>::const_iterator m=assSimHits.begin()+1; m<assSimHits.end(); m++){
00662 if ((m->processType()!=7&&m->processType()!=8&&m->processType()!=9)&&abs(m->particleType())!=11){
00663 ioniOnly = false;
00664 break;
00665 }
00666 }
00667 if (ioniOnly&&!shared){
00668 LogTrace("TestOutliers") << "delta";
00669 }
00670
00671 if (goodhit) {
00672 if (outlier) {
00673 goodprocess->Fill(shit.processType());
00674 if (clustersize>=4) {
00675 goodhittype_clgteq4->Fill(hittypeval);
00676 goodlayer_clgteq4->Fill(layerval);
00677 } else {
00678 goodhittype_cllt4->Fill(hittypeval);
00679 goodlayer_cllt4->Fill(layerval);
00680 }
00681
00682 if (hittypeval==1 && clustersize>=4) goodpixgteq4_simvecsize->Fill(assSimHits.size());
00683 if (hittypeval==1 && clustersize<4 ) goodpixlt4_simvecsize->Fill(assSimHits.size());
00684 if (hittypeval==2 && clustersize>=4) goodst1gteq4_simvecsize->Fill(assSimHits.size());
00685 if (hittypeval==2 && clustersize<4 ) goodst1lt4_simvecsize->Fill(assSimHits.size());
00686 if (hittypeval==3 && clustersize>=4) goodst2gteq4_simvecsize->Fill(assSimHits.size());
00687 if (hittypeval==3 && clustersize<4 ) goodst2lt4_simvecsize->Fill(assSimHits.size());
00688 if (hittypeval==4 && clustersize>=4) goodprjgteq4_simvecsize->Fill(assSimHits.size());
00689 if (hittypeval==4 && clustersize<4 ) goodprjlt4_simvecsize->Fill(assSimHits.size());
00690
00691
00692 if (hittypeval==1) goodpix_clustersize->Fill(clustersize);
00693 if (hittypeval==2) goodst1_clustersize->Fill(clustersize);
00694 if (hittypeval==3) goodst2_clustersize->Fill(clustersize);
00695 if (hittypeval==4) goodprj_clustersize->Fill(clustersize);
00696 if (hittypeval==1) goodpix_simvecsize->Fill(assSimHits.size());
00697 if (hittypeval==2) goodst1_simvecsize->Fill(assSimHits.size());
00698 if (hittypeval==3) goodst2_simvecsize->Fill(assSimHits.size());
00699 if (hittypeval==4) goodprj_simvecsize->Fill(assSimHits.size());
00700
00701
00702 nOfTrackIds->Fill(nIds);
00703 if (hittypeval!=3) {
00704 if (energyLossM.size()>1) {
00705 sort(energyLossM.begin(),energyLossM.end(),greater<double>());
00706 energyLossRatio->Fill(energyLossM[1]/energyLossM[0]);
00707 }
00708 } else {
00709
00710 if (energyLossM.size()>1&&energyLossS.size()<=1) {
00711 sort(energyLossM.begin(),energyLossM.end(),greater<double>());
00712 energyLossRatio->Fill(energyLossM[1]/energyLossM[0]);
00713 }
00714 else if (energyLossS.size()>1&&energyLossM.size()<=1) {
00715 sort(energyLossS.begin(),energyLossS.end(),greater<double>());
00716 energyLossRatio->Fill(energyLossS[1]/energyLossS[0]);
00717 }
00718 else if (energyLossS.size()>1&&energyLossM.size()>1) {
00719 sort(energyLossM.begin(),energyLossM.end(),greater<double>());
00720 sort(energyLossS.begin(),energyLossS.end(),greater<double>());
00721 energyLossM[1]/energyLossM[0] > energyLossS[1]/energyLossS[0]
00722 ? energyLossRatio->Fill(energyLossM[1]/energyLossM[0])
00723 : energyLossRatio->Fill(energyLossS[1]/energyLossS[0]);
00724 }
00725 }
00726
00727 LogTrace("TestOutliers") << "before merged";
00728 const SiStripMatchedRecHit2D* tmp = dynamic_cast<const SiStripMatchedRecHit2D*>(&**itHit);
00729 LogTrace("TestOutliers") << "tmp=" << tmp;
00730 LogTrace("TestOutliers") << "assSimHits.size()=" << assSimHits.size();
00731 if ( (assSimHits.size()>1 && tmp==0) ||
00732 (assSimHits.size()>2 && tmp!=0) ) {
00733
00734
00735 mergedlayer->Fill(layerval);
00736 mergedcluster->Fill(clustersize);
00737 mergedhittype->Fill(hittypeval);
00738
00739 for(std::vector<PSimHit>::const_iterator m=assSimHits.begin(); m<assSimHits.end(); m++){
00740 unsigned int tId = m->trackId();
00741 LogTrace("TestOutliers") << "component with id=" << tId << " eLoss=" << m->energyLoss()
00742 << " proc=" << m->processType() << " part=" << m->particleType();
00743 if (find(tpids.begin(),tpids.end(),tId)==tpids.end()) continue;
00744 if (m->processType()==2) {
00745
00746
00747 AlgebraicSymMatrix33 ger =
00748 ErrorFrameTransformer().transform((*itHit)->localPositionError(),theG->idToDet((*itHit)->geographicalId())->surface() ).matrix();
00749
00750 GlobalPoint gps = theG->idToDet((*itHit)->geographicalId())->surface().toGlobal(m->localPosition());
00751
00752 ROOT::Math::SVector<double,3> delta;
00753 delta[0]=gpos.x()-gps.x();
00754 delta[1]=gpos.y()-gps.y();
00755 delta[2]=gpos.z()-gps.z();
00756 LogTrace("TestOutliers") << delta << " " << ger ;
00757 double mpull = sqrt(delta[0]*delta[0]/ger[0][0]+delta[1]*delta[1]/ger[1][1]+delta[2]*delta[2]/ger[2][2]);
00758 LogTrace("TestOutliers") << "hit pull=" << mpull;
00759 mergedPull->Fill(mpull);
00760 }
00761 }
00762 LogTrace("TestOutliers") << "end merged";
00763 } else {
00764
00765 goodlayer->Fill(layerval);
00766 goodcluster->Fill(clustersize);
00767 goodhittype->Fill(hittypeval);
00768 }
00769 }
00770
00771 const SiPixelRecHit* pix = dynamic_cast<const SiPixelRecHit*>(&**itHit);
00772 if ((hittypeval!=3 && assSimHits.size()<2)||(hittypeval==3 && assSimHits.size()<3)){
00773 if (outlier) {
00774 goodhittype_simvecsmall->Fill(hittypeval);
00775 goodlayer_simvecsmall->Fill(layerval);
00776 goodbadmerged->Fill(1);
00777 if (pix) {
00778 probXgood->Fill(pix->probabilityX());
00779 probYgood->Fill(pix->probabilityY());
00780 }
00781 LogTrace("TestOutliers") << "out good";
00782 }
00783 else if (lost){
00784 goodbadmergedLost->Fill(1);
00785 LogTrace("TestOutliers") << "lost good";
00786 }
00787 else if (gained){
00788 goodbadmergedGained->Fill(1);
00789 LogTrace("TestOutliers") << "gained good";
00790 }
00791 LogTrace("TestOutliers") << "good";
00792 } else {
00793 if (outlier) {
00794 goodhittype_simvecbig->Fill(hittypeval);
00795 goodlayer_simvecbig->Fill(layerval);
00796 if (ioniOnly&&!shared) {
00797 goodbadmerged->Fill(3);
00798 if (pix) {
00799 probXdelta->Fill(pix->probabilityX());
00800 probYdelta->Fill(pix->probabilityY());
00801 }
00802 } else if(!ioniOnly&&!shared) {
00803 goodbadmerged->Fill(4);
00804 if (pix) {
00805 probXnoshare->Fill(pix->probabilityX());
00806 probYnoshare->Fill(pix->probabilityY());
00807 }
00808 } else {
00809 goodbadmerged->Fill(5);
00810 if (pix) {
00811 probXshared->Fill(pix->probabilityX());
00812 probYshared->Fill(pix->probabilityY());
00813 }
00814 }
00815 LogTrace("TestOutliers") << "out merged, ioniOnly=" << ioniOnly << " shared=" << shared;
00816 }
00817 else if (lost) {
00818 if (ioniOnly&&!shared) goodbadmergedLost->Fill(3);
00819 else if(!ioniOnly&&!shared) goodbadmergedLost->Fill(4);
00820 else goodbadmergedLost->Fill(5);
00821 LogTrace("TestOutliers") << "lost merged, ioniOnly=" << ioniOnly << " shared=" << shared;
00822 }
00823 else if (gained) {
00824 if (ioniOnly&&!shared) goodbadmergedGained->Fill(3);
00825 else if(!ioniOnly&&!shared) goodbadmergedGained->Fill(4);
00826 else goodbadmergedGained->Fill(5);
00827 LogTrace("TestOutliers") << "gained merged, ioniOnly=" << ioniOnly << " shared=" << shared;
00828 }
00829 LogTrace("TestOutliers") << "merged, ioniOnly=" << ioniOnly << " shared=" << shared;
00830 }
00831 }
00832 else {
00833
00834 if (outlier) {
00835 badcluster->Fill(clustersize);
00836 badhittype->Fill(hittypeval);
00837 badlayer->Fill(layerval);
00838 badprocess->Fill(shit.processType());
00839 goodbadmerged->Fill(2);
00840 const SiPixelRecHit* pix = dynamic_cast<const SiPixelRecHit*>(&**itHit);
00841 if (pix) {
00842 probXbad->Fill(pix->probabilityX());
00843 probYbad->Fill(pix->probabilityY());
00844 }
00845 LogTrace("TestOutliers") << "out bad";
00846 }
00847 else if (lost) {
00848 goodbadmergedLost->Fill(2);
00849 LogTrace("TestOutliers") << "lost bad";
00850 }
00851 else if (gained) {
00852 goodbadmergedGained->Fill(2);
00853 LogTrace("TestOutliers") << "gained bad";
00854 }
00855 LogTrace("TestOutliers") << "bad";
00856 }
00857 }
00858 }
00859 }
00860
00861 else if ( 0 ) {
00862 LogTrace("TestOutliers") << "outliers for track with #hits=" << trackOut->numberOfValidHits();
00863 tracks->Fill(1);
00864 LogTrace("TestOutliers") << "Out->pt=" << trackOut->pt() << " Old->pt=" << trackOld->pt()
00865 << " tp->pt=" << sqrt(tpr->momentum().perp2())
00866
00867 << " Old->validHits=" << trackOld->numberOfValidHits() << " Out->validHits=" << trackOut->numberOfValidHits()
00868 << " fracOut=" << fracOut
00869 << " deltaHits=" << trackOld->numberOfValidHits()-trackOut->numberOfValidHits();
00870 LogTrace("TestOutliers") << "track with gained hits";
00871 gainedhits2->Fill(trackOut->numberOfValidHits()-trackOld->numberOfValidHits());
00872 } else {
00873 LogTrace("TestOutliers") << "no outliers for track with #hits=" << trackOut->numberOfValidHits();
00874 }
00875 }
00876 LogTrace("TestOutliers") << "end track old #" << j;
00877 }
00878
00879 for (unsigned int k=0;k<tracksOut->size();++k) {
00880 if ( find(outused.begin(),outused.end(),k)==outused.end() ) {
00881 edm::RefToBase<reco::Track> trackOut(tracksOut, k);
00882 bool outAssoc = recSimCollOut.find(trackOut) != recSimCollOut.end();
00883 if (outAssoc) {
00884 hitsPerTrackGained->Fill(trackOut->numberOfValidHits());
00885 LogTrace("TestOutliers") << "gained track out id=" << k << " #hits==" << trackOut->numberOfValidHits();
00886
00887 }
00888 }
00889 }
00890 delete hitAssociator;
00891 delete theAssociatorOld;
00892 delete theAssociatorOut;
00893 }
00894
00895
00896
00897 void
00898 TestOutliers::beginRun(edm::Run & run, const edm::EventSetup& es)
00899 {
00900 es.get<TrackerDigiGeometryRecord>().get(theG);
00901 const bool oldAddDir = TH1::AddDirectoryStatus();
00902 TH1::AddDirectory(true);
00903 file = new TFile(out.c_str(),"recreate");
00904 histoPtOut = new TH1F("histoPtOut","histoPtOut",100,-10,10);
00905 histoPtOld = new TH1F("histoPtOld","histoPtOld",100,-10,10);
00906 histoQoverpOut = new TH1F("histoQoverpOut","histoQoverpOut",250,-25,25);
00907 histoQoverpOld = new TH1F("histoQoverpOld","histoQoverpOld",250,-25,25);
00908 histoPhiOut = new TH1F("histoPhiOut","histoPhiOut",250,-25,25);
00909 histoPhiOld = new TH1F("histoPhiOld","histoPhiOld",250,-25,25);
00910 histoD0Out = new TH1F("histoD0Out","histoD0Out",250,-25,25);
00911 histoD0Old = new TH1F("histoD0Old","histoD0Old",250,-25,25);
00912 histoDzOut = new TH1F("histoDzOut","histoDzOut",250,-25,25);
00913 histoDzOld = new TH1F("histoDzOld","histoDzOld",250,-25,25);
00914 histoLambdaOut = new TH1F("histoLambdaOut","histoLambdaOut",250,-25,25);
00915 histoLambdaOld = new TH1F("histoLambdaOld","histoLambdaOld",250,-25,25);
00916 deltahits = new TH1F("deltahits","deltahits",80,-40,40);
00917 deltahitsOK = new TH1F("deltahitsOK","deltahitsOK",20,0,20);
00918 deltahitsNO = new TH1F("deltahitsNO","deltahitsNO",20,0,20);
00919 okcutsOut = new TH1F("okcutsOut","okcutsOut",2,-0.5,1.5);
00920 okcutsOld = new TH1F("okcutsOld","okcutsOld",2,-0.5,1.5);
00921 tracks = new TH1F("tracks_","tracks_",2,-0.5,1.5);
00922 goodbadhits = new TH1F("goodbadhits","goodbadhits",2,-0.5,1.5);
00923 process = new TH1F("process","process",20,-0.5,19.5);
00924 goodcluster = new TH1F("goodcluster","goodcluster",40,-0.5,39.5);
00925 goodprocess = new TH1F("goodprocess","goodprocess",20,-0.5,19.5);
00926 badcluster = new TH1F("badcluster","badcluster",40,-0.5,39.5);
00927 badprocess = new TH1F("badprocess","badprocess",20,-0.5,19.5);
00928 goodhittype = new TH1F("goodhittype","goodhittype",5,-0.5,4.5);
00929 goodlayer = new TH1F("goodlayer","goodlayer",70,-0.5,69.5);
00930 goodhittype_clgteq4 = new TH1F("goodhittype_clgteq4","goodhittype_clgteq4",5,-0.5,4.5);
00931 goodlayer_clgteq4 = new TH1F("goodlayer_clgteq4","goodlayer_clgteq4",70,-0.5,69.5);
00932 goodhittype_cllt4 = new TH1F("goodhittype_cllt4","goodhittype_cllt4",5,-0.5,4.5);
00933 goodlayer_cllt4 = new TH1F("goodlayer_cllt4","goodlayer_cllt4",70,-0.5,69.5);
00934 badhittype = new TH1F("badhittype","badhittype",5,-0.5,4.5);
00935 badlayer = new TH1F("badlayer","badlayer",70,-0.5,69.5);
00936 posxy = new TH2F("posxy","posxy",1200,0,120,1200,0,120);
00937 poszr = new TH2F("poszr","poszr",3000,0,300,1200,0,120);
00938 goodpixgteq4_simvecsize = new TH1F("goodpixgteq4_simvecsize","goodpixgteq4_simvecsize",40,-0.5,39.5);
00939 goodpixlt4_simvecsize = new TH1F("goodpixlt4_simvecsize","goodpixlt4_simvecsize",40,-0.5,39.5);
00940 goodst1gteq4_simvecsize = new TH1F("goodst1gteq4_simvecsize","goodst1gteq4_simvecsize",40,-0.5,39.5);
00941 goodst1lt4_simvecsize = new TH1F("goodst1lt4_simvecsize","goodst1lt4_simvecsize",40,-0.5,39.5);
00942 goodst2gteq4_simvecsize = new TH1F("goodst2gteq4_simvecsize","goodst2gteq4_simvecsize",40,-0.5,39.5);
00943 goodst2lt4_simvecsize = new TH1F("goodst2lt4_simvecsize","goodst2lt4_simvecsize",40,-0.5,39.5);
00944 goodprjgteq4_simvecsize = new TH1F("goodprjgteq4_simvecsize","goodprjgteq4_simvecsize",40,-0.5,39.5);
00945 goodprjlt4_simvecsize = new TH1F("goodprjlt4_simvecsize","goodprjlt4_simvecsize",40,-0.5,39.5);
00946 goodpix_clustersize = new TH1F("goodpix_clustersize","goodpix_clustersize",40,-0.5,39.5);
00947 goodst1_clustersize = new TH1F("goodst1_clustersize","goodst1_clustersize",40,-0.5,39.5);
00948 goodst2_clustersize = new TH1F("goodst2_clustersize","goodst2_clustersize",40,-0.5,39.5);
00949 goodprj_clustersize = new TH1F("goodprj_clustersize","goodprj_clustersize",40,-0.5,39.5);
00950 goodpix_simvecsize = new TH1F("goodpix_simvecsize","goodpix_simvecsize",40,-0.5,39.5);
00951 goodst1_simvecsize = new TH1F("goodst1_simvecsize","goodst1_simvecsize",40,-0.5,39.5);
00952 goodst2_simvecsize = new TH1F("goodst2_simvecsize","goodst2_simvecsize",40,-0.5,39.5);
00953 goodprj_simvecsize = new TH1F("goodprj_simvecsize","goodprj_simvecsize",40,-0.5,39.5);
00954 goodhittype_simvecsmall = new TH1F("goodhittype_simvecsmall","goodhittype_simvecsmall",5,-0.5,4.5);
00955 goodlayer_simvecsmall = new TH1F("goodlayer_simvecsmall","goodlayer_simvecsmall",70,-0.5,69.5);
00956 goodhittype_simvecbig = new TH1F("goodhittype_simvecbig","goodhittype_simvecbig",5,-0.5,4.5);
00957 goodlayer_simvecbig = new TH1F("goodlayer_simvecbig","goodlayer_simvecbig",70,-0.5,69.5);
00958 goodbadmerged = new TH1F("goodbadmerged","goodbadmerged",5,0.5,5.5);
00959 goodbadmergedLost = new TH1F("goodbadmergedLost","goodbadmergedLost",5,0.5,5.5);
00960 goodbadmergedGained = new TH1F("goodbadmergedGained","goodbadmergedGained",5,0.5,5.5);
00961 energyLoss = new TH1F("energyLoss","energyLoss",1000,0,0.1);
00962 energyLossMax = new TH1F("energyLossMax","energyLossMax",1000,0,0.1);
00963 energyLossRatio = new TH1F("energyLossRatio","energyLossRatio",100,0,1);
00964 nOfTrackIds = new TH1F("nOfTrackIds","nOfTrackIds",10,0,10);
00965 mergedPull = new TH1F("mergedPull","mergedPull",100,0,10);
00966 mergedlayer = new TH1F("mergedlayer","mergedlayer",70,-0.5,69.5);
00967 mergedhittype = new TH1F("mergedhittype","mergedhittype",5,-0.5,4.5);
00968 mergedcluster = new TH1F("mergedcluster","mergedcluster",40,-0.5,39.5);
00969 deltahitsAssocGained = new TH1F("deltahitsAssocGained","deltahitsAssocGained",80, -40, 40);
00970 deltahitsAssocLost = new TH1F("deltahitsAssocLost","deltahitsAssocLost",80, -40, 40);
00971 hitsPerTrackLost = new TH1F("hitsPerTrackLost","hitsPerTrackLost",40, -0.5, 39.5);
00972 hitsPerTrackAssocLost = new TH1F("hitsPerTrackAssocLost","hitsPerTrackAssocLost",40, -0.5, 39.5);
00973 hitsPerTrackGained = new TH1F("hitsPerTrackGained","hitsPerTrackGained",40, -0.5, 39.5);
00974 hitsPerTrackAssocGained = new TH1F("hitsPerTrackAssocGained","hitsPerTrackAssocGained",40, -0.5, 39.5);
00975 sizeOut = new TH1F("sizeOut","sizeOut",900,-0.5,899.5);
00976 sizeOld = new TH1F("sizeOld","sizeOld",900,-0.5,899.5);
00977 sizeOutT = new TH1F("sizeOutT","sizeOutT",900,-0.5,899.5);
00978 sizeOldT = new TH1F("sizeOldT","sizeOldT",900,-0.5,899.5);
00979 countOutA = new TH1F("countOutA","countOutA",2,0,2);
00980 countOutT = new TH1F("countOutT","countOutT",2,0,2);
00981 countOldT = new TH1F("countOldT","countOldT",2,0,2);
00982 gainedhits = new TH1F("gainedhits","gainedhits",2,0,2);
00983 gainedhits2 = new TH1F("gainedhits2","gainedhits2",30,-0.5,29.5);
00984 probXgood = new TH1F("probXgood","probXgood",110,0,1.1);
00985 probXbad = new TH1F("probXbad","probXbad",110,0,1.1);
00986 probXdelta = new TH1F("probXdelta","probXdelta",110,0,1.1);
00987 probXshared = new TH1F("probXshared","probXshared",110,0,1.1);
00988 probXnoshare = new TH1F("probXnoshare","probXnoshare",110,0,1.1);
00989 probYgood = new TH1F("probYgood","probYgood",110,0,1.1);
00990 probYbad = new TH1F("probYbad","probYbad",110,0,1.1);
00991 probYdelta = new TH1F("probYdelta","probYdelta",110,0,1.1);
00992 probYshared = new TH1F("probYshared","probYshared",110,0,1.1);
00993 probYnoshare = new TH1F("probYnoshare","probYnoshare",110,0,1.1);
00994 TH1::AddDirectory(oldAddDir);
00995 }
00996
00997 void
00998 TestOutliers::endJob() {
00999 LogTrace("TestOutliers") << "TestOutliers::endJob";
01000 file->Write();
01001 LogTrace("TestOutliers") << "outfile written";
01002 file->Close();
01003 LogTrace("TestOutliers") << "oufile closed";
01004 LogTrace("TestOutliers") << "exiting TestOutliers::endJob";
01005 }
01006
01007
01008 DEFINE_FWK_MODULE(TestOutliers);