68 #include "TStopwatch.h"
190 m_muonCollectionTag(
cfg.getParameter<
edm::
InputTag>(
"muonCollectionTag")),
192 m_minTrackPt(
cfg.getParameter<double>(
"minTrackPt")),
193 m_maxTrackPt(
cfg.getParameter<double>(
"maxTrackPt")),
194 m_minTrackP(
cfg.getParameter<double>(
"minTrackP")),
195 m_maxTrackP(
cfg.getParameter<double>(
"maxTrackP")),
196 m_maxDxy(
cfg.getParameter<double>(
"maxDxy")),
197 m_minTrackerHits(
cfg.getParameter<
int>(
"minTrackerHits")),
198 m_maxTrackerRedChi2(
cfg.getParameter<double>(
"maxTrackerRedChi2")),
199 m_allowTIDTEC(
cfg.getParameter<
bool>(
"allowTIDTEC")),
200 m_minNCrossedChambers(
cfg.getParameter<
int>(
"minNCrossedChambers")),
201 m_minDT13Hits(
cfg.getParameter<
int>(
"minDT13Hits")),
202 m_minDT2Hits(
cfg.getParameter<
int>(
"minDT2Hits")),
203 m_minCSCHits(
cfg.getParameter<
int>(
"minCSCHits")),
204 m_writeTemporaryFile(
cfg.getParameter<
std::
string>(
"writeTemporaryFile")),
205 m_readTemporaryFiles(
cfg.getParameter<
std::vector<
std::
string> >(
"readTemporaryFiles")),
206 m_doAlignment(
cfg.getParameter<
bool>(
"doAlignment")),
207 m_strategy(
cfg.getParameter<
int>(
"strategy")),
208 m_residualsModel(
cfg.getParameter<
std::
string>(
"residualsModel")),
209 m_minAlignmentHits(
cfg.getParameter<
int>(
"minAlignmentHits")),
210 m_twoBin(
cfg.getParameter<
bool>(
"twoBin")),
211 m_combineME11(
cfg.getParameter<
bool>(
"combineME11")),
212 m_weightAlignment(
cfg.getParameter<
bool>(
"weightAlignment")),
213 m_reportFileName(
cfg.getParameter<
std::
string>(
"reportFileName")),
214 m_maxResSlopeY(
cfg.getParameter<double>(
"maxResSlopeY")),
215 m_createNtuple(
cfg.getParameter<
bool>(
"createNtuple")),
216 m_peakNSigma(
cfg.getParameter<double>(
"peakNSigma")),
217 m_BFieldCorrection(
cfg.getParameter<
int>(
"bFieldCorrection")),
218 m_doDT(
cfg.getParameter<
bool>(
"doDT")),
219 m_doCSC(
cfg.getParameter<
bool>(
"doCSC")),
220 m_useResiduals(
cfg.getParameter<
std::
string>(
"useResiduals")) {
265 m_ttree = fs->
make<TTree>(
"mual_ttree",
"mual_ttree");
291 return atoi(
s.c_str());
299 if (alignableMuon ==
nullptr)
300 throw cms::Exception(
"MuonAlignmentFromReference") <<
"doMuon must be set to True" << std::endl;
319 <<
"unrecognized residualsModel: \"" <<
m_residualsModel <<
"\"" << std::endl;
336 <<
"unrecognized useResiduals: \"" <<
m_useResiduals <<
"\"" << std::endl;
348 bool made_fitter =
false;
401 <<
"only DTChambers and CSCChambers can be aligned with this module" << std::endl;
407 int index = ali->geomDetId().rawId();
417 const auto& all_DT_chambers = alignableMuon->
DTChambers();
418 const auto& all_CSC_chambers = alignableMuon->
CSCChambers();
430 std::cout <<
"****** EVENT START *******" << std::endl;
448 std::cout <<
"JUST BEFORE LOOP OVER trajTrackPairs" << std::endl;
452 for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
466 std::cout <<
"JUST BEFORE muonResidualsFromTrack" << std::endl;
470 muonDetIdAssociator_,
477 std::cout <<
"JUST AFTER muonResidualsFromTrack" << std::endl;
480 std::cout <<
"JUST BEFORE PROCESS" << std::endl;
483 std::cout <<
"JUST AFTER PROCESS" << std::endl;
488 std::cout <<
"JUST AFTER LOOP OVER trajTrackPairs" << std::endl;
533 std::vector<DetId> chamberIds = mrft.
chamberIds();
540 for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end();
552 if (dt13 !=
nullptr && dt2 !=
nullptr) {
558 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
585 std::cout <<
"processMuonResidualsFromTrack 6DOF dt13->residual() " << dt13->
residual()
603 fitter->second->fill(
charge, residdata);
618 if (dt13 !=
nullptr) {
623 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
646 std::cout <<
"processMuonResidualsFromTrack 5DOF dt13->residual() " << dt13->
residual()
660 fitter->second->fill(
charge, residdata);
671 if (
csc !=
nullptr) {
681 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
m_fitters.find(ali);
697 std::cout <<
"processMuonResidualsFromTrack 6DOFrphi csc->residual() " <<
csc->residual()
711 fitter->second->fill(
charge, residdata);
756 <<
"That's all!" << std::endl;
758 TStopwatch stop_watch;
765 std::cout <<
"readTmpFiles took " << stop_watch.CpuTime() <<
" sec" << std::endl;
774 std::cout <<
"selectResidualsPeaks took " << stop_watch.CpuTime() <<
" sec" << std::endl;
782 std::cout <<
"correctBField took " << stop_watch.CpuTime() <<
" sec" << std::endl;
791 std::cout <<
"fiducialCuts took " << stop_watch.CpuTime() <<
" sec" << std::endl;
800 std::cout <<
"fillNtuple took " << stop_watch.CpuTime() <<
" sec" << std::endl;
808 std::cout <<
"eraseNotSelectedResiduals took " << stop_watch.CpuTime() <<
" sec" << std::endl;
817 std::cout <<
"fitAndAlign took " << stop_watch.CpuTime() <<
" sec" << std::endl;
825 std::cout <<
"end: MuonAlignmentFromReference::terminate()" << std::endl;
838 report <<
"nan = None; NAN = None" << std::endl;
839 report <<
"nan = 0" << std::endl;
840 report <<
"reports = []" << std::endl;
841 report <<
"class ValErr:" << std::endl
842 <<
" def __init__(self, value, error, antisym):" << std::endl
843 <<
" self.value, self.error, self.antisym = value, error, antisym" << std::endl
845 <<
" def __repr__(self):" << std::endl
846 <<
" if self.antisym == 0.:" << std::endl
847 <<
" return \"%g +- %g\" % (self.value, self.error)" << std::endl
848 <<
" else:" << std::endl
849 <<
" return \"%g +- %g ~ %g\" % (self.value, self.error, self.antisym)" << std::endl
851 <<
"class Report:" << std::endl
852 <<
" def __init__(self, chamberId, postal_address, name):" << std::endl
853 <<
" self.chamberId, self.postal_address, self.name = chamberId, postal_address, name" << std::endl
854 <<
" self.status = \"NOFIT\"" << std::endl
855 <<
" self.fittype = None" << std::endl
857 <<
" def add_parameters(self, deltax, deltay, deltaz, deltaphix, deltaphiy, deltaphiz, loglikelihood, "
858 "numsegments, sumofweights, redchi2):"
860 <<
" self.status = \"PASS\"" << std::endl
861 <<
" self.deltax, self.deltay, self.deltaz, self.deltaphix, self.deltaphiy, self.deltaphiz = deltax, "
862 "deltay, deltaz, deltaphix, deltaphiy, deltaphiz"
864 <<
" self.loglikelihood, self.numsegments, self.sumofweights, self.redchi2 = loglikelihood, "
865 "numsegments, sumofweights, redchi2"
868 <<
" def add_stats(self, median_x, median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, "
869 "mean50_dydz, mean15_x, mean15_y, mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, "
870 "wmean50_dydz, wmean15_x, wmean15_y, wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, "
871 "stdev50_dydz, stdev15_x, stdev15_y, stdev10_dxdz, stdev25_dydz):"
873 <<
" self.median_x, self.median_y, self.median_dxdz, self.median_dydz, self.mean30_x, self.mean30_y, "
874 "self.mean20_dxdz, self.mean50_dydz, self.mean15_x, self.mean15_y, self.mean10_dxdz, self.mean25_dydz, "
875 "self.wmean30_x, self.wmean30_y, self.wmean20_dxdz, self.wmean50_dydz, self.wmean15_x, self.wmean15_y, "
876 "self.wmean10_dxdz, self.wmean25_dydz, self.stdev30_x, self.stdev30_y, self.stdev20_dxdz, "
877 "self.stdev50_dydz, self.stdev15_x, self.stdev15_y, self.stdev10_dxdz, self.stdev25_dydz = median_x, "
878 "median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, mean50_dydz, mean15_x, mean15_y, "
879 "mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, wmean50_dydz, wmean15_x, wmean15_y, "
880 "wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, stdev50_dydz, stdev15_x, stdev15_y, "
881 "stdev10_dxdz, stdev25_dydz"
884 <<
" def __repr__(self):" << std::endl
885 <<
" return \"<Report %s %s %s>\" % (self.postal_address[0], \" \".join(map(str, "
886 "self.postal_address[1:])), self.status)"
892 std::cout <<
"***** just after report.open" << std::endl;
896 std::cout <<
"***** Start loop over alignables" << std::endl;
898 std::vector<bool> selector = ali->alignmentParameters()->selector();
899 bool align_x = selector[0];
900 bool align_y = selector[1];
901 bool align_z = selector[2];
902 bool align_phix = selector[3];
903 bool align_phiy = selector[4];
904 bool align_phiz = selector[5];
905 int numParams = ((align_x ? 1 : 0) + (align_y ? 1 : 0) + (align_z ? 1 : 0) + (align_phix ? 1 : 0) +
906 (align_phiy ? 1 : 0) + (align_phiz ? 1 : 0));
909 std::vector<int> paramIndex;
910 int paramIndex_counter = -1;
912 paramIndex_counter++;
913 paramIndex.push_back(paramIndex_counter);
915 paramIndex_counter++;
916 paramIndex.push_back(paramIndex_counter);
918 paramIndex_counter++;
919 paramIndex.push_back(paramIndex_counter);
921 paramIndex_counter++;
922 paramIndex.push_back(paramIndex_counter);
924 paramIndex_counter++;
925 paramIndex.push_back(paramIndex_counter);
927 paramIndex_counter++;
928 paramIndex.push_back(paramIndex_counter);
930 DetId id = ali->geomDetId();
940 std::cout <<
"***** loop over alignables 1" << std::endl;
943 char wheel_label[][2] = {
"A",
"B",
"C",
"D",
"E"};
950 sprintf(cname,
"MBwh%sst%dsec%02d", wheel_label[chamberId.
wheel() + 2], chamberId.
station(), chamberId.
sector());
952 report <<
"reports.append(Report(" <<
id.rawId() <<
", (\"DT\", " << chamberId.
wheel() <<
", "
953 << chamberId.
station() <<
", " << chamberId.
sector() <<
"), \"" << cname <<
"\"))" << std::endl;
959 (chamberId.
endcap() == 1 ?
"p" :
"m"),
967 report <<
"reports.append(Report(" <<
id.rawId() <<
", (\"CSC\", " << chamberId.
endcap() <<
", "
968 << chamberId.
station() <<
", " << chamberId.
ring() <<
", " << chamberId.
chamber() <<
"), \"" << cname
969 <<
"\"))" << std::endl;
974 std::cout <<
"***** loop over alignables 2" << std::endl;
978 std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
m_fitters.find(thisali);
981 std::cout <<
"***** loop over alignables 3" << std::endl;
986 TStopwatch stop_watch;
991 std::cout <<
"============================================================================================="
994 std::cout <<
"Fitting " << cname << std::endl;
997 report <<
"reports[-1].posNum = " << fitter->second->numResidualsPos() << std::endl;
998 report <<
"reports[-1].negNum = " << fitter->second->numResidualsNeg() << std::endl;
1042 std::cout <<
"***** loop over alignables 4" << std::endl;
1049 std::cout <<
"***** loop over alignables 5" << std::endl;
1051 bool successful_fit = fitter->second->fit(thisali);
1054 std::cout <<
"***** loop over alignables 6 " << fitter->second->type() << std::endl;
1056 double loglikelihood = fitter->second->loglikelihood();
1057 double numsegments = fitter->second->numsegments();
1058 double sumofweights = fitter->second->sumofweights();
1059 double redchi2 = fitter->second->plot(cname, &rootDirectory, thisali);
1063 std::cout <<
"***** loop over alignables k5DOF" << std::endl;
1093 double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1094 gammaresslope_antisym;
1095 gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1096 gammaresslope_antisym = 0.;
1111 report <<
"reports[-1].fittype = \"5DOF\"" << std::endl;
1112 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1113 << deltax_antisym <<
"), \\" << std::endl
1114 <<
" None, \\" << std::endl
1115 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1116 << deltaz_antisym <<
"), \\" << std::endl
1117 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1118 << deltaphix_antisym <<
"), \\" << std::endl
1119 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1120 << deltaphiy_antisym <<
"), \\" << std::endl
1121 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1122 << deltaphiz_antisym <<
"), \\" << std::endl
1123 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1124 <<
", " << redchi2 <<
")" << std::endl;
1125 report <<
"reports[-1].sigmaresid = ValErr(" << sigmaresid_value <<
", " << sigmaresid_error <<
", "
1126 << sigmaresid_antisym <<
")" << std::endl;
1127 report <<
"reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value <<
", " << sigmaresslope_error
1128 <<
", " << sigmaresslope_antisym <<
")" << std::endl;
1132 report <<
"reports[-1].gammaresid = ValErr(" << gammaresid_value <<
", " << gammaresid_error <<
", "
1133 << gammaresid_antisym <<
")" << std::endl;
1134 report <<
"reports[-1].gammaresslope = ValErr(" << gammaresslope_value <<
", " << gammaresslope_error
1135 <<
", " << gammaresslope_antisym <<
")" << std::endl;
1160 <<
"None)" << std::endl;
1162 std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1163 namesimple_x << cname <<
"_simple_x";
1164 namesimple_dxdz << cname <<
"_simple_dxdz";
1165 nameweighted_x << cname <<
"_weighted_x";
1166 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1169 fitter->second->plotsimple(
1172 fitter->second->plotweighted(nameweighted_x.str(),
1177 fitter->second->plotweighted(nameweighted_dxdz.str(),
1184 if (successful_fit) {
1186 params[paramIndex[0]] = deltax_value;
1188 params[paramIndex[2]] = deltaz_value;
1190 params[paramIndex[3]] = deltaphix_value;
1192 params[paramIndex[4]] = deltaphiy_value;
1194 params[paramIndex[5]] = deltaphiz_value;
1200 std::cout <<
"***** loop over alignables k6DOF" << std::endl;
1242 double gammax_value, gammax_error, gammax_antisym, gammay_value, gammay_error, gammay_antisym,
1243 gammadxdz_value, gammadxdz_error, gammadxdz_antisym, gammadydz_value, gammadydz_error, gammadydz_antisym;
1244 gammax_value = gammax_error = gammax_antisym = gammay_value = gammay_error = gammay_antisym =
1245 gammadxdz_value = gammadxdz_error = gammadxdz_antisym = gammadydz_value = gammadydz_error =
1246 gammadydz_antisym = 0.;
1268 report <<
"reports[-1].fittype = \"6DOF\"" << std::endl;
1269 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1270 << deltax_antisym <<
"), \\" << std::endl
1271 <<
" ValErr(" << deltay_value <<
", " << deltay_error <<
", "
1272 << deltay_antisym <<
"), \\" << std::endl
1273 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1274 << deltaz_antisym <<
"), \\" << std::endl
1275 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1276 << deltaphix_antisym <<
"), \\" << std::endl
1277 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1278 << deltaphiy_antisym <<
"), \\" << std::endl
1279 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1280 << deltaphiz_antisym <<
"), \\" << std::endl
1281 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1282 <<
", " << redchi2 <<
")" << std::endl;
1283 report <<
"reports[-1].sigmax = ValErr(" << sigmax_value <<
", " << sigmax_error <<
", " << sigmax_antisym
1284 <<
")" << std::endl;
1285 report <<
"reports[-1].sigmay = ValErr(" << sigmay_value <<
", " << sigmay_error <<
", " << sigmay_antisym
1286 <<
")" << std::endl;
1287 report <<
"reports[-1].sigmadxdz = ValErr(" << sigmadxdz_value <<
", " << sigmadxdz_error <<
", "
1288 << sigmadxdz_antisym <<
")" << std::endl;
1289 report <<
"reports[-1].sigmadydz = ValErr(" << sigmadydz_value <<
", " << sigmadydz_error <<
", "
1290 << sigmadydz_antisym <<
")" << std::endl;
1294 report <<
"reports[-1].gammax = ValErr(" << gammax_value <<
", " << gammax_error <<
", " << gammax_antisym
1295 <<
")" << std::endl;
1296 report <<
"reports[-1].gammay = ValErr(" << gammay_value <<
", " << gammay_error <<
", " << gammay_antisym
1297 <<
")" << std::endl;
1298 report <<
"reports[-1].gammadxdz = ValErr(" << gammadxdz_value <<
", " << gammadxdz_error <<
", "
1299 << gammadxdz_antisym <<
")" << std::endl;
1300 report <<
"reports[-1].gammadydz = ValErr(" << gammadydz_value <<
", " << gammadydz_error <<
", "
1301 << gammadydz_antisym <<
")" << std::endl;
1340 std::stringstream namesimple_x, namesimple_y, namesimple_dxdz, namesimple_dydz, nameweighted_x,
1341 nameweighted_y, nameweighted_dxdz, nameweighted_dydz;
1342 namesimple_x << cname <<
"_simple_x";
1343 namesimple_y << cname <<
"_simple_y";
1344 namesimple_dxdz << cname <<
"_simple_dxdz";
1345 namesimple_dydz << cname <<
"_simple_dydz";
1346 nameweighted_x << cname <<
"_weighted_x";
1347 nameweighted_y << cname <<
"_weighted_y";
1348 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1349 nameweighted_dydz << cname <<
"_weighted_dydz";
1353 fitter->second->plotsimple(
1355 fitter->second->plotsimple(
1358 fitter->second->plotweighted(nameweighted_x.str(),
1363 fitter->second->plotweighted(nameweighted_y.str(),
1368 fitter->second->plotweighted(nameweighted_dxdz.str(),
1373 fitter->second->plotweighted(nameweighted_dydz.str(),
1380 if (successful_fit) {
1382 params[paramIndex[0]] = deltax_value;
1384 params[paramIndex[1]] = deltay_value;
1386 params[paramIndex[2]] = deltaz_value;
1388 params[paramIndex[3]] = deltaphix_value;
1390 params[paramIndex[4]] = deltaphiy_value;
1392 params[paramIndex[5]] = deltaphiz_value;
1398 std::cout <<
"***** loop over alignables k6DOFrphi" << std::endl;
1432 double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1433 gammaresslope_antisym;
1434 gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1435 gammaresslope_antisym = 0.;
1449 report <<
"reports[-1].fittype = \"6DOFrphi\"" << std::endl;
1450 report <<
"reports[-1].add_parameters(ValErr(" << deltax_value <<
", " << deltax_error <<
", "
1451 << deltax_antisym <<
"), \\" << std::endl
1452 <<
" ValErr(" << deltay_value <<
", " << deltay_error <<
", "
1453 << deltay_antisym <<
"), \\" << std::endl
1454 <<
" ValErr(" << deltaz_value <<
", " << deltaz_error <<
", "
1455 << deltaz_antisym <<
"), \\" << std::endl
1456 <<
" ValErr(" << deltaphix_value <<
", " << deltaphix_error <<
", "
1457 << deltaphix_antisym <<
"), \\" << std::endl
1458 <<
" ValErr(" << deltaphiy_value <<
", " << deltaphiy_error <<
", "
1459 << deltaphiy_antisym <<
"), \\" << std::endl
1460 <<
" ValErr(" << deltaphiz_value <<
", " << deltaphiz_error <<
", "
1461 << deltaphiz_antisym <<
"), \\" << std::endl
1462 <<
" " << loglikelihood <<
", " << numsegments <<
", " << sumofweights
1463 <<
", " << redchi2 <<
")" << std::endl;
1464 report <<
"reports[-1].sigmaresid = ValErr(" << sigmaresid_value <<
", " << sigmaresid_error <<
", "
1465 << sigmaresid_antisym <<
")" << std::endl;
1466 report <<
"reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value <<
", " << sigmaresslope_error
1467 <<
", " << sigmaresslope_antisym <<
")" << std::endl;
1471 report <<
"reports[-1].gammaresid = ValErr(" << gammaresid_value <<
", " << gammaresid_error <<
", "
1472 << gammaresid_antisym <<
")" << std::endl;
1473 report <<
"reports[-1].gammaresslope = ValErr(" << gammaresslope_value <<
", " << gammaresslope_error
1474 <<
", " << gammaresslope_antisym <<
")" << std::endl;
1484 << fitter->second->wmean(
1488 << fitter->second->wmean(
1492 << fitter->second->wmean(
1496 << fitter->second->wmean(
1503 <<
"None)" << std::endl;
1505 std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1506 namesimple_x << cname <<
"_simple_x";
1507 namesimple_dxdz << cname <<
"_simple_dxdz";
1508 nameweighted_x << cname <<
"_weighted_x";
1509 nameweighted_dxdz << cname <<
"_weighted_dxdz";
1512 fitter->second->plotsimple(
1515 fitter->second->plotweighted(nameweighted_x.str(),
1520 fitter->second->plotweighted(nameweighted_dxdz.str(),
1527 if (successful_fit) {
1529 params[paramIndex[0]] = deltax_value;
1531 params[paramIndex[1]] = deltay_value;
1533 params[paramIndex[2]] = deltaz_value;
1535 params[paramIndex[3]] = deltaphix_value;
1537 params[paramIndex[4]] = deltaphiy_value;
1539 params[paramIndex[5]] = deltaphiz_value;
1543 if (successful_fit) {
1545 oneortwo.push_back(ali);
1547 oneortwo.push_back(thisali);
1551 std::cout <<
"MINUIT fit failed!" << std::endl;
1553 report <<
"reports[-1].status = \"MINUITFAIL\"" << std::endl;
1556 for (
int i = 0;
i < numParams;
i++)
1560 oneortwo.push_back(ali);
1562 oneortwo.push_back(thisali);
1567 std::cout <<
"Too few hits!" << std::endl;
1569 report <<
"reports[-1].status = \"TOOFEWHITS\"" << std::endl;
1572 for (
int i = 0;
i < numParams;
i++)
1576 oneortwo.push_back(ali);
1578 oneortwo.push_back(thisali);
1583 ali->setAlignmentParameters(parnew);
1585 ali->alignmentParameters()->setValid(
true);
1588 std::cout << cname <<
" fittime= " << stop_watch.CpuTime() <<
" sec" << std::endl;
1606 file = fopen((*fileName).c_str(),
"r");
1607 if (
file ==
nullptr)
1609 <<
"file \"" << *
fileName <<
"\" can't be opened (doesn't exist?)" << std::endl;
1611 fread(&
size,
sizeof(
int), 1,
file);
1615 <<
" fitters (probably corresponds to the wrong alignment job)" << std::endl;
1620 unsigned int index_toread;
1621 fread(&index_toread,
sizeof(
unsigned int), 1,
file);
1622 if (*
index != index_toread)
1624 <<
"file \"" << *
fileName <<
"\" has index " << index_toread <<
" at position " <<
i
1625 <<
", but this job is expecting " << *
index <<
" (probably corresponds to the wrong alignment job)"
1638 fwrite(&
size,
sizeof(
int), 1,
file);
1643 unsigned int index_towrite = *
index;
1644 fwrite(&index_towrite,
sizeof(
unsigned int), 1,
file);
1688 int vars_index[10] = {0, 1};
1754 sprintf(cname,
"MB%+d/%d/%02d", chamberId.
wheel(), chamberId.
station(), chamberId.
sector());
1759 (chamberId.
endcap() == 1 ?
"+" :
"-"),
1795 for (; residual != fitter->
residualsPos_end(); ++residual, ++residual_ok) {
1833 std::map<Alignable*, bool> already_seen;
1836 bool parsing_error =
false;
1841 parsing_error =
true;
1843 if (!parsing_error &&
barrel) {
1857 parsing_error =
true;
1860 bool wheel_digit =
false;
1870 parsing_error =
true;
1873 parsing_error =
true;
1877 bool station_digit =
false;
1881 station_digit =
true;
1885 parsing_error =
true;
1888 parsing_error =
true;
1892 bool sector_digit =
false;
1896 sector_digit =
true;
1900 parsing_error =
true;
1902 if (!parsing_error) {
1903 bool no_such_chamber =
false;
1905 if (wheel < -2 || wheel > 2)
1906 no_such_chamber =
true;
1907 if (station < 1 || station > 4)
1908 no_such_chamber =
true;
1909 if (
station == 4 && (sector < 1 || sector > 14))
1910 no_such_chamber =
true;
1911 if (
station < 4 && (sector < 1 || sector > 12))
1912 no_such_chamber =
true;
1914 if (no_such_chamber)
1916 <<
"reference chamber doesn't exist: " << (*name) << std::endl;
1919 for (
const auto& ali : all_DT_chambers) {
1920 if (ali->geomDetId().rawId() ==
id.rawId()) {
1921 std::map<Alignable*, bool>::const_iterator
trial = already_seen.find(ali);
1922 if (
trial == already_seen.end()) {
1924 already_seen[ali] =
true;
1931 if (!parsing_error &&
endcap) {
1945 parsing_error =
true;
1948 bool station_digit =
false;
1952 station_digit =
true;
1958 parsing_error =
true;
1961 parsing_error =
true;
1965 bool ring_digit =
false;
1973 parsing_error =
true;
1976 parsing_error =
true;
1980 bool chamber_digit =
false;
1984 chamber_digit =
true;
1988 parsing_error =
true;
1990 if (!parsing_error) {
1991 bool no_such_chamber =
false;
1995 if (station < 1 || station > 4)
1996 no_such_chamber =
true;
1997 if (
station == 1 && (ring < 1 || ring > 4))
1998 no_such_chamber =
true;
1999 if (
station > 1 && (ring < 1 || ring > 2))
2000 no_such_chamber =
true;
2001 if (
station == 1 && (chamber < 1 || chamber > 36))
2002 no_such_chamber =
true;
2003 if (
station > 1 &&
ring == 1 && (chamber < 1 || chamber > 18))
2004 no_such_chamber =
true;
2005 if (
station > 1 &&
ring == 2 && (chamber < 1 || chamber > 36))
2006 no_such_chamber =
true;
2008 if (no_such_chamber)
2010 <<
"reference chamber doesn't exist: " << (*name) << std::endl;
2013 for (
const auto& ali : all_CSC_chambers) {
2014 if (ali->geomDetId().rawId() ==
id.rawId()) {
2015 std::map<Alignable*, bool>::const_iterator
trial = already_seen.find(ali);
2016 if (
trial == already_seen.end()) {
2018 already_seen[ali] =
true;
2027 <<
"reference chamber name is malformed: " << (*name) << std::endl;