test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual ~TSLToyGen ()
 

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 ( const TAbsFitParticle bReco,
const TAbsFitParticle lepton,
const TAbsFitParticle X,
const TAbsFitParticle neutrino 
)

Definition at line 14 of file TSLToyGen.cc.

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

15  :
18  _measParticles(0),
20  _Y4S(0., 0., 0.)
21 
22 {
23 
24  // Clone input particles
25  _iniBreco = bReco->clone( bReco->GetName() + (TString) "INI" );
26  _breco = bReco->clone( bReco->GetName() + (TString) "SMEAR" );
27  _iniLepton = lepton->clone( lepton->GetName() + (TString) "INI" );
28  _lepton = lepton->clone( lepton->GetName() + (TString) "SMEAR" );
29  _iniX = X->clone( X->GetName() + (TString) "INI" );
30  _X = X->clone( X->GetName() + (TString) "SMEAR" );
31  _iniNeutrino = neutrino->clone( neutrino->GetName() +(TString) "INI" );
32  _neutrino = neutrino->clone( neutrino->GetName() + (TString) "SMEAR" );
33 
34  _printPartIni = false;
35  _printConsIni = false;
37  _printConsBefore = false;
38  _printConsAfter = false;
39  _printPartAfter = false;
40  _withMassConstraint = false;
41  _withMPDGCons = false;
43 }
TAbsFitParticle * _iniLepton
Definition: TSLToyGen.h:77
Bool_t _withMassConstraint
Definition: TSLToyGen.h:91
Bool_t _printPartIni
Definition: TSLToyGen.h:85
Bool_t _withMPDGCons
Definition: TSLToyGen.h:92
Bool_t _printConsAfter
Definition: TSLToyGen.h:89
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:70
TAbsFitParticle * _iniX
Definition: TSLToyGen.h:78
TAbsFitParticle * _breco
Definition: TSLToyGen.h:80
TAbsFitParticle * _X
Definition: TSLToyGen.h:82
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
TVector3 _Y4S
Definition: TSLToyGen.h:74
TAbsFitParticle * _iniNeutrino
Definition: TSLToyGen.h:79
Bool_t _doCheckConstraintsTruth
Definition: TSLToyGen.h:93
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:83
Bool_t _printConsBefore
Definition: TSLToyGen.h:88
TAbsFitParticle * _iniBreco
Definition: TSLToyGen.h:76
std::vector< TAbsFitParticle * > _unmeasParticles
Definition: TSLToyGen.h:73
TAbsFitParticle * _lepton
Definition: TSLToyGen.h:81
Bool_t _printConsIni
Definition: TSLToyGen.h:86
std::vector< TAbsFitParticle * > _iniunmeasParticles
Definition: TSLToyGen.h:71
Bool_t _printPartAfter
Definition: TSLToyGen.h:90
Bool_t _printSmearedPartBefore
Definition: TSLToyGen.h:87
virtual TAbsFitParticle * clone(const TString &newname="") const =0
TSLToyGen::~TSLToyGen ( )
virtual

Definition at line 45 of file TSLToyGen.cc.

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

45  {
46 
47  delete _iniBreco;
48  delete _iniLepton;
49  delete _iniX;
50  delete _iniNeutrino;
51 
52  delete _breco;
53  delete _lepton;
54  delete _X;
55  delete _neutrino;
56 
57 }
TAbsFitParticle * _iniLepton
Definition: TSLToyGen.h:77
TAbsFitParticle * _iniX
Definition: TSLToyGen.h:78
TAbsFitParticle * _breco
Definition: TSLToyGen.h:80
TAbsFitParticle * _X
Definition: TSLToyGen.h:82
TAbsFitParticle * _iniNeutrino
Definition: TSLToyGen.h:79
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:83
TAbsFitParticle * _iniBreco
Definition: TSLToyGen.h:76
TAbsFitParticle * _lepton
Definition: TSLToyGen.h:81

Member Function Documentation

void TSLToyGen::createHists ( )
protected

Definition at line 358 of file TSLToyGen.cc.

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, i, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by doToyExperiments().

358  {
359 
360  _histStatus = new TH1D( "hStatus", "Status of the Fit", 16, -1, 15);
361  _histNIter = new TH1D( "hNIter", "Number of iterations", 100, 0, 100);
362  _histPChi2 = new TH1D( "hPChi2", "Chi2 probability", 100, 0., 1.);
363  _histChi2 = new TH1D( "hChi2", "Chi2 ", 200, 0., 20.);
364  _histMBrecoTrue = new TH1D( "histMBrecoTrue", "histMBrecoTrue", 2000, 4., 6.);
365  _histMBrecoSmear = new TH1D( "histMBrecoSmear", "histMBrecoSmear", 2000, 4., 6.);
366  _histMBrecoFit = new TH1D( "histMBrecoFit", "histMBrecoFit", 2000, 4., 6.);
367  _histMXTrue = new TH1D( "histMXTrue", "histMXTrue", 600, 0., 6.);
368  _histMXSmear = new TH1D( "histMXSmear", "histMXSmear", 600, 0., 6.);
369  _histMXFit = new TH1D( "histMXFit", "histMXFit", 600, 0., 6.);
370  _histMXlnuTrue = new TH1D( "histMXlnuTrue", "histMXlnuTrue", 3000, 4., 7.);
371  _histMXlnuSmear = new TH1D( "histMXlnuSmear", "histMXlnuSmear", 500, 3., 8.);
372  _histMXlnuFit = new TH1D( "histMXlnuFit", "histMXlnuFit", 3000, 4., 7.);
373 
374  _histsParTrue.Clear();
375  _histsParSmear.Clear();
376  _histsParFit.Clear();
377  _histsPull1.Clear();
378  _histsError1.Clear();
379  _histsDiff1.Clear();
380  _histsPull2.Clear();
381  _histsError2.Clear();
382  _histsDiff2.Clear();
383 
384  TObjArray histarrays;
385  histarrays.Add( &_histsParTrue );
386  histarrays.Add( &_histsParSmear );
387  histarrays.Add( &_histsParFit );
388  histarrays.Add( &_histsPull1 );
389  histarrays.Add( &_histsError1 );
390  histarrays.Add( &_histsDiff1 );
391  histarrays.Add( &_histsPull2 );
392  histarrays.Add( &_histsError2 );
393  histarrays.Add( &_histsDiff2 );
394 
395 
396  TString histnames[] = {"hParTrue", "hParSmear", "hParFit", "hPull1", "hError1", "hDiff1", "hPull2", "hError2", "hDiff2" };
397 
398  TArrayD arrmin( histarrays.GetEntries() );
399  TArrayD arrmax( histarrays.GetEntries() );
400  arrmin[0] = 0.; arrmax[0] = 2.; // Parameters
401  arrmin[1] = 0.; arrmax[1] = 2.;
402  arrmin[2] = 0.; arrmax[2] = 2.;
403 
404  arrmin[3] = -3.; arrmax[3] = 3.; // Pull1
405  arrmin[4] = 0.; arrmax[4] = .2; //Error1
406  arrmin[5] = -.5; arrmax[5] = .5; //Diff1
407  arrmin[6] = -3.; arrmax[6] = 3.; // Pull2
408  arrmin[7] = 0.; arrmax[7] = 0.2; //Error2
409  arrmin[8] = -.5; arrmax[8] = .5; //Diff2
410 
411  for (unsigned int p = 0; p < _measParticles.size(); p++) {
412 
413  const TAbsFitParticle* particle = _measParticles[p];
414  // const TMatrixD* covMatrix = particle->getCovMatrix();
415 
416  for (int i = 0; i < particle->getNPar(); i++) {
417  for (int h = 0; h < histarrays.GetEntries(); h++ ) {
418  TString name = histnames[h] + (TString) particle->GetName();
419  name += i;
420  if ( h < 3) {
421  const TMatrixD* parfit = _measParticles[p]->getParCurr();
422  arrmin[h] = (*parfit)(i,0)*0.5;
423  arrmax[h] = (*parfit)(i,0)*1.5;
424  }
425  TH1D* newhisto = new TH1D( name, name, 100, arrmin[h], arrmax[h]) ;
426  ((TObjArray*) histarrays[h])->Add( newhisto );
427 
428  // newhisto->SetBit(TH1::kCanRebin);
429  }
430  }
431  }
432 }
TObjArray _histsDiff1
Definition: TSLToyGen.h:41
TH1D * _histPChi2
Definition: TSLToyGen.h:22
TObjArray _histsPull2
Definition: TSLToyGen.h:42
TH1D * _histNIter
Definition: TSLToyGen.h:21
TH1D * _histMXlnuFit
Definition: TSLToyGen.h:33
int i
Definition: DBlmapReader.cc:9
TObjArray _histsPull1
Definition: TSLToyGen.h:39
TObjArray _histsError1
Definition: TSLToyGen.h:40
TH1D * _histMXTrue
Definition: TSLToyGen.h:28
TObjArray _histsDiff2
Definition: TSLToyGen.h:44
TObjArray _histsError2
Definition: TSLToyGen.h:43
TObjArray _histsParTrue
Definition: TSLToyGen.h:35
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
TH1D * _histMBrecoTrue
Definition: TSLToyGen.h:25
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Int_t getNPar() const
TH1D * _histChi2
Definition: TSLToyGen.h:23
TH1D * _histMXlnuTrue
Definition: TSLToyGen.h:31
TH1D * _histStatus
Definition: TSLToyGen.h:20
TObjArray _histsParSmear
Definition: TSLToyGen.h:36
TH1D * _histMBrecoFit
Definition: TSLToyGen.h:27
TH1D * _histMXSmear
Definition: TSLToyGen.h:29
TH1D * _histMXlnuSmear
Definition: TSLToyGen.h:32
TH1D * _histMBrecoSmear
Definition: TSLToyGen.h:26
TObjArray _histsParFit
Definition: TSLToyGen.h:37
TH1D * _histMXFit
Definition: TSLToyGen.h:30
Bool_t TSLToyGen::doToyExperiments ( Int_t  nbExperiments = 1000)

Definition at line 59 of file TSLToyGen.cc.

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, alignCSCRings::e, fillM(), fillPar(), fillPull1(), fillPull2(), TKinFitter::fit(), TFitConstraintM::getCurrentValue(), TKinFitter::getF(), TAbsFitParticle::getIni4Vec(), TKinFitter::getMaxF(), TKinFitter::getNbIter(), TKinFitter::getNDF(), TKinFitter::getS(), TKinFitter::getStatus(), i, AlCaHLTBitMon_ParallelJobs::p, TAbsFitParticle::print(), TFitConstraintEp::pX, TFitConstraintEp::pY, TFitConstraintEp::pZ, TKinFitter::setMaxDeltaS(), TKinFitter::setMaxF(), TKinFitter::setMaxNbIter(), TKinFitter::setVerbosity(), and smearParticles().

59  {
60 
61  // define fitter
62  TKinFitter fitter;
63 
64  std::vector<TAbsFitParticle*> ParVec(0);
65  ParVec.push_back(_breco);
66  ParVec.push_back(_lepton);
67  ParVec.push_back(_X);
68  ParVec.push_back(_neutrino);
69 
70  fitter.addMeasParticle(_breco);
71  _inimeasParticles.push_back( _iniBreco );
72  _measParticles.push_back( _breco );
73  fitter.addMeasParticle(_lepton);
74  _inimeasParticles.push_back( _iniLepton );
75  _measParticles.push_back( _lepton );
76  fitter.addMeasParticle(_X);
77  _inimeasParticles.push_back( _iniX );
78  _measParticles.push_back( _X );
80  _iniunmeasParticles.push_back( _iniNeutrino );
81  _iniunmeasParticles.push_back( _neutrino );
82 
83  // Calculate Y4S
84  _Y4S.SetXYZ(0., 0., 0.);
85  for (unsigned int p = 0; p < _inimeasParticles.size(); p++) {
86  _Y4S += _inimeasParticles[p]->getIni4Vec()->Vect();
87  }
88  _Y4S += _iniNeutrino->getIni4Vec()->Vect();
89  //_Y4S.SetXYZ(-0.1212, -0.0033, 5.8784);
90  Double_t EY4S = TMath::Sqrt( _Y4S.Mag2() + 10.58*10.58 );
91  // std::cout << "_Y4S : " <<_Y4S.x() << " / " << _Y4S.y() << " / " << _Y4S.z() << " / " <<EY4S<< std::endl;
92 
93  TFitConstraintEp pXCons( "pX", "pX", &ParVec, TFitConstraintEp::pX, _Y4S.x() );
94  TFitConstraintEp pYCons( "pY", "pY", &ParVec, TFitConstraintEp::pY, _Y4S.y() );
95  TFitConstraintEp pZCons( "pZ", "pZ", &ParVec, TFitConstraintEp::pZ, _Y4S.z() );
96  TFitConstraintEp ECons( "E", "E", &ParVec, TFitConstraintEp::E, EY4S );
97  TFitConstraintM MCons( "MassConstraint", "Mass-Constraint", 0, 0 ,0);
98  MCons.addParticle1( _breco );
99  MCons.addParticles2( _lepton, _neutrino, _X );
100  TFitConstraintM MPDGCons( "MPDGCons", "MPDGCons", 0, 0 , 5.279 );
101  MPDGCons.addParticles1( _lepton, _neutrino, _X );
102 // TFitConstraintE EBCons( "EBXlnuCons", "EBXlnuCons", 0, 0 );
103 // EBCons.addParticle1( _breco );
104 // EBCons.addParticles2( _lepton, _neutrino, _X );
105 
106  fitter.addConstraint(&pXCons);
107  fitter.addConstraint(&pYCons);
108  fitter.addConstraint(&pZCons);
109  fitter.addConstraint(&ECons);
111  fitter.addConstraint(&MCons);
112  if(_withMPDGCons)
113  fitter.addConstraint(&MPDGCons);
114  // fitter.addConstraint(&EBCons);
115 
116  fitter.setMaxNbIter( 50 );
117  fitter.setMaxDeltaS( 5e-5 );
118  fitter.setMaxF( 1e-4 );
119  fitter.setVerbosity(0);
120 
121  if( _printPartIni ) {
122  std::cout << std::endl
123  << "----------------------------------" << std::endl;
124  std::cout << "--- PRINTING INITIAL PARTICLES ---" << std::endl;
125  std::cout << "----------------------------------" << std::endl ;
126  _iniBreco->print();
127  _iniLepton->print();
128  _iniX->print();
129  _iniNeutrino->print();
130  std::cout << std::endl << std::endl;
131  }
132 
133  if( _printConsIni ) {
134  std::cout << std::endl
135  << "-------------------------------------------------" << std::endl;
136  std::cout << "INITIAL CONSTRAINTS " << std::endl ;
137  std::cout << "-------------------------------------------------" << std::endl;
138  std::cout << " M: " << MCons.getCurrentValue()
139  << " MPDG: " << MPDGCons.getCurrentValue()
140  << " px: " << pXCons.getCurrentValue()
141  << " py: " << pYCons.getCurrentValue()
142  << " pz: " << pZCons.getCurrentValue()
143  << " E: " << ECons.getCurrentValue() << std::endl << std::endl;
144  }
145 
146  // Check initial constraints
147  if ( _doCheckConstraintsTruth ) {
148  if (fitter.getF() > fitter.getMaxF()) {
149  //std::cout << "Initial constraints are not fulfilled." << std::endl;
150  return false;
151  }
152  }
153 
154  // create histograms
155  createHists();
156 
157  // perform pseudo experiments
158  for (int i = 0; i < nbExperiments; i++) {
159 
160  smearParticles();
161 
163  std::cout << std::endl
164  << "-------------------------------------------------------" << std::endl ;
165  std::cout << "--- PRINTING SMEARED PARTICLES BEFORE FIT FOR experiment # " <<i+1 << std::endl;
166  std::cout << "-------------------------------------------------------" << std::endl;
167  _breco->print();
168  _lepton->print();
169  _X->print();
170  _neutrino->print();
171  }
172 
173 
174  if( _printConsBefore ) {
175  std::cout << std::endl
176  << "-------------------------------------------------" << std::endl;
177  std::cout << "INITIAL (SMEARED) CONSTRAINTS FOR experiment # "<< i+1 << std::endl ;
178  std::cout << "-------------------------------------------------" << std::endl;
179  std::cout << " M: " << MCons.getCurrentValue()
180  << " px: " << pXCons.getCurrentValue()
181  << " py: " << pYCons.getCurrentValue()
182  << " pz: " << pZCons.getCurrentValue()
183  << " E: " << ECons.getCurrentValue() << std::endl << std::endl;
184  }
185 
186  fitter.fit();
187 
188  if( _printConsAfter) {
189  std::cout << std::endl
190  << "-------------------------------------------------" << std::endl;
191  std::cout << " CONSTRAINTS AFTER FIT FOR experiment # "<< i+1 << std::endl ;
192  std::cout << "-------------------------------------------------" << std::endl;
193  std::cout << " M: " << MCons.getCurrentValue()
194  << " MPDG: " << MPDGCons.getCurrentValue()
195  << " px: " << pXCons.getCurrentValue()
196  << " py: " << pYCons.getCurrentValue()
197  << " pz: " << pZCons.getCurrentValue()
198  << " E: " << ECons.getCurrentValue() << std::endl << std::endl;
199  }
200 
201  if( _printPartAfter ) {
202  std::cout << std::endl
203  << "--------------------------------------------------------" << std::endl ;
204  std::cout << "--- PRINTING PARTICLES AFTER FIT FOR experiment # "<< i+1 << std::endl;
205  std::cout << "--------------------------------------------------------" << std::endl;
206  _breco->print();
207  _lepton->print();
208  _X->print();
209  _neutrino->print();
210  }
211 
212  _histStatus->Fill( fitter.getStatus() );
213  _histNIter->Fill( fitter.getNbIter() );
214  if ( fitter.getStatus() == 0 ) {
215  _histPChi2->Fill( TMath::Prob( fitter.getS(), fitter.getNDF() ) );
216  _histChi2->Fill( fitter.getS());
217  fillPull1();
218  fillPull2();
219  fillPar();
220  fillM();
221  }
222 
223  if (i % 176 == 0) {
224  std::cout << "\r";
225  std::cout <<" ------ "<< (Double_t) i/nbExperiments*100. << " % PROCESSED ------";
226  std::cout.flush();
227  }
228  }
229 
230  return true;
231 
232 }
TH1D * _histPChi2
Definition: TSLToyGen.h:22
TH1D * _histNIter
Definition: TSLToyGen.h:21
void fillM()
Definition: TSLToyGen.cc:331
Int_t getNbIter()
Definition: TKinFitter.h:40
int i
Definition: DBlmapReader.cc:9
TAbsFitParticle * _iniLepton
Definition: TSLToyGen.h:77
void setMaxF(Double_t maxF)
Definition: TKinFitter.h:44
Bool_t _withMassConstraint
Definition: TSLToyGen.h:91
Int_t fit()
Definition: TKinFitter.cc:309
void smearParticles()
Definition: TSLToyGen.cc:234
Bool_t _printPartIni
Definition: TSLToyGen.h:85
void fillPar()
Definition: TSLToyGen.cc:313
void setMaxDeltaS(Double_t maxDeltaS)
Definition: TKinFitter.h:42
Bool_t _withMPDGCons
Definition: TSLToyGen.h:92
const TLorentzVector * getIni4Vec()
Bool_t _printConsAfter
Definition: TSLToyGen.h:89
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:70
TAbsFitParticle * _iniX
Definition: TSLToyGen.h:78
TAbsFitParticle * _breco
Definition: TSLToyGen.h:80
TAbsFitParticle * _X
Definition: TSLToyGen.h:82
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
TVector3 _Y4S
Definition: TSLToyGen.h:74
Double_t getMaxF()
Definition: TKinFitter.h:45
Double_t getS()
Definition: TKinFitter.cc:1108
void fillPull2()
Definition: TSLToyGen.cc:294
void addConstraint(TAbsFitConstraint *constraint)
Definition: TKinFitter.cc:281
TAbsFitParticle * _iniNeutrino
Definition: TSLToyGen.h:79
Int_t getStatus()
Definition: TKinFitter.h:41
void addUnmeasParticle(TAbsFitParticle *particle)
Definition: TKinFitter.cc:245
Int_t getNDF()
Definition: TKinFitter.h:35
void addMeasParticle(TAbsFitParticle *particle)
Definition: TKinFitter.cc:209
TH1D * _histChi2
Definition: TSLToyGen.h:23
Bool_t _doCheckConstraintsTruth
Definition: TSLToyGen.h:93
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:83
void createHists()
Definition: TSLToyGen.cc:358
virtual void print()
void setVerbosity(Int_t verbosity=1)
Definition: TKinFitter.cc:294
Bool_t _printConsBefore
Definition: TSLToyGen.h:88
TAbsFitParticle * _iniBreco
Definition: TSLToyGen.h:76
TH1D * _histStatus
Definition: TSLToyGen.h:20
TAbsFitParticle * _lepton
Definition: TSLToyGen.h:81
Bool_t _printConsIni
Definition: TSLToyGen.h:86
void setMaxNbIter(Int_t maxNbIter)
Definition: TKinFitter.h:38
void fillPull1()
Definition: TSLToyGen.cc:266
Double_t getF()
Definition: TKinFitter.cc:1095
std::vector< TAbsFitParticle * > _iniunmeasParticles
Definition: TSLToyGen.h:71
tuple cout
Definition: gather_cfg.py:121
Bool_t _printPartAfter
Definition: TSLToyGen.h:90
Bool_t _printSmearedPartBefore
Definition: TSLToyGen.h:87
void TSLToyGen::fillM ( )
protected

Definition at line 331 of file TSLToyGen.cc.

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().

331  {
332 
333  _histMBrecoTrue->Fill( _iniBreco->getIni4Vec()->M() );
334  _histMBrecoSmear->Fill( _breco->getIni4Vec()->M() );
335  _histMBrecoFit->Fill( _breco->getCurr4Vec()->M() );
336 
337  _histMXTrue->Fill( _iniX->getIni4Vec()->M() );
338  _histMXSmear->Fill( _X->getIni4Vec()->M() );
339  _histMXFit->Fill( _X->getCurr4Vec()->M() );
340 
341  TLorentzVector xlnutrue = *(_iniLepton->getIni4Vec());
342  xlnutrue += *(_iniX->getIni4Vec());
343  xlnutrue += *(_iniNeutrino->getIni4Vec());
344  _histMXlnuTrue->Fill( xlnutrue.M() );
345 
346  TLorentzVector xlnusmear = *(_lepton->getIni4Vec());
347  xlnusmear += *(_X->getIni4Vec());
348  xlnusmear += *(_neutrino->getIni4Vec());
349  _histMXlnuSmear->Fill( xlnusmear.M() );
350 
351  TLorentzVector xlnufit = *(_lepton->getCurr4Vec());
352  xlnufit += *(_X->getCurr4Vec());
353  xlnufit += *(_neutrino->getCurr4Vec());
354  _histMXlnuFit->Fill( xlnufit.M() );
355 
356 }
TH1D * _histMXlnuFit
Definition: TSLToyGen.h:33
TAbsFitParticle * _iniLepton
Definition: TSLToyGen.h:77
const TLorentzVector * getIni4Vec()
TH1D * _histMXTrue
Definition: TSLToyGen.h:28
TAbsFitParticle * _iniX
Definition: TSLToyGen.h:78
TAbsFitParticle * _breco
Definition: TSLToyGen.h:80
TAbsFitParticle * _X
Definition: TSLToyGen.h:82
TH1D * _histMBrecoTrue
Definition: TSLToyGen.h:25
TAbsFitParticle * _iniNeutrino
Definition: TSLToyGen.h:79
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:83
TAbsFitParticle * _iniBreco
Definition: TSLToyGen.h:76
TH1D * _histMXlnuTrue
Definition: TSLToyGen.h:31
const TLorentzVector * getCurr4Vec()
TAbsFitParticle * _lepton
Definition: TSLToyGen.h:81
TH1D * _histMBrecoFit
Definition: TSLToyGen.h:27
TH1D * _histMXSmear
Definition: TSLToyGen.h:29
TH1D * _histMXlnuSmear
Definition: TSLToyGen.h:32
TH1D * _histMBrecoSmear
Definition: TSLToyGen.h:26
TH1D * _histMXFit
Definition: TSLToyGen.h:30
void TSLToyGen::fillPar ( )
protected

Definition at line 313 of file TSLToyGen.cc.

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

Referenced by doToyExperiments().

313  {
314 
315  Int_t histindex = 0;
316  for (unsigned int p = 0; p < _measParticles.size(); p++) {
317 
318  const TMatrixD* partrue = _inimeasParticles[p]->getParIni();
319  const TMatrixD* parsmear = _measParticles[p]->getParIni();
320  const TMatrixD* parfit = _measParticles[p]->getParCurr();
321  for (int i = 0; i < partrue->GetNrows(); i++) {
322  ( (TH1D*) _histsParTrue[histindex])->Fill( (*partrue)(i, 0) );
323  ( (TH1D*) _histsParSmear[histindex])->Fill( (*parsmear)(i, 0) );
324  ( (TH1D*) _histsParFit[histindex])->Fill( (*parfit)(i, 0) );
325  histindex++;
326  }
327  }
328 
329 }
int i
Definition: DBlmapReader.cc:9
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:70
TObjArray _histsParTrue
Definition: TSLToyGen.h:35
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
TObjArray _histsParSmear
Definition: TSLToyGen.h:36
TObjArray _histsParFit
Definition: TSLToyGen.h:37
void TSLToyGen::fillPull1 ( )
protected

Definition at line 266 of file TSLToyGen.cc.

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

Referenced by doToyExperiments().

266  {
267 
268  Int_t histindex = 0;
269  for (unsigned int p = 0; p < _measParticles.size(); p++) {
270 
271  //const TAbsFitParticle* particle = _measParticles[p];
272  TLorentzVector vectrue( *_inimeasParticles[p]->getIni4Vec() );
273  TMatrixD* partrue = _measParticles[p]->transform( vectrue );
274  const TMatrixD* parfit = _measParticles[p]->getParCurr();
275 
276  TMatrixD parpull( *parfit );
277  parpull -= (*partrue);
278  const TMatrixD* covMatrixFit = _measParticles[p]->getCovMatrixFit();
279  for (int i = 0; i < parpull.GetNrows(); i++) {
280 
281  ((TH1D*) _histsDiff1[histindex])->Fill( parpull(i, 0) );
282  parpull(i, 0) /= TMath::Sqrt( (*covMatrixFit)(i, i) );
283  ((TH1D*) _histsPull1[histindex])->Fill( parpull(i, 0) );
284  ((TH1D*) _histsError1[histindex])->Fill( TMath::Sqrt( (*covMatrixFit)(i, i) ) );
285  histindex++;
286 
287  }
288  delete partrue;
289 
290  }
291 
292 }
TObjArray _histsDiff1
Definition: TSLToyGen.h:41
int i
Definition: DBlmapReader.cc:9
TObjArray _histsPull1
Definition: TSLToyGen.h:39
TObjArray _histsError1
Definition: TSLToyGen.h:40
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:70
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
void TSLToyGen::fillPull2 ( )
protected

Definition at line 294 of file TSLToyGen.cc.

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

Referenced by doToyExperiments().

294  {
295 
296  Int_t histindex = 0;
297  for (unsigned int p = 0; p < _measParticles.size(); p++) {
298 
299  const TMatrixD* pull = _measParticles[p]->getPull();
300  const TMatrixD* VDeltaY = _measParticles[p]->getCovMatrixDeltaY();
301  TMatrixD pardiff( *(_measParticles[p]->getParCurr()) );
302  pardiff -= *(_measParticles[p]->getParIni());
303  for (int i = 0; i < pull->GetNrows(); i++) {
304  ( (TH1D*) _histsPull2[histindex])->Fill( (*pull)(i, 0) );
305  ( (TH1D*) _histsError2[histindex])->Fill( TMath::Sqrt( (*VDeltaY)(i, i) ) );
306  ( (TH1D*) _histsDiff2[histindex])->Fill( pardiff(i, 0) );
307  histindex++;
308  }
309  }
310 
311 }
TObjArray _histsPull2
Definition: TSLToyGen.h:42
int i
Definition: DBlmapReader.cc:9
TObjArray _histsDiff2
Definition: TSLToyGen.h:44
TObjArray _histsError2
Definition: TSLToyGen.h:43
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
void TSLToyGen::setCheckConstraintsTruth ( Bool_t  value)
inline

Definition at line 55 of file TSLToyGen.h.

References _doCheckConstraintsTruth, and relativeConstraints::value.

void TSLToyGen::setMassConstraint ( Bool_t  value)
inline

Definition at line 53 of file TSLToyGen.h.

References _withMassConstraint, and relativeConstraints::value.

void TSLToyGen::setMPDGCons ( Bool_t  value)
inline

Definition at line 54 of file TSLToyGen.h.

References _withMPDGCons, and relativeConstraints::value.

54 { _withMPDGCons = value; }
Bool_t _withMPDGCons
Definition: TSLToyGen.h:92
void TSLToyGen::setprintConsAfter ( Bool_t  value)
inline

Definition at line 51 of file TSLToyGen.h.

References _printConsAfter, and relativeConstraints::value.

void TSLToyGen::setprintConsBefore ( Bool_t  value)
inline

Definition at line 50 of file TSLToyGen.h.

References _printConsBefore, and relativeConstraints::value.

void TSLToyGen::setprintConsIni ( Bool_t  value)
inline

Definition at line 47 of file TSLToyGen.h.

References _printConsIni, and relativeConstraints::value.

47 { _printConsIni = value; }
Bool_t _printConsIni
Definition: TSLToyGen.h:86
void TSLToyGen::setprintPartAfter ( Bool_t  value)
inline

Definition at line 49 of file TSLToyGen.h.

References _printPartAfter, and relativeConstraints::value.

void TSLToyGen::setprintPartIni ( Bool_t  value)
inline

Definition at line 46 of file TSLToyGen.h.

References _printPartIni, and relativeConstraints::value.

46 { _printPartIni = value; }
Bool_t _printPartIni
Definition: TSLToyGen.h:85
void TSLToyGen::setprintSmearedPartBefore ( Bool_t  value)
inline

Definition at line 48 of file TSLToyGen.h.

References _printSmearedPartBefore, and relativeConstraints::value.

void TSLToyGen::smearParticles ( )
protected

Definition at line 234 of file TSLToyGen.cc.

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

Referenced by doToyExperiments().

234  {
235  // Smear measured particles
236 
237  for (unsigned int p = 0; p < _measParticles.size(); p++) {
238 
239  TAbsFitParticle* particle = _measParticles[p];
240  TAbsFitParticle* iniParticle = _inimeasParticles[p];
241  TMatrixD parIni( *(iniParticle->getParIni()) );
242  const TMatrixD* covM = iniParticle->getCovMatrix();
243  for (int m = 0; m < iniParticle->getNPar(); m++) {
244  parIni(m, 0) += gRandom->Gaus(0., TMath::Sqrt( (*covM)(m,m) ) );
245  }
246  TLorentzVector* ini4Vec = iniParticle->calc4Vec( &parIni );
247  particle->setIni4Vec( ini4Vec );
248  delete ini4Vec;
249  TLorentzVector vectrue( *_inimeasParticles[p]->getIni4Vec() );
250  TMatrixD* partrue = _measParticles[p]->transform( vectrue );
251  //_measParticles[p]->setParIni(partrue);
252  delete partrue;
253  }
254 
255  // Calculate neutrino
256  TVector3 nuP3 = _Y4S;
257  for (unsigned int p = 0; p < _measParticles.size(); p++) {
258  nuP3 -= _measParticles[p]->getCurr4Vec()->Vect();
259  }
260  TLorentzVector ini4VecNeutrino ;
261  ini4VecNeutrino.SetXYZM( nuP3.X(), nuP3.Y(), nuP3.Z(), 0. );
262  _neutrino->setIni4Vec( &ini4VecNeutrino );
263 
264 }
virtual void setIni4Vec(const TLorentzVector *pini)=0
virtual TLorentzVector * calc4Vec(const TMatrixD *params)=0
std::vector< TAbsFitParticle * > _inimeasParticles
Definition: TSLToyGen.h:70
std::vector< TAbsFitParticle * > _measParticles
Definition: TSLToyGen.h:72
TVector3 _Y4S
Definition: TSLToyGen.h:74
Int_t getNPar() const
TAbsFitParticle * _neutrino
Definition: TSLToyGen.h:83
const TMatrixD * getParIni()
virtual const TMatrixD * getCovMatrix() const

Member Data Documentation

TAbsFitParticle* TSLToyGen::_breco
private

Definition at line 80 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_doCheckConstraintsTruth
private

Definition at line 93 of file TSLToyGen.h.

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

TH1D* TSLToyGen::_histChi2

Definition at line 23 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

TH1D* TSLToyGen::_histMBrecoFit

Definition at line 27 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMBrecoSmear

Definition at line 26 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMBrecoTrue

Definition at line 25 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXFit

Definition at line 30 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXlnuFit

Definition at line 33 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXlnuSmear

Definition at line 32 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXlnuTrue

Definition at line 31 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXSmear

Definition at line 29 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histMXTrue

Definition at line 28 of file TSLToyGen.h.

Referenced by createHists(), and fillM().

TH1D* TSLToyGen::_histNIter

Definition at line 21 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

TH1D* TSLToyGen::_histPChi2

Definition at line 22 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

TObjArray TSLToyGen::_histsDiff1

Definition at line 41 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

TObjArray TSLToyGen::_histsDiff2

Definition at line 44 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

TObjArray TSLToyGen::_histsError1

Definition at line 40 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

TObjArray TSLToyGen::_histsError2

Definition at line 43 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

TObjArray TSLToyGen::_histsParFit

Definition at line 37 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

TObjArray TSLToyGen::_histsParSmear

Definition at line 36 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

TObjArray TSLToyGen::_histsParTrue

Definition at line 35 of file TSLToyGen.h.

Referenced by createHists(), and fillPar().

TObjArray TSLToyGen::_histsPull1

Definition at line 39 of file TSLToyGen.h.

Referenced by createHists(), and fillPull1().

TObjArray TSLToyGen::_histsPull2

Definition at line 42 of file TSLToyGen.h.

Referenced by createHists(), and fillPull2().

TH1D* TSLToyGen::_histStatus

Definition at line 20 of file TSLToyGen.h.

Referenced by createHists(), and doToyExperiments().

TAbsFitParticle* TSLToyGen::_iniBreco
private

Definition at line 76 of file TSLToyGen.h.

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

TAbsFitParticle* TSLToyGen::_iniLepton
private

Definition at line 77 of file TSLToyGen.h.

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

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

Definition at line 70 of file TSLToyGen.h.

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

TAbsFitParticle* TSLToyGen::_iniNeutrino
private

Definition at line 79 of file TSLToyGen.h.

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

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

Definition at line 71 of file TSLToyGen.h.

Referenced by doToyExperiments().

TAbsFitParticle* TSLToyGen::_iniX
private

Definition at line 78 of file TSLToyGen.h.

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

TAbsFitParticle* TSLToyGen::_lepton
private

Definition at line 81 of file TSLToyGen.h.

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

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

Definition at line 72 of file TSLToyGen.h.

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

TAbsFitParticle* TSLToyGen::_neutrino
private

Definition at line 83 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printConsAfter
private

Definition at line 89 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printConsBefore
private

Definition at line 88 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printConsIni
private

Definition at line 86 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printPartAfter
private

Definition at line 90 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printPartIni
private

Definition at line 85 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_printSmearedPartBefore
private

Definition at line 87 of file TSLToyGen.h.

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

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

Definition at line 73 of file TSLToyGen.h.

Bool_t TSLToyGen::_withMassConstraint
private

Definition at line 91 of file TSLToyGen.h.

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

Bool_t TSLToyGen::_withMPDGCons
private

Definition at line 92 of file TSLToyGen.h.

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

TAbsFitParticle* TSLToyGen::_X
private

Definition at line 82 of file TSLToyGen.h.

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

TVector3 TSLToyGen::_Y4S
private

Definition at line 74 of file TSLToyGen.h.

Referenced by doToyExperiments(), and smearParticles().