#include "CellList.h" void OpenAndRead(char *address) { TFile *file = TFile::Open(address); TTree *tree = (TTree*)file->Get("DsggTree/DecayTree"); int nentries = tree->GetEntries(); printf("%i\n",nentries); tree->SetBranchStatus("*",0); tree->SetBranchStatus("lab2_MC_MOTHER_ID",1); Int_t motherid_Dsplus; int incremented; tree->SetBranchAddress("lab2_MC_MOTHER_ID",&motherid_Dsplus); list IDlist = NULL; list IDcounter = NULL; Insert_front(&IDlist,0); Insert_front(&IDcounter,0); for (int jentry=0; jentryGetEntry(jentry); incremented = 0; int motherid = motherid_Dsplus; for (int n=1; n<=Size(IDlist); n++) { int ID = Get(&IDlist,n); if ( ID == motherid) { incremented += 1; Set(&IDcounter,n,Get(&IDcounter,n)+1); } } if ( incremented == 0) { Insert_tail(&IDlist,motherid_Dsplus); Insert_tail(&IDcounter,1); } } for (int n=1; n<=Size(IDlist); n++) { printf("%i\t%i\n",Get(&IDlist,n),Get(&IDcounter,n)); } file->Close(); } void MotherIDTester2() { OpenAndRead("root://castorlhcb.cern.ch///castor/cern.ch/user/m/mpappaga/Dsstar_spectroscopy/MC/EventType27163222/Ds_Spectroscopy_2012_MU_P6.root"); OpenAndRead("root://castorlhcb.cern.ch///castor/cern.ch/user/m/mpappaga/Dsstar_spectroscopy/MC/EventType27163222/Ds_Spectroscopy_2012_MU_P8.root"); OpenAndRead("root://castorlhcb.cern.ch///castor/cern.ch/user/m/mpappaga/Dsstar_spectroscopy/MC/EventType27163222/Ds_Spectroscopy_2012_MD_P6.root"); OpenAndRead("root://castorlhcb.cern.ch///castor/cern.ch/user/m/mpappaga/Dsstar_spectroscopy/MC/EventType27163222/Ds_Spectroscopy_2012_MU_P8.root"); }