I’m trying to do a for-loop over some even to get the position (x,y,z) saved in a container. Then use the contained to obtain 3D line fit. Visualize the Fitted 3d Line and all of the 3D points. I don’t know where to start. Can you please give me some ideas.
-----------------------------------------------------------------------
#define Example_cxx
#include "Example.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
// ### Create a histogram of X positions stored in the event
TH1D *hXposition = new TH1D("hXposition", "My first histo", 100, 0, 100);
// ### The Loop() function ####
void Example::Loop()
{
// ### These functions check if the ROOT file is loaded properly ###
if (fChain == 0) return;
// ### This gets the total number of entries (e.g. events) stored in the ROOT file
// ### and event is one simulated particle passing through the liquid argon
Long64_t nentries = fChain->GetEntriesFast();
// ### These are variables we won't use, but ROOT defines for us
Long64_t nbytes = 0, nb = 0;
// ### This for loop loops over all the events stored in the ROOT file
// ### jentry is the current event number under analyis
//for (Long64_t jentry=0; jentry<nentries;jentry++)
for (Long64_t jentry=0; jentry<10;jentry++)
{
// ### Load the information from the tree for this event (e.g. jentry)
Long64_t ientry = LoadTree(jentry);
// ### We will break the code if the returned value of the object in memory is < 0
if (ientry < 0) break;
// #### store the current file information
nb = fChain->GetEntry(jentry); nbytes += nb;
// ### My code starts here ###
if(maxTrackIDE < 1){continue;}
// ### Loop over the IDE's ###
for(int ide = 0; ide < maxTrackIDE; ide++)
{
std::cout<<IDEPos[ide][0]<<std::endl;
hXposition->Fill(IDEPos[ide][0]);
}//<---End ide loop
// Step 1: ### Loop over all the track IDE's for one event and store the X, Y, Z position
// ### into a container
Pos = [double * x, double * y, double * z ]
PosArray = array('i', PositionList )
// ###Step 2: Use the container to obtain a 3d line fit to the points
// ### Step 3: Visualize the Fitted 3d Line and all of the 3D points
}//<---End of the jentry for loop
hXposition->Draw();
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided