GSI Helmholtzzentrum für Schwerionenforschung
Hi, I want to access the entries for fToF only in simulation but I am not able to access the entries. I am using code: //--------------------------------------------- TFile* f = new TFile("sim_complete.root"); TTree *t=(TTree *) f->Get("cbmsim") ; TClonesArray *ftof_array=new TClonesArray("PndFtofPoint"); t->SetBranchAddress("FtofPoint",&ftof_array);//Branch names for (Int_t k=0; k<ftof_array->GetEntriesFast(); k++) { PndFtofPoint* tofpoint = (PndFtofPoint*)ftof_array->At(k); cout<<"The entries in Ftof are="<< k<<endl; } //----------------------------------------------- Thank You
If you take a look into this macro, you can see you forgot the event loop on the tree: Int_t nEntries = t->GetEntriesFast(); for (Int_t j=0; j< nEntries; j++) { t->GetEntry(j); for (Int_t k=0; k<ftof_array->GetEntriesFast(); k++) { PndFtofPoint* tofpoint = (PndFtofPoint*)ftof_array->At(k); cout<<"This is Ftof entry number "<< k<<endl; } }
Hi Stefano, Thank you for reply I have a question that when I run the above code I have the output below. Now for total entries I have to sum these all numbers or I have to consider every entry number as 1 entry. This is Ftof entry number 3 This is Ftof entry number 1 This is Ftof entry number 2 This is Ftof entry number 3 This is Ftof entry number 4 This is Ftof entry number 5 This is Ftof entry number 6 This is Ftof entry number 7 This is Ftof entry number 8 This is Ftof entry number 9
That is the loop over the ftof hits. If you want to have the sum per event, then it is enough: Int_t counts = ftof_array->GetEntriesFast();
Hi Stefano, I am matching the track Id for start detector and Ftof, I have a doubt that for every entry of tree I get around 4 or 5 track id for start and around 2 or 3 for Ftof. My question is I have to match the track id for both detectors for every entry of tree one by one or I have to store all the track id corresponding to both detector in two different array for all the entry in tree then in the last I have to match them.
The best way would be to loop over the MCTrack array, you select only the primary particles (GetMotherID()==-1), and for each MCTrack ID you associate the point in the start and the point in the ftof. In the case you have more than one point for each track IF, mabe you could store also the multiplicity. Or maybe you define a new TObjArray (or maybe a vector) storing all the Points (or maybe the indices) correlated to the same track id.
Thank You for reply I have tried to use mc_array but the entries in MC Track are 5742300 that will take longer time to match but in start and ftof i have entries 19185 and 10340 respectively That is the reason I have choose array to store track id.
Which kind of events do you have, with a so high number of points in the ftof and start? I beliebe there should be something wrong Could you please put your package and amcros somehwre in the development branch, so that I can take a look? (but next week)
I am using the macro/run/sim_complete.C for 1 GeV 20000 pion with multiplicity 5 by box generator.I am using the lambda disk Geometry as start detector. I am attaching the plot and picture. I have not changed any thing in sim_complete.C just use box generator and mom=1GeV.
Again, MCTrack is fine, but if you select ONLY the primary particles, where GetMotherID()==-1, you should see many less particles in all the systems. I believe you don't want to reconstruct secondary particles.
Thank you for reply, I will try the way you have suggested.