17 #include "TObjString.h"
30 , m_inputMetaStore(
"StoreGateSvc/InputMetaDataStore",
name )
31 , m_outputMetaStore(
"StoreGateSvc/MetaDataStore",
name )
35 for(
auto prop : getProperties()) {
36 if(prop->name() !=
"EvtStore")
continue;
47 evtStore().setTypeAndName(prop.toString());
57 incSvc->removeListener(
this, IncidentType::BeginInputFile );
58 incSvc->addListener(
this, IncidentType::BeginInputFile, 0,
true );
59 incSvc->removeListener(
this, IncidentType::EndInputFile );
60 incSvc->addListener(
this, IncidentType::EndInputFile, 0,
true );
61 incSvc->removeListener(
this,
"MetaDataStop" );
62 incSvc->addListener(
this,
"MetaDataStop", 0,
true );
69 return StatusCode::SUCCESS;
77 return StatusCode::FAILURE;
80 return AthHistogramAlgorithm::sysExecute(ctx);
89 if( inc.type() == IncidentType::BeginInputFile ) {
93 throw std::runtime_error(
"Couldn't call beginInputFile()" );
95 }
else if(inc.type() == IncidentType::EndInputFile ) {
98 throw std::runtime_error(
"Couldn't call endInputFile()" );
100 }
else if(inc.type() ==
"MetaDataStop" ) {
103 throw std::runtime_error(
"Couldn't call metaDataStop()" );
117 return StatusCode::SUCCESS;
125 return StatusCode::SUCCESS;
133 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
153 SmartIF<IProperty> evtSelector{service(evtSelName,
false)};
155 ATH_MSG_ERROR(
"currentFile(): Couldn't find the service: " << evtSelName);
return 0;
160 const StringArrayProperty& inputCollectionsName =
dynamic_cast<const StringArrayProperty&
>(evtSelector->getProperty(
"InputCollections"));
162 ATH_MSG_VERBOSE(
"nOpenFile=" << gROOT->GetListOfFiles()->GetSize() <<
". nFilesInInputCollection=" << inputCollectionsName.value().size());
164 for(
int i=0;
i<gROOT->GetListOfFiles()->GetSize();
i++) {
165 ATH_MSG_VERBOSE(
"Open file: " << gROOT->GetListOfFiles()->At(
i)->GetName());
171 for(
int i=0;
i<gROOT->GetListOfFiles()->GetSize();
i++) {
172 TFile *
g = (TFile*)gROOT->GetListOfFiles()->At(
i);
175 TString
s(
g->GetName());
176 TObjArray*
tokens =
s.Tokenize(
"/");
177 TObjString* lastToken =
dynamic_cast<TObjString*
>(
tokens->Last());
178 TString sToCompare(
"");
179 bool shortComparison(
false);
180 if(
tokens->GetEntries()>1) {
181 TString beforeSlash((
dynamic_cast<TObjString*
>(
tokens->At(
tokens->GetEntries()-2)))->GetString());
182 if(beforeSlash.Length()>0) sToCompare += beforeSlash;
185 shortComparison=
true;
187 sToCompare += lastToken->GetString();
188 TString sToCompare_short(lastToken->GetString());
191 for(
unsigned int j=0;j<inputCollectionsName.value().
size();j++) {
192 TString
t(inputCollectionsName.value()[j].c_str());
195 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
199 TObjArray*
tokens =
t.Tokenize(
"/");
200 TObjString* lastToken =
dynamic_cast<TObjString*
>(
tokens->Last());
201 TString tToCompare =
"";
202 bool shortComparison2(
false);
203 if(
tokens->GetEntries()>1) {
204 TString beforeSlash((
dynamic_cast<TObjString*
>(
tokens->At(
tokens->GetEntries()-2)))->GetString());
205 if(beforeSlash.Length()>0) tToCompare += beforeSlash;
208 shortComparison2=
true;
210 tToCompare += lastToken->GetString();
211 TString tToCompare_short(lastToken->GetString());
214 if(shortComparison || shortComparison2) {
215 if(sToCompare_short.EqualTo(tToCompare_short)) {
216 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
221 if(sToCompare.EqualTo(tToCompare)) {
222 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
230 ATH_MSG_ERROR(
"currentFile(): Couldn't load InputCollections property of " << evtSelName);
return 0;
233 ATH_MSG_ERROR(
"currentFile(): Could not find the current file!");