|Message: Re: Using OpenScientist to analyse Geant4 data||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
> For example, I would like to normalize a spectrum, having the maximum > height equals 1. How do I iterate over the tuples/histo, doing a > division for each one? We have no IHistogram1D::normalize(double weigth) method. I will let Andreas, that was against its introduction, argue the point... Anyway, within the Lab package, I put below a python procedure that will permit you to produce a normalize histogram suitable for plotting : def H1D_normalize(aName,aLabel,aHistogram,aWeight = 1.): h_normalized = H1D(aName,aLabel,aHistogram.axis().bins(),aHistogram.axis().lowerEdge(),aHistogram.axis().upperEdge()) hsw = aHistogram.sumBinHeights() factor = aWeight/hsw for i in range(0,aHistogram.axis().bins()): x = (aHistogram.axis().binLowerEdge(i) + aHistogram.axis().binUpperEdge(i))/2 h_normalized.fill(x,aHistogram.binHeight(i) * factor) return h_normalized An example of usage : # Get current plotter : plotter = Plotter('') # parametrize plotter (with two regions) : plotter.createRegions(1,2) # Create an histo : h = H1D('h','Rand gauss',100,-5,5) rg = Lib_RandomGauss(0,1) for I in range(0,10000): h.fill(rg.shoot(),1) # From h, create an histo "normalized" to 2 : h_normalized = H1D_normalize('h_normalized','Rand gauss normalized',h,2) print h_normalized.sumBinHeights() # Plot h and h_normalized : plotter.plot(h) plotter.next() plotter.plot(h_normalized) (H1D_normalize will be available at next release of the Lab package alond with an example). > I've tried to play with the evaluator but did not succeed, because I > couldn't understand well the interface. The evaluator permits to define an operation that will be done, at each row processing, on the column entries of a tuple. Its output will be used, for example, to fill an histo. The filter permits to define a cut that will be apply, at each row processing, on the column entries. For example, imagine you have hooked a tuple with two columns "A" and "B" : # Get the tuple : tuple = .... # Book an histo : histo = .... # Create an Evaluator that will do some operation on # columns entries, at each row processing : evaluator = Evaluator(tuple,'A + 2 * B') # Create a filter to "cut" rows according some expression # over column entries : filter = Filter(tuple2,'(fabs(A)<=2)&&(B>=1)') # Project the tuple on the histo. # Only accepted row that have "passed" the filter will # be "evaluated" according "evaluator" ; the result of the # evaluation will be used to fill the histo : tuple.project(histo,evaluator,filter) Note that here, I have used "Evaluator", "Filter", "H1D", "Plotter" procedure that are defined in Lab/scripts/Python/Lab_init.py. These procedures encapsulate some code using my SWIG Python wrapping of the AIDA interfaces. For the moment, in that Lab package, I have only "scripted" evaluator and filter, that is to say ones using an interpreter to evaluat and filter. Someone may ask to be able to define and use compiled ones... Doc improvement : --------------- In general I will rely on the AIDA wed site for doc and examples about the interfaces. You will have to refer to these pages. If you do not find what you want, complain here or at firstname.lastname@example.org, we will try to improve. For the moment only the Tony java material of the SLAC user workshop had been put in the AIDA site, we have to find a way to organize the pages to have c++ examples but in fact also Python examples... Since I use SWIG to wrap the interfaces, a transcription from java example to python should be easy to do. Python AIDA API : --------------- Note that for Python, the AIDA group had not yet discussed the AIDA API for Python. Andreas and me, we are using the SWIG tool to wrap our c++ implementations, but I am not sure that in fact we have the same Python API... Moreover I have no idea of the Python API that Tony have by using Jython... Then for the moment what you see in the Lab/examples/Python (and Lab/scripts/Python/Lab_init.py) scripts had not be "AIDA-discussed". I will try to raise the point at our next AIDA workshop (begin of June at CERN). > I'll try to dig deeper into the code but this is a hard way to go > further, that is, I couldn't find a straight doc, leading me to the > point. And there is probably not one right now ; that is to say a one explaining thorougthly the interfaces along with examples for various languages (C++, Java, Python) and along with what is available in the implementations. Some material exists and have to be gather in the AIDA web sites. Mainly the situation is that now we have some code covering three languages that permits to do most of common things (ok, except a normalize...) and that we are at the beginning of organizing the doc (and the rest) for all that...
|Inline Depth:||Outline Depth:||Add message:|