23 #include "TDirectory.h"
33 using namespace trigger;
44 for(
size_t i=0;
i<vec.size(); ++
i)
61 iEvent.
getByToken(muonTag_, theMuonCollectionHandle);
62 Muons = *theMuonCollectionHandle;
65 int indexOfLeadRecoMuon=-1;
66 double LeadRecoMuonPt=-1, LeadRecoMuonEta=-1, LeadRecoMuonPhi=-1;
67 for(
size_t i=0;
i<Muons.size(); ++
i)
68 if(Muons[
i].
pt() > LeadRecoMuonPt)
70 indexOfLeadRecoMuon =
i;
71 LeadRecoMuonPt = Muons[
i].pt();
72 LeadRecoMuonEta = Muons[
i].eta();
73 LeadRecoMuonPhi = Muons[
i].phi();
80 iEvent.
getByToken(triggerTag_,theTriggerCollectionHandle);
82 int indexOfCollection=-1, idOfLeadMuon=-1, indexOfFilter=-1;
83 double LeadL3MuonPt=-1;
84 vector<int> idsOfFilteredMuons;
85 bool LeadRecoMuonAssociation=
false;
86 const string L3MuonCollection =
"hltL3MuonCandidates::HLT";
89 if(theTriggerCollectionHandle.
isValid())
91 for(
int i=0;
i<theTriggerCollectionHandle->sizeCollections(); ++
i)
93 if(L3MuonCollection.compare(theTriggerCollectionHandle->collectionTag(
i).encode())==0)
95 indexOfCollection =
i;
99 for(
int i=0;
i<theTriggerCollectionHandle->sizeFilters(); ++
i)
101 if(TriggerFilter.compare(theTriggerCollectionHandle->filterTag(
i).encode())==0)
105 const Keys& KEYS(theTriggerCollectionHandle->filterKeys(
i));
106 for(
size_t j=0;
j<KEYS.size(); ++
j)
107 idsOfFilteredMuons.push_back(KEYS[
j]);
111 if(indexOfCollection!=-1 && indexOfFilter!=-1)
113 if(indexOfCollection==0)
116 firstMuon = theTriggerCollectionHandle->collectionKey(indexOfCollection-1);
117 lastMuon = theTriggerCollectionHandle->collectionKey(indexOfCollection)-1;
118 for(
int i=firstMuon;
i<=lastMuon; ++
i)
121 if(TO.
pt()>LeadL3MuonPt &&
find(idsOfFilteredMuons,i))
123 LeadL3MuonPt = TO.
pt();
127 LeadRecoMuonAssociation=
true;
135 LeadL3MuonPt = TO.
pt();
146 if(indexOfLeadRecoMuon!=-1)
149 hLeadRecoMuonPt_1_ByEvent->Fill(LeadRecoMuonPt);
151 hLeadRecoMuonPt_2_ByEvent->Fill(LeadRecoMuonPt);
152 else if(
std::abs(LeadRecoMuonEta)>2.1)
153 hLeadRecoMuonPt_3_ByEvent->Fill(LeadRecoMuonPt);
154 if(LeadRecoMuonPt>=0)
155 hLeadRecoMuonEta_1_ByEvent->Fill(LeadRecoMuonEta);
156 if(LeadRecoMuonPt>=10)
157 hLeadRecoMuonEta_2_ByEvent->Fill(LeadRecoMuonEta);
158 if(LeadRecoMuonPt>=20)
159 hLeadRecoMuonEta_3_ByEvent->Fill(LeadRecoMuonEta);
161 if(LeadRecoMuonAssociation)
164 hLeadAssocRecoMuonPt_1_ByEvent->Fill(LeadRecoMuonPt);
166 hLeadAssocRecoMuonPt_2_ByEvent->Fill(LeadRecoMuonPt);
167 else if(
std::abs(LeadRecoMuonEta)>2.1)
168 hLeadAssocRecoMuonPt_3_ByEvent->Fill(LeadRecoMuonPt);
169 if(LeadRecoMuonPt>=0)
170 hLeadAssocRecoMuonEta_1_ByEvent->Fill(LeadRecoMuonEta);
171 if(LeadRecoMuonPt>=10)
172 hLeadAssocRecoMuonEta_2_ByEvent->Fill(LeadRecoMuonEta);
173 if(LeadRecoMuonPt>=20)
174 hLeadAssocRecoMuonEta_3_ByEvent->Fill(LeadRecoMuonEta);
181 for(
size_t i=0;
i<Muons.size(); ++
i)
183 double RecoMuonPt=Muons[
i].pt(), RecoMuonEta=Muons[
i].eta();
185 hRecoMuonPt_1_ByMuon->Fill(RecoMuonPt);
187 hRecoMuonPt_2_ByMuon->Fill(RecoMuonPt);
189 hRecoMuonPt_3_ByMuon->Fill(RecoMuonPt);
191 hRecoMuonEta_1_ByMuon->Fill(RecoMuonEta);
193 hRecoMuonEta_2_ByMuon->Fill(RecoMuonEta);
195 hRecoMuonEta_3_ByMuon->Fill(RecoMuonEta);
197 if(lastMuon-firstMuon+1 > 0)
199 for(
int j=firstMuon;
j<=lastMuon; ++
j)
204 RecoMuonPt=Muons[
i].pt();
205 RecoMuonEta=Muons[
i].eta();
207 hAssocRecoMuonPt_1_ByMuon->Fill(RecoMuonPt);
209 hAssocRecoMuonPt_2_ByMuon->Fill(RecoMuonPt);
211 hAssocRecoMuonPt_3_ByMuon->Fill(RecoMuonPt);
213 hAssocRecoMuonEta_1_ByMuon->Fill(RecoMuonEta);
215 hAssocRecoMuonEta_2_ByMuon->Fill(RecoMuonEta);
217 hAssocRecoMuonEta_3_ByMuon->Fill(RecoMuonEta);
249 int pt_bins=100, eta_bins=100;
250 double pt_floor=0., pt_ceiling = 200., eta_floor=-3.5, eta_ceiling=3.5;
252 dbe_->setCurrentFolder(subDir +
"/By_Event");
253 hLeadRecoMuonPt_1_ByEvent = dbe_->book1D(
"LeadRecoMuonPt_1_ByEvent" ,
"Lead Reco Muon P_{t}, |Eta|<1.2, By Event", pt_bins, pt_floor, pt_ceiling);
254 hLeadRecoMuonEta_1_ByEvent= dbe_->book1D(
"LeadRecoMuonEta_1_ByEvent",
"Lead Reco Muon Eta, P_{t}>0, By Event", eta_bins, eta_floor,eta_ceiling);
255 hLeadRecoMuonPt_2_ByEvent = dbe_->book1D(
"LeadRecoMuonPt_2_ByEvent" ,
"Lead Reco Muon P_{t}, 1.2<|Eta|<2.1, By Event", pt_bins, pt_floor, pt_ceiling);
256 hLeadRecoMuonEta_2_ByEvent= dbe_->book1D(
"LeadRecoMuonEta_2_ByEvent",
"Lead Reco Muon Eta, P_{t}>10, By Event", eta_bins, eta_floor,eta_ceiling);
257 hLeadRecoMuonPt_3_ByEvent = dbe_->book1D(
"LeadRecoMuonPt_3_ByEvent" ,
"Lead Reco Muon P_{t}, |Eta|>2.1, By Event", pt_bins, pt_floor, pt_ceiling);
258 hLeadRecoMuonEta_3_ByEvent= dbe_->book1D(
"LeadRecoMuonEta_3_ByEvent",
"Lead Reco Muon Eta, P_{t}>20, By Event", eta_bins, eta_floor,eta_ceiling);
259 hLeadAssocRecoMuonPt_1_ByEvent = dbe_->book1D(
"LeadAssocRecoMuonPt_1_ByEvent" ,
"Lead Assoc Reco Muon P_{t}, |Eta|<1.2, By Event", pt_bins, pt_floor, pt_ceiling);
260 hLeadAssocRecoMuonEta_1_ByEvent= dbe_->book1D(
"LeadAssocRecoMuonEta_1_ByEvent",
"Lead Assoc Muon Eta, P_{t}>0, By Event", eta_bins, eta_floor,eta_ceiling);
261 hLeadAssocRecoMuonPt_2_ByEvent = dbe_->book1D(
"LeadAssocRecoMuonPt_2_ByEvent" ,
"Lead Assoc Reco Muon P_{t}, 1.2<|Eta|<2.1, By Event", pt_bins, pt_floor, pt_ceiling);
262 hLeadAssocRecoMuonEta_2_ByEvent= dbe_->book1D(
"LeadAssocRecoMuonEta_2_ByEvent",
"Lead Assoc Muon Eta, P_{t}>10, By Event", eta_bins, eta_floor,eta_ceiling);
263 hLeadAssocRecoMuonPt_3_ByEvent = dbe_->book1D(
"LeadAssocRecoMuonPt_3_ByEvent" ,
"Lead Assoc Reco Muon P_{t}, |Eta|>2.1, By Event", pt_bins, pt_floor, pt_ceiling);
264 hLeadAssocRecoMuonEta_3_ByEvent= dbe_->book1D(
"LeadAssocRecoMuonEta_3_ByEvent",
"Lead Assoc Muon Eta, P_{t}>20, By Event", eta_bins, eta_floor,eta_ceiling);
266 dbe_->setCurrentFolder(subDir +
"/By_Muon");
267 hRecoMuonPt_1_ByMuon = dbe_->book1D(
"RecoMuonPt_1_ByMuon" ,
"Reco Muon P_{t}, |Eta|<1.2, By Muon", pt_bins, pt_floor, pt_ceiling);
268 hRecoMuonEta_1_ByMuon= dbe_->book1D(
"RecoMuonEta_1_ByMuon",
"Reco Muon Eta, P_{t}>0, By Muon", eta_bins, eta_floor,eta_ceiling);
269 hRecoMuonPt_2_ByMuon = dbe_->book1D(
"RecoMuonPt_2_ByMuon" ,
"Reco Muon P_{t}, 1.2<|Eta|<2.1, By Muon", pt_bins, pt_floor, pt_ceiling);
270 hRecoMuonEta_2_ByMuon= dbe_->book1D(
"RecoMuonEta_2_ByMuon",
"Reco Muon Eta, P_{t}>10, By Muon", eta_bins, eta_floor,eta_ceiling);
271 hRecoMuonPt_3_ByMuon = dbe_->book1D(
"RecoMuonPt_3_ByMuon" ,
"Reco Muon P_{t}, |Eta|>2.1, By Muon", pt_bins, pt_floor, pt_ceiling);
272 hRecoMuonEta_3_ByMuon= dbe_->book1D(
"RecoMuonEta_3_ByMuon",
"Reco Muon Eta, P_{t}>20, By Muon", eta_bins, eta_floor,eta_ceiling);
273 hAssocRecoMuonPt_1_ByMuon = dbe_->book1D(
"AssocRecoMuonPt_1_ByMuon" ,
"Assoc Reco Muon P_{t}, |Eta|<1.2, By Muon", pt_bins, pt_floor, pt_ceiling);
274 hAssocRecoMuonEta_1_ByMuon= dbe_->book1D(
"AssocRecoMuonEta_1_ByMuon",
"Assoc Muon Eta, P_{t}>0, By Muon", eta_bins, eta_floor,eta_ceiling);
275 hAssocRecoMuonPt_2_ByMuon = dbe_->book1D(
"AssocRecoMuonPt_2_ByMuon" ,
"Assoc Reco Muon P_{t}, 1.2<|Eta|<2.1, By Muon", pt_bins, pt_floor, pt_ceiling);
276 hAssocRecoMuonEta_2_ByMuon= dbe_->book1D(
"AssocRecoMuonEta_2_ByMuon",
"Assoc Muon Eta, P_{t}>10, By Muon", eta_bins, eta_floor,eta_ceiling);
277 hAssocRecoMuonPt_3_ByMuon = dbe_->book1D(
"AssocRecoMuonPt_3_ByMuon" ,
"Assoc Reco Muon P_{t}, |Eta|>2.1, By Muon", pt_bins, pt_floor, pt_ceiling);
278 hAssocRecoMuonEta_3_ByMuon= dbe_->book1D(
"AssocRecoMuonEta_3_ByMuon",
"Assoc Muon Eta, P_{t}>20, By Muon", eta_bins, eta_floor,eta_ceiling);
The single EDProduct to be saved for each event (AOD case)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool find(const std::vector< int > &, int)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void FillPlots(const edm::Event &, const edm::EventSetup &)
std::vector< Muon > MuonCollection
collection of Muon objects
Single trigger physics object (e.g., an isolated muon)
Abs< T >::type abs(const T &t)
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
std::vector< size_type > Keys
MuonAnalyzerSBSM(const edm::InputTag &, const edm::InputTag &, edm::ConsumesCollector &&iC)
void InitializePlots(DQMStore *, const std::string)
Power< A, B >::type pow(const A &a, const B &b)