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<int> 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 int hitHashedIndex=hhit->id().hashed_index();
00422 for (uint32_t i=0; i<usedHits.size(); i++)
00423 {
00424 if (usedHits[i]==hitHashedIndex) hitIsUsed=true;
00425 }
00426 if (hitIsUsed) continue;
00427 usedHits.push_back(hitHashedIndex);
00428
00429
00430
00431 float recal = 1;
00432
00433
00434 GlobalPoint pos = geo->getPosition(hhit->detid());
00435
00436
00437
00438 int iphihitm = (hhit->id()).iphi();
00439 int ietahitm = (hhit->id()).ieta();
00440 int depthhit = (hhit->id()).depth();
00441 float enehit = hhit->energy() * recal;
00442
00443 if (depthhit!=1) continue;
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454 double distAtHcal = getDistInPlaneSimple(gPointHcal, pos);
00455
00456 if(distAtHcal < associationConeSize_)
00457 {
00458
00459 for (HBHERecHitCollection::const_iterator hhit2=Hithbhe.begin(); hhit2!=Hithbhe.end(); hhit2++)
00460 {
00461 int iphihitm2 = (hhit2->id()).iphi();
00462 int ietahitm2 = (hhit2->id()).ieta();
00463 int depthhit2 = (hhit2->id()).depth();
00464 float enehit2 = hhit2->energy() * recal;
00465
00466 if (iphihitm==iphihitm2 && ietahitm==ietahitm2 && depthhit!=depthhit2) enehit = enehit+enehit2;
00467
00468 }
00469
00470
00471
00472
00473
00474
00475 if(enehit > MaxHit.hitenergy)
00476 {
00477 MaxHit.hitenergy = enehit;
00478 MaxHit.ietahitm = (hhit->id()).ieta();
00479 MaxHit.iphihitm = (hhit->id()).iphi();
00480 MaxHit.dr = distAtHcal;
00481
00482 MaxHit.depthhit = 1;
00483
00484
00485 }
00486
00487 }
00488 }
00489
00490 usedHits.clear();
00491
00492
00493
00494
00495
00496
00497 Bool_t passCuts = kFALSE;
00498 if(trackE > energyMinIso && trackE < energyMaxIso && emEnergy < energyECALmip && MaxHit.hitenergy > 0. && abs(MaxHit.ietahitm)<29) passCuts = kTRUE;
00499
00500
00501
00502
00503 numHits=0;
00504
00505 eClustBefore = 0.0;
00506 eClustAfter = 0.0;
00507 eBeforeDepth1 = 0.0;
00508 eAfterDepth1 = 0.0;
00509 eBeforeDepth2 = 0.0;
00510 eAfterDepth2 = 0.0;
00511 CentHitFactor = 0.0;
00512 e3x3After = 0.0;
00513 e3x3Before = 0.0;
00514 e5x5After = 0.0;
00515 e5x5Before = 0.0;
00516
00517
00518 for (HBHERecHitCollection::const_iterator hhit=Hithbhe.begin(); hhit!=Hithbhe.end(); hhit++)
00519 {
00520
00521
00522 bool hitIsUsed=false;
00523 int hitHashedIndex=hhit->id().hashed_index();
00524 for (uint32_t i=0; i<usedHits.size(); i++)
00525 {
00526 if (usedHits[i]==hitHashedIndex) hitIsUsed=true;
00527 }
00528 if (hitIsUsed) continue;
00529 usedHits.push_back(hitHashedIndex);
00530
00531 int DIETA = 100;
00532 if(MaxHit.ietahitm*(hhit->id()).ieta()>0)
00533 {
00534 DIETA = MaxHit.ietahitm - (hhit->id()).ieta();
00535 }
00536 if(MaxHit.ietahitm*(hhit->id()).ieta()<0)
00537 {
00538 DIETA = MaxHit.ietahitm - (hhit->id()).ieta();
00539 DIETA = DIETA>0 ? DIETA-1 : DIETA+1;
00540 }
00541
00542 int DIPHI = abs(MaxHit.iphihitm - (hhit->id()).iphi());
00543 DIPHI = DIPHI>36 ? 72-DIPHI : DIPHI;
00544
00545
00546
00547 int numbercell=100;
00548
00549
00550
00551
00552
00553
00554
00555 if( abs(DIETA)<=numbercell && (abs(DIPHI)<=numbercell || ( abs(MaxHit.ietahitm)>=20 && abs(DIPHI)<=numbercell+1)) )
00556 {
00557 const GlobalPoint pos2 = geo->getPosition(hhit->detid());
00558
00559 if(passCuts && hhit->energy()>0)
00560 {
00561
00562
00563 float factor = 0.0;
00564
00565 factor = respRecalib -> getValues(hhit->id())->getValue();
00566
00567
00568
00569
00570
00571 if (hhit->id().ieta() == MaxHit.ietahitm && hhit->id().iphi() == MaxHit.iphihitm) CentHitFactor=factor;
00572
00573 if (hhit->id().ieta() == MaxHit.ietahitm && hhit->id().iphi() == MaxHit.iphihitm) iTime = hhit->time();
00574
00575 if(AxB_!="3x3" && AxB_!="5x5" && AxB_!="Cone") LogWarning(" AxB ")<<" Not supported: "<< AxB_;
00576
00577
00578 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) )) )
00579 {
00580
00581 e5x5Before += hhit->energy();
00582 e5x5After += hhit->energy()*factor;
00583 }
00584
00585
00586 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) )) )
00587 {
00588
00589 e3x3Before += hhit->energy();
00590 e3x3After += hhit->energy()*factor;
00591 }
00592
00593
00594 if(AxB_=="5x5")
00595 {
00596
00597 if (abs(DIETA)<=2 && (abs(DIPHI)<=2 || ( abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=4) ) )
00598 {
00599 if (abs(MaxHit.ietahitm)==21 && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>3) continue;
00600
00601 HTime[numHits]= hhit->time();
00602 numHits++;
00603
00604 eClustBefore += hhit->energy();
00605 eClustAfter += hhit->energy()*factor;
00606
00607 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00608 {
00609 eBeforeDepth1 += hhit->energy();
00610 eAfterDepth1 += hhit->energy()*factor;
00611 }
00612 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00613 {
00614 eBeforeDepth2 += hhit->energy();
00615 eAfterDepth2 += hhit->energy()*factor;
00616 }
00617 }
00618 }
00619
00620
00621
00622 if(AxB_=="3x3")
00623 {
00624 if (abs(DIETA)<=1 && (abs(DIPHI)<=1 || ( abs(MaxHit.ietahitm)>20 && abs(DIPHI)<=2) ) )
00625 {
00626 if (abs(MaxHit.ietahitm)==21 && abs((hhit->id()).ieta())<=20 && abs(DIPHI)>2) continue;
00627
00628 HTime[numHits]= hhit->time();
00629 numHits++;
00630
00631 eClustBefore += hhit->energy();
00632 eClustAfter += hhit->energy() * factor;
00633
00634 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00635 {
00636 eBeforeDepth1 += hhit->energy();
00637 eAfterDepth1 += hhit->energy() * factor;
00638 }
00639 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00640 {
00641 eBeforeDepth2 += hhit->energy();
00642 eAfterDepth2 += hhit->energy() * factor;
00643 }
00644
00645 }
00646 }
00647
00648
00649 if (AxB_=="Cone" && getDistInPlaneSimple(gPointHcal, pos2) < calibrationConeSize_) {
00650
00651 HTime[numHits]= hhit->time();
00652 numHits++;
00653
00654 eClustBefore += hhit->energy();
00655 eClustAfter += hhit->energy() * factor;
00656
00657 if ((hhit->id().depth() == 1) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00658 {
00659 eBeforeDepth1 += hhit->energy();
00660 eAfterDepth1 += hhit->energy() * factor;
00661 }
00662 else if((hhit->id().depth() == 2) && (abs(hhit->id().ieta()) > 17) && (abs(hhit->id().ieta()) < 29))
00663 {
00664 eBeforeDepth2 += hhit->energy();
00665 eAfterDepth2 += hhit->energy() * factor;
00666 }
00667
00668
00669 }
00670
00671 }
00672
00673 }
00674
00675 }
00676
00677
00678 int dieta_M_P = 100;
00679 int diphi_M_P = 100;
00680 if(MaxHit.ietahitm*ietatrue>0) {dieta_M_P = abs (MaxHit.ietahitm-ietatrue);}
00681 if(MaxHit.ietahitm*ietatrue<0) {dieta_M_P = abs(MaxHit.ietahitm-ietatrue)-1;}
00682 diphi_M_P = abs(MaxHit.iphihitm-iphitrue);
00683 diphi_M_P = diphi_M_P>36 ? 72-diphi_M_P : diphi_M_P;
00684
00685
00686 if(passCuts)
00687
00688 {
00689 eventNumber = iEvent.id().event();
00690 runNumber = iEvent.id().run();
00691
00692 eCentHitBefore = MaxHit.hitenergy;
00693 eCentHitAfter = MaxHit.hitenergy*CentHitFactor;
00694 eECAL = emEnergy;
00695 numValidTrkHits = numVH;
00696 numValidTrkStrips = numVS;
00697 PtNearBy = ptNear;
00698
00699
00700 eTrack = trackE;
00701 phiTrack = trackPhi;
00702 etaTrack = trackEta;
00703
00704 iEta = MaxHit.ietahitm;
00705 iPhi = MaxHit.iphihitm;
00706
00707 iEtaTr = ietatrue;
00708 iPhiTr = iphitrue;
00709 iDr = sqrt(diphi_M_P*diphi_M_P+dieta_M_P*dieta_M_P);
00710 delR = MaxHit.dr;
00711 dietatr = dieta_M_P;
00712 diphitr = diphi_M_P;
00713
00714 fTree -> Fill();
00715 }
00716
00717 }
00718
00719
00720
00721
00722
00723 int n = generalTracks->size();
00724 nTracks->Fill(n);
00725
00726 if(takeGenTracks_ && iEvent.id().event()%10==1)
00727 {
00728 gen = generalTracks->size();
00729 iso = isoProdTracks->size();
00730 pix = isoPixelTracks->size();
00731
00732 genPt[0] = -33;
00733 genPhi[0] = -33;
00734 genEta[0] = -33;
00735
00736 isoPt[0] = -33;
00737 isoPhi[0] = -33;
00738 isoEta[0] = -33;
00739
00740 pixPt[0] = -33;
00741 pixPhi[0] = -33;
00742 pixEta[0] = -33;
00743
00744 Int_t gencount=0, isocount=0, pixcount=0;
00745 for (reco::TrackCollection::const_iterator gentr=generalTracks->begin(); gentr!=generalTracks->end(); gentr++)
00746 {
00747 genPt[gencount] = gentr->pt();
00748 genPhi[gencount] = gentr->phi();
00749 genEta[gencount] = gentr->eta();
00750 gencount++;
00751 }
00752
00753 for (reco::TrackCollection::const_iterator isotr=isoProdTracks->begin(); isotr!=isoProdTracks->end(); isotr++)
00754 {
00755 isoPt[isocount] = isotr->pt();
00756 isoPhi[isocount] = isotr->phi();
00757 isoEta[isocount] = isotr->eta();
00758 isocount++;
00759 }
00760
00761 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator pixtr=isoPixelTracks->begin(); pixtr!=isoPixelTracks->end(); pixtr++)
00762 {
00763 pixPt[pixcount] = pixtr->pt();
00764 pixPhi[pixcount] = pixtr->phi();
00765 pixEta[pixcount] = pixtr->eta();
00766 pixcount++;
00767 }
00768 }
00769
00770 tTree -> Fill();
00771
00772 }
00773
00774
00775 void
00776 ValidIsoTrkCalib::beginJob()
00777 {
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798 nTracks = fs->make<TH1F>("nTracks","general;number of general tracks",11,-0.5,10.5);
00799
00800
00801 tTree = fs->make<TTree>("tTree", "Tree for gen info");
00802
00803 fTree = fs->make<TTree>("fTree", "Tree for IsoTrack Calibration");
00804
00805 fTree->Branch("eventNumber", &eventNumber, "eventNumber/I");
00806 fTree->Branch("runNumber", &runNumber, "runNumber/I");
00807
00808 fTree->Branch("eClustBefore", &eClustBefore,"eClustBefore/F");
00809 fTree->Branch("eClustAfter", &eClustAfter,"eClustAfter/F");
00810 fTree->Branch("eTrack", &eTrack, "eTrack/F");
00811 fTree->Branch("etaTrack", &etaTrack, "etaTrack/F");
00812 fTree->Branch("phiTrack", &phiTrack, "phiTrack/F");
00813
00814 fTree->Branch("numHits", &numHits, "numHits/I");
00815 fTree->Branch("eECAL", &eECAL, "eECAL/F");
00816 fTree->Branch("PtNearBy", &PtNearBy, "PtNearBy/F");
00817 fTree->Branch("numValidTrkHits", &numValidTrkHits, "numValidTrkHits/F");
00818 fTree->Branch("numValidTrkStrips", &numValidTrkStrips, "numValidTrkStrips/F");
00819
00820 fTree->Branch("eBeforeDepth1", &eBeforeDepth1, "eBeforeDepth1/F");
00821 fTree->Branch("eBeforeDepth2", &eBeforeDepth2, "eBeforeDepth2/F");
00822 fTree->Branch("eAfterDepth1", &eAfterDepth1, "eAfterDepth1/F");
00823 fTree->Branch("eAfterDepth2", &eAfterDepth2, "eAfterDepth2/F");
00824
00825 fTree->Branch("e3x3Before", &e3x3Before, "e3x3Before/F");
00826 fTree->Branch("e3x3After", &e3x3After, "e3x3After/F");
00827 fTree->Branch("e5x5Before", &e5x5Before, "e5x5Before/F");
00828 fTree->Branch("e5x5After", &e5x5After, "e5x5After/F");
00829
00830 fTree->Branch("eCentHitAfter", &eCentHitAfter, "eCentHitAfter/F");
00831 fTree->Branch("eCentHitBefore", &eCentHitBefore, "eCentHitBefore/F");
00832 fTree->Branch("iEta", &iEta, "iEta/I");
00833 fTree->Branch("iPhi", &iPhi, "iPhi/I");
00834
00835
00836 fTree->Branch("iEtaTr", &iEtaTr, "iEtaTr/I");
00837 fTree->Branch("iPhiTr", &iPhiTr, "iPhiTr/I");
00838 fTree->Branch("dietatr", &dietatr, "dietatr/I");
00839 fTree->Branch("diphitr", &diphitr, "diphitr/I");
00840 fTree->Branch("iDr", &iDr, "iDr/F");
00841 fTree->Branch("delR", &delR, "delR/F");
00842
00843 fTree->Branch("iTime", &iTime, "iTime/F");
00844 fTree->Branch("HTime", HTime, "HTime[numHits]/F");
00845
00846 fTree->Branch("xTrkEcal", &xTrkEcal, "xTrkEcal/F");
00847 fTree->Branch("yTrkEcal", &yTrkEcal, "yTrkEcal/F");
00848 fTree->Branch("zTrkEcal", &zTrkEcal, "zTrkEcal/F");
00849 fTree->Branch("xTrkHcal", &xTrkHcal, "xTrkHcal/F");
00850 fTree->Branch("yTrkHcal", &yTrkHcal, "yTrkHcal/F");
00851 fTree->Branch("zTrkHcal", &zTrkHcal, "zTrkHcal/F");
00852
00853 if(takeGenTracks_) {
00854 tTree->Branch("gen", &gen, "gen/I");
00855 tTree->Branch("iso", &iso, "iso/I");
00856 tTree->Branch("pix", &pix, "pix/I");
00857 tTree->Branch("genPt", genPt, "genPt[gen]/F");
00858 tTree->Branch("genPhi", genPhi, "genPhi[gen]/F");
00859 tTree->Branch("genEta", genEta, "genEta[gen]/F");
00860
00861 tTree->Branch("isoPt", isoPt, "isoPt[iso]/F");
00862 tTree->Branch("isoPhi", isoPhi, "isoPhi[iso]/F");
00863 tTree->Branch("isoEta", isoEta, "isoEta[iso]/F");
00864
00865 tTree->Branch("pixPt", pixPt, "pixPt[pix]/F");
00866 tTree->Branch("pixPhi", pixPhi, "pixPhi[pix]/F");
00867 tTree->Branch("pixEta", pixEta, "pixEta[pix]/F");
00868 }
00869
00870
00871 }
00872
00873
00874
00875
00876 void
00877 ValidIsoTrkCalib::endJob()
00878 {
00879
00880
00881 }
00882
00883
00884 DEFINE_FWK_MODULE(ValidIsoTrkCalib);