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