00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "FWCore/Framework/interface/EDAnalyzer.h"
00022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00023 #include "FWCore/Framework/interface/MakerMacros.h"
00024
00025 #include <algorithm>
00026
00027 #include "FWCore/Framework/interface/ESHandle.h"
00028 #include "FWCore/Framework/interface/EventSetup.h"
00029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00030
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 #include "FWCore/Utilities/interface/InputTag.h"
00033
00034
00035 #include "FWCore/Framework/interface/EDProducer.h"
00036 #include "FWCore/Framework/interface/Event.h"
00037 #include "FWCore/Framework/interface/EventSetup.h"
00038 #include "FWCore/Framework/interface/ESHandle.h"
00039 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00040 #include "FWCore/ServiceRegistry/interface/Service.h"
00041
00042
00043 #include "DataFormats/Common/interface/View.h"
00044 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00045 #include "DataFormats/TrackReco/interface/Track.h"
00046 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00047 #include "DataFormats/TrackingRecHit/interface/InvalidTrackingRecHit.h"
00048 #include "DataFormats/MuonReco/interface/Muon.h"
00049 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00050
00051 #include "TrackingTools/TransientTrack/interface/BasicTransientTrack.h"
00052 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00053 #include "DataFormats/TrackReco/interface/Track.h"
00054 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00055 #include "DataFormats/Common/interface/RefToBase.h"
00056 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
00057
00058 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00059 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00060 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00061 #include "TrackingTools/TrajectoryState/interface/CopyUsingClone.h"
00062 #include "RecoVertex/VertexTools/interface/PerigeeLinearizedTrackState.h"
00063
00064 #include <TTree.h>
00065
00066
00067
00068
00069
00070 class CosmicSplitterValidation : public edm::EDAnalyzer {
00071 public:
00072 explicit CosmicSplitterValidation(const edm::ParameterSet&);
00073 ~CosmicSplitterValidation();
00074
00075
00076 private:
00077 virtual void beginJob();
00078 virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup);
00079 virtual void endJob() ;
00080
00081 bool is_gold_muon(const edm::Event& e);
00082
00083 edm::InputTag splitTracks_;
00084 edm::InputTag splitGlobalMuons_;
00085 edm::InputTag originalTracks_;
00086 edm::InputTag originalGlobalMuons_;
00087
00088 bool checkIfGolden_;
00089 bool splitMuons_;
00090 int totalTracksToAnalyzer_;
00091 int goldenCtr;
00092 int twoTracksCtr;
00093 int goldenPlusTwoTracksCtr;
00094 int _passesTracksPlusMuonsCuts;
00095
00096 edm::Service<TFileService> tfile;
00097
00098
00099
00100 TTree* splitterTree_;
00101
00102
00103 double dcaX1_spl_, dcaY1_spl_, dcaZ1_spl_;
00104 double dcaX2_spl_, dcaY2_spl_, dcaZ2_spl_;
00105 double dxy1_spl_, dxy2_spl_, dz1_spl_, dz2_spl_;
00106 double theta1_spl_, theta2_spl_, phi1_spl_, phi2_spl_;
00107 double ddxy_spl_, ddz_spl_, dtheta_spl_, dphi_spl_;
00108 double pt1_spl_, pt2_spl_, dpt_spl_, p1_spl_, p2_spl_;
00109 double eta1_spl_, eta2_spl_, deta_spl_;
00110 double nHits1_spl_, nHitsPXB1_spl_, nHitsPXF1_spl_, nHitsTIB1_spl_, nHitsTOB1_spl_, nHitsTID1_spl_, nHitsTEC1_spl_;
00111 double nHits2_spl_, nHitsPXB2_spl_, nHitsPXF2_spl_, nHitsTIB2_spl_, nHitsTOB2_spl_, nHitsTID2_spl_, nHitsTEC2_spl_;
00112
00113 double pt1Err_spl_, pt2Err_spl_;
00114 double theta1Err_spl_, theta2Err_spl_;
00115 double phi1Err_spl_, phi2Err_spl_;
00116 double d01Err_spl_, d02Err_spl_;
00117 double dz1Err_spl_, dz2Err_spl_;
00118
00119 double dcaX_org_, dcaY_org_, dcaZ_org_;
00120 double dxy_org_, dz_org_;
00121 double theta_org_, phi_org_, eta_org_, pt_org_, p_org_;
00122 double norchi2_org_;
00123
00124
00125 double dcaX1_sta_, dcaY1_sta_, dcaZ1_sta_;
00126 double dcaX2_sta_, dcaY2_sta_, dcaZ2_sta_;
00127 double dxy1_sta_, dxy2_sta_, dz1_sta_, dz2_sta_;
00128 double theta1_sta_, theta2_sta_, phi1_sta_, phi2_sta_;
00129 double ddxy_sta_, ddz_sta_, dtheta_sta_, dphi_sta_;
00130 double pt1_sta_, pt2_sta_, dpt_sta_, p1_sta_, p2_sta_;
00131 double eta1_sta_, eta2_sta_, deta_sta_;
00132
00133 double pt1Err_sta_, pt2Err_sta_;
00134 double theta1Err_sta_, theta2Err_sta_;
00135 double phi1Err_sta_, phi2Err_sta_;
00136 double d01Err_sta_, d02Err_sta_;
00137 double dz1Err_sta_, dz2Err_sta_;
00138
00139
00140 double dcaX1_glb_, dcaY1_glb_, dcaZ1_glb_;
00141 double dcaX2_glb_, dcaY2_glb_, dcaZ2_glb_;
00142 double dxy1_glb_, dxy2_glb_, dz1_glb_, dz2_glb_;
00143 double theta1_glb_, theta2_glb_, phi1_glb_, phi2_glb_;
00144 double ddxy_glb_, ddz_glb_, dtheta_glb_, dphi_glb_;
00145 double pt1_glb_, pt2_glb_, dpt_glb_, p1_glb_, p2_glb_;
00146 double eta1_glb_, eta2_glb_, deta_glb_;
00147 double norchi1_glb_, norchi2_glb_;
00148
00149 double pt1Err_glb_, pt2Err_glb_;
00150 double theta1Err_glb_, theta2Err_glb_;
00151 double phi1Err_glb_, phi2Err_glb_;
00152 double d01Err_glb_, d02Err_glb_;
00153 double dz1Err_glb_, dz2Err_glb_;
00154
00155 double dcaX_orm_, dcaY_orm_, dcaZ_orm_;
00156 double dxy_orm_, dz_orm_;
00157 double theta_orm_, phi_orm_, eta_orm_, pt_orm_, p_orm_;
00158 double norchi2_orm_;
00159
00160 };
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 CosmicSplitterValidation::CosmicSplitterValidation(const edm::ParameterSet& iConfig):
00174 splitTracks_(iConfig.getParameter<edm::InputTag>("splitTracks")),
00175 splitGlobalMuons_(iConfig.getParameter<edm::InputTag>("splitGlobalMuons")),
00176 originalTracks_(iConfig.getParameter<edm::InputTag>("originalTracks")),
00177 originalGlobalMuons_(iConfig.getParameter<edm::InputTag>("originalGlobalMuons")),
00178 checkIfGolden_(iConfig.getParameter<bool>("checkIfGolden")),
00179 splitMuons_(iConfig.getParameter<bool> ("ifSplitMuons"))
00180 {
00181
00182 }
00183
00184
00185 CosmicSplitterValidation::~CosmicSplitterValidation()
00186 {}
00187
00188
00189
00190
00191
00192
00193
00194 void CosmicSplitterValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00195 {
00196
00197
00198 bool isGolden = true;
00199 if (checkIfGolden_) isGolden = is_gold_muon( iEvent );
00200
00201
00202 edm::Handle<std::vector<reco::Track> > tracks;
00203 edm::Handle<reco::MuonCollection> globalMuons;
00204 edm::Handle<reco::MuonCollection> originalGlobalMuons;
00205 edm::Handle<std::vector<reco::Track> > originalTracks;
00206 iEvent.getByLabel(splitTracks_, tracks);
00207 iEvent.getByLabel(originalTracks_, originalTracks);
00208 if (splitMuons_){
00209 iEvent.getByLabel(splitGlobalMuons_, globalMuons);
00210 iEvent.getByLabel(originalGlobalMuons_, originalGlobalMuons);
00211 }
00212
00213 const int kBPIX = PixelSubdetector::PixelBarrel;
00214 const int kFPIX = PixelSubdetector::PixelEndcap;
00215
00216
00217 totalTracksToAnalyzer_ = totalTracksToAnalyzer_ + tracks->size();
00218 if (isGolden) goldenCtr++;
00219 if (tracks->size() == 2) twoTracksCtr++;
00220 if (tracks->size() == 2 && originalTracks->size() == 1 && isGolden){
00221 goldenPlusTwoTracksCtr++;
00222
00223 int gmCtr = 0;
00224 bool topGlobalMuonFlag = false;
00225 bool bottomGlobalMuonFlag = false;
00226 int topGlobalMuon = -1;
00227 int bottomGlobalMuon = -1;
00228 double topGlobalMuonNorchi2 = 1e10;
00229 double bottomGlobalMuonNorchi2 = 1e10;
00230
00231 if (splitMuons_){
00232
00233 for (std::vector<reco::Muon>::const_iterator gmI = globalMuons->begin(); gmI != globalMuons->end(); gmI++){
00234
00235 if ( gmI->isTrackerMuon() && gmI->isStandAloneMuon() && gmI->isGlobalMuon() ){
00236
00237 reco::TrackRef trackerTrackRef1( tracks, 0 );
00238 reco::TrackRef trackerTrackRef2( tracks, 1 );
00239
00240 if (gmI->innerTrack() == trackerTrackRef1){
00241 if (gmI->globalTrack()->normalizedChi2() < topGlobalMuonNorchi2){
00242 topGlobalMuonFlag = true;
00243 topGlobalMuonNorchi2 = gmI->globalTrack()->normalizedChi2();
00244 topGlobalMuon = gmCtr;
00245 }
00246 }
00247 if (gmI->innerTrack() == trackerTrackRef2){
00248 if (gmI->globalTrack()->normalizedChi2() < bottomGlobalMuonNorchi2){
00249 bottomGlobalMuonFlag = true;
00250 bottomGlobalMuonNorchi2 = gmI->globalTrack()->normalizedChi2();
00251 bottomGlobalMuon = gmCtr;
00252 }
00253 }
00254 }
00255 gmCtr++;
00256 }
00257 }
00258
00259 if ( (!splitMuons_) || (splitMuons_ && bottomGlobalMuonFlag && topGlobalMuonFlag) ){
00260
00261 _passesTracksPlusMuonsCuts++;
00262
00263
00264 reco::Track track1 = tracks->at(0);
00265 reco::Track track2 = tracks->at(1);
00266
00267 math::XYZPoint dca1 = track1.referencePoint();
00268 math::XYZPoint dca2 = track2.referencePoint();
00269
00270
00271 double Nrechits1 =0;
00272 double nhitinTIB1 =0;
00273 double nhitinTOB1 =0;
00274 double nhitinTID1 =0;
00275 double nhitinTEC1 =0;
00276 double nhitinBPIX1 =0;
00277 double nhitinFPIX1 =0;
00278 for (trackingRecHit_iterator iHit = track1.recHitsBegin(); iHit != track1.recHitsEnd(); ++iHit) {
00279
00280 if((*iHit)->isValid()) {
00281
00282 Nrechits1++;
00283
00284 int type =(*iHit)->geographicalId().subdetId();
00285
00286 if(type==int(StripSubdetector::TIB)){++nhitinTIB1;}
00287 if(type==int(StripSubdetector::TOB)){++nhitinTOB1;}
00288 if(type==int(StripSubdetector::TID)){++nhitinTID1;}
00289 if(type==int(StripSubdetector::TEC)){++nhitinTEC1;}
00290 if(type==int( kBPIX)){++nhitinBPIX1;}
00291 if(type==int( kFPIX)){++nhitinFPIX1;}
00292
00293 }
00294 }
00295 nHits1_spl_ = Nrechits1;
00296 nHitsTIB1_spl_ = nhitinTIB1;
00297 nHitsTOB1_spl_ = nhitinTOB1;
00298 nHitsTID1_spl_ = nhitinTID1;
00299 nHitsTEC1_spl_ = nhitinTEC1;
00300 nHitsPXB1_spl_ = nhitinBPIX1;
00301 nHitsPXF1_spl_ = nhitinFPIX1;
00302
00303
00304 double Nrechits2 =0;
00305 double nhitinTIB2 =0;
00306 double nhitinTOB2 =0;
00307 double nhitinTID2 =0;
00308 double nhitinTEC2 =0;
00309 double nhitinBPIX2 =0;
00310 double nhitinFPIX2 =0;
00311 for (trackingRecHit_iterator iHit = track2.recHitsBegin(); iHit != track2.recHitsEnd(); ++iHit) {
00312
00313 if((*iHit)->isValid()) {
00314
00315 Nrechits2++;
00316
00317 int type =(*iHit)->geographicalId().subdetId();
00318
00319 if(type==int(StripSubdetector::TIB)){++nhitinTIB2;}
00320 if(type==int(StripSubdetector::TOB)){++nhitinTOB2;}
00321 if(type==int(StripSubdetector::TID)){++nhitinTID2;}
00322
00323 if(type==int( kBPIX)){++nhitinBPIX2;}
00324 if(type==int( kFPIX)){++nhitinFPIX2;}
00325
00326 }
00327 }
00328 nHits2_spl_ = Nrechits2;
00329 nHitsTIB2_spl_ = nhitinTIB2;
00330 nHitsTOB2_spl_ = nhitinTOB2;
00331 nHitsTID2_spl_ = nhitinTID2;
00332 nHitsTEC2_spl_ = nhitinTEC2;
00333 nHitsPXB2_spl_ = nhitinBPIX2;
00334 nHitsPXF2_spl_ = nhitinFPIX2;
00335
00336
00337 double dtheta_Val = track1.theta() - track2.theta();
00338 double dphi_Val = track1.phi() - track2.phi();
00339 double ddxy_Val = track1.d0() - track2.d0();
00340 double ddz_Val = track1.dz() - track2.dz();
00341 double dpt_Val = track1.pt() - track2.pt();
00342
00343
00344 reco::Track origTrack = originalTracks->at(0);
00345 math::XYZPoint dca_org = origTrack.referencePoint();
00346
00347
00348
00349 dcaX1_spl_ = dca1.x();
00350 dcaY1_spl_ = dca1.y();
00351 dcaZ1_spl_ = dca1.z();
00352 dcaX2_spl_ = dca2.x();
00353 dcaY2_spl_ = dca2.y();
00354 dcaZ2_spl_ = dca2.z();
00355 dxy1_spl_ = track1.d0();
00356 dxy2_spl_ = track2.d0();
00357 dz1_spl_ = track1.dz();
00358 dz2_spl_ = track2.dz();
00359 d01Err_spl_ = track1.d0Error();
00360 d02Err_spl_ = track2.d0Error();
00361 dz1Err_spl_ = track1.dzError();
00362 dz2Err_spl_ = track2.dzError();
00363 theta1_spl_ = track1.theta();
00364 theta2_spl_ = track2.theta();
00365 theta1Err_spl_ = track1.thetaError();
00366 theta2Err_spl_ = track2.thetaError();
00367 phi1_spl_ = track1.phi();
00368 phi2_spl_ = track2.phi();
00369 phi1Err_spl_ = track1.phiError();
00370 phi2Err_spl_ = track2.phiError();
00371 ddxy_spl_ = ddxy_Val;
00372 ddz_spl_ = ddz_Val;
00373 dtheta_spl_ = dtheta_Val;
00374 dphi_spl_ = dphi_Val;
00375 pt1_spl_ = track1.pt();
00376 pt2_spl_ = track2.pt();
00377 p1_spl_ = track1.p();
00378 p2_spl_ = track2.p();
00379 pt1Err_spl_ = track1.ptError();
00380 pt2Err_spl_ = track2.ptError();
00381 dpt_spl_ = dpt_Val;
00382 eta1_spl_ = track1.eta();
00383 eta2_spl_ = track2.eta();
00384 deta_spl_ = eta1_spl_ - eta2_spl_;
00385
00386
00387 dcaX_org_ = dca_org.x();
00388 dcaY_org_ = dca_org.y();
00389 dcaZ_org_ = dca_org.z();
00390 dxy_org_ = origTrack.d0();
00391 dz_org_ = origTrack.dz();
00392 theta_org_ = origTrack.theta();
00393 phi_org_ = origTrack.phi();
00394 eta_org_ = origTrack.eta();
00395 pt_org_ = origTrack.pt();
00396 p_org_ = origTrack.p();
00397 norchi2_org_ = origTrack.normalizedChi2();
00398
00399
00400 if (splitMuons_){
00401
00402 reco::Muon muonTop = globalMuons->at( topGlobalMuon );
00403 reco::Muon muonBottom = globalMuons->at( bottomGlobalMuon );
00404
00405 reco::TrackRef glb1 = muonTop.globalTrack();
00406 reco::TrackRef glb2 = muonBottom.globalTrack();
00407 reco::TrackRef sta1 = muonTop.outerTrack();
00408 reco::TrackRef sta2 = muonBottom.outerTrack();
00409
00410
00411 dcaX1_sta_ = sta1->referencePoint().x();
00412 dcaY1_sta_ = sta1->referencePoint().y();
00413 dcaZ1_sta_ = sta1->referencePoint().z();
00414 dcaX2_sta_ = sta2->referencePoint().x();
00415 dcaY2_sta_ = sta2->referencePoint().y();
00416 dcaZ2_sta_ = sta2->referencePoint().z();
00417 dxy1_sta_ = sta1->d0();
00418 dxy2_sta_ = sta2->d0();
00419 dz1_sta_ = sta1->dz();
00420 dz2_sta_ = sta2->dz();
00421 d01Err_sta_ = sta1->d0Error();
00422 d02Err_sta_ = sta2->d0Error();
00423 dz1Err_sta_ = sta1->dzError();
00424 dz2Err_sta_ = sta2->dzError();
00425 theta1_sta_ = sta1->theta();
00426 theta2_sta_ = sta2->theta();
00427 theta1Err_sta_ = sta1->thetaError();
00428 theta2Err_sta_ = sta2->thetaError();
00429 phi1_sta_ = sta1->phi();
00430 phi2_sta_ = sta2->phi();
00431 phi1Err_sta_ = sta1->phiError();
00432 phi2Err_sta_ = sta2->phiError();
00433 ddxy_sta_ = sta1->d0() - sta2->d0();
00434 ddz_sta_ = sta1->dz() - sta2->dz();
00435 dtheta_sta_ = sta1->theta() - sta2->theta();
00436 dphi_sta_ = sta1->phi() - sta2->phi();
00437 pt1_sta_ = sta1->pt();
00438 pt2_sta_ = sta2->pt();
00439 p1_sta_ = sta1->p();
00440 p2_sta_ = sta2->p();
00441 pt1Err_sta_ = sta1->ptError();
00442 pt2Err_sta_ = sta2->ptError();
00443 dpt_sta_ = sta1->pt() - sta2->pt();
00444 eta1_sta_ = sta1->eta();
00445 eta2_sta_ = sta2->eta();
00446 deta_sta_ = eta1_sta_ - eta2_sta_;
00447
00448
00449 dcaX1_glb_ = glb1->referencePoint().x();
00450 dcaY1_glb_ = glb1->referencePoint().y();
00451 dcaZ1_glb_ = glb1->referencePoint().z();
00452 dcaX2_glb_ = glb2->referencePoint().x();
00453 dcaY2_glb_ = glb2->referencePoint().y();
00454 dcaZ2_glb_ = glb2->referencePoint().z();
00455 dxy1_glb_ = glb1->d0();
00456 dxy2_glb_ = glb2->d0();
00457 dz1_glb_ = glb1->dz();
00458 dz2_glb_ = glb2->dz();
00459 d01Err_glb_ = glb1->d0Error();
00460 d02Err_glb_ = glb2->d0Error();
00461 dz1Err_glb_ = glb1->dzError();
00462 dz2Err_glb_ = glb2->dzError();
00463 theta1_glb_ = glb1->theta();
00464 theta2_glb_ = glb2->theta();
00465 theta1Err_glb_ = glb1->thetaError();
00466 theta2Err_glb_ = glb2->thetaError();
00467 phi1_glb_ = glb1->phi();
00468 phi2_glb_ = glb2->phi();
00469 phi1Err_glb_ = glb1->phiError();
00470 phi2Err_glb_ = glb2->phiError();
00471 ddxy_glb_ = glb1->d0() - glb2->d0();
00472 ddz_glb_ = glb1->dz() - glb2->dz();
00473 dtheta_glb_ = glb1->theta() - glb2->theta();
00474 dphi_glb_ = glb1->phi() - glb2->phi();
00475 pt1_glb_ = glb1->pt();
00476 pt2_glb_ = glb2->pt();
00477 p1_glb_ = glb1->p();
00478 p2_glb_ = glb2->p();
00479 pt1Err_glb_ = glb1->ptError();
00480 pt2Err_glb_ = glb2->ptError();
00481 dpt_glb_ = glb1->pt() - glb2->pt();
00482 eta1_glb_ = glb1->eta();
00483 eta2_glb_ = glb2->eta();
00484 deta_glb_ = eta1_glb_ - eta2_glb_;
00485 norchi1_glb_ = glb1->normalizedChi2();
00486 norchi2_glb_ = glb2->normalizedChi2();
00487
00488 }
00489
00490
00491 splitterTree_->Fill();
00492 }
00493 }
00494
00495
00496 }
00497
00498
00499
00500 void CosmicSplitterValidation::beginJob()
00501 {
00502 edm::LogInfo("beginJob") << "Begin Job" << std::endl;
00503
00504 splitterTree_ = tfile->make<TTree>("splitterTree","splitterTree");
00505
00506
00507 splitterTree_->Branch("dcaX1_spl", &dcaX1_spl_, "dcaX1_spl/D");
00508 splitterTree_->Branch("dcaY1_spl", &dcaY1_spl_, "dcaY1_spl/D");
00509 splitterTree_->Branch("dcaZ1_spl", &dcaZ1_spl_, "dcaZ1_spl/D");
00510 splitterTree_->Branch("dcaX2_spl", &dcaX2_spl_, "dcaX2_spl/D");
00511 splitterTree_->Branch("dcaY2_spl", &dcaY2_spl_, "dcaY2_spl/D");
00512 splitterTree_->Branch("dcaZ2_spl", &dcaZ2_spl_, "dcaZ2_spl/D");
00513 splitterTree_->Branch("dxy1_spl", &dxy1_spl_, "dxy1_spl/D");
00514 splitterTree_->Branch("dz1_spl", &dz1_spl_, "dz1_spl/D");
00515 splitterTree_->Branch("dxy2_spl", &dxy2_spl_, "dxy2_spl/D");
00516 splitterTree_->Branch("dz2_spl", &dz2_spl_, "dz2_spl/D");
00517 splitterTree_->Branch("theta1_spl", &theta1_spl_, "theta1_spl/D");
00518 splitterTree_->Branch("theta2_spl", &theta2_spl_, "theta2_spl/D");
00519 splitterTree_->Branch("phi1_spl", &phi1_spl_, "phi1_spl/D");
00520 splitterTree_->Branch("phi2_spl", &phi2_spl_, "phi2_spl/D");
00521 splitterTree_->Branch("ddxy_spl", &ddxy_spl_, "ddxy_spl/D");
00522 splitterTree_->Branch("ddz_spl", &ddz_spl_, "ddz_spl/D");
00523 splitterTree_->Branch("dphi_spl", &dphi_spl_, "dphi_spl/D");
00524 splitterTree_->Branch("dtheta_spl", &dtheta_spl_, "dtheta_spl/D");
00525 splitterTree_->Branch("pt1_spl", &pt1_spl_, "pt1_spl/D");
00526 splitterTree_->Branch("pt2_spl", &pt2_spl_, "pt2_spl/D");
00527 splitterTree_->Branch("dpt_spl", &dpt_spl_, "dpt_spl/D");
00528 splitterTree_->Branch("p1_spl", &p1_spl_, "p1_spl/D");
00529 splitterTree_->Branch("p2_spl", &p2_spl_, "p2_spl/D");
00530 splitterTree_->Branch("eta1_spl", &eta1_spl_, "eta1_spl/D");
00531 splitterTree_->Branch("eta2_spl", &eta2_spl_, "eta2_spl/D");
00532 splitterTree_->Branch("deta_spl", &deta_spl_, "deta_spl/D");
00533 splitterTree_->Branch("nHits1_spl", &nHits1_spl_, "nHits1_spl/D");
00534 splitterTree_->Branch("nHitsPXB1_spl", &nHitsPXB1_spl_, "nHitsPXB1_spl/D");
00535 splitterTree_->Branch("nHitsPXF1_spl", &nHitsPXF1_spl_, "nHitsPXF1_spl/D");
00536 splitterTree_->Branch("nHitsTIB1_spl", &nHitsTIB1_spl_, "nHitsTIB1_spl/D");
00537 splitterTree_->Branch("nHitsTOB1_spl", &nHitsTOB1_spl_, "nHitsTOB1_spl/D");
00538 splitterTree_->Branch("nHitsTID1_spl", &nHitsTID1_spl_, "nHitsTID1_spl/D");
00539 splitterTree_->Branch("nHitsTEC1_spl", &nHitsTEC1_spl_, "nHitsTEC1_spl/D");
00540 splitterTree_->Branch("nHits2_spl", &nHits2_spl_, "nHits2_spl/D");
00541 splitterTree_->Branch("nHitsPXB2_spl", &nHitsPXB2_spl_, "nHitsPXB2_spl/D");
00542 splitterTree_->Branch("nHitsPXF2_spl", &nHitsPXF2_spl_, "nHitsPXF2_spl/D");
00543 splitterTree_->Branch("nHitsTIB2_spl", &nHitsTIB2_spl_, "nHitsTIB2_spl/D");
00544 splitterTree_->Branch("nHitsTOB2_spl", &nHitsTOB2_spl_, "nHitsTOB2_spl/D");
00545 splitterTree_->Branch("nHitsTID2_spl", &nHitsTID2_spl_, "nHitsTID2_spl/D");
00546 splitterTree_->Branch("nHitsTEC2_spl", &nHitsTEC2_spl_, "nHitsTEC2_spl/D");
00547
00548
00549 splitterTree_->Branch("d01Err_spl", &d01Err_spl_, "d01Err_spl/D");
00550 splitterTree_->Branch("d02Err_spl", &d02Err_spl_, "d02Err_spl/D");
00551 splitterTree_->Branch("dz1Err_spl", &dz1Err_spl_, "dz1Err_spl/D");
00552 splitterTree_->Branch("dz2Err_spl", &dz2Err_spl_, "dz2Err_spl/D");
00553 splitterTree_->Branch("phi1Err_spl", &phi1Err_spl_, "phi1Err_spl/D");
00554 splitterTree_->Branch("phi2Err_spl", &phi2Err_spl_, "phi2Err_spl/D");
00555 splitterTree_->Branch("theta1Err_spl", &theta1Err_spl_, "theta1Err_spl/D");
00556 splitterTree_->Branch("theta2Err_spl", &theta2Err_spl_, "theta2Err_spl/D");
00557 splitterTree_->Branch("pt1Err_spl", &pt1Err_spl_, "pt1Err_spl/D");
00558 splitterTree_->Branch("pt2Err_spl", &pt2Err_spl_, "pt2Err_spl/D");
00559
00560 splitterTree_->Branch("dcaX_org", &dcaX_org_, "dcaX_org/D");
00561 splitterTree_->Branch("dcaY_org", &dcaY_org_, "dcaY_org/D");
00562 splitterTree_->Branch("dcaZ_org", &dcaZ_org_, "dcaZ_org/D");
00563 splitterTree_->Branch("dxy_org", &dxy_org_, "dxy_org/D");
00564 splitterTree_->Branch("dz_org", &dz_org_, "dz_org/D");
00565 splitterTree_->Branch("theta_org", &theta_org_, "theta_org/D");
00566 splitterTree_->Branch("phi_org", &phi_org_, "phi_org/D");
00567 splitterTree_->Branch("eta_org", &eta_org_, "eta_org/D");
00568 splitterTree_->Branch("pt_org", &pt_org_, "pt_org/D");
00569 splitterTree_->Branch("p_org", &p_org_, "p_org/D");
00570 splitterTree_->Branch("norchi2_org", &norchi2_org_, "norchi2_org/D");
00571
00572 if (splitMuons_){
00573
00574
00575 splitterTree_->Branch("dcaX1_sta", &dcaX1_sta_, "dcaX1_sta/D");
00576 splitterTree_->Branch("dcaY1_sta", &dcaY1_sta_, "dcaY1_sta/D");
00577 splitterTree_->Branch("dcaZ1_sta", &dcaZ1_sta_, "dcaZ1_sta/D");
00578 splitterTree_->Branch("dcaX2_sta", &dcaX2_sta_, "dcaX2_sta/D");
00579 splitterTree_->Branch("dcaY2_sta", &dcaY2_sta_, "dcaY2_sta/D");
00580 splitterTree_->Branch("dcaZ2_sta", &dcaZ2_sta_, "dcaZ2_sta/D");
00581 splitterTree_->Branch("dxy1_sta", &dxy1_sta_, "dxy1_sta/D");
00582 splitterTree_->Branch("dz1_sta", &dz1_sta_, "dz1_sta/D");
00583 splitterTree_->Branch("dxy2_sta", &dxy2_sta_, "dxy2_sta/D");
00584 splitterTree_->Branch("dz2_sta", &dz2_sta_, "dz2_sta/D");
00585 splitterTree_->Branch("theta1_sta", &theta1_sta_, "theta1_sta/D");
00586 splitterTree_->Branch("theta2_sta", &theta2_sta_, "theta2_sta/D");
00587 splitterTree_->Branch("phi1_sta", &phi1_sta_, "phi1_sta/D");
00588 splitterTree_->Branch("phi2_sta", &phi2_sta_, "phi2_sta/D");
00589 splitterTree_->Branch("ddxy_sta", &ddxy_sta_, "ddxy_sta/D");
00590 splitterTree_->Branch("ddz_sta", &ddz_sta_, "ddz_sta/D");
00591 splitterTree_->Branch("dphi_sta", &dphi_sta_, "dphi_sta/D");
00592 splitterTree_->Branch("dtheta_sta", &dtheta_sta_, "dtheta_sta/D");
00593 splitterTree_->Branch("pt1_sta", &pt1_sta_, "pt1_sta/D");
00594 splitterTree_->Branch("pt2_sta", &pt2_sta_, "pt2_sta/D");
00595 splitterTree_->Branch("dpt_sta", &dpt_sta_, "dpt_sta/D");
00596 splitterTree_->Branch("p1_sta", &p1_sta_, "p1_sta/D");
00597 splitterTree_->Branch("p2_sta", &p2_sta_, "p2_sta/D");
00598 splitterTree_->Branch("eta1_sta", &eta1_sta_, "eta1_sta/D");
00599 splitterTree_->Branch("eta2_sta", &eta2_sta_, "eta2_sta/D");
00600 splitterTree_->Branch("deta_sta", &deta_sta_, "deta_sta/D");
00601
00602 splitterTree_->Branch("d01Err_sta", &d01Err_sta_, "d01Err_sta/D");
00603 splitterTree_->Branch("d02Err_sta", &d02Err_sta_, "d02Err_sta/D");
00604 splitterTree_->Branch("dz1Err_sta", &dz1Err_sta_, "dz1Err_sta/D");
00605 splitterTree_->Branch("dz2Err_sta", &dz2Err_sta_, "dz2Err_sta/D");
00606 splitterTree_->Branch("phi1Err_sta", &phi1Err_sta_, "phi1Err_sta/D");
00607 splitterTree_->Branch("phi2Err_sta", &phi2Err_sta_, "phi2Err_sta/D");
00608 splitterTree_->Branch("theta1Err_sta", &theta1Err_sta_, "theta1Err_sta/D");
00609 splitterTree_->Branch("theta2Err_sta", &theta2Err_sta_, "theta2Err_sta/D");
00610 splitterTree_->Branch("pt1Err_sta", &pt1Err_sta_, "pt1Err_sta/D");
00611 splitterTree_->Branch("pt2Err_sta", &pt2Err_sta_, "pt2Err_sta/D");
00612
00613
00614 splitterTree_->Branch("dcaX1_glb", &dcaX1_glb_, "dcaX1_glb/D");
00615 splitterTree_->Branch("dcaY1_glb", &dcaY1_glb_, "dcaY1_glb/D");
00616 splitterTree_->Branch("dcaZ1_glb", &dcaZ1_glb_, "dcaZ1_glb/D");
00617 splitterTree_->Branch("dcaX2_glb", &dcaX2_glb_, "dcaX2_glb/D");
00618 splitterTree_->Branch("dcaY2_glb", &dcaY2_glb_, "dcaY2_glb/D");
00619 splitterTree_->Branch("dcaZ2_glb", &dcaZ2_glb_, "dcaZ2_glb/D");
00620 splitterTree_->Branch("dxy1_glb", &dxy1_glb_, "dxy1_glb/D");
00621 splitterTree_->Branch("dz1_glb", &dz1_glb_, "dz1_glb/D");
00622 splitterTree_->Branch("dxy2_glb", &dxy2_glb_, "dxy2_glb/D");
00623 splitterTree_->Branch("dz2_glb", &dz2_glb_, "dz2_glb/D");
00624 splitterTree_->Branch("theta1_glb", &theta1_glb_, "theta1_glb/D");
00625 splitterTree_->Branch("theta2_glb", &theta2_glb_, "theta2_glb/D");
00626 splitterTree_->Branch("phi1_glb", &phi1_glb_, "phi1_glb/D");
00627 splitterTree_->Branch("phi2_glb", &phi2_glb_, "phi2_glb/D");
00628 splitterTree_->Branch("ddxy_glb", &ddxy_glb_, "ddxy_glb/D");
00629 splitterTree_->Branch("ddz_glb", &ddz_glb_, "ddz_glb/D");
00630 splitterTree_->Branch("dphi_glb", &dphi_glb_, "dphi_glb/D");
00631 splitterTree_->Branch("dtheta_glb", &dtheta_glb_, "dtheta_glb/D");
00632 splitterTree_->Branch("pt1_glb", &pt1_glb_, "pt1_glb/D");
00633 splitterTree_->Branch("pt2_glb", &pt2_glb_, "pt2_glb/D");
00634 splitterTree_->Branch("dpt_glb", &dpt_glb_, "dpt_glb/D");
00635 splitterTree_->Branch("p1_glb", &p1_glb_, "p1_glb/D");
00636 splitterTree_->Branch("p2_glb", &p2_glb_, "p2_glb/D");
00637 splitterTree_->Branch("eta1_glb", &eta1_glb_, "eta1_glb/D");
00638 splitterTree_->Branch("eta2_glb", &eta2_glb_, "eta2_glb/D");
00639 splitterTree_->Branch("deta_glb", &deta_glb_, "deta_glb/D");
00640 splitterTree_->Branch("norchi1_glb", &norchi1_glb_, "norchi1_glb/D");
00641 splitterTree_->Branch("norchi2_glb", &norchi2_glb_, "norchi2_glb/D");
00642
00643 splitterTree_->Branch("d01Err_glb", &d01Err_glb_, "d01Err_glb/D");
00644 splitterTree_->Branch("d02Err_glb", &d02Err_glb_, "d02Err_glb/D");
00645 splitterTree_->Branch("dz1Err_glb", &dz1Err_glb_, "dz1Err_glb/D");
00646 splitterTree_->Branch("dz2Err_glb", &dz2Err_glb_, "dz2Err_glb/D");
00647 splitterTree_->Branch("phi1Err_glb", &phi1Err_glb_, "phi1Err_glb/D");
00648 splitterTree_->Branch("phi2Err_glb", &phi2Err_glb_, "phi2Err_glb/D");
00649 splitterTree_->Branch("theta1Err_glb", &theta1Err_glb_, "theta1Err_glb/D");
00650 splitterTree_->Branch("theta2Err_glb", &theta2Err_glb_, "theta2Err_glb/D");
00651 splitterTree_->Branch("pt1Err_glb", &pt1Err_glb_, "pt1Err_glb/D");
00652 splitterTree_->Branch("pt2Err_glb", &pt2Err_glb_, "pt2Err_glb/D");
00653
00654 }
00655
00656 totalTracksToAnalyzer_ = 0;
00657 goldenCtr = 0;
00658 twoTracksCtr = 0;
00659 goldenPlusTwoTracksCtr = 0;
00660 _passesTracksPlusMuonsCuts = 0;
00661 }
00662
00663
00664
00665 void CosmicSplitterValidation::endJob() {
00666
00667
00668 std::cout << "golden: " << goldenCtr << ", two tracks: " << twoTracksCtr << ", golden+twotracks: " << goldenPlusTwoTracksCtr << ", tracks+muons cuts: " << _passesTracksPlusMuonsCuts << std::endl;
00669 }
00670
00671 bool CosmicSplitterValidation::is_gold_muon(const edm::Event& e){
00672
00673 edm::Handle<reco::MuonCollection> muHandle;
00674 e.getByLabel("STAMuons", muHandle);
00675 const reco::MuonCollection & muons = *(muHandle.product());
00676
00677 if ( 2 != muons.size() ) return false;
00678
00679 double mudd0=0., mudphi=0., muddsz=0., mudeta=0.;
00680 for ( unsigned int bindex = 0; bindex < muons.size(); ++bindex ) {
00681 reco::Muon mymuon = muons[bindex];
00682
00683
00684 reco::TrackRef mutrackref = mymuon.outerTrack();
00685 const reco::Track* mutrack = mutrackref.get();
00686 if (0 == bindex){
00687 mudd0+=mutrack->d0();
00688 mudphi+=mutrack->phi();
00689 muddsz+=mutrack->dsz();
00690 mudeta+=mymuon.eta();
00691 }
00692 if (1 == bindex){
00693 mudd0-=mutrack->d0();
00694 mudphi-=mutrack->phi();
00695 muddsz-=mutrack->dsz();
00696 mudeta-=mymuon.eta();
00697 }
00698 }
00699 if ((fabs(mudd0)<15.0)&&(fabs(mudphi)<0.045)&&(fabs(muddsz)<20.0)&&(fabs(mudeta)<0.060)) return true;
00700 return false;
00701 }
00702
00703
00704
00705 DEFINE_FWK_MODULE(CosmicSplitterValidation);