85 #include <unordered_set>
86 #include <unordered_map>
105 default:
return "UNKNOWN TRACKER HIT TYPE";
109 struct ProductIDSetPrinter {
110 ProductIDSetPrinter(
const std::set<edm::ProductID>& set): set_(set) {}
112 void print(std::ostream& os)
const {
113 for(
const auto& item: set_) {
118 const std::set<edm::ProductID>& set_;
120 std::ostream&
operator<<(std::ostream& os,
const ProductIDSetPrinter&
o) {
124 template <
typename T>
125 struct ProductIDMapPrinter {
126 ProductIDMapPrinter(
const std::map<edm::ProductID, T>& map):
map_(map) {}
128 void print(std::ostream& os)
const {
129 for(
const auto& item:
map_) {
130 os << item.first <<
" ";
134 const std::map<edm::ProductID, T>&
map_;
136 template <
typename T>
137 auto make_ProductIDMapPrinter(
const std::map<edm::ProductID, T>& map) {
138 return ProductIDMapPrinter<T>(map);
140 template <
typename T>
141 std::ostream& operator<<(std::ostream& os, const ProductIDMapPrinter<T>&
o) {
146 template <
typename T>
147 struct VectorPrinter {
148 VectorPrinter(
const std::vector<T>& vec): vec_(vec) {}
150 void print(std::ostream& os)
const {
151 for(
const auto& item: vec_) {
156 const std::vector<T>& vec_;
158 template <
typename T>
159 auto make_VectorPrinter(
const std::vector<T>& vec) {
160 return VectorPrinter<T>(vec);
162 template <
typename T>
163 std::ostream& operator<<(std::ostream& os, const VectorPrinter<T>&
o) {
168 void checkProductID(
const std::set<edm::ProductID>& set,
const edm::ProductID&
id,
const char *
name) {
169 if(set.find(
id) == set.end())
170 throw cms::Exception(
"Configuration") <<
"Got " << name <<
" with a hit with ProductID " <<
id
171 <<
" which does not match to the set of ProductID's for the hits: "
172 << ProductIDSetPrinter(set)
173 <<
". Usually this is caused by a wrong hit collection in the configuration.";
176 template <
typename SimLink,
typename Func>
178 for(
const auto&
link: digiSimLinks) {
179 if(
link.channel() == channel) {
185 std::map<unsigned int, double> chargeFraction(
const SiPixelCluster& cluster,
const DetId& detId,
187 std::map<unsigned int, double> simTrackIdToAdc;
189 auto idetset = digiSimLink.
find(detId);
190 if(idetset == digiSimLink.
end())
191 return simTrackIdToAdc;
195 for(
int iPix=0; iPix != cluster.
size(); ++iPix) {
199 forEachMatchedSimLink(*idetset, channel, [&](
const PixelDigiSimLink& simLink){
205 for(
auto& pair: simTrackIdToAdc) {
209 pair.second /= adcSum;
212 return simTrackIdToAdc;
215 std::map<unsigned int, double> chargeFraction(
const SiStripCluster& cluster,
const DetId& detId,
217 std::map<unsigned int, double> simTrackIdToAdc;
219 auto idetset = digiSimLink.
find(detId);
220 if(idetset == digiSimLink.
end())
221 return simTrackIdToAdc;
229 double& adc = simTrackIdToAdc[simLink.
SimTrackId()];
233 for(
const auto& pair: simTrackIdToAdc) {
234 simTrackIdToAdc[pair.first] = (adcSum != 0. ? pair.second/adcSum : 0.);
238 return simTrackIdToAdc;
314 std::set<edm::ProductID>& hitProductIds
325 std::set<edm::ProductID>& hitProductIds
331 std::vector<std::pair<int, int> >& monoStereoClusterList
341 const std::vector<std::pair<int, int> >& monoStereoClusterList,
342 const std::set<edm::ProductID>& hitProductIds,
343 std::map<edm::ProductID, size_t>& seedToCollIndex
353 const std::set<edm::ProductID>& hitProductIds,
354 const std::map<edm::ProductID, size_t>& seedToCollIndex
362 std::vector<TPHitIndex>& tpHitList);
369 const std::vector<TPHitIndex>& tpHitList
389 template <
typename SimLink>
391 DetId hitId,
int clusterKey,
402 std::vector<edm::EDGetTokenT<edm::View<reco::Track> > >
seedTokens_;
683 return consumes<edm::View<reco::Track> >(
tag);
703 includeSeeds_(iConfig.getUntrackedParameter<
bool>(
"includeSeeds")),
704 includeAllHits_(iConfig.getUntrackedParameter<
bool>(
"includeAllHits"))
706 const bool tpRef = iConfig.getUntrackedParameter<
bool>(
"trackingParticlesRef");
709 trackingParticleRefToken_ = consumes<TrackingParticleRefVector>(
tpTag);
712 trackingParticleToken_ = consumes<TrackingParticleCollection>(
tpTag);
719 t->Branch(
"event" , &ev_event);
720 t->Branch(
"lumi" , &ev_lumi);
721 t->Branch(
"run" , &ev_run);
724 t->Branch(
"trk_px" , &trk_px);
725 t->Branch(
"trk_py" , &trk_py);
726 t->Branch(
"trk_pz" , &trk_pz);
727 t->Branch(
"trk_pt" , &trk_pt);
728 t->Branch(
"trk_inner_px" , &trk_inner_px);
729 t->Branch(
"trk_inner_py" , &trk_inner_py);
730 t->Branch(
"trk_inner_pz" , &trk_inner_pz);
731 t->Branch(
"trk_inner_pt" , &trk_inner_pt);
732 t->Branch(
"trk_outer_px" , &trk_outer_px);
733 t->Branch(
"trk_outer_py" , &trk_outer_py);
734 t->Branch(
"trk_outer_pz" , &trk_outer_pz);
735 t->Branch(
"trk_outer_pt" , &trk_outer_pt);
736 t->Branch(
"trk_eta" , &trk_eta);
737 t->Branch(
"trk_lambda" , &trk_lambda);
738 t->Branch(
"trk_cotTheta" , &trk_cotTheta);
739 t->Branch(
"trk_phi" , &trk_phi);
740 t->Branch(
"trk_dxy" , &trk_dxy );
741 t->Branch(
"trk_dz" , &trk_dz );
742 t->Branch(
"trk_ptErr" , &trk_ptErr );
743 t->Branch(
"trk_etaErr" , &trk_etaErr );
744 t->Branch(
"trk_lambdaErr", &trk_lambdaErr);
745 t->Branch(
"trk_phiErr" , &trk_phiErr );
746 t->Branch(
"trk_dxyErr" , &trk_dxyErr );
747 t->Branch(
"trk_dzErr" , &trk_dzErr );
748 t->Branch(
"trk_refpoint_x", &trk_refpoint_x);
749 t->Branch(
"trk_refpoint_y", &trk_refpoint_y);
750 t->Branch(
"trk_refpoint_z", &trk_refpoint_z);
751 t->Branch(
"trk_nChi2" , &trk_nChi2);
752 t->Branch(
"trk_q" , &trk_q);
753 t->Branch(
"trk_nValid" , &trk_nValid );
754 t->Branch(
"trk_nInvalid" , &trk_nInvalid);
755 t->Branch(
"trk_nPixel" , &trk_nPixel );
756 t->Branch(
"trk_nStrip" , &trk_nStrip );
757 t->Branch(
"trk_nPixelLay", &trk_nPixelLay);
758 t->Branch(
"trk_nStripLay", &trk_nStripLay);
759 t->Branch(
"trk_n3DLay" , &trk_n3DLay );
760 t->Branch(
"trk_nOuterLost", &trk_nOuterLost );
761 t->Branch(
"trk_nInnerLost", &trk_nInnerLost );
762 t->Branch(
"trk_algo" , &trk_algo );
763 t->Branch(
"trk_originalAlgo", &trk_originalAlgo);
764 t->Branch(
"trk_algoMask" , &trk_algoMask);
765 t->Branch(
"trk_stopReason", &trk_stopReason);
766 t->Branch(
"trk_isHP" , &trk_isHP );
768 t->Branch(
"trk_seedIdx" , &trk_seedIdx );
770 t->Branch(
"trk_vtxIdx" , &trk_vtxIdx);
771 t->Branch(
"trk_shareFrac", &trk_shareFrac);
772 t->Branch(
"trk_simTrkIdx", &trk_simTrkIdx );
773 if(includeAllHits_) {
774 t->Branch(
"trk_hitIdx" , &trk_hitIdx);
775 t->Branch(
"trk_hitType", &trk_hitType);
778 t->Branch(
"sim_event" , &sim_event );
779 t->Branch(
"sim_bunchCrossing", &sim_bunchCrossing);
780 t->Branch(
"sim_pdgId" , &sim_pdgId );
781 t->Branch(
"sim_px" , &sim_px );
782 t->Branch(
"sim_py" , &sim_py );
783 t->Branch(
"sim_pz" , &sim_pz );
784 t->Branch(
"sim_pt" , &sim_pt );
785 t->Branch(
"sim_eta" , &sim_eta );
786 t->Branch(
"sim_phi" , &sim_phi );
787 t->Branch(
"sim_pca_pt" , &sim_pca_pt );
788 t->Branch(
"sim_pca_eta" , &sim_pca_eta );
789 t->Branch(
"sim_pca_lambda", &sim_pca_lambda);
790 t->Branch(
"sim_pca_cotTheta", &sim_pca_cotTheta);
791 t->Branch(
"sim_pca_phi" , &sim_pca_phi );
792 t->Branch(
"sim_pca_dxy" , &sim_pca_dxy );
793 t->Branch(
"sim_pca_dz" , &sim_pca_dz );
794 t->Branch(
"sim_q" , &sim_q );
795 t->Branch(
"sim_nValid" , &sim_nValid );
796 t->Branch(
"sim_nPixel" , &sim_nPixel );
797 t->Branch(
"sim_nStrip" , &sim_nStrip );
798 t->Branch(
"sim_nLay" , &sim_nLay );
799 t->Branch(
"sim_nPixelLay", &sim_nPixelLay);
800 t->Branch(
"sim_n3DLay" , &sim_n3DLay );
801 t->Branch(
"sim_trkIdx" , &sim_trkIdx );
802 t->Branch(
"sim_shareFrac", &sim_shareFrac);
803 t->Branch(
"sim_parentVtxIdx", &sim_parentVtxIdx);
804 t->Branch(
"sim_decayVtxIdx", &sim_decayVtxIdx);
805 if(includeAllHits_) {
806 t->Branch(
"sim_simHitIdx" , &sim_simHitIdx );
808 if(includeAllHits_) {
810 t->Branch(
"pix_isBarrel" , &pix_isBarrel );
811 t->Branch(
"pix_det" , &pix_det );
812 t->Branch(
"pix_lay" , &pix_lay );
813 t->Branch(
"pix_detId" , &pix_detId );
814 t->Branch(
"pix_trkIdx" , &pix_trkIdx );
816 t->Branch(
"pix_seeIdx" , &pix_seeIdx );
818 t->Branch(
"pix_simHitIdx" , &pix_simHitIdx);
819 t->Branch(
"pix_chargeFraction", &pix_chargeFraction);
820 t->Branch(
"pix_simType", &pix_simType);
821 t->Branch(
"pix_x" , &pix_x );
822 t->Branch(
"pix_y" , &pix_y );
823 t->Branch(
"pix_z" , &pix_z );
824 t->Branch(
"pix_xx" , &pix_xx );
825 t->Branch(
"pix_xy" , &pix_xy );
826 t->Branch(
"pix_yy" , &pix_yy );
827 t->Branch(
"pix_yz" , &pix_yz );
828 t->Branch(
"pix_zz" , &pix_zz );
829 t->Branch(
"pix_zx" , &pix_zx );
830 t->Branch(
"pix_radL" , &pix_radL );
831 t->Branch(
"pix_bbxi" , &pix_bbxi );
832 t->Branch(
"pix_bbxi" , &pix_bbxi );
834 t->Branch(
"str_isBarrel" , &str_isBarrel );
835 t->Branch(
"str_isStereo" , &str_isStereo );
836 t->Branch(
"str_det" , &str_det );
837 t->Branch(
"str_lay" , &str_lay );
838 t->Branch(
"str_detId" , &str_detId );
839 t->Branch(
"str_trkIdx" , &str_trkIdx );
841 t->Branch(
"str_seeIdx" , &str_seeIdx );
843 t->Branch(
"str_simHitIdx" , &str_simHitIdx);
844 t->Branch(
"str_chargeFraction", &str_chargeFraction);
845 t->Branch(
"str_simType", &str_simType);
846 t->Branch(
"str_x" , &str_x );
847 t->Branch(
"str_y" , &str_y );
848 t->Branch(
"str_z" , &str_z );
849 t->Branch(
"str_xx" , &str_xx );
850 t->Branch(
"str_xy" , &str_xy );
851 t->Branch(
"str_yy" , &str_yy );
852 t->Branch(
"str_yz" , &str_yz );
853 t->Branch(
"str_zz" , &str_zz );
854 t->Branch(
"str_zx" , &str_zx );
855 t->Branch(
"str_radL" , &str_radL );
856 t->Branch(
"str_bbxi" , &str_bbxi );
858 t->Branch(
"glu_isBarrel" , &glu_isBarrel );
859 t->Branch(
"glu_det" , &glu_det );
860 t->Branch(
"glu_lay" , &glu_lay );
861 t->Branch(
"glu_detId" , &glu_detId );
862 t->Branch(
"glu_monoIdx" , &glu_monoIdx );
863 t->Branch(
"glu_stereoIdx" , &glu_stereoIdx);
865 t->Branch(
"glu_seeIdx" , &glu_seeIdx );
867 t->Branch(
"glu_x" , &glu_x );
868 t->Branch(
"glu_y" , &glu_y );
869 t->Branch(
"glu_z" , &glu_z );
870 t->Branch(
"glu_xx" , &glu_xx );
871 t->Branch(
"glu_xy" , &glu_xy );
872 t->Branch(
"glu_yy" , &glu_yy );
873 t->Branch(
"glu_yz" , &glu_yz );
874 t->Branch(
"glu_zz" , &glu_zz );
875 t->Branch(
"glu_zx" , &glu_zx );
876 t->Branch(
"glu_radL" , &glu_radL );
877 t->Branch(
"glu_bbxi" , &glu_bbxi );
879 t->Branch(
"inv_isBarrel" , &inv_isBarrel );
880 t->Branch(
"inv_det" , &inv_det );
881 t->Branch(
"inv_lay" , &inv_lay );
882 t->Branch(
"inv_detId" , &inv_detId );
883 t->Branch(
"inv_type" , &inv_type );
885 t->Branch(
"simhit_det" , &simhit_det);
886 t->Branch(
"simhit_lay" , &simhit_lay);
887 t->Branch(
"simhit_detId" , &simhit_detId);
888 t->Branch(
"simhit_x" , &simhit_x);
889 t->Branch(
"simhit_y" , &simhit_y);
890 t->Branch(
"simhit_z" , &simhit_z);
891 t->Branch(
"simhit_particle", &simhit_particle);
892 t->Branch(
"simhit_process" , &simhit_process);
893 t->Branch(
"simhit_eloss" , &simhit_eloss);
894 t->Branch(
"simhit_tof" , &simhit_tof);
896 t->Branch(
"simhit_simTrkIdx", &simhit_simTrkIdx);
897 t->Branch(
"simhit_hitIdx" , &simhit_hitIdx);
898 t->Branch(
"simhit_hitType" , &simhit_hitType);
901 t->Branch(
"bsp_x" , &bsp_x ,
"bsp_x/F");
902 t->Branch(
"bsp_y" , &bsp_y ,
"bsp_y/F");
903 t->Branch(
"bsp_z" , &bsp_z ,
"bsp_z/F");
904 t->Branch(
"bsp_sigmax" , &bsp_sigmax ,
"bsp_sigmax/F");
905 t->Branch(
"bsp_sigmay" , &bsp_sigmay ,
"bsp_sigmay/F");
906 t->Branch(
"bsp_sigmaz" , &bsp_sigmaz ,
"bsp_sigmaz/F");
909 t->Branch(
"see_fitok" , &see_fitok );
910 t->Branch(
"see_px" , &see_px );
911 t->Branch(
"see_py" , &see_py );
912 t->Branch(
"see_pz" , &see_pz );
913 t->Branch(
"see_pt" , &see_pt );
914 t->Branch(
"see_eta" , &see_eta );
915 t->Branch(
"see_phi" , &see_phi );
916 t->Branch(
"see_dxy" , &see_dxy );
917 t->Branch(
"see_dz" , &see_dz );
918 t->Branch(
"see_ptErr" , &see_ptErr );
919 t->Branch(
"see_etaErr" , &see_etaErr );
920 t->Branch(
"see_phiErr" , &see_phiErr );
921 t->Branch(
"see_dxyErr" , &see_dxyErr );
922 t->Branch(
"see_dzErr" , &see_dzErr );
923 t->Branch(
"see_chi2" , &see_chi2 );
924 t->Branch(
"see_q" , &see_q );
925 t->Branch(
"see_nValid" , &see_nValid );
926 t->Branch(
"see_nPixel" , &see_nPixel );
927 t->Branch(
"see_nGlued" , &see_nGlued );
928 t->Branch(
"see_nStrip" , &see_nStrip );
929 t->Branch(
"see_algo" , &see_algo );
930 t->Branch(
"see_trkIdx" , &see_trkIdx );
931 t->Branch(
"see_shareFrac", &see_shareFrac);
932 t->Branch(
"see_simTrkIdx", &see_simTrkIdx );
933 if(includeAllHits_) {
934 t->Branch(
"see_hitIdx" , &see_hitIdx );
935 t->Branch(
"see_hitType", &see_hitType );
938 t->Branch(
"see_offset" , &see_offset );
942 t->Branch(
"vtx_x" , &vtx_x);
943 t->Branch(
"vtx_y" , &vtx_y);
944 t->Branch(
"vtx_z" , &vtx_z);
945 t->Branch(
"vtx_xErr" , &vtx_xErr);
946 t->Branch(
"vtx_yErr" , &vtx_yErr);
947 t->Branch(
"vtx_zErr" , &vtx_zErr);
948 t->Branch(
"vtx_ndof" , &vtx_ndof);
949 t->Branch(
"vtx_chi2" , &vtx_chi2);
950 t->Branch(
"vtx_fake" , &vtx_fake);
951 t->Branch(
"vtx_valid" , &vtx_valid);
952 t->Branch(
"vtx_trkIdx" , &vtx_trkIdx);
955 t->Branch(
"simvtx_event" , &simvtx_event );
956 t->Branch(
"simvtx_bunchCrossing", &simvtx_bunchCrossing);
957 t->Branch(
"simvtx_processType", &simvtx_processType);
958 t->Branch(
"simvtx_x" , &simvtx_x);
959 t->Branch(
"simvtx_y" , &simvtx_y);
960 t->Branch(
"simvtx_z" , &simvtx_z);
961 t->Branch(
"simvtx_sourceSimIdx", &simvtx_sourceSimIdx);
962 t->Branch(
"simvtx_daughterSimIdx", &simvtx_daughterSimIdx);
964 t->Branch(
"simpv_idx" , &simpv_idx);
1212 using namespace edm;
1213 using namespace reco;
1214 using namespace std;
1234 LogDebug(
"TrackingNtuple") <<
"Analyzing new event";
1250 for(
size_t i=0,
size=TPCollectionH->size();
i<
size; ++
i) {
1257 tmpTPptr = TPCollectionHRefVector.product();
1258 for(
const auto& ref: *tmpTPptr) {
1259 tmpTPkeys.insert(ref.key());
1266 for(
size_t i=0;
i<tpCollection.size(); ++
i) {
1267 tpKeyToIndex[tpCollection[
i].key()] =
i;
1278 for(
size_t i=0;
i<tvs.size(); ++
i) {
1282 tvKeyToIndex[
i] = tvRefs.size();
1297 std::vector<TPHitIndex> tpHitList;
1299 std::set<edm::ProductID> hitProductIds;
1300 std::map<edm::ProductID, size_t> seedCollToOffset;
1309 const auto& pixelDigiSimLinks = *pixelDigiSimLinksHandle;
1313 const auto& stripDigiSimLinks = *stripDigiSimLinksHandle;
1318 BeamSpot const & bs = *recoBeamSpotHandle;
1322 vector<pair<int,int> > monoStereoClusterList;
1325 fillSimHits(
tracker, tpKeyToIndex, *simHitsTPAssoc, tTopo, simHitRefKeyToIndex, tpHitList);
1328 fillPixelHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, pixelDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
1331 fillStripRphiStereoHits(iEvent, clusterToTPMap, tpKeyToIndex, *simHitsTPAssoc, stripDigiSimLinks, *theTTRHBuilder, tTopo, simHitRefKeyToIndex, hitProductIds);
1339 fillSeeds(iEvent, tpCollection, tpKeyToIndex, bs, associatorByHits, *theTTRHBuilder, theMF.product(), monoStereoClusterList, hitProductIds, seedCollToOffset);
1351 fillTracks(trackRefs, tpCollection, tpKeyToIndex, bs, associatorByHits, *theTTRHBuilder, tTopo, hitProductIds, seedCollToOffset);
1356 fillTrackingParticles(iEvent, iSetup, trackRefs, tpCollection, tvKeyToIndex, associatorByHits, tpHitList);
1380 template <
typename SimLink>
struct GetCluster;
1391 template <
typename SimLink>
1393 DetId hitId,
int clusterKey,
1404 auto simTrackIdToChargeFraction = chargeFraction(GetCluster<SimLink>::call(cluster), hitId, digiSimLinks);
1407 auto range = clusterToTPMap.
equal_range( cluster );
1408 if( range.first != range.second ) {
1409 for(
auto ip=range.first; ip != range.second; ++ip ) {
1413 const auto event = trackingParticle->eventId().event();
1414 const auto bx = trackingParticle->eventId().bunchCrossing();
1422 auto tpIndex = tpKeyToIndex.find(trackingParticle.
key());
1423 if( tpIndex == tpKeyToIndex.end())
1425 if( trackingParticle->numberOfHits() == 0 )
continue;
1428 std::pair<TrackingParticleRef, TrackPSimHitRef> simHitTPpairWithDummyTP(trackingParticle,
TrackPSimHitRef());
1430 auto range = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
1433 bool foundElectron =
false;
1435 for(
auto ip = range.first; ip != range.second; ++ip) {
1440 if(
std::abs(TPhit->particleType()) == 11 &&
std::abs(trackingParticle->pdgId()) != 11) {
1441 foundElectron =
true;
1445 simHitKey = TPhit.
key();
1446 simHitID = TPhit.
id();
1456 auto ex =
cms::Exception(
"LogicError") <<
"Did not find SimHit for reco hit DetId " << hitId.
rawId()
1457 <<
" for TP " << trackingParticle.
key() <<
" bx:event " << bx <<
":" <<
event
1458 <<
".\nFound SimHits from detectors ";
1459 for(
auto ip = range.first; ip != range.second; ++ip) {
1462 ex << dId.
rawId() <<
" ";
1464 if(trackingParticle->eventId().event() != 0) {
1465 ex <<
"\nSince this is a TrackingParticle from pileup, check that you're running the pileup mixing in playback mode.";
1469 auto simHitIndex = simHitRefKeyToIndex.at(std::make_pair(simHitKey, simHitID));
1472 double chargeFraction = 0.;
1473 for(
const SimTrack& simtrk: trackingParticle->g4Tracks()) {
1474 auto found = simTrackIdToChargeFraction.find(simtrk.trackId());
1475 if(found != simTrackIdToChargeFraction.end()) {
1476 chargeFraction += found->second;
1486 simhit_hitType[simHitIndex].push_back(static_cast<int>(hitType));
1498 std::vector<TPHitIndex>& tpHitList) {
1500 for(
const auto& assoc: simHitsTPAssoc) {
1501 auto tpKey = assoc.first.key();
1505 auto found = tpKeyToIndex.find(tpKey);
1506 if(found == tpKeyToIndex.end())
1508 const auto tpIndex = found->second;
1511 const auto& simhit = *(assoc.second);
1512 auto detId =
DetId(simhit.detUnitId());
1522 auto simHitKey = std::make_pair(assoc.second.key(), assoc.second.id());
1524 if(simHitRefKeyToIndex.find(simHitKey) != simHitRefKeyToIndex.end()) {
1525 for(
const auto& assoc2: simHitsTPAssoc) {
1526 if(std::make_pair(assoc2.second.key(), assoc2.second.id()) == simHitKey) {
1529 auto range1 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
1532 auto range2 = std::equal_range(simHitsTPAssoc.begin(), simHitsTPAssoc.end(),
1536 LogTrace(
"TrackingNtuple") <<
"Earlier TP " << assoc2.first.key() <<
" SimTrack Ids";
1537 for(
const auto& simTrack: assoc2.first->g4Tracks()) {
1538 edm::LogPrint(
"TrackingNtuple") <<
" SimTrack " << simTrack.trackId() <<
" BX:event " << simTrack.eventId().bunchCrossing() <<
":" << simTrack.eventId().event();
1540 for(
auto iHit = range2.first; iHit != range2.second; ++iHit) {
1541 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();
1543 LogTrace(
"TrackingNtuple") <<
"Current TP " << assoc.first.key() <<
" SimTrack Ids";
1544 for(
const auto& simTrack: assoc.first->g4Tracks()) {
1545 edm::LogPrint(
"TrackingNtuple") <<
" SimTrack " << simTrack.trackId() <<
" BX:event " << simTrack.eventId().bunchCrossing() <<
":" << simTrack.eventId().event();
1547 for(
auto iHit = range1.first; iHit != range1.second; ++iHit) {
1548 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();
1552 throw cms::Exception(
"LogicError") <<
"Got second time the SimHit " << simHitKey.first <<
" of " << simHitKey.second <<
", first time with TrackingParticle " << assoc2.first.key() <<
", now with " << tpKey;
1555 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!";
1560 throw cms::Exception(
"LogicError") <<
"Did not find a det unit for DetId " << simhit.detUnitId() <<
" from tracker geometry";
1562 const auto pos = det->surface().toGlobal(simhit.localPosition());
1563 const float tof = simhit.timeOfFlight();
1566 simHitRefKeyToIndex[simHitKey] = simHitIndex;
1585 tpHitList.emplace_back(tpKey, simHitIndex, tof, simhit.detUnitId());
1597 std::set<edm::ProductID>& hitProductIds
1601 for (
auto it = pixelHits->begin(); it!=pixelHits->end(); it++ ) {
1602 const DetId hitId = it->detId();
1603 for (
auto hit = it->begin();
hit!=it->end();
hit++ ) {
1606 hitProductIds.insert(
hit->cluster().
id());
1608 const int key =
hit->cluster().key();
1609 const int lay = tTopo.
layer(hitId);
1611 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Pixel);
1621 pix_x .push_back( ttrh->globalPosition().x() );
1622 pix_y .push_back( ttrh->globalPosition().y() );
1623 pix_z .push_back( ttrh->globalPosition().z() );
1624 pix_xx .push_back( ttrh->globalPositionError().cxx() );
1625 pix_xy .push_back( ttrh->globalPositionError().cyx() );
1626 pix_yy .push_back( ttrh->globalPositionError().cyy() );
1627 pix_yz .push_back( ttrh->globalPositionError().czy() );
1628 pix_zz .push_back( ttrh->globalPositionError().czz() );
1629 pix_zx .push_back( ttrh->globalPositionError().czx() );
1631 pix_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
1632 pix_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
1633 LogTrace(
"TrackingNtuple") <<
"pixHit cluster=" << key
1636 <<
" rawId=" << hitId.
rawId()
1637 <<
" pos =" << ttrh->globalPosition()
1641 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
1647 <<
" event=" << simHitData.
event[0];
1662 std::set<edm::ProductID>& hitProductIds
1669 int totalStripHits = rphiHits->dataSize()+stereoHits->dataSize();
1672 str_det .resize(totalStripHits);
1673 str_lay .resize(totalStripHits);
1679 str_x .resize(totalStripHits);
1680 str_y .resize(totalStripHits);
1681 str_z .resize(totalStripHits);
1682 str_xx .resize(totalStripHits);
1683 str_xy .resize(totalStripHits);
1684 str_yy .resize(totalStripHits);
1685 str_yz .resize(totalStripHits);
1686 str_zz .resize(totalStripHits);
1687 str_zx .resize(totalStripHits);
1693 for(
const auto& detset: hits) {
1694 const DetId hitId = detset.detId();
1695 for(
const auto&
hit: detset) {
1698 hitProductIds.insert(
hit.cluster().
id());
1700 const int key =
hit.cluster().key();
1701 const int lay = tTopo.
layer(hitId);
1703 clusterToTPMap, tpKeyToIndex, simHitsTPAssoc, digiSimLink, simHitRefKeyToIndex,
HitType::Strip);
1711 str_x [
key] = ttrh->globalPosition().x();
1712 str_y [
key] = ttrh->globalPosition().y();
1713 str_z [
key] = ttrh->globalPosition().z();
1714 str_xx [
key] = ttrh->globalPositionError().cxx();
1715 str_xy [
key] = ttrh->globalPositionError().cyx();
1716 str_yy [
key] = ttrh->globalPositionError().cyy();
1717 str_yz [
key] = ttrh->globalPositionError().czy();
1718 str_zz [
key] = ttrh->globalPositionError().czz();
1719 str_zx [
key] = ttrh->globalPositionError().czx();
1721 str_radL [
key] = ttrh->surface()->mediumProperties().radLen();
1722 str_bbxi [
key] = ttrh->surface()->mediumProperties().xi();
1723 LogTrace(
"TrackingNtuple") << name <<
" cluster=" << key
1726 <<
" rawId=" << hitId.
rawId()
1727 <<
" pos =" << ttrh->globalPosition()
1731 LogTrace(
"TrackingNtuple") <<
" firstMatchingSimHit=" << simHitIdx
1738 <<
" event=" << simHitData.
event[0];
1744 fill(*rphiHits,
"stripRPhiHit",
false);
1745 fill(*stereoHits,
"stripStereoHit",
true);
1751 std::vector<std::pair<int, int> >& monoStereoClusterList
1755 for (
auto it = matchedHits->begin(); it!=matchedHits->end(); it++ ) {
1756 const DetId hitId = it->detId();
1757 for (
auto hit = it->begin();
hit!=it->end();
hit++ ) {
1759 const int lay = tTopo.
layer(hitId);
1760 monoStereoClusterList.emplace_back(
hit->monoHit().cluster().key(),
hit->stereoHit().cluster().key());
1768 glu_x .push_back( ttrh->globalPosition().x() );
1769 glu_y .push_back( ttrh->globalPosition().y() );
1770 glu_z .push_back( ttrh->globalPosition().z() );
1771 glu_xx .push_back( ttrh->globalPositionError().cxx() );
1772 glu_xy .push_back( ttrh->globalPositionError().cyx() );
1773 glu_yy .push_back( ttrh->globalPositionError().cyy() );
1774 glu_yz .push_back( ttrh->globalPositionError().czy() );
1775 glu_zz .push_back( ttrh->globalPositionError().czz() );
1776 glu_zx .push_back( ttrh->globalPositionError().czx() );
1777 glu_radL .push_back( ttrh->surface()->mediumProperties().radLen() );
1778 glu_bbxi .push_back( ttrh->surface()->mediumProperties().xi() );
1779 LogTrace(
"TrackingNtuple") <<
"stripMatchedHit"
1780 <<
" cluster0=" <<
hit->stereoHit().cluster().key()
1781 <<
" cluster1=" <<
hit->monoHit().cluster().key()
1784 <<
" rawId=" << hitId.
rawId()
1785 <<
" pos =" << ttrh->globalPosition();
1797 const std::vector<std::pair<int, int> >& monoStereoClusterList,
1798 const std::set<edm::ProductID>& hitProductIds,
1799 std::map<edm::ProductID, size_t>& seedCollToOffset
1804 iEvent.
getByToken(seedToken, seedTracksHandle);
1805 const auto& seedTracks = *seedTracksHandle;
1807 if(seedTracks.empty())
1813 seedTrackRefs.
push_back(seedTracks.refAt(
i));
1821 label.ReplaceAll(
"seedTracks",
"");
1822 label.ReplaceAll(
"Seeds",
"");
1823 label.ReplaceAll(
"muonSeeded",
"muonSeededStep");
1827 auto inserted = seedCollToOffset.emplace(
id,
see_fitok.size());
1828 if(!inserted.second)
1829 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.";
1832 LogTrace(
"TrackingNtuple") <<
"NEW SEED LABEL: " << label <<
" size: " << seedTracks.size() <<
" algo=" << algo
1833 <<
" ProductID " << id;
1835 for(
const auto& seedTrackRef: seedTrackRefs) {
1836 const auto& seedTrack = *seedTrackRef;
1837 const auto& seedRef = seedTrack.seedRef();
1838 const auto&
seed = *seedRef;
1840 if(seedRef.id() != id)
1841 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 <<
".";
1843 std::vector<float> sharedFraction;
1844 std::vector<int> tpIdx;
1845 auto foundTPs = recSimColl.
find(seedTrackRef);
1846 if (foundTPs != recSimColl.
end()) {
1847 for(
const auto tpQuality: foundTPs->val) {
1848 sharedFraction.push_back(tpQuality.second);
1849 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
1855 const int charge = seedTrack.charge();
1856 const float pt = seedFitOk ? seedTrack.pt() : 0;
1857 const float eta = seedFitOk ? seedTrack.eta() : 0;
1858 const float phi = seedFitOk ? seedTrack.phi() : 0;
1859 const int nHits = seedTrack.numberOfValidHits();
1861 const auto seedIndex =
see_fitok.size();
1865 see_px .push_back( seedFitOk ? seedTrack.px() : 0 );
1866 see_py .push_back( seedFitOk ? seedTrack.py() : 0 );
1867 see_pz .push_back( seedFitOk ? seedTrack.pz() : 0 );
1871 see_q .push_back( charge );
1876 see_ptErr .push_back( seedFitOk ? seedTrack.ptError() : 0);
1877 see_etaErr .push_back( seedFitOk ? seedTrack.etaError() : 0);
1878 see_phiErr .push_back( seedFitOk ? seedTrack.phiError() : 0);
1879 see_dxyErr .push_back( seedFitOk ? seedTrack.dxyError() : 0);
1880 see_dzErr .push_back( seedFitOk ? seedTrack.dzError() : 0);
1899 std::vector<int> hitIdx;
1900 std::vector<int> hitType;
1904 int subid = recHit->geographicalId().subdetId();
1910 checkProductID(hitProductIds, clusterRef.id(),
"seed");
1913 hitIdx.push_back( clusterKey );
1925 std::vector<std::pair<int,int> >::const_iterator pos =
find( monoStereoClusterList.begin(), monoStereoClusterList.end(), std::make_pair(monoIdx,stereoIdx) );
1926 const auto gluedIndex =
std::distance(monoStereoClusterList.begin(), pos);
1928 hitIdx.push_back( gluedIndex );
1935 checkProductID(hitProductIds, clusterRef.id(),
"seed");
1938 hitIdx.push_back( clusterKey );
1953 std::vector<GlobalPoint>
gp(2);
1954 std::vector<GlobalError> ge(2);
1955 gp[0] = recHit0->globalPosition();
1956 ge[0] = recHit0->globalPositionError();
1957 gp[1] = recHit1->globalPosition();
1958 ge[1] = recHit1->globalPositionError();
1959 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
1960 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
1961 <<
" - PAIR - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId()
1962 <<
" hitpos: " << gp[0] <<
" " << gp[1]
1963 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
1964 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
1965 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
1966 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
1967 <<
" eta,phi: " << gp[0].
eta() <<
"," << gp[0].phi();
1968 }
else if (nHits==3) {
1975 gp[0] = recHit0->globalPosition();
1976 ge[0] = recHit0->globalPositionError();
1977 int subid0 = recHit0->geographicalId().subdetId();
1979 gp[1] = recHit1->globalPosition();
1980 ge[1] = recHit1->globalPositionError();
1981 int subid1 = recHit1->geographicalId().subdetId();
1983 gp[2] = recHit2->globalPosition();
1984 ge[2] = recHit2->globalPositionError();
1985 int subid2 = recHit2->geographicalId().subdetId();
1988 float seed_chi2 = rzLine.
chi2();
1991 LogTrace(
"TrackingNtuple") <<
"seed " << seedTrackRef.key()
1992 <<
" pt=" << pt <<
" eta=" << eta <<
" phi=" << phi <<
" q=" << charge
1993 <<
" - TRIPLET - ids: " << recHit0->geographicalId().rawId() <<
" " << recHit1->geographicalId().rawId() <<
" " << recHit2->geographicalId().rawId()
1994 <<
" hitpos: " <<
gp[0] <<
" " <<
gp[1] <<
" " <<
gp[2]
1995 <<
" trans0: " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
1996 <<
" " << (recHit0->transientHits().size()>1 ? recHit0->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
1997 <<
" trans1: " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
1998 <<
" " << (recHit1->transientHits().size()>1 ? recHit1->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
1999 <<
" trans2: " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[0]->globalPosition() :
GlobalPoint(0,0,0))
2000 <<
" " << (recHit2->transientHits().size()>1 ? recHit2->transientHits()[1]->globalPosition() :
GlobalPoint(0,0,0))
2001 <<
" local: " << recHit2->localPosition()
2003 <<
" eta,phi: " <<
gp[0].eta() <<
"," <<
gp[0].phi()
2004 <<
" pt,chi2: " << seed_pt <<
"," << seed_chi2;
2019 const std::set<edm::ProductID>& hitProductIds,
2020 const std::map<edm::ProductID, size_t>& seedCollToOffset
2025 LogTrace(
"TrackingNtuple") <<
"NEW TRACK LABEL: " << labels.
module;
2026 for(
size_t iTrack = 0; iTrack<tracks.
size(); ++iTrack) {
2027 const auto& itTrack = tracks[iTrack];
2029 bool isSimMatched =
false;
2030 std::vector<float> sharedFraction;
2031 std::vector<int> tpIdx;
2032 auto foundTPs = recSimColl.
find(itTrack);
2033 if (foundTPs != recSimColl.
end()) {
2034 if (!foundTPs->val.empty()) {
2035 nSimHits = foundTPs->val[0].first->numberOfTrackerHits();
2036 isSimMatched =
true;
2038 for(
const auto tpQuality: foundTPs->val) {
2039 sharedFraction.push_back(tpQuality.second);
2040 tpIdx.push_back( tpKeyToIndex.at( tpQuality.first.key() ) );
2043 int charge = itTrack->charge();
2044 float pt = itTrack->pt();
2045 float eta = itTrack->eta();
2046 const double lambda = itTrack->lambda();
2047 float chi2 = itTrack->normalizedChi2();
2048 float phi = itTrack->phi();
2049 int nHits = itTrack->numberOfValidHits();
2051 trk_px .push_back(itTrack->px());
2052 trk_py .push_back(itTrack->py());
2053 trk_pz .push_back(itTrack->pz());
2058 trk_inner_pt.push_back(itTrack->innerMomentum().rho());
2062 trk_outer_pt.push_back(itTrack->outerMomentum().rho());
2069 trk_ptErr .push_back(itTrack->ptError());
2074 trk_dzErr .push_back(itTrack->dzError());
2078 trk_nChi2 .push_back( itTrack->normalizedChi2());
2080 trk_q .push_back(charge);
2090 trk_algo .push_back(itTrack->algo());
2096 auto offset = seedCollToOffset.find(itTrack->seedRef().id());
2097 if(
offset == seedCollToOffset.end()) {
2100 <<
"' refers to seed collection " << itTrack->seedRef().id()
2101 <<
", but that seed collection is not given as an input. The following collections were given as an input " << make_ProductIDMapPrinter(seedCollToOffset);
2104 const auto seedIndex =
offset->second + itTrack->seedRef().key();
2107 throw cms::Exception(
"LogicError") <<
"Track index has already been set for seed " << seedIndex <<
" to " <<
see_trkIdx[seedIndex] <<
"; was trying to set it to " << iTrack;
2113 LogTrace(
"TrackingNtuple") <<
"Track #" << itTrack.key() <<
" with q=" << charge
2114 <<
", pT=" << pt <<
" GeV, eta: " << eta <<
", phi: " << phi
2115 <<
", chi2=" << chi2
2116 <<
", Nhits=" << nHits
2117 <<
", algo=" << itTrack->algoName(itTrack->algo()).c_str()
2119 <<
" seed#=" << itTrack->seedRef().key()
2120 <<
" simMatch=" << isSimMatched
2121 <<
" nSimHits=" << nSimHits
2122 <<
" sharedFraction=" << (sharedFraction.empty()?-1:sharedFraction[0])
2123 <<
" tpIdx=" << (tpIdx.empty()?-1:tpIdx[0]);
2124 std::vector<int> hitIdx;
2125 std::vector<int> hitType;
2127 for(
auto i=itTrack->recHitsBegin();
i!=itTrack->recHitsEnd();
i++) {
2129 DetId hitId = hit->geographicalId();
2137 if (hit->isValid()) {
2141 const auto clusterKey = clusterRef.
isPixel() ? clusterRef.cluster_pixel().key() : clusterRef.cluster_strip().key();
2143 LogTrace(
"TrackingNtuple") <<
" id: " << hitId.
rawId() <<
" - globalPos =" << hit->globalPosition()
2144 <<
" cluster=" << clusterKey
2145 <<
" eta,phi: " << hit->globalPosition().eta() <<
"," << hit->globalPosition().phi();
2147 checkProductID(hitProductIds, clusterRef.id(),
"track");
2148 if(isPixel)
pix_trkIdx[clusterKey].push_back(iTrack);
2149 else str_trkIdx[clusterKey].push_back(iTrack);
2152 hitIdx.push_back(clusterKey);
2155 LogTrace(
"TrackingNtuple") <<
" - invalid hit";
2164 inv_type .push_back( hit->getType() );
2180 const std::vector<TPHitIndex>& tpHitList
2189 const auto& nLayers_tPCeff = *tpNLayersH;
2192 const auto& nPixelLayers_tPCeff = *tpNLayersH;
2195 const auto& nStripMonoAndStereoLayers_tPCeff = *tpNLayersH;
2200 LogTrace(
"TrackingNtuple") <<
"tracking particle pt=" << tp->pt() <<
" eta=" << tp->eta() <<
" phi=" << tp->phi();
2201 bool isRecoMatched =
false;
2202 std::vector<int> tkIdx;
2203 std::vector<float> sharedFraction;
2204 auto foundTracks = simRecColl.
find(tp);
2205 if(foundTracks != simRecColl.
end()) {
2206 isRecoMatched =
true;
2212 LogTrace(
"TrackingNtuple") <<
"matched to tracks = " << make_VectorPrinter(tkIdx) <<
" isRecoMatched=" << isRecoMatched;
2213 sim_event .push_back(tp->eventId().event());
2216 sim_px .push_back(tp->px());
2217 sim_py .push_back(tp->py());
2218 sim_pz .push_back(tp->pz());
2219 sim_pt .push_back(tp->pt());
2220 sim_eta .push_back(tp->eta());
2221 sim_phi .push_back(tp->phi());
2222 sim_q .push_back(tp->charge());
2226 std::vector<int> decayIdx;
2227 for(
const auto&
v: tp->decayVertices())
2228 decayIdx.push_back( tvKeyToIndex.at(
v.key()) );
2234 float dxySim = (-vertex.x()*
sin(momentum.phi())+vertex.y()*
cos(momentum.phi()));
2235 float dzSim = vertex.z() - (vertex.x()*momentum.x()+vertex.y()*momentum.y())/
sqrt(momentum.perp2())
2236 * momentum.z()/
sqrt(momentum.perp2());
2237 const double lambdaSim =
M_PI/2 - momentum.theta();
2246 std::vector<int> hitIdx;
2247 int nPixel=0, nStrip=0;
2249 for(
auto ip = rangeHit.first; ip != rangeHit.second; ++ip) {
2253 LogTrace(
"TrackingNtuple") <<
"simhit=" << ip->simHitIdx <<
" type=" <<
static_cast<int>(
type);
2254 hitIdx.push_back(ip->simHitIdx);
2257 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose det() is not Tracker but " << detid.det();
2259 const auto subdet = detid.subdetId();
2272 throw cms::Exception(
"LogicError") <<
"Encountered SimHit for TP " << tp.key() <<
" with DetId " << detid.rawId() <<
" whose subdet is not recognized, is " << subdet;
2279 const auto nSimLayers = nLayers_tPCeff[tp];
2280 const auto nSimPixelLayers = nPixelLayers_tPCeff[tp];
2281 const auto nSimStripMonoAndStereoLayers = nStripMonoAndStereoLayers_tPCeff[tp];
2284 sim_n3DLay .push_back( nSimPixelLayers+nSimStripMonoAndStereoLayers );
2292 for(
size_t iVertex=0,
size=vertices.size(); iVertex<
size; ++iVertex) {
2294 vtx_x.push_back(vertex.
x());
2295 vtx_y.push_back(vertex.
y());
2296 vtx_z.push_back(vertex.
z());
2305 std::vector<int> trkIdx;
2308 if(iTrack->id() != tracks.
id())
2311 trkIdx.push_back(iTrack->key());
2314 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;
2325 int current_event = -1;
2326 for(
const auto& ref: trackingVertices) {
2336 processType = v.
g4Vertices()[0].processType();
2348 for(
const auto& tpRef: tps) {
2349 auto found = tpKeyToIndex.find(tpRef.key());
2350 if(found != tpKeyToIndex.end()) {
2351 idx.push_back(tpRef.key());
2356 std::vector<int> sourceIdx;
2357 std::vector<int> daughterIdx;
2371 desc.
addUntracked<std::vector<edm::InputTag> >(
"seedTracks", std::vector<edm::InputTag>{
2385 desc.
addUntracked<
bool>(
"trackingParticlesRef",
false);
2405 descriptions.
add(
"trackingNtuple",desc);
int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< unsigned short > str_lay
std::vector< float > sim_pca_dz
edm::LuminosityBlockNumber_t ev_lumi
static const std::string kSharedResource
std::vector< unsigned int > simvtx_processType
edm::EDGetTokenT< TrackingParticleRefVector > trackingParticleRefToken_
std::vector< unsigned int > sim_nLay
beamSpotToken_(consumes< reco::BeamSpot >(iConfig.getUntrackedParameter< edm::InputTag >("beamSpot")))
EventNumber_t event() const
void fillTrackingVertices(const TrackingVertexRefVector &trackingVertices, const TrackingParticleRefKeyToIndex &tpKeyToIndex)
const TrackerGeomDet * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > stripMatchedRecHitToken_
std::vector< short > see_fitok
tpNLayersToken_(consumes< edm::ValueMap< unsigned int > >(iConfig.getUntrackedParameter< edm::InputTag >("trackingParticleNlayers")))
std::vector< short > vtx_fake
std::vector< float > simvtx_z
std::vector< std::vector< int > > see_hitType
edm::EDGetTokenT< SiStripRecHit2DCollection > stripRphiRecHitToken_
tuple ret
prodAgent to be discontinued
const TrackingParticleRefVector & sourceTracks() const
std::vector< float > trk_phi
SiPixelCluster const & pixelCluster() const
std::vector< float > sim_pca_cotTheta
std::vector< float > sim_pca_dxy
std::vector< unsigned int > trk_nOuterLost
std::vector< float > glu_xy
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 > 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 trackFromSeedFitFailed(const reco::Track &track)
std::vector< float > trk_outer_py
std::unordered_map< reco::RecoToSimCollection::index_type, size_t > TrackingParticleRefKeyToIndex
std::vector< float > pix_zz
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< int > glu_monoIdx
std::vector< float > trk_eta
std::vector< short > glu_isBarrel
std::vector< int > sim_bunchCrossing
std::vector< unsigned int > glu_lay
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
trackingVertexToken_(consumes< TrackingVertexCollection >(iConfig.getUntrackedParameter< edm::InputTag >("trackingVertices")))
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
const_iterator end() const
last iterator over the map (read only)
std::vector< unsigned short > inv_lay
std::vector< float > str_x
std::vector< float > see_dzErr
vertexToken_(consumes< reco::VertexCollection >(iConfig.getUntrackedParameter< edm::InputTag >("vertices")))
std::vector< unsigned int > sim_n3DLay
std::vector< float > trk_cotTheta
stripStereoRecHitToken_(consumes< SiStripRecHit2DCollection >(iConfig.getUntrackedParameter< edm::InputTag >("stripStereoRecHits")))
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< unsigned int > see_nStrip
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 > 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
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
std::vector< float > trk_pt
std::vector< float > glu_x
std::vector< unsigned int > glu_det
std::vector< float > trk_inner_py
Sin< T >::type sin(const T &t)
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
edm::EDGetTokenT< edm::View< reco::Track > > trackToken_
Global3DPoint GlobalPoint
void fillBeamSpot(const reco::BeamSpot &bs)
std::vector< float > trk_outer_px
void fillTracks(const edm::RefToBaseVector< reco::Track > &tracks, const TrackingParticleRefVector &tpCollection, const TrackingParticleRefKeyToIndex &tpKeyToIndex, const reco::BeamSpot &bs, const reco::TrackToTrackingParticleAssociator &associatorByHits, const TransientTrackingRecHitBuilder &theTTRHBuilder, const TrackerTopology &tTopo, const std::set< edm::ProductID > &hitProductIds, const std::map< edm::ProductID, size_t > &seedToCollIndex)
std::vector< std::vector< int > > trk_hitType
TrackingParticleRefKeyToIndex TrackingVertexRefKeyToIndex
unsigned long long EventNumber_t
int numberOfValidStripHits() 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::pair< TrackPSimHitRef::key_type, edm::ProductID > SimHitFullKey
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< unsigned short > simhit_det
std::vector< unsigned int > inv_detId
std::vector< int > simhit_simTrkIdx
key_type key() const
Accessor for product key.
std::vector< std::vector< float > > sim_shareFrac
std::vector< short > str_isStereo
int pixelLayersWithMeasurement() const
static bool tpHitIndexListLess(const TPHitIndex &i, const TPHitIndex &j)
TrackingNtuple(const edm::ParameterSet &)
void fillTrackingParticles(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::RefToBaseVector< reco::Track > &tracks, const TrackingParticleRefVector &tpCollection, const TrackingVertexRefKeyToIndex &tvKeyToIndex, const reco::TrackToTrackingParticleAssociator &associatorByHits, const std::vector< TPHitIndex > &tpHitList)
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
stripMatchedRecHitToken_(consumes< SiStripMatchedRecHit2DCollection >(iConfig.getUntrackedParameter< edm::InputTag >("stripMatchedRecHits")))
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
ProductID id() const
Accessor for product ID.
std::vector< int > simpv_idx
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelSimLinkToken_
std::vector< unsigned int > trk_stopReason
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 > inv_isBarrel
uint32_t rawId() const
get the raw id
math::XYZPointD Point
point in the space
std::vector< float > see_etaErr
std::vector< float > simhit_z
std::vector< float > trk_refpoint_y
std::vector< int > sim_event
std::vector< unsigned int > trk_nStrip
SiStripCluster const & stripCluster() const
std::vector< float > chargeFraction
edm::EDGetTokenT< edm::ValueMap< unsigned int > > tpNStripStereoLayersToken_
std::string parametersDefinerName_
std::vector< unsigned int > trk_nPixel
std::vector< float > glu_y
std::vector< float > trk_pz
std::vector< float > trk_dzErr
std::vector< float > trk_lambdaErr
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
edm::EDGetTokenT< SiPixelRecHitCollection > pixelRecHitToken_
std::vector< unsigned short > pix_lay
std::vector< std::vector< int > > simvtx_sourceSimIdx
trackAssociatorToken_(consumes< reco::TrackToTrackingParticleAssociator >(iConfig.getUntrackedParameter< edm::InputTag >("trackAssociator")))
std::vector< float > trk_etaErr
std::vector< short > pix_isBarrel
std::vector< float > glu_yz
std::vector< float > sim_pca_phi
std::vector< unsigned int > trk_algo
std::vector< float > vtx_y
std::vector< float > pix_z
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
int bunchCrossing() const
get the detector field from this detid
std::vector< int > bunchCrossing
std::vector< float > sim_eta
std::vector< unsigned int > trk_originalAlgo
usesResource(TFileService::kSharedResource)
std::vector< unsigned int > trk_nInnerLost
ClusterStripRef cluster_strip() const
std::vector< float > str_y
std::vector< unsigned short > pix_det
std::vector< int > sim_pdgId
Cos< T >::type cos(const T &t)
std::vector< std::vector< int > > simhit_hitType
std::vector< float > trk_refpoint_z
std::vector< edm::EDGetTokenT< edm::View< reco::Track > > > seedTokens_
edm::EDGetTokenT< SimHitTPAssociationProducer::SimHitTPAssociationList > simHitTPMapToken_
std::vector< float > pix_yz
std::vector< int > trk_seedIdx
std::vector< std::vector< float > > pix_chargeFraction
std::vector< float > vtx_yErr
std::vector< std::vector< int > > pix_trkIdx
includeSeeds_(iConfig.getUntrackedParameter< bool >("includeSeeds"))
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
simHitTPMapToken_(consumes< SimHitTPAssociationProducer::SimHitTPAssociationList >(iConfig.getUntrackedParameter< edm::InputTag >("simHitTPMap")))
std::vector< float > vtx_ndof
double chi2() const
chi-squares
std::vector< float > simvtx_x
double z() const
z coordinate
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
std::vector< float > sim_pca_pt
std::vector< float > see_dxyErr
bool isMatched(TrackingRecHit const &hit)
double BeamWidthX() const
beam width X
stripRphiRecHitToken_(consumes< SiStripRecHit2DCollection >(iConfig.getUntrackedParameter< edm::InputTag >("stripRphiRecHits")))
range equal_range(const OmniClusterRef &key) const
std::vector< float > see_pt
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
std::vector< float > trk_dz
pixelSimLinkToken_(consumes< edm::DetSetVector< PixelDigiSimLink > >(iConfig.getUntrackedParameter< edm::InputTag >("pixelDigiSimLink")))
std::vector< float > trk_ptErr
std::vector< unsigned int > simhit_detId
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)
builderName_(iConfig.getUntrackedParameter< std::string >("TTRHBuilder"))
std::vector< float > see_phi
OmniClusterRef const & monoClusterRef() const
std::vector< float > vtx_z
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::vector< float > see_pz
std::vector< float > trk_phiErr
std::vector< unsigned int > sim_nPixelLay
std::vector< float > trk_lambda
iterator end()
Return the off-the-end iterator.
std::vector< float > glu_zz
std::vector< float > sim_pca_lambda
std::vector< float > glu_zx
std::shared_ptr< TrackingRecHit const > RecHitPointer
std::vector< float > vtx_xErr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< std::vector< float > > trk_shareFrac
std::vector< float > sim_pz
std::vector< std::vector< int > > sim_simHitIdx
edm::Ref< TrackingVertexCollection > TrackingVertexRef
std::vector< unsigned short > inv_det
edm::EventNumber_t ev_event
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleToken_
double x() const
x coordinate
tpNPixelLayersToken_(consumes< edm::ValueMap< unsigned int > >(iConfig.getUntrackedParameter< edm::InputTag >("trackingParticleNpixellayers")))
std::vector< int > glu_stereoIdx
std::vector< unsigned short > simhit_lay
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< unsigned short > str_det
std::vector< unsigned int > see_nGlued
std::vector< float > see_py
std::vector< float > pix_x
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< float > str_zx
virtual OmniClusterRef const & firstClusterRef() const =0
std::vector< TrackingVertex > TrackingVertexCollection
double sigmaZ() const
sigma z
std::string algoName() const
int stripLayersWithMeasurement() const
T const * product() const
tpNStripStereoLayersToken_(consumes< edm::ValueMap< unsigned int > >(iConfig.getUntrackedParameter< edm::InputTag >("trackingParticleNstripstereolayers")))
std::vector< short > trk_isHP
std::vector< float > str_xy
double BeamWidthY() const
beam width Y
std::vector< std::vector< float > > str_chargeFraction
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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_
std::vector< short > vtx_valid
const EncodedEventId & eventId() const
edm::EDGetTokenT< ClusterTPAssociation > clusterTPMapToken_
Pixel cluster – collection of neighboring pixels above threshold.
std::vector< std::vector< int > > vtx_trkIdx
edm::ProductID id() const
std::vector< short > str_isBarrel
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
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< float > sim_pca_eta
void push_back(const RefToBase< T > &)
bool isPixel(HitType hitType)
std::map< SimHitFullKey, size_t > SimHitRefKeyToIndex
static int pixelToChannel(int row, int col)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
static TrackAlgorithm algoByName(const std::string &name)
double y0() const
y coordinate
std::vector< float > simhit_y
int numberOfValidPixelHits() const
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
std::vector< std::vector< int > > str_simHitIdx
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
std::vector< float > simhit_x
const Point & position() const
position
std::vector< float > simvtx_y
std::vector< std::vector< int > > simvtx_daughterSimIdx
std::vector< float > str_xx
#define declareDynArray(T, n, x)
pixelRecHitToken_(consumes< SiPixelRecHitCollection >(iConfig.getUntrackedParameter< edm::InputTag >("pixelRecHits")))
std::vector< unsigned int > see_offset
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
std::vector< int > see_trkIdx
math::XYZVectorD Vector
point in the space
std::vector< float > simhit_tof
Detector det() const
get the detector field from this detid
void fillVertices(const reco::VertexCollection &vertices, const edm::RefToBaseVector< reco::Track > &tracks)
std::vector< float > pix_xy
std::vector< float > trk_dxy
std::vector< float > sim_pt
std::vector< float > pix_yy
std::unordered_set< reco::RecoToSimCollection::index_type > TrackingParticleRefKeySet
parametersDefinerName_(iConfig.getUntrackedParameter< std::string >("parametersDefiner"))
std::vector< unsigned int > trk_nInvalid
stripSimLinkToken_(consumes< edm::DetSetVector< StripDigiSimLink > >(iConfig.getUntrackedParameter< edm::InputTag >("stripDigiSimLink")))
std::vector< decltype(reco::TrackBase().algoMaskUL())> trk_algoMask
std::vector< std::vector< int > > see_hitIdx
clusterTPMapToken_(consumes< ClusterTPAssociation >(iConfig.getUntrackedParameter< edm::InputTag >("clusterTPMap")))
std::vector< float > vtx_x
std::vector< unsigned int > see_nPixel
tuple size
Write out results.
edm::Ref< TrackingParticleCollection > TrackingParticleRef
std::vector< float > see_eta
const std::vector< uint8_t > & amplitudes() const
std::vector< unsigned int > trk_nValid
std::vector< float > trk_inner_px
double yError() const
error on y
std::vector< float > vtx_zErr
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< unsigned int > pix_detId
std::vector< float > simhit_eloss
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripSimLinkToken_
edm::Service< TFileService > fs
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
std::vector< unsigned int > glu_detId
trackToken_(consumes< edm::View< reco::Track > >(iConfig.getUntrackedParameter< edm::InputTag >("tracks")))
const LorentzVector & position() const
double x0() const
x coordinate
std::vector< unsigned int > sim_nStrip
std::vector< unsigned int > str_detId