CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TtFullHadSignalSel.cc
Go to the documentation of this file.
3 #include "TVector3.h"
4 
6  pt1_(-1.), pt2_(-1.), pt3_(-1.), pt4_(-1.), pt5_(-1.), pt6_(-1.)
7 {
8 }
9 
10 std::vector<math::XYZVector> makeVecForEventShape(std::vector<pat::Jet> jets, double scale = 1.) {
11  std::vector<math::XYZVector> p;
12  unsigned int i=1;
13  for (std::vector<pat::Jet>::const_iterator jet = jets.begin(); jet != jets.end(); ++jet) {
14  math::XYZVector Vjet(jet->px() * scale, jet->py() * scale, jet->pz() * scale);
15  p.push_back(Vjet);
16  ++i;
17  if(i==6) break;
18  }
19  return p;
20 }
21 
22 TtFullHadSignalSel::TtFullHadSignalSel(const std::vector<pat::Jet>& jets)
23 {
24 
25  H_ = 0;
26  Ht_ = 0;
27  Ht123_ = 0;
28  Ht3jet_ = 0;
29  Et56_ = 0;
30  sqrt_s_ = 0;
31  M3_ = 0;
32 
33  TCHP_Bjets_ = 0;
34  SSV_Bjets_ = 0;
35  CSV_Bjets_ = 0;
36  SM_Bjets_ = 0;
37 
38  TCHP_Bjet1_ = 0;
39  TCHP_Bjet2_ = 0;
40  TCHP_Bjet3_ = 0;
41  TCHP_Bjet4_ = 0;
42  TCHP_Bjet5_ = 0;
43  TCHP_Bjet6_ = 0;
44  SSV_Bjet1_ = 0;
45  SSV_Bjet2_ = 0;
46  SSV_Bjet3_ = 0;
47  SSV_Bjet4_ = 0;
48  SSV_Bjet5_ = 0;
49  SSV_Bjet6_ = 0;
50  CSV_Bjet1_ = 0;
51  CSV_Bjet2_ = 0;
52  CSV_Bjet3_ = 0;
53  CSV_Bjet4_ = 0;
54  CSV_Bjet5_ = 0;
55  CSV_Bjet6_ = 0;
56  SM_Bjet1_ = 0;
57  SM_Bjet2_ = 0;
58  SM_Bjet3_ = 0;
59  SM_Bjet4_ = 0;
60  SM_Bjet5_ = 0;
61  SM_Bjet6_ = 0;
62 
81 
82  aplanarity_ = 0;
83  sphericity_ = 0;
84  circularity_ = 0;
85  isotropy_ = 0;
86  C_ = 0;
87  D_ = 0;
88 
89  dRMin1_ = 0;
90  dRMin2_ = 0;
91  sumDR3JetMin1_ = 0;
92  sumDR3JetMin2_ = 0;
93 
94  dRMin1Mass_ = 0;
95  dRMin2Mass_ = 0;
98 
99  std::list< double > TCHP_Bjet_Discis;
100  std::list< double > SSV_Bjet_Discis;
101  std::list< double > CSV_Bjet_Discis;
102  std::list< double > SM_Bjet_Discis;
103 
104  std::list< std::pair< double, std::pair< unsigned int, unsigned int > > > dRs;
105  std::list< std::pair< double, std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > > dRs3Jets;
106 
107  unsigned int jetCounter = 1;
108  for(std::vector<pat::Jet>::const_iterator jet = jets.begin(); jet != jets.end(); ++jet, ++jetCounter){
109 
110  H_ += jet->energy();
111  Ht_ += jet->et();
112  Ht3jet_ += jet->et();
113 
114  TCHP_Bjet_Discis.push_back( jet->bDiscriminator("trackCountingHighPurBJetTags") );
115  SSV_Bjet_Discis.push_back( jet->bDiscriminator("simpleSecondaryVertexBJetTags") );
116  CSV_Bjet_Discis.push_back( jet->bDiscriminator("combinedSecondaryVertexBJetTags") );
117  SM_Bjet_Discis.push_back( jet->bDiscriminator("softMuonBJetTags") );
118 
119  if (jetCounter == 1) {
120  pt1_ = jet->pt();
121  Ht3jet_ -= jet->et();
122  Ht123_ += jet->et();
123  jet1_etaetaMoment_ = jet->etaetaMoment();
124  jet1_etaphiMoment_ = jet->etaphiMoment();
125  jet1_phiphiMoment_ = jet->phiphiMoment();
126  }
127  else if (jetCounter == 2) {
128  pt2_ = jet->pt();
129  Ht3jet_ -= jet->et();
130  Ht123_ += jet->et();
131  jet2_etaetaMoment_ = jet->etaetaMoment();
132  jet2_etaphiMoment_ = jet->etaphiMoment();
133  jet2_phiphiMoment_ = jet->phiphiMoment();
134  }
135  else if (jetCounter == 3) {
136  pt3_ = jet->pt();
137  Ht123_ += jet->et();
138  jet3_etaetaMoment_ = jet->etaetaMoment();
139  jet3_etaphiMoment_ = jet->etaphiMoment();
140  jet3_phiphiMoment_ = jet->phiphiMoment();
141  }
142  else if (jetCounter == 4) {
143  pt4_ = jet->pt();
144  jet4_etaetaMoment_ = jet->etaetaMoment();
145  jet4_etaphiMoment_ = jet->etaphiMoment();
146  jet4_phiphiMoment_ = jet->phiphiMoment();
147  }
148  else if (jetCounter == 5) {
149  pt5_ = jet->pt();
150  jet5_etaetaMoment_ = jet->etaetaMoment();
151  jet5_etaphiMoment_ = jet->etaphiMoment();
152  jet5_phiphiMoment_ = jet->phiphiMoment();
153  Et56_ += jet->et();
154  }
155  else if (jetCounter == 6) {
156  pt6_ = jet->pt();
157  jet6_etaetaMoment_ = jet->etaetaMoment();
158  jet6_etaphiMoment_ = jet->etaphiMoment();
159  jet6_phiphiMoment_ = jet->phiphiMoment();
160  Et56_ += jet->et();
161  }
162 
163  if(jet->bDiscriminator("trackCountingHighPurBJetTags") > 2.17) ++TCHP_Bjets_;
164  if(jet->bDiscriminator("simpleSecondaryVertexBJetTags") > 2.02) ++SSV_Bjets_;
165  if(jet->bDiscriminator("combinedSecondaryVertexBJetTags") > 0.9 ) ++CSV_Bjets_;
166  if(jet->bDiscriminator("softMuonBJetTags") > 0.3 ) ++SM_Bjets_;
167 
168  unsigned int jetCounter2 = jetCounter + 1;
169  for(std::vector<pat::Jet>::const_iterator jet2 = jet; (jet2 != jets.end() && jet2 != (--jets.end()) && jet2 != (--(--jets.end()))); ++jet2, ++jetCounter2){
170  ++jet2;
171  dRs.push_back( std::make_pair( deltaR( jet->phi(), jet->eta(), jet2->phi(), jet2->eta() ), std::make_pair( jetCounter-1, jetCounter2-1 ) ) );
172 
173  unsigned int jetCounter3 = jetCounter2 + 1;
174  for(std::vector<pat::Jet>::const_iterator jet3 = jet2; (jet3 != jets.end() && jet3 != (--jets.end()) && jet3 != (--(--jets.end())) && jet3 != (--(--(--jets.end())))); ++jet3, ++jetCounter3){
175  ++jet3;
176  double dR1 = deltaR( jet->phi() , jet->eta() , jet2->phi(), jet2->eta() );
177  double dR2 = deltaR( jet->phi() , jet->eta() , jet3->phi(), jet3->eta() );
178  double dR3 = deltaR( jet2->phi(), jet2->eta(), jet3->phi(), jet3->eta() );
179  dRs3Jets.push_back( std::make_pair( dR1+dR2+dR3, std::make_pair( std::make_pair( jetCounter-1, jetCounter2-1 ), jetCounter3-1 ) ) );
180  }
181  }
182 
183  }
184 
185  dRs.sort();
186  dRs3Jets.sort();
187 
188  dRMin1_ = dRs.begin()->first;
189  dRMin1Mass_ = (jets[dRs.begin()->second.first].p4()+jets[dRs.begin()->second.second].p4()).mass();
190  sumDR3JetMin1_ = dRs3Jets.begin()->first;
191  sumDR3JetMin1Mass_ = (jets[dRs3Jets.begin()->second.first.first].p4()+jets[dRs3Jets.begin()->second.first.second].p4()+jets[dRs3Jets.begin()->second.second].p4()).mass();
192 
193  for(std::list< std::pair< double, std::pair< unsigned int, unsigned int > > >::const_iterator dR = ++dRs.begin(); dR != dRs.end(); ++dR){
194  if( (dR->second.first != dRs.begin()->second.first) && (dR->second.first != dRs.begin()->second.second) &&
195  (dR->second.second != dRs.begin()->second.first) && (dR->second.second != dRs.begin()->second.second) ){
196  dRMin2_ = dR->first;
197  dRMin2Mass_ = (jets[dR->second.first].p4()+jets[dR->second.second].p4()).mass();
198  break;
199  }
200  }
201 
202  for(std::list< std::pair< double, std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > >::const_iterator dR = ++dRs3Jets.begin(); dR != dRs3Jets.end(); ++dR){
203  if( (dR->second.first.first != dRs3Jets.begin()->second.first.first) && (dR->second.first.first != dRs3Jets.begin()->second.first.second) &&
204  (dR->second.first.second != dRs3Jets.begin()->second.first.first) && (dR->second.first.second != dRs3Jets.begin()->second.first.second) &&
205  (dR->second.first.first != dRs3Jets.begin()->second.second) && (dR->second.first.second != dRs3Jets.begin()->second.second) ){
206  sumDR3JetMin2_ = dR->first;
207  sumDR3JetMin2Mass_ = (jets[dR->second.first.first].p4()+jets[dR->second.first.second].p4()+jets[dR->second.second].p4()).mass();
208  break;
209  }
210  }
211 
212  TCHP_Bjet_Discis.sort();
213  SSV_Bjet_Discis.sort();
214  CSV_Bjet_Discis.sort();
215  SM_Bjet_Discis.sort();
216 
217  unsigned int counter = 1;
218  for(std::list< double >::const_reverse_iterator jet = TCHP_Bjet_Discis.rbegin(); jet != TCHP_Bjet_Discis.rend(); ++jet, ++counter){
219  if (counter == 1) TCHP_Bjet1_ = *jet;
220  else if(counter == 2) TCHP_Bjet2_ = *jet;
221  else if(counter == 3) TCHP_Bjet3_ = *jet;
222  else if(counter == 4) TCHP_Bjet4_ = *jet;
223  else if(counter == 5) TCHP_Bjet5_ = *jet;
224  else if(counter == 6) TCHP_Bjet6_ = *jet;
225  }
226 
227  counter = 1;
228  for(std::list< double >::const_reverse_iterator jet = SSV_Bjet_Discis.rbegin(); jet != SSV_Bjet_Discis.rend(); ++jet, ++counter){
229  if (counter == 1) SSV_Bjet1_ = *jet;
230  else if(counter == 2) SSV_Bjet2_ = *jet;
231  else if(counter == 3) SSV_Bjet3_ = *jet;
232  else if(counter == 4) SSV_Bjet4_ = *jet;
233  else if(counter == 5) SSV_Bjet5_ = *jet;
234  else if(counter == 6) SSV_Bjet6_ = *jet;
235  }
236 
237  counter = 1;
238  for(std::list< double >::const_reverse_iterator jet = CSV_Bjet_Discis.rbegin(); jet != CSV_Bjet_Discis.rend(); ++jet, ++counter){
239  if (counter == 1) CSV_Bjet1_ = *jet;
240  else if(counter == 2) CSV_Bjet2_ = *jet;
241  else if(counter == 3) CSV_Bjet3_ = *jet;
242  else if(counter == 4) CSV_Bjet4_ = *jet;
243  else if(counter == 5) CSV_Bjet5_ = *jet;
244  else if(counter == 6) CSV_Bjet6_ = *jet;
245  }
246 
247  counter = 1;
248  for(std::list< double >::const_reverse_iterator jet = SM_Bjet_Discis.rbegin(); jet != SM_Bjet_Discis.rend(); ++jet, ++counter){
249  if (counter == 1) SM_Bjet1_ = *jet;
250  else if(counter == 2) SM_Bjet2_ = *jet;
251  else if(counter == 3) SM_Bjet3_ = *jet;
252  else if(counter == 4) SM_Bjet4_ = *jet;
253  else if(counter == 5) SM_Bjet5_ = *jet;
254  else if(counter == 6) SM_Bjet6_ = *jet;
255  }
256 
257  if(jets.size() > 2){
258 
259  M3_ = (jets[0].p4() + jets[1].p4() + jets[2].p4()).mass();
260 
261  if(jets.size() > 5){
262  sqrt_s_ = (jets[0].p4() + jets[1].p4() + jets[2].p4() + jets[3].p4() + jets[4].p4() + jets[5].p4()).mass();
263  }
264  }
265 
266  EventShapeVariables eventshape(makeVecForEventShape(jets));
267 
268  aplanarity_ = eventshape.aplanarity();
269  sphericity_ = eventshape.sphericity();
270  circularity_ = eventshape.circularity();
271  isotropy_ = eventshape.isotropy();
272  C_ = eventshape.C();
273  D_ = eventshape.D();
274 
275 }
276 
278 {
279 }
int i
Definition: DBlmapReader.cc:9
double C(double=2.) const
double circularity(const unsigned int &numberOfSteps=1000) const
Class for the calculation of several event shape variables.
std::vector< math::XYZVector > makeVecForEventShape(std::vector< pat::Jet > jets, double scale=1.)
double sphericity(double=2.) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double D(double=2.) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double isotropy(const unsigned int &numberOfSteps=1000) const
double aplanarity(double=2.) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run