ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PhotonPairSelector.cc
Revision: 1.13
Committed: Sun Oct 2 10:03:59 2011 UTC (13 years, 7 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.12: +1 -1 lines
Log Message:
upgrade

File Contents

# User Rev Content
1 fabstoec 1.1 #include "MitPhysics/Mods/interface/PhotonPairSelector.h"
2     #include "MitAna/DataTree/interface/PhotonCol.h"
3     #include "MitAna/DataTree/interface/PFCandidateCol.h"
4 bendavid 1.8 #include "MitAna/DataTree/interface/StableData.h"
5     #include "MitAna/DataTree/interface/StableParticle.h"
6 fabstoec 1.1 #include "MitPhysics/Init/interface/ModNames.h"
7     #include "MitPhysics/Utils/interface/IsolationTools.h"
8     #include "MitPhysics/Utils/interface/PhotonTools.h"
9     #include "MitPhysics/Utils/interface/VertexTools.h"
10 bendavid 1.6 #include "MitPhysics/Utils/interface/PhotonFix.h"
11 bendavid 1.5 #include "TDataMember.h"
12 fabstoec 1.1 #include <TNtuple.h>
13     #include <TRandom3.h>
14 bendavid 1.6 #include <TSystem.h>
15 bendavid 1.9 #include <TH1D.h>
16 fabstoec 1.1
17     using namespace mithep;
18    
19     ClassImp(mithep::PhotonPairSelector)
20    
21     //--------------------------------------------------------------------------------------------------
22     PhotonPairSelector::PhotonPairSelector(const char *name, const char *title) :
23     // Base Module...
24     BaseMod (name,title),
25    
26     // define all the Branches to load
27     fPhotonBranchName (Names::gkPhotonBrn),
28     fElectronName (Names::gkElectronBrn),
29 bendavid 1.8 fGoodElectronName (Names::gkElectronBrn),
30 fabstoec 1.1 fConversionName (Names::gkMvfConversionBrn),
31     fTrackBranchName (Names::gkTrackBrn),
32     fPileUpDenName (Names::gkPileupEnergyDensityBrn),
33     fPVName (Names::gkPVBeamSpotBrn),
34     fBeamspotName (Names::gkBeamSpotBrn),
35     fPFCandName (Names::gkPFCandidatesBrn),
36     // MC specific stuff...
37     fMCParticleName (Names::gkMCPartBrn),
38     fPileUpName (Names::gkPileupInfoBrn),
39    
40     fGoodPhotonsName (ModNames::gkGoodPhotonsName),
41    
42     // ----------------------------------------
43     // Selection Types
44     fPhotonSelType ("NoSelection"),
45     fVertexSelType ("StdSelection"),
46     fPhSelType (kNoPhSelection),
47     fVtxSelType (kStdVtxSelection),
48    
49     // ----------------------------------------
50     fPhotonPtMin (20.0),
51     fPhotonEtaMax (2.5),
52    
53     fLeadingPtMin (40.0),
54     fTrailingPtMin (30.0),
55    
56     fIsData (false),
57     fPhotonsFromBranch (true),
58     fPVFromBranch (true),
59 bendavid 1.8 fGoodElectronsFromBranch (kTRUE),
60    
61 fabstoec 1.1 // ----------------------------------------
62     // collections....
63     fPhotons (0),
64     fElectrons (0),
65     fConversions (0),
66     fTracks (0),
67     fPileUpDen (0),
68     fPV (0),
69     fBeamspot (0),
70     fPFCands (0),
71     fMCParticles (0),
72     fPileUp (0),
73    
74     // ---------------------------------------
75     fDataEnCorr_EB_hR9 (0.),
76     fDataEnCorr_EB_lR9 (0.),
77     fDataEnCorr_EE_hR9 (0.),
78     fDataEnCorr_EE_lR9 (0.),
79    
80     fRunStart (0),
81     fRunEnd (0),
82    
83     fMCSmear_EB_hR9 (0.),
84     fMCSmear_EB_lR9 (0.),
85     fMCSmear_EE_hR9 (0.),
86     fMCSmear_EE_lR9 (0.),
87    
88     // ---------------------------------------
89     rng (new TRandom3()),
90 bendavid 1.9 fDoRegression (kFALSE),
91     fPhFixString ("4_2"),
92 bendavid 1.11 fRegWeights (gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/gbrph.root")),
93 bendavid 1.9 fEtaCorrections (0),
94 fabstoec 1.1 // ---------------------------------------
95     fDoDataEneCorr (true),
96     fDoMCSmear (true),
97 fabstoec 1.2 fDoVtxSelection (true),
98     fApplyEleVeto (true),
99 bendavid 1.8 fInvertElectronVeto(kFALSE)
100 fabstoec 1.1 {
101     // Constructor.
102     }
103    
104     PhotonPairSelector::~PhotonPairSelector(){
105     if(rng) delete rng;
106     }
107    
108     //--------------------------------------------------------------------------------------------------
109     void PhotonPairSelector::Process()
110     {
111     // ------------------------------------------------------------
112     // Process entries of the tree.
113     LoadEventObject(fPhotonBranchName, fPhotons);
114 bendavid 1.8
115     // -----------------------------------------------------------
116     // OUtput Photon Collection. It will ALWAYS conatrin either 0 or 2 Photons
117     PhotonOArr *GoodPhotons = new PhotonOArr;
118     GoodPhotons->SetName(fGoodPhotonsName);
119     GoodPhotons->SetOwner(kTRUE);
120     // add to event for other modules to use
121     AddObjThisEvt(GoodPhotons);
122    
123     if (fPhotons->GetEntries()<2) return;
124    
125 fabstoec 1.1 LoadEventObject(fElectronName, fElectrons);
126 bendavid 1.8 LoadEventObject(fGoodElectronName, fGoodElectrons);
127 fabstoec 1.1 LoadEventObject(fConversionName, fConversions);
128     LoadEventObject(fTrackBranchName, fTracks);
129     LoadEventObject(fPileUpDenName, fPileUpDen);
130     LoadEventObject(fPVName, fPV);
131     LoadEventObject(fBeamspotName, fBeamspot);
132     LoadEventObject(fPFCandName, fPFCands);
133    
134     // ------------------------------------------------------------
135     // load event based information
136     Float_t _tRho = -99.;
137 fabstoec 1.2 if( fPileUpDen->GetEntries() > 0 )
138     _tRho = (Double_t) fPileUpDen->At(0)->RhoRandomLowEta();
139    
140 fabstoec 1.1 const BaseVertex *bsp = dynamic_cast<const BaseVertex*>(fBeamspot->At(0));
141    
142     // ------------------------------------------------------------
143     // Get Event header for Run info etc.
144     const EventHeader* evtHead = this->GetEventHeader();
145     unsigned int evtNum = evtHead->EvtNum();
146 fabstoec 1.7 //Float_t _evtNum1 = (Float_t) ( (int) (evtNum/10000.) );
147     //Float_t _evtNum2 = (Float_t) ( (int) (evtNum % 10000) );
148 fabstoec 1.1 UInt_t runNumber = evtHead->RunNum();
149     Float_t _runNum = (Float_t) runNumber;
150     Float_t _lumiSec = (Float_t) evtHead->LumiSec();
151 ceballos 1.13
152 fabstoec 1.1 // ------------------------------------------------------------
153     // here we'll store the preselected Photons (and which CiCCategory they are...)
154     PhotonOArr* preselPh = new PhotonOArr;
155     std::vector<PhotonTools::CiCBaseLineCats> preselCat;
156     preselCat.resize(0);
157    
158     // 1. we do the pre-selection; but keep the non-passing photons in a secont container...
159     for (UInt_t i=0; i<fPhotons->GetEntries(); ++i) {
160     const Photon *ph = fPhotons->At(i);
161    
162     if(ph->SCluster()->AbsEta()>= fPhotonEtaMax || (ph->SCluster()->AbsEta()>=1.4442 && ph->SCluster()->AbsEta()<=1.566)) continue;
163     if(ph->Et() < fPhotonPtMin) continue;
164     if(ph->HadOverEm() > 0.15) continue;
165     if(ph->IsEB()) {
166     if(ph->CoviEtaiEta() > 0.013) continue;
167     } else {
168     if(ph->CoviEtaiEta() > 0.03) continue;
169     }
170     preselPh->Add(ph);
171 fabstoec 1.2 }
172    
173 bendavid 1.8 if (preselPh->GetEntries()<2) return;
174    
175 fabstoec 1.2 // Sorry... need the second loop here in order to sort & assign the right Categories..
176     preselPh->Sort();
177     for(unsigned int iPh = 0; iPh <preselPh->GetEntries(); ++iPh) {
178     const Photon* ph = preselPh->At(iPh);
179 fabstoec 1.1 preselCat.push_back(PhotonTools::CiCBaseLineCat(ph));
180     }
181    
182     // ------------------------------------------------------------
183     // compute how many pairs there are ...
184     unsigned int numPairs = 0;
185     if( preselPh->GetEntries() > 0) numPairs = (preselPh->GetEntries()-1)*preselPh->GetEntries()/2;
186     // ... and create all possible pairs of pre-selected photons
187     std::vector<unsigned int> idx1st;
188     std::vector<unsigned int> idx2nd;
189     std::vector<PhotonTools::CiCBaseLineCats> cat1st;
190     std::vector<PhotonTools::CiCBaseLineCats> cat2nd;
191     // ... this will be used to store whether a givne pair passes the cuts
192     std::vector<bool> pairPasses;
193    
194     if(numPairs > 0) {
195     for(unsigned int i1st = 0; i1st <preselPh->GetEntries() - 1; ++i1st) {
196     for(unsigned int i2nd = i1st + 1; i2nd <preselPh->GetEntries(); ++i2nd) {
197     idx1st.push_back(i1st);
198     idx2nd.push_back(i2nd);
199     pairPasses.push_back(true);
200     }
201     }
202     }
203    
204     // ------------------------------------------------------------
205     // array to store the index of 'chosen Vtx' for each pair
206     const Vertex** theVtx = new const Vertex*[numPairs]; // holds the 'chosen' Vtx for each Pair
207     Photon** fixPh1st = new Photon*[numPairs]; // holds the 1st Photon for each Pair
208     Photon** fixPh2nd = new Photon*[numPairs]; // holds the 2nd photon for each Pair
209    
210    
211     // store pair-indices for pairs passing the selection
212     std::vector<unsigned int> passPairs;
213     passPairs.resize(0);
214    
215     // ------------------------------------------------------------
216     // Loop over all Pairs and to the 'incredible machine' running....
217     for(unsigned int iPair = 0; iPair < numPairs; ++iPair) {
218    
219     // first we need a hard copy of the incoming photons
220     fixPh1st[iPair] = new Photon(*preselPh->At(idx1st[iPair]));
221     fixPh2nd[iPair] = new Photon(*preselPh->At(idx2nd[iPair]));
222     // we also store the category, so we don't have to ask all the time...
223     cat1st.push_back(preselCat[idx1st[iPair]]);
224     cat2nd.push_back(preselCat[idx2nd[iPair]]);
225 bendavid 1.9
226     if (fDoRegression) {
227     if (!egcor.IsInitialized()) {
228 bendavid 1.11 egcor.Initialize(!fIsData,fPhFixString,fPhFixFile,fRegWeights);
229 bendavid 1.9 }
230    
231     egcor.CorrectEnergyWithError(fixPh1st[iPair]);
232     egcor.CorrectEnergyWithError(fixPh2nd[iPair]);
233    
234     ThreeVectorC scpos1 = fixPh1st[iPair]->SCluster()->Point();
235     ThreeVectorC scpos2 = fixPh2nd[iPair]->SCluster()->Point();
236    
237     fixPh1st[iPair]->SetCaloPosXYZ(scpos1.X(),scpos1.Y(),scpos1.Z());
238     fixPh2nd[iPair]->SetCaloPosXYZ(scpos2.X(),scpos2.Y(),scpos2.Z());
239    
240    
241     }
242 fabstoec 1.1
243     // now we dicide if we either scale (Data) or Smear (MC) the Photons
244     if (fIsData) {
245     if(fDoDataEneCorr) {
246     // statring with scale = 1.
247     double scaleFac1 = 1.;
248     double scaleFac2 = 1.;
249 bendavid 1.9
250     //eta-dependent corrections
251     if (fEtaCorrections) {
252     double etacor1 = fEtaCorrections->GetBinContent(fEtaCorrections->GetXaxis()->FindFixBin(fixPh1st[iPair]->SCluster()->Eta()));
253     double etacor2 = fEtaCorrections->GetBinContent(fEtaCorrections->GetXaxis()->FindFixBin(fixPh2nd[iPair]->SCluster()->Eta()));
254    
255     scaleFac1 *= (etacor1*etacor1);
256     scaleFac2 *= (etacor2*etacor2);
257     }
258    
259 fabstoec 1.1 // checking the run Rangees ...
260     Int_t runRange = FindRunRangeIdx(runNumber);
261     if(runRange > -1) {
262 bendavid 1.9 scaleFac1 /= (1.0+GetDataEnCorr(runRange, cat1st[iPair]));
263     scaleFac2 /= (1.0+GetDataEnCorr(runRange, cat2nd[iPair]));
264 fabstoec 1.1 }
265     PhotonTools::ScalePhoton(fixPh1st[iPair], scaleFac1);
266     PhotonTools::ScalePhoton(fixPh2nd[iPair], scaleFac2);
267     }
268 bendavid 1.9 }
269    
270     if(fDoMCSmear) {
271    
272     double width1 = GetMCSmearFac(cat1st[iPair]);
273     double width2 = GetMCSmearFac(cat2nd[iPair]);
274    
275     if (!fIsData) {
276     // get the seed to do deterministic smearing...
277     UInt_t seedBase = (UInt_t) evtNum + (UInt_t) _runNum + (UInt_t) _lumiSec;
278     UInt_t seed1 = seedBase + (UInt_t) fixPh1st[iPair]->E() + (UInt_t) (TMath::Abs(10.*fixPh1st[iPair]->SCluster()->Eta()));
279     UInt_t seed2 = seedBase + (UInt_t) fixPh2nd[iPair]->E() + (UInt_t) (TMath::Abs(10.*fixPh2nd[iPair]->SCluster()->Eta()));
280     // get the smearing for MC photons..
281 fabstoec 1.3
282 bendavid 1.9 PhotonTools::SmearPhoton(fixPh1st[iPair], rng, width1, seed1);
283     PhotonTools::SmearPhoton(fixPh2nd[iPair], rng, width2, seed2);
284 fabstoec 1.1 }
285 bendavid 1.9
286    
287     PhotonTools::SmearPhotonError(fixPh1st[iPair], width1);
288     PhotonTools::SmearPhotonError(fixPh2nd[iPair], width2);
289    
290 fabstoec 1.1 }
291 bendavid 1.9
292 fabstoec 1.1
293     // store the vertex for this pair
294     switch( fVtxSelType ){
295     case kStdVtxSelection:
296     theVtx[iPair] = fPV->At(0);
297     break;
298     case kCiCVtxSelection:
299     theVtx[iPair] = VertexTools::findVtxBasicRanking(fixPh1st[iPair],fixPh2nd[iPair], bsp, fPV, fConversions);
300     break;
301     case kMITVtxSelection:
302     // need PFCandidate Collection
303     theVtx[iPair] = VertexTools::BestVtx(fPFCands, fPV, bsp, mithep::FourVector((fixPh1st[iPair]->Mom()+fixPh2nd[iPair]->Mom())));
304     break;
305     default:
306     theVtx[iPair] = fPV->At(0);
307 fabstoec 1.2
308 fabstoec 1.1 }
309 bendavid 1.8
310     //set PV ref in photons
311     fixPh1st[iPair]->SetPV(theVtx[iPair]);
312     fixPh2nd[iPair]->SetPV(theVtx[iPair]);
313 fabstoec 1.2
314 fabstoec 1.1 // fix the kinematics for both events
315     FourVectorM newMom1st = fixPh1st[iPair]->MomVtx(theVtx[iPair]->Position());
316     FourVectorM newMom2nd = fixPh2nd[iPair]->MomVtx(theVtx[iPair]->Position());
317     fixPh1st[iPair]->SetMom(newMom1st.X(), newMom1st.Y(), newMom1st.Z(), newMom1st.E());
318     fixPh2nd[iPair]->SetMom(newMom2nd.X(), newMom2nd.Y(), newMom2nd.Z(), newMom2nd.E());
319    
320     // check if both photons pass the CiC selection
321     // FIX-ME: Add other possibilities....
322     bool pass1 = false;
323     bool pass2 = false;
324 bendavid 1.8 switch( fPhSelType ){
325 fabstoec 1.1 case kNoPhSelection:
326     pass1 = ( fixPh1st[iPair]->Pt() > fLeadingPtMin );
327     pass2 = ( fixPh2nd[iPair]->Pt() > fTrailingPtMin );
328     break;
329     case kCiCPhSelection:
330 fabstoec 1.3
331    
332 fabstoec 1.2 pass1 = PhotonTools::PassCiCSelection(fixPh1st[iPair], theVtx[iPair], fTracks, fElectrons, fPV, _tRho, fLeadingPtMin, fApplyEleVeto);
333     if(pass1) pass2 = PhotonTools::PassCiCSelection(fixPh2nd[iPair], theVtx[iPair], fTracks, fElectrons, fPV, _tRho, fTrailingPtMin, fApplyEleVeto);
334 fabstoec 1.3
335 fabstoec 1.1 break;
336     case kMITPhSelection:
337 fabstoec 1.3 // FIX-ME: This is a place-holder.. MIT guys: Please work hard... ;)
338 fabstoec 1.1 pass1 = ( fixPh1st[iPair]->Pt() > fLeadingPtMin );
339     pass2 = ( fixPh2nd[iPair]->Pt() > fTrailingPtMin );
340     break;
341     default:
342     pass1 = true;
343     pass2 = true;
344     }
345 bendavid 1.8
346     //match to good electrons if requested
347     if (fInvertElectronVeto) {
348     pass1 &= !PhotonTools::PassElectronVeto(fixPh1st[iPair],fGoodElectrons);
349     pass2 &= !PhotonTools::PassElectronVeto(fixPh2nd[iPair],fGoodElectrons);
350     }
351 fabstoec 1.1 // finally, if both Photons pass the selections, add the pair to the 'passing Pairs)
352     if( pass1 && pass2 ) passPairs.push_back(iPair);
353     }
354    
355    
356     // ---------------------------------------------------------------
357     // ... we're almost done, stau focused...
358     // loop over all passing pairs and find the one with the highest sum Et
359     const Vertex* _theVtx = NULL;
360     Photon* phHard = NULL;
361     Photon* phSoft = NULL;
362    
363     PhotonTools::CiCBaseLineCats catPh1 = PhotonTools::kCiCNoCat;
364     PhotonTools::CiCBaseLineCats catPh2 = PhotonTools::kCiCNoCat;
365    
366     double maxSumEt = 0.;
367     for(unsigned int iPair=0; iPair<passPairs.size(); ++iPair){
368     double sumEt = fixPh1st[passPairs[iPair]]->Et();
369     sumEt += fixPh2nd[passPairs[iPair]]->Et();
370     if( sumEt > maxSumEt ) {
371     maxSumEt = sumEt;
372     phHard = fixPh1st[passPairs[iPair]];
373     phSoft = fixPh2nd[passPairs[iPair]];
374     catPh1 = cat1st[passPairs[iPair]];
375     catPh2 = cat2nd[passPairs[iPair]];
376     _theVtx = theVtx[iPair];
377     }
378     }
379    
380     // ---------------------------------------------------------------
381     // we have the Photons (*PARTY*)... compute some useful qunatities
382    
383 bendavid 1.8
384 fabstoec 1.1
385     if(phHard && phSoft) {
386     GoodPhotons->AddOwned(phHard);
387     GoodPhotons->AddOwned(phSoft);
388     }
389    
390    
391     // sort according to pt
392     GoodPhotons->Sort();
393    
394     // delete auxiliary photon collection...
395     delete preselPh;
396     delete[] theVtx;
397 bendavid 1.4
398 fabstoec 1.1 return;
399    
400     }
401    
402     //--------------------------------------------------------------------------------------------------
403     void PhotonPairSelector::SlaveBegin()
404     {
405     // Run startup code on the computer (slave) doing the actual analysis. Here,
406     // we just request the photon collection branch.
407    
408     ReqEventObject(fPhotonBranchName, fPhotons, fPhotonsFromBranch);
409     ReqEventObject(fTrackBranchName, fTracks, true);
410     ReqEventObject(fElectronName, fElectrons, true);
411 bendavid 1.8 ReqEventObject(fGoodElectronName, fGoodElectrons, fGoodElectronsFromBranch);
412 fabstoec 1.1 ReqEventObject(fPileUpDenName, fPileUpDen, true);
413     ReqEventObject(fPVName, fPV, fPVFromBranch);
414     ReqEventObject(fConversionName, fConversions,true);
415     ReqEventObject(fBeamspotName, fBeamspot, true);
416     ReqEventObject(fPFCandName, fPFCands, true);
417    
418     if (!fIsData) {
419     ReqBranch(fPileUpName, fPileUp);
420     ReqBranch(fMCParticleName, fMCParticles);
421     }
422    
423     if (fPhotonSelType.CompareTo("CiCSelection") == 0)
424     fPhSelType = kCiCPhSelection;
425     else if (fPhotonSelType.CompareTo("MITSelection") == 0)
426     fPhSelType = kMITPhSelection;
427     else
428     fPhSelType = kNoPhSelection;
429    
430     if (fVertexSelType.CompareTo("CiCSelection") == 0)
431     fVtxSelType = kCiCVtxSelection;
432     else if (fVertexSelType.CompareTo("MITSelection") == 0)
433     fVtxSelType = kMITVtxSelection;
434     else
435     fVtxSelType = kStdVtxSelection;
436    
437 bendavid 1.9 if (fIsData) {
438     fPhFixFile = gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/PhotonFixGRPV22.dat");
439     }
440     else {
441     fPhFixFile = gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/PhotonFixSTART42V13.dat");
442     }
443    
444 fabstoec 1.1 }
445    
446     // ----------------------------------------------------------------------------------------
447     // some helpfer functions....
448 bendavid 1.8 void PhotonPairSelector::FindHiggsPtAndZ(Float_t& pt, Float_t& decayZ, Float_t& mass) {
449 fabstoec 1.1
450     pt = -999.;
451     decayZ = -999.;
452 bendavid 1.8 mass = -999.;
453 fabstoec 1.1
454     // loop over all GEN particles and look for status 1 photons
455     for(UInt_t i=0; i<fMCParticles->GetEntries(); ++i) {
456     const MCParticle* p = fMCParticles->At(i);
457 bendavid 1.8 if( p->Is(MCParticle::kH) || (!fApplyEleVeto && p->AbsPdgId()==23) ) {
458     pt=p->Pt();
459     decayZ = p->DecayVertex().Z();
460     mass = p->Mass();
461     break;
462     }
463 fabstoec 1.1 }
464    
465     return;
466     }
467    
468     // this routine looks for the idx of the run-range
469     Int_t PhotonPairSelector::FindRunRangeIdx(UInt_t run) {
470     Int_t runRange=-1;
471     for(UInt_t iRun = 0; iRun<fRunStart.size(); ++iRun) {
472     if( run >= fRunStart[iRun] && run <= fRunEnd[iRun]) {
473     runRange = (Int_t) iRun;
474     return runRange;
475     }
476     }
477     return runRange;
478     }
479    
480    
481     Double_t PhotonPairSelector::GetDataEnCorr(Int_t runRange, PhotonTools::CiCBaseLineCats cat) {
482     switch( cat ) {
483     case PhotonTools::kCiCCat1:
484     return fDataEnCorr_EB_hR9[runRange];
485     case PhotonTools::kCiCCat2:
486     return fDataEnCorr_EB_lR9[runRange];
487     case PhotonTools::kCiCCat3:
488     return fDataEnCorr_EE_hR9[runRange];
489     case PhotonTools::kCiCCat4:
490     return fDataEnCorr_EE_lR9[runRange];
491     default:
492     return 1.;
493     }
494     }
495    
496    
497     Double_t PhotonPairSelector::GetMCSmearFac(PhotonTools::CiCBaseLineCats cat) {
498     switch( cat ) {
499     case PhotonTools::kCiCCat1:
500     return fMCSmear_EB_hR9;
501     case PhotonTools::kCiCCat2:
502     return fMCSmear_EB_lR9;
503     case PhotonTools::kCiCCat3:
504     return fMCSmear_EE_hR9;
505     case PhotonTools::kCiCCat4:
506     return fMCSmear_EE_lR9;
507     default:
508     return 1.;
509     }
510     }
511    
512     Float_t PhotonPairSelector::GetEventCat(PhotonTools::CiCBaseLineCats cat1, PhotonTools::CiCBaseLineCats cat2) {
513    
514     bool ph1IsEB = (cat1 == PhotonTools::kCiCCat1 || cat1 == PhotonTools::kCiCCat2);
515     bool ph2IsEB = (cat2 == PhotonTools::kCiCCat1 || cat2 == PhotonTools::kCiCCat2);
516    
517     bool ph1IsHR9 = (cat1 == PhotonTools::kCiCCat1 || cat1 == PhotonTools::kCiCCat3);
518     bool ph2IsHR9 = (cat2 == PhotonTools::kCiCCat1 || cat2 == PhotonTools::kCiCCat3);
519    
520     if( ph1IsEB && ph2IsEB )
521     return ( ph1IsHR9 && ph2IsHR9 ? 0. : 1.);
522    
523     return ( ph1IsHR9 && ph2IsHR9 ? 2. : 3.);
524     }
525 bendavid 1.4