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 IProperty* evtSelector = 0;
154 if(service(evtSelName,evtSelector,
false).isFailure()) {
155 ATH_MSG_ERROR(
"currentFile(): Couldn't find the service: " << evtSelName);
return 0;
167 const StringArrayProperty& inputCollectionsName =
dynamic_cast<const StringArrayProperty&
>(evtSelector->getProperty(
"InputCollections"));
169 ATH_MSG_VERBOSE(
"nOpenFile=" << gROOT->GetListOfFiles()->GetSize() <<
". nFilesInInputCollection=" << inputCollectionsName.value().size());
171 for(
int i=0;
i<gROOT->GetListOfFiles()->GetSize();
i++) {
172 ATH_MSG_VERBOSE(
"Open file: " << gROOT->GetListOfFiles()->At(
i)->GetName());
178 for(
int i=0;
i<gROOT->GetListOfFiles()->GetSize();
i++) {
179 TFile *
g = (TFile*)gROOT->GetListOfFiles()->At(
i);
182 TString
s(
g->GetName());
183 TObjArray*
tokens =
s.Tokenize(
"/");
184 TObjString* lastToken =
dynamic_cast<TObjString*
>(
tokens->Last());
185 TString sToCompare(
"");
186 bool shortComparison(
false);
187 if(
tokens->GetEntries()>1) {
188 TString beforeSlash((
dynamic_cast<TObjString*
>(
tokens->At(
tokens->GetEntries()-2)))->GetString());
189 if(beforeSlash.Length()>0) sToCompare += beforeSlash;
192 shortComparison=
true;
194 sToCompare += lastToken->GetString();
195 TString sToCompare_short(lastToken->GetString());
198 for(
unsigned int j=0;j<inputCollectionsName.value().
size();j++) {
199 TString
t(inputCollectionsName.value()[j].c_str());
202 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
206 TObjArray*
tokens =
t.Tokenize(
"/");
207 TObjString* lastToken =
dynamic_cast<TObjString*
>(
tokens->Last());
208 TString tToCompare =
"";
209 bool shortComparison2(
false);
210 if(
tokens->GetEntries()>1) {
211 TString beforeSlash((
dynamic_cast<TObjString*
>(
tokens->At(
tokens->GetEntries()-2)))->GetString());
212 if(beforeSlash.Length()>0) tToCompare += beforeSlash;
215 shortComparison2=
true;
217 tToCompare += lastToken->GetString();
218 TString tToCompare_short(lastToken->GetString());
221 if(shortComparison || shortComparison2) {
222 if(sToCompare_short.EqualTo(tToCompare_short)) {
223 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
228 if(sToCompare.EqualTo(tToCompare)) {
229 ATH_MSG_VERBOSE(
"Current File is: " << inputCollectionsName.value()[j]);
237 ATH_MSG_ERROR(
"currentFile(): Couldn't load InputCollections property of " << evtSelName);
return 0;
240 ATH_MSG_ERROR(
"currentFile(): Could not find the current file!");