From c8603a2bfe65b1e5c2b6639e97098a7e4b5cc64c Mon Sep 17 00:00:00 2001 From: dsilverm Date: Fri, 22 Jan 2010 01:52:40 +0000 Subject: [PATCH] Neural Net signal fitter code from Paola/Catania --- EMCAL/AliCaloNeuralFit.cxx | 1057 ++++++++++++++++++++++++++++++++++++ EMCAL/AliCaloNeuralFit.h | 140 +++++ EMCAL/AliEMCALRawUtils.cxx | 63 ++- EMCAL/AliEMCALRawUtils.h | 2 +- EMCAL/EMCALrecLinkDef.h | 1 + EMCAL/libEMCALrec.pkg | 4 +- 6 files changed, 1259 insertions(+), 8 deletions(-) create mode 100644 EMCAL/AliCaloNeuralFit.cxx create mode 100644 EMCAL/AliCaloNeuralFit.h diff --git a/EMCAL/AliCaloNeuralFit.cxx b/EMCAL/AliCaloNeuralFit.cxx new file mode 100644 index 00000000000..a2a9e1bbe23 --- /dev/null +++ b/EMCAL/AliCaloNeuralFit.cxx @@ -0,0 +1,1057 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id: $ */ + +//_________________________________________________________________________ +// Utility Class for Neural Network fit +// +// currently uses 5 input neurons +// network configured via TMultiLayerPerceptron +// +//*-- Author: Paola La Rocca (Catania) +// + +#include "AliCaloNeuralFit.h" +#include + + +Double_t AliCaloNeuralFit::Value +(int index, Double_t in0, Double_t in1, Double_t in2, Double_t in3, Double_t in4) +{ +// +// Compute the neural network answer, +// given the input values (taken from the signal TGraph) +// + + fInput0 = in0; + fInput1 = in1; + fInput2 = in2; + fInput3 = in3; + fInput4 = in4; + switch(index) + { + case 0: + return Neuron0x945d4f0(); + case 1: + return Neuron0x945f490(); + default: + return 0.; + } +} + +Double_t AliCaloNeuralFit::Neuron0x945cbe8() const +{ +// +// Input neuron. +// Just return activation value externally setted. +// + + return fInput0; +} + +Double_t AliCaloNeuralFit::Neuron0x945cd78() const +{ +// +// Input neuron. +// Just return activation value externally setted. +// + + return fInput1; +} + +Double_t AliCaloNeuralFit::Neuron0x945cf50() const +{ +// +// Input neuron. +// Just return activation value externally setted. +// + + return fInput2; +} + +Double_t AliCaloNeuralFit::Neuron0x945d128() const +{ +// +// Input neuron. +// Just return activation value externally setted. +// + + return fInput3; +} + +Double_t AliCaloNeuralFit::Neuron0x945d300() const +{ +// +// Input neuron. +// Just return activation value externally setted. +// + + return fInput4; +} + +Double_t AliCaloNeuralFit::Input0x945d620() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + + Double_t input = -0.508174; + input += Synapse0x943edb8(); + input += Synapse0x945d7d0(); + input += Synapse0x945d7f8(); + input += Synapse0x945d820(); + input += Synapse0x945d848(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945d620() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945d620(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945d870() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = 0.29145; + input += Synapse0x945da68(); + input += Synapse0x945da90(); + input += Synapse0x945dab8(); + input += Synapse0x945dae0(); + input += Synapse0x945db08(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945d870() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945d870(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945db30() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.132489; + input += Synapse0x945dd28(); + input += Synapse0x945dd50(); + input += Synapse0x945dd78(); + input += Synapse0x945dda0(); + input += Synapse0x945ddc8(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945db30() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945db30(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945ddf0() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -1.12891; + input += Synapse0x945dfe8(); + input += Synapse0x945e010(); + input += Synapse0x945e0c0(); + input += Synapse0x945e0e8(); + input += Synapse0x945e110(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945ddf0() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945ddf0(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945e138() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = 0.576896; + input += Synapse0x945e2e8(); + input += Synapse0x945e310(); + input += Synapse0x945e338(); + input += Synapse0x945e360(); + input += Synapse0x945e388(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945e138() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945e138(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945e3b0() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = 0.654194; + input += Synapse0x945e5a8(); + input += Synapse0x945e5d0(); + input += Synapse0x945e5f8(); + input += Synapse0x945e620(); + input += Synapse0x945e648(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945e3b0() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945e3b0(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945e670() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.356397; + input += Synapse0x945e868(); + input += Synapse0x945e890(); + input += Synapse0x945e8b8(); + input += Synapse0x945e038(); + input += Synapse0x945e060(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945e670() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945e670(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945e9e8() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.798487; + input += Synapse0x945ebe0(); + input += Synapse0x945ec08(); + input += Synapse0x945ec30(); + input += Synapse0x945ec58(); + input += Synapse0x945ec80(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945e9e8() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945e9e8(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945eca8() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.934985; + input += Synapse0x945eea0(); + input += Synapse0x945eec8(); + input += Synapse0x945eef0(); + input += Synapse0x945ef18(); + input += Synapse0x945ef40(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945eca8() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945eca8(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945ef68() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.457775; + input += Synapse0x945f160(); + input += Synapse0x945f188(); + input += Synapse0x945f1b0(); + input += Synapse0x945f1d8(); + input += Synapse0x945f200(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945ef68() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945ef68(); + return (tanh(input) * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945d4f0() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = 0.849942; + input += Synapse0x945f300(); + input += Synapse0x945f328(); + input += Synapse0x945f350(); + input += Synapse0x945f378(); + input += Synapse0x945f3a0(); + input += Synapse0x945f3c8(); + input += Synapse0x945f3f0(); + input += Synapse0x945f418(); + input += Synapse0x945f440(); + input += Synapse0x945f468(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945d4f0() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945d4f0(); + return (input * 1)+0; +} + +Double_t AliCaloNeuralFit::Input0x945f490() const +{ +// +// Hidden/Output neuron +// Compute the activation from linear combination of +// all neurons going into this, each one times its synaptic weight +// + Double_t input = -0.147416; + input += Synapse0x945f690(); + input += Synapse0x945f6b8(); + input += Synapse0x945f6e0(); + input += Synapse0x945f708(); + input += Synapse0x945f730(); + input += Synapse0x936a1f0(); + input += Synapse0x943ee18(); + input += Synapse0x945cb70(); + input += Synapse0x945cb98(); + input += Synapse0x945cbc0(); + return input; +} + +Double_t AliCaloNeuralFit::Neuron0x945f490() const +{ +// +// Hidden/Output neuron +// Return computed activation +// + Double_t input = Input0x945f490(); + return (input * 1)+0; +} + +Double_t AliCaloNeuralFit::Synapse0x943edb8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*-0.104546); +} + +Double_t AliCaloNeuralFit::Synapse0x945d7d0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*-0.0905177); +} + +Double_t AliCaloNeuralFit::Synapse0x945d7f8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-0.143637); +} + +Double_t AliCaloNeuralFit::Synapse0x945d820() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.413064); +} + +Double_t AliCaloNeuralFit::Synapse0x945d848() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*0.883744); +} + +Double_t AliCaloNeuralFit::Synapse0x945da68() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*-1.26724); +} + +Double_t AliCaloNeuralFit::Synapse0x945da90() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*-0.14136); +} + +Double_t AliCaloNeuralFit::Synapse0x945dab8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*0.27187); +} + +Double_t AliCaloNeuralFit::Synapse0x945dae0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*0.563302); +} + +Double_t AliCaloNeuralFit::Synapse0x945db08() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*1.38006); +} + +Double_t AliCaloNeuralFit::Synapse0x945dd28() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*-0.235737); +} + +Double_t AliCaloNeuralFit::Synapse0x945dd50() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*0.715314); +} + +Double_t AliCaloNeuralFit::Synapse0x945dd78() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-0.893506); +} + +Double_t AliCaloNeuralFit::Synapse0x945dda0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*1.66689); +} + +Double_t AliCaloNeuralFit::Synapse0x945ddc8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*0.433463); +} + +Double_t AliCaloNeuralFit::Synapse0x945dfe8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*0.198835); +} + +Double_t AliCaloNeuralFit::Synapse0x945e010() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*1.67429); +} + +Double_t AliCaloNeuralFit::Synapse0x945e0c0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-1.19328); +} + +Double_t AliCaloNeuralFit::Synapse0x945e0e8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*2.5465); +} + +Double_t AliCaloNeuralFit::Synapse0x945e110() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*0.153072); +} + +Double_t AliCaloNeuralFit::Synapse0x945e2e8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*0.0815823); +} + +Double_t AliCaloNeuralFit::Synapse0x945e310() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*0.0316826); +} + +Double_t AliCaloNeuralFit::Synapse0x945e338() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*0.617448); +} + +Double_t AliCaloNeuralFit::Synapse0x945e360() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.749993); +} + +Double_t AliCaloNeuralFit::Synapse0x945e388() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*-0.980764); +} + +Double_t AliCaloNeuralFit::Synapse0x945e5a8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*-0.453657); +} + +Double_t AliCaloNeuralFit::Synapse0x945e5d0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*0.146578); +} + +Double_t AliCaloNeuralFit::Synapse0x945e5f8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*0.123041); +} + +Double_t AliCaloNeuralFit::Synapse0x945e620() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*0.189871); +} + +Double_t AliCaloNeuralFit::Synapse0x945e648() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*-0.153873); +} + +Double_t AliCaloNeuralFit::Synapse0x945e868() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*-0.0569668); +} + +Double_t AliCaloNeuralFit::Synapse0x945e890() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*-0.0208438); +} + +Double_t AliCaloNeuralFit::Synapse0x945e8b8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-0.662575); +} + +Double_t AliCaloNeuralFit::Synapse0x945e038() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.308952); +} + +Double_t AliCaloNeuralFit::Synapse0x945e060() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*-0.0591419); +} + +Double_t AliCaloNeuralFit::Synapse0x945ebe0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*0.203333); +} + +Double_t AliCaloNeuralFit::Synapse0x945ec08() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*-0.210458); +} + +Double_t AliCaloNeuralFit::Synapse0x945ec30() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-0.46208); +} + +Double_t AliCaloNeuralFit::Synapse0x945ec58() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.213809); +} + +Double_t AliCaloNeuralFit::Synapse0x945ec80() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*0.652572); +} + +Double_t AliCaloNeuralFit::Synapse0x945eea0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*0.53005); +} + +Double_t AliCaloNeuralFit::Synapse0x945eec8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*1.97055); +} + +Double_t AliCaloNeuralFit::Synapse0x945eef0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*-0.934772); +} + +Double_t AliCaloNeuralFit::Synapse0x945ef18() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.253289); +} + +Double_t AliCaloNeuralFit::Synapse0x945ef40() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*-0.190109); +} + +Double_t AliCaloNeuralFit::Synapse0x945f160() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cbe8()*0.111492); +} + +Double_t AliCaloNeuralFit::Synapse0x945f188() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cd78()*0.928076); +} + +Double_t AliCaloNeuralFit::Synapse0x945f1b0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945cf50()*0.178153); +} + +Double_t AliCaloNeuralFit::Synapse0x945f1d8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d128()*-0.750558); +} + +Double_t AliCaloNeuralFit::Synapse0x945f200() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d300()*-1.40984); +} + +Double_t AliCaloNeuralFit::Synapse0x945f300() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d620()*-0.838377); +} + +Double_t AliCaloNeuralFit::Synapse0x945f328() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d870()*0.191143); +} + +Double_t AliCaloNeuralFit::Synapse0x945f350() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945db30()*-0.453988); +} + +Double_t AliCaloNeuralFit::Synapse0x945f378() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945ddf0()*-0.520562); +} + +Double_t AliCaloNeuralFit::Synapse0x945f3a0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e138()*-0.995398); +} + +Double_t AliCaloNeuralFit::Synapse0x945f3c8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e3b0()*-0.114216); +} + +Double_t AliCaloNeuralFit::Synapse0x945f3f0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e670()*-0.72899); +} + +Double_t AliCaloNeuralFit::Synapse0x945f418() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e9e8()*-0.453087); +} + +Double_t AliCaloNeuralFit::Synapse0x945f440() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945eca8()*0.0891431); +} + +Double_t AliCaloNeuralFit::Synapse0x945f468() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945ef68()*0.679937); +} + +Double_t AliCaloNeuralFit::Synapse0x945f690() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d620()*0.806704); +} + +Double_t AliCaloNeuralFit::Synapse0x945f6b8() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945d870()*-1.27447); +} + +Double_t AliCaloNeuralFit::Synapse0x945f6e0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945db30()*1.0306); +} + +Double_t AliCaloNeuralFit::Synapse0x945f708() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945ddf0()*2.09234); +} + +Double_t AliCaloNeuralFit::Synapse0x945f730() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e138()*0.0643316); +} + +Double_t AliCaloNeuralFit::Synapse0x936a1f0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e3b0()*-0.204933); +} + +Double_t AliCaloNeuralFit::Synapse0x943ee18() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e670()*0.423604); +} + +Double_t AliCaloNeuralFit::Synapse0x945cb70() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945e9e8()*1.00527); +} + +Double_t AliCaloNeuralFit::Synapse0x945cb98() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945eca8()*-1.54485); +} + +Double_t AliCaloNeuralFit::Synapse0x945cbc0() const +{ +// +// Synaptic connection +// Multiplies input times synaptic weight +// + return (Neuron0x945ef68()*0.540381); +} + diff --git a/EMCAL/AliCaloNeuralFit.h b/EMCAL/AliCaloNeuralFit.h new file mode 100644 index 00000000000..b90cefafdd7 --- /dev/null +++ b/EMCAL/AliCaloNeuralFit.h @@ -0,0 +1,140 @@ +#ifndef ALICALONEURALFIT_H +#define ALICALONEURALFIT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: $ */ + +//_________________________________________________________________________ +// Utility Class for Neural Network fit +// +// currently uses 5 input neurons +// network configured via TMultiLayerPerceptron +// +//*-- Author: Paola La Rocca (Catania) +// + +#include + +class AliCaloNeuralFit : public TObject +{ +public: + AliCaloNeuralFit(): fInput0(0.0), fInput1(0.0), fInput2(0.0), fInput3(0.0), fInput4(0.0) {} + ~AliCaloNeuralFit() {} + Double_t Value(int index, Double_t in0, Double_t in1, Double_t in2, Double_t in3, Double_t in4); + Double_t Value(int index, Double_t* input) { return Value(index, input[0], input[1], input[2], input[3], input[4]); } +private: + Double_t fInput0; // neural network input neuron #1 + Double_t fInput1; // neural network input neuron #2 + Double_t fInput2; // neural network input neuron #3 + Double_t fInput3; // neural network input neuron #4 + Double_t fInput4; // neural network input neuron #5 + + // private functions as exported by TMultiLayerPerceptron + // containing the network data processing + Double_t Neuron0x945cbe8() const; + Double_t Neuron0x945cd78() const; + Double_t Neuron0x945cf50() const; + Double_t Neuron0x945d128() const; + Double_t Neuron0x945d300() const; + Double_t Input0x945d620() const; + Double_t Neuron0x945d620() const; + Double_t Input0x945d870() const; + Double_t Neuron0x945d870() const; + Double_t Input0x945db30() const; + Double_t Neuron0x945db30() const; + Double_t Input0x945ddf0() const; + Double_t Neuron0x945ddf0() const; + Double_t Input0x945e138() const; + Double_t Neuron0x945e138() const; + Double_t Input0x945e3b0() const; + Double_t Neuron0x945e3b0() const; + Double_t Input0x945e670() const; + Double_t Neuron0x945e670() const; + Double_t Input0x945e9e8() const; + Double_t Neuron0x945e9e8() const; + Double_t Input0x945eca8() const; + Double_t Neuron0x945eca8() const; + Double_t Input0x945ef68() const; + Double_t Neuron0x945ef68() const; + Double_t Input0x945d4f0() const; + Double_t Neuron0x945d4f0() const; + Double_t Input0x945f490() const; + Double_t Neuron0x945f490() const; + Double_t Synapse0x943edb8() const; + Double_t Synapse0x945d7d0() const; + Double_t Synapse0x945d7f8() const; + Double_t Synapse0x945d820() const; + Double_t Synapse0x945d848() const; + Double_t Synapse0x945da68() const; + Double_t Synapse0x945da90() const; + Double_t Synapse0x945dab8() const; + Double_t Synapse0x945dae0() const; + Double_t Synapse0x945db08() const; + Double_t Synapse0x945dd28() const; + Double_t Synapse0x945dd50() const; + Double_t Synapse0x945dd78() const; + Double_t Synapse0x945dda0() const; + Double_t Synapse0x945ddc8() const; + Double_t Synapse0x945dfe8() const; + Double_t Synapse0x945e010() const; + Double_t Synapse0x945e0c0() const; + Double_t Synapse0x945e0e8() const; + Double_t Synapse0x945e110() const; + Double_t Synapse0x945e2e8() const; + Double_t Synapse0x945e310() const; + Double_t Synapse0x945e338() const; + Double_t Synapse0x945e360() const; + Double_t Synapse0x945e388() const; + Double_t Synapse0x945e5a8() const; + Double_t Synapse0x945e5d0() const; + Double_t Synapse0x945e5f8() const; + Double_t Synapse0x945e620() const; + Double_t Synapse0x945e648() const; + Double_t Synapse0x945e868() const; + Double_t Synapse0x945e890() const; + Double_t Synapse0x945e8b8() const; + Double_t Synapse0x945e038() const; + Double_t Synapse0x945e060() const; + Double_t Synapse0x945ebe0() const; + Double_t Synapse0x945ec08() const; + Double_t Synapse0x945ec30() const; + Double_t Synapse0x945ec58() const; + Double_t Synapse0x945ec80() const; + Double_t Synapse0x945eea0() const; + Double_t Synapse0x945eec8() const; + Double_t Synapse0x945eef0() const; + Double_t Synapse0x945ef18() const; + Double_t Synapse0x945ef40() const; + Double_t Synapse0x945f160() const; + Double_t Synapse0x945f188() const; + Double_t Synapse0x945f1b0() const; + Double_t Synapse0x945f1d8() const; + Double_t Synapse0x945f200() const; + Double_t Synapse0x945f300() const; + Double_t Synapse0x945f328() const; + Double_t Synapse0x945f350() const; + Double_t Synapse0x945f378() const; + Double_t Synapse0x945f3a0() const; + Double_t Synapse0x945f3c8() const; + Double_t Synapse0x945f3f0() const; + Double_t Synapse0x945f418() const; + Double_t Synapse0x945f440() const; + Double_t Synapse0x945f468() const; + Double_t Synapse0x945f690() const; + Double_t Synapse0x945f6b8() const; + Double_t Synapse0x945f6e0() const; + Double_t Synapse0x945f708() const; + Double_t Synapse0x945f730() const; + Double_t Synapse0x936a1f0() const; + Double_t Synapse0x943ee18() const; + Double_t Synapse0x945cb70() const; + Double_t Synapse0x945cb98() const; + Double_t Synapse0x945cbc0() const; + + ClassDef(AliCaloNeuralFit,1) +}; + +#endif // AliCaloNeuralFit_h + diff --git a/EMCAL/AliEMCALRawUtils.cxx b/EMCAL/AliEMCALRawUtils.cxx index 57e55ad0468..edaf73a609e 100644 --- a/EMCAL/AliEMCALRawUtils.cxx +++ b/EMCAL/AliEMCALRawUtils.cxx @@ -49,6 +49,7 @@ class AliEMCALDigitizer; #include "AliEMCAL.h" #include "AliCaloCalibPedestal.h" #include "AliCaloFastAltroFitv0.h" +#include "AliCaloNeuralFit.h" ClassImp(AliEMCALRawUtils) @@ -78,7 +79,7 @@ AliEMCALRawUtils::AliEMCALRawUtils() fNoiseThreshold = 3; // 3 ADC counts is approx. noise level fNPedSamples = 4; // less than this value => likely pedestal samples fRemoveBadChannels = kTRUE; //Remove bad channels before fitting - fFittingAlgorithm = kFastFit;//kStandard; // Use default minuit fitter + fFittingAlgorithm = kFastFit;//kStandard; //kNeuralNet// Use default minuit fitter //Get Mapping RCU files from the AliEMCALRecParam const TObjArray* maps = AliEMCALRecParam::GetMappings(); @@ -553,7 +554,7 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB } } - // 1st step: we try to estimate the pedestal value + // 1st step: we try to estimate the pedestal value Int_t nPed = 0; for (Int_t index = 0; index < gSig->GetN(); index++) { gSig->GetPoint(index, ttime, signal) ; @@ -760,7 +761,7 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB case kFastFit: { //printf("FastFitter \n"); - Double_t eSignal = 0; + Double_t eSignal = 1; // nominal 1 ADC error Double_t dAmp = amp; Double_t eAmp = 0; Double_t dTime = time; @@ -773,9 +774,59 @@ void AliEMCALRawUtils::FitRaw(TGraph * gSig, TF1* signalF, const Int_t lastTimeB amp = dAmp; time = dTime * GetRawFormatTimeBinWidth(); //printf("FastFitter: Amp %f, time %g, eAmp %f, eTimeEstimate %g, chi2 %f\n",amp, time,eAmp,eTime,chi2); - break; - } //kFastFit - //---------------------------- + break; + } //kFastFit + //---------------------------- + + case kNeuralNet: + { + // Extracts the amplitude and the time information using a Neural Network approach + // Author P. La Rocca + //printf("NeuralNet \n"); + Double_t input[5] = {0.}; + Double_t maxgraph = 0.; + Int_t maxindex = -10; + for (Int_t i=0; i < gSig->GetN(); i++) { + gSig->GetPoint(i, ttime, signal); + if(signal > maxgraph) { + maxgraph = signal; + maxindex = i; + } + } + if((maxindex-2) > -1 && (maxindex-2)< gSig->GetN()) { + gSig->GetPoint(maxindex-2, ttime, input[0]); + input[0] -= pedEstimate; + input[0] /= (globMaxSig - pedEstimate); + } + if((maxindex-1) > -1 && (maxindex-1)< gSig->GetN()) { + gSig->GetPoint(maxindex-1, ttime, input[1]); + input[1] -= pedEstimate; + input[1] /= (globMaxSig - pedEstimate); + } + if((maxindex) > -1 && (maxindex)< gSig->GetN()) { + gSig->GetPoint(maxindex, ttime, input[2]); + input[2] -= pedEstimate; + input[2] /= (globMaxSig - pedEstimate); + } + if((maxindex+1) > -1 && (maxindex+1)< gSig->GetN()) { + gSig->GetPoint(maxindex+1, ttime, input[3]); + input[3] -= pedEstimate; + input[3] /= (globMaxSig - pedEstimate); + } + if((maxindex+2) > -1 && (maxindex+2)< gSig->GetN()) { + gSig->GetPoint(maxindex+2, ttime, input[4]); + input[4] -= pedEstimate; + input[4] /= (globMaxSig - pedEstimate); + } + + AliCaloNeuralFit exportNN; + amp = exportNN.Value(0,input[0],input[1],input[2],input[3],input[4])*(globMaxSig - pedEstimate); + time = (exportNN.Value(1,input[0],input[1],input[2],input[3],input[4])+globMaxId) * fgTimeBins; + + + break; + } //kNeuralNet + //---------------------------- }//switch fitting algorithms } // ampEstimate > fNoiseThreshold return; diff --git a/EMCAL/AliEMCALRawUtils.h b/EMCAL/AliEMCALRawUtils.h index ef3cc2f744c..33d52523f7a 100644 --- a/EMCAL/AliEMCALRawUtils.h +++ b/EMCAL/AliEMCALRawUtils.h @@ -34,7 +34,7 @@ class AliEMCALRawUtils : public TObject { AliEMCALRawUtils(AliEMCALGeometry *pGeometry); virtual ~AliEMCALRawUtils(); - enum fitAlgorithm {kStandard = 0, kFastFit= 1}; + enum fitAlgorithm {kStandard = 0, kFastFit= 1, kNeuralNet = 2}; AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils); diff --git a/EMCAL/EMCALrecLinkDef.h b/EMCAL/EMCALrecLinkDef.h index df34160e005..e5ff0efc9c3 100644 --- a/EMCAL/EMCALrecLinkDef.h +++ b/EMCAL/EMCALrecLinkDef.h @@ -11,5 +11,6 @@ #pragma link C++ class AliEMCALPID+; #pragma link C++ class AliEMCALQADataMakerRec+; #pragma link C++ class AliEMCALAodCluster+; +#pragma link C++ class AliCaloNeuralFit+; #endif diff --git a/EMCAL/libEMCALrec.pkg b/EMCAL/libEMCALrec.pkg index 35ae766be65..42db9c7de3a 100644 --- a/EMCAL/libEMCALrec.pkg +++ b/EMCAL/libEMCALrec.pkg @@ -7,7 +7,9 @@ AliEMCALClusterizerv1.cxx \ AliEMCALTrack.cxx \ AliEMCALTracker.cxx \ AliEMCALPID.cxx \ -AliEMCALQADataMakerRec.cxx AliEMCALAodCluster.cxx +AliEMCALQADataMakerRec.cxx \ +AliEMCALAodCluster.cxx \ +AliCaloNeuralFit.cxx HDRS= $(SRCS:.cxx=.h) -- 2.39.3