64 self.
msg.info(
"Performing thinning test [%s]...", testName )
67 particlesName =
"%s_%s" % (self.
Particles,testName)
68 particles = self.
sg.retrieve(
"AthExParticles", particlesName )
70 self.
msg.warning(
"Could not fetch particles at [%s] !!",
72 return StatusCode.Failure
73 self.
msg.info(
"particles: %i", particles.size() )
76 iparticles = self.
sg.retrieve(
"AthExIParticles", particlesName )
77 if iparticles
is None:
78 self.
msg.warning(
"Could not fetch iparticles at [%s] !!",
80 return StatusCode.Failure
81 self.
msg.info(
"iparticles: %i", iparticles.size() )
83 if ( iparticles.size() != particles.size()
or
84 iparticles.at(0).px() != particles.at(0).px() ):
85 self.
msg.
error(
"symlinked containers are corrupted: " )
86 self.
msg.
error(
" #iparticles: %i", iparticles.size() )
87 self.
msg.
error(
" # particles: %i", particles.size() )
88 self.
msg.
error(
" ipx[0] = %r", iparticles.at(0).px() )
89 self.
msg.
error(
" px[0] = %r", particles.at(0).px() )
90 return StatusCode.Failure
93 decay = self.
sg.retrieve(
"AthExDecay",
94 "%s_%s" % (self.
Decay, testName) )
96 self.
msg.warning(
"Could not fetch Decay at [%s] !!",
98 return StatusCode.Failure
101 elephantino = self.
sg.retrieve(
"AthExElephantino",
103 if elephantino
is None:
104 self.
msg.warning(
"Could not fetch Elephantino at [%s] !!",
106 return StatusCode.Failure
108 self.
msg.info(
"IN particles: %i", particles.size() )
109 self.
msg.info(
"IN decay:" )
110 self.
msg.info(
" p1: px= %r", decay.p1().px() / Units.GeV )
111 self.
msg.info(
" p2: px= %r", decay.p2().px() / Units.GeV )
112 self.
msg.info(
" l1: px= %r", decay.l1().px() / Units.GeV )
113 self.
msg.info(
" l2: px= %r", decay.l2().px() / Units.GeV )
115 self.
msg.info(
"IN elephantino:" )
116 self.
msg.info(
" leg1: px= %r", elephantino.leg1().px() / Units.GeV )
117 self.
msg.info(
" leg2: px= %r", elephantino.leg2().px() / Units.GeV )
118 self.
msg.info(
" leg3: px= %r", elephantino.leg3().px() / Units.GeV )
119 self.
msg.info(
" leg4: px= %r", elephantino.leg4().px() / Units.GeV )
120 self.
msg.info(
" ear1: px= %r", elephantino.ear1().px() / Units.GeV )
121 self.
msg.info(
" ear2: px= %r", elephantino.ear2().px() / Units.GeV )
124 dec = ROOT.SG.ThinningDecision (particlesName)
125 if testName ==
"test1":
127 self.
msg.warning(
"Could not exercize Thinning !!" )
128 elif testName ==
"test2":
130 self.
msg.warning(
"Could not exercize Thinning !!" )
131 elif testName ==
"test3":
133 self.
msg.warning(
"Could not exercize Thinning !!" )
135 self.
msg.
error(
"Unknown test [%s]", testName )
136 return StatusCode.Failure
138 if not self.
sg.record (dec, particlesName +
'_THINNED_StreamUSR_0'):
139 return StatusCode.Failure
140 ROOT.SetOwnership (dec,
False)
142 self.
msg.info(
"Decay is now:" )
143 self.
msg.info(
" p1: px= %r", decay.p1().px() / Units.GeV )
144 self.
msg.info(
" p2: px= %r", decay.p2().px() / Units.GeV )
145 self.
msg.info(
" l1: px= %r", decay.l1().px() / Units.GeV )
146 self.
msg.info(
" l2: px= %r", decay.l2().px() / Units.GeV )
148 self.
msg.info(
"Elephantino is now: " )
149 self.
msg.info(
" leg1: px= %r", elephantino.leg1().px() / Units.GeV )
150 self.
msg.info(
" leg2: px= %r", elephantino.leg2().px() / Units.GeV )
151 self.
msg.info(
" leg3: px= %r", elephantino.leg3().px() / Units.GeV )
152 self.
msg.info(
" leg4: px= %r", elephantino.leg4().px() / Units.GeV )
153 self.
msg.info(
" ear1: px= %r", elephantino.ear1().px() / Units.GeV )
154 self.
msg.info(
" ear2: px= %r", elephantino.ear2().px() / Units.GeV )
156 self.
msg.info(
"[%s] has been performed.", testName )
157 return StatusCode.Success
161 RemovedIdx = ROOT.SG.ThinningDecisionBase.RemovedIdx
162 self.
msg.info(
"Particles | filter :" )
163 for i
in range(particles.size()):
164 if filter[i]: kr =
"keep"
166 self.
msg.info(
"%9s | %s", (i+1)*10, kr )
167 self.
msg.info(
"="*19 )
169 filter[len(filter)//2:] = [
True]*(len(filter)//2)
170 self.
msg.info(
"Filter %r", filter )
172 self.
msg.info(
"... Processing [pre-thinning] ..." )
175 self.
msg.info(
"======== Index table =========" )
176 tmp = ROOT.SG.ThinningDecisionBase (dec)
179 os.sys.stdout.flush()
180 for i
in range(particles.size()):
181 newIdx = tmp.index(i)
182 if newIdx == RemovedIdx: newIdx =
"-"
183 self.
msg.info(
" idx %i -> %s", i, newIdx )
186 filter[:len(filter)//2] = [
True]*(len(filter)//2)
187 self.
msg.info(
"Filter %r", filter )
189 self.
msg.info(
"... Processing [thinning] ..." )
190 keep (dec, filter,
'and')
192 self.
msg.info(
"======== Index table =========" )
193 tmp = ROOT.SG.ThinningDecisionBase (dec)
195 for i
in range(particles.size()):
196 newIdx = tmp.index(i)
197 if newIdx == RemovedIdx: newIdx =
"-"
198 self.
msg.info(
" idx %i -> %s", i, newIdx )
200 return StatusCode.Success
204 RemovedIdx = ROOT.SG.ThinningDecisionBase.RemovedIdx
205 self.
msg.info(
"Particles | filter :" )
206 for i
in range(particles.size()):
207 if filter[i]: kr =
"keep"
209 self.
msg.info(
"%9s | %s", (i+1)*10, kr )
210 self.
msg.info(
"="*19 )
212 filter[len(filter)//2:] = [
False]*(len(filter)//2)
213 self.
msg.info(
"Filter %s", filter )
215 self.
msg.info(
"... Processing [pre-thinning] ..." )
218 self.
msg.info(
"======== Index table =========" )
219 tmp = ROOT.SG.ThinningDecisionBase (dec)
221 for i
in range(particles.size()):
222 newIdx = tmp.index(i)
223 if newIdx == RemovedIdx: newIdx =
"-"
224 self.
msg.info(
" idx %i -> %s", i, newIdx )
227 filter[:len(filter)//2] = [
False]*(len(filter)//2)
228 self.
msg.info(
"Filter %s", filter )
230 self.
msg.info(
"... Processing [thinning] ..." )
231 keep (dec, filter,
'or')
233 self.
msg.info(
"======== Index table =========" )
234 tmp = ROOT.SG.ThinningDecisionBase (dec)
236 for i
in range(particles.size()):
237 newIdx = tmp.index(i)
238 if newIdx == RemovedIdx: newIdx =
"-"
239 self.
msg.info(
" idx %i -> %s", i, newIdx )
241 return StatusCode.Success
245 RemovedIdx = ROOT.SG.ThinningDecisionBase.RemovedIdx
246 self.
msg.info(
"IParticles | filter :" )
247 for i
in range(iparticles.size()):
248 if filter[i]: kr =
"keep"
250 self.
msg.info(
"%9s | %s", (i+1)*10, kr )
251 self.
msg.info(
"="*19 )
253 filter[len(filter)//2:] = [
True]*(len(filter)//2)
254 self.
msg.info(
"Filter %r", filter )
256 self.
msg.info(
"... Processing [pre-thinning] ..." )
259 self.
msg.info(
"======== Index table =========" )
260 tmp = ROOT.SG.ThinningDecisionBase (dec)
262 for i
in range(iparticles.size()):
263 newIdx = tmp.index(i)
264 if newIdx == RemovedIdx: newIdx =
"-"
265 self.
msg.info(
" idx %i -> %s", i, newIdx )
268 filter[:len(filter)//2] = [
True]*(len(filter)//2)
269 self.
msg.info(
"Filter %r", filter )
271 self.
msg.info(
"... Processing [thinning] ..." )
272 keep (dec, filter,
'and')
274 self.
msg.info(
"======== Index table =========" )
275 tmp = ROOT.SG.ThinningDecisionBase (dec)
277 for i
in range(iparticles.size()):
278 newIdx = tmp.index(i)
279 if newIdx == RemovedIdx: newIdx =
"-"
280 self.
msg.info(
" idx %i -> %s", i, newIdx )
282 return StatusCode.Success