54 {
55
56
59
60 if( argc < 2 ) {
61 fileName = std::getenv(
"ROOTCORE_TEST_FILE");
63 } else {
65 }
66
67 StatusCode::enableFailure();
69 StatusCode::enableFailure();
70
71
73
74
76 std::unique_ptr< TFile >
ifile( TFile::Open(
fileName.data(),
"READ" ) );
78
79
80
84 static_cast< int >(
event.getEntries() ) );
85
86
88
89
90 Long64_t
entries =
event.getEntries();
91 if( argc > 2 ) {
92 const Long64_t
e = atoll( argv[ 2 ] );
95 }
96 } else {
97
99 }
100
101
103
106
107
108
109
111 auto originTool = std::make_unique<InDet::InDetTrackTruthOriginTool> ( "InDetTrackTruthOriginTool" );
112 CHECK( originTool->initialize() );
113 ToolHandle< InDet::IInDetTrackTruthOriginTool > trackTruthOriginToolHandle( originTool.get() );
114 CHECK( filterTool.setProperty(
"trackOriginTool", trackTruthOriginToolHandle) );
115
117 CHECK( jetFilterTool.setProperty(
"trackOriginTool", trackTruthOriginToolHandle) );
118
119
127
132
133
134
135
138 };
139 std::vector< InDet::InDetTrackSystematicsTool* >
tools = {&smearingTool, &biasingTool, &filterTool, &jetFilterTool};
140
143 tool->msg().setLevel( MSG::DEBUG );
145 auto systCode =
tool->applySystematicVariation(systSet);
146 if (systCode != StatusCode::SUCCESS) {
147 Error(
APP_NAME,
"Failed to apply systematic variation on tool %s",
tool->name().data() );
148 return 2;
149 }
150 }
151
152 bool doTIDE = true;
153 std::string jetCollectionName = "AntiKt4EMTopoJets";
155
156 auto outfile = std::make_unique<TFile>(
"InDetTrackSystsToolTester.out.root",
"RECREATE");
157
158 TH1* d0_before =
new TH1F(
"d0_before",
"original d_{0}",100,-5,5);
159 TH1* z0_before =
new TH1F(
"z0_before",
"original z_{0}",100,-200,200);
160 TH1* qOverP_before =
new TH1F(
"qOverP_before",
"original q/p", 200, -0.05, 0.05);
161 TH1* d0_after =
new TH1F(
"d0_after",
"d_{0} after",100,-5,5);
162 TH1* z0_after =
new TH1F(
"z0_after",
"z_{0} after",100,-200,200);
163 TH1* qOverP_after =
new TH1F(
"qOverP_after",
"q/p after", 200, -0.05, 0.05);
164 TH1* d0_diff =
new TH1F(
"d0_diff",
"#delta d_{0}",100,-1.0,1.0);
165 TH1* z0_diff =
new TH1F(
"z0_diff",
"#delta z_{0}",100,-10.0,10.0);
166 TH1* qOverP_diff =
new TH1F(
"qOverP_diff",
"#delta q/p", 200, -1.e-5, 1.e-5);
167
168 bool isSim = true;
170 auto sc =
event.retrieve( ei,
"EventInfo" );
171 if ( !
sc.isSuccess() ) {
172 Error( __func__,
"Could not retreive event ahead of time to detect data/MC" );
173 } else {
175 }
176
177
178 int debugN = 8;
179
181
182
183 event.getEntry( entry );
184
185
187 CHECK(
event.retrieve( ParticlesID ,
"InDetTrackParticles" ) );
188
190 if (doTIDE) {
191 CHECK(
event.retrieve( jets, jetCollectionName ) );
192 }
193
197
198 if ( isSim ) {
199 if ( !filterTool.accept(trkCpy) ) continue;
200 }
201 if ( doTIDE && !jetFilterTool.accept( trkCpy, jets ) ) continue;
202
203 auto d0b = trkCpy->
d0();
204 auto z0b = trkCpy->
z0();
205 auto qOverPb = trkCpy->
qOverP();
206
208 Error(__func__,
"Could not apply bias correction!" );
209 }
211 Error(__func__,
"Could not apply smearing correction!" );
212 }
213
214 auto d0a = trkCpy->
d0();
215 auto z0a = trkCpy->
z0();
216 auto qOverPa = trkCpy->
qOverP();
217 auto d0d = d0a - d0b;
218 auto z0d = z0a - z0b;
219 auto qOverPd = qOverPa - qOverPb;
220
221 if (debugN > 0) {
222 std::cout << "d0, before/after/diff:\t" << d0b
223 << "/" << d0a << "/" << d0d << std::endl;
224 std::cout << "z0, before/after/diff:\t" << z0b
225 << "/" << z0a << "/" << z0d << std::endl;
226 std::cout << "q/p, before/after/diff:\t" << qOverPb
227 << "/" << qOverPa << "/" << qOverPd << std::endl;
228 --debugN;
229 }
230 if (debugN == 0) {
231 std::cout << "supressing debug output..." << std::endl;
232 --debugN;
233 }
234
235 d0_before->Fill( d0b );
236 z0_before->Fill( z0b );
237 qOverP_before->Fill( qOverPb );
238 d0_after->Fill( d0a );
239 z0_after->Fill( z0a );
240 qOverP_after->Fill( qOverPa );
241 d0_diff->Fill( d0d );
242 z0_diff->Fill( z0d );
243 qOverP_diff->Fill( qOverPd );
244 }
245 }
246
248
249
251
252
253 return 0;
254}
@ Error
Some error happened during the object correction.
static void enableFailure() noexcept
Class to wrap a set of SystematicVariations.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
ReadStats & stats()
Access the object belonging to the current thread.
static IOStats & instance()
Singleton object accessor.
void printSmartSlimmingBranchList(bool autoIncludeLinks=false) const
Print the accessed variables, formatted for smart slimming.
Tool for accessing xAOD files outside of Athena.
@ kAthenaAccess
Access containers/objects like Athena does.
A relatively simple transient store for objects created in analysis.
float z0() const
Returns the parameter.
float d0() const
Returns the parameter.
float qOverP() const
Returns the parameter.
Error
The different types of error that can be flagged in the L1TopoRDO.
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
typename ShallowCopyResult< T >::type ShallowCopyResult_t
Return type of xAOD::shallowCopy.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".