Skip to content

Commit ee4d3c4

Browse files
authored
Merge pull request cms-sw#40754 from mmusich/SiStripHitResol_test_merge
Merge SiStrip Hit resolution code in cmssw
2 parents 3bb9f02 + 85356ec commit ee4d3c4

23 files changed

+4507
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<use name="CommonTools/Statistics"/>
2+
<use name="CommonTools/UtilAlgos"/>
3+
<use name="DataFormats/Common"/>
4+
<use name="DataFormats/DetId"/>
5+
<use name="DataFormats/SiStripDetId"/>
6+
<use name="DataFormats/TrackReco"/>
7+
<use name="DataFormats/TrackerRecHit2D"/>
8+
<use name="DataFormats/TrackingRecHit"/>
9+
<use name="FWCore/Framework"/>
10+
<use name="FWCore/MessageLogger"/>
11+
<use name="FWCore/ParameterSet"/>
12+
<use name="FWCore/PluginManager"/>
13+
<use name="Geometry/CommonDetUnit"/>
14+
<use name="Geometry/Records"/>
15+
<use name="Geometry/TrackerGeometryBuilder"/>
16+
<use name="MagneticField/Engine"/>
17+
<use name="MagneticField/Records"/>
18+
<use name="RecoLocalTracker/SiStripClusterizer"/>
19+
<use name="RecoTracker/MeasurementDet"/>
20+
<use name="RecoTracker/Record"/>
21+
<use name="RecoTracker/TkSeedGenerator"/>
22+
<use name="RecoTracker/TransientTrackingRecHit"/>
23+
<use name="SimDataFormats/TrackingAnalysis"/>
24+
<use name="SimTracker/TrackerHitAssociation"/>
25+
<use name="TrackingTools/AnalyticalJacobians"/>
26+
<use name="TrackingTools/KalmanUpdators"/>
27+
<use name="TrackingTools/MeasurementDet"/>
28+
<use name="TrackingTools/PatternTools"/>
29+
<use name="TrackingTools/TrackFitters"/>
30+
<use name="TrackingTools/TrajectoryState"/>
31+
<use name="root"/>
32+
<export>
33+
<lib name="1"/>
34+
</export>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Hit Resolution Project #
2+
3+
## Explanation for the pair method ##
4+
The hit resolution, $`\sigma_{hit}`$, (in centimetres) can be obtained by using the following equation:
5+
6+
$`\sigma_{hit} = \sqrt{\frac{\sigma^{2}_{HitDX-TrackDX} - \sigma^{2}_{TrackDXE}}{2}}`$,
7+
8+
where $`\sigma_{HitDX-TrackDX}`$ is the standard deviation of the gaussian-fitted distribution of the double difference between the predicted and measured hit positions, and $`\sigma_{TrackDXE}`$ is the mean of the distribution of the predicted positions.
9+
10+
The following criteria are used:
11+
12+
* The charged particle must have traversed through two sufficiently-overlapping detector modules.
13+
* Tracks must have transverse momenta greater than 3 GeV ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/src/HitResol.cc#L324)).
14+
* Track momentum is > 15 GeV for strips and > 5 GeV for pixels ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L243)).
15+
* More than six hits must be left in the SST layers and the pixel detector ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L252)).
16+
* No more than four of these hits can have a large cluster width ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L254)).
17+
* The track fit must yield a good $`\chi^{2}`$ probability of $`\chi^{2} \geqslant 10^{-2}`$ ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L251)).
18+
* The predicted path (the distance of propagation of the charged particle from one layer to the next) must be < 7cm in the TIB and TOB ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L238)).
19+
* The predicted path must be < 2cm for pixels([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L239)).
20+
* The error in the distance between two hit resolution measurements must be < 0.0025 ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L235)).
21+
* Clusters in the silicon module under consideration must have the same width ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L254)).
22+
* Clusters positioned on the edge of modules are not considered ([permalink](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/src/HitResol.cc#L346))
23+
24+
Hit resolution measurements are obtained for each tracker region; the definitions for each region are based on those given under the "Phase 1 Upgrade Detector DetId schema" heading of the README file in the github repository linked [here](https://github.com/cms-sw/cmssw/blob/master/Geometry/TrackerNumberingBuilder/README.md). The permalinks to where these definitions are implemented are as follows:
25+
26+
* [TIB L1](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L100)
27+
* [TIB L2](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L104)
28+
* [TIB L3](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L108)
29+
* [TIB L4](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L112)
30+
* [TID Side](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L117)
31+
* [TID Wheel](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L122)
32+
* [TID Ring](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L126)
33+
* [TOB L1](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L131)
34+
* [TOB L2](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L135)
35+
* [TOB L3](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L139)
36+
* [TOB L4](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L143)
37+
* [TOB L5](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L147)
38+
* [TOB L6](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L151)
39+
* [TEC Side](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L156)
40+
* [TEC Wheel](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L160)
41+
* [TEC Ring](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L163)
42+
* [All TIB](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L167)
43+
* [All TOB](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L171)
44+
* [All TID](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L175)
45+
* [All TEC](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L188)
46+
* [Pixel barrel](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L204)
47+
* [Pixel endcap disk](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L207)
48+
49+
## How to run the code ##
50+
The following scripts are used for the hit resolution study:
51+
* [src/HitResol.cc](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/src/HitResol.cc) (original author: Denis Gele)
52+
* [test/SiStripHitResol_testULcosmics.py](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/test/SiStripHitResol_testULcosmics.py) (original author: Pieter David)
53+
* [Resolutions.cc](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc) (original author: Kathryn Coldham)
54+
* [ResolutionPlots.cc](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc) (original author: Kathryn Coldham)
55+
56+
The scripts should be run inside CMSSW_11_1_0_pre6. Firstly, the following commands should be used:
57+
58+
* cd CMSSW_11_1_0_pre6/src
59+
* cmsenv
60+
* cd UserCode/SiStripHitResolution
61+
62+
Next, to specify between running over UL or non-UL samples, the integer [UL](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/test/SiStripHitResol_testULcosmics.py#L11) must be set as 0 (for non-UL) or 1 (for UL). Then, compile and run the python config file using the following commands:
63+
64+
* scram b
65+
* cmsRun test/SiStripHitResol_testULcosmics.py
66+
67+
This will produce an output root file, which will be called hitresol_ALCARECO_UL.root (for when ultra legacy samples have been used as input) or hitresol_ALCARECO.root (for ALCARECO, non-ultra legacy samples). This root file is then used as input to the macro Resolutions.cc, for which the following command should be used:
68+
69+
* root -l Resolutions.cc
70+
71+
This will produce three output directories: GaussianFits, HitResolutionValues and CutFlowReports.
72+
73+
* [GaussianFits](https://gitlab.cern.ch/coldham/hitresolutionproject/-/tree/master/CutFlowReports) will contain the root files GaussianFits_Centimetres.root or GaussianFits_PitchUnits.root.
74+
* [HitResolutionValues](https://gitlab.cern.ch/coldham/hitresolutionproject/-/tree/master/HitResolutionValues) will contain the text files HitResolutionValues_Centimetres.txt or HitResolutionValues_PitchUnits.txt.
75+
* [CutFlowReports](https://gitlab.cern.ch/coldham/hitresolutionproject/-/tree/master/CutFlowReports) will contain text files with the numbers of events that pass each filter, for each region.
76+
77+
To choose between pitch units or centimetres, [UnitInteger](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L330) must be set as 0 (for pitch units) or 1 (for centimetres). To choose between using output file names that correspond to the UL or non-UL ALCARECO samples, the value of [ULInteger](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resolutions.cc#L331) must be set as 0 (for non-UL samples) or 1 (for UL samples).
78+
79+
The plotting script [ResolutionPlots.cc](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc) has been provided for comparing the hit resolution values for UL and non-UL samples. However, the elements of the arrays will need to be edited ([UL_Array](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc#L20) for when the unit has been specified as centimetres, [NonUL_Array](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc#L25) for centimetres, [UL_Array](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc#L40) for pitch units and [NonUL_Array](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/ResolutionPlots.cc#L43) for pitch units). The following command should then be used:
80+
81+
* root -l ResolutionPlots.cc
82+
83+
This will produce two output files: ResolutionComparison_ULAndNonUL_Centimetres.pdf and ResolutionComparison_ULAndNonUL_Centimetres.root (for results in centimetres), and ResolutionComparison_ULAndNonUL_PitchUnits.pdf and ResolutionComparison_ULAndNonUL_PitchUnits.root (for results in pitch units).
84+
85+
86+
## References ##
87+
88+
* [Butz, E. (2017). Operation and Performance of the CMS Outer Tracker. The Compact Muon Solenoid Experiment Conference Report. 2017/428.](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resources/CR2017_428.pdf)
89+
* [Chiochia, V et al. (2005). Track reconstruction in the CMS tracker. CMS Analysis Note. CMS AN 2005/063.](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resources/AN2005_063_v2.pdf)
90+
* [Gelé, D. (2018). Status of SiStripHitResolution studies.](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resources/PresentationTracker_17072018.pdf)
91+
* [Ulmer, K. (2009). Tracker Hit Resolution Measurements in 2009 CRAFT Data.](https://gitlab.cern.ch/coldham/hitresolutionproject/-/blob/master/Resources/HitResLPCPhysics_10_15_09.ppt)
92+
* [McColl, N. (2013). RecHit Resolution Methods.](https://indico.cern.ch/event/305395/contributions/701396/attachments/580300/798934/nmccoll_3_13_RecHitRes.pdf)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
/*!
3+
4+
\page CalibTracker_SiStripHitResolution Package CalibTracker/SiStripHitResolution
5+
6+
<center>
7+
<small>
8+
9+
<!-- @CVS_TAG@ will be substituted at build time, no need to touch -->
10+
<a href=http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/CalibTracker/SiStripHitResolution/?cvsroot=CMSSW&only_with_tag=@CVS_TAG@>Source code (CVS tag: @CVS_TAG@)</a> -
11+
<a href=http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/CalibTracker/SiStripHitResolution/.admin/developers?rev=HEAD&cvsroot=CMSSW&content-type=text/vnd.viewcvs-markup>Administrative privileges</a>
12+
</small>
13+
</center>
14+
15+
\section desc Description
16+
<!-- Short description of what this package is supposed to provide -->
17+
18+
(THE PACKAGE ADMINISTATOR SHOULD REPLACE THIS SENTENCE WITH HAND-WRITTEN DOCUMENTATION SAYING WHAT THE PACKAGE DOES.)
19+
20+
\subsection interface Public interface
21+
<!-- List the classes that are provided for use in other packages (if any) -->
22+
23+
- HitResol
24+
- TrajectoryAtInvalidHit
25+
26+
27+
\subsection pluginai Plugins
28+
<!-- List the plugins that are provided for use in other packages (if any) -->
29+
30+
31+
32+
33+
\subsection modules Modules
34+
<!-- Describe modules implemented in this package and their parameter set -->
35+
36+
- HitResol
37+
38+
\subsection tests Unit tests and examples
39+
<!-- Describe cppunit tests and example configuration files -->
40+
Unknown
41+
42+
\section status Status and planned development
43+
<!-- e.g. completed, stable, missing features -->
44+
Unknown
45+
46+
<hr>
47+
Last updated:
48+
@DATE@ Author: computer-generated.
49+
*/
50+
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
#ifndef CalibTracker_SiStripHitResolution_HitResol_H
2+
#define CalibTracker_SiStripHitResolution_HitResol_H
3+
4+
// system includes
5+
#include <vector>
6+
7+
// user includes
8+
#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
9+
#include "CalibTracker/Records/interface/SiStripQualityRcd.h"
10+
#include "DataFormats/Common/interface/Handle.h"
11+
#include "DataFormats/Scalers/interface/LumiScalers.h"
12+
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
13+
#include "FWCore/Framework/interface/Event.h"
14+
#include "FWCore/Framework/interface/EventSetup.h"
15+
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
16+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
17+
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
18+
#include "MagneticField/Engine/interface/MagneticField.h"
19+
#include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
20+
#include "RecoTracker/Record/interface/CkfComponentsRecord.h"
21+
#include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
22+
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
23+
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
24+
25+
// ROOT includes
26+
#include "TTree.h"
27+
#include "TROOT.h"
28+
#include "TH1F.h"
29+
#include "TH2F.h"
30+
31+
class TrackerTopology;
32+
33+
class HitResol : public edm::one::EDAnalyzer<edm::one::SharedResources> {
34+
public:
35+
explicit HitResol(const edm::ParameterSet& conf);
36+
~HitResol() override = default;
37+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
38+
double checkConsistency(const StripClusterParameterEstimator::LocalValues& parameters, double xx, double xerr);
39+
void getSimHitRes(const GeomDetUnit* det,
40+
const LocalVector& trackdirection,
41+
const TrackingRecHit& recHit,
42+
float& trackWidth,
43+
float* pitch,
44+
LocalVector& drift);
45+
double getSimpleRes(const TrajectoryMeasurement* traj1);
46+
bool getPairParameters(const MagneticField* magField_,
47+
AnalyticalPropagator& propagator,
48+
const TrajectoryMeasurement* traj1,
49+
const TrajectoryMeasurement* traj2,
50+
float& pairPath,
51+
float& hitDX,
52+
float& trackDX,
53+
float& trackDXE,
54+
float& trackParamX,
55+
float& trackParamY,
56+
float& trackParamDXDZ,
57+
float& trackParamDYDZ,
58+
float& trackParamXE,
59+
float& trackParamYE,
60+
float& trackParamDXDZE,
61+
float& trackParamDYDZE);
62+
typedef std::vector<Trajectory> TrajectoryCollection;
63+
64+
private:
65+
void beginJob() override;
66+
void endJob() override;
67+
void analyze(const edm::Event& e, const edm::EventSetup& c) override;
68+
69+
// ----------member data ---------------------------
70+
71+
// ED tokens
72+
const edm::EDGetTokenT<LumiScalersCollection> scalerToken_;
73+
const edm::EDGetTokenT<reco::TrackCollection> combinatorialTracks_token_;
74+
const edm::EDGetTokenT<std::vector<Trajectory> > tjToken_;
75+
const edm::EDGetTokenT<reco::TrackCollection> tkToken_;
76+
77+
// ES tokens
78+
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
79+
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
80+
const edm::ESGetToken<StripClusterParameterEstimator, TkStripCPERecord> cpeToken_;
81+
const edm::ESGetToken<SiStripQuality, SiStripQualityRcd> siStripQualityToken_;
82+
const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magFieldToken_;
83+
84+
// configuration parameters
85+
const bool addLumi_;
86+
const bool DEBUG_;
87+
const bool cutOnTracks_;
88+
const double momentumCut_;
89+
const int compSettings_;
90+
const unsigned int usePairsOnly_;
91+
const unsigned int layers_;
92+
const unsigned int trackMultiplicityCut_;
93+
94+
// output file
95+
TTree* reso;
96+
TTree* treso;
97+
std::map<TString, TH2F*> histos2d_;
98+
99+
// conversion
100+
static constexpr float cmToUm = 10000.f;
101+
102+
// counters
103+
int events, EventTrackCKF;
104+
105+
// Tree declarations
106+
// Hit Resolution Ntuple Content
107+
float mymom;
108+
int numHits;
109+
int NumberOf_tracks;
110+
float ProbTrackChi2;
111+
float StripCPE1_smp_pos_error;
112+
float StripCPE2_smp_pos_error;
113+
float StripErrorSquared1;
114+
float StripErrorSquared2;
115+
float uerr2;
116+
float uerr2_2;
117+
unsigned int clusterWidth;
118+
unsigned int clusterWidth_2;
119+
unsigned int clusterCharge;
120+
unsigned int clusterCharge_2;
121+
unsigned int iidd1;
122+
unsigned int iidd2;
123+
unsigned int pairsOnly;
124+
float pairPath;
125+
float mypitch1;
126+
float mypitch2;
127+
float expWidth;
128+
float expWidth_2;
129+
float driftAlpha;
130+
float driftAlpha_2;
131+
float thickness;
132+
float thickness_2;
133+
float trackWidth;
134+
float trackWidth_2;
135+
float atEdge;
136+
float atEdge_2;
137+
float simpleRes;
138+
float hitDX;
139+
float trackDX;
140+
float trackDXE;
141+
float trackParamX;
142+
float trackParamY;
143+
float trackParamXE;
144+
float trackParamYE;
145+
float trackParamDXDZ;
146+
float trackParamDYDZ;
147+
float trackParamDXDZE;
148+
float trackParamDYDZE;
149+
float track_momentum;
150+
float track_pt;
151+
float track_eta;
152+
float track_width;
153+
float track_phi;
154+
float track_trackChi2;
155+
float N1;
156+
float N2;
157+
float N1uProj;
158+
float N2uProj;
159+
int Nstrips;
160+
int Nstrips_2;
161+
};
162+
163+
#endif

0 commit comments

Comments
 (0)