In order to use your XML files to make a C# file that you can code LINQ queries against you’ll need to use a tool to translate them into C# code. There are two ways to do this. The preferred way is using an MSBUILD task, but the below works just fine (and will continue to be supported until I figure out how to automate the MSBUILD integration).

Basically, we need to create a new project that uses nmake to run the build. The makefile will read the input files and then create an output file in the proper place.

  1. Create a new make file project.
  2. For the commands for the makefile project:
    1. Build: “nmake /nologo all”
    2. Clean: “nmake /nologo clean”
  3. Create the following Makefile (it needs to be called exactly that):
    #
    # Builds the xml file for a ROOT file. Normally this isn't part of the build
    # but since I expect things to evolve "rapidly" I suspect I'll be
    # appreciative of automating this. of course, this is go paths hard wired
    # into it!!
    #
    
    clean: cleanall
    
    DemoJetShapesDir = ..\DemoJetShapes
    SolutionDir = ..
    ClassConverterImage = ..\..\LINQToTTree\CmdGenerateLINQClasses\bin\Debug\CmdGenerateLINQClasses.exe
    
    ClassCSFile = $(DemoJetShapesDir)\ntupleDataModel.cs
    
    #
    # Rules
    #
    
    all: $(ClassCSFile)
    
    $(ClassCSFile) : $(DemoJetShapesDir)\ntuple.ntupom $(ClassConverterImage)
        $(ClassConverterImage) $(DemoJetShapesDir)\ntuple.ntupom $(ClassCSFile)
    
    #
    # Clean up the above files to force a restart
    #
    cleanall:
        del /Q $(ClassCSFile)
  4. You’ll have to modify several things in this file. In particular, note the "DemoJetShapes” which is the directory that contains the actual analysis project (see next section).
  5. Make sure that your actual project (like DemoJetShapes) is dependent on this project so that it always gets built.

Last edited Apr 17, 2011 at 12:43 AM by gwatts, version 1

Comments

No comments yet.