ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/Objects.hh
Revision: 1.29
Committed: Tue Oct 25 13:26:50 2011 UTC (13 years, 6 months ago) by agilbert
Content type: text/plain
Branch: MAIN
CVS Tags: v01-00-00, HEAD
Changes since 1.28: +285 -202 lines
Log Message:
Significant code re-write.  Compiles under 4_2_4 but may not work as expected.  Files marked as broken may need to be fixed in the future.

File Contents

# Content
1 #ifndef HbbAnalysis_Objects_hh
2 #define HbbAnalysis_Objects_hh
3
4 #include <vector>
5 #include <string>
6 #include <iostream>
7 #include <map>
8
9 #include "TLorentzVector.h"
10 #include "TMath.h"
11
12 namespace HbbAnalysis {
13
14 struct Point{
15 double vx;
16 double vy;
17 double vz;
18
19 Point() : vx(0), vy(0), vz(0) {}
20 Point(double x, double y, double z) : vx(x), vy(y), vz(z) {}
21 void Clear() {
22 vx = 0;
23 vy = 0;
24 vz = 0;
25 }
26 };
27
28 struct P4Total {
29 double comE;
30 double sumPx;
31 double sumPy;
32 double sumPz;
33 double sumE;
34 P4Total() :
35 comE(0),
36 sumPx(0),
37 sumPy(0),
38 sumPz(0),
39 sumE(0)
40 {}
41 void Clear() {
42 comE = 0;
43 sumPx = 0;
44 sumPy = 0;
45 sumPz = 0;
46 sumE = 0;
47 }
48 };
49
50 struct FourMomentum {
51 double px;
52 double py;
53 double pz;
54 double e;
55
56 FourMomentum() :
57 px(0),
58 py(0),
59 pz(0),
60 e(0)
61 {}
62 void Clear() {
63 px = 0;
64 py = 0;
65 pz = 0;
66 e = 0;
67 }
68 TLorentzVector GetTLorentzVector() const {
69 return TLorentzVector(px,py,pz,e);
70 }
71 };
72
73 struct PUVars {
74 int bunchCrossing;
75 unsigned int numInteractions;
76 PUVars(){
77 bunchCrossing = 0;
78 numInteractions = 0;
79 }
80 void Clear(){
81 bunchCrossing = 0;
82 numInteractions = 0;
83 }
84 };
85
86 struct GenJetVars {
87 int flavour;
88 double mass;
89 int nConstituents;
90 GenJetVars():
91 flavour(0),
92 mass(0),
93 nConstituents(0)
94 {}
95 void Clear() {
96 flavour = 0;
97 mass = 0;
98 nConstituents = 0;
99 }
100 };
101
102 struct GenVars {
103 float charge;
104 int pdgId;
105 short status;
106 int index;
107 Point vertex;
108 GenVars():
109 charge(0),
110 pdgId(0),
111 status(0),
112 index(0)
113 {}
114 void Clear() {
115 charge = 0;
116 pdgId = 0;
117 status = 0;
118 index = 0;
119 vertex.Clear();
120 }
121 };
122
123 struct SCVars {
124 float eta;
125 float sigmaEtaEta;
126 float sigmaIEtaIEta;
127 float e1x5;
128 float e2x5Max;
129 float e5x5;
130 float eOverP;
131 SCVars():
132 eta(0),
133 sigmaEtaEta(0),
134 sigmaIEtaIEta(0),
135 e1x5(0),
136 e2x5Max(0),
137 e5x5(0),
138 eOverP(0)
139 {}
140 void Clear() {
141 eta = 0;
142 sigmaEtaEta = 0;
143 sigmaIEtaIEta = 0;
144 e1x5 = 0;
145 e2x5Max = 0;
146 e5x5 = 0;
147 eOverP = 0;
148 }
149 };
150
151 struct EleIsoVars {
152 float track;
153 float ecal;
154 float hcal;
155 EleIsoVars():
156 track(0),
157 ecal(0),
158 hcal(0)
159 {}
160 void Clear() {
161 track = 0;
162 ecal = 0;
163 hcal = 0;
164 }
165 };
166
167 struct EleIDVars{
168 unsigned short idAndIso;
169 std::map<std::string,float> electronIDs;
170 float hOverE;
171 float deltaPhiIn;
172 float deltaEtaIn;
173 bool ecalDrivenSeed;
174 bool trackerDrivenSeed;
175 EleIDVars():
176 idAndIso(0),
177 hOverE(0),
178 deltaPhiIn(0),
179 deltaEtaIn(0),
180 ecalDrivenSeed(false),
181 trackerDrivenSeed(false)
182 {}
183 void Clear() {
184 idAndIso = 0;
185 electronIDs.clear();
186 hOverE = 0;
187 deltaPhiIn = 0;
188 deltaEtaIn = 0;
189 ecalDrivenSeed = false;
190 trackerDrivenSeed = false;
191 }
192 };
193
194 struct MuTrkVars {
195 float dxy;
196 float dz;
197 float normalizedChi2;
198 unsigned int muonHits;
199 int charge;
200 unsigned int trackerHits;
201 unsigned int pixelHits;
202 MuTrkVars():
203 dxy(0),
204 dz(0),
205 normalizedChi2(0),
206 muonHits(0),
207 charge(0),
208 trackerHits(0),
209 pixelHits(0)
210 {}
211 void Clear() {
212 dxy = 0;
213 dz = 0;
214 normalizedChi2 = 0;
215 muonHits = 0;
216 charge = 0;
217 trackerHits = 0;
218 pixelHits = 0;
219 }
220 };
221
222 struct MuIsoVars {
223 float sumPt;
224 float emEt;
225 float hadEt;
226 int nTracks;
227 MuIsoVars():
228 sumPt(0),
229 emEt(0),
230 hadEt(0),
231 nTracks(0)
232 {}
233 void Clear() {
234 sumPt = 0;
235 emEt = 0;
236 hadEt = 0;
237 nTracks = 0;
238 }
239 };
240
241 struct MuIDVars{
242 unsigned short type;
243 std::vector<unsigned short> ids;
244 float caloCompat;
245 float segCompat;
246 unsigned int nChambers;
247 unsigned int nMatchesLoose;
248 unsigned int nMatchesMedium;
249 unsigned int nMatchesTight;
250 MuIDVars():
251 type(0),
252 caloCompat(0),
253 segCompat(0),
254 nChambers(0),
255 nMatchesLoose(0),
256 nMatchesMedium(0),
257 nMatchesTight(0)
258 {}
259 void Clear() {
260 type = 0;
261 ids.clear();
262 caloCompat = 0;
263 segCompat = 0;
264 nChambers = 0;
265 nMatchesLoose = 0;
266 nMatchesMedium = 0;
267 nMatchesTight = 0;
268 }
269 };
270
271
272 struct TrkVars{
273 double pT;
274 double eta;
275 double phi;
276 double matchDist;
277 double IPxy;
278 double IPz;
279 float signedSipt;
280 TrkVars():
281 pT(0),
282 eta(0),
283 phi(0),
284 matchDist(0),
285 IPxy(0),
286 IPz(0),
287 signedSipt(0)
288 {}
289
290 };
291
292
293 struct CaloTauIsoVars{
294 unsigned int nIsoTracks;
295 unsigned int nSigTracks;
296 float leadTrackHCAL3x3hitsEtSum;
297 float leadTrackHCAL3x3hottesthitDEta;
298 float signalTracksInvariantMass;
299 float tracksInvariantMass;
300 float isolationTracksPtSum;
301 float isolationECALhitsEtSum;
302 float maximumHCALhitEt;
303 CaloTauIsoVars():
304 nIsoTracks(0),
305 nSigTracks(0),
306 leadTrackHCAL3x3hitsEtSum(0),
307 leadTrackHCAL3x3hottesthitDEta(0),
308 signalTracksInvariantMass(0),
309 tracksInvariantMass(0),
310 isolationTracksPtSum(0),
311 isolationECALhitsEtSum(0),
312 maximumHCALhitEt(0)
313 {}
314
315
316
317 };
318
319 struct CaloTauIDVars{
320 float byIsolation;
321 float byLeadingTrackFinding;
322 float byLeadingTrackPtCut;
323 CaloTauIDVars():
324 byIsolation(0),
325 byLeadingTrackFinding(0),
326 byLeadingTrackPtCut(0)
327 {}
328
329 };
330
331 struct PFTauIsoVars{
332 unsigned int nSigCands;
333 unsigned int nIsoCands;
334 double maximumHCALPFClusterEt;
335 //double emFraction;
336 double hcalTotOverPLead;
337 double hcalMaxOverPLead;
338 double hcal3x3OverPLead;
339 double ecalStripSumEOverPLead;
340 double bremsRecoveryEOverPLead;
341 PFTauIsoVars():
342 nSigCands(0),
343 nIsoCands(0),
344 maximumHCALPFClusterEt(0),
345 //emFraction(0),
346 hcalTotOverPLead(0),
347 hcalMaxOverPLead(0),
348 hcal3x3OverPLead(0),
349 ecalStripSumEOverPLead(0),
350 bremsRecoveryEOverPLead(0)
351 {}
352 };
353
354 //for hadr, neutr and gamma cands
355 struct PFTauCandVars{
356 unsigned int nSigCands;
357 unsigned int nIsoCands;
358 double isolationPtSum;
359 PFTauCandVars():
360 nSigCands(0),
361 nIsoCands(0),
362 isolationPtSum(0)
363 {}
364 };
365
366 struct PFTauIDVars{
367 float byLeadingTrackFinding;
368 float byLeadingTrackPtCut;
369 float byTrackIsolation;
370 float byECALIsolation;
371 float byIsolation;
372 float againstElectron;
373 float againstMuon;
374 float byIsolationUsingLeadingPion;
375 float byTaNC;
376 float byTaNCfrHalfPercent;
377 float byTaNCfrOnePercent;
378 float byTaNCfrQuarterPercent;
379 float byTaNCfrTenthPercent;
380 float ecalIsolationUsingLeadingPion;
381 float leadingPionPtCut;
382 float trackIsolationUsingLeadingPion;
383 PFTauIDVars():
384 byLeadingTrackFinding(0),
385 byLeadingTrackPtCut(0),
386 byTrackIsolation(0),
387 byECALIsolation(0),
388 byIsolation(0),
389 againstElectron(0),
390 againstMuon(0),
391 byIsolationUsingLeadingPion(0),
392 byTaNC(0),
393 byTaNCfrHalfPercent(0),
394 byTaNCfrOnePercent(0),
395 byTaNCfrQuarterPercent(0),
396 byTaNCfrTenthPercent(0),
397 ecalIsolationUsingLeadingPion(0),
398 leadingPionPtCut(0),
399 trackIsolationUsingLeadingPion(0)
400 {}
401 };
402
403 struct PFTauEleIDVars{
404 double pT;
405 double eta;
406 double phi;
407 float output;
408 float decision;
409
410 PFTauEleIDVars():
411 pT(0),
412 eta(0),
413 phi(0),
414 output(0),
415 decision(0)
416 {}
417 };
418
419 struct PFTauMuIDVars{
420 float caloCompat;
421 float segCompat;
422 float decision;
423 PFTauMuIDVars():
424 caloCompat(0),
425 segCompat(0),
426 decision(0)
427 {}
428 };
429
430
431 struct CaloJetVars{
432 float maxEInEmTowers;
433 float maxEInHadTowers;
434 float energyFractionHadronic;
435 float emEnergyFraction;
436 float hadEnergyInHB;
437 float hadEnergyInHO;
438 float hadEnergyInHE;
439 float hadEnergyInHF;
440 float emEnergyInEB;
441 float emEnergyInEE;
442 float emEnergyInHF;
443 float towersArea;
444 int n90;
445 int n60;
446 CaloJetVars():
447 maxEInEmTowers(0),
448 maxEInHadTowers(0),
449 energyFractionHadronic(0),
450 emEnergyFraction(0),
451 hadEnergyInHB(0),
452 hadEnergyInHO(0),
453 hadEnergyInHE(0),
454 hadEnergyInHF(0),
455 emEnergyInEB(0),
456 emEnergyInEE(0),
457 emEnergyInHF(0),
458 towersArea(0),
459 n90(0),
460 n60(0)
461 {}
462 void Clear() {
463 maxEInEmTowers = 0;
464 maxEInHadTowers = 0;
465 energyFractionHadronic = 0;
466 emEnergyFraction = 0;
467 hadEnergyInHB = 0;
468 hadEnergyInHO = 0;
469 hadEnergyInHE = 0;
470 hadEnergyInHF = 0;
471 emEnergyInEB = 0;
472 emEnergyInEE = 0;
473 emEnergyInHF = 0;
474 towersArea = 0;
475 n90 = 0;
476 n60 = 0;
477 }
478 };
479
480 struct JPTJetVars{
481 float zspCorrection;
482 int elecMultiplicity;
483 float calopT;
484 float caloEta;
485 //std::vector<TrkVars> pionsInCone;
486 //std::vector<TrkVars> pionsCurledOut;
487 //std::vector<TrkVars> pionsCurledIn;
488 //std::vector<TrkVars> elecsInCone;
489 //std::vector<TrkVars> elecsCurledOut;
490 //std::vector<TrkVars> elecsCurledIn;
491 //std::vector<TrkVars> muonsInCone;
492 //std::vector<TrkVars> muonsCurledOut;
493 //std::vector<TrkVars> muonsCurledIn;
494 std::vector< std::pair<unsigned int,double> > particleStatusPt;
495 JPTJetVars():
496 zspCorrection(0),
497 elecMultiplicity(0),
498 calopT(0),
499 caloEta(0)
500 {}
501 void Clear() {
502 zspCorrection = 0;
503 elecMultiplicity = 0;
504 calopT = 0;
505 caloEta = 0;
506 particleStatusPt.clear();
507 }
508 };
509
510 struct JPTPFJetVars{
511 float chargedHadronEnergy;
512 float chargedHadronEnergyFraction;
513 float neutralHadronEnergy;
514 float neutralHadronEnergyFraction;
515 float chargedEmEnergy;
516 float chargedEmEnergyFraction;
517 float neutralEmEnergy;
518 float neutralEmEnergyFraction;
519 int chargedMultiplicity;
520 int muonMultiplicity;
521 JPTPFJetVars():
522 chargedHadronEnergy(0),
523 chargedHadronEnergyFraction(0),
524 neutralHadronEnergy(0),
525 neutralHadronEnergyFraction(0),
526 chargedEmEnergy(0),
527 chargedEmEnergyFraction(0),
528 neutralEmEnergy(0),
529 neutralEmEnergyFraction(0),
530 chargedMultiplicity(0),
531 muonMultiplicity(0)
532 {}
533 void Clear() {
534 chargedHadronEnergy = 0;
535 chargedHadronEnergyFraction = 0;
536 neutralHadronEnergy = 0;
537 neutralHadronEnergyFraction = 0;
538 chargedEmEnergy = 0;
539 chargedEmEnergyFraction = 0;
540 neutralEmEnergy = 0;
541 neutralEmEnergyFraction = 0;
542 chargedMultiplicity = 0;
543 muonMultiplicity = 0;
544 }
545 };
546
547 struct PFJetVars{
548 double chargedMuEnergy;
549 double chargedMuEnergyFraction;
550 double neutralMultiplicity;
551 unsigned numberOfDaughters;
552 double HFHadronEnergy;
553 PFJetVars():
554 chargedMuEnergy(0),
555 chargedMuEnergyFraction(0),
556 neutralMultiplicity(0),
557 numberOfDaughters(0),
558 HFHadronEnergy(0)
559 {}
560 void Clear() {
561 chargedMuEnergy = 0;
562 chargedMuEnergyFraction = 0;
563 neutralMultiplicity = 0;
564 numberOfDaughters = 0;
565 HFHadronEnergy = 0;
566 }
567 };
568
569 struct JetBtagVars{
570 float cSV;
571 float cSVMVA;
572 float iPMVA;
573 float bProba;
574 float probability;
575 float sSVHE;
576 float sSVHP;
577 float softElectronByPt;
578 float softElectronByIP3d;
579 float softMuon;
580 float softMuonByPt;
581 float softMuonByIP3d;
582 float tCHE;
583 float tCHP;
584 JetBtagVars():
585 cSV(0),
586 cSVMVA(0),
587 iPMVA(0),
588 bProba(0),
589 probability(0),
590 sSVHE(0),
591 sSVHP(0),
592 softElectronByPt(0),
593 softElectronByIP3d(0),
594 softMuon(0),
595 softMuonByPt(0),
596 softMuonByIP3d(0),
597 tCHE(0),
598 tCHP(0)
599 {}
600 void Clear() {
601 cSV = 0;
602 cSVMVA = 0;
603 iPMVA = 0;
604 bProba = 0;
605 probability = 0;
606 sSVHE = 0;
607 sSVHP = 0;
608 softElectronByPt = 0;
609 softElectronByIP3d = 0;
610 softMuon = 0;
611 softMuonByPt = 0;
612 softMuonByIP3d = 0;
613 tCHE = 0;
614 tCHP = 0;
615 }
616 };
617
618 struct JetSecVertexVars{
619 HbbAnalysis::FourMomentum fourVec;
620 HbbAnalysis::Point vertex;
621 JetSecVertexVars(){}
622 void Clear() {
623 fourVec.Clear();
624 vertex.Clear();
625 }
626 };
627
628
629 struct JetIDVars{
630 double fHPD;
631 double fRBX;
632 int n90Hits;
633 //double fSubDetector1;
634 //double fSubDetector2;
635 //double fSubDetector3;
636 //double fSubDetector4;
637 double restrictedEMF;
638 int nHCALTowers;
639 int nECALTowers;
640 //double approximatefHPD;
641 //double approximatefRBX;
642 int hitsInN90;
643 // muon hits id
644 //int numberOfHits2RPC;
645 //int numberOfHits3RPC;
646 //int numberOfHitsRPC;
647 JetIDVars():
648 fHPD(0),
649 fRBX(0),
650 n90Hits(0),
651 restrictedEMF(0),
652 nHCALTowers(0),
653 nECALTowers(0),
654 hitsInN90(0)
655 {}
656 void Clear() {
657 fHPD = 0;
658 fRBX = 0;
659 n90Hits = 0;
660 restrictedEMF = 0;
661 nHCALTowers = 0;
662 nECALTowers = 0;
663 hitsInN90 = 0;
664 }
665 };
666
667 struct JetECorVars{
668 //std::vector<std::pair<std::string,double> > Levels;
669 std::map<std::string, double> Levels;
670 JetECorVars(){
671 }
672 void Clear() {
673 Levels.clear();
674 }
675 };
676
677
678 struct MetVars{
679 double mET;
680 double mEx;
681 double mEy;
682 double sumET;
683 double phi;
684 double mEtSig;
685 MetVars():
686 mET(0),
687 mEx(0),
688 mEy(0),
689 sumET(0),
690 phi(0),
691 mEtSig(0)
692 {}
693
694 };
695
696 struct TriggerVars{
697 std::string name;
698 unsigned int index;
699 bool accept;
700 int prescale;
701 TriggerVars():
702 name(""),
703 index(0),
704 accept(false),
705 prescale(0)
706 {}
707 };
708
709
710 struct VertexVars{
711 //std::vector<float> trackWeights;
712 //std::vector<float> trackpT;
713 double sumPtSq;
714 double chi2;
715 double ndof;
716 double x;
717 double y;
718 double z;
719 double rho;
720 double xError;
721 double yError;
722 double zError;
723 double cov01;
724 double cov02;
725 double cov12;
726 VertexVars():
727 sumPtSq(0),
728 chi2(0),
729 ndof(0),
730 x(0),
731 y(0),
732 z(0),
733 rho(0),
734 xError(0),
735 yError(0),
736 zError(0),
737 cov01(0),
738 cov02(0),
739 cov12(0)
740 {
741 }
742 void Clear() {
743 sumPtSq = 0;
744 chi2 = 0;
745 ndof = 0;
746 x = 0;
747 y = 0;
748 z = 0;
749 rho = 0;
750 xError = 0;
751 yError = 0;
752 zError = 0;
753 cov01 = 0;
754 cov02 = 0;
755 cov12 = 0;
756 }
757 };
758
759 struct BeamSpotVars{
760 double x0;
761 double y0;
762 double z0;
763 double sigmaZ;
764 double BeamWidthX;
765 double BeamWidthY;
766 double x0Error;
767 double y0Error;
768 double z0Error;
769 double sigmaZ0Error;
770 double BeamWidthXError;
771 double BeamWidthYError;
772 //double dxdz;
773 //double dydz;
774 //double dxdzError;
775 //double dydzError;
776 //BeamType type();
777 //enum BeamType { Unknown=-1, Fake=0, LHC=1, Tracker=2 };
778 //double emittanceX() const { return emittanceX_; }
779 //double emittanceY() const { return emittanceY_; }
780 //double betaStar() const { return betaStar_; }
781 BeamSpotVars():
782 x0(0),
783 y0(0),
784 z0(0),
785 sigmaZ(0),
786 BeamWidthX(0),
787 BeamWidthY(0),
788 x0Error(0),
789 y0Error(0),
790 z0Error(0),
791 sigmaZ0Error(0),
792 BeamWidthXError(0),
793 BeamWidthYError(0)
794 {}
795 };
796
797 double DeltaPhi(const double phi1, const double phi2);
798 double DeltaR(const TLorentzVector & v1, const TLorentzVector & v2);
799
800 template <class T1, class T2>
801 double DeltaR(const T1 & v1, const T2 & v2){
802 double dEta = v1.eta - v2.eta;
803 double dPhi = fabs(v1.phi - v2.phi);
804 if (dPhi > TMath::Pi()) dPhi = (2.0*TMath::Pi() - dPhi);
805 return sqrt(dEta*dEta+dPhi*dPhi);
806 }
807
808 bool SameSign(double charge1, double charge2);
809
810 bool OppSign(double charge1, double charge2);
811
812 //TLorentzVector FourMomentum(const BaseVars & v, const double scale=1) ;
813
814 double TransverseMass(const TLorentzVector & leg1,
815 const TLorentzVector & leg2,
816 const double mEx,
817 const double mEy);
818
819 double TransverseMass(const TLorentzVector & leg1,
820 const double mEx,
821 const double mEy);
822
823 TLorentzVector FourMomentumCDFmethod(const TLorentzVector & leg1,
824 const TLorentzVector & leg2,
825 double mEx,
826 double mEy);
827
828 TLorentzVector FourMomentumCollinearApprox(const TLorentzVector & leg1,
829 const TLorentzVector & leg2,
830 double mEx,
831 double mEy);
832
833 //double EtaDetector(const BaseVars & v1);
834 //double EtaDetector(const GenVars & v1);
835
836 }//namespace
837
838 #endif