68 #include "TStopwatch.h"
202 m_muonCollectionTag(
cfg.getParameter<
edm::
InputTag>(
"muonCollectionTag")),
204 m_minTrackPt(
cfg.getParameter<double>(
"minTrackPt")),
205 m_maxTrackPt(
cfg.getParameter<double>(
"maxTrackPt")),
206 m_minTrackP(
cfg.getParameter<double>(
"minTrackP")),
207 m_maxTrackP(
cfg.getParameter<double>(
"maxTrackP")),
208 m_maxDxy(
cfg.getParameter<double>(
"maxDxy")),
209 m_minTrackerHits(
cfg.getParameter<
int>(
"minTrackerHits")),
210 m_maxTrackerRedChi2(
cfg.getParameter<double>(
"maxTrackerRedChi2")),
211 m_allowTIDTEC(
cfg.getParameter<
bool>(
"allowTIDTEC")),
212 m_minNCrossedChambers(
cfg.getParameter<
int>(
"minNCrossedChambers")),
213 m_minDT13Hits(
cfg.getParameter<
int>(
"minDT13Hits")),
214 m_minDT2Hits(
cfg.getParameter<
int>(
"minDT2Hits")),
215 m_minCSCHits(
cfg.getParameter<
int>(
"minCSCHits")),
216 m_writeTemporaryFile(
cfg.getParameter<
std::
string>(
"writeTemporaryFile")),
218 m_doAlignment(
cfg.getParameter<
bool>(
"doAlignment")),
219 m_strategy(
cfg.getParameter<
int>(
"strategy")),
220 m_residualsModel(
cfg.getParameter<
std::
string>(
"residualsModel")),
221 m_minAlignmentHits(
cfg.getParameter<
int>(
"minAlignmentHits")),
222 m_twoBin(
cfg.getParameter<
bool>(
"twoBin")),
223 m_combineME11(
cfg.getParameter<
bool>(
"combineME11")),
224 m_weightAlignment(
cfg.getParameter<
bool>(
"weightAlignment")),
225 m_reportFileName(
cfg.getParameter<
std::
string>(
"reportFileName")),
226 m_maxResSlopeY(
cfg.getParameter<double>(
"maxResSlopeY")),
227 m_createNtuple(
cfg.getParameter<
bool>(
"createNtuple")),
228 m_peakNSigma(
cfg.getParameter<double>(
"peakNSigma")),
229 m_BFieldCorrection(
cfg.getParameter<
int>(
"bFieldCorrection")),
230 m_doDT(
cfg.getParameter<
bool>(
"doDT")),
231 m_doCSC(
cfg.getParameter<
bool>(
"doCSC")),
232 m_useResiduals(
cfg.getParameter<
std::
string>(
"useResiduals")) {
277 m_ttree = fs->
make<TTree>(
"mual_ttree",
"mual_ttree");
303 return atoi(
s.c_str());
311 if (alignableMuon ==
nullptr)
312 throw cms::Exception(
"MuonAlignmentFromReference") <<
"doMuon must be set to True" << std::endl;
331 <<
"unrecognized residualsModel: \"" <<
m_residualsModel <<
"\"" << std::endl;
348 <<
"unrecognized useResiduals: \"" <<
m_useResiduals <<
"\"" << std::endl;
359 bool made_fitter =
false;
412 <<
"only DTChambers and CSCChambers can be aligned with this module" << std::endl;
418 int index = ali->geomDetId().rawId();
428 const auto& all_DT_chambers = alignableMuon->
DTChambers();
429 const auto& all_CSC_chambers = alignableMuon->
CSCChambers();
441 std::cout <<
"****** EVENT START *******" << std::endl;
452 std::cout <<
"JUST BEFORE LOOP OVER trajTrackPairs" << std::endl;
456 for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
470 std::cout <<
"JUST BEFORE muonResidualsFromTrack" << std::endl;
481 std::cout <<
"JUST AFTER muonResidualsFromTrack" << std::endl;
484 std::cout <<
"JUST BEFORE PROCESS" << std::endl;
487 std::cout <<
"JUST AFTER PROCESS" << std::endl;
492 std::cout <<
"JUST AFTER LOOP OVER trajTrackPairs" << std::endl;
537 std::vector<DetId> chamberIds = mrft.
chamberIds();
544 for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end();
556 if (dt13 !=
nullptr && dt2 !=
nullptr) {
562 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
589 std::cout <<
"processMuonResidualsFromTrack 6DOF dt13->residual() " << dt13->
residual()
607 fitter->second->fill(
charge, residdata);
622 if (dt13 !=
nullptr) {
627 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
650 std::cout <<
"processMuonResidualsFromTrack 5DOF dt13->residual() " << dt13->
residual()
664 fitter->second->fill(
charge, residdata);
675 if (
csc !=
nullptr) {
685 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
m_fitters.find(ali);
701 std::cout <<
"processMuonResidualsFromTrack 6DOFrphi csc->residual() " <<
csc->residual()
715 fitter->second->fill(
charge, residdata);
760 <<
"That's all!" << std::endl;
762 TStopwatch stop_watch;
769 std::cout <<
"readTmpFiles took " << stop_watch.CpuTime() <<
" sec" << std::endl;
778 std::cout <<
"selectResidualsPeaks took " << stop_watch.CpuTime() <<
" sec" << std::endl;
786 std::cout <<
"correctBField took " << stop_watch.CpuTime() <<
" sec" << std::endl;
795 std::cout <<
"fiducialCuts took " << stop_watch.CpuTime() <<
" sec" << std::endl;
804 std::cout <<
"fillNtuple took " << stop_watch.CpuTime() <<
" sec" << std::endl;
812 std::cout <<
"eraseNotSelectedResiduals took " << stop_watch.CpuTime() <<
" sec" << std::endl;
821 std::cout <<
"fitAndAlign took " << stop_watch.CpuTime() <<
" sec" << std::endl;
829 std::cout <<
"end: MuonAlignmentFromReference::terminate()" << std::endl;
842 report <<
"nan = None; NAN = None" << std::endl;
843 report <<
"nan = 0" << std::endl;
844 report <<
"reports = []" << std::endl;
845 report <<
"class ValErr:" << std::endl
846 <<
" def __init__(self, value, error, antisym):" << std::endl
847 <<
" self.value, self.error, self.antisym = value, error, antisym" << std::endl
849 <<
" def __repr__(self):" << std::endl
850 <<
" if self.antisym == 0.:" << std::endl
851 <<
" return \"%g +- %g\" % (self.value, self.error)" << std::endl
852 <<
" else:" << std::endl
853 <<
" return \"%g +- %g ~ %g\" % (self.value, self.error, self.antisym)" << std::endl
855 <<
"class Report:" << std::endl
856 <<
" def __init__(self, chamberId, postal_address, name):" << std::endl
857 <<
" self.chamberId, self.postal_address, self.name = chamberId, postal_address, name" << std::endl
858 <<
" self.status = \"NOFIT\"" << std::endl
859 <<
" self.fittype = None" << std::endl
861 <<
" def add_parameters(self, deltax, deltay, deltaz, deltaphix, deltaphiy, deltaphiz, loglikelihood, "
862 "numsegments, sumofweights, redchi2):"
864 <<
" self.status = \"PASS\"" << std::endl
865 <<
" self.deltax, self.deltay, self.deltaz, self.deltaphix, self.deltaphiy, self.deltaphiz = deltax, "
866 "deltay, deltaz, deltaphix, deltaphiy, deltaphiz"
868 <<
" self.loglikelihood, self.numsegments, self.sumofweights, self.redchi2 = loglikelihood, "
869 "numsegments, sumofweights, redchi2"
872 <<
" def add_stats(self, median_x, median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, "
873 "mean50_dydz, mean15_x, mean15_y, mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, "
874 "wmean50_dydz, wmean15_x, wmean15_y, wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, "
875 "stdev50_dydz, stdev15_x, stdev15_y, stdev10_dxdz, stdev25_dydz):"
877 <<
" self.median_x, self.median_y, self.median_dxdz, self.median_dydz, self.mean30_x, self.mean30_y, "
878 "self.mean20_dxdz, self.mean50_dydz, self.mean15_x, self.mean15_y, self.mean10_dxdz, self.mean25_dydz, "
879 "self.wmean30_x, self.wmean30_y, self.wmean20_dxdz, self.wmean50_dydz, self.wmean15_x, self.wmean15_y, "
880 "self.wmean10_dxdz, self.wmean25_dydz, self.stdev30_x, self.stdev30_y, self.stdev20_dxdz, "
881 "self.stdev50_dydz, self.stdev15_x, self.stdev15_y, self.stdev10_dxdz, self.stdev25_dydz = median_x, "
882 "median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, mean50_dydz, mean15_x, mean15_y, "
883 "mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, wmean50_dydz, wmean15_x, wmean15_y, "
884 "wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, stdev50_dydz, stdev15_x, stdev15_y, "
885 "stdev10_dxdz, stdev25_dydz"
888 <<
" def __repr__(self):" << std::endl
889 <<
" return \"<Report %s %s %s>\" % (self.postal_address[0], \" \".join(map(str, "
890 "self.postal_address[1:])), self.status)"
896 std::cout <<
"***** just after report.open" << std::endl;
900 std::cout <<
"***** Start loop over alignables" << std::endl;
902 std::vector<bool> selector = ali->alignmentParameters()->selector();
903 bool align_x = selector[0];
904 bool align_y = selector[1];
905 bool align_z = selector[2];
906 bool align_phix = selector[3];
907 bool align_phiy = selector[4];
908 bool align_phiz = selector[5];
909 int numParams = ((align_x ? 1 : 0) + (align_y ? 1 : 0) + (align_z ? 1 : 0) + (align_phix ? 1 : 0) +
910 (align_phiy ? 1 : 0) + (align_phiz ? 1 : 0));
913 std::vector<int> paramIndex;
914 int paramIndex_counter = -1;
916 paramIndex_counter++;
917 paramIndex.push_back(paramIndex_counter);
919 paramIndex_counter++;
920 paramIndex.push_back(paramIndex_counter);
922 paramIndex_counter++;
923 paramIndex.push_back(paramIndex_counter);
925 paramIndex_counter++;
926 paramIndex.push_back(paramIndex_counter);
928 paramIndex_counter++;
929 paramIndex.push_back(paramIndex_counter);
931 paramIndex_counter++;
932 paramIndex.push_back(paramIndex_counter);
934 DetId id = ali->geomDetId();
944 std::cout <<
"***** loop over alignables 1" << std::endl;
947 char wheel_label[][2] = {
"A",
"B",
"C",
"D",
"E"};
954 sprintf(cname,
"MBwh%sst%dsec%02d", wheel_label[chamberId.
wheel() + 2], chamberId.
station(), chamberId.
sector());
956 report <<
"reports.append(Report(" <<
id.rawId() <<
", (\"DT\", " << chamberId.
wheel() <<
", "
957 << chamberId.
station() <<
", " << chamberId.
sector() <<
"), \"" << cname <<
"\"))" << std::endl;
963 (chamberId.
endcap() == 1 ?
"p" :
"m"),
971 report <<
"reports.append(Report(" <<
id.rawId() <<
", (\"CSC\", " << chamberId.
endcap() <<
", "
972 << chamberId.
station() <<
", " << chamberId.
ring() <<
", " << chamberId.
chamber() <<
"), \"" << cname
973 <<
"\"))" << std::endl;
978 std::cout <<
"***** loop over alignables 2" << std::endl;
982 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
m_fitters.find(thisali);
985 std::cout <<
"***** loop over alignables 3" << std::endl;
990 TStopwatch stop_watch;
995 std::cout <<
"============================================================================================="
998 std::cout <<
"Fitting " << cname << std::endl;
1001 report <<
"reports[-1].posNum = " << fitter->second->numResidualsPos() << std::endl;
1002 report <<
"reports[-1].negNum = " << fitter->second->numResidualsNeg() << std::endl;
1046 std::cout <<
"***** loop over alignables 4" << std::endl;
1053 std::cout <<
"***** loop over alignables 5" << std::endl;
1055 bool successful_fit = fitter->second->fit(thisali);
1058 std::cout <<
"***** loop over alignables 6 " << fitter->second->type() << std::endl;
1060 double loglikelihood = fitter->second->loglikelihood();
1061 double numsegments = fitter->second->numsegments();
1062 double sumofweights = fitter->second->sumofweights();
1063 double redchi2 = fitter->second->plot(cname, &rootDirectory, thisali);
1067 std::cout <<
"***** loop over alignables k5DOF" << std::endl;
1097 double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1098 gammaresslope_antisym;
1099 gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1100 gammaresslope_antisym = 0.;
1115 report <<
"reports[-1].fittype = \"5DOF\"" << std::endl;
1116 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1117 << deltax_antisym <<
"), \\" << std::endl
1118 <<
" None, \\" << std::endl
1119 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1120 << deltaz_antisym <<
"), \\" << std::endl
1121 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1122 << deltaphix_antisym <<
"), \\" << std::endl
1123 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1124 << deltaphiy_antisym <<
"), \\" << std::endl
1125 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1126 << deltaphiz_antisym <<
"), \\" << std::endl
1127 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1128 <<
", " << redchi2 <<
")" << std::endl;
1129 report <<
"reports[-1].sigmaresid = ValErr(" << sigmaresid_value <<
", " << sigmaresid_error <<
", "
1130 << sigmaresid_antisym <<
")" << std::endl;
1131 report <<
"reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value <<
", " << sigmaresslope_error
1132 <<
", " << sigmaresslope_antisym <<
")" << std::endl;
1136 report <<
"reports[-1].gammaresid = ValErr(" << gammaresid_value <<
", " << gammaresid_error <<
", "
1137 << gammaresid_antisym <<
")" << std::endl;
1138 report <<
"reports[-1].gammaresslope = ValErr(" << gammaresslope_value <<
", " << gammaresslope_error
1139 <<
", " << gammaresslope_antisym <<
")" << std::endl;
1164 <<
"None)" << std::endl;
1166 std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1167 namesimple_x << cname <<
"_simple_x";
1168 namesimple_dxdz << cname <<
"_simple_dxdz";
1169 nameweighted_x << cname <<
"_weighted_x";
1170 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1173 fitter->second->plotsimple(
1176 fitter->second->plotweighted(nameweighted_x.str(),
1181 fitter->second->plotweighted(nameweighted_dxdz.str(),
1188 if (successful_fit) {
1190 params[paramIndex[0]] = deltax_value;
1192 params[paramIndex[2]] = deltaz_value;
1194 params[paramIndex[3]] = deltaphix_value;
1196 params[paramIndex[4]] = deltaphiy_value;
1198 params[paramIndex[5]] = deltaphiz_value;
1204 std::cout <<
"***** loop over alignables k6DOF" << std::endl;
1246 double gammax_value, gammax_error, gammax_antisym, gammay_value, gammay_error, gammay_antisym,
1247 gammadxdz_value, gammadxdz_error, gammadxdz_antisym, gammadydz_value, gammadydz_error, gammadydz_antisym;
1248 gammax_value = gammax_error = gammax_antisym = gammay_value = gammay_error = gammay_antisym =
1249 gammadxdz_value = gammadxdz_error = gammadxdz_antisym = gammadydz_value = gammadydz_error =
1250 gammadydz_antisym = 0.;
1272 report <<
"reports[-1].fittype = \"6DOF\"" << std::endl;
1273 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1274 << deltax_antisym <<
"), \\" << std::endl
1275 <<
" ValErr(" << deltay_value <<
", " << deltay_error <<
", "
1276 << deltay_antisym <<
"), \\" << std::endl
1277 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1278 << deltaz_antisym <<
"), \\" << std::endl
1279 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1280 << deltaphix_antisym <<
"), \\" << std::endl
1281 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1282 << deltaphiy_antisym <<
"), \\" << std::endl
1283 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1284 << deltaphiz_antisym <<
"), \\" << std::endl
1285 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1286 <<
", " << redchi2 <<
")" << std::endl;
1287 report <<
"reports[-1].sigmax = ValErr(" << sigmax_value <<
", " << sigmax_error <<
", " << sigmax_antisym
1288 <<
")" << std::endl;
1289 report <<
"reports[-1].sigmay = ValErr(" << sigmay_value <<
", " << sigmay_error <<
", " << sigmay_antisym
1290 <<
")" << std::endl;
1291 report <<
"reports[-1].sigmadxdz = ValErr(" << sigmadxdz_value <<
", " << sigmadxdz_error <<
", "
1292 << sigmadxdz_antisym <<
")" << std::endl;
1293 report <<
"reports[-1].sigmadydz = ValErr(" << sigmadydz_value <<
", " << sigmadydz_error <<
", "
1294 << sigmadydz_antisym <<
")" << std::endl;
1298 report <<
"reports[-1].gammax = ValErr(" << gammax_value <<
", " << gammax_error <<
", " << gammax_antisym
1299 <<
")" << std::endl;
1300 report <<
"reports[-1].gammay = ValErr(" << gammay_value <<
", " << gammay_error <<
", " << gammay_antisym
1301 <<
")" << std::endl;
1302 report <<
"reports[-1].gammadxdz = ValErr(" << gammadxdz_value <<
", " << gammadxdz_error <<
", "
1303 << gammadxdz_antisym <<
")" << std::endl;
1304 report <<
"reports[-1].gammadydz = ValErr(" << gammadydz_value <<
", " << gammadydz_error <<
", "
1305 << gammadydz_antisym <<
")" << std::endl;
1344 std::stringstream namesimple_x, namesimple_y, namesimple_dxdz, namesimple_dydz, nameweighted_x,
1345 nameweighted_y, nameweighted_dxdz, nameweighted_dydz;
1346 namesimple_x << cname <<
"_simple_x";
1347 namesimple_y << cname <<
"_simple_y";
1348 namesimple_dxdz << cname <<
"_simple_dxdz";
1349 namesimple_dydz << cname <<
"_simple_dydz";
1350 nameweighted_x << cname <<
"_weighted_x";
1351 nameweighted_y << cname <<
"_weighted_y";
1352 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1353 nameweighted_dydz << cname <<
"_weighted_dydz";
1357 fitter->second->plotsimple(
1359 fitter->second->plotsimple(
1362 fitter->second->plotweighted(nameweighted_x.str(),
1367 fitter->second->plotweighted(nameweighted_y.str(),
1372 fitter->second->plotweighted(nameweighted_dxdz.str(),
1377 fitter->second->plotweighted(nameweighted_dydz.str(),
1384 if (successful_fit) {
1386 params[paramIndex[0]] = deltax_value;
1388 params[paramIndex[1]] = deltay_value;
1390 params[paramIndex[2]] = deltaz_value;
1392 params[paramIndex[3]] = deltaphix_value;
1394 params[paramIndex[4]] = deltaphiy_value;
1396 params[paramIndex[5]] = deltaphiz_value;
1402 std::cout <<
"***** loop over alignables k6DOFrphi" << std::endl;
1436 double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1437 gammaresslope_antisym;
1438 gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1439 gammaresslope_antisym = 0.;
1453 report <<
"reports[-1].fittype = \"6DOFrphi\"" << std::endl;
1454 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1455 << deltax_antisym <<
"), \\" << std::endl
1456 <<
" ValErr(" << deltay_value <<
", " << deltay_error <<
", "
1457 << deltay_antisym <<
"), \\" << std::endl
1458 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1459 << deltaz_antisym <<
"), \\" << std::endl
1460 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1461 << deltaphix_antisym <<
"), \\" << std::endl
1462 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1463 << deltaphiy_antisym <<
"), \\" << std::endl
1464 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1465 << deltaphiz_antisym <<
"), \\" << std::endl
1466 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1467 <<
", " << redchi2 <<
")" << std::endl;
1468 report <<
"reports[-1].sigmaresid = ValErr(" << sigmaresid_value <<
", " << sigmaresid_error <<
", "
1469 << sigmaresid_antisym <<
")" << std::endl;
1470 report <<
"reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value <<
", " << sigmaresslope_error
1471 <<
", " << sigmaresslope_antisym <<
")" << std::endl;
1475 report <<
"reports[-1].gammaresid = ValErr(" << gammaresid_value <<
", " << gammaresid_error <<
", "
1476 << gammaresid_antisym <<
")" << std::endl;
1477 report <<
"reports[-1].gammaresslope = ValErr(" << gammaresslope_value <<
", " << gammaresslope_error
1478 <<
", " << gammaresslope_antisym <<
")" << std::endl;
1488 << fitter->second->wmean(
1492 << fitter->second->wmean(
1496 << fitter->second->wmean(
1500 << fitter->second->wmean(
1507 <<
"None)" << std::endl;
1509 std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1510 namesimple_x << cname <<
"_simple_x";
1511 namesimple_dxdz << cname <<
"_simple_dxdz";
1512 nameweighted_x << cname <<
"_weighted_x";
1513 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1516 fitter->second->plotsimple(
1519 fitter->second->plotweighted(nameweighted_x.str(),
1524 fitter->second->plotweighted(nameweighted_dxdz.str(),
1531 if (successful_fit) {
1533 params[paramIndex[0]] = deltax_value;
1535 params[paramIndex[1]] = deltay_value;
1537 params[paramIndex[2]] = deltaz_value;
1539 params[paramIndex[3]] = deltaphix_value;
1541 params[paramIndex[4]] = deltaphiy_value;
1543 params[paramIndex[5]] = deltaphiz_value;
1547 if (successful_fit) {
1549 oneortwo.push_back(ali);
1551 oneortwo.push_back(thisali);
1555 std::cout <<
"MINUIT fit failed!" << std::endl;
1557 report <<
"reports[-1].status = \"MINUITFAIL\"" << std::endl;
1560 for (
int i = 0;
i < numParams;
i++)
1564 oneortwo.push_back(ali);
1566 oneortwo.push_back(thisali);
1571 std::cout <<
"Too few hits!" << std::endl;
1573 report <<
"reports[-1].status = \"TOOFEWHITS\"" << std::endl;
1576 for (
int i = 0;
i < numParams;
i++)
1580 oneortwo.push_back(ali);
1582 oneortwo.push_back(thisali);
1587 ali->setAlignmentParameters(parnew);
1589 ali->alignmentParameters()->setValid(
true);
1592 std::cout << cname <<
" fittime= " << stop_watch.CpuTime() <<
" sec" << std::endl;
1610 file = fopen((*fileName).c_str(),
"r");
1611 if (
file ==
nullptr)
1613 <<
"file \"" << *
fileName <<
"\" can't be opened (doesn't exist?)" << std::endl;
1615 fread(&
size,
sizeof(
int), 1,
file);
1619 <<
" fitters (probably corresponds to the wrong alignment job)" << std::endl;
1624 unsigned int index_toread;
1625 fread(&index_toread,
sizeof(
unsigned int), 1,
file);
1626 if (*
index != index_toread)
1628 <<
"file \"" << *
fileName <<
"\" has index " << index_toread <<
" at position " <<
i
1629 <<
", but this job is expecting " << *
index <<
" (probably corresponds to the wrong alignment job)"
1642 fwrite(&
size,
sizeof(
int), 1,
file);
1647 unsigned int index_towrite = *
index;
1648 fwrite(&index_towrite,
sizeof(
unsigned int), 1,
file);
1692 int vars_index[10] = {0, 1};
1758 sprintf(cname,
"MB%+d/%d/%02d", chamberId.
wheel(), chamberId.
station(), chamberId.
sector());
1763 (chamberId.
endcap() == 1 ?
"+" :
"-"),
1799 for (; residual != fitter->
residualsPos_end(); ++residual, ++residual_ok) {
1837 std::map<Alignable*, bool> already_seen;
1840 bool parsing_error =
false;
1845 parsing_error =
true;
1847 if (!parsing_error &&
barrel) {
1861 parsing_error =
true;
1864 bool wheel_digit =
false;
1874 parsing_error =
true;
1877 parsing_error =
true;
1881 bool station_digit =
false;
1885 station_digit =
true;
1889 parsing_error =
true;
1892 parsing_error =
true;
1896 bool sector_digit =
false;
1900 sector_digit =
true;
1904 parsing_error =
true;
1906 if (!parsing_error) {
1907 bool no_such_chamber =
false;
1909 if (wheel < -2 || wheel > 2)
1910 no_such_chamber =
true;
1911 if (station < 1 || station > 4)
1912 no_such_chamber =
true;
1913 if (
station == 4 && (sector < 1 || sector > 14))
1914 no_such_chamber =
true;
1915 if (
station < 4 && (sector < 1 || sector > 12))
1916 no_such_chamber =
true;
1918 if (no_such_chamber)
1920 <<
"reference chamber doesn't exist: " << (*name) << std::endl;
1923 for (
const auto& ali : all_DT_chambers) {
1924 if (ali->geomDetId().rawId() ==
id.rawId()) {
1925 std::map<Alignable*, bool>::const_iterator
trial = already_seen.find(ali);
1926 if (
trial == already_seen.end()) {
1928 already_seen[ali] =
true;
1935 if (!parsing_error &&
endcap) {
1949 parsing_error =
true;
1952 bool station_digit =
false;
1956 station_digit =
true;
1962 parsing_error =
true;
1965 parsing_error =
true;
1969 bool ring_digit =
false;
1977 parsing_error =
true;
1980 parsing_error =
true;
1984 bool chamber_digit =
false;
1988 chamber_digit =
true;
1992 parsing_error =
true;
1994 if (!parsing_error) {
1995 bool no_such_chamber =
false;
1999 if (station < 1 || station > 4)
2000 no_such_chamber =
true;
2001 if (
station == 1 && (ring < 1 || ring > 4))
2002 no_such_chamber =
true;
2003 if (
station > 1 && (ring < 1 || ring > 2))
2004 no_such_chamber =
true;
2005 if (
station == 1 && (chamber < 1 || chamber > 36))
2006 no_such_chamber =
true;
2007 if (
station > 1 &&
ring == 1 && (chamber < 1 || chamber > 18))
2008 no_such_chamber =
true;
2009 if (
station > 1 &&
ring == 2 && (chamber < 1 || chamber > 36))
2010 no_such_chamber =
true;
2012 if (no_such_chamber)
2014 <<
"reference chamber doesn't exist: " << (*name) << std::endl;
2017 for (
const auto& ali : all_CSC_chambers) {
2018 if (ali->geomDetId().rawId() ==
id.rawId()) {
2019 std::map<Alignable*, bool>::const_iterator
trial = already_seen.find(ali);
2020 if (
trial == already_seen.end()) {
2022 already_seen[ali] =
true;
2031 <<
"reference chamber name is malformed: " << (*name) << std::endl;