00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <memory>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028 #include "FWCore/Framework/interface/ESHandle.h"
00029
00030
00031
00032
00033
00034 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00035 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00036 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00037 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00038 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00039 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00040 #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
00041 #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"
00042
00043 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00044 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00045 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00046 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00047 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00048 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00049 #include "CondFormats/HcalObjects/interface/HcalRespCorrs.h"
00050 #include "CondFormats/DataRecord/interface/HcalRespCorrsRcd.h"
00051
00052 #include "Calibration/HcalCalibAlgos/interface/CommonUsefulStuff.h"
00053
00054 #include "TROOT.h"
00055 #include "TFile.h"
00056 #include "TTree.h"
00057 #include "TH1F.h"
00058
00059
00060 #include <fstream>
00061 #include <map>
00062
00063 using namespace edm;
00064 using namespace std;
00065 using namespace reco;
00066
00067 class ValidIsoTrkCalib : public edm::EDAnalyzer {
00068 public:
00069 explicit ValidIsoTrkCalib(const edm::ParameterSet&);
00070 ~ValidIsoTrkCalib();
00071
00072
00073
00074 private:
00075
00076 virtual void beginJob() ;
00077 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00078 virtual void endJob() ;
00079
00080
00081
00082
00083
00084
00085
00086 TrackDetectorAssociator trackAssociator_;
00087 TrackAssociatorParameters parameters_;
00088 double taECALCone_;
00089 double taHCALCone_;
00090
00091 const CaloGeometry* geo;
00092 InputTag genTracksLabel_;
00093 InputTag genhbheLabel_;
00094 InputTag genhoLabel_;
00095 std::vector<edm::InputTag> genecalLabel_;
00096 InputTag hbheLabel_;
00097 InputTag hoLabel_;
00098 InputTag trackLabel_;
00099 InputTag trackLabel1_;
00100
00101
00102
00103
00104 double associationConeSize_;
00105 string AxB_;
00106 double calibrationConeSize_;
00107
00108 bool allowMissingInputs_;
00109 string outputFileName_;
00110
00111
00112
00113 bool takeGenTracks_;
00114
00115 int gen, iso, pix;
00116 float genPt[500], genPhi[500], genEta[500];
00117 float isoPt[500], isoPhi[500], isoEta[500];
00118 float pixPt[500], pixPhi[500], pixEta[500];
00119
00120
00121
00122
00123 int NisoTrk;
00124 float trackPt, trackE, trackEta, trackPhi;
00125 float ptNear;
00126 float ptrack, rvert;
00127
00128
00129 int MinNTrackHitsBarrel, MinNTECHitsEndcap;
00130 double energyECALmip, maxPNear;
00131 double energyMinIso, energyMaxIso;
00132
00133
00134 Float_t emEnergy;
00135 Float_t targetE;
00136
00137
00138
00139 TTree *tTree, *fTree;
00140
00141 Float_t xTrkEcal;
00142 Float_t yTrkEcal;
00143 Float_t zTrkEcal;
00144
00145 Float_t xTrkHcal;
00146 Float_t yTrkHcal;
00147 Float_t zTrkHcal;
00148
00149 int Nhits;
00150 float eClustBefore;
00151 float eClustAfter;
00152 float eTrack;
00153 float etaTrack;
00154 float phiTrack;
00155 float eECAL;
00156 int numHits;
00157
00158
00159 float eBeforeDepth1;
00160 float eAfterDepth1;
00161 float eBeforeDepth2;
00162 float eAfterDepth2;
00163 float eCentHitBefore;
00164 float eCentHitAfter;
00165 float CentHitFactor;
00166 int iEta;
00167 int iPhi;
00168 int iEtaTr;
00169 int iPhiTr;
00170 float iDr, delR;
00171 int dietatr;
00172 int diphitr;
00173
00174 float iTime;
00175 float HTime[100];
00176 float e3x3Before;
00177 float e3x3After;
00178 float e5x5Before;
00179 float e5x5After;
00180 int eventNumber;
00181 int runNumber;
00182 float PtNearBy;
00183 float numVH, numVS, numValidTrkHits, numValidTrkStrips;
00184
00185 const HcalRespCorrs* respRecalib;
00186
00187
00188
00189 TH1F *nTracks;
00190
00191 edm::Service<TFileService> fs;
00192
00193
00194
00195 };
00196
00197
00198 ValidIsoTrkCalib::ValidIsoTrkCalib(const edm::ParameterSet& iConfig)
00199
00200 {
00201
00202
00203 takeGenTracks_=iConfig.getUntrackedParameter<bool>("takeGenTracks");
00204
00205 genTracksLabel_ = iConfig.getParameter<edm::InputTag>("genTracksLabel");
00206 genhbheLabel_= iConfig.getParameter<edm::InputTag>("genHBHE");
00207
00208
00209
00210
00211
00212 hbheLabel_= iConfig.getParameter<edm::InputTag>("hbheInput");
00213 hoLabel_=iConfig.getParameter<edm::InputTag>("hoInput");
00214
00215 trackLabel_ = iConfig.getParameter<edm::InputTag>("HcalIsolTrackInput");
00216 trackLabel1_ = iConfig.getParameter<edm::InputTag>("trackInput");
00217
00218 associationConeSize_=iConfig.getParameter<double>("associationConeSize");
00219 allowMissingInputs_=iConfig.getUntrackedParameter<bool>("allowMissingInputs", true);
00220
00221
00222
00223
00224 AxB_=iConfig.getParameter<std::string>("AxB");
00225 calibrationConeSize_=iConfig.getParameter<double>("calibrationConeSize");
00226
00227 MinNTrackHitsBarrel = iConfig.getParameter<int>("MinNTrackHitsBarrel");
00228 MinNTECHitsEndcap = iConfig.getParameter<int>("MinNTECHitsEndcap");
00229 energyECALmip = iConfig.getParameter<double>("energyECALmip");
00230 energyMinIso = iConfig.getParameter<double>("energyMinIso");
00231 energyMaxIso = iConfig.getParameter<double>("energyMaxIso");
00232 maxPNear = iConfig.getParameter<double>("maxPNear");
00233
00234 edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
00235 parameters_.loadParameters( parameters );
00236 trackAssociator_.useDefaultPropagator();
00237
00238
00239
00240
00241 }
00242
00243
00244 ValidIsoTrkCalib::~ValidIsoTrkCalib()
00245 {
00246
00247
00248
00249
00250 }
00251
00252
00253
00254 void
00255 ValidIsoTrkCalib::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00256 {
00257 using namespace edm;
00258
00259 try{
00260 edm::ESHandle <HcalRespCorrs> recalibCorrs;
00261 iSetup.get<HcalRespCorrsRcd>().get("recalibrate",recalibCorrs);
00262 respRecalib = recalibCorrs.product();
00263
00264 LogInfo("CalibConstants")<<" Loaded: OK ";
00265
00266 }catch(const cms::Exception & e) {
00267 LogWarning("CalibConstants")<<" Not Found!! ";
00268 }
00269
00270 edm::Handle<reco::TrackCollection> generalTracks;
00271 iEvent.getByLabel(genTracksLabel_, generalTracks);
00272
00273 edm::Handle<reco::TrackCollection> isoProdTracks;
00274 iEvent.getByLabel(trackLabel1_,isoProdTracks);
00275
00276
00277 edm::Handle<reco::IsolatedPixelTrackCandidateCollection> isoPixelTracks;
00278
00279 iEvent.getByLabel(trackLabel_,isoPixelTracks);
00280
00281
00282
00283
00284
00285
00286
00287 edm::Handle<HBHERecHitCollection> hbhe;
00288 iEvent.getByLabel(hbheLabel_,hbhe);
00289 const HBHERecHitCollection Hithbhe = *(hbhe.product());
00290
00291 edm::ESHandle<CaloGeometry> pG;
00292 iSetup.get<CaloGeometryRecord>().get(pG);
00293 geo = pG.product();
00294
00295 const CaloSubdetectorGeometry* gHcal = geo->getSubdetectorGeometry(DetId::Hcal,HcalBarrel);
00296
00297
00298
00299 parameters_.useEcal = true;
00300 parameters_.useHcal = true;
00301 parameters_.useCalo = false;
00302 parameters_.useMuon = false;
00303
00304
00305
00306
00307
00308 if (isoPixelTracks->size()==0) return;
00309
00310
00311 for (reco::TrackCollection::const_iterator trit=isoProdTracks->begin(); trit!=isoProdTracks->end(); trit++)
00312 {
00313
00314 reco::IsolatedPixelTrackCandidateCollection::const_iterator isoMatched=isoPixelTracks->begin();
00315
00316 bool matched=false;
00317
00318
00319 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator it = isoPixelTracks->begin(); it!=isoPixelTracks->end(); it++)
00320
00321 {
00322
00323 if (abs((trit->pt() - it->pt())/it->pt()) < 0.005 && abs(trit->eta() - it->eta()) < 0.01)
00324 {
00325 isoMatched=it;
00326 matched=true;
00327 break;
00328 }
00329 }
00330
00331
00332 if (!matched) continue;
00333 if(isoMatched->maxPtPxl() > maxPNear) continue;
00334
00335 ptNear = isoMatched->maxPtPxl();
00336
00337
00338
00339
00340 if (trit->hitPattern().numberOfValidHits()<MinNTrackHitsBarrel) continue;
00341 if (fabs(trit->eta())>1.47&&trit->hitPattern().numberOfValidStripTECHits()<MinNTECHitsEndcap) continue;
00342
00343
00344
00345
00346 numVH = trit->hitPattern().numberOfValidHits();
00347 numVS = trit->hitPattern().numberOfValidStripTECHits();
00348
00349
00350
00351 trackE = sqrt(trit->px()*trit->px()+trit->py()*trit->py()+trit->pz()*trit->pz()+0.14*0.14);
00352 trackPt = trit->pt();
00353 trackEta = trit->eta();
00354 trackPhi = trit->phi();
00355
00356 emEnergy = isoMatched->energyIn();
00357
00358
00359
00360
00361 TrackDetMatchInfo info = trackAssociator_.associate(iEvent, iSetup,trackAssociator_.getFreeTrajectoryState(iSetup, *trit), parameters_);
00362
00363
00364
00365
00366
00367
00368
00369 xTrkEcal=info.trkGlobPosAtEcal.x();
00370 yTrkEcal=info.trkGlobPosAtEcal.y();
00371 zTrkEcal=info.trkGlobPosAtEcal.z();
00372
00373 xTrkHcal=info.trkGlobPosAtHcal.x();
00374 yTrkHcal=info.trkGlobPosAtHcal.y();
00375 zTrkHcal=info.trkGlobPosAtHcal.z();
00376
00377 if (xTrkEcal==0 && yTrkEcal==0&& zTrkEcal==0) {cout<<"zero point at Ecal"<<endl; continue;}
00378 if (xTrkHcal==0 && yTrkHcal==0&& zTrkHcal==0) {cout<<"zero point at Hcal"<<endl; continue;}
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388 GlobalPoint gPointEcal(xTrkEcal,yTrkEcal,zTrkEcal);
00389 GlobalPoint gPointHcal(xTrkHcal,yTrkHcal,zTrkHcal);
00390
00391 int iphitrue = -10;
00392 int ietatrue = 100;
00393 const HcalDetId tempId = gHcal->getClosestCell(gPointHcal);
00394 ietatrue = tempId.ieta();
00395 iphitrue = tempId.iphi();
00396
00397
00398 MaxHit_struct MaxHit;
00399
00400 MaxHit.hitenergy=-100.;
00401
00402
00403 std::vector<DetId> usedHits;
00404
00405 usedHits.clear();
00406
00407
00408
00409
00410
00411
00412
00413 GlobalPoint gPhot;
00414
00415
00416 for (HBHERecHitCollection::const_iterator hhit=Hithbhe.begin(); hhit!=Hithbhe.end(); hhit++)
00417 {
00418
00419
00420 bool hitIsUsed=false;
00421 for (uint32_t i=0; i<usedHits.size(); i++)
00422 {
00423 if (usedHits[i]==hhit->id()) hitIsUsed=true;
00424 }
00425 if (hitIsUsed) continue;
00426 usedHits.push_back(hhit->id());
00427
00428
00429
00430 float recal = 1;
00431
00432
00433 GlobalPoint pos = geo->getPosition(hhit->detid());
00434
00435
00436
00437 int iphihitm = (hhit->id()).iphi();
00438 int ietahitm = (hhit->id()).ieta();
00439 int depthhit = (hhit->id()).depth();
00440 float enehit = hhit->energy() * recal;
00441
00442 if (depthhit!=1) continue;
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453 double distAtHcal = getDistInPlaneSimple(gPointHcal, pos);
00454
00455 if(distAtHcal < associationConeSize_)
00456 {
00457
00458 for (HBHERecHitCollection::const_iterator hhit2=Hithbhe.begin(); hhit2!=Hithbhe.end(); hhit2++)
00459 {
00460 int iphihitm2 = (hhit2->id()).iphi();
00461 int ietahitm2 = (hhit2->id()).ieta();
00462 int depthhit2 = (hhit2->id()).depth();
00463 float enehit2 = hhit2->energy() * recal;
00464
00465 if (iphihitm==iphihitm2 && ietahitm==ietahitm2 && depthhit!=depthhit2) enehit = enehit+enehit2;
00466
00467 }
00468
00469
00470
00471
00472
00473
00474 if(enehit > MaxHit.hitenergy)
00475 {
00476 MaxHit.hitenergy = enehit;
00477 MaxHit.ietahitm = (hhit->id()).ieta();
00478 MaxHit.iphihitm = (hhit->id()).iphi();
00479 MaxHit.dr = distAtHcal;
00480
00481 MaxHit.depthhit = 1;
00482
00483
00484 }
00485
00486 }
00487 }
00488
00489 usedHits.clear();
00490
00491
00492
00493
00494
00495
00496 Bool_t passCuts = kFALSE;
00497 if(trackE > energyMinIso && trackE < energyMaxIso && emEnergy < energyECALmip && MaxHit.hitenergy > 0. && abs(MaxHit.ietahitm)<29) passCuts = kTRUE;
00498
00499
00500
00501
00502 numHits=0;
00503
00504 eClustBefore = 0.0;
00505 eClustAfter = 0.0;
00506 eBeforeDepth1 = 0.0;
00507 eAfterDepth1 = 0.0;
00508 eBeforeDepth2 = 0.0;
00509 eAfterDepth2 = 0.0;
00510 CentHitFactor = 0.0;
00511 e3x3After = 0.0;
00512 e3x3Before = 0.0;
00513 e5x5After = 0.0;
00514 e5x5Before = 0.0;
00515
00516
00517 for (HBHERecHitCollection::const_iterator hhit=Hithbhe.begin(); hhit!=Hithbhe.end(); hhit++)
00518 {
00519
00520
00521 bool hitIsUsed=false;
00522 for (uint32_t i=0; i<usedHits.size(); i++)
00523 {
00524 if (usedHits[i]==hhit->id()) hitIsUsed=true;
00525 }
00526 if (hitIsUsed) continue;
00527 usedHits.push_back(hhit->id());
00528
00529 int DIETA = 100;
00530 if(MaxHit.ietahitm*(hhit->id()).ieta()>0)
00531 {
00532 DIETA = MaxHit.ietahitm - (hhit->id()).ieta();
00533 }
00534 if(MaxHit.ietahitm*(hhit->id()).ieta()<0)
00535 {
00536 DIETA = MaxHit.ietahitm - (hhit->id()).ieta();
00537 DIETA = DIETA>0 ? DIETA-1 : DIETA+1;
00538 }
00539
00540 int DIPHI = abs(MaxHit.iphihitm - (hhit->id()).iphi());
00541 DIPHI = DIPHI>36 ? 72-DIPHI : DIPHI;
00542
00543
00544
00545 int numbercell=100;
00546
00547
00548
00549
00550
00551
00552
00553 if( abs(DIETA)<=numbercell && (abs(DIPHI)<=numbercell || ( abs(MaxHit.ietahitm)>=20 && abs(DIPHI)<=numbercell+1)) )
00554 {
00555 const GlobalPoint pos2 = geo->getPosition(hhit->detid());
00556
00557 if(passCuts && hhit->energy()>0)
00558 {
00559
00560
00561 float factor = 0.0;
00562
00563 factor = respRecalib -> getValues(hhit->id())->getValue();
00564
00565
00566
00567
00568
00569 if (hhit->id().ieta() == MaxHit.ietahitm && hhit->id().iphi() == MaxHit.iphihitm) CentHitFactor=factor;
00570
00571 if (hhit->id().ieta() == MaxHit.ietahitm && hhit->id().iphi() == MaxHit.iphihitm) iTime = hhit->time();
00572
00573 if(AxB_!="3x3" && AxB_!="5x5" && AxB_!="Cone") LogWarning(" AxB ")<<" Not supported: "<< AxB_;
00574
00575
00576 if (abs(DIETA)<=2 && (abs(DIPHI)<=2 || ((abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=4) && !( (abs(MaxHit.ietahitm)==21 || abs(MaxHit.ietahitm)==22) && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>2) )) )
00577 {
00578
00579 e5x5Before += hhit->energy();
00580 e5x5After += hhit->energy()*factor;
00581 }
00582
00583
00584 if (abs(DIETA)<=1 && (abs(DIPHI)<=1 || ((abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=2) && !(abs(MaxHit.ietahitm)==21 && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>1) )) )
00585 {
00586
00587 e3x3Before += hhit->energy();
00588 e3x3After += hhit->energy()*factor;
00589 }
00590
00591
00592 if(AxB_=="5x5")
00593 {
00594
00595 if (abs(DIETA)<=2 && (abs(DIPHI)<=2 || ( abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=4) ) )
00596 {
00597 if (abs(MaxHit.ietahitm)==21 && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>3) continue;
00598
00599 HTime[numHits]= hhit->time();
00600 numHits++;
00601
00602 eClustBefore += hhit->energy();
00603 eClustAfter += hhit->energy()*factor;
00604
00605 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00606 {
00607 eBeforeDepth1 += hhit->energy();
00608 eAfterDepth1 += hhit->energy()*factor;
00609 }
00610 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00611 {
00612 eBeforeDepth2 += hhit->energy();
00613 eAfterDepth2 += hhit->energy()*factor;
00614 }
00615 }
00616 }
00617
00618
00619
00620 if(AxB_=="3x3")
00621 {
00622 if (abs(DIETA)<=1 && (abs(DIPHI)<=1 || ( abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=2) ) )
00623 {
00624 if (abs(MaxHit.ietahitm)==21 && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>2) continue;
00625
00626 HTime[numHits]= hhit->time();
00627 numHits++;
00628
00629 eClustBefore += hhit->energy();
00630 eClustAfter += hhit->energy() * factor;
00631
00632 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00633 {
00634 eBeforeDepth1 += hhit->energy();
00635 eAfterDepth1 += hhit->energy() * factor;
00636 }
00637 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00638 {
00639 eBeforeDepth2 += hhit->energy();
00640 eAfterDepth2 += hhit->energy() * factor;
00641 }
00642
00643 }
00644 }
00645
00646
00647 if (AxB_=="Cone" && getDistInPlaneSimple(gPointHcal, pos2) < calibrationConeSize_) {
00648
00649 HTime[numHits]= hhit->time();
00650 numHits++;
00651
00652 eClustBefore += hhit->energy();
00653 eClustAfter += hhit->energy() * factor;
00654
00655 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00656 {
00657 eBeforeDepth1 += hhit->energy();
00658 eAfterDepth1 += hhit->energy() * factor;
00659 }
00660 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00661 {
00662 eBeforeDepth2 += hhit->energy();
00663 eAfterDepth2 += hhit->energy() * factor;
00664 }
00665
00666
00667 }
00668
00669 }
00670
00671 }
00672
00673 }
00674
00675
00676 int dieta_M_P = 100;
00677 int diphi_M_P = 100;
00678 if(MaxHit.ietahitm*ietatrue>0) {dieta_M_P = abs (MaxHit.ietahitm-ietatrue);}
00679 if(MaxHit.ietahitm*ietatrue<0) {dieta_M_P = abs(MaxHit.ietahitm-ietatrue)-1;}
00680 diphi_M_P = abs(MaxHit.iphihitm-iphitrue);
00681 diphi_M_P = diphi_M_P>36 ? 72-diphi_M_P : diphi_M_P;
00682
00683
00684 if(passCuts)
00685
00686 {
00687 eventNumber = iEvent.id().event();
00688 runNumber = iEvent.id().run();
00689
00690 eCentHitBefore = MaxHit.hitenergy;
00691 eCentHitAfter = MaxHit.hitenergy*CentHitFactor;
00692 eECAL = emEnergy;
00693 numValidTrkHits = numVH;
00694 numValidTrkStrips = numVS;
00695 PtNearBy = ptNear;
00696
00697
00698 eTrack = trackE;
00699 phiTrack = trackPhi;
00700 etaTrack = trackEta;
00701
00702 iEta = MaxHit.ietahitm;
00703 iPhi = MaxHit.iphihitm;
00704
00705 iEtaTr = ietatrue;
00706 iPhiTr = iphitrue;
00707 iDr = sqrt(diphi_M_P*diphi_M_P+dieta_M_P*dieta_M_P);
00708 delR = MaxHit.dr;
00709 dietatr = dieta_M_P;
00710 diphitr = diphi_M_P;
00711
00712 fTree -> Fill();
00713 }
00714
00715 }
00716
00717
00718
00719
00720
00721 int n = generalTracks->size();
00722 nTracks->Fill(n);
00723
00724 if(takeGenTracks_ && iEvent.id().event()%10==1)
00725 {
00726 gen = generalTracks->size();
00727 iso = isoProdTracks->size();
00728 pix = isoPixelTracks->size();
00729
00730 genPt[0] = -33;
00731 genPhi[0] = -33;
00732 genEta[0] = -33;
00733
00734 isoPt[0] = -33;
00735 isoPhi[0] = -33;
00736 isoEta[0] = -33;
00737
00738 pixPt[0] = -33;
00739 pixPhi[0] = -33;
00740 pixEta[0] = -33;
00741
00742 Int_t gencount=0, isocount=0, pixcount=0;
00743 for (reco::TrackCollection::const_iterator gentr=generalTracks->begin(); gentr!=generalTracks->end(); gentr++)
00744 {
00745 genPt[gencount] = gentr->pt();
00746 genPhi[gencount] = gentr->phi();
00747 genEta[gencount] = gentr->eta();
00748 gencount++;
00749 }
00750
00751 for (reco::TrackCollection::const_iterator isotr=isoProdTracks->begin(); isotr!=isoProdTracks->end(); isotr++)
00752 {
00753 isoPt[isocount] = isotr->pt();
00754 isoPhi[isocount] = isotr->phi();
00755 isoEta[isocount] = isotr->eta();
00756 isocount++;
00757 }
00758
00759 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator pixtr=isoPixelTracks->begin(); pixtr!=isoPixelTracks->end(); pixtr++)
00760 {
00761 pixPt[pixcount] = pixtr->pt();
00762 pixPhi[pixcount] = pixtr->phi();
00763 pixEta[pixcount] = pixtr->eta();
00764 pixcount++;
00765 }
00766 }
00767
00768 tTree -> Fill();
00769
00770 }
00771
00772
00773 void
00774 ValidIsoTrkCalib::beginJob()
00775 {
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796 nTracks = fs->make<TH1F>("nTracks","general;number of general tracks",11,-0.5,10.5);
00797
00798
00799 tTree = fs->make<TTree>("tTree", "Tree for gen info");
00800
00801 fTree = fs->make<TTree>("fTree", "Tree for IsoTrack Calibration");
00802
00803 fTree->Branch("eventNumber", &eventNumber, "eventNumber/I");
00804 fTree->Branch("runNumber", &runNumber, "runNumber/I");
00805
00806 fTree->Branch("eClustBefore", &eClustBefore,"eClustBefore/F");
00807 fTree->Branch("eClustAfter", &eClustAfter,"eClustAfter/F");
00808 fTree->Branch("eTrack", &eTrack, "eTrack/F");
00809 fTree->Branch("etaTrack", &etaTrack, "etaTrack/F");
00810 fTree->Branch("phiTrack", &phiTrack, "phiTrack/F");
00811
00812 fTree->Branch("numHits", &numHits, "numHits/I");
00813 fTree->Branch("eECAL", &eECAL, "eECAL/F");
00814 fTree->Branch("PtNearBy", &PtNearBy, "PtNearBy/F");
00815 fTree->Branch("numValidTrkHits", &numValidTrkHits, "numValidTrkHits/F");
00816 fTree->Branch("numValidTrkStrips", &numValidTrkStrips, "numValidTrkStrips/F");
00817
00818 fTree->Branch("eBeforeDepth1", &eBeforeDepth1, "eBeforeDepth1/F");
00819 fTree->Branch("eBeforeDepth2", &eBeforeDepth2, "eBeforeDepth2/F");
00820 fTree->Branch("eAfterDepth1", &eAfterDepth1, "eAfterDepth1/F");
00821 fTree->Branch("eAfterDepth2", &eAfterDepth2, "eAfterDepth2/F");
00822
00823 fTree->Branch("e3x3Before", &e3x3Before, "e3x3Before/F");
00824 fTree->Branch("e3x3After", &e3x3After, "e3x3After/F");
00825 fTree->Branch("e5x5Before", &e5x5Before, "e5x5Before/F");
00826 fTree->Branch("e5x5After", &e5x5After, "e5x5After/F");
00827
00828 fTree->Branch("eCentHitAfter", &eCentHitAfter, "eCentHitAfter/F");
00829 fTree->Branch("eCentHitBefore", &eCentHitBefore, "eCentHitBefore/F");
00830 fTree->Branch("iEta", &iEta, "iEta/I");
00831 fTree->Branch("iPhi", &iPhi, "iPhi/I");
00832
00833
00834 fTree->Branch("iEtaTr", &iEtaTr, "iEtaTr/I");
00835 fTree->Branch("iPhiTr", &iPhiTr, "iPhiTr/I");
00836 fTree->Branch("dietatr", &dietatr, "dietatr/I");
00837 fTree->Branch("diphitr", &diphitr, "diphitr/I");
00838 fTree->Branch("iDr", &iDr, "iDr/F");
00839 fTree->Branch("delR", &delR, "delR/F");
00840
00841 fTree->Branch("iTime", &iTime, "iTime/F");
00842 fTree->Branch("HTime", HTime, "HTime[numHits]/F");
00843
00844 fTree->Branch("xTrkEcal", &xTrkEcal, "xTrkEcal/F");
00845 fTree->Branch("yTrkEcal", &yTrkEcal, "yTrkEcal/F");
00846 fTree->Branch("zTrkEcal", &zTrkEcal, "zTrkEcal/F");
00847 fTree->Branch("xTrkHcal", &xTrkHcal, "xTrkHcal/F");
00848 fTree->Branch("yTrkHcal", &yTrkHcal, "yTrkHcal/F");
00849 fTree->Branch("zTrkHcal", &zTrkHcal, "zTrkHcal/F");
00850
00851 if(takeGenTracks_) {
00852 tTree->Branch("gen", &gen, "gen/I");
00853 tTree->Branch("iso", &iso, "iso/I");
00854 tTree->Branch("pix", &pix, "pix/I");
00855 tTree->Branch("genPt", genPt, "genPt[gen]/F");
00856 tTree->Branch("genPhi", genPhi, "genPhi[gen]/F");
00857 tTree->Branch("genEta", genEta, "genEta[gen]/F");
00858
00859 tTree->Branch("isoPt", isoPt, "isoPt[iso]/F");
00860 tTree->Branch("isoPhi", isoPhi, "isoPhi[iso]/F");
00861 tTree->Branch("isoEta", isoEta, "isoEta[iso]/F");
00862
00863 tTree->Branch("pixPt", pixPt, "pixPt[pix]/F");
00864 tTree->Branch("pixPhi", pixPhi, "pixPhi[pix]/F");
00865 tTree->Branch("pixEta", pixEta, "pixEta[pix]/F");
00866 }
00867
00868
00869 }
00870
00871
00872
00873
00874 void
00875 ValidIsoTrkCalib::endJob()
00876 {
00877
00878
00879 }
00880
00881
00882 DEFINE_FWK_MODULE(ValidIsoTrkCalib);