00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025
00026 #include "FWCore/Framework/interface/ESHandle.h"
00027
00028 #include "FWCore/Framework/interface/Frameworkfwd.h"
00029 #include "FWCore/Framework/interface/EDAnalyzer.h"
00030
00031 #include "FWCore/Framework/interface/Event.h"
00032 #include "FWCore/Framework/interface/MakerMacros.h"
00033
00034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00035
00036 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00037 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00038 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00039
00040 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00041 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00042 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00043 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00044 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00045
00046 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00047 #include "DataFormats/TrackReco/interface/Track.h"
00048
00049 #include "CondFormats/L1TObjects/interface/L1GtPrescaleFactors.h"
00050 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsAlgoTrigRcd.h"
00051 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsTechTrigRcd.h"
00052
00053 #include "DQMServices/Core/interface/DQMStore.h"
00054 #include "DQMServices/Core/interface/MonitorElement.h"
00055 #include "FWCore/ServiceRegistry/interface/Service.h"
00056
00057 #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
00058 #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"
00059
00060 #include "DataFormats/Math/interface/deltaR.h"
00061
00062 #include <fstream>
00063
00064 #include "TH1F.h"
00065
00066 class DQMHcalIsoTrackAlCaReco : public edm::EDAnalyzer {
00067 public:
00068 explicit DQMHcalIsoTrackAlCaReco(const edm::ParameterSet&);
00069 ~DQMHcalIsoTrackAlCaReco();
00070
00071
00072 private:
00073
00074 DQMStore* dbe_;
00075
00076 virtual void beginJob() ;
00077 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00078 virtual void endJob() ;
00079
00080 std::string folderName_;
00081 bool saveToFile_;
00082 std::string outRootFileName_;
00083 edm::InputTag hltEventTag_;
00084 std::string l1FilterTag_;
00085 std::vector<std::string> hltFilterTag_;
00086 edm::InputTag arITrLabel_;
00087 edm::InputTag recoTrLabel_;
00088 double pThr_;
00089 double heLow_;
00090 double heUp_;
00091
00092 MonitorElement* hl3Pt;
00093 MonitorElement* hl3eta;
00094 MonitorElement* hl3AbsEta;
00095 MonitorElement* hl3phi;
00096 MonitorElement* hOffL3TrackMatch;
00097 MonitorElement* hOffL3TrackPtRat;
00098
00099 MonitorElement* hOffP_0005;
00100 MonitorElement* hOffP_0510;
00101 MonitorElement* hOffP_1015;
00102 MonitorElement* hOffP_1520;
00103
00104 MonitorElement* hOffP;
00105
00106 MonitorElement* hTracksSumP;
00107 MonitorElement* hTracksMaxP;
00108
00109 MonitorElement* hDeposEcalInnerEB;
00110 MonitorElement* hDeposEcalOuterEB;
00111 MonitorElement* hDeposEcalInnerEE;
00112 MonitorElement* hDeposEcalOuterEE;
00113
00114 MonitorElement* hL1jetMatch;
00115
00116 MonitorElement* hOffEtaFP;
00117 MonitorElement* hOffAbsEta;
00118 MonitorElement* hOffPhiFP;
00119
00120 MonitorElement* hOffEta;
00121 MonitorElement* hOffPhi;
00122
00123 MonitorElement* hOccupancyFull;
00124 MonitorElement* hOccupancyHighEn;
00125
00126 MonitorElement* hPurityEta;
00127 MonitorElement* hPurityPhi;
00128
00129 int nTotal;
00130 int nHLTL3accepts;
00131 int nameLength_;
00132 int l1nameLength_;
00133
00134 std::pair<int, int> towerIndex(double eta, double phi);
00135
00136 };
00137
00138 std::pair<int,int> DQMHcalIsoTrackAlCaReco::towerIndex(double eta, double phi)
00139 {
00140 int ieta = 0;
00141 int iphi = 0;
00142 for (int i=1; i<21; i++)
00143 {
00144 if (fabs(eta)<=(i*0.087)&&fabs(eta)>(i-1)*0.087) ieta=int(fabs(eta)/eta)*i;
00145 }
00146 if (fabs(eta)>1.740&&fabs(eta)<=1.830) ieta=int(fabs(eta)/eta)*21;
00147 if (fabs(eta)>1.830&&fabs(eta)<=1.930) ieta=int(fabs(eta)/eta)*22;
00148 if (fabs(eta)>1.930&&fabs(eta)<=2.043) ieta=int(fabs(eta)/eta)*23;
00149 if (fabs(eta)>2.043&&fabs(eta)<=2.172) ieta=int(fabs(eta)/eta)*24;
00150
00151 double delta=phi+0.174532925;
00152 if (delta<0) delta=delta+2*acos(-1);
00153 if (fabs(eta)<1.740)
00154 {
00155 for (int i=0; i<72; i++)
00156 {
00157 if (delta<(i+1)*0.087266462&&delta>i*0.087266462) iphi=i;
00158 }
00159 }
00160 else
00161 {
00162 for (int i=0; i<36; i++)
00163 {
00164 if (delta<2*(i+1)*0.087266462&&delta>2*i*0.087266462) iphi=2*i;
00165 }
00166 }
00167
00168 return std::pair<int,int>(ieta,iphi);
00169 }
00170
00171
00172 DQMHcalIsoTrackAlCaReco::DQMHcalIsoTrackAlCaReco(const edm::ParameterSet& iConfig)
00173
00174 {
00175 folderName_ = iConfig.getParameter<std::string>("folderName");
00176 saveToFile_=iConfig.getParameter<bool>("saveToFile");
00177 outRootFileName_=iConfig.getParameter<std::string>("outputRootFileName");
00178 hltEventTag_=iConfig.getParameter<edm::InputTag>("hltTriggerEventLabel");
00179 l1FilterTag_=iConfig.getParameter<std::string>("l1FilterLabel");
00180 hltFilterTag_=iConfig.getParameter<std::vector<std::string> >("hltL3FilterLabels");
00181 nameLength_=iConfig.getUntrackedParameter<int>("filterNameLength",27);
00182 l1nameLength_=iConfig.getUntrackedParameter<int>("l1filterNameLength",11);
00183 arITrLabel_=iConfig.getParameter<edm::InputTag>("alcarecoIsoTracksLabel");
00184 recoTrLabel_=iConfig.getParameter<edm::InputTag>("recoTracksLabel");
00185 pThr_=iConfig.getUntrackedParameter<double>("pThrL3",0);
00186 heLow_=iConfig.getUntrackedParameter<double>("lowerHighEnergyCut",40);
00187 heUp_=iConfig.getUntrackedParameter<double>("upperHighEnergyCut",60);
00188
00189 nTotal=0;
00190 nHLTL3accepts=0;
00191 }
00192
00193 DQMHcalIsoTrackAlCaReco::~DQMHcalIsoTrackAlCaReco()
00194 {}
00195
00196 void DQMHcalIsoTrackAlCaReco::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00197 {
00198
00199 nTotal++;
00200
00201 edm::Handle<trigger::TriggerEvent> trEv;
00202 iEvent.getByLabel(hltEventTag_,trEv);
00203
00204 edm::Handle<reco::IsolatedPixelTrackCandidateCollection> recoIsoTracks;
00205 iEvent.getByLabel(arITrLabel_,recoIsoTracks);
00206
00207 const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
00208
00209 const trigger::size_type nFilt(trEv->sizeFilters());
00210
00211
00212 trigger::Keys KEYSl1;
00213 for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
00214 {
00215 if ((trEv->filterTag(iFilt).label()).substr(0,l1nameLength_)==l1FilterTag_) KEYSl1=trEv->filterKeys(iFilt);
00216 }
00217
00218 trigger::size_type nRegl1=KEYSl1.size();
00219
00220 double etaTrigl1=-10000;
00221 double phiTrigl1=-10000;
00222 double ptMaxl1=0;
00223 for (trigger::size_type iReg=0; iReg<nRegl1; iReg++)
00224 {
00225 const trigger::TriggerObject& TObj(TOCol[KEYSl1[iReg]]);
00226 if (TObj.pt()>ptMaxl1)
00227 {
00228 etaTrigl1=TObj.eta();
00229 phiTrigl1=TObj.phi();
00230 ptMaxl1=TObj.pt();
00231 }
00232 }
00233
00234
00235 std::vector<double> trigEta;
00236 std::vector<double> trigPhi;
00237
00238 trigger::Keys KEYS;
00239 for (unsigned l=0; l<hltFilterTag_.size(); l++)
00240 {
00241 for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
00242 {
00243 if ((trEv->filterTag(iFilt).label()).substr(0,nameLength_)==hltFilterTag_[l])
00244 {
00245 KEYS=trEv->filterKeys(iFilt);
00246 }
00247 }
00248
00249 trigger::size_type nReg=KEYS.size();
00250
00251
00252 for (trigger::size_type iReg=0; iReg<nReg; iReg++)
00253 {
00254 const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
00255 if (TObj.p()<pThr_) continue;
00256 hl3eta->Fill(TObj.eta(),1);
00257 hl3AbsEta->Fill(fabs(TObj.eta()),1);
00258 hl3phi->Fill(TObj.phi(),1);
00259
00260 if (recoIsoTracks->size()>0)
00261 {
00262 double minRecoL3dist=1000;
00263 reco::IsolatedPixelTrackCandidateCollection::const_iterator mrtr;
00264 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator rtrit=recoIsoTracks->begin(); rtrit!=recoIsoTracks->end(); rtrit++)
00265 {
00266 double R=deltaR(rtrit->eta(),rtrit->phi(),TObj.eta(),TObj.phi());
00267 if (R<minRecoL3dist)
00268 {
00269 mrtr=rtrit;
00270 minRecoL3dist=R;
00271 }
00272 }
00273 hOffL3TrackMatch->Fill(minRecoL3dist,1);
00274 if (minRecoL3dist<0.02) hOffL3TrackPtRat->Fill(TObj.pt()/mrtr->pt(),1);
00275 }
00276
00277 hl3Pt->Fill(TObj.pt(),1);
00278 trigEta.push_back(TObj.eta());
00279 trigPhi.push_back(TObj.phi());
00280 }
00281 }
00282
00283
00284 for (reco::IsolatedPixelTrackCandidateCollection::const_iterator itr=recoIsoTracks->begin(); itr!=recoIsoTracks->end(); itr++)
00285 {
00286 bool match=false;
00287 for (unsigned int l=0; l<trigEta.size(); l++)
00288 {
00289 if (deltaR(itr->eta(),itr->phi(),trigEta[l],trigPhi[l])<0.02) match=true;
00290 }
00291 if (match)
00292 {
00293 hOffEtaFP->Fill(itr->eta(),1);
00294 hOffPhiFP->Fill(itr->phi(),1);
00295 }
00296
00297 hOffEta->Fill(itr->eta(),1);
00298 hOffPhi->Fill(itr->phi(),1);
00299
00300 hOffAbsEta->Fill(fabs(itr->eta()),1);
00301
00302 hL1jetMatch->Fill(deltaR(itr->eta(), itr->phi(), etaTrigl1, phiTrigl1),1);
00303
00304 if (fabs(itr->eta())<1.479)
00305 {
00306 hDeposEcalInnerEB->Fill(itr->energyIn(),1);
00307 hDeposEcalOuterEB->Fill(itr->energyOut(),1);
00308 }
00309 else
00310 {
00311 hDeposEcalInnerEE->Fill(itr->energyIn(),1);
00312 hDeposEcalOuterEE->Fill(itr->energyOut(),1);
00313 }
00314
00315 hTracksSumP->Fill(itr->sumPtPxl(),1);
00316 if (itr->maxPtPxl()==-10) hTracksMaxP->Fill(0,1);
00317 else hTracksMaxP->Fill(itr->maxPtPxl(),1);
00318
00319 if (fabs(itr->eta())<0.5) hOffP_0005->Fill(itr->p(),1);
00320 if (fabs(itr->eta())>0.5&&fabs(itr->eta())<1.0) hOffP_0510->Fill(itr->p(),1);
00321 if (fabs(itr->eta())>1.0&&fabs(itr->eta())<1.5) hOffP_1015->Fill(itr->p(),1);
00322 if (fabs(itr->eta())<1.5&&fabs(itr->eta())<2.0) hOffP_1520->Fill(itr->p(),1);
00323
00324 hOffP->Fill(itr->p(),1);
00325
00326 std::pair<int,int> TI=towerIndex(itr->eta(),itr->phi());
00327 hOccupancyFull->Fill(TI.first,TI.second,1);
00328 if (itr->p()>heLow_&&itr->p()<heUp_) hOccupancyHighEn->Fill(TI.first,TI.second,1);
00329 }
00330
00331 }
00332
00333 void DQMHcalIsoTrackAlCaReco::beginJob()
00334 {
00335 dbe_ = edm::Service<DQMStore>().operator->();
00336 dbe_->setCurrentFolder(folderName_);
00337
00338 hl3Pt=dbe_->book1D("hl3Pt","pT of hlt L3 objects",1000,0,1000);
00339 hl3Pt->setAxisTitle("pT(GeV)",1);
00340
00341 hl3eta=dbe_->book1D("hl3eta","eta of hlt L3 objects",16,-2,2);
00342 hl3eta->setAxisTitle("eta",1);
00343 hl3AbsEta=dbe_->book1D("hl3AbsEta","|eta| of hlt L3 objects",8,0,2);
00344 hl3AbsEta->setAxisTitle("eta",1);
00345 hl3phi=dbe_->book1D("hl3phi","phi of hlt L3 objects",16,-3.2,3.2);
00346 hl3phi->setAxisTitle("phi",1);
00347 hOffEta=dbe_->book1D("hOffEta","eta of alcareco objects",100,-2,2);
00348 hOffEta->setAxisTitle("eta",1);
00349 hOffPhi=dbe_->book1D("hOffPhi","phi of alcareco objects",100,-3.2,3.2);
00350 hOffPhi->setAxisTitle("phi",1);
00351 hOffP=dbe_->book1D("hOffP","p of alcareco objects",1000,0,1000);
00352 hOffP->setAxisTitle("E(GeV)",1);
00353 hOffP_0005=dbe_->book1D("hOffP_0005","p of alcareco objects, |eta|<0.5",1000,0,1000);
00354 hOffP_0005->setAxisTitle("E(GeV)",1);
00355 hOffP_0510=dbe_->book1D("hOffP_0510","p of alcareco objects, 0.5<|eta|<1.0",1000,0,1000);
00356 hOffP_0510->setAxisTitle("E(GeV)",1);
00357 hOffP_1015=dbe_->book1D("hOffP_1015","p of alcareco objects, 1.0<|eta|<1.5",1000,0,1000);
00358 hOffP_1015->setAxisTitle("E(GeV)",1);
00359 hOffP_1520=dbe_->book1D("hOffP_1520","p of alcareco objects, 1.5<|eta|<2.0",1000,0,1000);
00360 hOffP_1520->setAxisTitle("E(GeV)",1);
00361 hOffEtaFP=dbe_->book1D("hOffEtaFP","eta of alcareco objects, FP",16,-2,2);
00362 hOffEtaFP->setAxisTitle("eta",1);
00363 hOffAbsEta=dbe_->book1D("hOffAbsEta","|eta| of alcareco objects",8,0,2);
00364 hOffAbsEta->setAxisTitle("|eta|",1);
00365 hOffPhiFP=dbe_->book1D("hOffPhiFP","phi of alcareco objects, FP",16,-3.2,3.2);
00366 hOffPhiFP->setAxisTitle("phi",1);
00367 hTracksSumP=dbe_->book1D("hTracksSumP","summary p of tracks in the isolation cone",100,0,20);
00368 hTracksSumP->setAxisTitle("E(GeV)");
00369 hTracksMaxP=dbe_->book1D("hTracksMaxP","maximum p among tracks in the isolation cone",100,0,20);
00370 hTracksMaxP->setAxisTitle("E(GeV)");
00371 hDeposEcalInnerEE=dbe_->book1D("hDeposEcalInnerEE","ecal energy deposition in inner cone around track, EE",20,0,20);
00372 hDeposEcalInnerEE->setAxisTitle("E(GeV)");
00373 hDeposEcalOuterEE=dbe_->book1D("hDeposEcalOuterEE","ecal energy deposition in outer cone around track, EE",100,0,100);
00374 hDeposEcalInnerEB=dbe_->book1D("hDeposEcalInnerEB","ecal energy deposition in inner cone around track, EB",20,0,20);
00375 hDeposEcalInnerEB->setAxisTitle("E(GeV)");
00376 hDeposEcalOuterEB=dbe_->book1D("hDeposEcalOuterEB","ecal energy deposition in outer cone around track, EB",100,0,100);
00377 hDeposEcalOuterEB->setAxisTitle("E(GeV)");
00378 hOccupancyFull=dbe_->book2D("hOccupancyFull","number of tracks per tower, full energy range",48,-25,25,73,0,73);
00379 hOccupancyFull->setAxisTitle("ieta",1);
00380 hOccupancyFull->setAxisTitle("iphi",2);
00381 hOccupancyFull->getTH2F()->SetOption("colz");
00382 hOccupancyFull->getTH2F()->SetStats(kFALSE);
00383 hOccupancyHighEn=dbe_->book2D("hOccupancyHighEn","number of tracks per tower, high energy tracks",48,-25,25,73,0,73);
00384 hOccupancyHighEn->setAxisTitle("ieta",1);
00385 hOccupancyHighEn->setAxisTitle("iphi",2);
00386 hOccupancyHighEn->getTH2F()->SetOption("colz");
00387 hOccupancyHighEn->getTH2F()->SetStats(kFALSE);
00388 hOffL3TrackMatch=dbe_->book1D("hOffL3TrackMatch","Distance from L3 object to offline track",40,0,0.2);
00389 hOffL3TrackMatch->setAxisTitle("R(eta,phi)",1);
00390 hOffL3TrackPtRat=dbe_->book1D("hOffL3TrackPtRat","Ratio of pT: L3/offline",500,0,3);
00391 hOffL3TrackPtRat->setAxisTitle("ratio L3/offline",1);
00392
00393 hL1jetMatch=dbe_->book1D("hL1jetMatch","dR(eta,phi) from leading L1 jet to offline track",100,0,5);
00394
00395 }
00396
00397 void DQMHcalIsoTrackAlCaReco::endJob() {
00398
00399 if(dbe_)
00400 {
00401 if (saveToFile_) dbe_->save(outRootFileName_);
00402 }
00403 }
00404