CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
lhef::LHERunInfo Class Reference

#include <LHERunInfo.h>

Classes

struct  Counter
 
class  Header
 
struct  Process
 
struct  XSec
 

Public Types

enum  CountMode { kTried = 0, kSelected, kKilled, kAccepted }
 

Public Member Functions

void addComment (const std::string &line)
 
void addHeader (const Header &header)
 
void count (int process, CountMode count, double eventWeight=1.0, double brWeight=1.0, double matchWeight=1.0)
 
std::vector< std::string > findHeader (const std::string &tag) const
 
const std::vector< std::string > & getComments () const
 
const std::vector< Header > & getHeaders () const
 
const int getHEPIDWTUP () const
 
const HEPRUPgetHEPRUP () const
 
const std::vector< Process > & getLumiProcesses () const
 
void initLumi ()
 
 LHERunInfo (std::istream &in)
 
 LHERunInfo (const HEPRUP &heprup)
 
 LHERunInfo (const HEPRUP &heprup, const std::vector< LHERunInfoProduct::Header > &headers, const std::vector< std::string > &comments)
 
 LHERunInfo (const LHERunInfoProduct &product)
 
bool operator!= (const LHERunInfo &other) const
 
bool operator== (const LHERunInfo &other) const
 
std::pair< int, int > pdfSetTranslation () const
 
void statistics () const
 
XSec xsec () const
 
 ~LHERunInfo ()
 

Private Member Functions

void init ()
 

Private Attributes

std::vector< std::string > comments
 
std::vector< Headerheaders
 
HEPRUP heprup
 
std::vector< Processprocesses
 
std::vector< ProcessprocessesLumi
 

Detailed Description

Definition at line 25 of file LHERunInfo.h.

Member Enumeration Documentation

Enumerator
kTried 
kSelected 
kKilled 
kAccepted 

Definition at line 66 of file LHERunInfo.h.

Constructor & Destructor Documentation

lhef::LHERunInfo::LHERunInfo ( std::istream &  in)

Definition at line 41 of file LHERunInfo.cc.

References comments, lhef::HEPRUP::EBMUP, heprup, i, lhef::HEPRUP::IDBMUP, lhef::HEPRUP::IDWTUP, init(), geometryCSVtoXML::line, lhef::HEPRUP::LPRUP, lhef::HEPRUP::NPRUP, lhef::HEPRUP::PDFGUP, lhef::HEPRUP::PDFSUP, lhef::HEPRUP::resize(), skipWhitespace(), AlCaHLTBitMon_QueryRunRegistry::string, lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

42 {
43  in >> heprup.IDBMUP.first >> heprup.IDBMUP.second
44  >> heprup.EBMUP.first >> heprup.EBMUP.second
45  >> heprup.PDFGUP.first >> heprup.PDFGUP.second
46  >> heprup.PDFSUP.first >> heprup.PDFSUP.second
47  >> heprup.IDWTUP >> heprup.NPRUP;
48  if (!in.good())
49  throw cms::Exception("InvalidFormat")
50  << "Les Houches file contained invalid"
51  " header in init section." << std::endl;
52 
53  heprup.resize();
54 
55  for(int i = 0; i < heprup.NPRUP; i++) {
56  in >> heprup.XSECUP[i] >> heprup.XERRUP[i]
57  >> heprup.XMAXUP[i] >> heprup.LPRUP[i];
58  if (!in.good())
59  throw cms::Exception("InvalidFormat")
60  << "Les Houches file contained invalid data"
61  " in header payload line " << (i + 1)
62  << "." << std::endl;
63  }
64 
65  while(skipWhitespace(in) == '#') {
67  std::getline(in, line);
68  comments.push_back(line + "\n");
69  }
70 
71  if (!in.eof())
72  edm::LogInfo("Generator|LHEInterface")
73  << "Les Houches file contained spurious"
74  " content after the regular data (this is normal for LHEv3 files for now)." << std::endl;
75 
76  init();
77 }
static XERCES_CPP_NAMESPACE_USE int skipWhitespace(std::istream &in)
Definition: LHERunInfo.cc:28
int i
Definition: DBlmapReader.cc:9
void resize(int nrup)
Definition: LesHouches.h:52
std::pair< double, double > EBMUP
Definition: LesHouches.h:78
std::pair< int, int > IDBMUP
Definition: LesHouches.h:73
std::pair< int, int > PDFGUP
Definition: LesHouches.h:84
std::vector< double > XERRUP
Definition: LesHouches.h:114
std::vector< double > XMAXUP
Definition: LesHouches.h:119
std::pair< int, int > PDFSUP
Definition: LesHouches.h:90
std::vector< std::string > comments
Definition: LHERunInfo.h:168
std::vector< double > XSECUP
Definition: LesHouches.h:108
std::vector< int > LPRUP
Definition: LesHouches.h:124
lhef::LHERunInfo::LHERunInfo ( const HEPRUP heprup)

Definition at line 79 of file LHERunInfo.cc.

References init().

79  :
80  heprup(heprup)
81 {
82  init();
83 }
lhef::LHERunInfo::LHERunInfo ( const HEPRUP heprup,
const std::vector< LHERunInfoProduct::Header > &  headers,
const std::vector< std::string > &  comments 
)

Definition at line 85 of file LHERunInfo.cc.

References filterCSVwithJSON::copy, and init().

87  :
88  heprup(heprup)
89 {
90  std::copy(headers.begin(), headers.end(),
91  std::back_inserter(this->headers));
92  std::copy(comments.begin(), comments.end(),
93  std::back_inserter(this->comments));
94 
95  init();
96 }
std::vector< std::string > comments
Definition: LHERunInfo.h:168
std::vector< Header > headers
Definition: LHERunInfo.h:167
lhef::LHERunInfo::LHERunInfo ( const LHERunInfoProduct product)

Definition at line 98 of file LHERunInfo.cc.

References comments, LHERunInfoProduct::comments_begin(), LHERunInfoProduct::comments_end(), filterCSVwithJSON::copy, headers, LHERunInfoProduct::headers_begin(), LHERunInfoProduct::headers_end(), and init().

98  :
99  heprup(product.heprup())
100 {
101  std::copy(product.headers_begin(), product.headers_end(),
102  std::back_inserter(headers));
103  std::copy(product.comments_begin(), product.comments_end(),
104  std::back_inserter(comments));
105 
106  init();
107 }
comments_const_iterator comments_end() const
headers_const_iterator headers_end() const
const lhef::HEPRUP & heprup() const
headers_const_iterator headers_begin() const
comments_const_iterator comments_begin() const
std::vector< std::string > comments
Definition: LHERunInfo.h:168
std::vector< Header > headers
Definition: LHERunInfo.h:167
lhef::LHERunInfo::~LHERunInfo ( )

Definition at line 109 of file LHERunInfo.cc.

110 {
111 }

Member Function Documentation

void lhef::LHERunInfo::addComment ( const std::string &  line)
inline

Definition at line 64 of file LHERunInfo.h.

64 { comments.push_back(line); }
std::vector< std::string > comments
Definition: LHERunInfo.h:168
void lhef::LHERunInfo::addHeader ( const Header header)
inline

Definition at line 63 of file LHERunInfo.h.

Referenced by lhef::LHEReader::next().

63 { headers.push_back(header); }
std::vector< Header > headers
Definition: LHERunInfo.h:167
void lhef::LHERunInfo::count ( int  process,
CountMode  count,
double  eventWeight = 1.0,
double  brWeight = 1.0,
double  matchWeight = 1.0 
)

Definition at line 147 of file LHERunInfo.cc.

References kAccepted, kKilled, kSelected, kTried, proc, LaserDQM_cfg::process, processes, and processesLumi.

149 {
150  std::vector<Process>::iterator proc =
151  std::lower_bound(processes.begin(), processes.end(), process);
152  if (proc == processes.end() || proc->process() != process)
153  return;
154 
155  std::vector<Process>::iterator procLumi =
156  std::lower_bound(processesLumi.begin(), processesLumi.end(), process);
157  if (procLumi == processesLumi.end() || procLumi->process() != process)
158  return;
159 
160  switch(mode) {
161  case kAccepted:
162  proc->addAcceptedBr(eventWeight * brWeight * matchWeight);
163  proc->addAccepted(eventWeight * matchWeight);
164  procLumi->addAcceptedBr(eventWeight * brWeight * matchWeight);
165  procLumi->addAccepted(eventWeight * matchWeight);
166  case kKilled:
167  proc->addKilled(eventWeight * matchWeight);
168  procLumi->addKilled(eventWeight * matchWeight);
169  if(eventWeight>0)
170  {
171  proc->addNPassPos();
172  procLumi->addNPassPos();
173  }
174  else
175  {
176  proc->addNPassNeg();
177  procLumi->addNPassNeg();
178  }
179  case kSelected:
180  proc->addSelected(eventWeight);
181  procLumi->addSelected(eventWeight);
182  if(eventWeight>0)
183  {
184  proc->addNTotalPos();
185  procLumi->addNTotalPos();
186  }
187  else
188  {
189  proc->addNTotalNeg();
190  procLumi->addNTotalNeg();
191  }
192  case kTried:
193  proc->addTried(eventWeight);
194  procLumi->addTried(eventWeight);
195  }
196 }
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< Process > processes
Definition: LHERunInfo.h:166
std::vector< Process > processesLumi
Definition: LHERunInfo.h:175
tuple process
Definition: LaserDQM_cfg.py:3
std::vector< std::string > lhef::LHERunInfo::findHeader ( const std::string &  tag) const

Definition at line 527 of file LHERunInfo.cc.

References lhef::domToLines(), headers, dbtoconf::root, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by gen::JetMatchingMadgraph::init(), gen::JetMatchingAlpgen::init(), gen::JetMatchingMGFastJet::init(), Herwig6Hadronizer::initialize(), gen::Pythia6Hadronizer::initializeForExternalPartons(), and Herwig6Hadronizer::readSettings().

528 {
529  const LHERunInfo::Header *header = 0;
530  for(std::vector<Header>::const_iterator iter = headers.begin();
531  iter != headers.end(); ++iter) {
532  if (iter->tag() == tag)
533  return std::vector<std::string>(iter->begin(),
534  iter->end());
535  if (iter->tag() == "header")
536  header = &*iter;
537  }
538 
539  if (!header)
540  return std::vector<std::string>();
541 
542  const DOMNode *root = header->getXMLNode();
543  if (!root)
544  return std::vector<std::string>();
545 
546  for(const DOMNode *iter = root->getFirstChild();
547  iter; iter = iter->getNextSibling()) {
548  if (iter->getNodeType() != DOMNode::ELEMENT_NODE)
549  continue;
550  if (tag == (const char*)XMLSimpleStr(iter->getNodeName()))
551  return domToLines(iter);
552  }
553 
554  return std::vector<std::string>();
555 }
static std::vector< std::string > domToLines(const DOMNode *node)
Definition: LHERunInfo.cc:508
std::vector< Header > headers
Definition: LHERunInfo.h:167
string root
initialization
Definition: dbtoconf.py:70
const std::vector<std::string>& lhef::LHERunInfo::getComments ( ) const
inline

Definition at line 59 of file LHERunInfo.h.

References comments.

59 { return comments; }
std::vector< std::string > comments
Definition: LHERunInfo.h:168
const std::vector<Header>& lhef::LHERunInfo::getHeaders ( ) const
inline

Definition at line 58 of file LHERunInfo.h.

References headers.

Referenced by edm::LHEProvenanceHelper::lheAugment(), and Herwig6Hadronizer::upInit().

58 { return headers; }
std::vector< Header > headers
Definition: LHERunInfo.h:167
const int lhef::LHERunInfo::getHEPIDWTUP ( ) const
inline

Definition at line 172 of file LHERunInfo.h.

References lhef::HEPRUP::IDWTUP.

172 {return heprup.IDWTUP;}
const HEPRUP* lhef::LHERunInfo::getHEPRUP ( ) const
inline
const std::vector<Process>& lhef::LHERunInfo::getLumiProcesses ( ) const
inline

Definition at line 171 of file LHERunInfo.h.

References processesLumi.

Referenced by edm::HadronizerFilter< HAD, DEC >::endLuminosityBlockProduce().

171 {return processesLumi;}
std::vector< Process > processesLumi
Definition: LHERunInfo.h:175
void lhef::LHERunInfo::init ( void  )
private

Definition at line 113 of file LHERunInfo.cc.

References heprup, i, lhef::HEPRUP::LPRUP, lhef::HEPRUP::NPRUP, proc, processes, lhef::LHERunInfo::Process::setHepRupIndex(), lhef::LHERunInfo::Process::setProcess(), and python.multivaluedict::sort().

Referenced by LHERunInfo().

114 {
115  for(int i = 0; i < heprup.NPRUP; i++) {
116  Process proc;
117  proc.setProcess(heprup.LPRUP[i]);
118  proc.setHepRupIndex((unsigned int)i);
119  processes.push_back(proc);
120  }
121 
122  std::sort(processes.begin(), processes.end());
123 }
int i
Definition: DBlmapReader.cc:9
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< Process > processes
Definition: LHERunInfo.h:166
std::vector< int > LPRUP
Definition: LesHouches.h:124
void lhef::LHERunInfo::initLumi ( )

Definition at line 125 of file LHERunInfo.cc.

References heprup, i, lhef::HEPRUP::LPRUP, lhef::HEPRUP::NPRUP, proc, processesLumi, lhef::LHERunInfo::Process::setHepRupIndex(), lhef::LHERunInfo::Process::setLHEXSec(), lhef::LHERunInfo::Process::setProcess(), python.multivaluedict::sort(), lhef::HEPRUP::XERRUP, and lhef::HEPRUP::XSECUP.

Referenced by edm::HadronizerFilter< HAD, DEC >::beginLuminosityBlock(), and edm::HadronizerFilter< HAD, DEC >::beginRun().

126 {
127  processesLumi.clear();
128  for(int i = 0; i < heprup.NPRUP; i++) {
129 
130  Process proc;
131  proc.setProcess(heprup.LPRUP[i]);
132  proc.setHepRupIndex((unsigned int)i);
133  proc.setLHEXSec(heprup.XSECUP[i],heprup.XERRUP[i]);
134  processesLumi.push_back(proc);
135 
136  }
137 
138  std::sort(processesLumi.begin(), processesLumi.end());
139 }
int i
Definition: DBlmapReader.cc:9
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< double > XERRUP
Definition: LesHouches.h:114
std::vector< Process > processesLumi
Definition: LHERunInfo.h:175
std::vector< double > XSECUP
Definition: LesHouches.h:108
std::vector< int > LPRUP
Definition: LesHouches.h:124
bool lhef::LHERunInfo::operator!= ( const LHERunInfo other) const
inline

Definition at line 55 of file LHERunInfo.h.

56  { return !(*this == other); }
bool lhef::LHERunInfo::operator== ( const LHERunInfo other) const

Definition at line 142 of file LHERunInfo.cc.

References heprup.

143 {
144  return heprup == other.heprup;
145 }
std::pair< int, int > lhef::LHERunInfo::pdfSetTranslation ( ) const

Definition at line 639 of file LHERunInfo.cc.

References heprup, lhef::HEPRUP::PDFGUP, and lhef::HEPRUP::PDFSUP.

Referenced by Herwig6Hadronizer::initialize(), and Herwig6Hadronizer::readSettings().

640 {
641  int pdfA = -1, pdfB = -1;
642 
643  if (heprup.PDFGUP.first >= 0) {
644  pdfA = heprup.PDFSUP.first;
645  }
646 
647  if (heprup.PDFGUP.second >= 0) {
648  pdfB = heprup.PDFSUP.second;
649  }
650 
651  return std::make_pair(pdfA, pdfB);
652 }
std::pair< int, int > PDFGUP
Definition: LesHouches.h:84
std::pair< int, int > PDFSUP
Definition: LesHouches.h:90
void lhef::LHERunInfo::statistics ( ) const

Definition at line 297 of file LHERunInfo.cc.

References gather_cfg::cout, cuy::denominator, heprup, lhef::HEPRUP::IDWTUP, customizeTrackingMonitorSeedNumber::idx, groupFilesInBlocks::ntotal, cuy::numerator, funct::pow(), proc, processes, mathSSE::sqrt(), lhef::HEPRUP::XERRUP, and lhef::HEPRUP::XSECUP.

Referenced by edm::HadronizerFilter< HAD, DEC >::endRunProduce().

298 {
299  double sigSelSum = 0.0;
300  double sigSum = 0.0;
301  double sigBrSum = 0.0;
302  double errSel2Sum = 0.0;
303  double err2Sum = 0.0;
304  double errBr2Sum = 0.0;
305  double errMatch2Sum = 0.0;
306  unsigned long nAccepted = 0;
307  unsigned long nTried = 0;
308  unsigned long nAccepted_pos = 0;
309  unsigned long nTried_pos = 0;
310  unsigned long nAccepted_neg = 0;
311  unsigned long nTried_neg = 0;
312  int idwtup = heprup.IDWTUP;
313 
314  std::cout << std::endl;
315  std::cout << "Process and cross-section statistics" << std::endl;
316  std::cout << "------------------------------------" << std::endl;
317  std::cout << "Process\t\txsec_before [pb]\t\tpassed\tnposw\tnnegw\ttried\tnposw\tnnegw \txsec_match [pb]\t\t\taccepted [%]\t event_eff [%]"
318  << std::endl;
319 
320  for(std::vector<Process>::const_iterator proc = processes.begin();
321  proc != processes.end(); ++proc) {
322  unsigned int idx = proc->heprupIndex();
323 
324  if (!proc->selected().n()) {
325  std::cout << proc->process() << "\t0\t0\tn/a\t\t\tn/a"
326  << std::endl;
327  continue;
328  }
329 
330  double sigma2Sum, sigma2Err;
331  sigma2Sum = heprup.XSECUP[idx]* heprup.XSECUP[idx];
332  sigma2Err = heprup.XERRUP[idx]* heprup.XERRUP[idx];
333 
334  double sigmaAvg = heprup.XSECUP[idx];
335 
336  double fracAcc = 0;
337  double ntotal = proc->nTotalPos()-proc->nTotalNeg();
338  double npass = proc->nPassPos() -proc->nPassNeg();
339  switch(idwtup){
340  case 3: case -3:
341  fracAcc = ntotal > 0? npass/ntotal: -1;
342  break;
343  default:
344  fracAcc = proc->selected().sum() > 0? proc->killed().sum() / proc->selected().sum():-1;
345  break;
346  }
347 
348 
349  double fracBr = proc->accepted().sum() > 0.0 ?
350  proc->acceptedBr().sum() / proc->accepted().sum() : 1;
351  double sigmaFin = fracAcc >0? sigmaAvg * fracAcc : 0;
352  double sigmaFinBr = sigmaFin * fracBr;
353 
354  double relErr = 1.0;
355  double relAccErr = 1.0;
356  double efferr2=0;
357 
358  if (proc->killed().n() > 0 && fracAcc > 0) {
359  switch(idwtup) {
360  case 3: case -3:
361  {
362  double ntotal_pos = proc->nTotalPos();
363  double effp = ntotal_pos > 0?
364  (double)proc->nPassPos()/ntotal_pos:0;
365  double effp_err2 = ntotal_pos > 0?
366  (1-effp)*effp/ntotal_pos: 0;
367 
368  double ntotal_neg = proc->nTotalNeg();
369  double effn = ntotal_neg > 0?
370  (double)proc->nPassNeg()/ntotal_neg:0;
371  double effn_err2 = ntotal_neg > 0?
372  (1-effn)*effn/ntotal_neg: 0;
373 
374  efferr2 = ntotal > 0 ?
375  (ntotal_pos*ntotal_pos*effp_err2 +
376  ntotal_neg*ntotal_neg*effn_err2)/ntotal/ntotal:0;
377  break;
378  }
379  default:
380  {
381  double denominator = pow(proc->selected().sum(),4);
382  double passw = proc->killed().sum();
383  double passw2 = proc->killed().sum2();
384  double failw = proc->selected().sum() - passw;
385  double failw2 = proc->selected().sum2() - passw2;
386  double numerator = (passw2*failw*failw + failw2*passw*passw);
387 
388  efferr2 = denominator>0?
389  numerator/denominator:0;
390  break;
391  }
392  }
393  double delta2Veto = efferr2/fracAcc/fracAcc;
394  double delta2Sum = delta2Veto
395  + sigma2Err / sigma2Sum;
396  relErr = (delta2Sum > 0.0 ?
397  std::sqrt(delta2Sum) : 0.0);
398  relAccErr = (delta2Veto > 0.0 ?
399  std::sqrt(delta2Veto) : 0.0);
400  }
401  double deltaFin = sigmaFin * relErr;
402  double deltaFinBr = sigmaFinBr * relErr;
403 
404  double ntotal_proc = proc->nTotalPos()+proc->nTotalNeg();
405  double event_eff_proc = ntotal_proc>0? (double)(proc->nPassPos()+ proc->nPassNeg())/ntotal_proc: -1;
406  double event_eff_err_proc = ntotal_proc>0? std::sqrt((1-event_eff_proc)*event_eff_proc/ntotal_proc): -1;
407 
408  std::cout << proc->process() << "\t\t"
409  << std::scientific << std::setprecision(3)
410  << heprup.XSECUP[proc->heprupIndex()] << " +/- "
411  << heprup.XERRUP[proc->heprupIndex()] << "\t\t"
412  << proc->accepted().n() << "\t"
413  << proc->nPassPos() << "\t"
414  << proc->nPassNeg() << "\t"
415  << proc->tried().n() << "\t"
416  << proc->nTotalPos() << "\t"
417  << proc->nTotalNeg() << "\t"
418  << std::scientific << std::setprecision(3)
419  << sigmaFinBr << " +/- "
420  << deltaFinBr << "\t\t"
421  << std::fixed << std::setprecision(1)
422  << (fracAcc * 100) << " +/- " << ( std::sqrt(efferr2) * 100) << "\t"
423  << std::fixed << std::setprecision(1)
424  << (event_eff_proc * 100) << " +/- " << ( event_eff_err_proc * 100)
425  << std::endl;
426 
427  nAccepted += proc->accepted().n();
428  nTried += proc->tried().n();
429  nAccepted_pos += proc->nPassPos();
430  nTried_pos += proc->nTotalPos();
431  nAccepted_neg += proc->nPassNeg();
432  nTried_neg += proc->nTotalNeg();
433  sigSelSum += sigmaAvg;
434  sigSum += sigmaFin;
435  sigBrSum += sigmaFinBr;
436  errSel2Sum += sigma2Err;
437  err2Sum += deltaFin * deltaFin;
438  errBr2Sum += deltaFinBr * deltaFinBr;
439  errMatch2Sum += sigmaFin*relAccErr*sigmaFin*relAccErr;
440  }
441 
442  double ntotal_all = (nTried_pos+nTried_neg);
443  double event_eff_all = ntotal_all>0? (double)(nAccepted_pos+nAccepted_neg)/ntotal_all: -1;
444  double event_eff_err_all = ntotal_all>0? std::sqrt((1-event_eff_all)*event_eff_all/ntotal_all): -1;
445 
446  std::cout << "Total\t\t"
447  << std::scientific << std::setprecision(3)
448  << sigSelSum << " +/- " << std::sqrt(errSel2Sum) << "\t\t"
449  << nAccepted << "\t"
450  << nAccepted_pos << "\t"
451  << nAccepted_neg << "\t"
452  << nTried << "\t"
453  << nTried_pos << "\t"
454  << nTried_neg << "\t"
455  << std::scientific << std::setprecision(3)
456  << sigBrSum << " +/- "
457  << std::sqrt(errBr2Sum) << "\t\t"
458  << std::fixed << std::setprecision(1)
459  << (sigSum / sigSelSum * 100) << " +/- " << (std::sqrt(errMatch2Sum)/sigSelSum * 100) << "\t"
460  << std::fixed << std::setprecision(1)
461  << (event_eff_all * 100) << " +/- " << (event_eff_err_all * 100)
462  << std::endl;
463 }
list numerator
Definition: cuy.py:483
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< Process > processes
Definition: LHERunInfo.h:166
list denominator
Definition: cuy.py:484
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< double > XERRUP
Definition: LesHouches.h:114
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple cout
Definition: gather_cfg.py:121
std::vector< double > XSECUP
Definition: LesHouches.h:108
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
LHERunInfo::XSec lhef::LHERunInfo::xsec ( ) const

Definition at line 199 of file LHERunInfo.cc.

References cuy::denominator, heprup, lhef::HEPRUP::IDWTUP, customizeTrackingMonitorSeedNumber::idx, groupFilesInBlocks::ntotal, cuy::numerator, funct::pow(), proc, processes, query::result, mathSSE::sqrt(), lhef::HEPRUP::XERRUP, and lhef::HEPRUP::XSECUP.

Referenced by edm::HadronizerFilter< HAD, DEC >::endRunProduce().

200 {
201  double sigSelSum = 0.0;
202  double sigSum = 0.0;
203  double sigBrSum = 0.0;
204  double err2Sum = 0.0;
205  double errBr2Sum = 0.0;
206  int idwtup = heprup.IDWTUP;
207  for(std::vector<Process>::const_iterator proc = processes.begin();
208  proc != processes.end(); ++proc) {
209  unsigned int idx = proc->heprupIndex();
210 
211  if (!proc->killed().n())
212  continue;
213 
214  double sigma2Sum, sigma2Err;
215  sigma2Sum = heprup.XSECUP[idx]* heprup.XSECUP[idx];
216  sigma2Err = heprup.XERRUP[idx]* heprup.XERRUP[idx];
217 
218  double sigmaAvg = heprup.XSECUP[idx];
219 
220  double fracAcc = 0;
221  double ntotal = proc->nTotalPos()-proc->nTotalNeg();
222  double npass = proc->nPassPos() -proc->nPassNeg();
223  switch(idwtup){
224  case 3: case -3:
225  fracAcc = ntotal > 0? npass/ntotal: -1;
226  break;
227  default:
228  fracAcc = proc->selected().sum() > 0? proc->killed().sum() / proc->selected().sum():-1;
229  break;
230  }
231 
232  if(fracAcc<=0)continue;
233 
234  double fracBr = proc->accepted().sum() > 0.0 ?
235  proc->acceptedBr().sum() / proc->accepted().sum() : 1;
236  double sigmaFin = sigmaAvg * fracAcc ;
237  double sigmaFinBr = sigmaFin * fracBr;
238 
239  double relErr = 1.0;
240 
241  double efferr2=0;
242  switch(idwtup) {
243  case 3: case -3:
244  {
245  double ntotal_pos = proc->nTotalPos();
246  double effp = ntotal_pos > 0?
247  (double)proc->nPassPos()/ntotal_pos:0;
248  double effp_err2 = ntotal_pos > 0?
249  (1-effp)*effp/ntotal_pos: 0;
250 
251  double ntotal_neg = proc->nTotalNeg();
252  double effn = ntotal_neg > 0?
253  (double)proc->nPassNeg()/ntotal_neg:0;
254  double effn_err2 = ntotal_neg > 0?
255  (1-effn)*effn/ntotal_neg: 0;
256 
257  efferr2 = ntotal > 0 ?
258  (ntotal_pos*ntotal_pos*effp_err2 +
259  ntotal_neg*ntotal_neg*effn_err2)/ntotal/ntotal:0;
260  break;
261  }
262  default:
263  {
264  double denominator = pow(proc->selected().sum(),4);
265  double passw = proc->killed().sum();
266  double passw2 = proc->killed().sum2();
267  double failw = proc->selected().sum() - passw;
268  double failw2 = proc->selected().sum2() - passw2;
269  double numerator = (passw2*failw*failw + failw2*passw*passw);
270 
271  efferr2 = denominator > 0?
272  numerator/denominator:0;
273  break;
274  }
275  }
276  double delta2Veto = efferr2/fracAcc/fracAcc;
277  double delta2Sum = delta2Veto
278  + sigma2Err / sigma2Sum;
279  relErr = (delta2Sum > 0.0 ?
280  std::sqrt(delta2Sum) : 0.0);
281 
282  double deltaFin = sigmaFin * relErr;
283  double deltaFinBr = sigmaFinBr * relErr;
284 
285  sigSelSum += sigmaAvg;
286  sigSum += sigmaFin;
287  sigBrSum += sigmaFinBr;
288  err2Sum += deltaFin * deltaFin;
289  errBr2Sum += deltaFinBr * deltaFinBr;
290  }
291 
292  XSec result(sigBrSum,std::sqrt(errBr2Sum));
293 
294  return result;
295 }
list numerator
Definition: cuy.py:483
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< Process > processes
Definition: LHERunInfo.h:166
list denominator
Definition: cuy.py:484
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
std::vector< double > XERRUP
Definition: LesHouches.h:114
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< double > XSECUP
Definition: LesHouches.h:108
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

std::vector<std::string> lhef::LHERunInfo::comments
private

Definition at line 168 of file LHERunInfo.h.

Referenced by getComments(), and LHERunInfo().

std::vector<Header> lhef::LHERunInfo::headers
private
HEPRUP lhef::LHERunInfo::heprup
private
std::vector<Process> lhef::LHERunInfo::processes
private

Definition at line 166 of file LHERunInfo.h.

Referenced by count(), init(), statistics(), and xsec().

std::vector<Process> lhef::LHERunInfo::processesLumi
private

Definition at line 175 of file LHERunInfo.h.

Referenced by count(), getLumiProcesses(), and initLumi().