ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/mstein/triggerStudy/triggerStudy.C
(Generate patch)

Comparing UserCode/mstein/triggerStudy/triggerStudy.C (file contents):
Revision 1.5 by mstein, Thu Dec 6 12:27:27 2012 UTC vs.
Revision 1.6 by mstein, Mon Dec 17 10:44:45 2012 UTC

# Line 64 | Line 64 | struct eventInfo{
64   // void init(TString inputFileName);
65   void handleTriggerMatchingInfo(eventInfo& evt);
66   void initBranches(TTree *tree, eventInfo &event);
67 < void investigateTriggerFilterMu(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName);
67 > void investigateTriggerFilterLep(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName, TString label);
68   void Loop(TString inputFileName, TString outputFileName);
69   void makeEfficiencyPlots(map<TString, plotMaker> &plot);
70   void plotHistograms(eventInfo& evt, map<TString, plotMaker> &plot);
# Line 88 | Line 88 | const Double_t upEta  = 2.5;
88   const Int_t    binPU = 64;
89   const Double_t lowPU = 0.;
90   const Double_t upPU  = 64.;
91 + //----------------------------------------
92 + const Int_t    binMinv = 40;
93 + const Double_t lowMinv = 50.;
94 + const Double_t upMinv  = 130.;
95  
96  
97   //================================================================================= triggerStudy
# Line 135 | Line 139 | void plotHistograms(eventInfo& evt, map<
139    plot["event"].addh1d("muMultiplicity", "muMultiplicity", "muon multiplicity", "events", 5, -0.5, 4.5, evt.muonP4->size(), evt.Weight);
140    plot["event"].addh1d("elMultiplicity", "elMultiplicity", "electron multiplicity", "events", 5, -0.5, 4.5, evt.electronP4->size(), evt.Weight);
141    plot["event"].addh1d("jetMultiplicity", "jetMultiplicity", "jet multiplicity", "events", 10, -0.5, 9.5, evt.jetP4->size(), evt.Weight);
142 +  if(evt.electronP4->size()==2){
143 +    Double_t minv = (evt.electronP4->at(0) + evt.electronP4->at(1)).mass();
144 +    plot["event"].addh1d("Minv", "Minv", "M_{inv}  [GeV/c^{2}]", "events", binMinv, lowMinv, upMinv, minv, evt.Weight);
145 +  }
146  
147 +  
148    for(Int_t i=0,N=triggerFilterToCheckMu.size(); i<N; ++i){
149 <    investigateTriggerFilterMu(evt, plot, triggerFilterToCheckMu.at(i));
149 >    investigateTriggerFilterLep(evt, plot, triggerFilterToCheckMu.at(i), "muon");
150 >  }
151 >  for(Int_t i=0,N=triggerFilterToCheckEl.size(); i<N; ++i){
152 >    investigateTriggerFilterLep(evt, plot, triggerFilterToCheckEl.at(i), "electron");
153    }
142 //   for(Int_t i=0,N=triggerFilterToCheckEl.size(); i<N; ++i){
143 //     investigateTriggerFilterEl(evt, plot, triggerFilterToCheckEl.at(i));
144 //   }
154   }
155  
156  
# Line 149 | Line 158 | void plotHistograms(eventInfo& evt, map<
158   //check, if the positive lepton can be matched to the trigger filter
159   //if yes, take this lepton as Tag
160   //then probe the other lepton
161 < void investigateTriggerFilterMu(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName, TString label){
161 > void investigateTriggerFilterLep(eventInfo& evt, map<TString, plotMaker> &plot, TString filterName, TString label){
162 >  vector<LorentzM>* lepP4;
163 >  vector<int>* lepCharge;
164 >  vector<vector<TString> > triggerFilterLep;
165 >  //--------------------------------------------------- chose input variables according to label
166 >  if(label = "muon"){
167 >    lepP4            = (evt.muonP4);
168 >    lepCharge        = (evt.muonCharge);
169 >    triggerFilterLep = (evt.triggerFilterMu);
170 >  }
171 >  else if(label = "electron"){
172 >    lepP4            = (evt.electronP4);
173 >    lepCharge        = (evt.electronCharge);
174 >    triggerFilterLep = (evt.triggerFilterEl);
175 >  }
176 >  else{
177 >    cout<<"WARNING: Label for 'investigateTriggerFilter' is neither 'muon' nor 'electron'!"<<endl;
178 >    cout<<"label = " << label << endl;
179 >    return;
180 >  }
181    //--------------------------------------------------- do some consistency check - just to be sure
182 <  if(evt.muonP4->size() != 2){
183 <    cout<<"WARNING: The size of the muon vector is NOT two!"<<endl;
184 <    cout<<"evt.muonP4->size()          = " << evt.muonP4->size() << endl;
182 >  if(lepP4->size() != 2){
183 >    cout<<"WARNING: The size of the " << label << "vector is NOT two!"<<endl;
184 >    cout<<"lepP4->size() = " << lepP4->size() << endl;
185      return;
186    }  
187 <  if(evt.muonP4->size() != evt.triggerFilterMu.size()){
188 <    cout<<"WARNING: The size of the muon vector and Matching-info vector is different!"<<endl;
189 <    cout<<"evt.muonP4->size()         = " << evt.muonP4->size() << endl;
190 <    cout<<"evt.triggerFilterMu.size() = " << evt.triggerFilterMu.size() << endl;
187 >  if(lepP4->size() != triggerFilterLep.size()){
188 >    cout<<"WARNING: The size of the "<< label << " vector and Matching-info vector is different!"<<endl;
189 >    cout<<"lepP4->size()         = " << lepP4->size() << endl;
190 >    cout<<"triggerFilterLep.size() = " << triggerFilterLep.size() << endl;
191      return;
192    }
193 <  if(evt.muonP4->size() != evt.muonCharge->size()){
194 <    cout<<"WARNING: The size of the muon vector and muon-charge vector is different!"<<endl;
195 <    cout<<"evt.muonP4->size()     = " << evt.muonP4->size() << endl;
196 <    cout<<"evt.muonCharge->size() = " << evt.muonCharge->size() << endl;
193 >  if(lepP4->size() != lepCharge->size()){
194 >    cout<<"WARNING: The size of the "<< label << "muon vector and muon-charge vector is different!"<<endl;
195 >    cout<<"lepP4->size()     = " << lepP4->size() << endl;
196 >    cout<<"lepCharge->size() = " << lepCharge->size() << endl;
197      return;
198    }
199   //   if(evt.electronP4->size() != evt.triggerFilterEl.size()){
# Line 183 | Line 211 | void investigateTriggerFilterMu(eventInf
211    //--------------------------------------------------- check which lepton has positive and which negative charge
212    Int_t index_pos = 0;
213    Int_t index_neg = 1;  
214 <  if(evt.muonCharge->at(0)==-1){
214 >  if(lepCharge->at(0)==-1){
215      index_pos = 0;
216      index_pos = 1;
217    }
218    //--------------------------------------------------- check which lepton has been matched to the trigger filter
219    vector<bool> matched;
220 <  for(Int_t i=0,N=evt.muonP4->size(); i<N; ++i){
220 >  for(Int_t i=0,N=lepP4->size(); i<N; ++i){
221      matched.push_back(false);
222 <    for(Int_t j=0,M=evt.triggerFilterMu.at(i).size(); j<M; ++j){
223 <      if(filterName == evt.triggerFilterMu.at(i).at(j)){
222 >    for(Int_t j=0,M=triggerFilterLep.at(i).size(); j<M; ++j){
223 >      if(filterName == triggerFilterLep.at(i).at(j)){
224          matched.back() = true;
225          break;
226        }
# Line 205 | Line 233 | void investigateTriggerFilterMu(eventInf
233    
234    //if the positive lepton IS matched => plot Tag and Probe, and passed and failed
235    //plot the Tag
236 <  plot[filterName].addh1d(filterName+"_pt_tag", filterName+"_pt_tag", "p_{T}(tag) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(index_pos).Pt(), evt.Weight);
237 <  plot[filterName].addh1d(filterName+"_eta_tag", filterName+"_eta_tag", "#eta(tag)", "events", binEta, lowEta, upEta, evt.muonP4->at(index_pos).eta(), evt.Weight);
236 >  plot[filterName].addh1d(filterName+"_pt_tag", filterName+"_pt_tag", "p_{T}(tag) [GeV/c]", "events", binPt, lowPt, upPt, lepP4->at(index_pos).Pt(), evt.Weight);
237 >  plot[filterName].addh1d(filterName+"_eta_tag", filterName+"_eta_tag", "#eta(tag)", "events", binEta, lowEta, upEta, lepP4->at(index_pos).eta(), evt.Weight);
238    //plot the Probe
239 <  plot[filterName].addh1d(filterName+"_pt_probe", filterName+"_pt_probe", "p_{T}(probe) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(index_neg).pt(), evt.Weight);    
240 <  plot[filterName].addh1d(filterName+"_eta_probe", filterName+"_eta_probe", "#eta(probe)", "events", binEta, lowEta, upEta, evt.muonP4->at(index_neg).eta(), evt.Weight);
239 >  plot[filterName].addh1d(filterName+"_pt_probe", filterName+"_pt_probe", "p_{T}(probe) [GeV/c]", "events", binPt, lowPt, upPt, lepP4->at(index_neg).pt(), evt.Weight);    
240 >  plot[filterName].addh1d(filterName+"_eta_probe", filterName+"_eta_probe", "#eta(probe)", "events", binEta, lowEta, upEta, lepP4->at(index_neg).eta(), evt.Weight);
241    //plot the passed
242    if(matched.at(index_neg)){
243 <    plot[filterName].addh1d(filterName+"_pt_passed", filterName+"_pt_passed", "p_{T}(passed) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(index_neg).pt(), evt.Weight);    
244 <    plot[filterName].addh1d(filterName+"_eta_passed", filterName+"_eta_passed", "#eta(passed)", "events", binEta, lowEta, upEta, evt.muonP4->at(index_neg).eta(), evt.Weight);
243 >    Double_t minv = (lepP4->at(index_pos) + lepP4->at(index_neg)).mass();
244 >    plot[filterName].addh1d(filterName+"_pt_passed", filterName+"_pt_passed", "p_{T}(passed) [GeV/c]", "events", binPt, lowPt, upPt, lepP4->at(index_neg).pt(), evt.Weight);    
245 >    plot[filterName].addh1d(filterName+"_eta_passed", filterName+"_eta_passed", "#eta(passed)", "events", binEta, lowEta, upEta, lepP4->at(index_neg).eta(), evt.Weight);
246      plot[filterName].addh1d(filterName+"_PUVertices_passed", filterName+"_PUVertices_passed", "number of primary vertices (passed)", "events", binPU, lowPU, upPU, evt.PUInter, evt.Weight);
247 +    plot[filterName].addh1d(filterName+"_Minv_passed", filterName+"_Minv_passed", "M_{inv}  [GeV/c^{2}]", "events", binMinv, lowMinv, upMinv, minv, evt.Weight);
248    }
249    else{//plot the failed
250 <    plot[filterName].addh1d(filterName+"_pt_failed", filterName+"_pt_failed", "p_{T}(failed) [GeV/c]", "events", binPt, lowPt, upPt, evt.muonP4->at(index_neg).pt(), evt.Weight);    
251 <    plot[filterName].addh1d(filterName+"_eta_failed", filterName+"_eta_failed", "#eta(failed)", "events", binEta, lowEta, upEta, evt.muonP4->at(index_neg).eta(), evt.Weight);
250 >    Double_t minv = (lepP4->at(index_pos) + lepP4->at(index_neg)).mass();
251 >    plot[filterName].addh1d(filterName+"_pt_failed", filterName+"_pt_failed", "p_{T}(failed) [GeV/c]", "events", binPt, lowPt, upPt, lepP4->at(index_neg).pt(), evt.Weight);    
252 >    plot[filterName].addh1d(filterName+"_eta_failed", filterName+"_eta_failed", "#eta(failed)", "events", binEta, lowEta, upEta, lepP4->at(index_neg).eta(), evt.Weight);
253      plot[filterName].addh1d(filterName+"_PUVertices_failed", filterName+"_PUVertices_failed", "number of primary vertices (failed)", "events", binPU, lowPU, upPU, evt.PUInter, evt.Weight);
254 +    plot[filterName].addh1d(filterName+"_Minv_failed", filterName+"_Minv_failed", "M_{inv}  [GeV/c^{2}]", "events", binMinv, lowMinv, upMinv, minv, evt.Weight);
255    }
256   }
257  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines