#include <TopQuarkAnalysis/Examples/plugins/TopElecAnalyzer.h>
Public Member Functions | |
TopElecAnalyzer (const edm::ParameterSet &) | |
~TopElecAnalyzer () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
Private Attributes | |
TH2D * | Count_Threshold_E |
TH2D * | Count_Threshold_H |
TH2D * | Count_Threshold_T |
TH2D * | CountInSize_E |
TH2D * | CountInSize_H |
TH2D * | CountInSize_T |
TH1F * | denElec_ |
TH2D * | Depo_Threshold_E |
TH2D * | Depo_Threshold_H |
TH2D * | Depo_Threshold_T |
TH2D * | DepoInSize_E |
TH2D * | DepoInSize_H |
TH2D * | DepoInSize_T |
TH1F * | dptElec_ |
edm::InputTag | elecs_ |
TH1F * | enElec_ |
TH1F * | etaElec_ |
TH1F * | genElec_ |
TH1I * | nrElec_ |
TH1F * | phiElec_ |
TH1F * | ptElec_ |
TH1F * | trgElec_ |
Definition at line 14 of file TopElecAnalyzer.h.
TopElecAnalyzer::TopElecAnalyzer | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 8 of file TopElecAnalyzer.cc.
References Count_Threshold_E, Count_Threshold_H, Count_Threshold_T, CountInSize_E, CountInSize_H, CountInSize_T, denElec_, Depo_Threshold_E, Depo_Threshold_H, Depo_Threshold_T, DepoInSize_E, DepoInSize_H, DepoInSize_T, dptElec_, enElec_, etaElec_, genElec_, nrElec_, phiElec_, ptElec_, and trgElec_.
00008 : 00009 elecs_(cfg.getParameter<edm::InputTag>("input")) 00010 { 00011 edm::Service<TFileService> fs; 00012 00013 nrElec_ = fs->make<TH1I>("NrElec", "Nr_{Elec}", 10, 0 , 10 ); 00014 ptElec_ = fs->make<TH1F>("ptElec", "pt_{Elec}", 100, 0.,300.); 00015 enElec_ = fs->make<TH1F>("enElec", "en_{Elec}", 100, 0.,300.); 00016 etaElec_= fs->make<TH1F>("etaElec", "eta_{Elec}", 100, -3., 3.); 00017 phiElec_= fs->make<TH1F>("phiElec", "phi_{Elec}", 100, -5., 5.); 00018 dptElec_= fs->make<TH1F>("dptElec", "dpt_{Elec}", 100, -2., 2.); 00019 denElec_= fs->make<TH1F>("denElec", "den_{Elec}", 100, -2., 2.); 00020 genElec_= fs->make<TH1F>("genElec", "gen_{Elec}", 100, -2., 2.); 00021 trgElec_= fs->make<TH1F>("trgElec", "trg_{Elec}", 100, -1., 1.); 00022 00023 CountInSize_T=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_T","NumDepoInIsoConeVsConeSize_T",30,0.04,0.34,50,0.,50.); 00024 CountInSize_E=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_E","NumDepoInIsoConeVsConeSize_E",30,0.04,0.34,50,0.,50.); 00025 CountInSize_H=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_H","NumDepoInIsoConeVsConeSize_H",30,0.04,0.34,50,0.,50.); 00026 00027 DepoInSize_T =fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_T","AmountDepoInIsoConeVsConeSize_T",30,0.04,0.34,50,0.,50.); 00028 DepoInSize_E =fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_E","AmountDepoInIsoConeVsConeSize_E",30,0.04,0.34,50,0.,50.); 00029 DepoInSize_H =fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_H","AmountDepoInIsoConeVsConeSize_H",30,0.04,0.34,50,0.,50.); 00030 00031 Count_Threshold_T=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_Threshold_T","NumDepoInIsoConeVsConeSize_Threshold_T",30,0.04,0.34,50,0.,50.); 00032 Count_Threshold_E=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_Threshold_E","NumDepoInIsoConeVsConeSize_Threshold_E",30,0.04,0.34,50,0.,50.); 00033 Count_Threshold_H=fs->make<TH2D>("NumDepoInIsoConeVsConeSize_Threshold_H","NumDepoInIsoConeVsConeSize_Threshold_H",30,0.04,0.34,50,0.,50.); 00034 00035 Depo_Threshold_T=fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_Threshold_T","AmountDepoInIsoConeVsConeSize_Threshold_T",30,0.04,0.34,50,0.,50.); 00036 Depo_Threshold_E=fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_Threshold_E","AmountDepoInIsoConeVsConeSize_Threshold_E",30,0.04,0.34,50,0.,50.); 00037 Depo_Threshold_H=fs->make<TH2D>("AmountDepoInIsoConeVsConeSize_Threshold_H","AmountDepoInIsoConeVsConeSize_Threshold_H",30,0.04,0.34,50,0.,50.); 00038 }
TopElecAnalyzer::~TopElecAnalyzer | ( | ) |
void TopElecAnalyzer::analyze | ( | const edm::Event & | evt, | |
const edm::EventSetup & | setup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 45 of file TopElecAnalyzer.cc.
References Count_Threshold_E, Count_Threshold_H, Count_Threshold_T, CountInSize_E, CountInSize_H, CountInSize_T, GenMuonPlsPt100GeV_cfg::cout, deltaR(), denElec_, Depo_Threshold_E, Depo_Threshold_H, Depo_Threshold_T, DepoInSize_E, DepoInSize_H, DepoInSize_T, reco::IsoDeposit::depositAndCountWithin(), dptElec_, elecs_, lat::endl(), enElec_, eta, etaElec_, first, genElec_, edm::Event::getByLabel(), i, edm::Handle< T >::isValid(), nrElec_, phi, phiElec_, ptElec_, radius(), edm::second(), pat::Flags::test(), GeomDetEnumerators::TID, track, pat::Flags::Isolation::Tracker, and trgElec_.
00046 { 00047 edm::Handle<std::vector<pat::Electron> > elecs; 00048 evt.getByLabel(elecs_, elecs); 00049 00050 nrElec_->Fill( elecs->size() ); 00051 for( std::vector<pat::Electron>::const_iterator elec=elecs->begin(); 00052 elec!=elecs->end(); ++elec){ 00053 // -------------------------------------------------- 00054 // fill basic electron kinematics 00055 // -------------------------------------------------- 00056 ptElec_ ->Fill( elec->pt() ); 00057 enElec_ ->Fill( elec->energy()); 00058 etaElec_->Fill( elec->eta() ); 00059 phiElec_->Fill( elec->phi() ); 00060 00061 // -------------------------------------------------- 00062 // request a bunch of pat tags 00063 // -------------------------------------------------- 00064 if(pat::Flags::test(*elec, pat::Flags::Isolation::Tracker)){ 00065 std::cout << "Electron is Tracker Isolated" << std::endl; 00066 } 00067 00068 // -------------------------------------------------- 00069 // check tigger bits 00070 // -------------------------------------------------- 00071 // still needs to get a sensible implementation 00072 // as soon as the trigger bits become available 00073 edm::Handle<edm::TriggerResults> triggerBits; 00074 evt.getByLabel("TriggerResults",triggerBits); 00075 00076 unsigned bit = 0; 00077 if(triggerBits.isValid()){ 00078 std::cout << "Trigger Bit [" << bit << "] = " << triggerBits->at(bit).accept() << std::endl; 00079 } 00080 00081 // -------------------------------------------------- 00082 // get matched trigger primitives and fill best match 00083 // -------------------------------------------------- 00084 int trigIdx =-1 ; 00085 double minDR=-1.; 00086 const std::vector<pat::TriggerPrimitive> trig = elec->triggerMatches(); 00087 for(unsigned idx = 0; idx<trig.size(); ++idx){ 00088 std::cout << "Trigger Match: " << trig[idx].filterName() << std::endl; 00089 double dR=deltaR(trig[idx].eta(), trig[idx].phi(), elec->eta(), elec->phi()); 00090 if( minDR<0 || dR<minDR ){ 00091 minDR=dR; 00092 trigIdx=idx; 00093 } 00094 } 00095 if(trigIdx>=0){ 00096 trgElec_->Fill((trig[trigIdx].pt()-elec->pt())/elec->pt()); 00097 } 00098 00099 // -------------------------------------------------- 00100 // get ElectronId 00101 // -------------------------------------------------- 00102 const std::vector<pat::Electron::IdPair> electronIDs = elec->electronIDs(); 00103 for(unsigned idx=0; idx<electronIDs.size(); ++idx){ 00104 std::cout << ::std::setw( 25 ) << ::std::left << electronIDs[idx].first << ":" << electronIDs[idx].second << std::endl; 00105 } 00106 00107 // -------------------------------------------------- 00108 // get userFunction 00109 // -------------------------------------------------- 00110 //std::cout << std::endl; 00111 //if(elec->userDataObject("relIso")){ 00112 // std::cout << ::std::setw( 12 ) << ::std::left << elec->userDataObject("relIso") << std::endl; 00113 //} 00114 //else{ 00115 // std::cout << ::std::setw( 12 ) << ::std::left << "userData ValueMap is empty..." << std::endl; 00116 //} 00117 00118 // -------------------------------------------------- 00119 // get embedded objects 00120 // -------------------------------------------------- 00121 bool track=true, gsfTrack=true, superClus=true, genMatch=true; 00122 00123 if(!elec->track()){ 00124 track=false; 00125 std::cout << "TrackRef : is not valid" << std::endl; 00126 } 00127 if(!elec->gsfTrack()){ 00128 gsfTrack=false; 00129 std::cout << "gsfTrackRef : is not valid" << std::endl; 00130 } 00131 if(!elec->superCluster()){ 00132 superClus=false; 00133 std::cout << "superCluster : is not valid" << std::endl; 00134 } 00135 if(!elec->genLepton()){ 00136 genMatch=false; 00137 std::cout << "genMatchRef : is not valid" << std::endl; 00138 } 00139 00140 if(gsfTrack && track ){ 00141 dptElec_->Fill( (elec->track()->pt() - elec->gsfTrack()->pt())/elec->gsfTrack()->pt() ); 00142 } 00143 if(gsfTrack && superClus){ 00144 denElec_->Fill( (elec->superCluster()->energy()- elec->gsfTrack()->pt())/elec->gsfTrack()->pt() ); 00145 } 00146 //needs fix in PAT 00147 if(elec->genLepton()){ 00148 genElec_->Fill( (elec->gsfTrack()->pt() - elec->genLepton()->pt())/elec->genLepton()->pt() ); 00149 } 00150 00151 // -------------------------------------------------- 00152 // Isolation in the tracker 00153 // -------------------------------------------------- 00154 00155 const reco::IsoDeposit *TID=0; 00156 TID = elec->trackerIsoDeposit(); 00157 00158 //Isolation Cone coordinates 00159 //double IsoCone_eta=TID->eta(); 00160 //double IsoCone_phi=TID->phi(); 00161 00162 00163 //Veto Cone coordinates 00164 //double VetoCone_eta =TID->veto().vetoDir.eta(); 00165 //double VetoCone_phi =TID->veto().vetoDir.phi(); 00166 //float VetoCone_size=TID->veto().dR; 00167 00168 00169 //get the candidate tag 00170 //float Cand_Tag_T =TID->candEnergy(); 00171 00172 //get the deposit & count within the isolation cone with the different cone size 00173 double radius=0.0; 00174 for(int i=0;i<6;i++) 00175 { 00176 00177 radius+=0.05; 00178 CountInSize_T->Fill(radius,TID->depositAndCountWithin(radius).second); 00179 DepoInSize_T ->Fill(radius,TID->depositAndCountWithin(radius).first); 00180 00181 //If the deposit should exceed some threshold 00182 double Threshold=0.3; 00183 Count_Threshold_T->Fill(radius,TID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).second); 00184 Depo_Threshold_T ->Fill(radius,TID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).first); 00185 00186 } 00187 00188 // -------------------------------------------------- 00189 // Isolation in the ecal & hcal 00190 // -------------------------------------------------- 00191 const reco::IsoDeposit *EID=0; 00192 const reco::IsoDeposit *HID=0; 00193 EID = elec->ecalIsoDeposit(); 00194 HID = elec->hcalIsoDeposit(); 00195 00196 00197 //get the candidate tag 00198 //float Cand_Tag_E =EID->candEnergy(); 00199 //float Cand_Tag_H =HID->candEnergy(); 00200 00201 00202 //get the deposit & count within the isolation cone with the different cone size 00203 for(int i=1;i<30;i++) 00204 { 00205 00206 double radius=i/100; 00207 CountInSize_E->Fill(radius,EID->depositAndCountWithin(radius).second); 00208 DepoInSize_E ->Fill(radius,EID->depositAndCountWithin(radius).first); 00209 00210 CountInSize_H->Fill(radius,HID->depositAndCountWithin(radius).second); 00211 DepoInSize_H ->Fill(radius,HID->depositAndCountWithin(radius).first); 00212 00213 //If the deposit should exceed some threshold 00214 double Threshold=0.3; 00215 Count_Threshold_E->Fill(radius,EID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).second); 00216 Depo_Threshold_E ->Fill(radius,EID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).first); 00217 00218 Count_Threshold_H->Fill(radius,HID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).second); 00219 Depo_Threshold_H ->Fill(radius,HID->depositAndCountWithin(radius,reco::IsoDeposit::Vetos(),Threshold).first); 00220 00221 } 00222 00223 } 00224 }
void TopElecAnalyzer::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
TH2D* TopElecAnalyzer::Count_Threshold_E [private] |
TH2D* TopElecAnalyzer::Count_Threshold_H [private] |
TH2D* TopElecAnalyzer::Count_Threshold_T [private] |
TH2D* TopElecAnalyzer::CountInSize_E [private] |
TH2D* TopElecAnalyzer::CountInSize_H [private] |
TH2D* TopElecAnalyzer::CountInSize_T [private] |
TH1F* TopElecAnalyzer::denElec_ [private] |
TH2D* TopElecAnalyzer::Depo_Threshold_E [private] |
TH2D* TopElecAnalyzer::Depo_Threshold_H [private] |
TH2D* TopElecAnalyzer::Depo_Threshold_T [private] |
TH2D* TopElecAnalyzer::DepoInSize_E [private] |
TH2D* TopElecAnalyzer::DepoInSize_H [private] |
TH2D* TopElecAnalyzer::DepoInSize_T [private] |
TH1F* TopElecAnalyzer::dptElec_ [private] |
edm::InputTag TopElecAnalyzer::elecs_ [private] |
TH1F* TopElecAnalyzer::enElec_ [private] |
TH1F* TopElecAnalyzer::etaElec_ [private] |
TH1F* TopElecAnalyzer::genElec_ [private] |
TH1I* TopElecAnalyzer::nrElec_ [private] |
TH1F* TopElecAnalyzer::phiElec_ [private] |
TH1F* TopElecAnalyzer::ptElec_ [private] |
TH1F* TopElecAnalyzer::trgElec_ [private] |