]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONTrackerIO.cxx
bookkeep pt hard info when generating on-the-fly pythia events
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackerIO.cxx
index a99ba6163f4e1b12cf33005d728d8e2b73f6a7dc..3e8b6fe75e10db3d984c0c0704f1e0973fa4a274 100644 (file)
@@ -16,6 +16,7 @@
 // $Id$
 
 #include <cstdlib>
+#include <iostream>
 #include "AliMUONTrackerIO.h"
 
 /// \class AliMUONTrackerIO
 ///
 /// \author Laurent Aphecetche, Subatech
 
+using std::ostringstream;
+using std::istringstream;
+using std::cout;
+using std::endl;
 /// \cond CLASSIMP
 ClassImp(AliMUONTrackerIO)
 /// \endcond
@@ -97,7 +102,7 @@ AliMUONTrackerIO::DecodeOccupancy(const char* data, AliMUONVStore& occupancyMap)
   if ( ! AliMpDDLStore::Instance(kFALSE) )
   {
     AliErrorClass("Mapping not loaded. Cannot work");
-    return 0;
+    return kNoMapping;
   }
   
   char line[1024];
@@ -117,6 +122,13 @@ AliMUONTrackerIO::DecodeOccupancy(const char* data, AliMUONVStore& occupancyMap)
 
     sin >> busPatchId >> manuId >> sumn >> numberOfEvents;
     
+    if ( busPatchId == -1 && manuId == -1 && sumn == 0 && numberOfEvents == 0 )
+    {
+      /// DA could not produce information (because run failed somehow). 
+      /// That's OK, but let the world know about it
+      return kNoInfoFile;
+    }
+    
     Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
 
     AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
@@ -296,6 +308,8 @@ AliMUONTrackerIO::DecodeGains(const char* data, AliMUONVStore& gainStore,
       if ( sline.Contains("DUMMY") )
       {
         AliDebugClass(1,"Got a dummy file here");
+        delete [] runs;
+        delete [] dac;
         return kDummyFile;
       }
       if ( sline.Contains("* Run") )
@@ -307,6 +321,7 @@ AliMUONTrackerIO::DecodeGains(const char* data, AliMUONVStore& gainStore,
           runNumber = s.Atoi();
           AliDebugClass(1,Form("runNumber is %d",runNumber));
         }            
+       delete a;
       }
       if ( sline.Contains("DAC values") )
       {
@@ -316,6 +331,8 @@ AliMUONTrackerIO::DecodeGains(const char* data, AliMUONVStore& gainStore,
         {
           if ( nDAC < 100 ) 
           {
+            delete[] runs;
+            delete[] dac;
             runs = new Int_t[nDAC];
             dac = new Int_t[nDAC];
             // skip two lines
@@ -351,6 +368,8 @@ AliMUONTrackerIO::DecodeGains(const char* data, AliMUONVStore& gainStore,
           {
             AliErrorClass(Form("Something went wrong, as I get too big nDAC = %d",nDAC));
             nDAC = 0;
+            delete [] runs;
+            delete [] dac;
             return kFormatError;
           }
         }
@@ -473,6 +492,9 @@ AliMUONTrackerIO::DecodeCapacitances(const char* data, AliMUONVStore& capaStore)
       }      
       continue;
     }
+    
+    if (!param) continue;
+    
     Int_t channel;
     Float_t capaValue;
     Float_t injectionGain;
@@ -489,15 +511,12 @@ AliMUONTrackerIO::DecodeCapacitances(const char* data, AliMUONVStore& capaStore)
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::ReadConfig(const char* filename, AliMUONVStore& confStore, Bool_t& changed)
+AliMUONTrackerIO::ReadConfig(const char* filename, AliMUONVStore& confStore)
 {
   /// Read config file (produced by the MUONTRKda.exe program for instance)
   /// and append the read values into the given VStore
   /// To be used when the input is a file (for instance when reading data 
   /// from the OCDB).
-  /// changed must be set to kFALSE before calling this method for the first time
-  /// (then the subsequent calls must not set it !)
-  ///
   
   TString sFilename(gSystem->ExpandPathName(filename));
   
@@ -514,19 +533,17 @@ AliMUONTrackerIO::ReadConfig(const char* filename, AliMUONVStore& confStore, Boo
   
   in.close();
   
-  return DecodeConfig(stream.str().c_str(),confStore,changed);
+  return DecodeConfig(stream.str().c_str(),confStore);
 }
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::DecodeConfig(const char* data, AliMUONVStore& confStore, Bool_t& changed)
+AliMUONTrackerIO::DecodeConfig(const char* data, AliMUONVStore& confStore)
 {
   /// Read config data (produced by the MUONTRKda.exe program for instance)
   /// and append the read values into the given VStore
   /// To be used when the input is a TString (for instance when getting data 
   /// from AMORE DB).
-  /// changed must be set to kFALSE before calling this method for the first time
-  /// (then the subsequent calls must not set it !)
 
   char line[1024];
   Int_t busPatchID, manuID;
@@ -538,9 +555,6 @@ AliMUONTrackerIO::DecodeConfig(const char* data, AliMUONVStore& confStore, Bool_
     AliDebugClass(3,Form("line=%s",line));
     if ( line[0] == '#' ) 
     {
-      TString sline(line);
-      sline.ToUpper();
-      if (sline.Contains("CHANGED") && !sline.Contains("UNCHANGED")) changed = kTRUE;
       continue;
     }
     std::istringstream sin(line);