38 {
39
41 msg() <<
"MuctpiLoader: Loading MuCTPi with ID = " << mTarget.id() <<
" and Lvl1 masterId = " << mTarget.lvl1MasterTableId() << std::endl;
42 try {
44 if ( mTarget.lvl1MasterTableId() ) {
45
46 long muctpi_id = 0;
47
48 std::unique_ptr<coral::IQuery> query0(
m_session.nominalSchema().tableHandle(
"L1_MASTER_TABLE").newQuery());
49 query0->setRowCacheSize( 5 );
50
51
52 coral::AttributeList bindList;
53 bindList.extend<long>("mtId");
54 std::string cond = "L1MT_ID = :mtId";
55 bindList[0].data<long>() = mTarget.lvl1MasterTableId();
56 query0->setCondition( cond, bindList );
57
58
59 coral::AttributeList attList;
60 attList.extend<long>( "L1MT_MUCTPI_INFO_ID" );
61 query0->defineOutput(attList);
62 query0->addToOutputList( "L1MT_MUCTPI_INFO_ID" );
63
64 coral::ICursor& cursor0 = query0->execute();
65
66 if ( ! cursor0.next() ) {
67 msg() <<
"MuctpiLoader >> No such Master_Table exists " << mTarget.lvl1MasterTableId() << std::endl;
69 throw std::runtime_error( "MuctpiLoader >> Muctpi_Info not available" );
70 }
71
72 const coral::AttributeList& row0 = cursor0.currentRow();
73 muctpi_id = row0["L1MT_MUCTPI_INFO_ID"].data<long>();
74
75 if ( cursor0.next() ) {
76 msg() <<
"MuctpiLoader >> More than one Muctpi_Info exists for this master_table id"
77 << mTarget.lvl1MasterTableId() << std::endl;
79 throw std::runtime_error( "MuctpiLoader >> Muctpi_Info not available" );
80 }
81 mTarget.setId(muctpi_id);
82 }
83
84 std::unique_ptr<coral::IQuery>
query(
m_session.nominalSchema().tableHandle(
"L1_MUCTPI_INFO").newQuery());
85 query->setRowCacheSize( 5 );
86
87
88 coral::AttributeList bindList2;
89 bindList2.extend<long>("miId");
90 std::string cond2 = "L1MI_ID = :miId";
91 bindList2[0].data<long>() = mTarget.id();
92 query->setCondition( cond2, bindList2 );
93
94
95 coral::AttributeList attList;
96 attList.extend<int>( "L1MI_VERSION" );
97 attList.extend<std::string>( "L1MI_NAME" );
98 attList.extend<int>( "L1MI_LOW_PT" );
99 attList.extend<int>( "L1MI_HIGH_PT" );
100 attList.extend<int>( "L1MI_MAX_CAND" );
101 attList.extend<long>( "L1MI_ID" );
102 query->defineOutput(attList);
103
104 query->addToOutputList(
"L1MI_VERSION" );
105 query->addToOutputList(
"L1MI_NAME" );
106 query->addToOutputList(
"L1MI_LOW_PT" );
107 query->addToOutputList(
"L1MI_HIGH_PT" );
108 query->addToOutputList(
"L1MI_MAX_CAND" );
109 query->addToOutputList(
"L1MI_ID" );
110 query->addToOrderList(
"L1MI_ID" );
111
114 msg() <<
"MuctpiLoader >> No such Muctpi_info exists " << mTarget.id() << std::endl;
116 throw std::runtime_error( "MuctpiLoader >> Muctpi not available" );
117 }
118
119 const coral::AttributeList&
row =
cursor.currentRow();
120 std::string
name =
row[
"L1MI_NAME"].data<std::string>();
121 int version =
row[
"L1MI_VERSION"].data<
int>();
122 int low_pt =
row[
"L1MI_LOW_PT"].data<
int>();
123 int high_pt =
row[
"L1MI_HIGH_PT"].data<
int>();
124 int max_cand =
row[
"L1MI_MAX_CAND"].data<
int>();
125
127 msg() <<
"MuctpiLoader >> More than one Muctpi exists " << mTarget.id() << std::endl;
129 throw std::runtime_error( "MuctpiLoader >> Muctpi not available" );
130 }
131
132
133
134 mTarget.setName( name );
135 mTarget.setVersion( version );
136 mTarget.setLowptThreshold( low_pt );
137 mTarget.setHighptThreshold( high_pt );
138 mTarget.setMaxCand( max_cand );
140 return true;
141 } catch( const coral::SchemaException& e ) {
142 msg() <<
"MuctpiLoader >> SchemaException: " <<
e.what() << std::endl;
144 return false;
145 } catch( const std::exception& e ) {
146 msg() <<
"MuctpiLoader >> Standard C++ exception: " <<
e.what() << std::endl;
148 return false;
149
150 } catch( ... ) {
151 msg() <<
"MuctpiLoader >> unknown C++ exception" << std::endl;
153 return false;
154 }
155}
virtual int verbose() const override
void commitSession()
commit session if not already done
void startSession()
start session if not already active
MsgStreamTC & msg() const
The standard message stream.
row
Appending html table to final .html summary file.