]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloRawAnalyzerNN.cxx
add new class to hold info on bins used in fitting + standardize result return codes...
[u/mrichter/AliRoot.git] / EMCAL / AliCaloRawAnalyzerNN.cxx
index 8e101d54c341dd88208f85dce7a805968a6bfa36..ac4565ae2e78245198cd693ebeeb0998614de4f8 100644 (file)
@@ -62,34 +62,36 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
   // The eveluation of  Peak position and amplitude using the Neural Network
   if( bunchvector.size()  <=  0 )
     {
-      return AliCaloFitResults(9999, 9999, 9999, 9999 , 9999, 9999, 9999 );
+      return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid , AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid );
     } 
  
-  short maxindex;
+  short maxampindex;
   short maxamp;
 
-  int bindex = SelectBunch( bunchvector, &maxindex , &maxamp ) ;
+  int index = SelectBunch( bunchvector, &maxampindex , &maxamp ) ;
   
-  if( bindex   < 0 )
+  if( index   < 0 )
     {
-      return AliCaloFitResults(9999, 9999, 9999, 9999 , 9999, 9999, 9999 );
+      return AliCaloFitResults(AliCaloFitResults::kInvalid, AliCaloFitResults::kInvalid);
     }
   
   int first = 0;
   int last = 0;
  
-  Float_t ped = ReverseAndSubtractPed( &(bunchvector.at( bindex ) )  ,  altrocfg1, altrocfg2, fReversed  );
+  Float_t ped = ReverseAndSubtractPed( &(bunchvector.at( index ) )  ,  altrocfg1, altrocfg2, fReversed  );
   
-  short maxrev = maxindex  -  bunchvector.at(bindex).GetStartBin();
-  short timebinOffset = maxindex - (bunchvector.at(bindex).GetLength()-1);
-  
-  SelectSubarray( fReversed,  bunchvector.at(bindex).GetLength(),  maxrev , &first, &last);
+  short maxrev = maxampindex  -  bunchvector.at(index).GetStartBin();
+  short timebinOffset = maxampindex - (bunchvector.at(index).GetLength()-1);
+  double maxf =  maxamp - ped;
+
+  SelectSubarray( fReversed,  bunchvector.at(index).GetLength(),  maxrev , &first, &last);
 
   if(maxrev  < 1000 )
     {
       if (  ( maxrev   - first) < 2  &&  (last -   maxrev ) < 2)
        {
-         return AliCaloFitResults(9999, 9999, 9999, 9999 , 9999, 9999, 9999 );
+         return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, maxrev+timebinOffset, AliCaloFitResults::kNoFit, AliCaloFitResults::kNoFit,
+                                   AliCaloFitResults::kNoFit, AliCaloFitSubarray(index, maxrev, first, last) ); 
        }
       else
        {
@@ -103,11 +105,13 @@ AliCaloRawAnalyzerNN::Evaluate( const vector<AliCaloBunchInfo> &bunchvector,
          double amp = (maxamp - ped)*fNeuralNet->Value( 0,  fNNInput[0],  fNNInput[1], fNNInput[2], fNNInput[3], fNNInput[4]);
          double tof = (fNeuralNet->Value( 1,  fNNInput[0],  fNNInput[1], fNNInput[2], fNNInput[3], fNNInput[4]) + timebinOffset ) ;
 
-         return AliCaloFitResults( maxamp, ped , -1, amp , tof, -2, -3 ); 
+         return AliCaloFitResults( maxamp, ped , AliCaloFitResults::kDummy, amp , tof, AliCaloFitResults::kDummy, AliCaloFitResults::kDummy,
+                                   AliCaloFitResults::kDummy, AliCaloFitSubarray(index, maxrev, first, last) );
 
        }
     }
-  return AliCaloFitResults(9999, 9999, 9999, 9999 , 9999, 9999, 9999 );
+  return AliCaloFitResults( maxamp, ped, AliCaloFitResults::kNoFit, maxf, maxrev+timebinOffset, AliCaloFitResults::kNoFit, AliCaloFitResults::kNoFit,
+                           AliCaloFitResults::kNoFit, AliCaloFitSubarray(index, maxrev, first, last) ); 
 }