MINT2
Public Member Functions | Private Attributes | List of all members
ReadNTuple< T, N > Class Template Reference

#include <ReadNTuple.h>

Inheritance diagram for ReadNTuple< T, N >:
ReadNTupleBase

Public Member Functions

std::string newFilename () const
 
 ReadNTuple (DalitzEventPattern *pat, std::string fname, std::string ntpName="DalitzEventList", const char *cuts="", long int maxEvents=-1)
 
 ~ReadNTuple ()
 
bool getTree ()
 
bool SetDaughterBranchAddress (const char *Px, const char *Py, const char *Pz, const char *E, const char *pdg)
 
bool SetMotherBranchAddress (const char *Px, const char *Py, const char *Pz, const char *E, const char *pdg)
 
void AddSlowPion (const char *Px="SlowPion_PX", const char *Py="SlowPion_PY", const char *Pz="SlowPion_PZ", const char *E="SlowPion_E", const char *pdg="SlowPion_ID")
 
void SetEventPattern (DalitzEventPattern *pat)
 
void ApplyFiducalCuts ()
 
bool passFiducalCuts (unsigned int entry)
 
bool passedFidCuts (float dx, float dy, float dz)
 
bool AddFriend (std::string fname, std::string ntpName)
 
bool getUpdatedTree ()
 
void useWeights (bool Weights)
 
void weightVarName (std::string weightName)
 
MINT::counted_ptr< DalitzEventreadEntry (unsigned int entry)
 
bool readit (MinimalEventList< DalitzEvent > *listPtr, int nEvents=-1, double scale=1.0)
 
bool testEventPattern ()
 
bool passETAcut (unsigned int entry)
 
float Random ()
 
void SetEntries (int entries)
 
void SetFirstEntry (int firstEntry)
 
- Public Member Functions inherited from ReadNTupleBase
 ReadNTupleBase ()
 
 ~ReadNTupleBase ()
 

Private Attributes

TFile * _file0
 
TTree * _oldTree
 
TTree * _tree
 
std::string _fname
 
std::string _ntpName
 
long int _maxEvents
 
TRandom Rand
 
TTree * friendTree
 
std::vector< std::vector< N > > m_input_var
 
std::vector< T > m_pdg
 
std::vector< int > set_pat
 
std::vector< N > m_mother_var
 
m_mother_pdg
 
bool m_useWeights
 
std::string m_weightName
 
std::vector< N > m_slowPion_var
 
int m_slowPion_pdg
 
bool slowPion
 
int m_particle
 
const char * _cuts
 
Long64_t _entries
 
Long64_t _firstentry
 
TLorentzVector _pMother
 
DalitzEventPatternm_pat
 
bool _applyFiducalCuts
 

Detailed Description

template<typename T, typename N>
class ReadNTuple< T, N >

Definition at line 31 of file ReadNTuple.h.

Constructor & Destructor Documentation

◆ ReadNTuple()

template<typename T , typename N >
ReadNTuple< T, N >::ReadNTuple ( DalitzEventPattern pat,
std::string  fname,
std::string  ntpName = "DalitzEventList",
const char *  cuts = "",
long int  maxEvents = -1 
)
inline

Definition at line 75 of file ReadNTuple.h.

81  : _file0(0)
82  , _oldTree(0)
83  , _tree(0)
84  , _fname(fname)
85  , _ntpName(ntpName)
86  , _maxEvents(maxEvents)
87  , m_useWeights(false)
88  , m_particle(0)
89  , _firstentry(0)
90  , _entries(1000000000)
91  {
92  m_weightName = "";
93 
94  for (int i = 0; i < 5; i++) {
95  vector<N> row; // Create an empty row
96  for (int j = 0; j < 5; j++) {
97  row.push_back(i * j); // Add an element (column) to the row
98  }
99  m_input_var.push_back(row); // Add the row to the main vector
100  }
101 
102  for (int i = 0; i < 4; i++) {
103  m_pdg.push_back(0);
104  m_mother_var.push_back(0);
105  m_slowPion_var.push_back(0);
106 
107  }
108 
109  // SetEventPattern(pat);
110 
111  slowPion = false;
112  _cuts = cuts;
113  _applyFiducalCuts = false;
114 
115  SetEventPattern(pat);
116  getTree();
117  }
bool _applyFiducalCuts
Definition: ReadNTuple.h:69
std::string _ntpName
Definition: ReadNTuple.h:38
TTree * _tree
Definition: ReadNTuple.h:36
long int _maxEvents
Definition: ReadNTuple.h:39
bool slowPion
Definition: ReadNTuple.h:57
std::vector< std::vector< N > > m_input_var
Definition: ReadNTuple.h:46
TFile * _file0
Definition: ReadNTuple.h:34
TTree * _oldTree
Definition: ReadNTuple.h:35
bool getTree()
Definition: ReadNTuple.h:124
std::vector< N > m_slowPion_var
Definition: ReadNTuple.h:55
bool m_useWeights
Definition: ReadNTuple.h:52
int m_particle
Definition: ReadNTuple.h:59
Long64_t _firstentry
Definition: ReadNTuple.h:63
void SetEventPattern(DalitzEventPattern *pat)
Definition: ReadNTuple.h:138
std::string m_weightName
Definition: ReadNTuple.h:53
std::string _fname
Definition: ReadNTuple.h:37
std::vector< T > m_pdg
Definition: ReadNTuple.h:47
const char * _cuts
Definition: ReadNTuple.h:60
Long64_t _entries
Definition: ReadNTuple.h:62
std::vector< N > m_mother_var
Definition: ReadNTuple.h:49

◆ ~ReadNTuple()

template<typename T , typename N >
ReadNTuple< T, N >::~ReadNTuple ( )
inline

Definition at line 119 of file ReadNTuple.h.

120  {
121 
122  }

Member Function Documentation

◆ AddFriend()

template<typename T , typename N >
bool ReadNTuple< T, N >::AddFriend ( std::string  fname,
std::string  ntpName 
)

Definition at line 191 of file ReadNTuple.h.

193  {
194  if (fname == "" || ntpName == "")
195  {
196  std::cout << "No friend Specified" << std::endl;
197  return true;
198  }
199  TFile* f = TFile::Open(fname.c_str(), "READ");
200  if(0 == f) return false;
201  friendTree = dynamic_cast<TTree*>(f->Get(ntpName.c_str()));
202  _oldTree->AddFriend(friendTree);
203  return (0 != _oldTree);
204 
205  }
TTree * _oldTree
Definition: ReadNTuple.h:35
TTree * friendTree
Definition: ReadNTuple.h:44

◆ AddSlowPion()

template<typename T , typename N >
void ReadNTuple< T, N >::AddSlowPion ( const char *  Px = "SlowPion_PX",
const char *  Py = "SlowPion_PY",
const char *  Pz = "SlowPion_PZ",
const char *  E = "SlowPion_E",
const char *  pdg = "SlowPion_ID" 
)

Definition at line 640 of file ReadNTuple.h.

641 {
642 
643  _oldTree->SetBranchAddress(Px,(float*)&m_slowPion_var[0]);
644  _oldTree->SetBranchAddress(Py,(float*)&m_slowPion_var[1]);
645  _oldTree->SetBranchAddress(Pz,(float*)&m_slowPion_var[2]);
646  _oldTree->SetBranchAddress(E,(float*)&m_slowPion_var[3]);
647  _oldTree->SetBranchAddress(pdg,(int*)&m_slowPion_pdg);
648  slowPion = true;
649 
650 }
bool slowPion
Definition: ReadNTuple.h:57
TTree * _oldTree
Definition: ReadNTuple.h:35
int m_slowPion_pdg
Definition: ReadNTuple.h:56
std::vector< N > m_slowPion_var
Definition: ReadNTuple.h:55

◆ ApplyFiducalCuts()

template<typename T , typename N >
void ReadNTuple< T, N >::ApplyFiducalCuts ( )

Definition at line 265 of file ReadNTuple.h.

266 {
267  _applyFiducalCuts = true;
268 }
bool _applyFiducalCuts
Definition: ReadNTuple.h:69

◆ getTree()

template<typename T , typename N >
bool ReadNTuple< T, N >::getTree ( )
inline

Definition at line 124 of file ReadNTuple.h.

124  {
125  TFile* f = TFile::Open(_fname.c_str(), "READ");
126  if(0 == f) return false;
127  _oldTree = dynamic_cast<TTree*>(f->Get(_ntpName.c_str()));
128  return (0 != _oldTree);
129  }
std::string _ntpName
Definition: ReadNTuple.h:38
TTree * _oldTree
Definition: ReadNTuple.h:35
std::string _fname
Definition: ReadNTuple.h:37

◆ getUpdatedTree()

template<typename T , typename N >
bool ReadNTuple< T, N >::getUpdatedTree ( )

Definition at line 216 of file ReadNTuple.h.

217 {
218 
219  TEntryList* elist=0;
220 
221  _oldTree->SetBranchStatus("*",1);
222  if (_cuts&&strcmp(_cuts,"")!=0) {
223  _oldTree->Draw(">>elist",_cuts,"entryList");
224  elist = (TEntryList*)gDirectory->Get("elist");
225  if (!elist)
226  {
227  std::stringstream msg;
228  msg << "Failed to retrieve TEntryList for cuts " << _cuts;
229 
230  }
231  _oldTree->SetEntryList(elist);
232  }
233  Long64_t nentries = !elist?_oldTree->GetEntries():elist->GetN();
234  if (nentries==0) {
235  std::cout << "No entries after cuts " << _cuts << std::endl;
236  }
237 
238  // attachit();
239  // cout << "ReadNTuple::getTree(): Reading from " << _fname
240  // << ", writing to: " << newFilename() << endl;
241  _file0 = TFile::Open(newFilename().c_str(), "RECREATE");
242  cout << "opened new file " << _file0 << endl;
243  if(0 == _file0) return false;
244  _file0->cd();
245  cout << "cd'ed to new file " << endl;
246  // _tree = _oldTree->CloneTree(1000);
247  std::cout << "Cuts: " << _cuts << std::endl;
248 
249  _tree = _oldTree->CopyTree(_cuts, "",_entries,_firstentry);
250 
251  _tree->Write();
252 
253 
254  return (0 != _tree);
255 }
TTree * _tree
Definition: ReadNTuple.h:36
TFile * _file0
Definition: ReadNTuple.h:34
TTree * _oldTree
Definition: ReadNTuple.h:35
std::string newFilename() const
Definition: ReadNTuple.h:174
Long64_t _firstentry
Definition: ReadNTuple.h:63
const char * _cuts
Definition: ReadNTuple.h:60
Long64_t _entries
Definition: ReadNTuple.h:62

◆ newFilename()

template<typename T , typename N >
std::string ReadNTuple< T, N >::newFilename ( ) const

Definition at line 174 of file ReadNTuple.h.

174  {
175  bool exists = true;
176  ofstream checkFile;
177  int i=0;
178  string newFilename(_fname);
179  newFilename.insert(newFilename.find_last_of('.'), "_reweighted");
180  do{
181  newFilename.insert(newFilename.find_last_of('.'), anythingToString(i++));
182  checkFile.open( newFilename.c_str(), ios::in );
183  exists = ! checkFile.fail();
184  checkFile.close();
185  }while(exists);
186 
187  return newFilename;
188 }
bool exists(const string &fname)
std::string newFilename() const
Definition: ReadNTuple.h:174
std::string anythingToString(const T &anything)
Definition: Utils.h:62
std::string _fname
Definition: ReadNTuple.h:37

◆ passedFidCuts()

template<typename T , typename N >
bool ReadNTuple< T, N >::passedFidCuts ( float  dx,
float  dy,
float  dz 
)

Definition at line 271 of file ReadNTuple.h.

272 {
273  bool passCuts = true;
274  if (fabs(dx) > 0.317*(dz - 2400))
275  {
276  passCuts = false;
277  }
278  if (fabs(dy/dz) < 0.02){
279  double p1 = 398;//418
280  double p2 = 517;//497
281  double beta1 = 0.01397;
282  double beta2 = 0.01605;
283  if( ( (p1 - beta1*dz) < fabs(dx) ) || ( fabs(dx) < ( p2+ beta2*dz ) ))
284  //|| (fabs(dx) > 600 && fabs(dx) < 700)) //add this back in if needed
285  {
286  passCuts = false;
287  }
288  }
289  // if ( (fabs(dx) > 600 && fabs(dx) < 700)) passCuts = false;
290 
291  // if (sqrt(dx*dx+dy*dy+dz*dz) > 100000) passCuts = false;
292 
293  return passCuts;
294 }

◆ passETAcut()

template<typename T , typename N >
bool ReadNTuple< T, N >::passETAcut ( unsigned int  entry)

Definition at line 653 of file ReadNTuple.h.

654 {
655  bool passETAcut = false;
656  _tree->GetEntry(entry);
657 
658  float dx = m_mother_var[0];
659  float dy = m_mother_var[1];
660  float dz = m_mother_var[2];
661  float P = sqrt(dx*dx+dy*dy+dz*dz);
662  float ETA = 0.5*log( (P + dz)/(P - dz) );
663  if (ETA < 5.0 && ETA > 2.0 ) passETAcut = true;
664  if (P < 300000 ) passETAcut = true;
665  return passETAcut;
666 }
TTree * _tree
Definition: ReadNTuple.h:36
bool passETAcut(unsigned int entry)
Definition: ReadNTuple.h:653
std::vector< N > m_mother_var
Definition: ReadNTuple.h:49

◆ passFiducalCuts()

template<typename T , typename N >
bool ReadNTuple< T, N >::passFiducalCuts ( unsigned int  entry)

Definition at line 297 of file ReadNTuple.h.

298 {
299  _tree->GetEntry(entry);
300  bool passCuts = true;
301 
302 
303  for (int i = 0; i<4; i++)
304  {
305  float dx = m_input_var[0][i];
306  float dy = m_input_var[1][i];
307  float dz = m_input_var[2][i];
308  if (!passedFidCuts(dx,dy,dz)) passCuts = false;
309  }
310 
311  if (slowPion)
312  {
313  if (!passedFidCuts(m_slowPion_var[0],m_slowPion_var[1],m_slowPion_var[2])) passCuts = false;
314  }
315  return passCuts;
316 }
TTree * _tree
Definition: ReadNTuple.h:36
bool slowPion
Definition: ReadNTuple.h:57
std::vector< std::vector< N > > m_input_var
Definition: ReadNTuple.h:46
std::vector< N > m_slowPion_var
Definition: ReadNTuple.h:55
bool passedFidCuts(float dx, float dy, float dz)
Definition: ReadNTuple.h:271

◆ Random()

template<typename T , typename N >
float ReadNTuple< T, N >::Random ( )
inline

Definition at line 162 of file ReadNTuple.h.

163  {
164  return Rand.Rndm();
165  }
TRandom Rand
Definition: ReadNTuple.h:43

◆ readEntry()

template<typename T , typename N >
MINT::counted_ptr< DalitzEvent > ReadNTuple< T, N >::readEntry ( unsigned int  entry)

Definition at line 346 of file ReadNTuple.h.

346  {
347 
348  // we read the MC-truth 4-momenta as we want to re-weight
349  // according to the trugh.
350  // Things to cut on are read from reconstructed data.
351 
352  bool dbThis = false;
353 
354  _tree->GetEntry(entry);
355 
356  if (set_pat.size() == 0)
357  {
358  std::cout << "Could not find EventPattern Did you set it?" << std::endl;
359  counted_ptr<DalitzEvent> zeroPtr(0);
360  return zeroPtr;
361  }
362  // if (set_pat.size() != m_pdg.size())
363  // {
364  // std::cout << "Event Patterns not the same" << std::endl;
365  // counted_ptr<DalitzEvent> zeroPtr(0);
366  // return zeroPtr;
367  // }
368  // for (int i = 0; i < 5; i++)
369  // {
370  // if (m_pdg[i] != set_pat[i])
371  // {
372  // std::cout << "ReadNTuple: Warning input Pattern does not match selected Events: Setting pattern to match Events " << m_pdg << std::endl;
373  // set_pat = m_pdg;
374  // break;
375  // }
376  //
377  // }
378 
379  // OrderParticles();
380  // we'll fill it according to the event pattern
381  // 421 -> -321 +211 -211 +211
382  // DalitzEventPattern pat(421, -211, +211, +211, -211);
383 
384  TLorentzVector mother(m_mother_var[0],m_mother_var[1],m_mother_var[2],m_mother_var[3]);
385 
386  // Get daughter LorentzVectors
387  TLorentzVector daughter1(m_input_var[0][0],m_input_var[1][0],m_input_var[2][0],m_input_var[3][0]);
388  TLorentzVector daughter2(m_input_var[0][1],m_input_var[1][1],m_input_var[2][1],m_input_var[3][1]);
389  TLorentzVector daughter3(m_input_var[0][2],m_input_var[1][2],m_input_var[2][2],m_input_var[3][2]);
390  TLorentzVector daughter4(m_input_var[0][3],m_input_var[1][3],m_input_var[2][3],m_input_var[3][3]);
391 
392  std::vector<TLorentzVector> daughter;
393  daughter.push_back(daughter1);
394  daughter.push_back(daughter2);
395  daughter.push_back(daughter3);
396  daughter.push_back(daughter4);
397 
398  if (dbThis)
399  {
400  if (!(entry%10000))
401  {
402  cout << "PDG: " << (int)m_pdg[0] << " Px: " << m_input_var[0][0] << std::endl;
403  cout << "PDG: " << (int)m_pdg[1] << " Px: " << m_input_var[0][1] << std::endl;
404  cout << "PDG: " << (int)m_pdg[2] << " Px: " << m_input_var[0][2] << std::endl;
405  cout << "PDG: " << (int)m_pdg[3] << " Px: " << m_input_var[0][3] << std::endl;
406  cout << "Mother PDG: " << m_mother_pdg << " Px: " << m_mother_var[0] << std::endl;
407 
408  }
409  }
410  // vector of Lorentz Vectors to great Dalitz Event
411  vector<TLorentzVector> PArray(5);
412 
413  TLorentzVector* pMother = &(PArray[0]);
414  *pMother = mother;
415 
416  int pdgArray[5];
417  pdgArray[0] = (int)m_mother_pdg;
418  // std::cout << m_mother_pdg <<
419 
420  if (dbThis)
421  {
422  if (!(entry%10000))
423  {
424  std::cout << "PArray Px: " << PArray[0].Px() << std::endl;
425  std::cout << "Mother Px: " << mother.Px() << std::endl;
426  }
427  }
428  std::vector<int> passed_pat = set_pat;
429  std::vector<T> this_pat = m_pdg; //change this for DTF
430  if (dbThis)
431  {
432  if (!(entry%1000))
433  {
434  for (int i = 0; i < 4; i++) // loop over particles read in
435  {
436  cout << "this_pat: " << (int)this_pat[i] << " passed pat:" << passed_pat[i];
437  cout << std::endl;
438  }
439  }
440  }
441 
442  // Order daughter particles accordinging to passed_pat
443  for (int j =1; j<5; j++) // loop over particles in pattern given
444  {
445  for (int i = 0; i < 4; i++) // loop over particles read in
446  {
447  if (dbThis)
448  {
449  if (!(entry%1000))
450  {
451  cout << "Pdg: " << passed_pat[j] << " " << (int)this_pat[i];
452  cout << std::endl;
453  }
454  }
455  if (passed_pat[j] == (int)this_pat[i]) // if particle equal to the one in pattern
456  {
457  pdgArray[j] = (int)this_pat[i];
458  PArray[j] = daughter[i];
459  this_pat[i] = 999; // dont use this particle again
460  if (dbThis)
461  {
462  if (!(entry%1000))
463  {
464  cout << "Pdg: " << passed_pat[j];
465  cout << " Px: " << PArray[j].Px() << std::endl;
466  }
467  }
468  break;
469  }
470  }
471  }
472 
473  // Randomize indentical final state particles
474  for (int i = 1; i < 4; i++)
475  {
476  for (int j = i+1; j < 5; j++)
477  {
478  if( pdgArray[i] == pdgArray[j])
479  {
480  // if(gRandom->Rndm() >0.5)
481  if (Random() > 0.5)
482  {
483  swap(PArray[i],PArray[j] );//swap 4-momenta
484  swap(pdgArray[i],pdgArray[j] );//shouldn't need this
485  }
486  }
487  }
488  }
489 
490 
491  if (dbThis)
492  {
493  if(entry < 5){
494  for(unsigned int i = 0; i < 5; i++){
495  cout << " mass " << i << ") " << PArray[i].M()
496  << " Px " << i << ") " << PArray[i].Px()
497  << " Py " << i << ") " << PArray[i].Py()
498  << " Pz " << i << ") " << PArray[i].Pz()
499  << " E " << i << ") " << PArray[i].E()
500  << ", pdg " << pdgArray[i] << endl;
501  }
502  }
503 
504  if (!(entry%10000))
505  {
506  for(unsigned int i = 0; i < 5; i++){
507  cout << " mass " << i << ") " << PArray[i].M()
508  << " Px " << i << ") " << PArray[i].Px()
509  << ", pdg " << pdgArray[i] << endl;
510  }
511  }
512  }
513  _pMother.SetPxPyPzE(m_mother_var[0], m_mother_var[1], m_mother_var[2], m_mother_var[3]);
514 
515  // DalitzEvent* devt = new DalitzEvent(*m_pat, PArray);
516  MINT::counted_ptr<DalitzEvent> evtPtr(new DalitzEvent(*m_pat, PArray));
517  return evtPtr;
518 }
TTree * _tree
Definition: ReadNTuple.h:36
std::vector< std::vector< N > > m_input_var
Definition: ReadNTuple.h:46
DalitzEventPattern * m_pat
Definition: ReadNTuple.h:67
T m_mother_pdg
Definition: ReadNTuple.h:50
float Random()
Definition: ReadNTuple.h:162
std::vector< T > m_pdg
Definition: ReadNTuple.h:47
std::vector< N > m_mother_var
Definition: ReadNTuple.h:49
TLorentzVector _pMother
Definition: ReadNTuple.h:65
std::vector< int > set_pat
Definition: ReadNTuple.h:48

◆ readit()

template<typename T , typename N >
bool ReadNTuple< T, N >::readit ( MinimalEventList< DalitzEvent > *  listPtr,
int  nEvents = -1,
double  scale = 1.0 
)

Definition at line 533 of file ReadNTuple.h.

533  {
534  getUpdatedTree();
535  if(0 == listPtr) return false;
536  int numEvents = 0;
537  TRandom Rand(1987);
538 
539  if (!testEventPattern()) return false;
540 
541  double weight(0);
542  if (m_useWeights)
543  {
544  _tree->SetBranchAddress(m_weightName.c_str(),&weight);
545  }
546  std::cout << "Entries " << _oldTree->GetEntries() << " " << _tree->GetEntries() << std::endl;
547  for(unsigned int i=0; i < _tree->GetEntries(); i++){
548 
549  if (Rand.Rndm() < scale)
550  {
551  if (_applyFiducalCuts)
552  {
553  if (passFiducalCuts(i))
554  {
555  if (passETAcut(i))
556  {
558  if (m_useWeights)
559  {
560  evtPtr->setWeight(weight);
561  }
562 
563  numEvents++;
564  listPtr->Add(*(evtPtr.get()));
565  }
566  }
567  }
568  if (!_applyFiducalCuts)
569  {
571  if (m_useWeights)
572  {
573  evtPtr->setWeight(weight);
574  }
575 
576  if (evtPtr->kinematicallyAllowed(5.e-2))
577  {
578  numEvents++;
579  listPtr->Add(*(evtPtr.get()));
580  }
581  else if (!evtPtr->kinematicallyAllowed(5.e-2))
582  {
583  std::cout << "Not allowed " << std::endl;
584  evtPtr->print();
585  }
586  }
587  if(maxEvents > 0 && numEvents > maxEvents) break;
588  }
589  }
590  return true;
591 }
bool _applyFiducalCuts
Definition: ReadNTuple.h:69
virtual void setWeight(double w)
bool passFiducalCuts(unsigned int entry)
Definition: ReadNTuple.h:297
TTree * _tree
Definition: ReadNTuple.h:36
bool passETAcut(unsigned int entry)
Definition: ReadNTuple.h:653
TTree * _oldTree
Definition: ReadNTuple.h:35
bool testEventPattern()
Definition: ReadNTuple.h:594
TRandom Rand
Definition: ReadNTuple.h:43
MINT::counted_ptr< DalitzEvent > readEntry(unsigned int entry)
Definition: ReadNTuple.h:346
bool getUpdatedTree()
Definition: ReadNTuple.h:216
bool m_useWeights
Definition: ReadNTuple.h:52
void print(std::ostream &os=std::cout) const
std::string m_weightName
Definition: ReadNTuple.h:53
bool kinematicallyAllowed(double epsilon=1.e-9) const
X * get() const
Definition: counted_ptr.h:123

◆ SetDaughterBranchAddress()

template<typename T , typename N >
bool ReadNTuple< T, N >::SetDaughterBranchAddress ( const char *  Px,
const char *  Py,
const char *  Pz,
const char *  E,
const char *  pdg 
)

Definition at line 319 of file ReadNTuple.h.

320 {
321 
322  _oldTree->SetBranchAddress(Px,&m_input_var[0][m_particle]);
323  _oldTree->SetBranchAddress(Py,&m_input_var[1][m_particle]);
324  _oldTree->SetBranchAddress(Pz,&m_input_var[2][m_particle]);
325  _oldTree->SetBranchAddress(E,&m_input_var[3][m_particle]);
326  _oldTree->SetBranchAddress(pdg,&m_pdg[m_particle]);
327  m_particle++;
328 
329  return true;
330 }
std::vector< std::vector< N > > m_input_var
Definition: ReadNTuple.h:46
TTree * _oldTree
Definition: ReadNTuple.h:35
int m_particle
Definition: ReadNTuple.h:59
std::vector< T > m_pdg
Definition: ReadNTuple.h:47

◆ SetEntries()

template<typename T , typename N >
void ReadNTuple< T, N >::SetEntries ( int  entries)
inline

Definition at line 167 of file ReadNTuple.h.

167 { _entries = entries;}
Long64_t _entries
Definition: ReadNTuple.h:62

◆ SetEventPattern()

template<typename T , typename N >
void ReadNTuple< T, N >::SetEventPattern ( DalitzEventPattern pat)
inline

Definition at line 138 of file ReadNTuple.h.

139  {
140  m_pat = pat;
141  set_pat = pat->getVectorOfInts();
142  }
std::vector< int > getVectorOfInts() const
DalitzEventPattern * m_pat
Definition: ReadNTuple.h:67
std::vector< int > set_pat
Definition: ReadNTuple.h:48

◆ SetFirstEntry()

template<typename T , typename N >
void ReadNTuple< T, N >::SetFirstEntry ( int  firstEntry)
inline

Definition at line 168 of file ReadNTuple.h.

168 { _firstentry = firstEntry;}
Long64_t _firstentry
Definition: ReadNTuple.h:63

◆ SetMotherBranchAddress()

template<typename T , typename N >
bool ReadNTuple< T, N >::SetMotherBranchAddress ( const char *  Px,
const char *  Py,
const char *  Pz,
const char *  E,
const char *  pdg 
)

Definition at line 333 of file ReadNTuple.h.

334 {
335 
336  _oldTree->SetBranchAddress(Px,&m_mother_var[0]);
337  _oldTree->SetBranchAddress(Py,&m_mother_var[1]);
338  _oldTree->SetBranchAddress(Pz,&m_mother_var[2]);
339  _oldTree->SetBranchAddress(E,&m_mother_var[3]);
340  _oldTree->SetBranchAddress(pdg,&m_mother_pdg);
341 
342  return true;
343 }
TTree * _oldTree
Definition: ReadNTuple.h:35
T m_mother_pdg
Definition: ReadNTuple.h:50
std::vector< N > m_mother_var
Definition: ReadNTuple.h:49

◆ testEventPattern()

template<typename T , typename N >
bool ReadNTuple< T, N >::testEventPattern ( )

Definition at line 594 of file ReadNTuple.h.

595 {
596  _tree->GetEntry(0);
597  if ((int)set_pat[0] != (int)m_mother_pdg)
598  {
599  cout << "Mother Pattern not the same try CC" << endl;
600  cout << " set_pat " << set_pat[0] << " " << set_pat[1];
601  cout << " " << set_pat[2] << " " << set_pat[3] << std::endl;
602 
603  cout << " m_mother_pdg " << m_mother_pdg << " " << endl;
604 
606  m_pat = new DalitzEventPattern(pat);
608  }
609  if ((int)set_pat[0] != (int)m_mother_pdg)
610  {
611  cerr << " set_pat " << set_pat[0] << std::endl;
612  cerr << "Mother Pattern STILL not the same" << endl;
613  cerr << "Will try other entry" << endl;
614  _tree->GetEntry(10);
615  if (set_pat[0] != m_mother_pdg)
616  {
617  cout << "Mother Pattern not the same try CC" << endl;
618  cout << " set_pat " << set_pat[0] << " " << set_pat[1];
619  cout << " " << set_pat[2] << " " << set_pat[3] << std::endl;
620 
621  cout << " m_mother_pdg " << m_mother_pdg << " " << endl;
622 
624  m_pat = new DalitzEventPattern(pat);
626  }
627  if (set_pat[0] != m_mother_pdg)
628  {
629  cerr << " set_pat " << set_pat[0] << std::endl;
630  cerr << "Mother Pattern STILL not the same" << endl;
631  return false;
632  }
633  }
634 
635  return true;
636 }
TTree * _tree
Definition: ReadNTuple.h:36
std::vector< int > getVectorOfInts() const
DalitzEventPattern * m_pat
Definition: ReadNTuple.h:67
T m_mother_pdg
Definition: ReadNTuple.h:50
DalitzEventPattern makeCPConjugate() const
std::vector< int > set_pat
Definition: ReadNTuple.h:48

◆ useWeights()

template<typename T , typename N >
void ReadNTuple< T, N >::useWeights ( bool  Weights)

Definition at line 521 of file ReadNTuple.h.

522 {
524 }
bool m_useWeights
Definition: ReadNTuple.h:52

◆ weightVarName()

template<typename T , typename N >
void ReadNTuple< T, N >::weightVarName ( std::string  weightName)

Definition at line 527 of file ReadNTuple.h.

528 {
529  m_weightName = weightName;
530 }
std::string m_weightName
Definition: ReadNTuple.h:53

Member Data Documentation

◆ _applyFiducalCuts

template<typename T , typename N >
bool ReadNTuple< T, N >::_applyFiducalCuts
private

Definition at line 69 of file ReadNTuple.h.

◆ _cuts

template<typename T , typename N >
const char* ReadNTuple< T, N >::_cuts
private

Definition at line 60 of file ReadNTuple.h.

◆ _entries

template<typename T , typename N >
Long64_t ReadNTuple< T, N >::_entries
private

Definition at line 62 of file ReadNTuple.h.

◆ _file0

template<typename T , typename N >
TFile* ReadNTuple< T, N >::_file0
private

Definition at line 34 of file ReadNTuple.h.

◆ _firstentry

template<typename T , typename N >
Long64_t ReadNTuple< T, N >::_firstentry
private

Definition at line 63 of file ReadNTuple.h.

◆ _fname

template<typename T , typename N >
std::string ReadNTuple< T, N >::_fname
private

Definition at line 37 of file ReadNTuple.h.

◆ _maxEvents

template<typename T , typename N >
long int ReadNTuple< T, N >::_maxEvents
private

Definition at line 39 of file ReadNTuple.h.

◆ _ntpName

template<typename T , typename N >
std::string ReadNTuple< T, N >::_ntpName
private

Definition at line 38 of file ReadNTuple.h.

◆ _oldTree

template<typename T , typename N >
TTree* ReadNTuple< T, N >::_oldTree
private

Definition at line 35 of file ReadNTuple.h.

◆ _pMother

template<typename T , typename N >
TLorentzVector ReadNTuple< T, N >::_pMother
private

Definition at line 65 of file ReadNTuple.h.

◆ _tree

template<typename T , typename N >
TTree* ReadNTuple< T, N >::_tree
private

Definition at line 36 of file ReadNTuple.h.

◆ friendTree

template<typename T , typename N >
TTree* ReadNTuple< T, N >::friendTree
private

Definition at line 44 of file ReadNTuple.h.

◆ m_input_var

template<typename T , typename N >
std::vector<std::vector<N> > ReadNTuple< T, N >::m_input_var
private

Definition at line 46 of file ReadNTuple.h.

◆ m_mother_pdg

template<typename T , typename N >
T ReadNTuple< T, N >::m_mother_pdg
private

Definition at line 50 of file ReadNTuple.h.

◆ m_mother_var

template<typename T , typename N >
std::vector<N> ReadNTuple< T, N >::m_mother_var
private

Definition at line 49 of file ReadNTuple.h.

◆ m_particle

template<typename T , typename N >
int ReadNTuple< T, N >::m_particle
private

Definition at line 59 of file ReadNTuple.h.

◆ m_pat

template<typename T , typename N >
DalitzEventPattern* ReadNTuple< T, N >::m_pat
private

Definition at line 67 of file ReadNTuple.h.

◆ m_pdg

template<typename T , typename N >
std::vector<T> ReadNTuple< T, N >::m_pdg
private

Definition at line 47 of file ReadNTuple.h.

◆ m_slowPion_pdg

template<typename T , typename N >
int ReadNTuple< T, N >::m_slowPion_pdg
private

Definition at line 56 of file ReadNTuple.h.

◆ m_slowPion_var

template<typename T , typename N >
std::vector<N> ReadNTuple< T, N >::m_slowPion_var
private

Definition at line 55 of file ReadNTuple.h.

◆ m_useWeights

template<typename T , typename N >
bool ReadNTuple< T, N >::m_useWeights
private

Definition at line 52 of file ReadNTuple.h.

◆ m_weightName

template<typename T , typename N >
std::string ReadNTuple< T, N >::m_weightName
private

Definition at line 53 of file ReadNTuple.h.

◆ Rand

template<typename T , typename N >
TRandom ReadNTuple< T, N >::Rand
private

Definition at line 43 of file ReadNTuple.h.

◆ set_pat

template<typename T , typename N >
std::vector<int> ReadNTuple< T, N >::set_pat
private

Definition at line 48 of file ReadNTuple.h.

◆ slowPion

template<typename T , typename N >
bool ReadNTuple< T, N >::slowPion
private

Definition at line 57 of file ReadNTuple.h.


The documentation for this class was generated from the following file: