116 const std::vector<Trajectory>&);
117 void insertMeasurement(std::multimap<
const uint32_t, std::pair<LocalPoint, double> >&,
124 const std::vector<Trajectory>&);
130 void insertMeasurement(std::multimap<
const uint32_t, std::pair<std::pair<float, float>,
int> >&,
137 std::map<uint32_t, float>
delay(
const std::vector<std::string>&);
165 std::multimap<const uint32_t, const FedChannelConnection*>
connections_;
226 : siStripClusterInfo_(consumesCollector(),
std::
string(
"")), hltConfig_() {
268 ntrajs_ =
new uint32_t[trackSize];
273 for (
size_t i = 0;
i < trackSize; ++
i) {
286 clusters_ =
dir->make<TTree>(
"clusters",
"cluster information");
289 for (
size_t i = 0;
i < trackSize; ++
i) {
292 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
293 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
317 pixclusters_ =
dir->make<TTree>(
"pixclusters",
"pixel cluster information");
320 for (
size_t i = 0;
i < trackSize; ++
i) {
323 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
324 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
343 for (
size_t i = 0;
i < trackSize; ++
i) {
346 sprintf(buffer1,
"tracks%lu", (
unsigned long)
i);
347 sprintf(buffer2,
"track%lu information", (
unsigned long)
i);
348 TTree* thetracks_ =
dir->make<TTree>(buffer1, buffer2);
349 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
350 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
352 thetracks_->Branch(
"eventid", &
eventid_,
"eventid/i");
353 thetracks_->Branch(
"runid", &
runid_,
"runid/i");
354 thetracks_->Branch(
"chi2", &
chi2_,
"chi2/F");
355 thetracks_->Branch(
"eta", &
eta_,
"eta/F");
356 thetracks_->Branch(
"etaerr", &
etaerr_,
"etaerr/F");
357 thetracks_->Branch(
"phi", &
phi_,
"phi/F");
358 thetracks_->Branch(
"phierr", &
phierr_,
"phierr/F");
359 thetracks_->Branch(
"dedx1", &
dedx1_,
"dedx1/F");
360 thetracks_->Branch(
"dedx2", &
dedx2_,
"dedx2/F");
361 thetracks_->Branch(
"dedx3", &
dedx3_,
"dedx3/F");
362 thetracks_->Branch(
"dedxNoM", &
dedxNoM_,
"dedxNoM/i");
363 thetracks_->Branch(
"charge", &
charge_,
"charge/F");
364 thetracks_->Branch(
"quality", &
quality_,
"quality/i");
365 thetracks_->Branch(
"foundhits", &
foundhits_,
"foundhits/i");
366 thetracks_->Branch(
"lostHits", &
lostHits_,
"lostHits/i");
367 thetracks_->Branch(
"foundhitsStrips", &
foundhitsStrips_,
"foundhitsStrips/i");
368 thetracks_->Branch(
"foundhitsPixels", &
foundhitsPixels_,
"foundhitsPixels/i");
369 thetracks_->Branch(
"losthitsStrips", &
losthitsStrips_,
"losthitsStrips/i");
370 thetracks_->Branch(
"losthitsPixels", &
losthitsPixels_,
"losthitsPixels/i");
371 thetracks_->Branch(
"p", &
p_,
"p/F");
372 thetracks_->Branch(
"pt", &
pt_,
"pt/F");
373 thetracks_->Branch(
"pterr", &
pterr_,
"pterr/F");
374 thetracks_->Branch(
"ndof", &
ndof_,
"ndof/i");
375 thetracks_->Branch(
"dz", &
dz_,
"dz/F");
376 thetracks_->Branch(
"dzerr", &
dzerr_,
"dzerr/F");
377 thetracks_->Branch(
"dzCorr", &
dzCorr_,
"dzCorr/F");
378 thetracks_->Branch(
"dxy", &
dxy_,
"dxy/F");
379 thetracks_->Branch(
"dxyerr", &
dxyerr_,
"dxyerr/F");
380 thetracks_->Branch(
"dxyCorr", &
dxyCorr_,
"dxyCorr/F");
381 thetracks_->Branch(
"qoverp", &
qoverp_,
"qoverp/F");
382 thetracks_->Branch(
"xPCA", &
xPCA_,
"xPCA/F");
383 thetracks_->Branch(
"yPCA", &
yPCA_,
"yPCA/F");
384 thetracks_->Branch(
"zPCA", &
zPCA_,
"zPCA/F");
385 thetracks_->Branch(
"nLayers", &
nLayers_,
"nLayers/i");
386 thetracks_->Branch(
"trkWeightpvtx", &
trkWeightpvtx_,
"trkWeightpvtx/F");
387 thetracks_->Branch(
"vertexid", &
vertexid_,
"vertexid/i");
392 for (
size_t i = 0;
i < trackSize; ++
i) {
395 sprintf(buffer1,
"misingHits%lu", (
unsigned long)
i);
396 sprintf(buffer2,
"missing hits from track collection %lu", (
unsigned long)
i);
397 TTree* themissingHits_ =
dir->make<TTree>(buffer1, buffer2);
398 sprintf(buffer1,
"trackid%lu", (
unsigned long)
i);
399 sprintf(buffer2,
"trackid%lu/i", (
unsigned long)
i);
401 themissingHits_->Branch(
"eventid", &
eventid_,
"eventid/i");
402 themissingHits_->Branch(
"runid", &
runid_,
"runid/i");
403 themissingHits_->Branch(
"detid", &
detid_,
"detid/i");
404 themissingHits_->Branch(
"type", &
type_,
"type/i");
405 themissingHits_->Branch(
"localX", &
clPositionX_,
"localX/F");
406 themissingHits_->Branch(
"localY", &
clPositionY_,
"localY/F");
407 themissingHits_->Branch(
"globalX", &
globalX_,
"globalX/F");
408 themissingHits_->Branch(
"globalY", &
globalY_,
"globalY/F");
409 themissingHits_->Branch(
"globalZ", &
globalZ_,
"globalZ/F");
410 themissingHits_->Branch(
"measX", &
measX_,
"measX/F");
411 themissingHits_->Branch(
"measY", &
measY_,
"measY/F");
412 themissingHits_->Branch(
"errorX", &
errorX_,
"errorX/F");
413 themissingHits_->Branch(
"errorY", &
errorY_,
"errorY/F");
418 vertices_ =
dir->make<TTree>(
"vertices",
"vertex information");
449 event_ =
dir->make<TTree>(
"events",
"event information");
464 sprintf(
buffer,
"ntracks[%lu]/i", (
unsigned long)trackSize);
466 sprintf(
buffer,
"ntrajs[%lu]/i", (
unsigned long)trackSize);
468 sprintf(
buffer,
"lowPixelProbabilityFraction[%lu]/F", (
unsigned long)trackSize);
488 event_->Branch(
"MagneticField", &
fBz_,
"MagneticField/F");
493 iConfig.
getUntrackedParameter<std::vector<std::string> >(
"DelayFileNames", std::vector<std::string>(0));
494 psumap_ =
dir->make<TTree>(
"psumap",
"PSU map");
529 using namespace reco;
536 bx_ =
iEvent.eventAuxiliary().bunchCrossing();
564 for (
int bit = 0; bit < 128; ++bit) {
568 for (
int bit = 0; bit < 64; ++bit) {
572 for (
int bit = 0; bit < 64; ++bit) {
579 size_t ntrh = trh->
size();
580 for (
size_t bit = 0; bit < 256; ++bit)
588 ?
Point(recoBeamSpotHandle->
x0(), recoBeamSpotHandle->
y0(), recoBeamSpotHandle->
z0())
590 if (recoBeamSpotHandle.
isValid()) {
612 for (reco::VertexCollection::const_iterator
v = vertexColl.begin();
v != vertexColl.end(); ++
v) {
613 if (
v->isValid() && !
v->isFake())
656 std::vector<edm::Handle<reco::TrackCollection> > trackCollectionHandle;
657 trackCollectionHandle.resize(trackSize);
672 std::vector<std::vector<Trajectory> > trajectoryCollection;
673 std::vector<edm::Handle<std::vector<Trajectory> > > trajectoryCollectionHandle;
674 trajectoryCollectionHandle.resize(trackSize);
684 trajectoryCollection.push_back(*trajectoryCollectionHandle[
index].product());
689 std::vector<TrajTrackAssociationCollection> TrajToTrackMap;
696 iEvent.getByToken(*
token, trajTrackAssociationHandle);
700 TrajToTrackMap.push_back(*trajTrackAssociationHandle.
product());
708 std::vector<std::map<size_t, int> > trackVertices;
709 for (
size_t i = 0;
i < trackSize; ++
i) {
715 for (reco::VertexCollection::const_iterator
v = vertexColl.begin();
v != vertexColl.end(); ++
v) {
733 for (reco::VertexCollection::const_iterator
v = pixelVertexColl.begin();
v != pixelVertexColl.end(); ++
v) {
751 std::vector<std::pair<double, double> > pixclusterOntrackAngles =
770 std::vector<std::vector<int> > stripClusterOntrackIndices;
771 for (
size_t i = 0;
i < trackSize; ++
i) {
774 std::vector<std::vector<int> > pixelClusterOntrackIndices;
775 for (
size_t i = 0;
i < trackSize; ++
i) {
779 stripClusterOntrackIndices[0].
begin(), stripClusterOntrackIndices[0].
end(), [](
auto c) {
return c != -1; });
781 pixelClusterOntrackIndices[0].
begin(), pixelClusterOntrackIndices[0].
end(), [](
auto c) {
return c != -1; });
785 uint32_t n_hits_barrel = 0;
786 uint32_t n_hits_lowprob = 0;
788 it != TrajToTrackMap[coll].end();
792 eta_ = itTrack->eta();
793 phi_ = itTrack->phi();
795 dedxNoM_ = dEdxTrack1[itTrack].numberOfMeasurements();
796 dedx1_ = dEdxTrack1[itTrack].dEdx();
797 dedx2_ = dEdxTrack2[itTrack].dEdx();
798 dedx3_ = dEdxTrack3[itTrack].dEdx();
813 nLayers_ = uint32_t(itTrack->hitPattern().trackerLayersWithMeasurement());
816 chi2_ = itTrack->chi2();
817 ndof_ = (uint32_t)itTrack->ndof();
819 dzerr_ = itTrack->dzError();
821 dxy_ = itTrack->dxy();
824 pterr_ = itTrack->ptError();
828 xPCA_ = itTrack->vertex().x();
829 yPCA_ = itTrack->vertex().y();
830 zPCA_ = itTrack->vertex().z();
832 if (!vertexColl.empty() && !vertexColl.begin()->isFake()) {
840 std::map<size_t, int>::const_iterator theV = trackVertices[coll].find(itTrack.
key());
841 vertexid_ = (theV != trackVertices[coll].end()) ? theV->second : 0;
845 for (Trajectory::DataContainer::const_iterator it = measurements.begin(); it != measurements.end(); ++it) {
847 if (!rechit->isValid()) {
849 detid_ = rechit->geographicalId();
851 type_ = rechit->getType();
857 GlobalPoint global = it->predictedState().globalPosition();
905 std::vector<double>::const_iterator angleIt = clusterOntrackAngles.begin();
906 uint32_t localCounter = 0;
911 uint32_t detid = DSViter->id();
915 ++iter, ++angleIt, ++localCounter) {
918 for (
size_t i = 0;
i < trackSize; ++
i) {
919 trackid_[
i] = stripClusterOntrackIndices[
i][localCounter];
925 thickness_ = ((((DSViter->id() >> 25) & 0x7f) == 0xd) ||
926 ((((DSViter->id() >> 25) & 0x7f) == 0xe) && (((DSViter->id() >> 5) & 0x7) > 4)))
930 int nstrips = static_cast<const StripGeomDetUnit*>(
tracker_->
idToDet(detid))->specificTopology().nstrips();
962 std::vector<std::pair<double, double> >::const_iterator pixAngleIt = pixclusterOntrackAngles.begin();
965 DSViter != pixelclusters->end();
969 uint32_t detid = DSViter->id();
973 ++iter, ++pixAngleIt, ++localCounter) {
975 for (
size_t i = 0;
i < trackSize; ++
i) {
976 trackid_[
i] = pixelClusterOntrackIndices[
i][localCounter];
984 alpha_ = pixAngleIt->first;
985 beta_ = pixAngleIt->second;
986 charge_ = (iter->charge()) / 1000.;
1037 for (std::vector<std::string>::const_iterator it =
hlNames_.begin(); it <
hlNames_.end(); ++it) {
1038 std::cout << (
i++) <<
" = " << (*it) << std::endl;
1051 for (
auto conn = connections.begin();
conn < connections.end(); ++
conn) {
1053 if (
conn->isConnected())
1056 if (
conn->isConnected()) {
1081 if (!delayMap.empty())
1082 tmap.
save(
true, 0, 0,
"delaymap.png");
1086 if (cablingFile.is_open()) {
1088 cablingFile.getline(
buffer, 1024);
1089 while (!cablingFile.eof()) {
1095 while (!
line.eof()) {
1099 cablingFile.getline(
buffer, 1024);
1102 edm::LogWarning(
"BadConfig") <<
" The PSU file does not exist. The psumap tree will not be filled." << std::endl
1104 <<
" Please specify a valid filename through the PSUFileName untracked parameter.";
1110 for (
size_t i = 0;
i <
tracks_.size(); ++
i) {
1112 sprintf(
buffer,
"trackid%lu", (
unsigned long)
i);
1124 vertices_->BuildIndex(
"vertexid",
"eventid");
1125 if (
event_->GetEntries())
1126 event_->BuildIndex(
"runid",
"eventid");
1134 const std::vector<Trajectory>& trajVec) {
1135 std::vector<double>
result;
1137 std::multimap<const uint32_t, std::pair<LocalPoint, double> > onTrackPositions;
1138 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1140 for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1141 double tla = meas->updatedState().localDirection().theta();
1151 std::pair<std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator,
1152 std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator>
1153 range = onTrackPositions.equal_range(DSViter->id());
1157 for (std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator
cl =
range.first;
cl !=
range.second;
1179 }
else if (singlehit) {
1182 }
else if (multihit) {
1183 std::vector<const TrackingRecHit*> childs = multihit->
recHits();
1184 for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1192 uint32_t firstTrack) {
1195 std::multimap<const uint32_t, std::pair<int, int> > onTrackPositions;
1196 uint32_t trackid = firstTrack;
1197 for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1198 ++itTrack, ++trackid) {
1205 int thetrackid = -1;
1210 std::pair<std::multimap<uint32_t, std::pair<int, int> >::const_iterator,
1211 std::multimap<uint32_t, std::pair<int, int> >::const_iterator>
1212 range = onTrackPositions.equal_range(DSViter->id());
1215 for (std::multimap<uint32_t, std::pair<int, int> >::const_iterator
cl =
range.first;
cl !=
range.second; ++
cl) {
1216 if (fabs(
cl->second.first - iter->barycenter()) < 2) {
1217 thetrackid =
cl->second.second;
1220 result.push_back(thetrackid);
1237 }
else if (singlehit) {
1239 std::make_pair(
int(singlehit->
cluster()->barycenter()), trackid)));
1240 }
else if (multihit) {
1241 std::vector<const TrackingRecHit*> childs = multihit->
recHits();
1242 for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1250 uint32_t firstVertex) {
1252 std::map<size_t, int>
output;
1253 uint32_t vertexid = firstVertex;
1254 for (reco::VertexCollection::const_iterator
v =
vertices.begin();
v !=
vertices.end(); ++
v, ++vertexid) {
1257 for (; it != lastTrack; ++it) {
1258 output[it->key()] = vertexid;
1266 std::vector<std::pair<double, double> >
result;
1268 std::multimap<const uint32_t, std::pair<LocalPoint, std::pair<double, double> > > onTrackPositions;
1269 for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1271 for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1272 LocalVector localDir = meas->updatedState().localDirection();
1273 double alpha = atan2(localDir.
z(), localDir.
x());
1274 double beta = atan2(localDir.
z(), localDir.
y());
1288 std::pair<std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator,
1289 std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator>
1290 range = onTrackPositions.equal_range(DSViter->id());
1292 for (std::multimap<uint32_t, std::pair<
LocalPoint, std::pair<double, double> > >::const_iterator
cl =
range.first;
1297 alpha =
cl->second.second.first;
1298 beta =
cl->second.second.second;
1323 uint32_t firstTrack) {
1326 std::multimap<const uint32_t, std::pair<std::pair<float, float>,
int> > onTrackPositions;
1327 uint32_t trackid = firstTrack;
1328 for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1329 ++itTrack, ++trackid) {
1336 int thetrackid = -1;
1343 std::pair<std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator,
1344 std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator>
1345 range = onTrackPositions.equal_range(DSViter->id());
1346 for (std::multimap<uint32_t, std::pair<std::pair<float, float>,
int> >::const_iterator
cl =
range.first;
1349 if ((fabs(
cl->second.first.first - iter->x()) < 2) && (fabs(
cl->second.first.second - iter->y()) < 2)) {
1350 thetrackid =
cl->second.second;
1353 result.push_back(thetrackid);
1360 std::multimap<
const uint32_t, std::pair<std::pair<float, float>,
int> >&
collection,
1369 std::make_pair(std::make_pair(pixhit->
cluster()->x(), pixhit->
cluster()->y()), trackid)));
1376 std::stringstream
output;
1460 std::stringstream
output;
1461 output << rawid <<
" (0x" << std::hex << rawid <<
std::dec <<
")";
1477 float delay = const_cast<SiStripEventSummary&>(
summary).ttcrx();
1478 uint32_t latencyCode = (const_cast<SiStripEventSummary&>(
summary).layerScanned() >> 24) & 0xff;
1481 if (latencyShift > 32)
1483 if ((latencyCode >> 6) == 2)
1485 if ((latencyCode >> 6) == 1)
1487 float correctedDelay =
1488 delay - (latencyShift * 25.);
1489 return correctedDelay;
1496 std::map<uint32_t, float> delayMap;
1500 std::ifstream cablingFile(
file->c_str());
1501 if (cablingFile.is_open()) {
1504 cablingFile.getline(
buffer, 1024);
1505 while (!cablingFile.eof()) {
1507 size_t pos =
line.find(
"dcuid");
1509 if (
pos != std::string::npos) {
1512 std::istringstream dcuidstr(dcuids);
1513 dcuidstr >> std::hex >> dcuid;
1517 std::istringstream diffstr(diffs);
1520 delayMap[dcuid] =
delay;
1523 cablingFile.getline(
buffer, 1024);
1526 edm::LogWarning(
"BadConfig") <<
" The delay file does not exist. The delay map will not be filled properly."
1528 <<
" Looking for " <<
file->c_str() <<
"." << std::endl
1529 <<
" Please specify valid filenames through the DelayFileNames untracked parameter.";