115 const std::vector<Trajectory>&);
116 void insertMeasurement(std::multimap<
const uint32_t, std::pair<LocalPoint, double> >&,
123 const std::vector<Trajectory>&);
129 void insertMeasurement(std::multimap<
const uint32_t, std::pair<std::pair<float, float>,
int> >&,
136 std::map<uint32_t, float>
delay(
const std::vector<std::string>&);
167 std::multimap<const uint32_t, const FedChannelConnection*>
connections_;
228 : siStripClusterInfo_(consumesCollector(),
std::
string(
"")),
275 ntrajs_ =
new uint32_t[trackSize];
280 for (
size_t i = 0;
i < trackSize; ++
i) {
293 clusters_ =
dir->make<TTree>(
"clusters",
"cluster information");
296 for (
size_t i = 0;
i < trackSize; ++
i) {
299 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
300 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
324 pixclusters_ =
dir->make<TTree>(
"pixclusters",
"pixel cluster information");
327 for (
size_t i = 0;
i < trackSize; ++
i) {
330 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
331 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
350 for (
size_t i = 0;
i < trackSize; ++
i) {
353 sprintf(buffer1,
"tracks%lu", (
unsigned long)
i);
354 sprintf(buffer2,
"track%lu information", (
unsigned long)
i);
355 TTree* thetracks_ =
dir->make<TTree>(buffer1, buffer2);
356 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
357 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
359 thetracks_->Branch(
"eventid", &
eventid_,
"eventid/i");
360 thetracks_->Branch(
"runid", &
runid_,
"runid/i");
361 thetracks_->Branch(
"chi2", &
chi2_,
"chi2/F");
362 thetracks_->Branch(
"eta", &
eta_,
"eta/F");
363 thetracks_->Branch(
"etaerr", &
etaerr_,
"etaerr/F");
364 thetracks_->Branch(
"phi", &
phi_,
"phi/F");
365 thetracks_->Branch(
"phierr", &
phierr_,
"phierr/F");
366 thetracks_->Branch(
"dedx1", &
dedx1_,
"dedx1/F");
367 thetracks_->Branch(
"dedx2", &
dedx2_,
"dedx2/F");
368 thetracks_->Branch(
"dedx3", &
dedx3_,
"dedx3/F");
369 thetracks_->Branch(
"dedxNoM", &
dedxNoM_,
"dedxNoM/i");
370 thetracks_->Branch(
"charge", &
charge_,
"charge/F");
371 thetracks_->Branch(
"quality", &
quality_,
"quality/i");
372 thetracks_->Branch(
"foundhits", &
foundhits_,
"foundhits/i");
373 thetracks_->Branch(
"lostHits", &
lostHits_,
"lostHits/i");
374 thetracks_->Branch(
"foundhitsStrips", &
foundhitsStrips_,
"foundhitsStrips/i");
375 thetracks_->Branch(
"foundhitsPixels", &
foundhitsPixels_,
"foundhitsPixels/i");
376 thetracks_->Branch(
"losthitsStrips", &
losthitsStrips_,
"losthitsStrips/i");
377 thetracks_->Branch(
"losthitsPixels", &
losthitsPixels_,
"losthitsPixels/i");
378 thetracks_->Branch(
"p", &
p_,
"p/F");
379 thetracks_->Branch(
"pt", &
pt_,
"pt/F");
380 thetracks_->Branch(
"pterr", &
pterr_,
"pterr/F");
381 thetracks_->Branch(
"ndof", &
ndof_,
"ndof/i");
382 thetracks_->Branch(
"dz", &
dz_,
"dz/F");
383 thetracks_->Branch(
"dzerr", &
dzerr_,
"dzerr/F");
384 thetracks_->Branch(
"dzCorr", &
dzCorr_,
"dzCorr/F");
385 thetracks_->Branch(
"dxy", &
dxy_,
"dxy/F");
386 thetracks_->Branch(
"dxyerr", &
dxyerr_,
"dxyerr/F");
387 thetracks_->Branch(
"dxyCorr", &
dxyCorr_,
"dxyCorr/F");
388 thetracks_->Branch(
"qoverp", &
qoverp_,
"qoverp/F");
389 thetracks_->Branch(
"xPCA", &
xPCA_,
"xPCA/F");
390 thetracks_->Branch(
"yPCA", &
yPCA_,
"yPCA/F");
391 thetracks_->Branch(
"zPCA", &
zPCA_,
"zPCA/F");
392 thetracks_->Branch(
"nLayers", &
nLayers_,
"nLayers/i");
393 thetracks_->Branch(
"trkWeightpvtx", &
trkWeightpvtx_,
"trkWeightpvtx/F");
394 thetracks_->Branch(
"vertexid", &
vertexid_,
"vertexid/i");
399 for (
size_t i = 0;
i < trackSize; ++
i) {
402 sprintf(buffer1,
"misingHits%lu", (
unsigned long)
i);
403 sprintf(buffer2,
"missing hits from track collection %lu", (
unsigned long)
i);
404 TTree* themissingHits_ =
dir->make<TTree>(buffer1, buffer2);
405 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
406 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
408 themissingHits_->Branch(
"eventid", &
eventid_,
"eventid/i");
409 themissingHits_->Branch(
"runid", &
runid_,
"runid/i");
410 themissingHits_->Branch(
"detid", &
detid_,
"detid/i");
411 themissingHits_->Branch(
"type", &
type_,
"type/i");
412 themissingHits_->Branch(
"localX", &
clPositionX_,
"localX/F");
413 themissingHits_->Branch(
"localY", &
clPositionY_,
"localY/F");
414 themissingHits_->Branch(
"globalX", &
globalX_,
"globalX/F");
415 themissingHits_->Branch(
"globalY", &
globalY_,
"globalY/F");
416 themissingHits_->Branch(
"globalZ", &
globalZ_,
"globalZ/F");
417 themissingHits_->Branch(
"measX", &
measX_,
"measX/F");
418 themissingHits_->Branch(
"measY", &
measY_,
"measY/F");
419 themissingHits_->Branch(
"errorX", &
errorX_,
"errorX/F");
420 themissingHits_->Branch(
"errorY", &
errorY_,
"errorY/F");
425 vertices_ =
dir->make<TTree>(
"vertices",
"vertex information");
456 event_ =
dir->make<TTree>(
"events",
"event information");
471 sprintf(
buffer,
"ntracks[%lu]/i", (
unsigned long)trackSize);
473 sprintf(
buffer,
"ntrajs[%lu]/i", (
unsigned long)trackSize);
475 sprintf(
buffer,
"lowPixelProbabilityFraction[%lu]/F", (
unsigned long)trackSize);
495 event_->Branch(
"MagneticField", &
fBz_,
"MagneticField/F");
500 iConfig.
getUntrackedParameter<std::vector<std::string> >(
"DelayFileNames", std::vector<std::string>(0));
501 psumap_ =
dir->make<TTree>(
"psumap",
"PSU map");
536 using namespace reco;
543 bx_ =
iEvent.eventAuxiliary().bunchCrossing();
568 for (
int bit = 0; bit < 128; ++bit) {
572 for (
int bit = 0; bit < 64; ++bit) {
576 for (
int bit = 0; bit < 64; ++bit) {
583 size_t ntrh = trh->
size();
584 for (
size_t bit = 0; bit < 256; ++bit)
592 ?
Point(recoBeamSpotHandle->
x0(), recoBeamSpotHandle->
y0(), recoBeamSpotHandle->
z0())
594 if (recoBeamSpotHandle.
isValid()) {
616 for (reco::VertexCollection::const_iterator
v = vertexColl.begin();
v != vertexColl.end(); ++
v) {
617 if (
v->isValid() && !
v->isFake())
660 std::vector<edm::Handle<reco::TrackCollection> > trackCollectionHandle;
661 trackCollectionHandle.resize(trackSize);
676 std::vector<std::vector<Trajectory> > trajectoryCollection;
677 std::vector<edm::Handle<std::vector<Trajectory> > > trajectoryCollectionHandle;
678 trajectoryCollectionHandle.resize(trackSize);
688 trajectoryCollection.push_back(*trajectoryCollectionHandle[
index].product());
693 std::vector<TrajTrackAssociationCollection> TrajToTrackMap;
700 iEvent.getByToken(*
token, trajTrackAssociationHandle);
704 TrajToTrackMap.push_back(*trajTrackAssociationHandle.
product());
712 std::vector<std::map<size_t, int> > trackVertices;
713 for (
size_t i = 0;
i < trackSize; ++
i) {
719 for (reco::VertexCollection::const_iterator
v = vertexColl.begin();
v != vertexColl.end(); ++
v) {
737 for (reco::VertexCollection::const_iterator
v = pixelVertexColl.begin();
v != pixelVertexColl.end(); ++
v) {
755 std::vector<std::pair<double, double> > pixclusterOntrackAngles =
774 std::vector<std::vector<int> > stripClusterOntrackIndices;
775 for (
size_t i = 0;
i < trackSize; ++
i) {
778 std::vector<std::vector<int> > pixelClusterOntrackIndices;
779 for (
size_t i = 0;
i < trackSize; ++
i) {
783 stripClusterOntrackIndices[0].begin(), stripClusterOntrackIndices[0].
end(), [](
auto c) {
return c != -1; });
785 pixelClusterOntrackIndices[0].begin(), pixelClusterOntrackIndices[0].
end(), [](
auto c) {
return c != -1; });
789 uint32_t n_hits_barrel = 0;
790 uint32_t n_hits_lowprob = 0;
792 it != TrajToTrackMap[coll].end();
796 eta_ = itTrack->eta();
797 phi_ = itTrack->phi();
799 dedxNoM_ = dEdxTrack1[itTrack].numberOfMeasurements();
800 dedx1_ = dEdxTrack1[itTrack].dEdx();
801 dedx2_ = dEdxTrack2[itTrack].dEdx();
802 dedx3_ = dEdxTrack3[itTrack].dEdx();
817 nLayers_ = uint32_t(itTrack->hitPattern().trackerLayersWithMeasurement());
820 chi2_ = itTrack->chi2();
821 ndof_ = (uint32_t)itTrack->ndof();
823 dzerr_ = itTrack->dzError();
825 dxy_ = itTrack->dxy();
828 pterr_ = itTrack->ptError();
832 xPCA_ = itTrack->vertex().x();
833 yPCA_ = itTrack->vertex().y();
834 zPCA_ = itTrack->vertex().z();
836 if (!vertexColl.empty() && !vertexColl.begin()->isFake()) {
844 std::map<size_t, int>::const_iterator theV = trackVertices[coll].find(itTrack.
key());
845 vertexid_ = (theV != trackVertices[coll].end()) ? theV->second : 0;
849 for (Trajectory::DataContainer::const_iterator it = measurements.begin(); it != measurements.end(); ++it) {
851 if (!rechit->isValid()) {
853 detid_ = rechit->geographicalId();
855 type_ = rechit->getType();
861 GlobalPoint global = it->predictedState().globalPosition();
909 std::vector<double>::const_iterator angleIt = clusterOntrackAngles.begin();
910 uint32_t localCounter = 0;
915 uint32_t detid = DSViter->id();
919 ++iter, ++angleIt, ++localCounter) {
922 for (
size_t i = 0;
i < trackSize; ++
i) {
923 trackid_[
i] = stripClusterOntrackIndices[
i][localCounter];
929 thickness_ = ((((DSViter->id() >> 25) & 0x7f) == 0xd) ||
930 ((((DSViter->id() >> 25) & 0x7f) == 0xe) && (((DSViter->id() >> 5) & 0x7) > 4)))
934 int nstrips = static_cast<const StripGeomDetUnit*>(
tracker_->
idToDet(detid))->specificTopology().nstrips();
966 std::vector<std::pair<double, double> >::const_iterator pixAngleIt = pixclusterOntrackAngles.begin();
969 DSViter != pixelclusters->end();
973 uint32_t detid = DSViter->id();
977 ++iter, ++pixAngleIt, ++localCounter) {
979 for (
size_t i = 0;
i < trackSize; ++
i) {
980 trackid_[
i] = pixelClusterOntrackIndices[
i][localCounter];
988 alpha_ = pixAngleIt->first;
989 beta_ = pixAngleIt->second;
990 charge_ = (iter->charge()) / 1000.;
1036 for (std::vector<std::string>::const_iterator it =
hlNames_.begin(); it <
hlNames_.end(); ++it) {
1037 std::cout << (
i++) <<
" = " << (*it) << std::endl;
1047 auto feds = cabling.fedIds();
1049 auto connections = cabling.fedConnections(*
fedid);
1050 for (
auto conn = connections.begin();
conn < connections.end(); ++
conn) {
1052 if (
conn->isConnected())
1055 if (
conn->isConnected()) {
1080 if (!delayMap.empty())
1081 tmap.
save(
true, 0, 0,
"delaymap.png");
1085 if (cablingFile.is_open()) {
1087 cablingFile.getline(
buffer, 1024);
1088 while (!cablingFile.eof()) {
1094 while (!
line.eof()) {
1098 cablingFile.getline(
buffer, 1024);
1101 edm::LogWarning(
"BadConfig") <<
" The PSU file does not exist. The psumap tree will not be filled." << std::endl
1103 <<
" Please specify a valid filename through the PSUFileName untracked parameter.";
1109 for (
size_t i = 0;
i <
tracks_.size(); ++
i) {
1111 sprintf(
buffer,
"trackid%lu", (
unsigned long)
i);
1123 vertices_->BuildIndex(
"vertexid",
"eventid");
1124 if (
event_->GetEntries())
1125 event_->BuildIndex(
"runid",
"eventid");
1133 const std::vector<Trajectory>& trajVec) {
1134 std::vector<double>
result;
1136 std::multimap<const uint32_t, std::pair<LocalPoint, double> > onTrackPositions;
1137 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1139 for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1140 double tla = meas->updatedState().localDirection().theta();
1150 std::pair<std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator,
1151 std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator>
1152 range = onTrackPositions.equal_range(DSViter->id());
1156 for (std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator
cl =
range.first;
cl !=
range.second;
1178 }
else if (singlehit) {
1181 }
else if (multihit) {
1182 std::vector<const TrackingRecHit*> childs = multihit->
recHits();
1183 for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1191 uint32_t firstTrack) {
1194 std::multimap<const uint32_t, std::pair<int, int> > onTrackPositions;
1195 uint32_t trackid = firstTrack;
1196 for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1197 ++itTrack, ++trackid) {
1204 int thetrackid = -1;
1209 std::pair<std::multimap<uint32_t, std::pair<int, int> >::const_iterator,
1210 std::multimap<uint32_t, std::pair<int, int> >::const_iterator>
1211 range = onTrackPositions.equal_range(DSViter->id());
1214 for (std::multimap<uint32_t, std::pair<int, int> >::const_iterator
cl =
range.first;
cl !=
range.second; ++
cl) {
1215 if (fabs(
cl->second.first - iter->barycenter()) < 2) {
1216 thetrackid =
cl->second.second;
1219 result.push_back(thetrackid);
1236 }
else if (singlehit) {
1238 std::make_pair(
int(singlehit->
cluster()->barycenter()), trackid)));
1239 }
else if (multihit) {
1240 std::vector<const TrackingRecHit*> childs = multihit->
recHits();
1241 for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1249 uint32_t firstVertex) {
1251 std::map<size_t, int>
output;
1252 uint32_t vertexid = firstVertex;
1253 for (reco::VertexCollection::const_iterator
v =
vertices.begin();
v !=
vertices.end(); ++
v, ++vertexid) {
1256 for (; it != lastTrack; ++it) {
1257 output[it->key()] = vertexid;
1265 std::vector<std::pair<double, double> >
result;
1267 std::multimap<const uint32_t, std::pair<LocalPoint, std::pair<double, double> > > onTrackPositions;
1268 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1270 for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1271 LocalVector localDir = meas->updatedState().localDirection();
1272 double alpha = atan2(localDir.
z(), localDir.
x());
1273 double beta = atan2(localDir.
z(), localDir.
y());
1287 std::pair<std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator,
1288 std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator>
1289 range = onTrackPositions.equal_range(DSViter->id());
1291 for (std::multimap<uint32_t, std::pair<
LocalPoint, std::pair<double, double> > >::const_iterator
cl =
range.first;
1296 alpha =
cl->second.second.first;
1297 beta =
cl->second.second.second;
1322 uint32_t firstTrack) {
1325 std::multimap<const uint32_t, std::pair<std::pair<float, float>,
int> > onTrackPositions;
1326 uint32_t trackid = firstTrack;
1327 for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1328 ++itTrack, ++trackid) {
1335 int thetrackid = -1;
1342 std::pair<std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator,
1343 std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator>
1344 range = onTrackPositions.equal_range(DSViter->id());
1345 for (std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator
cl =
range.first;
1348 if ((fabs(
cl->second.first.first - iter->x()) < 2) && (fabs(
cl->second.first.second - iter->y()) < 2)) {
1349 thetrackid =
cl->second.second;
1352 result.push_back(thetrackid);
1359 std::multimap<
const uint32_t, std::pair<std::pair<float, float>,
int> >&
collection,
1368 std::make_pair(std::make_pair(pixhit->
cluster()->x(), pixhit->
cluster()->y()), trackid)));
1375 std::stringstream
output;
1459 std::stringstream
output;
1460 output << rawid <<
" (0x" << std::hex << rawid <<
std::dec <<
")";
1476 float delay = const_cast<SiStripEventSummary&>(
summary).ttcrx();
1477 uint32_t latencyCode = (const_cast<SiStripEventSummary&>(
summary).layerScanned() >> 24) & 0xff;
1480 if (latencyShift > 32)
1482 if ((latencyCode >> 6) == 2)
1484 if ((latencyCode >> 6) == 1)
1486 float correctedDelay =
1487 delay - (latencyShift * 25.);
1488 return correctedDelay;
1495 std::map<uint32_t, float> delayMap;
1499 std::ifstream cablingFile(
file->c_str());
1500 if (cablingFile.is_open()) {
1503 cablingFile.getline(
buffer, 1024);
1504 while (!cablingFile.eof()) {
1506 size_t pos =
line.find(
"dcuid");
1508 if (
pos != std::string::npos) {
1511 std::istringstream dcuidstr(dcuids);
1512 dcuidstr >> std::hex >> dcuid;
1516 std::istringstream diffstr(diffs);
1519 delayMap[dcuid] =
delay;
1522 cablingFile.getline(
buffer, 1024);
1525 edm::LogWarning(
"BadConfig") <<
" The delay file does not exist. The delay map will not be filled properly."
1527 <<
" Looking for " <<
file->c_str() <<
"." << std::endl
1528 <<
" Please specify valid filenames through the DelayFileNames untracked parameter.";