ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonInsideOutAnalysis Class Reference

#include <MuonInsideOutAnalysis.h>

Collaboration diagram for Muon::MuonInsideOutAnalysis:

Public Types

enum  MatchingStrategy { SameTrack = 0 , NotSameTrack = 1 , All = 2 }

Public Member Functions

 MuonInsideOutAnalysis (TDirectory *dir)
 create analsyis for a given tree
void analyse (TTree &tree)
 analyse tree

Private Member Functions

bool testStrategy (MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, bool sameTrack) const
unsigned int handleHits (MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, HitPlots &plots)
unsigned int handleHough (MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, HoughPlots &plots)
unsigned int handleSegments (MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, int stage, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, SegmentPlots &segmentPlots)
std::pair< unsigned int, unsigned int > handleCandidates (MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, StageSummaryPlots &plots, int stage)
void handleTimes (MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, TrackPlots &trackPlots)
TimePointBetaFitter::FitResult fitBeta (MuonInsideOutValidationNtuple &ntuple, const std::vector< int > &indexVec, const std::set< int > &type)

Private Attributes

MuonInsideOutAnalysisPlots m_plots

Detailed Description

Definition at line 18 of file MuonInsideOutAnalysis.h.

Member Enumeration Documentation

◆ MatchingStrategy

Constructor & Destructor Documentation

◆ MuonInsideOutAnalysis()

Muon::MuonInsideOutAnalysis::MuonInsideOutAnalysis ( TDirectory * dir)

create analsyis for a given tree

Definition at line 20 of file MuonInsideOutAnalysis.cxx.

20 {
21 m_plots.book(dir,"");
22 }
MuonInsideOutAnalysisPlots m_plots

Member Function Documentation

◆ analyse()

void Muon::MuonInsideOutAnalysis::analyse ( TTree & tree)

analyse tree

Definition at line 24 of file MuonInsideOutAnalysis.cxx.

24 {
25
26 // create ntuple and initialize it
27 Muon::MuonInsideOutValidationNtuple ntuple;
28 ntuple.init("",&tree,false);
29 //tree.SetMakeClass(1);
30 // loop over tree
31 Long64_t nentries = tree.GetEntries();
32 MsgStream log(Athena::getMessageSvc(),"MuonInsideOutAnalysis");
33 if (log.level()<=MSG::INFO) log << MSG::INFO << "Opening tree " << nentries << endmsg;
34 for (Long64_t jentry=0; jentry<nentries;jentry++) {
35
36 // load tree and get entries
37 Long64_t centry = tree.LoadTree(jentry);
38 if (centry < 0) return;
39 tree.GetEntry(jentry);
40
41
42 if( jentry%1000 == 0 ){
43 if (log.level()<=MSG::INFO) {
44 log << MSG::INFO << " new event " << jentry << endmsg;
45 log << MSG::INFO << " tracks " << ntuple.trackParticleBlock.pt->size() << " segments " << ntuple.segmentBlock.quality->size() << endmsg;
46 }
47 }
48
49 // to simplify the analysis we in the beginning look up the indicies of objects corresponding to a given track identifier
50 // fill look up tables
51 typedef std::map<int,std::vector<int> > TrackMap;
52 auto fillTrackMap = []( const std::vector<int>& trkids, TrackMap& trackMap ){
53 for( unsigned int i=0;i<trkids.size();++i){
54 trackMap[ trkids[i] ].push_back(i);
55 }
56 };
57
58 TrackMap track_seg_map;
59 fillTrackMap( *ntuple.segmentBlock.track.trkid, track_seg_map );
60
61 TrackMap track_hough_map;
62 fillTrackMap( *ntuple.houghBlock.track.trkid, track_hough_map );
63
64 TrackMap track_hit_map;
65 fillTrackMap( *ntuple.hitBlock.track.trkid, track_hit_map );
66
67 TrackMap track_time_map;
68 fillTrackMap( *ntuple.timeBlock.track.trkid, track_time_map );
69
70 TrackMap track_candidate_map;
71 fillTrackMap( *ntuple.candidateBlock.track.trkid, track_candidate_map );
72
73 // now run the analysis per track
74 // loop over tracks
75 TrackPlots* trackPlots = nullptr;
76 for( unsigned int i=0;i<ntuple.trackParticleBlock.pt->size();++i){
77
78 //if( (*ntuple.trackParticleBlock.pt)[i] < 50000. ) continue;
79 float eta = (*ntuple.trackParticleBlock.eta)[i];
80 bool isBarrel = std::abs(eta)<1.05;
81 float betaTruth = (*ntuple.trackParticleBlock.truth.beta)[i];
82
83 // this loop is ther to deal with the following cases:
84 // 1) true muon + segments from the same muon in the MS -> our signal
85 // 2) true muon + segments from other particles -> background
86 // 3) ID track not a muon -> background
87 for( int ii=0;ii<3;++ii ){
88 MatchingStrategy matchingStrategy = static_cast<MatchingStrategy>(ii);
89
90 // first select track type, first deal with the case the track is a stau
91 if( std::abs((*ntuple.trackParticleBlock.truth.pdg)[i]) == 1000015 ) {
92 if( matchingStrategy == SameTrack ) trackPlots = &m_plots.stau;
93 else if( matchingStrategy == NotSameTrack ) trackPlots = &m_plots.rest;
94 else continue;
95 }else if( std::abs((*ntuple.trackParticleBlock.truth.pdg)[i]) == 13 ) {
96 if( matchingStrategy == SameTrack ) trackPlots = &m_plots.muon;
97 else if( matchingStrategy == NotSameTrack ) trackPlots = &m_plots.rest;
98 else continue;
99 }else{
100 // track is not a muon
101 if( matchingStrategy == All ) trackPlots = &m_plots.rest;
102 else continue;
103 }
104
105 // count the number of true segments/reconstructed segments/layers with hough maxima
106 unsigned int ntruth = 0;
107 unsigned int nseg = 0;
108 unsigned int nseg1 = 0;
109 unsigned int nseg2 = 0;
110 unsigned int nseg3 = 0;
111 unsigned int nhough = 0;
112
113 // process segments
114 TrackMap::iterator pos = track_seg_map.find(i);
115 if( pos != track_seg_map.end() ) {
116 nseg = handleSegments(ntuple,i,pos->second,0, matchingStrategy, trackPlots->segments);
117 nseg1 = handleSegments(ntuple,i,pos->second,1, matchingStrategy, trackPlots->segments1);
118 nseg2 = handleSegments(ntuple,i,pos->second,2, matchingStrategy, trackPlots->segments2);
119 nseg3 = handleSegments(ntuple,i,pos->second,3, matchingStrategy, trackPlots->segments3);
120 }
121
122 // process hough
123 pos = track_hough_map.find(i);
124 if( pos != track_hough_map.end() ) {
125 nhough = handleHough(ntuple,i,pos->second, matchingStrategy, trackPlots->hough);
126 }
127
128 // process hits
129 pos = track_hit_map.find(i);
130 if( pos != track_hit_map.end() ) {
131 ntruth = handleHits(ntuple,i,pos->second, matchingStrategy, trackPlots->hits);
132 }
133
134 // process times
135 pos = track_time_map.find(i);
136 if( pos != track_time_map.end() ) {
137 handleTimes(ntuple,i,pos->second, matchingStrategy, *trackPlots);
138 }
139
140
141 // fill general track block only once per track
142 if( matchingStrategy == SameTrack || matchingStrategy == All ) {
143 trackPlots->fill(ntuple.trackParticleBlock,i);
144 trackPlots->fill(ntruth,nseg,nseg1,nseg2,nseg3,nhough);
145
146 pos = track_candidate_map.find(i);
147 // bool justOnCandidate = true;
148 // loop over stages and fill plots
149 for( unsigned int si=0;si<trackPlots->candidateStages.size();++si ){
150 StageSummaryPlots& plots = trackPlots->candidateStages[si];
151 std::pair<unsigned int,unsigned int> candidateCounts(0,0);
152 if( pos != track_candidate_map.end() ) candidateCounts = handleCandidates(ntuple,i,pos->second, plots, si );
153 if( candidateCounts.first == 0 ) {
154 plots.etaMissed->Fill(eta);
155 plots.etaBetaMissed->Fill(eta,betaTruth);
156 plots.betaMissed->Fill(betaTruth);
157 }
158 if( candidateCounts.second == 0 ) {
159 plots.etaMissedCombined->Fill(eta);
160 plots.betaMissedCombined->Fill(betaTruth);
161 }
162 plots.ncandidates->Fill(candidateCounts.first);
163 plots.ncombinedCandidates->Fill(candidateCounts.second);
164 // if( candidateCounts.first > 1 ) justOnCandidate = false;
165 }
166 if( nseg3 < 2 ) continue;
167
168 pos = track_time_map.find(i);
169 if( pos != track_time_map.end() ) {
170
171 BetaFitRegionPlots& betaRegionPlots = isBarrel ? trackPlots->barrel : trackPlots->endcap;
172
173 // loop over input types, RPC + MDT segment or RPC + MDTT
174 for( unsigned int co=0;co<2;++co ){
175
176 std::set<int> selection = {1};
177 TimePointBetaFitter::FitResult betaFitResult = fitBeta( ntuple, pos->second,selection);
178 if( betaFitResult.status != 0 ) betaRegionPlots.mdt.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
179 if( isBarrel ){
180
181 selection = {2};
182 betaFitResult = fitBeta( ntuple, pos->second,selection );
183 if( betaFitResult.status != 0 ) betaRegionPlots.rpc.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
184
185 selection = {12};
186 betaFitResult = fitBeta( ntuple, pos->second,selection );
187 if( betaFitResult.status != 0 ) betaRegionPlots.rpct.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
188
189 selection = {1,2};
190 betaFitResult = fitBeta( ntuple, pos->second,selection );
191 if( betaFitResult.status != 0 ) betaRegionPlots.all.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
192
193 selection = {10,12};
194 betaFitResult = fitBeta( ntuple, pos->second,selection );
195 if( betaFitResult.status != 0 ) {
196 betaRegionPlots.allt.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
197 if( betaFitResult.ndof > 9 ) betaRegionPlots.allt_good.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
198 }
199 }
200
201 selection = {10};
202 betaFitResult = fitBeta( ntuple, pos->second,selection );
203 if( betaFitResult.status != 0 ) {
204 betaRegionPlots.mdtt.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
205 if( betaFitResult.ndof > 9 ) betaRegionPlots.mdtt_good.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
206 }
207 }
208 }
209 }
210 }
211 }
212 }
213 }
Scalar eta() const
pseudorapidity method
#define endmsg
std::pair< unsigned int, unsigned int > handleCandidates(MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, StageSummaryPlots &plots, int stage)
unsigned int handleHough(MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, HoughPlots &plots)
TimePointBetaFitter::FitResult fitBeta(MuonInsideOutValidationNtuple &ntuple, const std::vector< int > &indexVec, const std::set< int > &type)
unsigned int handleHits(MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, HitPlots &plots)
unsigned int handleSegments(MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, int stage, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, SegmentPlots &segmentPlots)
void handleTimes(MuonInsideOutValidationNtuple &ntuple, unsigned int trkIndex, const std::vector< int > &indexVec, MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, TrackPlots &trackPlots)
MuonValidationTrackParticleBlock trackParticleBlock
const std::string selection
IMessageSvc * getMessageSvc(bool quiet=false)
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
void init(const std::string &prefix, TTree *, bool write=true)
TChain * tree

◆ fitBeta()

TimePointBetaFitter::FitResult Muon::MuonInsideOutAnalysis::fitBeta ( MuonInsideOutValidationNtuple & ntuple,
const std::vector< int > & indexVec,
const std::set< int > & type )
private

fit beta

Definition at line 390 of file MuonInsideOutAnalysis.cxx.

391 {
392
393 TimePointBetaFitter fitter;
394 std::map<int,TimePointBetaFitter::HitVec> hitsPerCandidate;
395
396 MsgStream log(Athena::getMessageSvc(),"MuonInsideOutAnalysis");
397 // loop over hits
398 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
399
400 if( *it < 0 || *it >= (int)ntuple.timeBlock.type->size() ) {
401 if (log.level()<=MSG::WARNING) log << MSG::WARNING << "index out of range: " << (*it) << " max " << ntuple.timeBlock.type->size() << endmsg;
402 continue;
403 }
404
405 // get hits
406 int type = (*ntuple.timeBlock.type)[*it];
407 if( !types.count(type) ) continue;
408 float time = (*ntuple.timeBlock.time)[*it];
409 float error = (*ntuple.timeBlock.err)[*it];
410 int candidateIndex = (*ntuple.timeBlock.stage)[*it];
411
412 hitsPerCandidate[candidateIndex].push_back( TimePointBetaFitter::Hit((*ntuple.timeBlock.d)[*it], time, error ) );
413 }
414
415 std::map<int,TimePointBetaFitter::HitVec>::iterator cit = hitsPerCandidate.begin();
416 std::map<int,TimePointBetaFitter::HitVec>::iterator cit_end = hitsPerCandidate.end();
417 if( hitsPerCandidate.size() > 1 ){
418 if (log.level()<=MSG::INFO) log << MSG::INFO << "multple candidates for track " << hitsPerCandidate.size() << endmsg;
419 }
420
421 TimePointBetaFitter::FitResult result;
422 for( ;cit!=cit_end;++cit ){
424 TimePointBetaFitter::HitVec& hits = cit->second;
425 TimePointBetaFitter::FitResult candidateResult = fitter.fitWithOutlierLogic(hits);
426
427 float chi2ndof = candidateResult.chi2/candidateResult.ndof;
428 if (log.level()<=MSG::INFO) {
429 if( hits.size() > 1 && candidateResult.status != 0 && chi2ndof>5 ){
430 MuonBetaCalculationUtils betaUtils(0.);
431 log << MSG::INFO << "Beta " << candidateResult.beta << " of fit for types ";
432 for( auto type : types ) std::cout << " " << type;
433 log << MSG::INFO << " with large chi2 " << chi2ndof << " hits " << hits.size() << endmsg;
434 for( auto& hit : hits ){
435 const char* text = hit.useInFit ? " hit " : " outlier ";
436 log << MSG::INFO << text << ": dist "<< std::setw(7) << (int)hit.distance
437 << " time " << std::setprecision(3) << std::setw(6) << hit.time - betaUtils.calculateTof(1.,hit.distance)
438 << " beta " << std::setw(6) << betaUtils.calculateBeta(hit.time,hit.distance)
439 << " error " << std::setw(6) << hit.error << " residual " << std::setw(6) << hit.residual << " pull " << std::setw(6) << hit.residual/hit.error << endmsg;
440 }
441 }
442 }
443 if( candidateResult.status != 0 ){
444 if( result.status == 0 || result.ndof < candidateResult.ndof ) result = candidateResult;
445 }
446 }
447 return result;
448 }
static const std::vector< std::string > types
time(flags, cells_name, *args, **kw)
const ShapeFitter * fitter

◆ handleCandidates()

std::pair< unsigned int, unsigned int > Muon::MuonInsideOutAnalysis::handleCandidates ( MuonInsideOutValidationNtuple & ntuple,
unsigned int trkIndex,
const std::vector< int > & indexVec,
StageSummaryPlots & plots,
int stage )
private

Definition at line 215 of file MuonInsideOutAnalysis.cxx.

217 {
218
219 CandidatePlots& allCandidates = plots.allCandidates;
220 CandidatePlots& tagCandidates = plots.tagCandidates;
221 CandidatePlots& combinedCandidates = plots.combinedCandidates;
222
223 float betaTruth = (*ntuple.trackParticleBlock.truth.beta)[trkIndex];
224
225 // loop over hits
226 int bestTagCandidateIndex = -1;
227 float bestRes = FLT_MAX;
228 int bestCombinedCandidateIndex = -1;
229 float bestCombinedRes = FLT_MAX;
230 unsigned int ncandidates = 0;
231 unsigned int ncombinedCandidates = 0;
232 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
233
234 if( *it < 0 || *it >= (int)ntuple.candidateBlock.ntimes->size() ) {
235 MsgStream log(Athena::getMessageSvc(),"MuonInsideOutAnalysis");
236 if (log.level()<=MSG::WARNING) log << MSG::WARNING << "index out of range: " << (*it) << " max " << ntuple.candidateBlock.ntimes->size() << endmsg;
237 continue;
238 }
239 if( (*ntuple.candidateBlock.stage)[*it] != stage ) continue;
240 bool hasTrack = (*ntuple.candidateBlock.nprec)[*it] > 0;
241 float beta = (*ntuple.candidateBlock.beta)[*it];
242 float res = std::abs(beta-betaTruth);
243 ++ncandidates;
244
245 allCandidates.fill(ntuple.trackParticleBlock,trkIndex);
246 allCandidates.betaCandidates.fill( beta, betaTruth, (*ntuple.candidateBlock.chi2ndof)[*it], (*ntuple.candidateBlock.ntimes)[*it] );
247
248 if( hasTrack ){
249 if( res < bestCombinedRes ){
250 bestCombinedRes = res;
251 bestCombinedCandidateIndex = *it;
252 }
253 combinedCandidates.fill(ntuple.trackParticleBlock,trkIndex);
254 combinedCandidates.betaCandidates.fill( beta, betaTruth, (*ntuple.candidateBlock.chi2ndof)[*it], (*ntuple.candidateBlock.ntimes)[*it] );
255 ++ncombinedCandidates;
256 }else{
257 if( res < bestRes ){
258 bestRes = res;
259 bestTagCandidateIndex = *it;
260 }
261 tagCandidates.fill(ntuple.trackParticleBlock,trkIndex);
262 tagCandidates.betaCandidates.fill( beta, betaTruth, (*ntuple.candidateBlock.chi2ndof)[*it], (*ntuple.candidateBlock.ntimes)[*it] );
263 }
264
265 }
266 if( bestCombinedCandidateIndex != -1 ){
267 combinedCandidates.betaBestCandidate.fill( (*ntuple.candidateBlock.beta)[bestCombinedCandidateIndex], betaTruth,
268 (*ntuple.candidateBlock.chi2ndof)[bestCombinedCandidateIndex],
269 (*ntuple.candidateBlock.ntimes)[bestCombinedCandidateIndex] );
270 }
271 if( bestTagCandidateIndex != -1 ){
272 tagCandidates.betaBestCandidate.fill( (*ntuple.candidateBlock.beta)[bestTagCandidateIndex], betaTruth, (*ntuple.candidateBlock.chi2ndof)[bestTagCandidateIndex],
273 (*ntuple.candidateBlock.ntimes)[bestTagCandidateIndex] );
274 }
275 int bestCandidateIndex = bestCombinedCandidateIndex != -1 ? bestCombinedCandidateIndex : bestTagCandidateIndex;
276 if( bestCandidateIndex != -1 ){
277 allCandidates.betaBestCandidate.fill( (*ntuple.candidateBlock.beta)[bestCandidateIndex], betaTruth, (*ntuple.candidateBlock.chi2ndof)[bestCandidateIndex],
278 (*ntuple.candidateBlock.ntimes)[bestCandidateIndex] );
279 }
280 return std::make_pair(ncandidates,ncombinedCandidates);
281 }
std::pair< std::vector< unsigned int >, bool > res

◆ handleHits()

unsigned int Muon::MuonInsideOutAnalysis::handleHits ( MuonInsideOutValidationNtuple & ntuple,
unsigned int trkIndex,
const std::vector< int > & indexVec,
MuonInsideOutAnalysis::MatchingStrategy matchingStrategy,
HitPlots & plots )
private

Definition at line 327 of file MuonInsideOutAnalysis.cxx.

329 {
330
331 int barcode_trk = (*ntuple.trackParticleBlock.truth.barcode)[trkIndex];
332 float p = (*ntuple.trackParticleBlock.p)[trkIndex]*0.001;
333
334 // count the number of hits per layer and use that to get the number of 'truth' segments
335 std::map<int,int> countsPerLayer;
336
337 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
338
339 // select stagesame track, only same barcode for now
340 bool sameTrack = (*ntuple.hitBlock.truth.barcode)[*it] == barcode_trk;
341 if( !testStrategy(matchingStrategy,sameTrack) ) continue;
342 ++countsPerLayer[(*ntuple.hitBlock.id.chIndex)[*it]];
343 plots.fill( ntuple.hitBlock, *it, p );
344
345 }
346 // count layers, require at least 3 hits
347 unsigned int nlayers = 0;
348 for( std::map<int,int>::iterator it=countsPerLayer.begin();it!=countsPerLayer.end();++it ){
349 if( it->second>2 )++nlayers;
350 }
351 return nlayers;
352 }
bool testStrategy(MuonInsideOutAnalysis::MatchingStrategy matchingStrategy, bool sameTrack) const

◆ handleHough()

unsigned int Muon::MuonInsideOutAnalysis::handleHough ( MuonInsideOutValidationNtuple & ntuple,
unsigned int trkIndex,
const std::vector< int > & indexVec,
MuonInsideOutAnalysis::MatchingStrategy matchingStrategy,
HoughPlots & plots )
private

Definition at line 306 of file MuonInsideOutAnalysis.cxx.

308 {
309
310 unsigned int nhough = 0;
311 int barcode_trk = (*ntuple.trackParticleBlock.truth.barcode)[trkIndex];
312 float p = (*ntuple.trackParticleBlock.p)[trkIndex]*0.001;
313 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
314
315 // same track
316 bool sameTrack = (*ntuple.houghBlock.truth.barcode)[*it] == barcode_trk;
317 if( !testStrategy(matchingStrategy,sameTrack) ) continue;
318
319 plots.fill( ntuple.houghBlock, *it, p );
320
321 ++nhough;
322 }
323
324 return nhough;
325 }

◆ handleSegments()

unsigned int Muon::MuonInsideOutAnalysis::handleSegments ( MuonInsideOutValidationNtuple & ntuple,
unsigned int trkIndex,
const std::vector< int > & indexVec,
int stage,
MuonInsideOutAnalysis::MatchingStrategy matchingStrategy,
SegmentPlots & segmentPlots )
private

Definition at line 283 of file MuonInsideOutAnalysis.cxx.

286 {
287
288 unsigned int nseg = 0;
289 int barcode_trk = (*ntuple.trackParticleBlock.truth.barcode)[trkIndex];
290 float p = (*ntuple.trackParticleBlock.p)[trkIndex]*0.001;
291
292 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
293
294 bool sameTrack = (*ntuple.segmentBlock.truth.barcode)[*it] == barcode_trk;
295 // select stage + same track only same barcode for now
296 if( (*ntuple.segmentBlock.stage)[*it] != stage ) continue;
297 ++nseg;
298 if( !testStrategy(matchingStrategy,sameTrack) ) continue;
299
300 segmentPlots.fill( ntuple.segmentBlock, *it, p, (*ntuple.trackParticleBlock.truth.beta)[trkIndex] );
301
302 }
303 return nseg;
304 }

◆ handleTimes()

void Muon::MuonInsideOutAnalysis::handleTimes ( MuonInsideOutValidationNtuple & ntuple,
unsigned int trkIndex,
const std::vector< int > & indexVec,
MuonInsideOutAnalysis::MatchingStrategy matchingStrategy,
TrackPlots & trackPlots )
private

Definition at line 361 of file MuonInsideOutAnalysis.cxx.

363 {
364
365 //int barcode_trk = (*ntuple.trackParticleBlock.truth.barcode)[trkIndex];
366 //float p = (*ntuple.trackParticleBlock.p)[trkIndex]*0.001;
367 float eta = (*ntuple.trackParticleBlock.eta)[trkIndex];
368 bool isBarrel = std::abs(eta)<1.05;
369
370 // loop over hits
371 for( std::vector<int>::const_iterator it=indexVec.begin();it!=indexVec.end();++it ){
372
373 if( *it < 0 || *it >= (int)ntuple.timeBlock.type->size() ) {
374 MsgStream log(Athena::getMessageSvc(),"MuonInsideOutAnalysis");
375 if (log.level()<=MSG::WARNING) log << MSG::WARNING << "index out of range: " << (*it) << " max " << ntuple.timeBlock.type->size() << endmsg;
376 continue;
377 }
378
379 int type = (*ntuple.timeBlock.type)[*it];
380 // barrel endcap split
381 if( !isBarrel && (type == 1 || type == 10) ) type += 1000;
382
383 // check that we have the correct type
384 TimePlots* plots = trackPlots.getTimePlots(type);
385 if( !plots ) continue;
386 plots->fill( ntuple.timeBlock, *it, (*ntuple.trackParticleBlock.truth.beta)[trkIndex] );
387 }
388 }

◆ testStrategy()

bool Muon::MuonInsideOutAnalysis::testStrategy ( MuonInsideOutAnalysis::MatchingStrategy matchingStrategy,
bool sameTrack ) const
private

Definition at line 354 of file MuonInsideOutAnalysis.cxx.

354 {
355 if( matchingStrategy == SameTrack && !sameTrack ) return false;
356 if( matchingStrategy == NotSameTrack && sameTrack ) return false;
357 return true;
358 }

Member Data Documentation

◆ m_plots

MuonInsideOutAnalysisPlots Muon::MuonInsideOutAnalysis::m_plots
private

Definition at line 55 of file MuonInsideOutAnalysis.h.


The documentation for this class was generated from the following files: