34 addColsFromParam( _param );
49 _conditions(p._conditions),
52 _optParams(p._optParams)
79 for( sColVecMap::const_iterator r=q->second.begin(); r!=q->second.end(); r++ ){
80 for(
unsigned int i=0; i<r->second.size(); i++ ){
100 _param->getStringKeys( keys );
102 for(
unsigned int i=0; i<keys.
size(); i++ ){
104 _param->getStringVals( keys[i], values );
107 for(
unsigned int j=0; j<values.
size(); j++ ){
112 for(
unsigned int j=0; j<values.
size(); j++ ){
122 _param->getStringVals(
"_marlin.lcioInType", InCols );
123 _param->getStringVals(
"_marlin.lcioOutType", OutCols );
125 unsigned int index = 0;
126 while( index < InCols.
size() ){
127 name = InCols[ index++ ];
128 type = InCols[ index++ ];
131 _param->getStringVals(name, values);
133 for (
unsigned int i=0; i<values.
size(); i++){
139 while( index < OutCols.
size() ){
140 name = OutCols[index++];
141 type = OutCols[index++];
144 _param->getStringVals(name, values);
146 for(
unsigned int i=0; i<values.
size(); i++ ){
155 if( conditions ==
"true" ){
163 while( q < conditions.
size() ){
164 if( conditions[ p ] ==
'(' ){
167 if( conditions[ q ] ==
'(' ){
170 if( conditions[ q ] ==
')' ){
178 if( conditions[ q ] ==
'&' ){
179 if( conditions[ p ] ==
'(' ){
192 if( conditions[ p ]==
'(' ){
221 _param->erase( p->first );
225 _param->erase( p->first );
229 _param->erase(
"ProcessorType" );
232 _param->erase(
"_marlin.lcioInType" );
233 _param->erase(
"_marlin.lcioOutType" );
238 if(
_param->isParameterSet(
"Opt_Params_Set" )){
240 _param->getStringVals(
"Opt_Params_Set", values );
241 for(
unsigned int i=0; i<values.
size(); i++ ){
247 _param->erase(
"Opt_Params_Set" );
264 for(
unsigned int i=0; i< p->second.size(); i++){
265 value.
push_back( p->second[i]->getValue() );
267 _param->add( p->first, value );
273 for(
unsigned int i=0; i< p->second.size(); i++){
274 value.
push_back( p->second[i]->getValue() );
276 _param->add( p->first, value );
290 void CCProcessor::addCol(
const string& iotype,
const string& name,
const string& type,
const string& value ){
305 _cols[iotype][name].push_back( newCol );
308 _types[iotype][name]=type;
328 if( index <
_cols[iotype][name].
size() ){
341 for(
unsigned int i=0; i<v.
size(); i++ ){
358 for( sColVecMap::const_iterator p=
_cols[iotype].
begin(); p!=
_cols[iotype].
end(); p++ ){
359 if( type_name==
"ALL_COLLECTIONS" || type_name == p->first ){
360 for(
unsigned int i=0; i<p->second.size(); i++ ){
371 static sSet type_names;
375 for( sColVecMap::const_iterator p=
_cols[ iotype ].
begin(); p!=
_cols[ iotype ].
end(); p++ ){
376 type_names.
insert( p->first );
385 for(
unsigned int i=0; i<v.
size(); i++ ){
386 if(( v[i]->
getValue() == value ) && ( v[i]->getType() == type )){
400 if(
_error[ error ] ==
false ){
407 if(
_error[ error ] ==
true ){
457 stream <<
" <processor name=\"" <<
_name <<
"\" type=\"" <<
_type <<
"\">\n";
464 for( sColVecMap::const_iterator q=p->second.begin(); q!=p->second.end(); q++ ){
465 if( q->second.size() != 0){
469 stream <<
" <parameter name=\"" << q->first <<
"\" type=\"" << (q->second.size() == 1 ?
"string" :
"StringVec") <<
"\" ";
470 stream << p->first <<
"=\"" << q->second[0]->getType() <<
"\"> ";
472 for(
unsigned int i=0; i<q->second.size(); i++ ){
473 stream << q->second[i]->getValue() <<
" ";
475 stream <<
"</parameter>\n";
483 _param->getStringKeys( keys );
487 for(
unsigned int i=0; i<keys.
size(); i++ ){
497 _param->getStringVals( keys[i], values );
501 for(
int j=0; j<((int)values.
size())/ssize; j++ ){
503 stream <<
" <" << (
isParamOptional( keys[i] ) ?
"!--" :
"") <<
"parameter name=\"" << keys[i] <<
"\" ";
504 stream <<
"type=\"" << p->
type() <<
"\"> ";
506 for(
int k=0; k<ssize; k++ ){
507 stream << values[ (j*ssize)+k ] <<
" ";
510 stream <<
"</parameter" << (
isParamOptional( keys[i] ) ?
"--" :
"") <<
">\n";
514 stream <<
" <" << (
isParamOptional( keys[i] ) ?
"!--" :
"") <<
"parameter name=\"" << keys[i] <<
"\" ";
515 stream <<
"type=\"" << p->
type() <<
"\"";
518 _param->getStringVals( keys[i], valuesLocal );
519 stream << (valuesLocal.
size() == 1 ?
" value=\"" :
"> ");
520 for(
unsigned int j=0; j<valuesLocal.
size(); j++ ){
521 stream << valuesLocal[j] << (valuesLocal.
size() > 1 ?
" " :
"");
523 stream << (valuesLocal.
size() == 1 ?
"\"/" :
"</parameter") << (
isParamOptional( keys[i] ) ?
"--" :
"") <<
">\n";
529 stream <<
" <!-- Sorry, this parameter isn't a default parameter for this processor: description and type lost!! -->" <<
std::endl ;
531 stream <<
" <parameter name=\"" << keys[i] <<
"\"";
535 _param->getStringVals( keys[i], values );
537 stream << ( values.
size() == 1 ?
" value=\"" :
">" );
539 for(
unsigned int j=0; j<values.
size(); j++ ){
540 stream << ( values.
size() == 1 ?
"" :
" ") << values[j];
542 stream << ( values.
size() == 1 ?
"\"/>\n" :
" </parameter>\n" );
545 stream <<
"</processor>\n\n";
virtual const std::string type()=0
std::string getLCIOOutType(const std::string &colName)
Return the LCIO output type for the collection colName - empty string if colName is not a registered ...
void addDCol(CCCollection *c)
Adds a duplicate collection to this processor.
static CMProcessor * instance()
return the instance of this class
std::vector< bool > _error
CCProcessor(bool status, const std::string &name, const std::string &type, std::shared_ptr< StringParameters > p)
std::string getLCIOInType(const std::string &colName)
Return the LCIO input type for the collection colName - empty string if colName is not a registered c...
bool isErrorCol(const std::string &type, const std::string &value)
Returns true if the given collection is in the unavailable or duplicate list of this processor...
handles information about LCIO collections needed by MarlinSteerCheck
ProcessorParameter * getParam(const std::string &type, const std::string &key)
returns the parameter with the given key of the processor with the given type
const std::string & getType() const
Processor * getProc(const std::string &type)
returns the instance of the processor with the given type
void remCol(const std::string &iotype, const std::string &name, unsigned int index)
Removes collection of the given iotype ( INPUT / OUTPUT ) with the given name at the given index...
void setError(int error)
Activates an error flag in this processor ( NO_PARAMETERS=0, NOT_INSTALLED=1, COL_ERRORS=2 ) ...
const StringVec _error_desc
handles information about marlin processors and their collections needed by MarlinSteerCheck ...
sSet & getColTypeNames(const std::string &iotype)
Returns collection's types/names of a given iotype found in the processor If iotype == INPUT/OUTPUT t...
const std::string getParamD(const std::string &type, const std::string &key)
returns the description of the parameter with the given key for the processor with the given type ...
bool isInputCollectionName(const std::string ¶meterName)
True if the given parameter defines an LCIO input collection, i.e.
CCCollection * popCol(ColVec &v, CCCollection *c)
void clearError(int error)
Clears an error flag in this processor ( NO_PARAMETERS=0, NOT_INSTALLED=1, COL_ERRORS=2 ) ...
void setConditions(const std::string &conditions)
Sets the processor's conditions.
bool isParamOptional(const std::string &key)
Returns true if a parameter is optional (optional means the parameter will be written out as a commen...
bool isInstalled()
Returns true if the processor is installed.
void setOptionalParam(const std::string &key, bool optional=true)
Sets a parameter as optional (if optional=true parameter is written out as a comment) ...
void writeToXML(std::ofstream &stream)
Writes this processor to a stream using the XML format.
bool hasErrors()
Returns true if the processor has errors.
bool hasCondition(const std::string &condition)
Returns true if the processor is constrained by the given condition.
bool isOutputCollectionName(const std::string ¶meterName)
True if the given parameter defines an LCIO output collection.
void changeStatus()
Changes the processor status ( ACTIVE->INACTIVE or INACTIVE->ACTIVE )
ColVec & getCols(const std::string &iotype, const std::string &type_name="ALL_COLLECTIONS")
Returns collections of a given iotype ( INPUT, OUTPUT, UNAVAILABLE, DUPLICATE ) for a given name or t...
void addCol(const std::string &iotype, const std::string &name, const std::string &type, const std::string &value)
Adds a collection of the given iotype ( INPUT / OUTPUT ) with the given name, type and value...
Class that holds a steering variable for a marlin processor - automatically created by Processor::reg...
std::shared_ptr< StringParameters > _param
bool hasParameters()
Returns true if the processor has parameters.
int getParamSetSize(const std::string &type, const std::string &key)
returns the set_size of the parameter with the given key for the processor with the given type ...
std::shared_ptr< StringParameters > mergeParams(const std::string &type, std::shared_ptr< StringParameters > sp)
merges the given parameters with the default ones from the processor with the given type ...
void addColsFromParam(std::shared_ptr< StringParameters > p)
const std::string getDescription()
Returns the Description of the processor.
void addUCol(CCCollection *c)
Adds an unavailable collection to this processor.