Example #1
0
// *** routine to only keep PID matched candidates in list
int SelectTruePid(PndAnalysis *ana, RhoCandList &l)
{
	int removed = 0;
	
	for (int ii=l.GetLength()-1;ii>=0;--ii)
	{
		if ( !(ana->McTruthMatch(l[ii])) )
		{
			l.Remove(l[ii]);
			removed++;
		}
	}
	
	return removed;
}
Example #2
0
void countDoubles(RhoCandList &l, int &n1, int &n2, int &n3)
{
	int n_smc  = 0;
	int n_strk = 0;
	int n_both = 0;
	double d = 0.00001;
	
	for (int i=0;i<l.GetLength()-1;++i)
	{
		for (int j=i+1;j<l.GetLength();++j)
		{
			TLorentzVector dl = l[i]->P4() - l[j]->P4();
		
			bool chkmc = (l[i]->GetMcTruth()==l[j]->GetMcTruth());
			bool chktrk = (fabs(dl.X())<d) && (fabs(dl.Y())<d) && (fabs(dl.Z())<d) && (fabs(dl.E())<d);
			if (chkmc) n_smc++;
			if (chktrk) n_strk++;
			if (chktrk && chkmc) n_both++;
		}	
	}
	n1 = n_strk;
	n2 = n_smc;
	n3 = n_both;
}
Example #3
0
void tut_ana_mclist(int nevts=0)
{
	// *** some variables
	int i=0,j=0, k=0, l=0;

	TString OutFile="output.root";

	// *** the files coming from the simulation
	TString inPidFile = "pid_complete.root";    // this file contains the PndPidCandidates and McTruth
	TString inParFile = "simparams.root";

	gStyle->SetOptFit(1011);

	// *** PID table with selection thresholds; can be modified by the user
	TString pidParFile = TString(gSystem->Getenv("VMCWORKDIR"))+"/macro/params/all.par";

	// *** initialization
	FairLogger::GetLogger()->SetLogToFile(kFALSE);
	FairRunAna* fRun = new FairRunAna();
	FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
	fRun->SetInputFile(inPidFile);

	// *** setup parameter database
	FairParRootFileIo* parIO = new FairParRootFileIo();
	parIO->open(inParFile);
	FairParAsciiFileIo* parIOPid = new FairParAsciiFileIo();
	parIOPid->open(pidParFile.Data(),"in");

	rtdb->setFirstInput(parIO);
	rtdb->setSecondInput(parIOPid);
	rtdb->setOutput(parIO);

	fRun->SetOutputFile(OutFile);
	fRun->Init();

	//
	// Now the analysis stuff comes...
	//


	// *** the data reader object
	PndAnalysis* theAnalysis = new PndAnalysis();
	if (nevts==0) nevts= theAnalysis->GetEntries();

	// *** RhoCandLists for the analysis
	RhoCandList mctruth;

	// ***
	// the event loop
	// ***
	while (theAnalysis->GetEvent() && i++<nevts)
	{
		cout<<"****** Evt " << i << endl;

		// *** the MC Truth objects
		theAnalysis->FillList(mctruth,"McTruth");

		//
		// Print MC Truth list with mother-daughter relations
		//
		for (j=0;j<mctruth.GetLength();++j)
		{
			RhoCandidate *mcmother = mctruth[j]->TheMother();

		  	int muid = -1;
		  	if (mcmother) muid = mcmother->GetTrackNumber();

		  	cout << "Track "<< mctruth[j]->GetTrackNumber()<<" (PDG:"<<mctruth[j]->PdgCode() <<") has mother "<<muid;

		  	if (mctruth[j]->NDaughters()>0) cout <<" and daughter(s) ";
		  	for (k=0;k<mctruth[j]->NDaughters();++k) cout <<mctruth[j]->Daughter(k)->GetTrackNumber()<<"  ";

		  	cout<<endl;
		}
		cout <<endl;
	}

}
Example #4
0
	  void GetNotCombinedList(RhoCandList combinedList, RhoCandList * candList){
		  for (int j=0; j<combinedList.GetLength(); j++){
			  RhoCandidate * combinedCand = combinedList[j];
			  candList->Remove(combinedCand);
		  }
	  }