00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00015
00016
00017 #include "MakeAlignmentModule.h"
00018 #include "NtpAlignmentRecord.h"
00019 #include "NtpAlignTrackStrip.h"
00020 #include "NtpAlignCandStrip.h"
00021
00022
00023 #include "JobControl/JobCModuleRegistry.h"
00024 #include "MessageService/MsgService.h"
00025 #include "MessageService/MsgFormat.h"
00026 #include "MinosObjectMap/MomNavigator.h"
00027 #include "UgliGeometry/UgliGeomHandle.h"
00028
00029
00030 #include "TFile.h"
00031
00032
00033 #include <cassert>
00034 #include <sstream>
00035 #include <cmath>
00036
00037
00038 CVSID("$Id: MakeAlignmentModule.cxx,v 1.6 2005/08/10 21:07:39 rustem Exp $");
00039
00040 JOBMODULE(MakeAlignmentModule,"MakeAlignmentModule","MakeAlignmentModule");
00041
00042 using namespace std;
00043
00044 MakeAlignmentModule::MakeAlignmentModule()
00045 :fAlgorithm(0),
00046 fHistogram(0),
00047 fNearCoilOn(2004, 12, 9, 0, 0, 0),
00048 fIteration(0),
00049 fCurrentRun(0),
00050 fCurrentSubRun(0),
00051 fNProcessedSubruns(0),
00052 fNSubRunsPerSubset(41),
00053 fMaxTrackChargeCut(60000.0),
00054 fMinTrackChargeCut(4000.0),
00055 fMaxSigmaOfTPosCut(0.03),
00056 fTrackChargeRatioCut(0.5),
00057 fMinCosZCut(0.25),
00058 fMinTrackStripChargeCut(100.0),
00059 fMaxTrackStripChargeCut(5000.0),
00060 fSpecialNDRunNumber(5845),
00061 fRecalculateResidual(false),
00062 fApplyCuts(false),
00063 fStatisticalSubsetSize(1000000),
00064 fNFailedFit(0),
00065 fNRecords(0),
00066 fNPassedRecords(0),
00067 fNSubsetRecords(0),
00068 fNFailedRead(0),
00069 fNMissedVPlane(0),
00070 fNMissedUPlane(0),
00071 fTotalVPlaneHits(0),
00072 fTotalUPlaneHits(0),
00073 fFailedCut(0),
00074 fNHitsOutsideStrip(0),
00075 fNFailedCutMaxVStripCharge(0),
00076 fNFailedCutMaxUStripCharge(0),
00077 fMissedVPlaneMeanCharge(0.0),
00078 fMissedUPlaneMeanCharge(0.0),
00079 fMissedVPlaneChargeSigma(0.0),
00080 fMissedUPlaneChargeSigma(0.0),
00081 fNFailedTrackChargeCut(0),
00082 fNFailedStripChargeCut(0),
00083 fNFailedCosZCut(0),
00084 fNFailedChargeRatioCut(0),
00085 fNFailedSigmaTPosCut(0)
00086 {
00087 }
00088
00089 void MakeAlignmentModule::BeginJob()
00090 {
00091 MSG("Align", Msg::kDebug) << "MakeAlignmentModule::BeginJob()"<< endl;
00092 MSG("Align", Msg::kInfo) << "Initializing variables and histograms..." << endl;
00093
00094 const char* strENV_ALIGN_ITER = getenv("ENV_ALIGN_ITER");
00095 if ( strENV_ALIGN_ITER == 0 || strlen(strENV_ALIGN_ITER) == 0 )
00096 {
00097 MSG("Align", Msg::kFatal) << "ENV_ALIGN_ITER is not set!" <<endl
00098 << " Program is terminating now." <<endl;
00099 abort();
00100 } else
00101 fIteration = atoi(strENV_ALIGN_ITER);
00102
00103 string alignmentpath;
00104 const char* strENV_ALIGN_DIR = getenv("ENV_ALIGN_DIR");
00105 if ( strENV_ALIGN_DIR == 0 || strlen(strENV_ALIGN_DIR) == 0 )
00106 {
00107 MSG("Align", Msg::kFatal) << "ENV_ALIGN_DIR is not set!"
00108 << " Program is terminating now." <<endl;
00109 abort();
00110 } else
00111 alignmentpath = string(strENV_ALIGN_DIR);
00112
00113 const char* strENV_ALIGN_APPLYCUTS = getenv("ENV_ALIGN_APPLYCUTS");
00114 if ( strENV_ALIGN_APPLYCUTS == 0 || strlen(strENV_ALIGN_APPLYCUTS) == 0 )
00115 {
00116 MSG("Align", Msg::kWarning) << "ENV_ALIGN_APPLYCUTS is not set!"
00117 << " Using default value: fApplyCuts=false" <<endl;
00118 } else
00119 if(atoi(strENV_ALIGN_APPLYCUTS) == 1)
00120 fApplyCuts = true;
00121
00122 const char* strENV_ALIGN_RECALCULATE = getenv("ENV_ALIGN_RECALCULATE");
00123 if ( strENV_ALIGN_RECALCULATE == 0 || strlen(strENV_ALIGN_RECALCULATE) == 0 )
00124 {
00125 MSG("Align", Msg::kWarning) << "ENV_ALIGN_RECALCULATE is not set!"
00126 << " Using default value: fRecalculateResidual=false" <<endl;
00127 } else
00128 if(atoi(strENV_ALIGN_RECALCULATE)==1)
00129 fRecalculateResidual = true;
00130
00131 MSG("Align", Msg::kInfo) << endl << "fIteration = " << fIteration << endl
00132 << "Alignment path: " << alignmentpath << endl
00133 << "fApplyCuts = " << fApplyCuts <<endl
00134 << "fRecalculateResidual = " << fRecalculateResidual <<endl << endl;
00135
00136 stringstream ss;
00137 if(fApplyCuts)
00138 ss << alignmentpath << "/new_alignment_" << fIteration << ".root";
00139 else
00140 ss << alignmentpath << "/new_alignment_no_cuts_" << fIteration << ".root";
00141
00142 fRootFile = new TFile(ss.str().c_str(),"RECREATE");
00143
00144 fTimer.Start();
00145 fTimerInterval.Start();
00146 }
00147
00148
00149 JobCResult MakeAlignmentModule::Ana(const MomNavigator* mom)
00150 {
00151 fNRecords++;
00152
00153 NtpAlignmentRecord* ntprec = dynamic_cast<NtpAlignmentRecord*>(mom->GetFragment("NtpAlignmentRecord"));
00154 if(!ntprec) return JobCResult::kAOK;
00155
00156 const RecCandHeader candheader = ntprec->GetHeader();
00157 const int run = candheader.GetRun();
00158 const int subrun = candheader.GetSubRun();
00159 VldContext vldc = candheader.GetVldContext();
00160
00161 if(fNRecords % 10000 == 0)
00162 {
00163 MsgFormat f("%10d");
00164 MSG("Align", Msg::kInfo) << "Found NtpAlignmentRecord #" << f(fNRecords)
00165 << " run #" << run << ", subrun #" << subrun
00166 << ", cpu time = " << fTimerInterval.RealTime() <<endl;
00167 fTimerInterval.Reset();
00168 fTimerInterval.Start();
00169 }
00170
00171 if(!fAlgorithm && !fHistogram)
00172 {
00173 fValidityContext = vldc;
00174 fHistogram = new AlignmentHistograms(fRootFile, fValidityContext);
00175 fAlgorithm = new AlignmentAlgorithm(fRootFile, fValidityContext);
00176 }
00177
00178 if(fValidityContext.GetDetector() != vldc.GetDetector())
00179 {
00180 MSG("Align", Msg::kError) << "The data in current record is for the different detector!" << endl;
00181 return JobCResult::kAOK;
00182 } else
00183 fValidityContext = vldc;
00184
00185
00186 fRunSummary.Fill(ntprec);
00187
00188 if(fApplyCuts && !GetTrackQuality(ntprec))
00189 {
00190 fFailedCut++;
00191 return JobCResult::kAOK;
00192 }
00193
00194
00195 if(!ReadRecord(ntprec))
00196 {
00197 fFailedCut++;
00198 fNFailedRead++;
00199 return JobCResult::kAOK;
00200 }
00201
00202 if(fRecalculateResidual && !RecalculateResiduals())
00203 {
00204 return JobCResult::kAOK;
00205 }
00206
00207 ProcessRecord(ntprec);
00208
00209 fHistogram -> FillPlanePlex(fTrackVStrip, fCandVStrip);
00210 fHistogram -> FillPlanePlex(fTrackUStrip, fCandUStrip);
00211
00212 fNPassedRecords++;
00213 fNSubsetRecords++;
00214
00215 if(fCurrentRun != run || fCurrentSubRun != subrun)
00216 {
00217 fCurrentRun = run;
00218 fCurrentSubRun = subrun;
00219 fNProcessedSubruns++;
00220 if(fNProcessedSubruns % fNSubRunsPerSubset == 0)
00221 {
00222 if(fCurrentRun != fSpecialNDRunNumber ||
00223 fValidityContext.GetDetector() != DetectorType::kNear)
00224 {
00225 fAlgorithm -> ResetSubset(fValidityContext, fNSubsetRecords);
00226 fNSubsetRecords = 0;
00227 }
00228 }
00229 if(fCurrentRun == fSpecialNDRunNumber &&
00230 fValidityContext.GetDetector() == DetectorType::kNear)
00231 if(fCurrentSubRun == 0 || fCurrentSubRun == 24)
00232 {
00233 fAlgorithm -> ResetSubset(fValidityContext, fNSubsetRecords);
00234 fNSubsetRecords = 0;
00235 }
00236 }
00237
00238 return JobCResult::kAOK;
00239 }
00240
00241 void MakeAlignmentModule::EndJob()
00242 {
00243 PrintJobStatistics();
00244
00245 if(fHistogram) delete fHistogram;
00246
00247 if(fAlgorithm)
00248 {
00249 fAlgorithm -> ResetSubset(fValidityContext, fNSubsetRecords);
00250 fAlgorithm -> RunAlgorithm();
00251 delete fAlgorithm;
00252 }
00253
00254 fRunSummary.FillSummaryTree(fRootFile);
00255
00256 MSG("Align", Msg::kInfo) << "Saving root file " << fRootFile -> GetName() << endl;
00257 fRootFile -> Write();
00258 fRootFile -> Close();
00259
00260 MSG("Align", Msg::kInfo) << "MakeAlignmentModule is done." << endl;
00261 }
00262
00263
00264
00265 bool MakeAlignmentModule::GetTrackQuality(const NtpAlignmentRecord* ntprec)
00266 {
00267
00268
00269
00270
00271
00272
00273 if(ntprec->vcharge > fMaxTrackChargeCut || ntprec->vcharge < fMinTrackChargeCut ||
00274 ntprec->ucharge > fMaxTrackChargeCut || ntprec->ucharge < fMinTrackChargeCut)
00275 {
00276 fNFailedTrackChargeCut++;
00277 return false;
00278 }
00279
00280
00281 if(ntprec->vsigmaoftpos > fMaxSigmaOfTPosCut || ntprec->usigmaoftpos > fMaxSigmaOfTPosCut)
00282 {
00283 fNFailedSigmaTPosCut++;
00284 return false;
00285 }
00286
00287
00288 if(fabs(ntprec->hcosz) < fMinCosZCut)
00289 {
00290 fNFailedCosZCut++;
00291 return false;
00292 }
00293
00294 const double allcharge = ntprec -> vcharge + ntprec -> ucharge
00295 + ntprec -> vcandcharge + ntprec -> ucandcharge;
00296
00297 if(allcharge < 1.0)
00298 return false;
00299
00300 Double_t ratio = (ntprec -> vcharge + ntprec -> ucharge)/allcharge;
00301
00302 if(ratio < fTrackChargeRatioCut)
00303 {
00304 fNFailedChargeRatioCut++;
00305 return false;
00306 }
00307
00308 return true;
00309 }
00310
00311
00312
00313 bool MakeAlignmentModule::ReadRecord(const NtpAlignmentRecord* ntprec)
00314 {
00315 fTrackVStrip.clear();
00316 fTrackUStrip.clear();
00317 fCandVStrip.clear();
00318 fCandUStrip.clear();
00319
00320 UgliGeomHandle ugh(fValidityContext);
00321
00322 for(unsigned int i = 0; i < ntprec -> ntrackvstrip; ++i)
00323 {
00324 NtpAlignTrackStrip* strip = dynamic_cast<NtpAlignTrackStrip*>(ntprec->trackvstrip->At(i));
00325 assert(strip);
00326
00327 AlignmentStrip astrip(strip);
00328 if(fApplyCuts && astrip.charge > fMaxTrackStripChargeCut){
00329 fNFailedCutMaxVStripCharge++;
00330 fNFailedStripChargeCut++;
00331 return false;
00332 }
00333
00334 PlexStripEndId plexid(astrip.plexseid);
00335 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00336
00337 astrip.plane = plexid.GetPlane();
00338 astrip.strip = plexid.GetStrip();
00339 astrip.tpos = ush.GetTPos();
00340 astrip.zpos = ush.GetScintPlnHandle().GetZ0();
00341 astrip.tposrelmdl = ush.GetTPosRelMdl();
00342 astrip.lposrelmdl = ush.GetLPosRelMdl();
00343 astrip.charge_pc = astrip.charge * ntprec -> hcosz;
00344
00345
00346 astrip.ghitpos = (ntprec -> ufita)*astrip.zpos + ntprec -> ufitb;
00347
00348 ConvertToLocal(astrip, plexid, ugh, ush);
00349 fTrackVStrip.push_back(astrip);
00350 }
00351
00352
00353 for(unsigned int i = 0; i < ntprec -> ntrackustrip; ++i)
00354 {
00355 NtpAlignTrackStrip* strip = dynamic_cast<NtpAlignTrackStrip*>(ntprec->trackustrip->At(i));
00356 assert(strip);
00357
00358 AlignmentStrip astrip(strip);
00359 if(fApplyCuts && astrip.charge > fMaxTrackStripChargeCut){
00360 fNFailedCutMaxUStripCharge++;
00361 fNFailedStripChargeCut++;
00362 return false;
00363 }
00364
00365 PlexStripEndId plexid(astrip.plexseid);
00366 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00367
00368 astrip.plane = plexid.GetPlane();
00369 astrip.strip = plexid.GetStrip();
00370 astrip.tpos = ush.GetTPos();
00371 astrip.zpos = ush.GetScintPlnHandle().GetZ0();
00372 astrip.tposrelmdl = ush.GetTPosRelMdl();
00373 astrip.lposrelmdl = ush.GetLPosRelMdl();
00374 astrip.charge_pc = astrip.charge * ntprec -> hcosz;
00375
00376
00377 astrip.ghitpos = (ntprec -> vfita)*astrip.zpos + ntprec -> vfitb;
00378
00379 ConvertToLocal(astrip, plexid, ugh, ush);
00380 fTrackUStrip.push_back(astrip);
00381 }
00382
00383
00384 for(unsigned int i = 0; i < ntprec -> ncandvstrip; ++i)
00385 {
00386 NtpAlignCandStrip* strip = dynamic_cast<NtpAlignCandStrip*>(ntprec->candvstrip->At(i));
00387 assert(strip);
00388
00389 AlignmentStrip astrip(strip);
00390 PlexStripEndId plexid(astrip.plexseid);
00391 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00392
00393 astrip.tpos = ush.GetTPos();
00394 astrip.zpos = ush.GetScintPlnHandle().GetZ0();
00395 astrip.tposrelmdl = ush.GetTPosRelMdl();
00396 astrip.lposrelmdl = ush.GetLPosRelMdl();
00397 astrip.plane = plexid.GetPlane();
00398 astrip.strip = plexid.GetStrip();
00399 fCandVStrip.push_back(astrip);
00400
00401 fAlgorithm -> FillCandStrip(astrip);
00402 }
00403
00404 for(unsigned int i = 0; i < ntprec -> ncandustrip; ++i)
00405 {
00406 NtpAlignCandStrip* strip = dynamic_cast<NtpAlignCandStrip*>(ntprec->candustrip->At(i));
00407 assert(strip);
00408
00409 AlignmentStrip astrip(strip);
00410 PlexStripEndId plexid(astrip.plexseid);
00411 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00412
00413 astrip.tpos = ush.GetTPos();
00414 astrip.zpos = ush.GetScintPlnHandle().GetZ0();
00415 astrip.tposrelmdl = ush.GetTPosRelMdl();
00416 astrip.lposrelmdl = ush.GetLPosRelMdl();
00417 astrip.plane = plexid.GetPlane();
00418 astrip.strip = plexid.GetStrip();
00419 fCandUStrip.push_back(astrip);
00420
00421 fAlgorithm -> FillCandStrip(astrip);
00422 }
00423
00424 fTotalVPlaneHits += fTrackVStrip.size();
00425 fTotalUPlaneHits += fTrackUStrip.size();
00426 return true;
00427 }
00428
00429
00430
00431 void MakeAlignmentModule::ProcessRecord(const NtpAlignmentRecord* ntprec)
00432 {
00433 for(vector<AlignmentStrip>::const_iterator vit = fTrackVStrip.begin();
00434 vit != fTrackVStrip.end(); ++vit)
00435 {
00436 const AlignmentStrip &astrip = *vit;
00437 fAlgorithm -> Fill(astrip);
00438 fHistogram -> Fill(astrip, ntprec);
00439 }
00440
00441 for(vector<AlignmentStrip>::const_iterator uit = fTrackUStrip.begin();
00442 uit != fTrackUStrip.end(); ++uit)
00443 {
00444 const AlignmentStrip &astrip = *uit;
00445 fAlgorithm -> Fill(astrip);
00446 fHistogram -> Fill(astrip, ntprec);
00447 }
00448
00449 }
00450
00451
00452 bool MakeAlignmentModule::RecalculateResiduals()
00453 {
00454
00455 UgliGeomHandle ugh(fValidityContext);
00456
00457 for(unsigned int i = 0; i < fTrackVStrip.size(); ++i){
00458 AlignmentStrip &astrip = fTrackVStrip[i];
00459 PlexStripEndId plexid(astrip.plexseid);
00460 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00461 TVector3 local(astrip.lhitpos, 0, 0);
00462 TVector3 globalxyz = ush.GlobalPos(astrip.lhitpos);
00463 TVector3 globaluvz = ugh.xyz2uvz(globalxyz);
00464 double tpos = globaluvz.y();
00465 double zpos = globaluvz.z();
00466 if(fabs(astrip.tpos-tpos) > 0.001){
00467 MsgFormat f("%10.9f");
00468 MSG("Align",Msg::kError) << "global tpos - local tpos = " << f(astrip.tpos-tpos) <<endl;
00469 }
00470 if(fabs(astrip.zpos-zpos) > 0.001){
00471 MsgFormat f("%10.9f");
00472 MSG("Align",Msg::kError) << "zpos before - zpos after = " << f(astrip.zpos-zpos) <<endl;
00473 }
00474 astrip.tpos = globaluvz.y();
00475 }
00476
00477 for(unsigned int i = 0; i < fTrackUStrip.size(); ++i){
00478 AlignmentStrip &astrip = fTrackUStrip[i];
00479 PlexStripEndId plexid(astrip.plexseid);
00480 UgliStripHandle ush = ugh.GetStripHandle(plexid);
00481 TVector3 local(astrip.lhitpos, 0, 0);
00482 TVector3 globalxyz = ush.GlobalPos(astrip.lhitpos);
00483 TVector3 globaluvz = ugh.xyz2uvz(globalxyz);
00484 double tpos = globaluvz.x();
00485 double zpos = globaluvz.z();
00486 if(fabs(astrip.tpos-tpos) > 0.001){
00487 MsgFormat f("%10.9f");
00488 MSG("Align",Msg::kError) << "global tpos - local tpos = " << f(astrip.tpos-tpos) <<endl;
00489 }
00490 if(fabs(astrip.zpos-zpos) > 0.001){
00491 MsgFormat f("%10.9f");
00492 MSG("Align",Msg::kError) << "zpos before - zpos after = " << f(astrip.zpos-zpos) <<endl;
00493 }
00494
00495 astrip.tpos = globaluvz.x();
00496 }
00497
00498 for(vector<AlignmentStrip>::iterator vit = fTrackVStrip.begin();
00499 vit != fTrackVStrip.end(); ++vit){
00500 double residual = FitTrackLessOne(fTrackVStrip.begin(), fTrackVStrip.end(), vit);
00501 if(fabs(residual) > 1.0)
00502 return false;
00503 AlignmentStrip &astrip = *vit;
00504 if(fabs(astrip.residual-residual) > 0.00001){
00505 MsgFormat ffrt("%7.6f");
00506 MSG("Align", Msg::kError) << "V residual diff after tpos correction for "
00507 << PlexStripEndId(astrip.plexseid) << " = "
00508 << ffrt(residual - astrip.residual) << endl;
00509 }
00510 astrip.residual = residual;
00511 }
00512
00513 for(vector<AlignmentStrip>::iterator uit = fTrackUStrip.begin();
00514 uit != fTrackUStrip.end(); ++uit){
00515 double residual = FitTrackLessOne(fTrackUStrip.begin(), fTrackUStrip.end(), uit);
00516 if(fabs(residual) > 1.0)
00517 return false;
00518 AlignmentStrip &astrip = *uit;
00519 if(fabs(astrip.residual-residual) > 0.00001){
00520 MsgFormat ffrt("%7.6f");
00521 MSG("Align", Msg::kError) << "U residual diff after tpos correction for "
00522 << PlexStripEndId(astrip.plexseid) << " = "
00523 << ffrt(residual - astrip.residual) << endl;
00524 }
00525
00526 astrip.residual = residual;
00527 }
00528 return true;
00529 }
00530
00531
00532
00533
00534 double MakeAlignmentModule::FitTrackLessOne(vector<AlignmentStrip>::const_iterator begin,
00535 vector<AlignmentStrip>::const_iterator end,
00536 vector<AlignmentStrip>::const_iterator skip)
00537 {
00538
00539
00540 MSG("Align", Msg::kVerbose) << "FitTrackLessOne..." << endl;
00541
00542
00543
00544 double A=0.0, B=0.0, C=0.0, D=0.0, E=0.0, F=0.0;
00545
00546 for (vector<AlignmentStrip>::const_iterator run = begin; run != end; ++run)
00547 if (run != skip){
00548 double x = run -> zpos;
00549 double y = run -> tpos;
00550 A += x;
00551 B += 1.0;
00552 C += y;
00553 D += x*x;
00554 E += x*y;
00555 F += y*y;
00556 }
00557
00558 double det = B*D - A*A;
00559 if(fabs(det) < 0.000001){
00560 MSG("Align", Msg::kWarning) << "Linear fit failed!" << endl;
00561 return -100.0;
00562 }
00563
00564
00565 double a = (E*B-C*A)/det;
00566 double b = (D*C-E*A)/det;
00567
00568 double skipped_x = skip -> zpos;
00569 double skipped_y = skip -> tpos;
00570 double predict = a*skipped_x + b;
00571
00572 MSG("Align", Msg::kVerbose) << "FitTrackLessOne Done!" << endl;
00573 return (predict - skipped_y);
00574
00575 }
00576
00577
00578 void MakeAlignmentModule::ConvertToLocal(AlignmentStrip &astrip,
00579 PlexStripEndId &plexid,
00580 UgliGeomHandle &ugh,
00581 UgliStripHandle &ush)
00582 {
00583
00584
00585
00586 Double_t halflen = ush.GetHalfLength();
00587
00588
00589 TVector3 localWestEnd(+halflen, 0.0, 0.0);
00590
00591
00592
00593
00594
00595
00596
00597 Double_t u = 0.0, v = 0.0;
00598
00599 if(plexid.GetPlaneView() == PlaneView::kU){
00600 v = astrip.ghitpos;
00601 u = astrip.residual + astrip.tpos;
00602 } else {
00603 u = astrip.ghitpos;
00604 v = astrip.residual + astrip.tpos;
00605 }
00606
00607
00608 TVector3 ghituvz(u, v, astrip.zpos);
00609 TVector3 ghitxyz = ugh.uvz2xyz(ghituvz);
00610 TVector3 lhitxyz = ush.GlobalToLocal(ghitxyz);
00611
00612 astrip.length = 2.0*halflen;
00613 astrip.lhitpos = lhitxyz.x();
00614 astrip.pigtail = ush.WlsPigtail(StripEnd::kWest);
00615 astrip.wlsbypass = ush.WlsBypass();
00616
00617 if(fabs(lhitxyz.x()) > halflen){
00618 astrip.goodhit = false;
00619 fNHitsOutsideStrip++;
00620 }
00621 }
00622
00623
00624
00625 void MakeAlignmentModule::PrintJobStatistics()
00626 {
00627 MSG("Align", Msg::kInfo) << "MakeAlignmentModule::EndJob()"<< endl << endl;
00628
00629 MSG("Align", Msg::kInfo) << "Cpu time = " << fTimer.CpuTime() <<endl;
00630 MSG("Align", Msg::kInfo) << "Real time = " << fTimer.RealTime() <<endl;
00631 MSG("Align", Msg::kInfo) << "fNPassedRecords = " << fNPassedRecords << endl;
00632 MSG("Align", Msg::kInfo) << "fNRecords = " << fNRecords << endl;
00633 MSG("Align", Msg::kInfo) << "fFailedCut = " << fFailedCut << endl;
00634 MSG("Align", Msg::kInfo) << "fNFailedFit = " << fNFailedFit << endl;
00635 MSG("Align", Msg::kInfo) << "fNFailedRead = " << fNFailedRead << endl;
00636 MSG("Align", Msg::kInfo) << "fNMissedVPlane = " << fNMissedVPlane << endl;
00637 MSG("Align", Msg::kInfo) << "fNMissedUPlane = " << fNMissedUPlane << endl;
00638 MSG("Align", Msg::kInfo) << "fTotalVPlaneHits = " << fTotalVPlaneHits << endl;
00639 MSG("Align", Msg::kInfo) << "fTotalUPlaneHits = " << fTotalUPlaneHits << endl;
00640 MSG("Align", Msg::kInfo) << "fNHitsOutsideStrip = " << fNHitsOutsideStrip << endl;
00641 if(fApplyCuts)
00642 {
00643 MSG("Align", Msg::kInfo) << "fNFailedCutMaxVStripCharge = " << fNFailedCutMaxVStripCharge <<endl;
00644 MSG("Align", Msg::kInfo) << "fNFailedCutMaxUStripCharge = " << fNFailedCutMaxUStripCharge <<endl;
00645 MSG("Align", Msg::kInfo) << "fNFailedTrackChargeCut = " << fNFailedTrackChargeCut << endl;
00646 MSG("Align", Msg::kInfo) << "fNFailedCosZCut = " << fNFailedCosZCut << endl;
00647 MSG("Align", Msg::kInfo) << "fNFailedSigmaTPosCut = " << fNFailedSigmaTPosCut << endl;
00648 MSG("Align", Msg::kInfo) << "fNFailedChargeRatioCut = " << fNFailedChargeRatioCut << endl;
00649 MSG("Align", Msg::kInfo) << "fNFailedStripChargeCut = " << fNFailedStripChargeCut << endl;
00650 }
00651
00652 MSG("Align", Msg::kInfo) << endl;
00653
00654 if(fNMissedVPlane > 1){
00655 Double_t size = fNMissedVPlane;
00656 fMissedVPlaneMeanCharge = fMissedVPlaneMeanCharge/size;
00657 fMissedVPlaneChargeSigma = pow(fMissedVPlaneChargeSigma/size -
00658 fMissedVPlaneMeanCharge*fMissedVPlaneMeanCharge, 0.5);
00659 MSG("Align", Msg::kInfo) << "fMissedVPlaneMeanCharge = " << fMissedVPlaneMeanCharge
00660 << " +/- " << fMissedVPlaneChargeSigma <<endl;
00661 }
00662
00663 if(fNMissedUPlane > 1){
00664 Double_t size = fNMissedUPlane;
00665 fMissedUPlaneMeanCharge = fMissedUPlaneMeanCharge/size;
00666 fMissedUPlaneChargeSigma = pow(fMissedUPlaneChargeSigma/size -
00667 fMissedUPlaneMeanCharge*fMissedUPlaneMeanCharge, 0.5);
00668 MSG("Align", Msg::kInfo) << "fMissedUPlaneMeanCharge = " << fMissedUPlaneMeanCharge
00669 << " +/- " << fMissedUPlaneChargeSigma <<endl;
00670 }
00671
00672 MSG("Align", Msg::kInfo) << endl;
00673 }
00674
00675
00676
00677 void MakeAlignmentModule::PrintAlignmentStrip(const AlignmentStrip& astrip)
00678 {
00679
00680 MsgFormat ffmt("%10.9f");
00681 MsgFormat ffrt("%5.4f");
00682 MsgFormat fimt("%5d");
00683
00684 MSG("Align", Msg::kVerbose) << PlexStripEndId(astrip.plexseid)
00685 << " charge = " << fimt(astrip.charge)
00686 << " begtime = " << ffmt(astrip.begtime)
00687 << " ndigit = " << astrip.ndigit
00688 << " residual = " << ffrt(astrip.residual) << endl;
00689 }