CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
TSLToyGen Class Reference

#include <TSLToyGen.h>

Inheritance diagram for TSLToyGen:

Public Member Functions

Bool_t doToyExperiments (Int_t nbExperiments=1000)
 
void setCheckConstraintsTruth (Bool_t value)
 
void setMassConstraint (Bool_t value)
 
void setMPDGCons (Bool_t value)
 
void setprintConsAfter (Bool_t value)
 
void setprintConsBefore (Bool_t value)
 
void setprintConsIni (Bool_t value)
 
void setprintPartAfter (Bool_t value)
 
void setprintPartIni (Bool_t value)
 
void setprintSmearedPartBefore (Bool_t value)
 
 TSLToyGen (const TAbsFitParticle *bReco, const TAbsFitParticle *lepton, const TAbsFitParticle *X, const TAbsFitParticle *neutrino)
 
 ~TSLToyGen () override
 

Public Attributes

TH1D * _histChi2
 
TH1D * _histMBrecoFit
 
TH1D * _histMBrecoSmear
 
TH1D * _histMBrecoTrue
 
TH1D * _histMXFit
 
TH1D * _histMXlnuFit
 
TH1D * _histMXlnuSmear
 
TH1D * _histMXlnuTrue
 
TH1D * _histMXSmear
 
TH1D * _histMXTrue
 
TH1D * _histNIter
 
TH1D * _histPChi2
 
TObjArray _histsDiff1
 
TObjArray _histsDiff2
 
TObjArray _histsError1
 
TObjArray _histsError2
 
TObjArray _histsParFit
 
TObjArray _histsParSmear
 
TObjArray _histsParTrue
 
TObjArray _histsPull1
 
TObjArray _histsPull2
 
TH1D * _histStatus
 

Protected Member Functions

void createHists ()
 
void fillM ()
 
void fillPar ()
 
void fillPull1 ()
 
void fillPull2 ()
 
void smearParticles ()
 

Private Attributes

TAbsFitParticle_breco
 
Bool_t _doCheckConstraintsTruth
 
TAbsFitParticle_iniBreco
 
TAbsFitParticle_iniLepton
 
std::vector< TAbsFitParticle * > _inimeasParticles
 
TAbsFitParticle_iniNeutrino
 
std::vector< TAbsFitParticle * > _iniunmeasParticles
 
TAbsFitParticle_iniX
 
TAbsFitParticle_lepton
 
std::vector< TAbsFitParticle * > _measParticles
 
TAbsFitParticle_neutrino
 
Bool_t _printConsAfter
 
Bool_t _printConsBefore
 
Bool_t _printConsIni
 
Bool_t _printPartAfter
 
Bool_t _printPartIni
 
Bool_t _printSmearedPartBefore
 
std::vector< TAbsFitParticle * > _unmeasParticles
 
Bool_t _withMassConstraint
 
Bool_t _withMPDGCons
 
TAbsFitParticle_X
 
TVector3 _Y4S
 

Detailed Description

Definition at line 12 of file TSLToyGen.h.

Constructor & Destructor Documentation

◆ TSLToyGen()

TSLToyGen::TSLToyGen ( const TAbsFitParticle bReco,
const TAbsFitParticle lepton,
const TAbsFitParticle X,
const TAbsFitParticle neutrino 
)

Definition at line 12 of file TSLToyGen.cc.

16  : _inimeasParticles(0),
18  _measParticles(0),
20  _Y4S(0., 0., 0.)
21 
22 {
23  // Clone input particles
24  _iniBreco = bReco->clone(bReco->GetName() + (TString) "INI");
25  _breco = bReco->clone(bReco->GetName() + (TString) "SMEAR");
26  _iniLepton = lepton->clone(lepton->GetName() + (TString) "INI");
27  _lepton = lepton->clone(lepton->GetName() + (TString) "SMEAR");
28  _iniX = X->clone(X->GetName() + (TString) "INI");
29  _X = X->clone(X->GetName() + (TString) "SMEAR");
30  _iniNeutrino = neutrino->clone(neutrino->GetName() + (TString) "INI");
31  _neutrino = neutrino->clone(neutrino->GetName() + (TString) "SMEAR");
32 
33  _printPartIni = false;
34  _printConsIni = false;
36  _printConsBefore = false;
37  _printConsAfter = false;
38  _printPartAfter = false;
39  _withMassConstraint = false;
40  _withMPDGCons = false;
42 }

References _breco, _doCheckConstraintsTruth, _iniBreco, _iniLepton, _iniNeutrino, _iniX, _lepton, _neutrino, _printConsAfter, _printConsBefore, _printConsIni, _printPartAfter, _printPartIni, _printSmearedPartBefore, _withMassConstraint, _withMPDGCons, _X, TAbsFitParticle::clone(), and X.

◆ ~TSLToyGen()

TSLToyGen::~TSLToyGen ( )
override

Definition at line 44 of file TSLToyGen.cc.

44  {
45  delete _iniBreco;
46  delete _iniLepton;
47  delete _iniX;
48  delete _iniNeutrino;
49 
50  delete _breco;
51  delete _lepton;
52  delete _X;
53  delete _neutrino;
54 }

References _breco, _iniBreco, _iniLepton, _iniNeutrino, _iniX, _lepton, _neutrino, and _X.

Member Function Documentation

◆ createHists()

void TSLToyGen::createHists ( )
protected

Definition at line 324 of file TSLToyGen.cc.

324  {
325  _histStatus = new TH1D("hStatus", "Status of the Fit", 16, -1, 15);
326  _histNIter = new TH1D("hNIter", "Number of iterations", 100, 0, 100);
327  _histPChi2 = new TH1D("hPChi2", "Chi2 probability", 100, 0., 1.);
328  _histChi2 = new TH1D("hChi2", "Chi2 ", 200, 0., 20.);
329  _histMBrecoTrue = new TH1D("histMBrecoTrue", "histMBrecoTrue", 2000, 4., 6.);
330  _histMBrecoSmear = new TH1D("histMBrecoSmear", "histMBrecoSmear", 2000, 4., 6.);
331  _histMBrecoFit = new TH1D("histMBrecoFit", "histMBrecoFit", 2000, 4., 6.);
332  _histMXTrue = new TH1D("histMXTrue", "histMXTrue", 600, 0., 6.);
333  _histMXSmear = new TH1D("histMXSmear", "histMXSmear", 600, 0., 6.);
334  _histMXFit = new TH1D("histMXFit", "histMXFit", 600, 0., 6.);
335  _histMXlnuTrue = new TH1D("histMXlnuTrue", "histMXlnuTrue", 3000, 4., 7.);
336  _histMXlnuSmear = new TH1D("histMXlnuSmear", "histMXlnuSmear", 500, 3., 8.);
337  _histMXlnuFit = new TH1D("histMXlnuFit", "histMXlnuFit", 3000, 4., 7.);
338 
339  _histsParTrue.Clear();
340  _histsParSmear.Clear();
341  _histsParFit.Clear();
342  _histsPull1.Clear();
343  _histsError1.Clear();
344  _histsDiff1.Clear();
345  _histsPull2.Clear();
346  _histsError2.Clear();
347  _histsDiff2.Clear();
348 
349  TObjArray histarrays;
350  histarrays.Add(&_histsParTrue);
351  histarrays.Add(&_histsParSmear);
352  histarrays.Add(&_histsParFit);
353  histarrays.Add(&_histsPull1);
354  histarrays.Add(&_histsError1);
355  histarrays.Add(&_histsDiff1);
356  histarrays.Add(&_histsPull2);
357  histarrays.Add(&_histsError2);
358  histarrays.Add(&_histsDiff2);
359 
360  TString histnames[] = {
361  "hParTrue", "hParSmear", "hParFit", "hPull1", "hError1", "hDiff1", "hPull2", "hError2", "hDiff2"};
362 
363  TArrayD arrmin(histarrays.GetEntries());
364  TArrayD arrmax(histarrays.GetEntries());
365  arrmin[0] = 0.;
366  arrmax[0] = 2.; // Parameters
367  arrmin[1] = 0.;
368  arrmax[1] = 2.;
369  arrmin[2] = 0.;
370  arrmax[2] = 2.;
371 
372  arrmin[3] = -3.;
373  arrmax[3] = 3.; // Pull1
374  arrmin[4] = 0.;
375  arrmax[4] = .2; //Error1
376  arrmin[5] = -.5;
377  arrmax[5] = .5; //Diff1
378  arrmin[6] = -3.;
379  arrmax[6] = 3.; // Pull2
380  arrmin[7] = 0.;
381  arrmax[7] = 0.2; //Error2
382  arrmin[8] = -.5;
383  arrmax[8] = .5; //Diff2
384 
385  for (unsigned int p = 0; p < _measParticles.size(); p++) {
386  const TAbsFitParticle* particle = _measParticles[p];
387  // const TMatrixD* covMatrix = particle->getCovMatrix();
388 
389  for (int i = 0; i < particle->getNPar(); i++) {
390  for (int h = 0; h < histarrays.GetEntries(); h++) {
391  TString name = histnames[h] + (TString)particle->GetName();
392  name += i;
393  if (h < 3) {
394  const TMatrixD* parfit = _measParticles[p]->getParCurr();
395  arrmin[h] = (*parfit)(i, 0) * 0.5;
396  arrmax[h] = (*parfit)(i, 0) * 1.5;
397  }
398  TH1D* newhisto = new TH1D(name, name, 100, arrmin[h], arrmax[h]);
399  ((TObjArray*)histarrays[h])->Add(newhisto);
400 
401  // newhisto->SetCanExtend(TH1::kAllAxes);
402  }
403  }
404  }
405 }

References _histChi2, _histMBrecoFit, _histMBrecoSmear, _histMBrecoTrue, _histMXFit, _histMXlnuFit, _histMXlnuSmear, _histMXlnuTrue, _histMXSmear, _histMXTrue, _histNIter, _histPChi2, _histsDiff1, _histsDiff2, _histsError1, _histsError2, _histsParFit, _histsParSmear, _histsParTrue, _histsPull1, _histsPull2, _histStatus, _measParticles, TAbsFitParticle::getNPar(), h, mps_fire::i, Skims_PA_cff::name, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by doToyExperiments().

◆ doToyExperiments()

Bool_t TSLToyGen::doToyExperiments ( Int_t  nbExperiments = 1000)

Definition at line 56 of file TSLToyGen.cc.

56  {
57  // define fitter
58  TKinFitter fitter;
59 
60  std::vector<TAbsFitParticle*> ParVec(0);
61  ParVec.push_back(_breco);
62  ParVec.push_back(_lepton);
63  ParVec.push_back(_X);
64  ParVec.push_back(_neutrino);
65 
66  fitter.addMeasParticle(_breco);
67  _inimeasParticles.push_back(_iniBreco);
68  _measParticles.push_back(_breco);
69  fitter.addMeasParticle(_lepton);
70  _inimeasParticles.push_back(_iniLepton);
71  _measParticles.push_back(_lepton);
72  fitter.addMeasParticle(_X);
73  _inimeasParticles.push_back(_iniX);
74  _measParticles.push_back(_X);
77  _iniunmeasParticles.push_back(_neutrino);
78 
79  // Calculate Y4S
80  _Y4S.SetXYZ(0., 0., 0.);
81  for (unsigned int p = 0; p < _inimeasParticles.size(); p++) {
82  _Y4S += _inimeasParticles[p]->getIni4Vec()->Vect();
83  }
84  _Y4S += _iniNeutrino->getIni4Vec()->Vect();
85  //_Y4S.SetXYZ(-0.1212, -0.0033, 5.8784);
86  Double_t EY4S = TMath::Sqrt(_Y4S.Mag2() + 10.58 * 10.58);
87  // std::cout << "_Y4S : " <<_Y4S.x() << " / " << _Y4S.y() << " / " << _Y4S.z() << " / " <<EY4S<< std::endl;
88 
89  TFitConstraintEp pXCons("pX", "pX", &ParVec, TFitConstraintEp::pX, _Y4S.x());
90  TFitConstraintEp pYCons("pY", "pY", &ParVec, TFitConstraintEp::pY, _Y4S.y());
91  TFitConstraintEp pZCons("pZ", "pZ", &ParVec, TFitConstraintEp::pZ, _Y4S.z());
92  TFitConstraintEp ECons("E", "E", &ParVec, TFitConstraintEp::E, EY4S);
93  TFitConstraintM MCons("MassConstraint", "Mass-Constraint", nullptr, nullptr, 0);
94  MCons.addParticle1(_breco);
95  MCons.addParticles2(_lepton, _neutrino, _X);
96  TFitConstraintM MPDGCons("MPDGCons", "MPDGCons", nullptr, nullptr, 5.279);
97  MPDGCons.addParticles1(_lepton, _neutrino, _X);
98  // TFitConstraintE EBCons( "EBXlnuCons", "EBXlnuCons", 0, 0 );
99  // EBCons.addParticle1( _breco );
100  // EBCons.addParticles2( _lepton, _neutrino, _X );
101 
102  fitter.addConstraint(&pXCons);
103  fitter.addConstraint(&pYCons);
104  fitter.addConstraint(&pZCons);
105  fitter.addConstraint(&ECons);
107  fitter.addConstraint(&MCons);
108  if (_withMPDGCons)
109  fitter.addConstraint(&MPDGCons);
110  // fitter.addConstraint(&EBCons);
111 
112  fitter.setMaxNbIter(50);
113  fitter.setMaxDeltaS(5e-5);
114  fitter.setMaxF(1e-4);
115  fitter.setVerbosity(0);
116 
117  if (_printPartIni) {
118  std::cout << std::endl << "----------------------------------" << std::endl;
119  std::cout << "--- PRINTING INITIAL PARTICLES ---" << std::endl;
120  std::cout << "----------------------------------" << std::endl;
121  _iniBreco->print();
122  _iniLepton->print();
123  _iniX->print();
124  _iniNeutrino->print();
125  std::cout << std::endl << std::endl;
126  }
127 
128  if (_printConsIni) {
129  std::cout << std::endl << "-------------------------------------------------" << std::endl;
130  std::cout << "INITIAL CONSTRAINTS " << std::endl;
131  std::cout << "-------------------------------------------------" << std::endl;
132  std::cout << " M: " << MCons.getCurrentValue() << " MPDG: " << MPDGCons.getCurrentValue()
133  << " px: " << pXCons.getCurrentValue() << " py: " << pYCons.getCurrentValue()
134  << " pz: " << pZCons.getCurrentValue() << " E: " << ECons.getCurrentValue() << std::endl
135  << std::endl;
136  }
137 
138  // Check initial constraints
140  if (fitter.getF() > fitter.getMaxF()) {
141  //std::cout << "Initial constraints are not fulfilled." << std::endl;
142  return false;
143  }
144  }
145 
146  // create histograms
147  createHists();
148 
149  // perform pseudo experiments
150  for (int i = 0; i < nbExperiments; i++) {
151  smearParticles();
152 
154  std::cout << std::endl << "-------------------------------------------------------" << std::endl;
155  std::cout << "--- PRINTING SMEARED PARTICLES BEFORE FIT FOR experiment # " << i + 1 << std::endl;
156  std::cout << "-------------------------------------------------------" << std::endl;
157  _breco->print();
158  _lepton->print();
159  _X->print();
160  _neutrino->print();
161  }
162 
163  if (_printConsBefore) {
164  std::cout << std::endl << "-------------------------------------------------" << std::endl;
165  std::cout << "INITIAL (SMEARED) CONSTRAINTS FOR experiment # " << i + 1 << std::endl;
166  std::cout << "-------------------------------------------------" << std::endl;
167  std::cout << " M: " << MCons.getCurrentValue() << " px: " << pXCons.getCurrentValue()
168  << " py: " << pYCons.getCurrentValue() << " pz: " << pZCons.getCurrentValue()
169  << " E: " << ECons.getCurrentValue() << std::endl
170  << std::endl;
171  }
172 
173  fitter.fit();
174 
175  if (_printConsAfter) {
176  std::cout << std::endl << "-------------------------------------------------" << std::endl;
177  std::cout << " CONSTRAINTS AFTER FIT FOR experiment # " << i + 1 << std::endl;
178  std::cout << "-------------------------------------------------" << std::endl;
179  std::cout << " M: " << MCons.getCurrentValue() << " MPDG: " << MPDGCons.getCurrentValue()
180  << " px: " << pXCons.getCurrentValue() << " py: " << pYCons.getCurrentValue()
181  << " pz: " << pZCons.getCurrentValue() << " E: " << ECons.getCurrentValue() << std::endl
182  << std::endl;
183  }
184 
185  if (_printPartAfter) {
186  std::cout << std::endl << "--------------------------------------------------------" << std::endl;
187  std::cout << "--- PRINTING PARTICLES AFTER FIT FOR experiment # " << i + 1 << std::endl;
188  std::cout << "--------------------------------------------------------" << std::endl;
189  _breco->print();
190  _lepton->print();
191  _X->print();
192  _neutrino->print();
193  }
194 
195  _histStatus->Fill(fitter.getStatus());
196  _histNIter->Fill(fitter.getNbIter());
197  if (fitter.getStatus() == 0) {
198  _histPChi2->Fill(TMath::Prob(fitter.getS(), fitter.getNDF()));
199  _histChi2->Fill(fitter.getS());
200  fillPull1();
201  fillPull2();
202  fillPar();
203  fillM();
204  }
205 
206  if (i % 176 == 0) {
207  std::cout << "\r";
208  std::cout << " ------ " << (Double_t)i / nbExperiments * 100. << " % PROCESSED ------";
209  std::cout.flush();
210  }
211  }
212 
213  return true;
214 }

References _breco, _doCheckConstraintsTruth, _histChi2, _histNIter, _histPChi2, _histStatus, _iniBreco, _iniLepton, _inimeasParticles, _iniNeutrino, _iniunmeasParticles, _iniX, _lepton, _measParticles, _neutrino, _printConsAfter, _printConsBefore, _printConsIni, _printPartAfter, _printPartIni, _printSmearedPartBefore, _withMassConstraint, _withMPDGCons, _X, _Y4S, TKinFitter::addConstraint(), TKinFitter::addMeasParticle(), TFitConstraintM::addParticle1(), TFitConstraintM::addParticles1(), TFitConstraintM::addParticles2(), TKinFitter::addUnmeasParticle(), gather_cfg::cout, createHists(), TFitConstraintEp::E, MillePedeFileConverter_cfg::e, fillM(), fillPar(), fillPull1(), fillPull2(), TKinFitter::fit(), TFitConstraintM::getCurrentValue(), TKinFitter::getF(), TAbsFitParticle::getIni4Vec(), TKinFitter::getMaxF(), TKinFitter::getNbIter(), TKinFitter::getNDF(), TKinFitter::getS(), TKinFitter::getStatus(), mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, TAbsFitParticle::print(), TFitConstraintEp::pX, TFitConstraintEp::pY, TFitConstraintEp::pZ, TKinFitter::setMaxDeltaS(), TKinFitter::setMaxF(), TKinFitter::setMaxNbIter(), TKinFitter::setVerbosity(), and smearParticles().

◆ fillM()

void TSLToyGen::fillM ( )
protected

Definition at line 299 of file TSLToyGen.cc.

299  {
300  _histMBrecoTrue->Fill(_iniBreco->getIni4Vec()->M());
301  _histMBrecoSmear->Fill(_breco->getIni4Vec()->M());
302  _histMBrecoFit->Fill(_breco->getCurr4Vec()->M());
303 
304  _histMXTrue->Fill(_iniX->getIni4Vec()->M());
305  _histMXSmear->Fill(_X->getIni4Vec()->M());
306  _histMXFit->Fill(_X->getCurr4Vec()->M());
307 
308  TLorentzVector xlnutrue = *(_iniLepton->getIni4Vec());
309  xlnutrue += *(_iniX->getIni4Vec());
310  xlnutrue += *(_iniNeutrino->getIni4Vec());
311  _histMXlnuTrue->Fill(xlnutrue.M());
312 
313  TLorentzVector xlnusmear = *(_lepton->getIni4Vec());
314  xlnusmear += *(_X->getIni4Vec());
315  xlnusmear += *(_neutrino->getIni4Vec());
316  _histMXlnuSmear->Fill(xlnusmear.M());
317 
318  TLorentzVector xlnufit = *(_lepton->getCurr4Vec());
319  xlnufit += *(_X->getCurr4Vec());
320  xlnufit += *(_neutrino->getCurr4Vec());
321  _histMXlnuFit->Fill(xlnufit.M());
322 }

References _breco, _histMBrecoFit, _histMBrecoSmear, _histMBrecoTrue, _histMXFit, _histMXlnuFit, _histMXlnuSmear, _histMXlnuTrue, _histMXSmear, _histMXTrue, _iniBreco, _iniLepton, _iniNeutrino, _iniX, _lepton, _neutrino, _X, TAbsFitParticle::getCurr4Vec(), and TAbsFitParticle::getIni4Vec().

Referenced by doToyExperiments().

◆ fillPar()

void TSLToyGen::fillPar ( )
protected

Definition at line 284 of file TSLToyGen.cc.

284  {
285  Int_t histindex = 0;
286  for (unsigned int p = 0; p < _measParticles.size(); p++) {
287  const TMatrixD* partrue = _inimeasParticles[p]->getParIni();
288  const TMatrixD* parsmear = _measParticles[p]->getParIni();
289  const TMatrixD* parfit = _measParticles[p]->getParCurr();
290  for (int i = 0; i < partrue->GetNrows(); i++) {
291  ((TH1D*)_histsParTrue[histindex])->Fill((*partrue)(i, 0));
292  ((TH1D*)_histsParSmear[histindex])->Fill((*parsmear)(i, 0));
293  ((TH1D*)_histsParFit[histindex])->Fill((*parfit)(i, 0));
294  histindex++;
295  }
296  }
297 }

References _histsParFit, _histsParSmear, _histsParTrue, _inimeasParticles, _measParticles, mps_fire::i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by doToyExperiments().

◆ fillPull1()

void TSLToyGen::fillPull1 ( )
protected

Definition at line 246 of file TSLToyGen.cc.

246  {
247  Int_t histindex = 0;
248  for (unsigned int p = 0; p < _measParticles.size(); p++) {
249  //const TAbsFitParticle* particle = _measParticles[p];
250  TLorentzVector vectrue(*_inimeasParticles[p]->getIni4Vec());
251  TMatrixD* partrue = _measParticles[p]->transform(vectrue);
252  const TMatrixD* parfit = _measParticles[p]->getParCurr();
253 
254  TMatrixD parpull(*parfit);
255  parpull -= (*partrue);
256  const TMatrixD* covMatrixFit = _measParticles[p]->getCovMatrixFit();
257  for (int i = 0; i < parpull.GetNrows(); i++) {
258  ((TH1D*)_histsDiff1[histindex])->Fill(parpull(i, 0));
259  parpull(i, 0) /= TMath::Sqrt((*covMatrixFit)(i, i));
260  ((TH1D*)_histsPull1[histindex])->Fill(parpull(i, 0));
261  ((TH1D*)_histsError1[histindex])->Fill(TMath::Sqrt((*covMatrixFit)(i, i)));
262  histindex++;
263  }
264  delete partrue;
265  }
266 }

References _histsDiff1, _histsError1, _histsPull1, _inimeasParticles, _measParticles, mps_fire::i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by doToyExperiments().

◆ fillPull2()

void TSLToyGen::fillPull2 ( )
protected

Definition at line 268 of file TSLToyGen.cc.

268  {
269  Int_t histindex = 0;
270  for (unsigned int p = 0; p < _measParticles.size(); p++) {
271  const TMatrixD* pull = _measParticles[p]->getPull();
272  const TMatrixD* VDeltaY = _measParticles[p]->getCovMatrixDeltaY();
273  TMatrixD pardiff(*(_measParticles[p]->getParCurr()));
274  pardiff -= *(_measParticles[p]->getParIni());
275  for (int i = 0; i < pull->GetNrows(); i++) {
276  ((TH1D*)_histsPull2[histindex])->Fill((*pull)(i, 0));
277  ((TH1D*)_histsError2[histindex])->Fill(TMath::Sqrt((*VDeltaY)(i, i)));
278  ((TH1D*)_histsDiff2[histindex])->Fill(pardiff(i, 0));
279  histindex++;
280  }
281  }
282 }

References _histsDiff2, _histsError2, _histsPull2, _measParticles, mps_fire::i, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by doToyExperiments().

◆ setCheckConstraintsTruth()

void TSLToyGen::setCheckConstraintsTruth ( Bool_t  value)
inline

Definition at line 56 of file TSLToyGen.h.

References _doCheckConstraintsTruth, and relativeConstraints::value.

◆ setMassConstraint()

void TSLToyGen::setMassConstraint ( Bool_t  value)
inline

Definition at line 54 of file TSLToyGen.h.

References _withMassConstraint, and relativeConstraints::value.

◆ setMPDGCons()

void TSLToyGen::setMPDGCons ( Bool_t  value)
inline

Definition at line 55 of file TSLToyGen.h.

55 { _withMPDGCons = value; }

References _withMPDGCons, and relativeConstraints::value.

◆ setprintConsAfter()

void TSLToyGen::setprintConsAfter ( Bool_t  value)
inline

Definition at line 52 of file TSLToyGen.h.

References _printConsAfter, and relativeConstraints::value.

◆ setprintConsBefore()

void TSLToyGen::setprintConsBefore ( Bool_t  value)
inline

Definition at line 51 of file TSLToyGen.h.

References _printConsBefore, and relativeConstraints::value.

◆ setprintConsIni()

void TSLToyGen::setprintConsIni ( Bool_t  value)
inline

Definition at line 48 of file TSLToyGen.h.

48 { _printConsIni = value; }

References _printConsIni, and relativeConstraints::value.

◆ setprintPartAfter()

void TSLToyGen::setprintPartAfter ( Bool_t  value)
inline

Definition at line 50 of file TSLToyGen.h.

References _printPartAfter, and relativeConstraints::value.

◆ setprintPartIni()

void TSLToyGen::setprintPartIni ( Bool_t  value)
inline

Definition at line 47 of file TSLToyGen.h.

47 { _printPartIni = value; }

References _printPartIni, and relativeConstraints::value.

◆ setprintSmearedPartBefore()

void TSLToyGen::setprintSmearedPartBefore ( Bool_t  value)
inline

Definition at line 49 of file TSLToyGen.h.

References _printSmearedPartBefore, and relativeConstraints::value.

◆ smearParticles()

void TSLToyGen::smearParticles ( )
protected

Definition at line 216 of file TSLToyGen.cc.

216  {
217  // Smear measured particles
218 
219  for (unsigned int p = 0; p < _measParticles.size(); p++) {
220  TAbsFitParticle* particle = _measParticles[p];
221  TAbsFitParticle* iniParticle = _inimeasParticles[p];
222  TMatrixD parIni(*(iniParticle->getParIni()));
223  const TMatrixD* covM = iniParticle->getCovMatrix();
224  for (int m = 0; m < iniParticle->getNPar(); m++) {
225  parIni(m, 0) += gRandom->Gaus(0., TMath::Sqrt((*covM)(m, m)));
226  }
227  TLorentzVector* ini4Vec = iniParticle->calc4Vec(&parIni);
228  particle->setIni4Vec(ini4Vec);
229  delete ini4Vec;
230  TLorentzVector vectrue(*_inimeasParticles[p]->getIni4Vec());
231  TMatrixD* partrue = _measParticles[p]->transform(vectrue);
232  //_measParticles[p]->setParIni(partrue);
233  delete partrue;
234  }
235 
236  // Calculate neutrino
237  TVector3 nuP3 = _Y4S;
238  for (unsigned int p = 0; p < _measParticles.size(); p++) {
239  nuP3 -= _measParticles[p]->getCurr4Vec()->Vect();
240  }
241  TLorentzVector ini4VecNeutrino;
242  ini4VecNeutrino.SetXYZM(nuP3.X(), nuP3.Y(), nuP3.Z(), 0.);
243  _neutrino->setIni4Vec(&ini4VecNeutrino);
244 }

References _inimeasParticles, _measParticles, _neutrino, _Y4S, TAbsFitParticle::calc4Vec(), TAbsFitParticle::getCovMatrix(), TAbsFitParticle::getNPar(), TAbsFitParticle::getParIni(), visualization-live-secondInstance_cfg::m, AlCaHLTBitMon_ParallelJobs::p, and TAbsFitParticle::setIni4Vec().

Referenced by doToyExperiments().

Member Data Documentation

◆ _breco

TAbsFitParticle* TSLToyGen::_breco
private

Definition at line 79 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _doCheckConstraintsTruth

Bool_t TSLToyGen::_doCheckConstraintsTruth
private

Definition at line 92 of file TSLToyGen.h.

Referenced by doToyExperiments(), setCheckConstraintsTruth(), and TSLToyGen().

◆ _histChi2

TH1D* TSLToyGen::_histChi2

Definition at line 24 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

◆ _histMBrecoFit

TH1D* TSLToyGen::_histMBrecoFit

Definition at line 28 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMBrecoSmear

TH1D* TSLToyGen::_histMBrecoSmear

Definition at line 27 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMBrecoTrue

TH1D* TSLToyGen::_histMBrecoTrue

Definition at line 26 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXFit

TH1D* TSLToyGen::_histMXFit

Definition at line 31 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXlnuFit

TH1D* TSLToyGen::_histMXlnuFit

Definition at line 34 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXlnuSmear

TH1D* TSLToyGen::_histMXlnuSmear

Definition at line 33 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXlnuTrue

TH1D* TSLToyGen::_histMXlnuTrue

Definition at line 32 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXSmear

TH1D* TSLToyGen::_histMXSmear

Definition at line 30 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histMXTrue

TH1D* TSLToyGen::_histMXTrue

Definition at line 29 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

◆ _histNIter

TH1D* TSLToyGen::_histNIter

Definition at line 22 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

◆ _histPChi2

TH1D* TSLToyGen::_histPChi2

Definition at line 23 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

◆ _histsDiff1

TObjArray TSLToyGen::_histsDiff1

Definition at line 42 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

◆ _histsDiff2

TObjArray TSLToyGen::_histsDiff2

Definition at line 45 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

◆ _histsError1

TObjArray TSLToyGen::_histsError1

Definition at line 41 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

◆ _histsError2

TObjArray TSLToyGen::_histsError2

Definition at line 44 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

◆ _histsParFit

TObjArray TSLToyGen::_histsParFit

Definition at line 38 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

◆ _histsParSmear

TObjArray TSLToyGen::_histsParSmear

Definition at line 37 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

◆ _histsParTrue

TObjArray TSLToyGen::_histsParTrue

Definition at line 36 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

◆ _histsPull1

TObjArray TSLToyGen::_histsPull1

Definition at line 40 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

◆ _histsPull2

TObjArray TSLToyGen::_histsPull2

Definition at line 43 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

◆ _histStatus

TH1D* TSLToyGen::_histStatus

Definition at line 21 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

◆ _iniBreco

TAbsFitParticle* TSLToyGen::_iniBreco
private

Definition at line 75 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _iniLepton

TAbsFitParticle* TSLToyGen::_iniLepton
private

Definition at line 76 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _inimeasParticles

std::vector<TAbsFitParticle*> TSLToyGen::_inimeasParticles
private

Definition at line 69 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillPar(), fillPull1(), and smearParticles().

◆ _iniNeutrino

TAbsFitParticle* TSLToyGen::_iniNeutrino
private

Definition at line 78 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _iniunmeasParticles

std::vector<TAbsFitParticle*> TSLToyGen::_iniunmeasParticles
private

Definition at line 70 of file TSLToyGen.h.

Referenced by doToyExperiments().

◆ _iniX

TAbsFitParticle* TSLToyGen::_iniX
private

Definition at line 77 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _lepton

TAbsFitParticle* TSLToyGen::_lepton
private

Definition at line 80 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _measParticles

std::vector<TAbsFitParticle*> TSLToyGen::_measParticles
private

Definition at line 71 of file TSLToyGen.h.

Referenced by createHists(), doToyExperiments(), fillPar(), fillPull1(), fillPull2(), and smearParticles().

◆ _neutrino

TAbsFitParticle* TSLToyGen::_neutrino
private

Definition at line 82 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), smearParticles(), TSLToyGen(), and ~TSLToyGen().

◆ _printConsAfter

Bool_t TSLToyGen::_printConsAfter
private

Definition at line 88 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintConsAfter(), and TSLToyGen().

◆ _printConsBefore

Bool_t TSLToyGen::_printConsBefore
private

Definition at line 87 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintConsBefore(), and TSLToyGen().

◆ _printConsIni

Bool_t TSLToyGen::_printConsIni
private

Definition at line 85 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintConsIni(), and TSLToyGen().

◆ _printPartAfter

Bool_t TSLToyGen::_printPartAfter
private

Definition at line 89 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintPartAfter(), and TSLToyGen().

◆ _printPartIni

Bool_t TSLToyGen::_printPartIni
private

Definition at line 84 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintPartIni(), and TSLToyGen().

◆ _printSmearedPartBefore

Bool_t TSLToyGen::_printSmearedPartBefore
private

Definition at line 86 of file TSLToyGen.h.

Referenced by doToyExperiments(), setprintSmearedPartBefore(), and TSLToyGen().

◆ _unmeasParticles

std::vector<TAbsFitParticle*> TSLToyGen::_unmeasParticles
private

Definition at line 72 of file TSLToyGen.h.

◆ _withMassConstraint

Bool_t TSLToyGen::_withMassConstraint
private

Definition at line 90 of file TSLToyGen.h.

Referenced by doToyExperiments(), setMassConstraint(), and TSLToyGen().

◆ _withMPDGCons

Bool_t TSLToyGen::_withMPDGCons
private

Definition at line 91 of file TSLToyGen.h.

Referenced by doToyExperiments(), setMPDGCons(), and TSLToyGen().

◆ _X

TAbsFitParticle* TSLToyGen::_X
private

Definition at line 81 of file TSLToyGen.h.

Referenced by doToyExperiments(), fillM(), TSLToyGen(), and ~TSLToyGen().

◆ _Y4S

TVector3 TSLToyGen::_Y4S
private

Definition at line 73 of file TSLToyGen.h.

Referenced by doToyExperiments(), and smearParticles().

TSLToyGen::_printPartIni
Bool_t _printPartIni
Definition: TSLToyGen.h:84
TKinFitter::getMaxF
Double_t getMaxF()
Definition: TKinFitter.h:55
TSLToyGen::_printSmearedPartBefore
Bool_t _printSmearedPartBefore
Definition: TSLToyGen.h:86
TKinFitter::setMaxF
void setMaxF(Double_t maxF)
Definition: TKinFitter.h:54
mps_fire.i
i
Definition: mps_fire.py:355
TSLToyGen::_iniX
TAbsFitParticle * _iniX
Definition: TSLToyGen.h:77
TKinFitter::getNbIter
Int_t getNbIter()
Definition: TKinFitter.h:50
TSLToyGen::fillPull2
void fillPull2()
Definition: TSLToyGen.cc:268
TKinFitter::getF
Double_t getF()
Definition: TKinFitter.cc:1054
TSLToyGen::_histsPull2
TObjArray _histsPull2
Definition: TSLToyGen.h:43
TSLToyGen::_histMXlnuTrue
TH1D * _histMXlnuTrue
Definition: TSLToyGen.h:32
TSLToyGen::fillPull1
void fillPull1()
Definition: TSLToyGen.cc:246
X
#define X(str)
Definition: MuonsGrabber.cc:38
TSLToyGen::_inimeasParticles
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:69
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
TAbsFitParticle::calc4Vec
virtual TLorentzVector * calc4Vec(const TMatrixD *params)=0
TFitConstraintM
Definition: TFitConstraintM.h:11
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TSLToyGen::_withMassConstraint
Bool_t _withMassConstraint
Definition: TSLToyGen.h:90
TSLToyGen::smearParticles
void smearParticles()
Definition: TSLToyGen.cc:216
TSLToyGen::_histMXTrue
TH1D * _histMXTrue
Definition: TSLToyGen.h:29
TSLToyGen::_histsParFit
TObjArray _histsParFit
Definition: TSLToyGen.h:38
TKinFitter
Definition: TKinFitter.h:13
TSLToyGen::_breco
TAbsFitParticle * _breco
Definition: TSLToyGen.h:79
TSLToyGen::_histsPull1
TObjArray _histsPull1
Definition: TSLToyGen.h:40
TSLToyGen::_X
TAbsFitParticle * _X
Definition: TSLToyGen.h:81
TSLToyGen::_histsParSmear
TObjArray _histsParSmear
Definition: TSLToyGen.h:37
TSLToyGen::_histMXFit
TH1D * _histMXFit
Definition: TSLToyGen.h:31
TSLToyGen::_histMBrecoTrue
TH1D * _histMBrecoTrue
Definition: TSLToyGen.h:26
TFitConstraintEp::pX
Definition: TFitConstraintEp.h:11
TKinFitter::fit
Int_t fit()
Definition: TKinFitter.cc:318
TSLToyGen::fillM
void fillM()
Definition: TSLToyGen.cc:299
TFitConstraintEp::pY
Definition: TFitConstraintEp.h:11
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
TSLToyGen::_lepton
TAbsFitParticle * _lepton
Definition: TSLToyGen.h:80
TKinFitter::getS
Double_t getS()
Definition: TKinFitter.cc:1066
TSLToyGen::_printConsAfter
Bool_t _printConsAfter
Definition: TSLToyGen.h:88
TSLToyGen::_iniNeutrino
TAbsFitParticle * _iniNeutrino
Definition: TSLToyGen.h:78
TFitConstraintEp::E
Definition: TFitConstraintEp.h:11
h
TAbsFitParticle
Definition: TAbsFitParticle.h:9
TSLToyGen::_histMBrecoFit
TH1D * _histMBrecoFit
Definition: TSLToyGen.h:28
TSLToyGen::fillPar
void fillPar()
Definition: TSLToyGen.cc:284
TKinFitter::addUnmeasParticle
void addUnmeasParticle(TAbsFitParticle *particle)
Definition: TKinFitter.cc:243
TSLToyGen::_histChi2
TH1D * _histChi2
Definition: TSLToyGen.h:24
TKinFitter::setVerbosity
void setVerbosity(Int_t verbosity=1)
Definition: TKinFitter.cc:304
TSLToyGen::_histNIter
TH1D * _histNIter
Definition: TSLToyGen.h:22
TAbsFitParticle::getCurr4Vec
const TLorentzVector * getCurr4Vec()
Definition: TAbsFitParticle.h:31
TSLToyGen::_histMXSmear
TH1D * _histMXSmear
Definition: TSLToyGen.h:30
TKinFitter::setMaxNbIter
void setMaxNbIter(Int_t maxNbIter)
Definition: TKinFitter.h:48
TKinFitter::getStatus
Int_t getStatus()
Definition: TKinFitter.h:51
TAbsFitParticle::getParIni
const TMatrixD * getParIni()
Definition: TAbsFitParticle.h:35
TSLToyGen::_withMPDGCons
Bool_t _withMPDGCons
Definition: TSLToyGen.h:91
TKinFitter::getNDF
Int_t getNDF()
Definition: TKinFitter.h:45
TSLToyGen::_histMBrecoSmear
TH1D * _histMBrecoSmear
Definition: TSLToyGen.h:27
TSLToyGen::_iniBreco
TAbsFitParticle * _iniBreco
Definition: TSLToyGen.h:75
TSLToyGen::_printConsIni
Bool_t _printConsIni
Definition: TSLToyGen.h:85
TSLToyGen::_unmeasParticles
std::vector< TAbsFitParticle * > _unmeasParticles
Definition: TSLToyGen.h:72
TSLToyGen::_histPChi2
TH1D * _histPChi2
Definition: TSLToyGen.h:23
TAbsFitParticle::print
virtual void print()
Definition: TAbsFitParticle.cc:82
TSLToyGen::createHists
void createHists()
Definition: TSLToyGen.cc:324
TSLToyGen::_measParticles
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:71
TSLToyGen::_histMXlnuSmear
TH1D * _histMXlnuSmear
Definition: TSLToyGen.h:33
TSLToyGen::_histsError1
TObjArray _histsError1
Definition: TSLToyGen.h:41
TFitConstraintEp
Definition: TFitConstraintEp.h:9
TSLToyGen::_doCheckConstraintsTruth
Bool_t _doCheckConstraintsTruth
Definition: TSLToyGen.h:92
TKinFitter::addConstraint
void addConstraint(TAbsFitConstraint *constraint)
Definition: TKinFitter.cc:292
TAbsFitParticle::clone
virtual TAbsFitParticle * clone(const TString &newname="") const =0
TSLToyGen::_printPartAfter
Bool_t _printPartAfter
Definition: TSLToyGen.h:89
TFitConstraintEp::pZ
Definition: TFitConstraintEp.h:11
TKinFitter::setMaxDeltaS
void setMaxDeltaS(Double_t maxDeltaS)
Definition: TKinFitter.h:52
relativeConstraints.value
value
Definition: relativeConstraints.py:53
TSLToyGen::_histsDiff2
TObjArray _histsDiff2
Definition: TSLToyGen.h:45
TKinFitter::addMeasParticle
void addMeasParticle(TAbsFitParticle *particle)
Definition: TKinFitter.cc:194
TSLToyGen::_histStatus
TH1D * _histStatus
Definition: TSLToyGen.h:21
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
TSLToyGen::_histsParTrue
TObjArray _histsParTrue
Definition: TSLToyGen.h:36
TSLToyGen::_neutrino
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:82
TSLToyGen::_Y4S
TVector3 _Y4S
Definition: TSLToyGen.h:73
TSLToyGen::_printConsBefore
Bool_t _printConsBefore
Definition: TSLToyGen.h:87
TSLToyGen::_iniunmeasParticles
std::vector< TAbsFitParticle * > _iniunmeasParticles
Definition: TSLToyGen.h:70
TAbsFitParticle::setIni4Vec
virtual void setIni4Vec(const TLorentzVector *pini)=0
TAbsFitParticle::getNPar
Int_t getNPar() const
Definition: TAbsFitParticle.h:30
TSLToyGen::_histMXlnuFit
TH1D * _histMXlnuFit
Definition: TSLToyGen.h:34
TSLToyGen::_histsError2
TObjArray _histsError2
Definition: TSLToyGen.h:44
TSLToyGen::_histsDiff1
TObjArray _histsDiff1
Definition: TSLToyGen.h:42
TSLToyGen::_iniLepton
TAbsFitParticle * _iniLepton
Definition: TSLToyGen.h:76
TAbsFitParticle::getCovMatrix
virtual const TMatrixD * getCovMatrix() const
Definition: TAbsFitParticle.h:24
TAbsFitParticle::getIni4Vec
const TLorentzVector * getIni4Vec()
Definition: TAbsFitParticle.h:32
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37