[d2n-analysis-talk] BB cer class TDC mod
Diana Parno
dparno at cmu.edu
Wed Jun 23 16:57:39 EDT 2010
Maybe there's some obvious reason why this wouldn't work, but you
might try to cheat by making a 1D array of TVector objects (the same
way you would make an array of histograms, etc).
For example, here's how to set up an array of pointers to TVector
objects:
TVector** multihit = (TVector**)malloc(numPMTs * sizeof(TVector*));
// PMT 0
multihit[0] = new TVector(/*construct your 1d array for PMT0*/);
You can then refer to each TVector object using multihit[index]-> .
The indexing might be a little complicated but I think it would
probably work.
Don't forget to explicitly free the memory used by this (every malloc
call should be paired with a free):
free(multihit);
Best,
Diana
On Jun 23, 2010, at 6:08 AM, posik at jlab.org wrote:
> Hi all,
>
> So in trying to modify the THaCherenkov class to include multi-hit
> TDCs,
> I ran into a when trying to have the variables that I was using in the
> Cherenkov class write to the ROOT Tree. It turns out that the analyzer
> global variable system does not support 2D arrays. So my idea of
> having
> a variable structure of TDC[PMT][Nhit] is not easily possible. I had
> sent an email to Ole. Here is the convo:
>
> //////////////////////////////////////////////////////////////////
>
> me:
> Since the BigBite Cherenkov uses multi-hit TDC information, I need to
> modify the THaCherenkov class to incoorperate this information. What I
> would like to do is the following:
>
> - change the current 1D array TDC variable BB.cer.t to a 2D array
> variable. Currently the class has the variable Float t[fNelem]
> which is
> an array of the number of PMTs. I want this to be an array like Float
> t[fNelem][ndata], where fNelem is the PMT number and ndata is the TDC
> channel that got hit. I started to look at how the DecData class took
> advantage of the multi-hit TDCs and what that class did was to have
> fNelem variables of length ndata so for example
>
> Float PMT1[ndata]
> Float PMT2[ndata]
> .
> .
> .
> Float PMTFnelem[ndata]
> //
> Ole:
> what you are doing is exactly right. Unfortunately, the "global
> variable"
> system in the analyzer does not support 2D arrays. (That's why there
> are
> all these ugly definitions in DecData.) There are a number of
> possibilities.
>
> (a) you could duplicate the setup in DecData. That would give you
> quick
> results, but you may have to do some recoding. You can always map
> individual member variables into an array, so you can still make
> things
> look like a 2D array in the code, except you lose the flexibility of
> having a configurable number of PMTs.
>
> (b) You may decide that writing out all the hit information is just a
> luxury, and the analysis can be done already in the Cherenkov class
> rather
> than interactively with ROOT. (That's a situation I've encountered
> frequently.)
>
> (c) We can add support for 2D arrays. That may take a while,
> unfortunately, since I am currently quite busy. Of course, you are
> welcome
> to take a shot at it ... but be warned, it gets pretty technical.
>
> I will put (c) on my longer-term to-do list.
>
> /////////////////////////////////////////////////////////////
>
> I am now thinking how I should approach this with only 1D arrays. Are
> there any suggestions?
>
> Thanks
> Matt
>
>
>
>
> _______________________________________________
> d2n-analysis-talk mailing list
> d2n-analysis-talk at jlab.org
> https://mailman.jlab.org/mailman/listinfo/d2n-analysis-talk
>
More information about the d2n-analysis-talk
mailing list