10 #if LCIO_VERSION_GE(1,7)
13 #include "marlin/LCSplitWriter.h"
41 _description =
"Writes the current event to the specified LCIO outputfile."
42 " Needs to be the last ActiveProcessor." ;
46 " name of output file " ,
51 "write mode for output file: WRITE_APPEND, WRITE_NEW or None" ,
62 "drops the named collections from the event" ,
68 dropTypesExample.
push_back(
"SimTrackerHit");
69 dropTypesExample.
push_back(
"SimCalorimeterHit");
72 "drops all collections of the given type from the event" ,
77 keepNamesExample.
push_back(
"MyPreciousSimTrackerHits");
80 "force keep of the named collections - overrules DropCollectionTypes (and DropCollectionNames)" ,
86 fullSubsetExample.
push_back(
"MCParticlesSkimmed");
89 " write complete objects in subset collections to the file (i.e. ignore subset flag)" ,
95 "will split output file if size in kB exceeds given value - doesn't work with APPEND and NEW" ,
100 "The ZLIB compression level on writing. Set it to 0 for no compression" ,
119 _lcWrt = LCFactory::getInstance()->createLCWriter() ;
150 _lcWrt->writeRunHeader( run ) ;
174 const StringVec* colNames = evt->getCollectionNames() ;
178 bool trackerHitsDroped = false ;
179 bool calorimeterHitsDroped = false ;
186 trackerHitsDroped = true ;
192 calorimeterHitsDroped = true ;
196 for( StringVec::const_iterator it = colNames->
begin();
197 it != colNames->
end() ; it++ ){
199 LCCollectionVec* col =
dynamic_cast<LCCollectionVec*
> (evt->getCollection( *it ) ) ;
207 col->setTransient(
true ) ;
213 col->setTransient(
true ) ;
220 col->setTransient(
false ) ;
229 if( col->isSubset() ) {
231 col->setSubset(
false ) ;
239 if( collectionType == LCIO::TRACK && trackerHitsDroped ){
242 flag[ LCIO::TRBIT_HITS ] = 0 ;
245 if( collectionType == LCIO::CLUSTER && calorimeterHitsDroped ){
248 flag[ LCIO::CLBIT_HITS ] = 0 ;
267 _lcWrt->writeEvent( evt ) ;
273 (*sIt)->setSubset(
true ) ;
284 <<
"LCIOOutputProcessor::end() " <<
name()
285 <<
": " <<
_nEvt <<
" events in " <<
_nRun <<
" runs written to file "
void registerProcessorParameter(const std::string ¶meterName, const std::string ¶meterDescription, T ¶meter, const T &defaultVal, int setSize=0)
Register a steering variable for this processor - call in constructor of processor.
virtual void processRunHeader(LCRunHeader *run)
Write every run header.
bool parameterSet(const std::string &name)
Tests whether the parameter has been set in the steering file.
virtual void init()
Open the LCIO outputfile.
virtual const std::string & name() const
Return name of this processor.
StringVec _keepCollectionNames
std::string _lcioWriteMode
StringVec _dropCollectionTypes
StringVec _fullSubsetCollections
void printParameters()
Print the parameters and their values depending on the given verbosity level.
virtual void end()
Close outputfile.
StringVec _dropCollectionNames
virtual ~LCIOOutputProcessor()
D'tor for subclasses.
Default output processor.
void dropCollections(LCEvent *evt)
Drops the collections specified in the steering file parameters DropCollectionNames and DropCollectio...
void registerOptionalParameter(const std::string ¶meterName, const std::string ¶meterDescription, T ¶meter, const T &defaultVal, int setSize=0)
Same as registerProcessorParameter except that the parameter is optional.
Base class for Marlin processors.
std::string _lcioOutputFile
std::string _description
Describes what the processor does.
virtual void processEvent(LCEvent *evt)
Write every event.
void myConstruct()
Inititalization for constructors.
LCIOOutputProcessor anLCIOOutputProcessor