Snapshot module#
- class mkShapesRDF.processor.modules.Snapshot.Snapshot(tmpOutputFilename, columns, eosPath, outputFilename, includeVariations=True, splitVariations=True, storeNominals=True)[source][source]#
Bases:
ModuleThe Snapshot module handles the creation of the final output files. There are 4 possible scenarios:
snapshot nominals only
snapshot variations only in separate files (one file per variation)
snapshot nominals and variation in separate files (one file per variation and one file for nominal)
snapshot both nominals and variations in the same file
The module does not run the snapshotting itself, but it creates the Snapshot objects with lazy evaluation. The snapshots to be run are added to the
valuesvariable:values.append( [ "snapshot", SnapshotObject, [tmpOutputFilename, copyFromInputFiles , outputFolderPath, outputFilenameEOS] ])
Where
tmpOutputFilenameis the name of the temporary output file,copyFromInputFilesis a boolean that indicates if the auxiliary keys of the input files should be copied in the output (only done for nominals),outputFolderPathis the path of the output folderoutputFilenameEOSis the name of the output file in the EOS folder (final output file name)
Methods
CopyFromInputFiles(outputFilename, inputFiles)Copy the auxiliary keys from the input files into the output file.
SplitVariations(df)Create a Snapshot object for each variation and tag.
StoreNominals(df)Create a Snapshot object for the nominal columns.
Create a Snapshot object containing both nominals and variations.
run(df, values)No module should overwrite this method.
runModule(df, values)The main method of the module.
- __init__(tmpOutputFilename, columns, eosPath, outputFilename, includeVariations=True, splitVariations=True, storeNominals=True)[source][source]#
Use this constructor to set the name of the module. It should store all the needed information for
runModulemethod.- Parameters:
- name
str Name of the module
- name
- static CopyFromInputFiles(outputFilename, inputFiles)[source][source]#
Copy the auxiliary keys from the input files into the output file.
It ``hadd``s the input files into a temporary file, then it copies the keys from the temporary file into the output file.
- Parameters:
- outputFilename
str The name of the output file where to copy the keys (should be equal to
tmpOutputFilename)- inputFileslist of str
The list of input files from which to copy the keys
- outputFilename
- SplitVariations(df)[source][source]#
Create a Snapshot object for each variation and tag.
- Parameters:
- df
mRDF The
mRDFobject to use for snapshot
- df
- StoreNominals(df)[source][source]#
Create a Snapshot object for the nominal columns.
- Parameters:
- df
mRDF The
mRDFobject to use for snapshot
- df
- StoreNominalsAndVariations(df)[source][source]#
Create a Snapshot object containing both nominals and variations.
- Parameters:
- df
mRDF The
mRDFobject to use for snapshot
- df
- runModule(df, values)[source][source]#
The main method of the module. It should contain all the logic of the module.
- Parameters:
- df
mRDF The
mRDFdataframe- values
list List of values that are passed between modules (should contain efficiency of cuts and other values)
- df
- Returns:
mRDFThe modified mRDF dataframe