73 {
74
75
76 MsgStream log(
msgSvc(), name());
77 log << MSG::INFO << " BesVisAlg initialize()" << endreq;
78 StatusCode status = StatusCode::SUCCESS;
79
80
81
82 IService* isvc = 0;
83 status = serviceLocator()->service("RootCnvSvc", isvc, false);
84 if ( !status.isSuccess() )
85 status = serviceLocator()->service("EventCnvSvc", isvc, true);
86 if ( status.isSuccess() )
88 status = hasWrite();
89 if ( status.isSuccess()){
90 log << MSG::INFO << "share file writed -- success"
91 << endreq;
92 }
93 else {
94 log << MSG::ERROR << "share file writed -- ERROR!!!!!"
95 << endreq;
96 }
97
98
99
100 log << MSG::INFO << " OutputFile = " << f_rootOutputFile << endreq;
101
102 for (unsigned int i=0; i<testVec.size(); i++) {
103 log << MSG::INFO << " MyStringVec[" << i << "] = "
104 << testVec[i] << endreq;
105 }
106
107
108 m_pid = getpid();
109 log << MSG::ERROR << "BesVisAlg process PID: [" << m_pid << "]"
110 << endreq;
111
112 log << MSG::ERROR << "Create and initialize semaphore" << endreq;
113 if ((semid = semget((int)m_pid, 2, IPC_CREAT | IPC_EXCL | 0666)) != -1){
114 arg.
array = start_val;
115 log << MSG::ERROR << "Semaphore ID:" << semid << endreq;
116
117 if (semctl(semid, 0, SETALL, arg) == -1){
118 log << MSG::ERROR << "semctl -- parent -- initialization"
119 << endreq;
120 exit(1);
121 }
122
123 if ((sem_value_F = semctl(semid,
FREE_SPACE, GETVAL, 0)) == -1){
124 log << MSG::ERROR << "semctl -- GETVAL" << endreq;
125 exit(1);
126 }
127
128 if ((sem_value_O = semctl(semid,
OUTPUT_STORE, GETVAL, 0)) == -1){
129 log << MSG::ERROR << "semctl -- GETVAL" << endreq;
130 exit(1);
131 }
132 }
133 else {
134 log << MSG::INFO << "semget -- parent -- creation" << endreq;
135 exit(2);
136 }
137
138
139
140
141
142
143
144
145 if ((c_pid = fork()) == -1){
146 log << MSG::ERROR << "fork -- consumer" << endreq;
147 exit(5);
148 }
149 else if (c_pid == 0){
150
151 log << MSG::INFO << "Parent fork consumer: ppid = " << getppid()
152 << "; pid = " << getpid() << endreq;
153
154
155 char msg_pid[25];
157
158 const char *msg_sleep = testVec[1].c_str();
159
160 log << MSG::INFO << "msg_pid: " << msg_pid << endreq;
161 log << MSG::INFO << "Consumer sleep time: " << msg_sleep
162 << " seconds." << endreq;
163
164
165 execlp("besvis.exe", "besvis.exe",
166 "-B", msg_pid, "-e", f_rootOutputFile.c_str(),
167 "-g", f_geoInputFile.c_str(), (
char *)
NULL );
168
169
170 log << MSG::ERROR << "exec -- consumer" << endreq;
171 exit(6);
172 }
173
174
175 return StatusCode::SUCCESS;
176}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
const InterfaceID IID_IRootCnvSvc