CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
readTestVector.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <fstream>
4 #include <memory>
5 #include <map>
6 
12 
13 #include "L1Trigger/L1TGlobal/src/L1TMenuEditor/L1TriggerMenu.hxx"
14 
16 
17 #include <boost/program_options.hpp>
18 
19 #include "TH1.h"
20 #include "TFile.h"
21 
22 const int MAX_ALGO_BITS = 512;
23 
24 #ifndef M_PI
25 #define M_PI 3.14159265358979323846
26 #endif
27 
31 
32 std::vector<int> l1taccepts;
33 std::vector<std::string> l1tnames;
34 std::vector<int> l1taccepts_evt;
35 
36 void parseMuons( std::vector<std::string> muons, bool verbose );
37 void parseEGs( std::vector<std::string> egs, bool verbose );
38 void parseTaus( std::vector<std::string> taus, bool verbose );
39 void parseJets( std::vector<std::string> jets, bool verbose );
40 void parseEtSums(std::vector<std::string> etsums, bool verbose );
41 
42 void parseAlgo( std::string algo );
43 
49 
50 double convertPtFromHW( int hwPt, double max, double step );
51 double convertEtaFromHW( int hwEta, double max, double step, int hwMax );
52 double convertPhiFromHW( int hwPhi, double step );
53 
54 
55 TH1D* h_l1mu_pt_;
59 
64 
65 TH1D* h_l1eg_pt_;
69 
74 
75 TH1D* h_l1ht_;
76 TH1D* h_l1et_;
81 
82 
83 double MaxLepPt_ = 255;
84 double MaxJetPt_ = 1023;
85 double MaxEt_ = 2047;
86 
87 double MaxCaloEta_ = 5.0;
88 double MaxMuonEta_ = 2.45;
89 
90 double PhiStepCalo_ = 144;
91 double PhiStepMuon_ = 576;
92 
93 double EtaStepCalo_ = 230;
94 double EtaStepMuon_ = 450;
95 
96 double PtStep_ = 0.5;
97 
98 
99 // The application.
100 int main( int argc, char** argv ){
101  using namespace boost;
102  namespace po = boost::program_options;
103 
104  std::string vector_file;
105  std::string xml_file;
106  std::string histo_file;
107  bool dumpEvents;
108  int maxEvents;
109 
110  po::options_description desc("Main options");
111  desc.add_options()
112  ("vector_file,i", po::value<std::string>(&vector_file)->default_value(""), "Input file")
113  ("menu_file,m", po::value<std::string>(&xml_file)->default_value(""), "Menu file")
114  ("hist_file,o", po::value<std::string>(&histo_file)->default_value(""), "Output histogram file")
115  ("dumpEvents,d", po::value<bool>(&dumpEvents)->default_value(false), "Dump event-by-event information")
116  ("maxEvents,n", po::value<int>(&maxEvents)->default_value(-1), "Number of events (default is all)")
117  ("help,h", "Produce help message")
118  ;
119 
120  po::variables_map vm, vm0;
121 
122  // parse the first time, using only common options and allow unregistered options
123  try{
124  po::store(po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(), vm0);
125  po::notify(vm0);
126  } catch(std::exception &ex) {
127  std::cout << "Invalid options: " << ex.what() << std::endl;
128  std::cout << "Use readTestVector --help to get a list of all the allowed options" << std::endl;
129  return 999;
130  } catch(...) {
131  std::cout << "Unidentified error parsing options." << std::endl;
132  return 1000;
133  }
134 
135  // if help, print help
136  if(vm0.count("help")) {
137  std::cout << "Usage: readTestVector [options]\n";
138  std::cout << desc;
139  return 0;
140  }
141 
142  if( vector_file=="" ){
143  std::cout << "No input file specified" << std::endl;
144  return 99;
145  }
146 
147  bool readXML = true;
148  if( xml_file=="" ){
149  readXML = false;
150  std::cout << "No menu file specified" << std::endl;
151  }
152 
153  bool output = true;
154  if( histo_file=="" ){
155  output = false;
156  }
157 
158  TFile* histofile = NULL;
159  if( output ){
160  histofile = new TFile(histo_file.c_str(),"RECREATE");
161  histofile->cd();
162  }
163 
164  l1taccepts.resize(MAX_ALGO_BITS);
166  for( unsigned int i=0; i<l1taccepts.size(); i++ ) l1taccepts[i] = 0;
167 
168  if( readXML ){
169  // Load XML.
170  std::auto_ptr<l1t::L1TriggerMenu> tm(l1t::l1TriggerMenu(xml_file));
171 
172  l1tnames.resize(MAX_ALGO_BITS);
173  l1t::AlgorithmList algorithms = tm->algorithms();
174  for( l1t::AlgorithmList::algorithm_const_iterator i = algorithms.algorithm().begin();
175  i != algorithms.algorithm().end(); ++i ){
176 
177  l1t::Algorithm algorithm = (*i);
178 
179  int index = algorithm.index();
180  std::string name = algorithm.name();
181 
182  l1tnames[index] = name;
183  }
184  }
185 
187  h_l1mu_pt_ = new TH1D("h_l1mu_pt", ";L1 #mu p_{T}", int((MaxLepPt_+PtStep_)/(PtStep_) + 1.001), 0, MaxLepPt_+PtStep_ );
188  h_l1mu_eta_ = new TH1D("h_l1mu_eta",";L1 #mu #eta", int(EtaStepMuon_/2+0.0001), -MaxMuonEta_, MaxMuonEta_ );
189  h_l1mu_phi_ = new TH1D("h_l1mu_phi",";L1 #mu #phi", PhiStepMuon_+1, 0, 2*M_PI );
190  h_l1mu_num_ = new TH1D("h_l1mu_num",";L1 Number of #mu", 10, 0, 10 );
191 
192  h_l1jet_pt_ = new TH1D("h_l1jet_pt", ";L1 jet p_{T}", int((MaxJetPt_+PtStep_)/(4*PtStep_) + 1.001), 0, MaxJetPt_+PtStep_ );
193  h_l1jet_eta_ = new TH1D("h_l1jet_eta",";L1 jet #eta", int(EtaStepCalo_/2+0.0001), -MaxCaloEta_, MaxCaloEta_ );
194  h_l1jet_phi_ = new TH1D("h_l1jet_phi",";L1 jet #phi", PhiStepCalo_+1, 0, 2*M_PI );
195  h_l1jet_num_ = new TH1D("h_l1jet_num",";L1 Number of jets", 13, 0, 13 );
196 
197  h_l1eg_pt_ = new TH1D("h_l1eg_pt", ";L1 EG p_{T}", int((MaxLepPt_+PtStep_)/(PtStep_) + 1.001), 0, MaxLepPt_+PtStep_ );
198  h_l1eg_eta_ = new TH1D("h_l1eg_eta",";L1 EG #eta", int(EtaStepCalo_/2+0.0001), -MaxCaloEta_, MaxCaloEta_ );
199  h_l1eg_phi_ = new TH1D("h_l1eg_phi",";L1 EG #phi", PhiStepCalo_+1, 0, 2*M_PI );
200  h_l1eg_num_ = new TH1D("h_l1eg_num",";L1 Number of EGs", 13, 0, 13 );
201 
202  h_l1tau_pt_ = new TH1D("h_l1tau_pt", ";L1 #tau p_{T}", int((MaxLepPt_+PtStep_)/(PtStep_) + 1.001), 0, MaxLepPt_+PtStep_ );
203  h_l1tau_eta_ = new TH1D("h_l1tau_eta",";L1 #tau #eta", int(EtaStepCalo_/2+0.0001), -MaxCaloEta_, MaxCaloEta_ );
204  h_l1tau_phi_ = new TH1D("h_l1tau_phi",";L1 #tau #phi", PhiStepCalo_+1, 0, 2*M_PI );
205  h_l1tau_num_ = new TH1D("h_l1tau_num",";L1 Number of #tau", 13, 0, 13 );
206 
207  h_l1ht_ = new TH1D("h_l1ht_", ";L1 #SigmaH_{T}", int((MaxEt_+PtStep_)/(16*PtStep_) + 1.001), 0, MaxEt_+PtStep_ );
208  h_l1et_ = new TH1D("h_l1et_", ";L1 #SigmaE_{T}", int((MaxEt_+PtStep_)/(16*PtStep_) + 1.001), 0, MaxEt_+PtStep_ );
209  h_l1htm_et_ = new TH1D("h_l1htm_et_", ";L1 Missing H_{T}", int((MaxEt_+PtStep_)/(16*PtStep_) + 1.001), 0, MaxEt_+PtStep_ );
210  h_l1etm_et_ = new TH1D("h_l1etm_et_", ";L1 Missing E_{T}", int((MaxEt_+PtStep_)/(16*PtStep_) + 1.001), 0, MaxEt_+PtStep_ );
211  h_l1htm_phi_ = new TH1D("h_l1htm_phi_", ";L1 Missing H_{T} #phi", PhiStepCalo_+1, 0, 2*M_PI );
212  h_l1etm_phi_ = new TH1D("h_l1etm_phi_", ";L1 Missing E_{T} #phi", PhiStepCalo_+1, 0, 2*M_PI );
213 
214 
215  std::ifstream file(vector_file);
217 
218  std::vector<std::string> mu;
219  std::vector<std::string> eg;
220  std::vector<std::string> tau;
221  std::vector<std::string> jet;
222  std::vector<std::string> etsum;
223  mu.resize(8);
224  eg.resize(12);
225  tau.resize(8);
226  jet.resize(12);
227  etsum.resize(4);
228 
229  std::string bx, ex, alg, fin;
230 
231  int evt=0;
232  int l1a=0;
233 
234  if( dumpEvents ) printf(" ==== Objects ===\n");
235 
236  while(std::getline(file, line)){
237  evt++;
238  std::stringstream linestream(line);
239  linestream >> bx
240  >> mu[0] >> mu[1] >> mu[2] >> mu[3] >> mu[4] >> mu[5] >> mu[6] >> mu[7]
241  >> eg[0] >> eg[1] >> eg[2] >> eg[3] >> eg[4] >> eg[5] >> eg[6] >> eg[7] >> eg[8] >> eg[9] >> eg[10] >> eg[11]
242  >> tau[0] >> tau[1] >> tau[2] >> tau[3] >> tau[4] >> tau[5] >> tau[6] >> tau[7]
243  >> jet[0] >> jet[1] >> jet[2] >> jet[3] >> jet[4] >> jet[5] >> jet[6] >> jet[7] >> jet[8] >> jet[9] >> jet[10] >> jet[11]
244  >> etsum[0] >> etsum[1] >> etsum[2] >> etsum[3]
245  >> ex >> alg >> fin;
246 
247  if( dumpEvents ) printf(" <==== BX = %s ====>\n",bx.c_str());
248  parseMuons(mu, dumpEvents);
249  parseEGs(eg, dumpEvents);
250  parseTaus(tau, dumpEvents);
251  parseJets(jet, dumpEvents);
252  parseEtSums(etsum, dumpEvents);
253 
254  parseAlgo(alg);
255 
256  int finOR = atoi( fin.c_str() );
257  l1a += finOR;
258 
259  if( dumpEvents ){
260  printf(" == Algos ==\n");
261  if( finOR ){
262  printf(" Triggers with nono-zero accepts\n");
263  if( readXML && l1tnames.size()>0 ) printf("\t bit\t L1A\t Name\n");
264  else printf("\t bit\t L1A\n");
265 
266  for( int i=0; i<MAX_ALGO_BITS; i++ ){
267  if( l1taccepts_evt[i]>0 ){
268  if( readXML && l1tnames.size()>0 ) printf("\t %d \t %d \t %s\n", i, l1taccepts_evt[i], l1tnames[i].c_str());
269  else printf("\t %d \t %d\n", i, l1taccepts_evt[i] );
270  }
271  }
272  }
273  else{
274  printf("\n No triggers passed\n");
275  }
276  // extra spacing between bx
277  printf("\n\n");
278  }
279 
280  if( evt==maxEvents ) break;
281  }
282 
283  printf(" =========== Summary of results ==========\n");
284  printf(" There were %d L1A out of %d events (%.1f%%)\n", l1a, evt, float(l1a)/float(evt)*100);
285  printf("\n Triggers with nono-zero accepts\n");
286  if( readXML && l1tnames.size()>0 ) printf("\t bit\t L1A\t Name\n");
287  else printf("\t bit\t L1A\n");
288 
289  for( int i=0; i<MAX_ALGO_BITS; i++ ){
290  if( l1taccepts[i]>0 ){
291  if( readXML && l1tnames.size()>0 ) printf("\t %d \t %d \t %s\n", i, l1taccepts[i], l1tnames[i].c_str());
292  else printf("\t %d \t %d\n", i, l1taccepts[i] );
293  }
294  }
295 
296 
297  if( output ){
298  histofile->Write();
299  histofile->Close();
300  }
301 
302 
303  return 0;
304 }
305 
306 
307 // Parse Objects
308 void parseMuons( std::vector<std::string> muons, bool verbose ){
309 
310  if( verbose) printf(" == Muons ==\n");
311  int nmu=0;
312  for( unsigned int i=0; i<muons.size(); i++ ){
313  std::string imu = muons[i];
314  if( imu==zeroes16 ) continue;
315  nmu++;
316  l1t::Muon mu = unpackMuons( imu );
317 
318  double pt = convertPtFromHW( mu.hwPt(), MaxLepPt_, PtStep_ );
319  double eta = convertEtaFromHW( mu.hwEta(), MaxMuonEta_, EtaStepMuon_, 0x1ff );
320  double phi = convertPhiFromHW( mu.hwPhi(), PhiStepMuon_ );
321 
322  h_l1mu_pt_->Fill( pt );
323  h_l1mu_eta_->Fill( eta );
324  h_l1mu_phi_->Fill( phi );
325 
326  if( verbose) printf(" l1t::Muon %d:\t pt = %d (%.1f),\t eta = %d (%+.2f),\t phi = %d (%.2f)\n", i, mu.hwPt(), pt, mu.hwEta(), eta, mu.hwPhi(), phi);
327  }
328  h_l1mu_num_->Fill(nmu);
329 
330  return;
331 }
332 void parseEGs( std::vector<std::string> egs, bool verbose ){
333 
334  if( verbose) printf(" == EGammas ==\n");
335  int neg=0;
336  for( unsigned int i=0; i<egs.size(); i++ ){
337  std::string ieg = egs[i];
338  if( ieg==zeroes8 ) continue;
339  neg++;
340  l1t::EGamma eg = unpackEGs( ieg );
341 
342  double pt = convertPtFromHW( eg.hwPt(), MaxLepPt_, PtStep_ );
343  double eta = convertEtaFromHW( eg.hwEta(), MaxCaloEta_, EtaStepCalo_, 0xff );
344  double phi = convertPhiFromHW( eg.hwPhi(), PhiStepCalo_ );
345 
346  h_l1eg_pt_->Fill( pt );
347  h_l1eg_eta_->Fill( eta );
348  h_l1eg_phi_->Fill( phi );
349 
350  if( verbose) printf(" l1t::EGamma %d:\t pt = %d (%.1f),\t eta = %d (%+.2f),\t phi = %d (%.2f)\n", i, eg.hwPt(), pt, eg.hwEta(), eta, eg.hwPhi(), phi);
351  }
352  h_l1eg_num_->Fill(neg);
353 
354  return;
355 }
356 void parseTaus( std::vector<std::string> taus, bool verbose ){
357 
358  if( verbose) printf(" == Taus ==\n");
359  int ntau=0;
360  for( unsigned int i=0; i<taus.size(); i++ ){
361  std::string itau = taus[i];
362  if( itau==zeroes8 ) continue;
363  ntau++;
364  l1t::Tau tau = unpackTaus( itau );
365 
366  double pt = convertPtFromHW( tau.hwPt(), MaxLepPt_, PtStep_ );
367  double eta = convertEtaFromHW( tau.hwEta(), MaxCaloEta_, EtaStepCalo_, 0xff );
368  double phi = convertPhiFromHW( tau.hwPhi(), PhiStepCalo_ );
369 
370  h_l1tau_pt_->Fill( pt );
371  h_l1tau_eta_->Fill( eta );
372  h_l1tau_phi_->Fill( phi );
373 
374  if( verbose) printf(" l1t::Tau %d:\t pt = %d (%.1f),\t eta = %d (%+.2f),\t phi = %d (%.2f)\n", i, tau.hwPt(), pt, tau.hwEta(), eta, tau.hwPhi(), phi);
375  }
376  h_l1tau_num_->Fill(ntau);
377 
378  return;
379 }
380 void parseJets( std::vector<std::string> jets, bool verbose ){
381 
382  if( verbose) printf(" == Jets ==\n");
383  int njet=0;
384  for( unsigned int i=0; i<jets.size(); i++ ){
385  std::string ijet = jets[i];
386  if( ijet==zeroes8 ) continue;
387  njet++;
388  l1t::Jet jet = unpackJets( ijet );
389 
390  double pt = convertPtFromHW( jet.hwPt(), MaxJetPt_, PtStep_ );
391  double eta = convertEtaFromHW( jet.hwEta(), MaxCaloEta_, EtaStepCalo_, 0xff );
392  double phi = convertPhiFromHW( jet.hwPhi(), PhiStepCalo_ );
393 
394  h_l1jet_pt_->Fill( pt );
395  h_l1jet_eta_->Fill( eta );
396  h_l1jet_phi_->Fill( phi );
397 
398  if( verbose) printf(" l1t::Jet %d:\t pt = %d (%.1f),\t eta = %d (%+.2f),\t phi = %d (%.2f)\n", i, jet.hwPt(), pt, jet.hwEta(), eta, jet.hwPhi(), phi);
399  }
400  h_l1jet_num_->Fill(njet);
401 
402  return;
403 }
404 void parseEtSums( std::vector<std::string> etsum, bool verbose ){
405 
406  if( verbose) printf(" == EtSums ==\n");
407 
408  //et sum
409  std::string iet = etsum[0];
410  if( iet!=zeroes8 ){
411  l1t::EtSum et = unpackEtSums( iet, l1t::EtSum::EtSumType::kTotalEt );
412  double pt = convertPtFromHW( et.hwPt(), MaxEt_, PtStep_ );
413  h_l1et_->Fill( pt );
414  if( verbose) printf(" l1t::EtSum TotalEt:\t Et = %d\n", et.hwPt());
415  }
416  //ht sum
417  std::string iht = etsum[1];
418  if( iht!=zeroes8 ){
419  l1t::EtSum ht = unpackEtSums( iht, l1t::EtSum::EtSumType::kTotalHt );
420  double pt = convertPtFromHW( ht.hwPt(), MaxEt_, PtStep_ );
421  h_l1ht_->Fill( pt );
422  if( verbose) printf(" l1t::EtSum TotalHt:\t Ht = %d\n", ht.hwPt());
423  }
424  //etm
425  std::string ietm = etsum[2];
426  if( ietm!=zeroes8 ){
427  l1t::EtSum etm = unpackEtSums( ietm, l1t::EtSum::EtSumType::kMissingEt );
428  double pt = convertPtFromHW( etm.hwPt(), MaxEt_, PtStep_ );
429  double phi = convertPhiFromHW( etm.hwPhi(), PhiStepCalo_ );
430  h_l1etm_et_->Fill( pt );
431  h_l1etm_phi_->Fill( phi );
432  if( verbose) printf(" l1t::EtSum MissingEt:\t Et = %d,\t phi = %d\n", etm.hwPt(), etm.hwPhi());
433  }
434  //htm
435  std::string ihtm = etsum[3];
436  if( ihtm!=zeroes8 ){
437  l1t::EtSum htm = unpackEtSums( ihtm, l1t::EtSum::EtSumType::kMissingHt );
438  double pt = convertPtFromHW( htm.hwPt(), MaxEt_, PtStep_ );
439  double phi = convertPhiFromHW( htm.hwPhi(), PhiStepCalo_ );
440  h_l1htm_et_->Fill( pt );
441  h_l1htm_phi_->Fill( phi );
442  if( verbose) printf(" l1t::EtSum MissingHt:\t Et = %d,\t phi = %d\n", htm.hwPt(), htm.hwPhi());
443  }
444 
445  return;
446 }
447 
448 
449 // Parse Algos
450 void parseAlgo( std::string algo ){
451 
452  // clear the algo per event
453  l1taccepts_evt.clear();
455 
456  // Return if no triggers fired
457  if( algo==zeroes128 ) return;
458 
459  std::stringstream ss;
460  std::string s;
461  int pos, algRes, accept;
462 
463  for( int i=0; i<MAX_ALGO_BITS; i++ ){
464  pos = 127 - int( i/4 );
465  std::string in(1,algo[pos]);
466  char* endPtr = (char*) in.c_str();
467  algRes = strtol( in.c_str(), &endPtr, 16 );
468  accept = ( algRes >> (i%4) ) & 1;
469  l1taccepts_evt[i] += accept;
470  l1taccepts[i] += accept;
471  }
472 
473  return;
474 
475 }
476 
477 // Unpack Objects
479 
480  char* endPtr = (char*) imu.c_str();
481  cms_uint64_t packedVal = strtoull( imu.c_str(), &endPtr, 16 );
482 
483  int pt = (packedVal>>10) & 0x1ff;
484  int eta = (packedVal>>23) & 0x1ff;
485  int phi = (packedVal>>0) & 0x3ff;
486  int iso = (packedVal>>32) & 0x1;
487  int qual= (packedVal>>19) & 0x1;
488  int charge = (packedVal>>34) & 0x1;
489  int chargeValid = (packedVal>>35) & 0x1;
490  int mip = 1;
491  int tag = 1;
492 
493  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 = new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
494  l1t::Muon mu(*p4, pt, eta, phi, qual, charge, chargeValid, iso, mip, tag);
495 
496  return mu;
497 
498 }
500 
501  char* endPtr = (char*) ieg.c_str();
502  unsigned int packedVal = strtol( ieg.c_str(), &endPtr, 16 );
503 
504  int pt = (packedVal>>0) & 0x1ff;
505  int eta = (packedVal>>9) & 0xff;
506  int phi = (packedVal>>17) & 0xff;
507  int iso = (packedVal>>25) & 0x1;
508  int qual= (packedVal>>26) & 0x1;
509 
510  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 = new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
511  l1t::EGamma eg(*p4, pt, eta, phi, qual, iso);
512 
513  return eg;
514 }
516 
517  char* endPtr = (char*) itau.c_str();
518  unsigned int packedVal = strtol( itau.c_str(), &endPtr, 16 );
519 
520  int pt = (packedVal>>0) & 0x1ff;
521  int eta = (packedVal>>9) & 0xff;
522  int phi = (packedVal>>17) & 0xff;
523  int iso = (packedVal>>25) & 0x1;
524  int qual= (packedVal>>26) & 0x1;
525 
526  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 = new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
527  l1t::Tau tau(*p4, pt, eta, phi, qual, iso);
528 
529  return tau;
530 }
531 
533 
534  char* endPtr = (char*) ijet.c_str();
535  unsigned int packedVal = strtol( ijet.c_str(), &endPtr, 16 );
536 
537  int pt = (packedVal>>0) & 0x7ff;
538  int eta = (packedVal>>11) & 0xff;
539  int phi = (packedVal>>19) & 0xff;
540  int qual= (packedVal>>27) & 0x1;
541 
542  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 = new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
543  l1t::Jet jet(*p4, pt, eta, phi, qual);
544 
545  return jet;
546 }
547 
549 
550  char* endPtr = (char*) ietsum.c_str();
551  unsigned int packedVal = strtol( ietsum.c_str(), &endPtr, 16 );
552 
553  int pt = (packedVal>>0) & 0xfff;
554  int phi = 0;
555  if( type==l1t::EtSum::EtSumType::kMissingEt ||
556  type==l1t::EtSum::EtSumType::kMissingHt ) phi = (packedVal>>12) & 0xff;
557 
558  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > *p4 = new ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >();
559  l1t::EtSum sum(*p4, type, pt, 0,phi, 0);
560 
561  return sum;
562 }
563 
564 // Conversion into physical coordinates from HW
565 double convertPtFromHW( int hwPt, double max, double step ){
566  double pt = double(hwPt)/step;
567  if( pt>max ) pt = max;
568  return pt;
569 }
570 
571 double convertEtaFromHW( int hwEta, double max, double step, int hwMax ){
572  hwMax++;
573  double binWidth = 2*max/step;
574  double eta = ( hwEta<int(hwMax/2+1.001) ) ? double(hwEta)*binWidth+0.5*binWidth : -(double(hwMax-hwEta)*binWidth -0.5*binWidth);
575  return eta;
576 }
577 double convertPhiFromHW( int hwPhi, double step ){
578  double phi = double(hwPhi)/step * 2 * M_PI;
579  return phi;
580 }
581 
582 
583 // eof
584 
type
Definition: HCALResponse.h:21
double MaxEt_
int i
Definition: DBlmapReader.cc:9
TH1D * h_l1et_
void parseEGs(std::vector< std::string > egs, bool verbose)
TH1D * h_l1eg_eta_
void parseEtSums(std::vector< std::string > etsums, bool verbose)
TH1D * h_l1mu_num_
std::string zeroes128
Definition: Tau.h:13
void parseMuons(std::vector< std::string > muons, bool verbose)
#define NULL
Definition: scimark2.h:8
std::vector< int > l1taccepts
int hwPhi() const
Definition: L1Candidate.cc:79
TH1D * h_l1eg_num_
TH1D * h_l1etm_et_
T eta() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:25
int njet
Definition: HydjetWrapper.h:90
void parseTaus(std::vector< std::string > taus, bool verbose)
double MaxMuonEta_
TH1D * h_l1mu_pt_
int main(int argc, char **argv)
TH1D * h_l1tau_num_
Definition: Jet.h:13
TH1D * h_l1eg_pt_
l1t::Muon unpackMuons(std::string imu)
double MaxJetPt_
double PhiStepCalo_
double EtaStepMuon_
TH1D * h_l1etm_phi_
std::string zeroes16
string histofile
Definition: jetmet_cfg.py:4
l1t::EtSum unpackEtSums(std::string ietsum, l1t::EtSum::EtSumType type)
TH1D * h_l1ht_
TH1D * h_l1jet_phi_
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
double convertPhiFromHW(int hwPhi, double step)
void parseJets(std::vector< std::string > jets, bool verbose)
double convertPtFromHW(int hwPt, double max, double step)
void parseAlgo(std::string algo)
double PtStep_
double MaxCaloEta_
double PhiStepMuon_
const int mu
Definition: Constants.h:22
int hwEta() const
Definition: L1Candidate.cc:74
TH1D * h_l1tau_eta_
#define M_PI
const int MAX_ALGO_BITS
TH1D * h_l1eg_phi_
Definition: Muon.h:12
TH1D * h_l1jet_pt_
std::vector< int > l1taccepts_evt
TH1D * h_l1tau_pt_
double MaxLepPt_
int hwPt() const
Definition: L1Candidate.cc:69
TH1D * h_l1htm_phi_
tuple argc
Definition: dir2webdir.py:38
TH1D * h_l1jet_eta_
tuple muons
Definition: patZpeak.py:38
double convertEtaFromHW(int hwEta, double max, double step, int hwMax)
std::string zeroes8
tuple cout
Definition: gather_cfg.py:121
l1t::EGamma unpackEGs(std::string ieg)
TH1D * h_l1tau_phi_
unsigned long long cms_uint64_t
Definition: typedefs.h:17
TH1D * h_l1mu_eta_
l1t::Jet unpackJets(std::string ijet)
TH1D * h_l1jet_num_
TH1D * h_l1htm_et_
EtSumType
Definition: EtSum.h:17
TH1D * h_l1mu_phi_
l1t::Tau unpackTaus(std::string itau)
std::vector< std::string > l1tnames
Definition: DDAxes.h:10
double EtaStepCalo_