86 #include "HepPDT/ParticleID.hh" 94 #include <unordered_set> 95 #include <unordered_map> 116 default:
return "UNKNOWN TRACKER HIT TYPE";
120 struct ProductIDSetPrinter {
121 ProductIDSetPrinter(
const std::set<edm::ProductID>&
set): set_(set) {}
123 void print(std::ostream& os)
const {
124 for(
const auto& item: set_) {
129 const std::set<edm::ProductID>& set_;
131 std::ostream&
operator<<(std::ostream& os,
const ProductIDSetPrinter&
o) {
135 template <
typename T>
136 struct ProductIDMapPrinter {
137 ProductIDMapPrinter(
const std::map<edm::ProductID, T>&
map):
map_(map) {}
139 void print(std::ostream& os)
const {
140 for(
const auto& item:
map_) {
141 os << item.first <<
" ";
145 const std::map<edm::ProductID, T>&
map_;
147 template <
typename T>
148 auto make_ProductIDMapPrinter(
const std::map<edm::ProductID, T>&
map) {
149 return ProductIDMapPrinter<T>(
map);
151 template <
typename T>
152 std::ostream& operator<<(std::ostream& os, const ProductIDMapPrinter<T>&
o) {
157 template <
typename T>
158 struct VectorPrinter {
159 VectorPrinter(
const std::vector<T>& vec): vec_(vec) {}
161 void print(std::ostream& os)
const {
162 for(
const auto& item: vec_) {
167 const std::vector<T>& vec_;
169 template <
typename T>
170 auto make_VectorPrinter(
const std::vector<T>& vec) {
171 return VectorPrinter<T>(vec);
173 template <
typename T>
174 std::ostream& operator<<(std::ostream& os, const VectorPrinter<T>&
o) {
179 void checkProductID(
const std::set<edm::ProductID>&
set,
const edm::ProductID&
id,
const char *
name) {
181 throw cms::Exception(
"Configuration") <<
"Got " << name <<
" with a hit with ProductID " <<
id 182 <<
" which does not match to the set of ProductID's for the hits: " 183 << ProductIDSetPrinter(
set)
184 <<
". Usually this is caused by a wrong hit collection in the configuration.";
187 template <
typename SimLink,
typename Func>
189 for(
const auto& link: digiSimLinks) {
190 if(link.channel() == channel) {
198 template <
typename ...Args>
void call_nop(Args&&...
args) {}
200 template <
typename ...Types>
208 return std::get<0>(content_)[i];
211 template <
typename ...Args>
212 void book(Args&&...
args) {
213 impl([&](
auto& vec) { vec.book(std::forward<Args>(
args)...); });
216 template <
typename ...Args>
217 void push_back(Args&&...
args) {
218 impl([&](
auto& vec) { vec.push_back(std::forward<Args>(
args)...); });
221 template <
typename ...Args>
222 void resize(Args&&...
args) {
223 impl([&](
auto& vec) { vec.resize(std::forward<Args>(
args)...); });
226 template <
typename ...Args>
227 void set(Args&&...
args) {
228 impl([&](
auto& vec) { vec.set(std::forward<Args>(
args)...); });
232 impl([&](
auto& vec) { vec.clear(); });
237 template <
typename F>
238 void impl(
F&& func) {
239 impl2(std::index_sequence_for<Types...>{}, std::forward<F>(
func));
247 template <std::size_t ...Is,
typename F>
248 void impl2(std::index_sequence<Is...>,
F&& func) {
249 call_nop( (
func(std::get<Is>(content_)) , 0)...);
252 std::tuple<
Types...> content_;
256 std::map<unsigned int, double> chargeFraction(
const SiPixelCluster& cluster,
const DetId& detId,
258 std::map<unsigned int, double> simTrackIdToAdc;
260 auto idetset = digiSimLink.
find(detId);
261 if(idetset == digiSimLink.
end())
262 return simTrackIdToAdc;
266 for(
int iPix=0; iPix != cluster.
size(); ++iPix) {
270 forEachMatchedSimLink(*idetset, channel, [&](
const PixelDigiSimLink& simLink){
276 for(
auto& pair: simTrackIdToAdc) {
280 pair.second /= adcSum;
283 return simTrackIdToAdc;
286 std::map<unsigned int, double> chargeFraction(
const SiStripCluster& cluster,
const DetId& detId,
288 std::map<unsigned int, double> simTrackIdToAdc;
290 auto idetset = digiSimLink.
find(detId);
291 if(idetset == digiSimLink.
end())
292 return simTrackIdToAdc;
300 double& adc = simTrackIdToAdc[simLink.
SimTrackId()];
304 for(
const auto& pair: simTrackIdToAdc) {
305 simTrackIdToAdc[pair.first] = (adcSum != 0. ? pair.second/adcSum : 0.);
309 return simTrackIdToAdc;
315 std::map<unsigned int, double> simTrackIdToAdc;
316 throw cms::Exception(
"LogicError") <<
"Not possible to use StripDigiSimLink with Phase2TrackerCluster1D! ";
317 return simTrackIdToAdc;
324 std::map<unsigned int, double> simTrackIdToAdc;
325 return simTrackIdToAdc;
345 void clearVariables();
400 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
405 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
406 std::set<edm::ProductID>& hitProductIds
409 void fillStripRphiStereoHits(
const edm::Event& iEvent,
411 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
416 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
417 std::set<edm::ProductID>& hitProductIds
420 void fillStripMatchedHits(
const edm::Event& iEvent,
423 std::vector<std::pair<int, int> >& monoStereoClusterList
426 void fillPhase2OTHits(
const edm::Event& iEvent,
428 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
433 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
434 std::set<edm::ProductID>& hitProductIds
439 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
444 const std::vector<std::pair<int, int> >& monoStereoClusterList,
445 const std::set<edm::ProductID>& hitProductIds,
446 std::map<edm::ProductID, size_t>& seedToCollIndex
451 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
457 const std::set<edm::ProductID>& hitProductIds,
458 const std::map<edm::ProductID, size_t>& seedToCollIndex,
459 const std::vector<const MVACollection *>& mvaColls,
460 const std::vector<const QualityMaskCollection *>& qualColls
464 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
467 SimHitRefKeyToIndex& simHitRefKeyToIndex,
468 std::vector<TPHitIndex>& tpHitList);
474 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
476 const std::vector<TPHitIndex>& tpHitList
481 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
482 const unsigned int seedOffset
489 const TrackingParticleRefKeyToIndex& tpKeyToIndex
502 template <
typename SimLink>
504 DetId hitId,
int clusterKey,
507 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
510 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
515 std::vector<edm::EDGetTokenT<edm::View<reco::Track> > >
seedTokens_;
551 #define BOOK(name) tree->Branch((prefix+"_"+#name).c_str(), &name); 569 detId .push_back(
id.rawId() );
570 subdet.push_back(
id.subdetId() );
571 layer .push_back(tTopo.
layer(
id) );
574 unsigned short s = 0;
575 switch(
id.subdetId()) {
598 subdet[
index] =
id.subdetId();
599 layer [
index] = tTopo.layer(
id);
600 side [
index] = tTopo.side(
id);
616 std::vector<unsigned short>
side;
633 blade .push_back( isBarrel ? 0 : tTopo.
pxfBlade(
id) );
634 panel .push_back( isBarrel ? 0 : tTopo.
pxfPanel(
id) );
660 const auto parsed =
parse(tTopo,
id);
661 order .push_back(parsed.order );
662 ring .push_back(parsed.ring );
663 rod .push_back(parsed.rod );
673 const auto parsed =
parse(tTopo,
id);
674 order [
index] = parsed.order ;
676 rod [
index] = parsed.rod ;
689 unsigned int order = 0;
691 unsigned int rod = 0;
694 switch(
id.subdetId()) {
709 std::vector<unsigned short>
ring;
710 std::vector<unsigned short>
rod;
726 const auto parsed =
parse(tTopo,
id);
727 string .push_back(parsed.string );
728 petalNumber.push_back(parsed.petalNumber);
729 isStereo .push_back(tTopo.
isStereo(
id));
730 isRPhi .push_back(tTopo.
isRPhi(
id));
731 isGlued .push_back(parsed.glued);
735 string .resize(size);
736 petalNumber.resize(size);
737 isStereo .resize(size);
738 isRPhi .resize(size);
739 isGlued .resize(size);
743 const auto parsed =
parse(tTopo,
id);
744 string [
index] = parsed.string ;
745 petalNumber[
index] = parsed.petalNumber;
746 isStereo [
index] = tTopo.isStereo(
id);
747 isRPhi [
index] = tTopo.isRPhi(
id);
748 isGlued [
index] = parsed.glued;
763 unsigned int string = 0;
764 unsigned int petalNumber = 0;
768 switch(
id.subdetId()) {
800 isLower.push_back(tTopo.
isLower(
id));
801 isUpper.push_back(tTopo.
isUpper(
id));
802 isStack.push_back(tTopo.
stack(
id) == 0);
818 using DetIdPixel = CombineDetId<DetIdCommon, DetIdPixelOnly>;
819 using DetIdStrip = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdStripOnly>;
820 using DetIdPhase2OT = CombineDetId<DetIdCommon, DetIdOTCommon, DetIdPhase2OTOnly>;
821 using DetIdAll = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly>;
822 using DetIdAllPhase2 = CombineDetId<DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdPhase2OTOnly>;
1115 trackToken_(consumes<
edm::
View<
reco::Track> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"tracks"))),
1116 clusterTPMapToken_(consumes<
ClusterTPAssociation>(iConfig.getUntrackedParameter<
edm::InputTag>(
"clusterTPMap"))),
1119 pixelSimLinkToken_(consumes<
edm::DetSetVector<
PixelDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"pixelDigiSimLink"))),
1120 stripSimLinkToken_(consumes<
edm::DetSetVector<
StripDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"stripDigiSimLink"))),
1121 siphase2OTSimLinksToken_(consumes<
edm::DetSetVector<
PixelDigiSimLink> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"phase2OTSimLink"))),
1122 includeStripHits_(iConfig.getUntrackedParameter<
edm::InputTag>(
"stripDigiSimLink").
label() !=
""),
1123 includePhase2OTHits_(iConfig.getUntrackedParameter<
edm::InputTag>(
"phase2OTSimLink").
label() !=
""),
1124 beamSpotToken_(consumes<
reco::
BeamSpot>(iConfig.getUntrackedParameter<
edm::InputTag>(
"beamSpot"))),
1132 tpNLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNlayers"))),
1133 tpNPixelLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNpixellayers"))),
1134 tpNStripStereoLayersToken_(consumes<
edm::ValueMap<unsigned
int> >(iConfig.getUntrackedParameter<
edm::InputTag>(
"trackingParticleNstripstereolayers"))),
1135 builderName_(iConfig.getUntrackedParameter<
std::
string>(
"TTRHBuilder")),
1136 parametersDefinerName_(iConfig.getUntrackedParameter<
std::
string>(
"parametersDefiner")),
1137 includeSeeds_(iConfig.getUntrackedParameter<
bool>(
"includeSeeds")),
1138 includeAllHits_(iConfig.getUntrackedParameter<
bool>(
"includeAllHits")),
1139 includeMVA_(iConfig.getUntrackedParameter<
bool>(
"includeMVA")),
1140 includeTrackingParticles_(iConfig.getUntrackedParameter<
bool>(
"includeTrackingParticles"))
1144 return consumes<edm::View<reco::Track> >(tag);
1147 return consumes<std::vector<SeedStopInfo> >(tag);
1149 if(seedTokens_.size() != seedStopInfoTokens_.size()) {
1150 throw cms::Exception(
"Configuration") <<
"Got " << seedTokens_.size() <<
" seed collections, but " << seedStopInfoTokens_.size() <<
" track candidate collections";
1154 if(includeAllHits_) {
1155 if(includeStripHits_ && includePhase2OTHits_) {
1156 throw cms::Exception(
"Configuration") <<
"Both stripDigiSimLink and phase2OTSimLink are set, please set only either one (this information is used to infer if you're running phase0/1 or phase2 detector)";
1158 if(!includeStripHits_ && !includePhase2OTHits_) {
1159 throw cms::Exception(
"Configuration") <<
"Neither stripDigiSimLink or phase2OTSimLink are set, please set either one.";
1166 trackingParticleRefToken_ = consumes<TrackingParticleRefVector>(
tpTag);
1169 trackingParticleToken_ = consumes<TrackingParticleCollection>(
tpTag);
1177 return std::make_tuple(consumes<MVACollection>(edm::InputTag(tag,
"MVAValues")),
1178 consumes<QualityMaskCollection>(edm::InputTag(tag,
"QualityMasks")));
1184 t = fs->
make<TTree>(
"tree",
"tree");
1186 t->Branch(
"event" , &ev_event);
1187 t->Branch(
"lumi" , &ev_lumi);
1188 t->Branch(
"run" , &ev_run);
1191 t->Branch(
"trk_px" , &trk_px);
1192 t->Branch(
"trk_py" , &trk_py);
1193 t->Branch(
"trk_pz" , &trk_pz);
1194 t->Branch(
"trk_pt" , &trk_pt);
1195 t->Branch(
"trk_inner_px" , &trk_inner_px);
1196 t->Branch(
"trk_inner_py" , &trk_inner_py);
1197 t->Branch(
"trk_inner_pz" , &trk_inner_pz);
1198 t->Branch(
"trk_inner_pt" , &trk_inner_pt);
1199 t->Branch(
"trk_outer_px" , &trk_outer_px);
1200 t->Branch(
"trk_outer_py" , &trk_outer_py);
1201 t->Branch(
"trk_outer_pz" , &trk_outer_pz);
1202 t->Branch(
"trk_outer_pt" , &trk_outer_pt);
1203 t->Branch(
"trk_eta" , &trk_eta);
1204 t->Branch(
"trk_lambda" , &trk_lambda);
1205 t->Branch(
"trk_cotTheta" , &trk_cotTheta);
1206 t->Branch(
"trk_phi" , &trk_phi);
1207 t->Branch(
"trk_dxy" , &trk_dxy );
1208 t->Branch(
"trk_dz" , &trk_dz );
1209 t->Branch(
"trk_dxyPV" , &trk_dxyPV );
1210 t->Branch(
"trk_dzPV" , &trk_dzPV );
1211 t->Branch(
"trk_dxyClosestPV", &trk_dxyClosestPV );
1212 t->Branch(
"trk_dzClosestPV", &trk_dzClosestPV );
1213 t->Branch(
"trk_ptErr" , &trk_ptErr );
1214 t->Branch(
"trk_etaErr" , &trk_etaErr );
1215 t->Branch(
"trk_lambdaErr", &trk_lambdaErr);
1216 t->Branch(
"trk_phiErr" , &trk_phiErr );
1217 t->Branch(
"trk_dxyErr" , &trk_dxyErr );
1218 t->Branch(
"trk_dzErr" , &trk_dzErr );
1219 t->Branch(
"trk_refpoint_x", &trk_refpoint_x);
1220 t->Branch(
"trk_refpoint_y", &trk_refpoint_y);
1221 t->Branch(
"trk_refpoint_z", &trk_refpoint_z);
1222 t->Branch(
"trk_nChi2" , &trk_nChi2);
1223 t->Branch(
"trk_nChi2_1Dmod", &trk_nChi2_1Dmod);
1224 t->Branch(
"trk_ndof" , &trk_ndof);
1226 trk_mvas.resize(mvaQualityCollectionTokens_.size());
1227 trk_qualityMasks.resize(mvaQualityCollectionTokens_.size());
1228 if(!trk_mvas.empty()) {
1229 t->Branch(
"trk_mva" , &(trk_mvas[0]));
1230 t->Branch(
"trk_qualityMask", &(trk_qualityMasks[0]));
1231 for(
size_t i=1;
i<trk_mvas.size(); ++
i) {
1232 t->Branch((
"trk_mva"+std::to_string(
i+1)).c_str(), &(trk_mvas[
i]));
1233 t->Branch((
"trk_qualityMask"+std::to_string(i+1)).c_str(), &(trk_qualityMasks[i]));
1237 t->Branch(
"trk_q" , &trk_q);
1238 t->Branch(
"trk_nValid" , &trk_nValid );
1239 t->Branch(
"trk_nInvalid" , &trk_nInvalid);
1240 t->Branch(
"trk_nPixel" , &trk_nPixel );
1241 t->Branch(
"trk_nStrip" , &trk_nStrip );
1242 t->Branch(
"trk_nOuterLost", &trk_nOuterLost );
1243 t->Branch(
"trk_nInnerLost", &trk_nInnerLost );
1244 t->Branch(
"trk_nPixelLay", &trk_nPixelLay);
1245 t->Branch(
"trk_nStripLay", &trk_nStripLay);
1246 t->Branch(
"trk_n3DLay" , &trk_n3DLay );
1247 t->Branch(
"trk_nLostLay" , &trk_nLostLay );
1248 t->Branch(
"trk_algo" , &trk_algo );
1249 t->Branch(
"trk_originalAlgo", &trk_originalAlgo);
1252 t->Branch(
"trk_isHP" , &
trk_isHP );
1257 if(includeTrackingParticles_) {
1264 if(includeAllHits_) {
1268 if(includeTrackingParticles_) {
1275 t->Branch(
"sim_px" , &
sim_px );
1276 t->Branch(
"sim_py" , &
sim_py );
1277 t->Branch(
"sim_pz" , &
sim_pz );
1278 t->Branch(
"sim_pt" , &
sim_pt );
1279 t->Branch(
"sim_eta" , &
sim_eta );
1280 t->Branch(
"sim_phi" , &
sim_phi );
1288 t->Branch(
"sim_q" , &
sim_q );
1292 t->Branch(
"sim_nLay" , &
sim_nLay );
1302 if(includeAllHits_) {
1306 if(includeAllHits_) {
1317 t->Branch(
"pix_x" , &
pix_x );
1318 t->Branch(
"pix_y" , &
pix_y );
1319 t->Branch(
"pix_z" , &
pix_z );
1320 t->Branch(
"pix_xx" , &
pix_xx );
1321 t->Branch(
"pix_xy" , &
pix_xy );
1322 t->Branch(
"pix_yy" , &
pix_yy );
1323 t->Branch(
"pix_yz" , &
pix_yz );
1324 t->Branch(
"pix_zz" , &
pix_zz );
1325 t->Branch(
"pix_zx" , &
pix_zx );
1326 t->Branch(
"pix_radL" , &
pix_radL );
1327 t->Branch(
"pix_bbxi" , &
pix_bbxi );
1328 t->Branch(
"pix_bbxi" , &
pix_bbxi );
1330 if(includeStripHits_){
1340 t->Branch(
"str_x" , &
str_x );
1341 t->Branch(
"str_y" , &
str_y );
1342 t->Branch(
"str_z" , &
str_z );
1343 t->Branch(
"str_xx" , &
str_xx );
1344 t->Branch(
"str_xy" , &
str_xy );
1345 t->Branch(
"str_yy" , &
str_yy );
1346 t->Branch(
"str_yz" , &
str_yz );
1347 t->Branch(
"str_zz" , &
str_zz );
1348 t->Branch(
"str_zx" , &
str_zx );
1349 t->Branch(
"str_radL" , &
str_radL );
1350 t->Branch(
"str_bbxi" , &
str_bbxi );
1359 t->Branch(
"glu_x" , &
glu_x );
1360 t->Branch(
"glu_y" , &
glu_y );
1361 t->Branch(
"glu_z" , &
glu_z );
1362 t->Branch(
"glu_xx" , &
glu_xx );
1363 t->Branch(
"glu_xy" , &
glu_xy );
1364 t->Branch(
"glu_yy" , &
glu_yy );
1365 t->Branch(
"glu_yz" , &
glu_yz );
1366 t->Branch(
"glu_zz" , &
glu_zz );
1367 t->Branch(
"glu_zx" , &
glu_zx );
1368 t->Branch(
"glu_radL" , &
glu_radL );
1369 t->Branch(
"glu_bbxi" , &
glu_bbxi );
1372 if(includePhase2OTHits_){
1381 t->Branch(
"ph2_x" , &
ph2_x );
1382 t->Branch(
"ph2_y" , &
ph2_y );
1383 t->Branch(
"ph2_z" , &
ph2_z );
1384 t->Branch(
"ph2_xx" , &
ph2_xx );
1385 t->Branch(
"ph2_xy" , &
ph2_xy );
1386 t->Branch(
"ph2_yy" , &
ph2_yy );
1387 t->Branch(
"ph2_yz" , &
ph2_yz );
1388 t->Branch(
"ph2_zz" , &
ph2_zz );
1389 t->Branch(
"ph2_zx" , &
ph2_zx );
1390 t->Branch(
"ph2_radL" , &
ph2_radL );
1391 t->Branch(
"ph2_bbxi" , &
ph2_bbxi );
1392 t->Branch(
"ph2_bbxi" , &
ph2_bbxi );
1396 if(includeStripHits_)
inv_detId.book(
"inv", t);
1398 t->Branch(
"inv_type" , &
inv_type );
1415 t->Branch(
"bsp_x" , &
bsp_x ,
"bsp_x/F");
1416 t->Branch(
"bsp_y" , &
bsp_y ,
"bsp_y/F");
1417 t->Branch(
"bsp_z" , &
bsp_z ,
"bsp_z/F");
1418 t->Branch(
"bsp_sigmax" , &
bsp_sigmax ,
"bsp_sigmax/F");
1419 t->Branch(
"bsp_sigmay" , &
bsp_sigmay ,
"bsp_sigmay/F");
1420 t->Branch(
"bsp_sigmaz" , &
bsp_sigmaz ,
"bsp_sigmaz/F");
1424 t->Branch(
"see_px" , &
see_px );
1425 t->Branch(
"see_py" , &
see_py );
1426 t->Branch(
"see_pz" , &
see_pz );
1427 t->Branch(
"see_pt" , &
see_pt );
1428 t->Branch(
"see_eta" , &
see_eta );
1429 t->Branch(
"see_phi" , &
see_phi );
1430 t->Branch(
"see_dxy" , &
see_dxy );
1431 t->Branch(
"see_dz" , &
see_dz );
1437 t->Branch(
"see_chi2" , &
see_chi2 );
1444 t->Branch(
"see_q" , &
see_q );
1450 t->Branch(
"see_algo" , &
see_algo );
1454 if(includeTrackingParticles_) {
1461 if(includeAllHits_) {
1470 t->Branch(
"vtx_x" , &
vtx_x);
1471 t->Branch(
"vtx_y" , &
vtx_y);
1472 t->Branch(
"vtx_z" , &
vtx_z);
1518 trk_inner_px .clear();
1519 trk_inner_py .clear();
1520 trk_inner_pz .clear();
1521 trk_inner_pt .clear();
1522 trk_outer_px .clear();
1523 trk_outer_py .clear();
1524 trk_outer_pz .clear();
1525 trk_outer_pt .clear();
1527 trk_lambda .clear();
1528 trk_cotTheta .clear();
1534 trk_dxyClosestPV.clear();
1535 trk_dzClosestPV.clear();
1537 trk_etaErr .clear();
1538 trk_lambdaErr.clear();
1539 trk_phiErr .clear();
1540 trk_dxyErr .clear();
1542 trk_refpoint_x.clear();
1543 trk_refpoint_y.clear();
1544 trk_refpoint_z.clear();
1546 trk_nChi2_1Dmod.clear();
1548 for(
auto&
mva: trk_mvas) {
1551 for(
auto&
mask: trk_qualityMasks) {
1555 trk_nValid .clear();
1556 trk_nInvalid .clear();
1557 trk_nPixel .clear();
1558 trk_nStrip .clear();
1559 trk_nOuterLost.clear();
1560 trk_nInnerLost.clear();
1561 trk_nPixelLay.clear();
1562 trk_nStripLay.clear();
1563 trk_n3DLay .clear();
1564 trk_nLostLay .clear();
1566 trk_originalAlgo.clear();
1740 if(includeTrackingParticles_) {
1777 using namespace edm;
1778 using namespace reco;
1779 using namespace std;
1796 iEvent.
getByToken(trackAssociatorToken_, theAssociator);
1799 LogDebug(
"TrackingNtuple") <<
"Analyzing new event";
1808 TrackingParticleRefKeySet tmpTPkeys;
1814 iEvent.
getByToken(trackingParticleToken_, TPCollectionH);
1815 for(
size_t i=0,
size=TPCollectionH->size();
i<
size; ++
i) {
1821 iEvent.
getByToken(trackingParticleRefToken_, TPCollectionHRefVector);
1822 tmpTPptr = TPCollectionHRefVector.
product();
1823 for(
const auto& ref: *tmpTPptr) {
1824 tmpTPkeys.insert(ref.key());
1830 TrackingParticleRefKeyToIndex tpKeyToIndex;
1831 for(
size_t i=0;
i<tpCollection.
size(); ++
i) {
1832 tpKeyToIndex[tpCollection[
i].key()] =
i;
1837 iEvent.
getByToken(trackingVertexToken_, htv);
1842 TrackingVertexRefKeyToIndex tvKeyToIndex;
1843 for(
size_t i=0;
i<tvs.size(); ++
i) {
1847 tvKeyToIndex[
i] = tvRefs.
size();
1853 iEvent.
getByToken(clusterTPMapToken_, pCluster2TPListH);
1856 iEvent.
getByToken(simHitTPMapToken_, simHitsTPAssoc);
1859 SimHitRefKeyToIndex simHitRefKeyToIndex;
1862 std::vector<TPHitIndex> tpHitList;
1864 std::set<edm::ProductID> hitProductIds;
1865 std::map<edm::ProductID, size_t> seedCollToOffset;
1867 ev_run = iEvent.
id().
run();
1869 ev_event = iEvent.
id().
event();
1873 iEvent.
getByToken(pixelSimLinkToken_, pixelDigiSimLinksHandle);
1874 const auto& pixelDigiSimLinks = *pixelDigiSimLinksHandle;
1877 iEvent.
getByToken(stripSimLinkToken_, stripDigiSimLinksHandle);
1881 iEvent.
getByToken(siphase2OTSimLinksToken_, siphase2OTSimLinksHandle);
1885 iEvent.
getByToken(beamSpotToken_, recoBeamSpotHandle);
1886 BeamSpot const & bs = *recoBeamSpotHandle;
1891 vector<pair<int,int> > monoStereoClusterList;
1892 if(includeAllHits_) {
1894 fillSimHits(tracker, tpKeyToIndex, *simHitsTPAssoc, tTopo, simHitRefKeyToIndex, tpHitList);
1897 fillPixelHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, pixelDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
1900 if(includeStripHits_){
1901 LogDebug(
"TrackingNtuple") <<
"foundStripSimLink" ;
1902 const auto& stripDigiSimLinks = *stripDigiSimLinksHandle;
1903 fillStripRphiStereoHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, stripDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
1909 if(includePhase2OTHits_){
1910 LogDebug(
"TrackingNtuple") <<
"foundPhase2OTSimLinks" ;
1911 const auto& phase2OTSimLinks = *siphase2OTSimLinksHandle;
1912 fillPhase2OTHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, phase2OTSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
1918 fillSeeds(iEvent, tpCollection, tpKeyToIndex, bs, associatorByHits, *theTTRHBuilder, theMF.
product(), monoStereoClusterList, hitProductIds, seedCollToOffset);
1923 iEvent.
getByToken(trackToken_, tracksHandle);
1930 std::vector<const MVACollection *> mvaColls;
1931 std::vector<const QualityMaskCollection *> qualColls;
1936 for(
const auto& tokenTpl: mvaQualityCollectionTokens_) {
1937 iEvent.
getByToken(std::get<0>(tokenTpl), hmva);
1938 iEvent.
getByToken(std::get<1>(tokenTpl), hqual);
1940 mvaColls.push_back(hmva.
product());
1941 qualColls.push_back(hqual.
product());
1942 if(mvaColls.back()->size() != tracks.
size()) {
1943 throw cms::Exception(
"Configuration") <<
"Inconsistency in track collection and MVA sizes. Track collection has " << tracks.
size() <<
" tracks, whereas the MVA " << (mvaColls.size()-1) <<
" has " << mvaColls.back()->size() <<
" entries. Double-check your configuration.";
1945 if(qualColls.back()->size() != tracks.
size()) {
1946 throw cms::Exception(
"Configuration") <<
"Inconsistency in track collection and quality mask sizes. Track collection has " << tracks.
size() <<
" tracks, whereas the quality mask " << (qualColls.size()-1) <<
" has " << qualColls.back()->size() <<
" entries. Double-check your configuration.";
1954 fillTracks(trackRefs, tpCollection, tpKeyToIndex, bs, *vertices, associatorByHits, *theTTRHBuilder, tTopo, hitProductIds, seedCollToOffset, mvaColls, qualColls);
1959 fillTrackingParticles(iEvent, iSetup, trackRefs, bs, tpCollection, tvKeyToIndex, associatorByHits, tpHitList);
1981 template <
typename SimLink>
struct GetCluster;
1983 struct GetCluster<PixelDigiSimLink> {
1987 struct GetCluster<StripDigiSimLink> {
1992 template <
typename SimLink>
1994 DetId hitId,
int clusterKey,
1997 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2000 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2005 std::map<unsigned int, double> simTrackIdToChargeFraction;
2007 else simTrackIdToChargeFraction = chargeFraction(GetCluster<SimLink>::call(cluster), hitId, digiSimLinks);
2010 auto range = clusterToTPMap.
equal_range( cluster );
2011 if( range.first != range.second ) {
2012 for(
auto ip=range.first; ip != range.second; ++ip ) {
2016 const auto event = trackingParticle->eventId().event();
2017 const auto bx = trackingParticle->eventId().bunchCrossing();
2025 auto tpIndex = tpKeyToIndex.find(trackingParticle.
key());
2026 if( tpIndex == tpKeyToIndex.end())
2030 std::pair<TrackingParticleRef, TrackPSimHitRef> simHitTPpairWithDummyTP(trackingParticle,
TrackPSimHitRef());
2032 auto range = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2035 bool foundElectron =
false;
2037 for(
auto ip = range.first; ip != range.second; ++ip) {
2042 if(
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
2043 foundElectron =
true;
2047 simHitKey = TPhit.
key();
2048 simHitID = TPhit.
id();
2058 auto ex =
cms::Exception(
"LogicError") <<
"Did not find SimHit for reco hit DetId " << hitId.
rawId()
2059 <<
" for TP " << trackingParticle.
key() <<
" bx:event " << bx <<
":" <<
event 2060 <<
".\nFound SimHits from detectors ";
2061 for(
auto ip = range.first; ip != range.second; ++ip) {
2064 ex << dId.
rawId() <<
" ";
2066 if(trackingParticle->eventId().event() != 0) {
2067 ex <<
"\nSince this is a TrackingParticle from pileup, check that you're running the pileup mixing in playback mode.";
2071 auto simHitIndex = simHitRefKeyToIndex.at(std::make_pair(simHitKey, simHitID));
2074 double chargeFraction = 0.;
2075 for(
const SimTrack& simtrk: trackingParticle->g4Tracks()) {
2076 auto found = simTrackIdToChargeFraction.find(simtrk.trackId());
2077 if(found != simTrackIdToChargeFraction.end()) {
2078 chargeFraction += found->second;
2088 simhit_hitType[simHitIndex].push_back(static_cast<int>(hitType));
2096 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2099 SimHitRefKeyToIndex& simHitRefKeyToIndex,
2100 std::vector<TPHitIndex>& tpHitList) {
2102 for(
const auto&
assoc: simHitsTPAssoc) {
2103 auto tpKey =
assoc.first.key();
2107 auto found = tpKeyToIndex.find(tpKey);
2108 if(found == tpKeyToIndex.end())
2110 const auto tpIndex = found->second;
2113 const auto& simhit = *(
assoc.second);
2114 auto detId =
DetId(simhit.detUnitId());
2124 auto simHitKey = std::make_pair(
assoc.second.key(),
assoc.second.id());
2126 if(simHitRefKeyToIndex.find(simHitKey) != simHitRefKeyToIndex.end()) {
2127 for(
const auto& assoc2: simHitsTPAssoc) {
2128 if(std::make_pair(assoc2.second.key(), assoc2.second.id()) == simHitKey) {
2131 auto range1 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2134 auto range2 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
2138 LogTrace(
"TrackingNtuple") <<
"Earlier TP " << assoc2.first.key() <<
" SimTrack Ids";
2139 for(
const auto&
simTrack: assoc2.first->g4Tracks()) {
2142 for(
auto iHit = range2.first; iHit != range2.second; ++iHit) {
2143 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof " << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event " << iHit->second->eventId().bunchCrossing() <<
":" << iHit->second->eventId().event();
2145 LogTrace(
"TrackingNtuple") <<
"Current TP " <<
assoc.first.key() <<
" SimTrack Ids";
2149 for(
auto iHit = range1.first; iHit != range1.second; ++iHit) {
2150 LogTrace(
"TrackingNtuple") <<
" SimHit " << iHit->second.key() <<
" " << iHit->second.id() <<
" tof " << iHit->second->tof() <<
" trackId " << iHit->second->trackId() <<
" BX:event " << iHit->second->eventId().bunchCrossing() <<
":" << iHit->second->eventId().event();
2154 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second <<
", first time with TrackingParticle " << assoc2.first.key() <<
", now with " << tpKey;
2157 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second <<
", now with TrackingParticle " << tpKey <<
", but I didn't find the first occurrance!";
2162 throw cms::Exception(
"LogicError") <<
"Did not find a det unit for DetId " << simhit.detUnitId() <<
" from tracker geometry";
2164 const auto pos = det->surface().toGlobal(simhit.localPosition());
2165 const float tof = simhit.timeOfFlight();
2167 const auto simHitIndex =
simhit_x.size();
2168 simHitRefKeyToIndex[simHitKey] = simHitIndex;
2170 if(includeStripHits_)
simhit_detId.push_back(tTopo, detId);
2186 tpHitList.emplace_back(tpKey, simHitIndex, tof, simhit.detUnitId());
2192 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2197 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2198 std::set<edm::ProductID>& hitProductIds
2201 iEvent.
getByToken(pixelRecHitToken_, pixelHits);
2202 for (
auto it = pixelHits->
begin(); it!=pixelHits->
end(); it++ ) {
2203 const DetId hitId = it->detId();
2204 for (
auto hit = it->begin();
hit!=it->end();
hit++ ) {
2207 hitProductIds.insert(
hit->cluster().
id());
2209 const int key =
hit->cluster().key();
2210 const int lay = tTopo.
layer(hitId);
2212 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Pixel);
2220 pix_x .push_back( ttrh->globalPosition().x() );
2221 pix_y .push_back( ttrh->globalPosition().y() );
2222 pix_z .push_back( ttrh->globalPosition().z() );
2223 pix_xx .push_back( ttrh->globalPositionError().cxx() );
2224 pix_xy .push_back( ttrh->globalPositionError().cyx() );
2225 pix_yy .push_back( ttrh->globalPositionError().cyy() );
2226 pix_yz .push_back( ttrh->globalPositionError().czy() );
2227 pix_zz .push_back( ttrh->globalPositionError().czz() );
2228 pix_zx .push_back( ttrh->globalPositionError().czx() );
2230 pix_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2231 pix_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2232 LogTrace(
"TrackingNtuple") <<
"pixHit cluster=" << key
2235 <<
" rawId=" << hitId.
rawId()
2236 <<
" pos =" << ttrh->globalPosition()
2240 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2246 <<
" event=" << simHitData.
event[0];
2255 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2260 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2261 std::set<edm::ProductID>& hitProductIds
2265 iEvent.
getByToken(stripRphiRecHitToken_, rphiHits);
2267 iEvent.
getByToken(stripStereoRecHitToken_, stereoHits);
2275 str_x .resize(totalStripHits);
2276 str_y .resize(totalStripHits);
2277 str_z .resize(totalStripHits);
2278 str_xx .resize(totalStripHits);
2279 str_xy .resize(totalStripHits);
2280 str_yy .resize(totalStripHits);
2281 str_yz .resize(totalStripHits);
2282 str_zz .resize(totalStripHits);
2283 str_zx .resize(totalStripHits);
2289 for(
const auto& detset: hits) {
2290 const DetId hitId = detset.detId();
2291 for(
const auto&
hit: detset) {
2294 hitProductIds.insert(
hit.cluster().
id());
2296 const int key =
hit.cluster().key();
2297 const int lay = tTopo.
layer(hitId);
2299 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Strip);
2304 str_x [
key] = ttrh->globalPosition().x();
2305 str_y [
key] = ttrh->globalPosition().y();
2306 str_z [
key] = ttrh->globalPosition().z();
2307 str_xx [
key] = ttrh->globalPositionError().cxx();
2308 str_xy [
key] = ttrh->globalPositionError().cyx();
2309 str_yy [
key] = ttrh->globalPositionError().cyy();
2310 str_yz [
key] = ttrh->globalPositionError().czy();
2311 str_zz [
key] = ttrh->globalPositionError().czz();
2312 str_zx [
key] = ttrh->globalPositionError().czx();
2314 str_radL [
key] = ttrh->surface()->mediumProperties().radLen();
2315 str_bbxi [
key] = ttrh->surface()->mediumProperties().xi();
2316 LogTrace(
"TrackingNtuple") << name <<
" cluster=" << key
2319 <<
" rawId=" << hitId.
rawId()
2320 <<
" pos =" << ttrh->globalPosition()
2324 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2331 <<
" event=" << simHitData.
event[0];
2337 fill(*rphiHits,
"stripRPhiHit");
2338 fill(*stereoHits,
"stripStereoHit");
2344 std::vector<std::pair<int, int> >& monoStereoClusterList
2347 iEvent.
getByToken(stripMatchedRecHitToken_, matchedHits);
2348 for (
auto it = matchedHits->
begin(); it!=matchedHits->
end(); it++ ) {
2349 const DetId hitId = it->detId();
2350 for (
auto hit = it->begin();
hit!=it->end();
hit++ ) {
2352 const int lay = tTopo.
layer(hitId);
2353 monoStereoClusterList.emplace_back(
hit->monoHit().cluster().key(),
hit->stereoHit().cluster().key());
2359 glu_x .push_back( ttrh->globalPosition().x() );
2360 glu_y .push_back( ttrh->globalPosition().y() );
2361 glu_z .push_back( ttrh->globalPosition().z() );
2362 glu_xx .push_back( ttrh->globalPositionError().cxx() );
2363 glu_xy .push_back( ttrh->globalPositionError().cyx() );
2364 glu_yy .push_back( ttrh->globalPositionError().cyy() );
2365 glu_yz .push_back( ttrh->globalPositionError().czy() );
2366 glu_zz .push_back( ttrh->globalPositionError().czz() );
2367 glu_zx .push_back( ttrh->globalPositionError().czx() );
2368 glu_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2369 glu_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2370 LogTrace(
"TrackingNtuple") <<
"stripMatchedHit" 2371 <<
" cluster0=" <<
hit->stereoHit().cluster().key()
2372 <<
" cluster1=" <<
hit->monoHit().cluster().key()
2375 <<
" rawId=" << hitId.
rawId()
2376 <<
" pos =" << ttrh->globalPosition();
2383 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2388 const SimHitRefKeyToIndex& simHitRefKeyToIndex,
2389 std::set<edm::ProductID>& hitProductIds
2392 iEvent.
getByToken(phase2OTRecHitToken_, phase2OTHits);
2393 for (
auto it = phase2OTHits->
begin(); it!=phase2OTHits->
end(); it++ ) {
2394 const DetId hitId = it->detId();
2395 for (
auto hit = it->begin();
hit!=it->end();
hit++ ) {
2398 hitProductIds.insert(
hit->cluster().
id());
2400 const int key =
hit->cluster().key();
2401 const int lay = tTopo.
layer(hitId);
2403 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Phase2OT);
2411 ph2_x .push_back( ttrh->globalPosition().x() );
2412 ph2_y .push_back( ttrh->globalPosition().y() );
2413 ph2_z .push_back( ttrh->globalPosition().z() );
2414 ph2_xx .push_back( ttrh->globalPositionError().cxx() );
2415 ph2_xy .push_back( ttrh->globalPositionError().cyx() );
2416 ph2_yy .push_back( ttrh->globalPositionError().cyy() );
2417 ph2_yz .push_back( ttrh->globalPositionError().czy() );
2418 ph2_zz .push_back( ttrh->globalPositionError().czz() );
2419 ph2_zx .push_back( ttrh->globalPositionError().czx() );
2420 ph2_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
2421 ph2_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
2423 LogTrace(
"TrackingNtuple") <<
"phase2 OT cluster=" << key
2426 <<
" rawId=" << hitId.
rawId()
2427 <<
" pos =" << ttrh->globalPosition()
2432 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
2438 <<
" event=" << simHitData.
event[0];
2447 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2452 const std::vector<std::pair<int, int> >& monoStereoClusterList,
2453 const std::set<edm::ProductID>& hitProductIds,
2454 std::map<edm::ProductID, size_t>& seedCollToOffset
2457 for(
size_t iColl=0; iColl < seedTokens_.size(); ++iColl) {
2458 const auto& seedToken = seedTokens_[iColl];
2461 iEvent.
getByToken(seedToken, seedTracksHandle);
2470 const auto& seedStopInfoToken = seedStopInfoTokens_[iColl];
2472 iEvent.
getByToken(seedStopInfoToken, seedStopInfoHandle);
2473 const auto& seedStopInfos = *seedStopInfoHandle;
2474 if(
seedTracks.size() != seedStopInfos.size()) {
2478 throw cms::Exception(
"LogicError") <<
"Got " <<
seedTracks.size() <<
" seeds, but " << seedStopInfos.size() <<
" seed stopping infos for collections " << labels.
module <<
", " << labels2.
module;
2491 label.ReplaceAll(
"seedTracks",
"");
2492 label.ReplaceAll(
"Seeds",
"");
2493 label.ReplaceAll(
"muonSeeded",
"muonSeededStep");
2498 auto inserted = seedCollToOffset.emplace(
id,
offset);
2499 if(!inserted.second)
2500 throw cms::Exception(
"Configuration") <<
"Trying to add seeds with ProductID " <<
id <<
" for a second time from collection " << labels.
module <<
", seed algo " << label <<
". Typically this is caused by a configuration problem.";
2503 LogTrace(
"TrackingNtuple") <<
"NEW SEED LABEL: " << label <<
" size: " <<
seedTracks.size() <<
" algo=" << algo
2504 <<
" ProductID " <<
id;
2506 for(
size_t iSeed=0; iSeed < seedTrackRefs.
size(); ++iSeed) {
2507 const auto& seedTrackRef = seedTrackRefs[iSeed];
2508 const auto& seedTrack = *seedTrackRef;
2509 const auto& seedRef = seedTrack.seedRef();
2510 const auto&
seed = *seedRef;
2512 const auto seedStopInfo = seedStopInfos[iSeed];
2514 if(seedRef.id() !=
id)
2515 throw cms::Exception(
"LogicError") <<
"All tracks in 'TracksFromSeeds' collection should point to seeds in the same collection. Now the element 0 had ProductID " <<
id <<
" while the element " << seedTrackRef.key() <<
" had " << seedTrackRef.id() <<
". The source collection is " << labels.
module <<
".";
2517 std::vector<float> sharedFraction;
2518 std::vector<int> tpIdx;
2519 auto foundTPs = recSimColl.
find(seedTrackRef);
2520 if (foundTPs != recSimColl.
end()) {
2521 for(
const auto tpQuality: foundTPs->val) {
2522 sharedFraction.push_back(tpQuality.second);
2523 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
2529 const int charge = seedTrack.charge();
2530 const float pt = seedFitOk ? seedTrack.pt() : 0;
2531 const float eta = seedFitOk ? seedTrack.eta() : 0;
2532 const float phi = seedFitOk ? seedTrack.phi() : 0;
2533 const int nHits = seedTrack.numberOfValidHits();
2535 const auto seedIndex =
see_fitok.size();
2539 see_px .push_back( seedFitOk ? seedTrack.px() : 0 );
2540 see_py .push_back( seedFitOk ? seedTrack.py() : 0 );
2541 see_pz .push_back( seedFitOk ? seedTrack.pz() : 0 );
2545 see_q .push_back( charge );
2550 see_ptErr .push_back( seedFitOk ? seedTrack.ptError() : 0);
2551 see_etaErr .push_back( seedFitOk ? seedTrack.etaError() : 0);
2552 see_phiErr .push_back( seedFitOk ? seedTrack.phiError() : 0);
2553 see_dxyErr .push_back( seedFitOk ? seedTrack.dxyError() : 0);
2554 see_dzErr .push_back( seedFitOk ? seedTrack.dzError() : 0);
2557 see_nCands .push_back( seedStopInfo.candidatesPerSeed() );
2559 const auto& state = seedTrack.seedRef()->startingState();
2560 const auto&
pos = state.parameters().position();
2561 const auto& mom = state.parameters().momentum();
2570 if(includeTrackingParticles_) {
2590 std::vector<int> hitIdx;
2591 std::vector<int> hitType;
2595 int subid = recHit->geographicalId().subdetId();
2600 if(includeAllHits_) {
2601 checkProductID(hitProductIds, clusterRef.id(),
"seed");
2604 hitIdx.push_back( clusterKey );
2610 if(includeAllHits_) {
2617 std::vector<std::pair<int,int> >::const_iterator
pos =
find( monoStereoClusterList.begin(), monoStereoClusterList.end(), std::make_pair(monoIdx,stereoIdx) );
2618 const auto gluedIndex =
std::distance(monoStereoClusterList.begin(), pos);
2619 if(includeAllHits_)
glu_seeIdx[gluedIndex].push_back(seedIndex);
2620 hitIdx.push_back( gluedIndex );
2625 unsigned int clusterKey;
2626 if(clusterRef.isPhase2()){
2629 clusterKey = clusterRef.cluster_strip().key();
2632 if(includeAllHits_) {
2633 checkProductID(hitProductIds, clusterRef.id(),
"seed");
2634 if(clusterRef.isPhase2()){
2641 hitIdx.push_back( clusterKey );
2642 if(clusterRef.isPhase2()){
2649 LogTrace(
"TrackingNtuple") <<
" not pixel and not Strip detector";
2663 std::vector<GlobalPoint>
gp(2);
2664 std::vector<GlobalError> ge(2);
2665 gp[0] = recHit0->globalPosition();
2666 ge[0] = recHit0->globalPositionError();
2667 gp[1] = recHit1->globalPosition();
2668 ge[1] = recHit1->globalPositionError();
2669 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
2670 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
2671 <<
" - PAIR - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId()
2672 <<
" hitpos: " << gp[0] <<
" " << gp[1]
2673 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2674 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2675 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2676 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2677 <<
" eta,phi: " << gp[0].
eta() <<
"," << gp[0].phi();
2678 }
else if (nHits==3) {
2685 gp[0] = recHit0->globalPosition();
2686 ge[0] = recHit0->globalPositionError();
2687 int subid0 = recHit0->geographicalId().subdetId();
2689 gp[1] = recHit1->globalPosition();
2690 ge[1] = recHit1->globalPositionError();
2691 int subid1 = recHit1->geographicalId().subdetId();
2693 gp[2] = recHit2->globalPosition();
2694 ge[2] = recHit2->globalPositionError();
2695 int subid2 = recHit2->geographicalId().subdetId();
2698 float seed_chi2 = rzLine.
chi2();
2701 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
2702 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
2703 <<
" - TRIPLET - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId() <<
" " << recHit2->geographicalId().rawId()
2704 <<
" hitpos: " <<
gp[0] <<
" " <<
gp[1] <<
" " <<
gp[2]
2705 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2706 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2707 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2708 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2709 <<
" trans2: " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2710 <<
" " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2711 <<
" local: " << recHit2->localPosition()
2713 <<
" eta,phi: " <<
gp[0].eta() <<
"," <<
gp[0].phi()
2714 <<
" pt,chi2: " << seed_pt <<
"," << seed_chi2;
2726 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
2732 const std::set<edm::ProductID>& hitProductIds,
2733 const std::map<edm::ProductID, size_t>& seedCollToOffset,
2734 const std::vector<const MVACollection *>& mvaColls,
2735 const std::vector<const QualityMaskCollection *>& qualColls
2740 LogTrace(
"TrackingNtuple") <<
"NEW TRACK LABEL: " << labels.
module;
2742 auto pvPosition = vertices[0].position();
2744 for(
size_t iTrack = 0; iTrack<tracks.
size(); ++iTrack) {
2745 const auto& itTrack = tracks[iTrack];
2747 bool isSimMatched =
false;
2748 std::vector<float> sharedFraction;
2749 std::vector<int> tpIdx;
2750 auto foundTPs = recSimColl.
find(itTrack);
2751 if (foundTPs != recSimColl.
end()) {
2752 if (!foundTPs->val.empty()) {
2753 nSimHits = foundTPs->val[0].first->numberOfTrackerHits();
2754 isSimMatched =
true;
2756 for(
const auto tpQuality: foundTPs->val) {
2757 sharedFraction.push_back(tpQuality.second);
2758 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
2761 int charge = itTrack->charge();
2762 float pt = itTrack->pt();
2763 float eta = itTrack->eta();
2764 const double lambda = itTrack->lambda();
2765 float chi2 = itTrack->normalizedChi2();
2766 float ndof = itTrack->ndof();
2767 float phi = itTrack->phi();
2768 int nHits = itTrack->numberOfValidHits();
2771 float chi2_1Dmod =
chi2;
2772 int count1dhits = 0;
2773 for(
auto iHit = itTrack->recHitsBegin(), iEnd=itTrack->recHitsEnd(); iHit != iEnd; ++iHit) {
2778 if(count1dhits > 0) {
2779 chi2_1Dmod = (chi2+count1dhits)/(ndof+count1dhits);
2784 trk_px .push_back(itTrack->px());
2785 trk_py .push_back(itTrack->py());
2786 trk_pz .push_back(itTrack->pz());
2787 trk_pt .push_back(pt);
2788 trk_inner_px.push_back(itTrack->innerMomentum().x());
2789 trk_inner_py.push_back(itTrack->innerMomentum().y());
2790 trk_inner_pz.push_back(itTrack->innerMomentum().z());
2791 trk_inner_pt.push_back(itTrack->innerMomentum().rho());
2792 trk_outer_px.push_back(itTrack->outerMomentum().x());
2793 trk_outer_py.push_back(itTrack->outerMomentum().y());
2794 trk_outer_pz.push_back(itTrack->outerMomentum().z());
2795 trk_outer_pt.push_back(itTrack->outerMomentum().rho());
2796 trk_eta .push_back(eta);
2797 trk_lambda .push_back(lambda);
2798 trk_cotTheta .push_back(1/
tan(
M_PI*0.5-lambda));
2799 trk_phi .push_back(phi);
2800 trk_dxy .push_back(itTrack->dxy(bs.
position()));
2801 trk_dz .push_back(itTrack->dz(bs.
position()));
2802 trk_dxyPV .push_back(itTrack->dxy(pvPosition));
2803 trk_dzPV .push_back(itTrack->dz(pvPosition));
2804 trk_dxyClosestPV.push_back(itTrack->dxy(bestPV));
2805 trk_dzClosestPV .push_back(itTrack->dz(bestPV));
2806 trk_ptErr .push_back(itTrack->ptError());
2807 trk_etaErr .push_back(itTrack->etaError());
2808 trk_lambdaErr.push_back(itTrack->lambdaError());
2809 trk_phiErr .push_back(itTrack->phiError());
2810 trk_dxyErr .push_back(itTrack->dxyError());
2811 trk_dzErr .push_back(itTrack->dzError());
2812 trk_refpoint_x.push_back(itTrack->vx());
2813 trk_refpoint_y.push_back(itTrack->vy());
2814 trk_refpoint_z.push_back(itTrack->vz());
2815 trk_nChi2 .push_back(chi2);
2816 trk_nChi2_1Dmod.push_back(chi2_1Dmod);
2817 trk_ndof .push_back(ndof);
2818 trk_q .push_back(charge);
2829 trk_algo .push_back(itTrack->algo());
2830 trk_originalAlgo.push_back(itTrack->originalAlgo());
2835 for(
size_t i=0;
i<trk_mvas.size(); ++
i) {
2836 trk_mvas [
i].push_back( (*(mvaColls [
i]))[iTrack] );
2837 trk_qualityMasks[
i].push_back( (*(qualColls[i]))[iTrack] );
2841 auto offset = seedCollToOffset.find(itTrack->seedRef().id());
2842 if(
offset == seedCollToOffset.end()) {
2845 <<
"' refers to seed collection " << itTrack->seedRef().id()
2846 <<
", but that seed collection is not given as an input. The following collections were given as an input " << make_ProductIDMapPrinter(seedCollToOffset);
2849 const auto seedIndex =
offset->second + itTrack->seedRef().key();
2852 throw cms::Exception(
"LogicError") <<
"Track index has already been set for seed " << seedIndex <<
" to " <<
see_trkIdx[seedIndex] <<
"; was trying to set it to " << iTrack;
2857 if(includeTrackingParticles_) {
2864 LogTrace(
"TrackingNtuple") <<
"Track #" << itTrack.key() <<
" with q=" << charge
2865 <<
", pT=" << pt <<
" GeV, eta: " << eta <<
", phi: " << phi
2866 <<
", chi2=" << chi2
2867 <<
", Nhits=" << nHits
2868 <<
", algo=" << itTrack->algoName(itTrack->algo()).c_str()
2870 <<
" seed#=" << itTrack->seedRef().key()
2871 <<
" simMatch=" << isSimMatched
2872 <<
" nSimHits=" << nSimHits
2873 <<
" sharedFraction=" << (sharedFraction.empty()?-1:sharedFraction[0])
2874 <<
" tpIdx=" << (tpIdx.empty()?-1:tpIdx[0]);
2875 std::vector<int> hitIdx;
2876 std::vector<int> hitType;
2878 for(
auto i=itTrack->recHitsBegin();
i!=itTrack->recHitsEnd();
i++) {
2880 DetId hitId = hit->geographicalId();
2887 if (hit->isValid()) {
2891 unsigned int clusterKey;
2892 if(clusterRef.isPixel()){
2894 }
else if(clusterRef.isPhase2()){
2895 clusterKey = clusterRef.cluster_phase2OT().key();
2897 clusterKey = clusterRef.cluster_strip().key();
2900 LogTrace(
"TrackingNtuple") <<
" id: " << hitId.
rawId() <<
" - globalPos =" << hit->globalPosition()
2901 <<
" cluster=" << clusterKey
2902 <<
" clusterRef ID=" << clusterRef.id()
2903 <<
" eta,phi: " << hit->globalPosition().eta() <<
"," << hit->globalPosition().phi();
2904 if(includeAllHits_) {
2905 checkProductID(hitProductIds, clusterRef.id(),
"track");
2906 if(clusterRef.isPixel()){
2908 }
else if(clusterRef.isPhase2()){
2916 hitIdx.push_back(clusterKey);
2917 if(clusterRef.isPixel()){
2919 }
else if(clusterRef.isPhase2()){
2925 LogTrace(
"TrackingNtuple") <<
" - invalid hit";
2931 if(includeStripHits_)
inv_detId.push_back( tTopo, hitId );
2933 inv_type .push_back( hit->getType() );
2948 const TrackingVertexRefKeyToIndex& tvKeyToIndex,
2950 const std::vector<TPHitIndex>& tpHitList
2958 iEvent.
getByToken(tpNLayersToken_, tpNLayersH);
2959 const auto& nLayers_tPCeff = *tpNLayersH;
2961 iEvent.
getByToken(tpNPixelLayersToken_, tpNLayersH);
2962 const auto& nPixelLayers_tPCeff = *tpNLayersH;
2964 iEvent.
getByToken(tpNStripStereoLayersToken_, tpNLayersH);
2965 const auto& nStripMonoAndStereoLayers_tPCeff = *tpNLayersH;
2970 LogTrace(
"TrackingNtuple") <<
"tracking particle pt=" << tp->pt() <<
" eta=" << tp->eta() <<
" phi=" << tp->phi();
2971 bool isRecoMatched =
false;
2972 std::vector<int> tkIdx;
2973 std::vector<float> sharedFraction;
2974 auto foundTracks = simRecColl.
find(tp);
2975 if(foundTracks != simRecColl.
end()) {
2976 isRecoMatched =
true;
2984 for(
const auto& genRef: tp->genParticles()) {
2985 if(genRef.isNonnull())
2989 bool isFromBHadron =
false;
2994 for(
const auto& particle: recoGenParticleTrail) {
2997 isFromBHadron =
true;
3003 LogTrace(
"TrackingNtuple") <<
"matched to tracks = " << make_VectorPrinter(tkIdx) <<
" isRecoMatched=" << isRecoMatched;
3004 sim_event .push_back(tp->eventId().event());
3008 sim_px .push_back(tp->px());
3009 sim_py .push_back(tp->py());
3010 sim_pz .push_back(tp->pz());
3011 sim_pt .push_back(tp->pt());
3012 sim_eta .push_back(tp->eta());
3013 sim_phi .push_back(tp->phi());
3014 sim_q .push_back(tp->charge());
3018 std::vector<int> decayIdx;
3019 for(
const auto&
v: tp->decayVertices())
3020 decayIdx.push_back( tvKeyToIndex.at(
v.key()) );
3028 const double lambdaSim =
M_PI/2 - momentum.theta();
3037 std::vector<int> hitIdx;
3038 int nPixel=0, nStrip=0;
3040 for(
auto ip = rangeHit.first; ip != rangeHit.second; ++ip) {
3044 LogTrace(
"TrackingNtuple") <<
"simhit=" << ip->simHitIdx <<
" type=" <<
static_cast<int>(
type);
3045 hitIdx.push_back(ip->simHitIdx);
3048 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose det() is not Tracker but " << detid.det();
3050 const auto subdet = detid.subdetId();
3063 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose subdet is not recognized, is " << subdet;
3070 const auto nSimLayers = nLayers_tPCeff[tp];
3071 const auto nSimPixelLayers = nPixelLayers_tPCeff[tp];
3072 const auto nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tp];
3075 sim_n3DLay .push_back( nSimPixelLayers+nSimStripMonoAndStereoLayers );
3084 const TrackingParticleRefKeyToIndex& tpKeyToIndex,
3085 const unsigned int seedOffset) {
3089 for(
const auto& keyVal: simRecColl) {
3090 const auto& tpRef = keyVal.key;
3091 auto found = tpKeyToIndex.find(tpRef.key());
3092 if(found == tpKeyToIndex.end())
3093 throw cms::Exception(
"Assert") << __FILE__ <<
":" << __LINE__ <<
" fillTrackingParticlesForSeeds: tpRef.key() " << tpRef.key() <<
" not found from tpKeyToIndex. tpKeyToIndex size " << tpKeyToIndex.size();
3094 const auto tpIndex = found->second;
3095 for(
const auto& pair: keyVal.val) {
3096 const auto& seedRef = pair.first->seedRef();
3097 sim_seedIdx[tpIndex].push_back(seedOffset + seedRef.key());
3105 for(
size_t iVertex=0,
size=vertices.size(); iVertex<
size; ++iVertex) {
3107 vtx_x.push_back(vertex.
x());
3108 vtx_y.push_back(vertex.
y());
3109 vtx_z.push_back(vertex.
z());
3118 std::vector<int> trkIdx;
3121 if(iTrack->id() != tracks.
id())
3124 trkIdx.push_back(iTrack->key());
3127 throw cms::Exception(
"LogicError") <<
"Vertex index has already been set for track " << iTrack->key() <<
" to " <<
trk_vtxIdx[iTrack->key()] <<
"; was trying to set it to " << iVertex;
3136 const TrackingParticleRefKeyToIndex& tpKeyToIndex
3138 int current_event = -1;
3139 for(
const auto& ref: trackingVertices) {
3149 processType = v.
g4Vertices()[0].processType();
3161 for(
const auto& tpRef: tps) {
3162 auto found = tpKeyToIndex.find(tpRef.key());
3163 if(found != tpKeyToIndex.end()) {
3164 idx.push_back(found->second);
3169 std::vector<int> sourceIdx;
3170 std::vector<int> daughterIdx;
3184 desc.
addUntracked<std::vector<edm::InputTag> >(
"seedTracks", std::vector<edm::InputTag>{
3196 desc.
addUntracked<std::vector<edm::InputTag> >(
"trackCandidates", std::vector<edm::InputTag>{
3209 desc.
addUntracked<std::vector<std::string> >(
"trackMVAs", std::vector<std::string>{{
"generalTracks"}});
3211 desc.
addUntracked<
bool>(
"trackingParticlesRef",
false);
3234 desc.
addUntracked<
bool>(
"includeTrackingParticles",
true);
3235 descriptions.
add(
"trackingNtuple",desc);
int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< float > sim_pca_dz
edm::LuminosityBlockNumber_t ev_lumi
std::vector< float > trk_nChi2_1Dmod
static const std::string kSharedResource
std::vector< unsigned int > simvtx_processType
Parsed parse(const TrackerTopology &tTopo, const DetId &id) const
edm::EDGetTokenT< TrackingParticleRefVector > trackingParticleRefToken_
std::vector< unsigned int > sim_nLay
std::vector< float > ph2_radL
std::vector< float > trk_dxyPV
EventNumber_t event() const
void fillTrackingVertices(const TrackingVertexRefVector &trackingVertices, const TrackingParticleRefKeyToIndex &tpKeyToIndex)
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > stripMatchedRecHitToken_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< short > see_fitok
Phase2Cluster1DRef cluster_phase2OT() const
std::vector< short > vtx_fake
std::vector< float > simvtx_z
std::vector< std::vector< int > > see_hitType
std::vector< float > trk_dzClosestPV
edm::EDGetTokenT< SiStripRecHit2DCollection > stripRphiRecHitToken_
Phase2TrackerCluster1D const & phase2OTCluster() const
const TrackingParticleRefVector & sourceTracks() const
std::vector< short > ph2_isBarrel
bool tecIsDoubleSide(const DetId &id) const
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
std::vector< float > trk_phi
SiPixelCluster const & pixelCluster() const
std::vector< float > sim_pca_cotTheta
bool tobIsDoubleSide(const DetId &id) const
const_iterator end(bool update=false) const
std::vector< float > sim_pca_dxy
void book(const std::string &prefix, TTree *tree)
std::vector< float > see_stateTrajX
std::vector< unsigned int > trk_nOuterLost
size_type dataSize() const
std::vector< float > glu_xy
std::vector< short > trk_isTrue
std::vector< std::vector< int > > ph2_seeIdx
std::vector< float > glu_radL
std::vector< float > trk_inner_pz
int event() const
get the contents of the subdetector field (should be protected?)
std::vector< float > see_stateTrajPy
std::vector< float > pix_y
std::vector< int > trk_vtxIdx
std::vector< std::vector< int > > str_trkIdx
std::vector< unsigned int > see_nValid
std::vector< float > str_yy
iterator find(det_id_type id)
bool tibIsDoubleSide(const DetId &id) const
bool trackFromSeedFitFailed(const reco::Track &track)
std::vector< float > trk_outer_py
std::unordered_map< reco::RecoToSimCollection::index_type, size_t > TrackingParticleRefKeyToIndex
unsigned int tibString(const DetId &id) const
std::vector< float > pix_zz
unsigned int tidRing(const DetId &id) const
std::vector< unsigned short > layer
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< float > ph2_bbxi
std::vector< int > glu_monoIdx
std::vector< float > trk_eta
std::vector< short > glu_isBarrel
std::vector< unsigned short > order
std::vector< int > sim_bunchCrossing
SimHitData matchCluster(const OmniClusterRef &cluster, DetId hitId, int clusterKey, const TransientTrackingRecHit::RecHitPointer &ttrh, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< SimLink > &digiSimLinks, const SimHitRefKeyToIndex &simHitRefKeyToIndex, HitType hitType)
std::vector< float > see_phiErr
void fillStripMatchedHits(const edm::Event &iEvent, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, std::vector< std::pair< int, int > > &monoStereoClusterList)
trackRef_iterator tracks_end() const
last iterator over tracks
std::vector< std::vector< int > > simhit_hitIdx
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
const_iterator end() const
last iterator over the map (read only)
std::vector< float > str_x
std::vector< float > see_dzErr
std::vector< unsigned int > sim_n3DLay
std::vector< float > trk_cotTheta
CombineDetId< DetIdCommon, DetIdOTCommon, DetIdStripOnly > DetIdStrip
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > see_nStrip
def analyze(function, filename, filter=None)
std::vector< float > trk_px
double zError() const
error on z
void fillPixelHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< PixelDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
std::vector< unsigned short > pix_simType
std::vector< unsigned short > inv_type
std::vector< float > see_stateTrajPz
std::vector< float > pix_zx
TPHitIndex(unsigned int tp=0, unsigned int simHit=0, float to=0, unsigned int id=0)
const std::vector< SimVertex > & g4Vertices() const
#define DEFINE_FWK_MODULE(type)
std::vector< float > sim_phi
std::vector< std::vector< int > > trk_simTrkIdx
void fillStripRphiStereoHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< StripDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
int numberOfValidHits() const
std::vector< float > trk_dzPV
double y() const
y coordinate
edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > trackAssociatorToken_
OmniClusterRef const & stereoClusterRef() const
int pdgId() const
PDG ID.
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
bool isValid() const
Tells whether the vertex is valid.
edm::EDGetTokenT< SiStripRecHit2DCollection > stripStereoRecHitToken_
std::vector< float > trk_dxyErr
unsigned int SimTrackId() const
std::vector< float > str_yz
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< float > trk_pt
unsigned int tecRing(const DetId &id) const
ring id
std::vector< float > glu_x
std::vector< float > trk_inner_py
std::vector< float > see_px
std::vector< float > see_chi2
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< float > glu_z
std::vector< float > see_stateTrajY
edm::EDGetTokenT< edm::View< reco::Track > > trackToken_
CombineDetId< DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdPhase2OTOnly > DetIdAllPhase2
CombineDetId< DetIdCommon, DetIdPixelOnly > DetIdPixel
unsigned int pxbLadder(const DetId &id) const
Global3DPoint GlobalPoint
unsigned int side(const DetId &id) const
void fillBeamSpot(const reco::BeamSpot &bs)
std::vector< unsigned short > see_stopReason
std::vector< float > trk_outer_px
std::vector< std::vector< int > > trk_hitType
std::vector< float > ph2_xx
TrackingParticleRefKeyToIndex TrackingVertexRefKeyToIndex
unsigned long long EventNumber_t
std::vector< std::vector< int > > ph2_trkIdx
int numberOfValidStripHits() const
edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > phase2OTRecHitToken_
bool isStereo(const DetId &id) const
std::vector< unsigned int > see_algo
std::vector< Vertex > VertexCollection
collection of Vertex objects
T * make(const Args &...args) const
make new ROOT object
std::vector< float > trk_inner_pt
uint16_t firstStrip() const
std::vector< short > simhit_process
std::vector< unsigned short > module
std::pair< TrackPSimHitRef::key_type, edm::ProductID > SimHitFullKey
CombineDetId< DetIdCommon, DetIdOTCommon, DetIdPhase2OTOnly > DetIdPhase2OT
std::vector< std::vector< int > > str_seeIdx
std::vector< std::vector< int > > see_simTrkIdx
std::vector< int > simvtx_event
std::vector< float > str_radL
std::vector< int > simhit_simTrkIdx
key_type key() const
Accessor for product key.
std::vector< std::vector< float > > sim_shareFrac
std::vector< unsigned short > trk_stopReason
int pixelLayersWithMeasurement() const
std::vector< unsigned short > ladder
static bool tpHitIndexListLess(const TPHitIndex &i, const TPHitIndex &j)
TrackingNtuple(const edm::ParameterSet &)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
std::ostream & operator<<(std::ostream &out, const ALILine &li)
std::vector< float > sim_py
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
LuminosityBlockNumber_t luminosityBlock() const
std::vector< float > sim_px
unsigned int SimTrackId() const
unsigned int LuminosityBlockNumber_t
std::vector< float > pix_xx
std::vector< std::vector< int > > sim_decayVtxIdx
std::vector< float > trk_refpoint_x
std::vector< float > pix_radL
std::vector< float > pix_bbxi
std::vector< std::vector< float > > trk_mvas
void fillPhase2OTHits(const edm::Event &iEvent, const ClusterTPAssociation &clusterToTPMap, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const edm::DetSetVector< PixelDigiSimLink > &digiSimLink, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const SimHitRefKeyToIndex &simHitRefKeyToIndex, std::set< edm::ProductID > &hitProductIds)
std::vector< float > ph2_zx
ProductID id() const
Accessor for product ID.
std::vector< int > simpv_idx
std::vector< unsigned char > QualityMaskCollection
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelSimLinkToken_
CombineDetId< DetIdCommon, DetIdPixelOnly, DetIdOTCommon, DetIdStripOnly > DetIdAll
std::vector< std::vector< int > > pix_seeIdx
int numberOfLostTrackerHits(HitCategory category) const
std::vector< unsigned short > str_simType
ClusterPixelRef cluster_pixel() const
std::vector< short > see_isTrue
std::vector< short > inv_isBarrel
uint32_t rawId() const
get the raw id
std::vector< unsigned short > ring
void fillTracks(const edm::RefToBaseVector< reco::Track > &tracks, const TrackingParticleRefVector &tpCollection, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const reco::BeamSpot &bs, const reco::VertexCollection &vertices, const reco::TrackToTrackingParticleAssociator &associatorByHits, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const std::set< edm::ProductID > &hitProductIds, const std::map< edm::ProductID, size_t > &seedToCollIndex, const std::vector< const MVACollection * > &mvaColls, const std::vector< const QualityMaskCollection * > &qualColls)
RefToBase< value_type > refAt(size_type i) const
bool isLower(const DetId &id) const
math::XYZPointD Point
point in the space
std::vector< float > see_etaErr
std::vector< float > simhit_z
std::vector< float > ph2_z
std::vector< float > ph2_yy
Parsed parse(const TrackerTopology &tTopo, const DetId &id) const
std::vector< float > trk_refpoint_y
std::vector< unsigned int > trk_nLostLay
std::vector< float > MVACollection
unsigned int module(const DetId &id) const
std::vector< int > sim_event
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< unsigned int > trk_nStrip
SiStripCluster const & stripCluster() const
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
std::vector< float > chargeFraction
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNStripStereoLayersToken_
unsigned int tibSide(const DetId &id) const
std::string parametersDefinerName_
std::vector< unsigned int > trk_nPixel
std::vector< float > glu_y
void fillTrackingParticles(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::RefToBaseVector< reco::Track > &tracks, const reco::BeamSpot &bs, const TrackingParticleRefVector &tpCollection, const TrackingVertexRefKeyToIndex &tvKeyToIndex, const reco::TrackToTrackingParticleAssociator &associatorByHits, const std::vector< TPHitIndex > &tpHitList)
std::vector< unsigned short > panel
std::vector< float > trk_pz
std::vector< float > trk_dzErr
std::vector< unsigned short > isStereo
std::vector< float > trk_lambdaErr
std::vector< unsigned short > isUpper
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitToken_
std::vector< float > ph2_y
std::vector< std::tuple< edm::EDGetTokenT< MVACollection >, edm::EDGetTokenT< QualityMaskCollection > > > mvaQualityCollectionTokens_
std::vector< std::vector< int > > simvtx_sourceSimIdx
std::vector< float > trk_etaErr
std::vector< short > pix_isBarrel
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > siphase2OTSimLinksToken_
std::vector< float > glu_yz
std::vector< float > sim_pca_phi
auto dz(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
std::vector< unsigned int > trk_algo
simTrack
per collection params
void fillTrackingParticlesForSeeds(const TrackingParticleRefVector &tpCollection, const reco::SimToRecoCollection &simRecColl, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const unsigned int seedOffset)
std::vector< float > ph2_xy
std::vector< float > vtx_y
std::vector< float > pix_z
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
int bunchCrossing() const
get the detector field from this detid
std::vector< int > bunchCrossing
std::vector< float > sim_eta
std::vector< unsigned short > blade
std::vector< unsigned int > trk_originalAlgo
std::vector< unsigned int > trk_nInnerLost
std::vector< float > str_y
std::vector< int > sim_pdgId
std::vector< std::vector< int > > simhit_hitType
std::vector< float > trk_refpoint_z
unsigned int tobSide(const DetId &id) const
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitTPMapToken_
std::vector< float > pix_yz
std::vector< std::vector< int > > sim_genPdgIds
std::vector< int > trk_seedIdx
std::vector< std::vector< float > > pix_chargeFraction
std::vector< float > vtx_yErr
std::vector< std::vector< int > > pix_trkIdx
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< unsigned int > sim_nValid
std::vector< float > glu_yy
std::vector< float > vtx_ndof
double chi2() const
chi-squares
std::vector< std::vector< int > > ph2_simHitIdx
std::vector< float > simvtx_x
double z() const
z coordinate
T operator[](int i) const
virtual TrackingParticle::Vector momentum(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
std::vector< float > str_zz
DetIdAllPhase2 inv_detId_phase2
std::vector< float > sim_pca_pt
std::vector< float > see_dxyErr
bool isMatched(TrackingRecHit const &hit)
double BeamWidthX() const
beam width X
range equal_range(const OmniClusterRef &key) const
std::vector< float > see_pt
std::vector< unsigned int > see_nPhase2OT
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexToken_
std::vector< float > see_dxy
std::vector< std::vector< int > > glu_seeIdx
std::vector< unsigned int > trk_n3DLay
std::vector< std::vector< int > > sim_trkIdx
std::vector< float > trk_outer_pt
static bool tpHitIndexListLessSort(const TPHitIndex &i, const TPHitIndex &j)
std::vector< int > matchingSimHit
const bool includeTrackingParticles_
std::vector< float > trk_dz
std::vector< float > trk_ptErr
std::vector< unsigned int > trk_nStripLay
void fillSimHits(const TrackerGeometry &tracker, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const SimHitTPAssociationProducer::SimHitTPAssociationList &simHitsTPAssoc, const TrackerTopology &tTopo, SimHitRefKeyToIndex &simHitRefKeyToIndex, std::vector< TPHitIndex > &tpHitList)
std::vector< float > see_phi
OmniClusterRef const & monoClusterRef() const
std::vector< float > vtx_z
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< float > see_pz
void book(const std::string &prefix, TTree *tree)
std::vector< float > trk_phiErr
std::vector< unsigned int > sim_nPixelLay
std::vector< float > trk_lambda
std::vector< edm::EDGetTokenT< std::vector< SeedStopInfo > > > seedStopInfoTokens_
iterator end()
Return the off-the-end iterator.
std::vector< float > glu_zz
std::vector< float > sim_pca_lambda
std::vector< float > see_stateTrajPx
std::vector< float > glu_zx
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
std::vector< float > vtx_xErr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::vector< float > > trk_shareFrac
bool isUpper(const DetId &id) const
std::vector< float > sim_pz
std::vector< std::vector< int > > sim_simHitIdx
edm::Ref< TrackingVertexCollection > TrackingVertexRef
std::vector< unsigned short > isGlued
edm::EventNumber_t ev_event
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< unsigned short > isRPhi
std::vector< float > ph2_x
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
double x() const
x coordinate
std::vector< int > glu_stereoIdx
std::vector< float > trk_py
double xError() const
error on x
std::vector< std::vector< int > > pix_simHitIdx
std::vector< float > trk_nChi2
std::vector< std::vector< unsigned short > > trk_qualityMasks
void book(const std::string &prefix, TTree *tree)
T const * product() const
std::vector< unsigned int > see_nGlued
std::vector< float > see_py
std::vector< float > pix_x
std::vector< unsigned int > detId
reco::RecoToSimCollection associateRecoToSim(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< int > sim_parentVtxIdx
std::vector< float > see_ptErr
std::vector< float > str_z
std::vector< unsigned short > isStack
std::vector< float > str_zx
uint32_t stack(const DetId &id) const
std::vector< TrackingVertex > TrackingVertexCollection
double sigmaZ() const
sigma z
std::string algoName() const
bool tidIsDoubleSide(const DetId &id) const
int stripLayersWithMeasurement() const
std::vector< short > trk_isHP
std::vector< float > str_xy
double BeamWidthY() const
beam width Y
std::vector< std::vector< float > > str_chargeFraction
void push_back(const TrackerTopology &tTopo, const DetId &id)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~TrackingNtuple() override
std::vector< unsigned short > isLower
unsigned int tecOrder(const DetId &id) const
Base class to all the history types.
int numberOfLostHits(HitCategory category) const
std::vector< std::vector< int > > trk_hitIdx
unsigned int layer(const DetId &id) const
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
std::vector< std::vector< float > > see_shareFrac
std::vector< unsigned int > sim_nPixel
std::vector< SimHitTPPair > SimHitTPAssociationList
const bool includeAllHits_
int trackerLayersWithoutMeasurement(HitCategory category) const
std::vector< short > vtx_valid
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
const EncodedEventId & eventId() const
edm::EDGetTokenT< ClusterTPAssociation > clusterTPMapToken_
unsigned int tidOrder(const DetId &id) const
Pixel cluster – collection of neighboring pixels above threshold.
std::vector< std::vector< int > > vtx_trkIdx
edm::ProductID id() const
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< short > str_isBarrel
auto dxy(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
void analyze(const edm::Event &, const edm::EventSetup &) override
void depth(int d)
Set the depth of the history.
const TrackingParticleRefVector & daughterTracks() const
std::vector< float > glu_bbxi
std::vector< int > simhit_particle
std::vector< float > trk_outer_pz
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNLayersToken_
std::vector< unsigned short > ph2_simType
std::vector< float > sim_pca_eta
void push_back(const RefToBase< T > &)
virtual OmniClusterRef const & firstClusterRef() const =0
std::vector< float > ph2_yz
std::vector< unsigned short > string
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
std::map< SimHitFullKey, size_t > SimHitRefKeyToIndex
static int pixelToChannel(int row, int col)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< unsigned short > rod
static TrackAlgorithm algoByName(const std::string &name)
double y0() const
y coordinate
std::vector< float > simhit_y
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
std::vector< float > trk_dxyClosestPV
int numberOfValidPixelHits() const
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
std::vector< std::vector< int > > str_simHitIdx
std::vector< float > see_statePt
std::vector< float > trk_ndof
size_type size() const
Size of the RefVector.
std::vector< float > glu_xx
Monte Carlo truth information used for tracking validation.
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNPixelLayersToken_
bool isUninitialized() const
std::vector< unsigned int > trk_nPixelLay
unsigned int tecPetalNumber(const DetId &id) const
std::vector< float > simhit_x
const Point & position() const
position
std::vector< float > simvtx_y
std::vector< unsigned short > see_nCands
std::vector< std::vector< int > > simvtx_daughterSimIdx
std::vector< float > str_xx
#define declareDynArray(T, n, x)
std::vector< unsigned int > see_offset
std::vector< float > ph2_zz
reco::SimToRecoCollection associateSimToReco(const edm::Handle< edm::View< reco::Track > > &tCH, const edm::Handle< TrackingParticleCollection > &tPCH) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
trackRef_iterator tracks_begin() const
first iterator over tracks
void book(const std::string &prefix, TTree *tree)
bool isRPhi(const DetId &id) const
std::vector< int > see_trkIdx
unsigned int tobRod(const DetId &id) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
math::XYZVectorD Vector
point in the space
std::vector< unsigned short > side
std::vector< float > simhit_tof
Detector det() const
get the detector field from this detid
std::vector< std::vector< int > > sim_seedIdx
void fillVertices(const reco::VertexCollection &vertices, const edm::RefToBaseVector< reco::Track > &tracks)
std::vector< float > pix_xy
std::vector< unsigned short > subdet
std::vector< float > trk_dxy
RecoGenParticleTrail const & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
void book(const std::string &prefix, TTree *tree)
std::vector< float > sim_pt
std::vector< float > pix_yy
std::unordered_set< reco::RecoToSimCollection::index_type > TrackingParticleRefKeySet
std::vector< unsigned int > trk_nInvalid
std::vector< decltype(reco::TrackBase().algoMaskUL())> trk_algoMask
std::vector< std::vector< int > > see_hitIdx
T const * product() const
std::vector< float > vtx_x
void push_back(const TrackerTopology &tTopo, const DetId &id)
std::vector< unsigned int > see_nPixel
edm::Ref< TrackingParticleCollection > TrackingParticleRef
std::vector< unsigned short > petalNumber
std::vector< float > see_eta
const std::vector< uint8_t > & amplitudes() const
unsigned int pxfPanel(const DetId &id) const
DetIdAllPhase2 simhit_detId_phase2
std::vector< unsigned int > trk_nValid
unsigned int pxfBlade(const DetId &id) const
std::vector< float > trk_inner_px
double yError() const
error on y
const_iterator begin(bool update=false) const
void fillSeeds(const edm::Event &iEvent, const TrackingParticleRefVector &tpCollection, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const reco::BeamSpot &bs, const reco::TrackToTrackingParticleAssociator &associatorByHits, const TransientTrackingRecHitBuilder &theTTRHBuilder, const MagneticField *theMF, const std::vector< std::pair< int, int > > &monoStereoClusterList, const std::set< edm::ProductID > &hitProductIds, std::map< edm::ProductID, size_t > &seedToCollIndex)
std::vector< float > vtx_zErr
unsigned int operator[](size_t i) const
std::vector< float > simhit_eloss
std::vector< int > sim_isFromBHadron
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripSimLinkToken_
std::vector< float > vtx_chi2
std::vector< int > simvtx_bunchCrossing
std::vector< float > str_bbxi
virtual TrackingParticle::Point vertex(const edm::Event &iEvent, const edm::EventSetup &iSetup, const Charge ch, const Point &vtx, const LorentzVector &lv) const
std::vector< float > see_dz
unsigned int tibOrder(const DetId &id) const
const LorentzVector & position() const
double x0() const
x coordinate
std::vector< unsigned int > sim_nStrip