]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Use minimal initialisation for generating LUTs.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Mar 2011 12:59:23 +0000 (12:59 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 12 Mar 2011 12:59:23 +0000 (12:59 +0000)
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx

index 9c9db9c8f4959bce1b3bf4fa579dc6ba073aa354..795db0480e359ae100dbc45e48704b9732704e8f 100644 (file)
@@ -1116,31 +1116,28 @@ bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
        /// @return  True if the generation of the LUT file succeeded.
        
        AliHLTMUONTriggerReconstructorComponent comp;
-       
-       if (ddl < 20 or 21 < ddl)
+       try
        {
-               std::cerr << "ERROR: the DDL number must be in the range [20..21]." << std::endl;
-               return false;
+               // Perform minimal initialisation to be able to fill the LUT buffer.
+               comp.fTrigRec = new AliHLTMUONTriggerReconstructor();
        }
-       
-       char ddlNum[32];
-       char runNum[32];
-       sprintf(ddlNum, "%d", ddl+1);
-       sprintf(runNum, "%d", run);
-       int argc = 7;
-       const char* argv[8] = {"-ddl", ddlNum, "-cdbpath", cdbPath, "-run", runNum, "-dont_use_crateid", NULL};
-       if (useCrateId)
+       catch (const std::bad_alloc&)
        {
-               argv[6] = NULL;
-               argc--;
+               std::cerr << "ERROR: Could not allocate more memory for the trigger reconstructor component." << std::endl;
+               return false;
        }
-       int result = comp.DoInit(argc, argv);
-       if (result != 0)
+       
+       if (ddl < 20 or 21 < ddl)
        {
-               // Error message already generated in DoInit.
+               std::cerr << "ERROR: the DDL number must be in the range [20..21]." << std::endl;
                return false;
        }
        
+       comp.fDDL = ddl;
+       comp.fUseCrateId = useCrateId;
+       if (comp.SetCDBPathAndRunNo(cdbPath, run) != 0) return false;
+       if (comp.ReadLutFromCDB() != 0) return false;
+       
        std::fstream file(filename, std::ios::out);
        if (not file)
        {
@@ -1159,7 +1156,5 @@ bool AliHLTMUONTriggerReconstructorComponent::GenerateLookupTable(
        }
        file.close();
        
-       comp.DoDeinit();
-       
        return true;
 }