24 {
25
26
27 Muon::MuonInsideOutValidationNtuple ntuple;
29
30
34 for (Long64_t jentry=0; jentry<
nentries;jentry++) {
35
36
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;
46 }
47 }
48
49
50
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;
60
61 TrackMap track_hough_map;
63
64 TrackMap track_hit_map;
66
67 TrackMap track_time_map;
69
70 TrackMap track_candidate_map;
72
73
74
75 TrackPlots* trackPlots = nullptr;
77
78
82
83
84
85
86
87 for( int ii=0;ii<3;++ii ){
89
90
94 else continue;
98 else continue;
99 }else{
100
101 if( matchingStrategy ==
All ) trackPlots = &
m_plots.rest;
102 else continue;
103 }
104
105
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
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
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
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
135 pos = track_time_map.find(i);
136 if( pos != track_time_map.end() ) {
138 }
139
140
141
142 if( matchingStrategy ==
SameTrack || matchingStrategy ==
All ) {
144 trackPlots->fill(ntruth,nseg,nseg1,nseg2,nseg3,nhough);
145
146 pos = track_candidate_map.find(i);
147
148
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 ) {
155 plots.etaBetaMissed->Fill(
eta,betaTruth);
156 plots.betaMissed->Fill(betaTruth);
157 }
158 if( candidateCounts.second == 0 ) {
160 plots.betaMissedCombined->Fill(betaTruth);
161 }
162 plots.ncandidates->Fill(candidateCounts.first);
163 plots.ncombinedCandidates->Fill(candidateCounts.second);
164
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
174 for( unsigned int co=0;co<2;++co ){
175
178 if( betaFitResult.status != 0 ) betaRegionPlots.mdt.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
180
183 if( betaFitResult.status != 0 ) betaRegionPlots.rpc.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
184
187 if( betaFitResult.status != 0 ) betaRegionPlots.rpct.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
188
191 if( betaFitResult.status != 0 ) betaRegionPlots.all.fill( betaFitResult.beta, betaTruth, betaFitResult.chi2, betaFitResult.ndof );
192
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
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
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
MuonValidationHoughBlock houghBlock
MuonValidationTimeBlock timeBlock
MuonValidationSegmentBlock segmentBlock
MuonValidationCandidateBlock candidateBlock
MuonValidationHitBlock hitBlock
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)
MuonValidationTrackBlock track
MuonValidationTrackBlock track
MuonValidationTrackBlock track
std::vector< int > * quality
MuonValidationTrackBlock track
MuonValidationTrackBlock track
std::vector< int > * trkid
std::vector< float > * eta
std::vector< float > * pt
MuonValidationTruthBlock truth
std::vector< float > * beta