14 #include "GaudiKernel/MsgStream.h"
29 , m_rejectanybrl(false)
30 , m_eventselectormode(false)
32 declareProperty(
"GoodRunsListVec",
m_goodrunslistVec,
"list of input xml files" );
34 declareProperty(
"BoolOperation",
m_boolop );
36 declareProperty(
"VerboseDetStatus",
m_verbose =
false);
37 declareProperty(
"RejectBlackRunsInEventSelector",
m_rejectanybrl =
false );
48 if (m_grlcollection!=0)
delete m_grlcollection;
49 if (m_brlcollection!=0)
delete m_brlcollection;
50 if (m_reader!=0)
delete m_reader;
53 while ( ! m_dqformula.empty() ) {
55 TFormula* form = (*itr).second;
56 m_dqformula.erase(itr);
70 if (!m_goodrunslistVec.empty() || !m_blackrunslistVec.empty() || m_usecool)
78 for (itr=m_goodrunslistVec.begin(); itr!=m_goodrunslistVec.end() && !m_usecool; ++itr) {
81 if ( itr->find(
"/")==0 || itr->find(
"$")==0 || itr->find(
".")==0 || itr->find(
":")!=string::npos ) {
82 fname = gSystem->ExpandPathName( itr->c_str() );
89 return StatusCode::FAILURE;
92 for (itr=m_blackrunslistVec.begin(); itr!=m_blackrunslistVec.end() && !m_usecool; ++itr) {
95 if ( itr->find(
"/")==0 || itr->find(
"$")==0 || itr->find(
".")==0 || itr->find(
":")!=string::npos ) {
96 fname = gSystem->ExpandPathName( itr->c_str() );
103 return StatusCode::FAILURE;
107 if ( !m_goodrunslistVec.empty() ) {
109 for (itr=m_goodrunslistVec.begin(); itr!=m_goodrunslistVec.end() && !m_usecool; ++itr) {
112 if ( itr->find(
"/")==0 || itr->find(
"$")==0 || itr->find(
".")==0 || itr->find(
":")!=string::npos ) {
113 fname = gSystem->ExpandPathName( itr->c_str() );
118 m_reader->AddXMLFile(
fname);
120 m_reader->Interpret();
122 *m_grlcollection = m_reader->GetMergedGRLCollection(
static_cast<Root::BoolOperation>(m_boolop));
124 if ( !m_blackrunslistVec.empty() ) {
126 for (itr=m_blackrunslistVec.begin(); itr!=m_blackrunslistVec.end() && !m_usecool; ++itr) {
129 if ( itr->find(
"/")==0 || itr->find(
"$")==0 || itr->find(
".")==0 || itr->find(
":")!=string::npos ) {
130 fname = gSystem->ExpandPathName( itr->c_str() );
135 m_reader->AddXMLFile(
fname);
137 m_reader->Interpret();
139 *m_brlcollection = m_reader->GetMergedGRLCollection(
static_cast<Root::BoolOperation>(m_boolop));
142 return StatusCode::SUCCESS;
153 int lumiBlockNr = pEvent.lumi_block();
158 " ; lumiblock number = " << lumiBlockNr <<
170 pass = this->passRunLB(
runNumber,lumiBlockNr);
179 const std::vector<std::string>& brlnameVec )
183 const EventContext& ctx = Gaudi::Hive::currentContext();
186 int runNumber = ctx.eventID().run_number();
187 int lumiBlockNr = ctx.eventID().lumi_block();
188 int timeStamp = ctx.eventID().time_stamp();
192 " ; lumiblock number = " << lumiBlockNr <<
204 pass = this->passRunLB(
runNumber,lumiBlockNr,grlnameVec,brlnameVec);
213 const std::vector<std::string>& grlnameVec,
214 const std::vector<std::string>& brlnameVec )
225 if ( m_rejectanybrl && m_eventselectormode ) {
226 if ( m_brlcollection->HasRunLumiBlock(
runNumber,lumiBlockNr) ) {
227 ATH_MSG_DEBUG (
"passRunLB() :: Event rejected by (_any_ of) merged black runs list.");
231 }
else if (!brlnameVec.empty()) {
233 std::vector<Root::TGoodRunsList>::const_iterator brlitr;
234 for (
unsigned int i=0;
i<brlnameVec.size() && !reject; ++
i) {
235 brlitr = m_brlcollection->find(brlnameVec[
i]);
236 if (brlitr!=m_brlcollection->end())
237 reject = brlitr->HasRunLumiBlock(
runNumber,lumiBlockNr);
240 ATH_MSG_DEBUG (
"passRunLB() :: Event rejected by specific black runs list.");
246 if (!grlnameVec.empty()) {
248 std::vector<Root::TGoodRunsList>::const_iterator grlitr;
249 for (
unsigned int i=0;
i<grlnameVec.size() && !pass; ++
i) {
250 grlitr = m_grlcollection->find(grlnameVec[
i]);
251 if (grlitr!=m_grlcollection->end())
252 pass = grlitr->HasRunLumiBlock(
runNumber,lumiBlockNr);
255 ATH_MSG_DEBUG (
"passRunLB() :: Event accepted by specific good runs list.");
259 }
else if (m_grlcollection->HasRunLumiBlock(
runNumber,lumiBlockNr)) {
260 ATH_MSG_DEBUG (
"passRunLB() :: Event accepted by (_any_ of) merged good runs list.");
264 ATH_MSG_DEBUG (
"passRunLB() :: Event rejected, not in (any) good runs list.");
273 return StatusCode::SUCCESS;
302 if (m_registry.find(
name)!=m_registry.end()) {
303 ATH_MSG_WARNING (
"registerGRLSelector() :: GRL selector with name <" <<
name <<
"> already registered. Return false.");
308 if (!brlnameVec.empty()) {
309 std::vector<Root::TGoodRunsList>::const_iterator brlitr;
310 for (
unsigned int i=0;
i<brlnameVec.size(); ++
i) {
311 brlitr = m_brlcollection->find(brlnameVec[
i]);
312 if (brlitr==m_brlcollection->end()) {
313 ATH_MSG_ERROR (
"registerGRLSelector() :: requested BRL object with name <" << brlnameVec[
i] <<
"> not found. Have you provided an object name from the BRL xml-file(s)?");
320 if (!grlnameVec.empty()) {
321 std::vector<Root::TGoodRunsList>::const_iterator grlitr;
322 for (
unsigned int i=0;
i<grlnameVec.size(); ++
i) {
323 grlitr = m_grlcollection->find(grlnameVec[
i]);
324 if (grlitr==m_grlcollection->end()) {
325 ATH_MSG_ERROR (
"registerGRLSelector() :: requested GRL object with name <" << grlnameVec[
i] <<
"> not found. Have you provided an object name from the GRL xml-file(s)?");
331 ATH_MSG_DEBUG (
"registerGRLSelector() :: GRL selector with name <" <<
name <<
"> registered.");
332 m_registry[
name] =
vvPair(grlnameVec,brlnameVec);