10 #include "TPaveStats.h"
22 sprintf(
_path, path );
43 TLegend * legend =
new TLegend (x1, y1, x2, y2,
"",
"NBNDC");
44 legend->SetNColumns(6);
45 legend->SetFillColor(0);
46 legend->SetBorderSize(0);
50 detNames[0] = TString(
"PXB");
51 detNames[1] = TString(
"PXF");
52 detNames[2] = TString(
"TIB");
53 detNames[3] = TString(
"TID");
54 detNames[4] = TString(
"TOB");
55 detNames[5] = TString(
"TEC");
57 for (
unsigned int isublevel = 0 ; isublevel < 6 ; isublevel++)
59 TGraph *
g =
new TGraph (0);
60 g->SetLineColor(COLOR_CODE[isublevel]);
61 g->SetMarkerColor(COLOR_CODE[isublevel]);
62 g->SetFillColor(COLOR_CODE[isublevel]);
66 legend->AddEntry(g,detNames[isublevel],
"lp");
74 cout<<
"--- extracting AlignParams ; Par "<<currentPar<<
" ---"<<endl<<endl;
82 cout<<
"Loaded par file -. OK"<<endl;
84 const TList* keysv = fv->GetListOfKeys();
85 const unsigned int maxIteration = keysv->GetSize() - 1;
89 else sprintf(fileaction,
"NEW");
93 TTree* tree0 = (TTree*) fv->Get(keysv->At(0)->GetName() );
102 tree0->SetBranchAddress(
"Id", &detId0 );
104 const int ndets=tree0->GetEntries();
107 sprintf(ppdirname,
"ShiftsPar%d", currentPar);
108 fout->mkdir(ppdirname);
109 gDirectory->cd(ppdirname);
113 TH1D *hpariter[maxIteration];
114 for(
unsigned int a = 0;
a < maxIteration;
a++){
115 char histoname[32],histotitle[32];
116 sprintf(histoname,
"Par_%d_Iter_%d",currentPar,
a);
117 sprintf(histotitle,
"Par %d for iteration #%d",currentPar,
a);
118 hpariter[
a]=
new TH1D(histoname,histoname,1000,-1.0,1.0);
121 for(
int i = 0;
i < ndets;
i++){
122 char histoname[32],histotitle[32];
123 sprintf(histoname,
"Par_%d_SiDet_%d",currentPar,
i);
124 sprintf(histotitle,
"Par %d for detector #%d",currentPar,
i);
125 hpar1[
i]=
new TH1D(histoname,histoname,maxIteration+1,-0.5,maxIteration+0.5);
129 ofstream flist(
"./List_aligned_dets.txt",
ios::out);
133 int modules_accepted = 0;
134 for(
unsigned int iter = 0; iter <= maxIteration; iter++){
138 TTree* tmpTree = (TTree*) fv->Get(keysv->At(iter)->GetName() );
140 tmpTree->SetBranchAddress(
"Id", &detId );
141 tmpTree->SetBranchAddress(
"Nhit", &nHit );
142 tmpTree->SetBranchAddress(
"Par", &par );
144 std::cout <<
"iteration: " << iter <<
"..." << std::endl;
148 for(
int j = 0;
j < tmpTree->GetEntries();
j++){
150 tmpTree->GetEntry(
j);
151 bool passSubdetCut =
true;
152 if (subDet > 0){
if (
GetSubDet(detId) != subDet ) passSubdetCut =
false; }
153 if (doubleSided > 0){
158 if (( nHit >= minHits )&&( passSubdetCut )){
159 hpar1[
j]->SetBinContent(iter+1,par[currentPar]);
163 hpar1[
j]->SetLineColor(COLOR_CODE[
GetSubDet(detId)-1]);
164 hpar1[
j]->SetMarkerColor(COLOR_CODE[
GetSubDet(detId)-1]);
169 if((iter==maxIteration-1)&&(currentPar==0))flist<<detId<<endl;
176 std::cout <<
"Modules accepted: " << modules_accepted << std::endl;
192 cout<<
"\n--- extracting AlignShifts ; Par "<<currentPar<<
" ---"<<endl<<endl;
194 const TList* keysa = fa->GetListOfKeys();
195 const unsigned int maxIteration = keysa->GetSize();
198 const TList* keysv = fv->GetListOfKeys();
205 else sprintf(fileaction,
"NEW");
208 TTree* tree0 = (TTree*) fa->Get(keysa->At(0)->GetName() );
209 const char* tree0v_Name = keysv->At(0)->GetName();
210 tree0->AddFriend( tree0v_Name, fv );
214 tree0->SetBranchAddress(
"Id", &detId0 );
216 const int ndets=tree0->GetEntries();
219 TH1D *hiter_ali[maxIteration];
221 sprintf(ppdirname,
"Shifts%d", currentPar);
222 fout->mkdir(ppdirname);
223 gDirectory->cd(ppdirname);
225 for(
unsigned int a = 0;
a < maxIteration;
a++){
226 char histoname[64],histotitle[64];
230 sprintf(histoname,
"AlignedShift_%d_Iter_%d",currentPar,
a);
231 sprintf(histotitle,
"Aligned Shift %d for iteration #%d",currentPar,
a);
232 hiter_ali[
a]=
new TH1D(histoname,histoname,ndets,0,ndets);
234 for(
int i = 0;
i < ndets;
i++){
235 char histoname[64],histotitle[64];
236 sprintf(histoname,
"Shift_%d_SiDet_%d",currentPar,
i);
237 sprintf(histotitle,
"Shift %d for detector #%d",currentPar,
i);
238 hshift[
i]=
new TH1D(histoname,histoname,maxIteration,-0.5,maxIteration-0.5);
242 int modules_accepted = 0;
254 detNames[0] = TString(
"PXB");
255 detNames[1] = TString(
"PXF");
256 detNames[2] = TString(
"TIB");
257 detNames[3] = TString(
"TID");
258 detNames[4] = TString(
"TOB");
259 detNames[5] = TString(
"TEC");
264 TTree* tmpTree_true = (TTree*)fa->Get(
"AlignablesAbsPos_0");
268 tmpTree_true->SetBranchAddress(
"Pos", &tpos );
270 if (currentPar >= 3 ){
272 tmpTree_true->SetBranchAddress(
"Rot", &trot );
275 for(
unsigned int iter = 1; iter < maxIteration; iter++){
277 TTree* tmpTree = (TTree*) fa->Get(keysa->At(iter)->GetName() );
278 const char* tmpTreev = keysv->At(iter)->GetName();
279 tmpTree->AddFriend( tmpTreev, fv );
280 tmpTree->SetBranchAddress(
"Id", &detId );
281 tmpTree->SetBranchAddress(
"Nhit", &nHit );
282 tmpTree->SetBranchAddress(
"ParError", &aerr );
284 if (currentPar < 3){ tmpTree->SetBranchAddress(
"Pos", &apos ); }
285 tmpTree->SetBranchAddress(
"Rot", &arot );
290 for(
int j = 0;
j < tmpTree->GetEntries();
j++){
291 tmpTree_true->GetEntry(
j);
292 tmpTree->GetEntry(
j);
298 bool passSubdetCut =
true;
300 if (subDet > 0){
if (
GetSubDet(detId) != subDet ) passSubdetCut =
false; }
303 hshift[
j]->SetLineColor(COLOR_CODE[
GetSubDet(detId)-1]);
304 hshift[
j]->SetMarkerColor(COLOR_CODE[
GetSubDet(detId)-1]);
306 if (( nHit >= minHits )&&( passSubdetCut )){
310 TVectorD dr_ali(3, apos);
311 TVectorD r_true(3, tpos);
312 TMatrixD R_true(3, 3, trot);
324 hshift[
j]->SetBinContent(iter+1,dr_ali[currentPar]);
328 hiter_ali[iter]->SetBinContent(
j+1,dr_ali[currentPar]);
332 if (currentPar >= 3){
334 TMatrixD dR_ali(3, 3, arot);
335 TMatrixD R_true(3, 3, trot);
337 dR_ali = dR_ali * TMatrixD(TMatrixD::kTransposed, R_true);
340 double dR_ali_euler = 0;
341 if (currentPar == 3 ){
343 dR_ali_euler = -std::atan2(dR_ali(2, 1), dR_ali(2, 2));
345 if (currentPar == 4 ){
347 dR_ali_euler = -std::asin(dR_ali(2, 0));
349 if (currentPar == 5 ){
351 dR_ali_euler = -std::atan2(dR_ali(1, 0), dR_ali(0, 0));
353 hshift[
j]->SetBinContent(iter+1,dR_ali_euler);
355 hiter_ali[iter]->SetBinContent(
j+1,dR_ali_euler);
358 hiter_ali[iter]->GetXaxis()->SetBinLabel(
j+1,detNames[
GetSubDet(detId)-1]);
359 hiter_ali[iter]->SetBinError(
j+1,aerr[currentPar]);
361 hiter_ali[iter]->LabelsOption(
"u",
"x");
368 std::cout <<
"Modules accepted: " << modules_accepted << std::endl;
373 std::cout <<
"Deleting..." << std::flush;
375 std::cout <<
"Deleting..." << std::flush;
388 cout<<
"_|_| plotting AlignParams |_|_"<<endl<<
"---> "<<ShiftsOrParams <<endl;
389 bool bParams =
false;
390 bool bShifts =
false;
391 if (ShiftsOrParams ==
"PARAMS") bParams =
true;
392 if (ShiftsOrParams ==
"SHIFTS") bShifts =
true;
399 TCanvas *c_params =
new TCanvas(
"can_params",
"CAN_PARAMS",1200,900);
400 c_params->Divide(3,2);
405 d = (TDirectory*)f->Get(
"ShiftsPar0");
410 d = (TDirectory*)f->Get(
"Shifts0");
415 for(
int iPar = 0; iPar < 6; iPar++){
417 c_params->cd( iPar+1 );
418 gPad->SetTopMargin(0.15);
419 gPad->SetBottomMargin(0.15);
421 if (bParams) sprintf( ppdirname,
"ShiftsPar%d", iPar );
422 if (bShifts) sprintf( ppdirname,
"Shifts%d", iPar );
423 if(iPar > 0)gDirectory->cd(
"../");
424 gDirectory->cd(ppdirname);
429 int sampling_ratio=1;
430 int ndets_plotted=(int)ndets/sampling_ratio;
431 cout<<
"Plotting "<<ndets_plotted<<
" detectors over a total of "<<ndets<<endl;
433 double histomax, histomin;
458 while((i<ndets_plotted) && (i*sampling_ratio<ndets) ){
459 if (bParams) sprintf(histoname,
"Par_%d_SiDet_%d",iPar,i*sampling_ratio);
460 if (bShifts) sprintf(histoname,
"Shift_%d_SiDet_%d",iPar,i*sampling_ratio);
461 hpar1[
i]=(TH1D*)gDirectory->Get(histoname);
463 if(iPar>=3)hpar1[
i]->Scale(1000.0);
464 else hpar1[
i]->Scale(10000.0);
466 hpar1[
i]->SetMarkerStyle(7);
467 hpar1[
i]->SetStats(0);
469 double tmpmax=hpar1[
i]->GetBinContent(hpar1[i]->GetMaximumBin());
470 double tmpmin=hpar1[
i]->GetBinContent(hpar1[i]->GetMinimumBin());
473 if(tmpmax>histomax)histomax=tmpmax*1.2;
474 if(tmpmin<histomin)histomin=tmpmin*1.2;
479 hpar1[
i]->SetXTitle(
"Iteration");
482 if(iPar==0)hpar1[
i]->SetYTitle(
"#delta u param (#mum)");
483 else if(iPar==1)hpar1[
i]->SetYTitle(
"#delta v param (#mum)");
484 else if(iPar==2)hpar1[
i]->SetYTitle(
"#delta w param (#mum)");
485 else if(iPar==3)hpar1[
i]->SetYTitle(
"#delta #alpha param (mrad)");
486 else if(iPar==4)hpar1[
i]->SetYTitle(
"#delta #beta param (mrad)");
487 else if(iPar==5)hpar1[
i]->SetYTitle(
"#delta #gamma param (mrad)");
488 else hpar1[
i]->SetYTitle(
"dunno");}
490 if(iPar==0)hpar1[
i]->SetYTitle(
"#delta u shift (#mum)");
491 else if(iPar==1)hpar1[
i]->SetYTitle(
"#delta v shift (#mum)");
492 else if(iPar==2)hpar1[
i]->SetYTitle(
"#delta w shift (#mum)");
493 else if(iPar==3)hpar1[
i]->SetYTitle(
"#delta #alpha shift (mrad)");
494 else if(iPar==4)hpar1[
i]->SetYTitle(
"#delta #beta shift (mrad)");
495 else if(iPar==5)hpar1[
i]->SetYTitle(
"#delta #gamma shift (mrad)");
496 else hpar1[
i]->SetYTitle(
"dunno");}
498 hpar1[
i]->GetYaxis()->SetTitleOffset(1.5);
500 hpar1[
i]->SetTitle(
"");
501 hpar1[
i]->SetMaximum(histomax);
502 hpar1[
i]->SetMinimum(histomin);
503 hpar1[
i]->Draw(
"PL");
506 else hpar1[
i]->Draw(
"PLsame");
509 hpar1[0]->SetMaximum(histomax);
510 hpar1[0]->SetMinimum(histomin);
512 cout<<
"Plotted "<<i<<
" aligned detectors"<<endl;
517 c_params->SaveAs(plotName);
518 std::cout <<
"Deleting..." << std::flush;
520 std::cout <<
"Deleting..." << std::flush;
530 cout<<
"Welcome to HIPplots::plotAlignParamsAtIter "<<iter<<endl;
531 bool bParams =
false;
532 bool bShifts =
false;
533 if (ShiftsOrParams ==
"PARAMS") bParams =
true;
534 else if (ShiftsOrParams ==
"SHIFTS") bShifts =
true;
535 else {
cout<<
"ERROR in plotAliParamsAtIter!!! Wrong input argument: "<<ShiftsOrParams<<
" . Exiting"<<endl;
return;}
541 TCanvas *c_params =
new TCanvas(
"can_params",
"CAN_PARAMS",1200,700);
542 c_params->Divide(3,2);
548 for(
int iPar = 0; iPar < 6; iPar++){
550 c_params->cd( iPar+1 );
552 gPad->SetTopMargin(0.15);
553 gPad->SetBottomMargin(0.15);
555 if (bParams) sprintf( ppdirname,
"ShiftsPar%d", iPar );
556 if (bShifts) sprintf( ppdirname,
"Shifts%d", iPar );
557 if(iPar > 0)gDirectory->cd(
"../");
558 gDirectory->cd(ppdirname);
563 if (bParams) sprintf( histoname,
"Par_%d_Iter_%d", iPar, iter );
564 if (bShifts) sprintf( histoname,
"AlignedShift_%d_Iter_%d", iPar, iter );
565 hiter = (TH1D*) gDirectory->Get(histoname);
571 hiter->SetXTitle(
"Sub-Det");
572 if(iPar==0)hiter->SetYTitle(
"#delta u (#mum)");
573 else if(iPar==1)hiter->SetYTitle(
"#delta v (#mum)");
574 else if(iPar==2)hiter->SetYTitle(
"#delta w (#mum)");
575 else if(iPar==3)hiter->SetYTitle(
"#delta #alpha (#murad)");
576 else if(iPar==4)hiter->SetYTitle(
"#delta #beta (#murad)");
577 else if(iPar==5)hiter->SetYTitle(
"#delta #gamma (#murad)");
578 else hiter->SetXTitle(
"dunno");
579 hiter->GetYaxis()->SetTitleOffset(1.5);
581 double histomax,histomin;
582 if(iPar==2||iPar==5) {histomax=200; histomin=-200;}
583 else {histomax=100; histomin=-100;}
585 if(iPar>=3)hiter->Scale(1000000.0);
586 else hiter->Scale(10000.0);
587 double tmpmax=hiter->GetBinContent(hiter->GetMaximumBin());
588 double tmpmin=hiter->GetBinContent(hiter->GetMinimumBin());
589 if(tmpmax>histomax)histomax=tmpmax*1.2;
590 if(tmpmin<histomin)histomin=tmpmin*1.2;
591 hiter->SetMaximum(histomax);
592 hiter->SetMinimum(histomin);
594 hiter->SetLineColor(1);
595 TColor *
col = gROOT->GetColor(kCyan+1);
597 hiter->SetFillColor(col->GetNumber());
599 hiter->SetMarkerStyle(7);
616 c_params->SaveAs(plotName);
630 cout<<
"\n--- Welcome to extractAlignableChiSquare ---"<<endl;
631 cout<<
"\nInput parameters:\n\tMinimum number of hits per alignbale = "<<minHits<<
"\n\tSubdetetctor selection"<<subDet<<endl;
634 cout<<
"Warning ! Allowing to select modules with NO hits. Chi2 not defined for them. Setting automatically minNhits=1 !!!"<<endl;
639 const TList* keysv = fv->GetListOfKeys();
640 const unsigned int maxIteration = keysv->GetSize() - 1;
641 cout<<
"MaxIteration is "<<maxIteration <<endl;
645 else sprintf(fileaction,
"NEW");
648 TTree* tree0 = (TTree*) fv->Get(keysv->At(0)->GetName() );
650 tree0->SetBranchAddress(
"Id", &detId0 );
651 const int ndets=tree0->GetEntries();
652 TH1D *halichi2n[ndets];
653 TH1D *htotchi2n[maxIteration];
654 TH1D *hprobdist[maxIteration];
656 sprintf(ppdirname,
"AlignablesChi2n");
657 fout->mkdir(ppdirname);
658 gDirectory->cd(ppdirname);
660 for(
int iter = 1; iter <=(int)maxIteration ; iter++){
661 char histoname[64],histotitle[128];
662 sprintf(histoname,
"Chi2n_iter%d",iter);
663 sprintf(histotitle,
"Distribution of Normalised #chi^{2} for All alignables at iter %d",iter);
664 htotchi2n[iter-1]=
new TH1D(histoname,histotitle,1000,0.0,10.0);
665 sprintf(histoname,
"ProbChi2_%d",iter);
666 sprintf(histotitle,
"Distribution of Prob(#chi^{2},ndof) at iter %d",iter);
667 hprobdist[iter-1]=
new TH1D(histoname,histotitle,100,0.0,1.0);
669 gDirectory->mkdir(
"AlignablewiseChi2n");
670 gDirectory->cd(
"AlignablewiseChi2n");
672 for(
int i = 0;
i < (int)ndets;
i++){
674 char histoname[64],histotitle[64];
675 sprintf(histoname,
"Chi2n_%d",
i);
676 sprintf(histotitle,
"Normalised #chi^{2} for detector #%d",
i);
677 halichi2n[
i]=
new TH1D(histoname,histotitle,maxIteration,0.5,maxIteration+0.5);
681 int modules_accepted = 0;
682 for(
unsigned int iter = 1; iter <= maxIteration; iter++){
684 TTree* tmpTreeUV = (TTree*) fv->Get(keysv->At(iter)->GetName() );
685 cout<<
"Taking tree "<<keysv->At(iter)->GetName()<<endl;
687 tmpTreeUV->SetBranchStatus(
"*",0);
688 tmpTreeUV->SetBranchStatus(
"Id",1);
689 tmpTreeUV->SetBranchStatus(
"Nhit",1);
690 tmpTreeUV->SetBranchStatus(
"AlignableChi2",1);
691 tmpTreeUV->SetBranchStatus(
"AlignableNdof",1);
693 unsigned int alindof=0;
695 unsigned int detId=0;
696 tmpTreeUV->SetBranchAddress(
"AlignableChi2",&alichi2);
697 tmpTreeUV->SetBranchAddress(
"AlignableNdof",&alindof);
698 tmpTreeUV->SetBranchAddress(
"Id",&detId);
699 tmpTreeUV->SetBranchAddress(
"Nhit",&nHit);
703 for(
int j = 0;
j < tmpTreeUV->GetEntries();
j++){
704 tmpTreeUV->GetEntry(
j);
706 bool passSubdetCut =
true;
707 if (subDet > 0){
if (
GetSubDet(detId) != subDet ) passSubdetCut =
false; }
708 if (doubleSided > 0){
713 if (( nHit >= minHits )&&( passSubdetCut ) ){
714 halichi2n[
j]->SetBinContent(iter,
double(alichi2 / alindof));
716 double prob=TMath::Prob(
double(alichi2),
int(alindof));
718 htotchi2n[iter-1]->Fill(
double(alichi2 / alindof));
719 hprobdist[iter-1]->Fill(prob);
724 cout<<
"alignables accepted at iteration "<<iter<<
" = "<<modules_accepted<<endl;
739 cout<<
"Finished extractAlignableChiSquare"<<endl;
745 cout<<
"\n--- extractSurveyResiduals has been called ---"<<endl;
748 const TList* keysv = fv->GetListOfKeys();
749 const unsigned int maxIteration = keysv->GetSize() ;
750 cout<<
"MaxIteration is "<<maxIteration <<endl;
754 else sprintf(fileaction,
"NEW");
757 TTree* tree0 = (TTree*) fv->Get(keysv->At(0)->GetName() );
759 tree0->SetBranchAddress(
"Id", &detId0 );
760 const int ndets=tree0->GetEntries();
761 TH1D *hsurvey[ndets];
762 TH1D *htotres[maxIteration];
765 sprintf(ppdirname,
"SurveyResiduals");
766 fout->mkdir(ppdirname);
767 gDirectory->cd(ppdirname);
769 for(
int iter = 1; iter <=(int)maxIteration ; iter++){
770 char histoname[64],histotitle[128];
771 sprintf(histoname,
"SurveyRes_Par%d_iter%d",currentPar,iter);
772 sprintf(histotitle,
"Distribution of survey Residuals for All alignables ; Par=%d ; iter %d",currentPar,iter);
773 htotres[iter-1]=
new TH1D(histoname,histotitle,1000,0.0,10.0);
775 gDirectory->mkdir(
"SurveyResiduals_alignables");
776 gDirectory->cd(
"SurveyResiduals_alignables");
778 for(
int i = 0;
i < (int)ndets;
i++){
780 char histoname[64],histotitle[64];
781 sprintf(histoname,
"SurveyRes_Par%d_%d",currentPar,
i);
782 sprintf(histotitle,
"Survey residual for detector #%d - Par=%d",
i,currentPar);
783 hsurvey[
i]=
new TH1D(histoname,histotitle,maxIteration,0.5,maxIteration+0.5);
787 int modules_accepted = 0;
788 for(
unsigned int iter = 1; iter <= maxIteration; iter++){
790 TTree* tmpTreeUV = (TTree*) fv->Get(keysv->At(iter)->GetName() );
791 cout<<
"Taking tree "<<keysv->At(iter)->GetName()<<endl;
793 tmpTreeUV->SetBranchStatus(
"*",0);
794 tmpTreeUV->SetBranchStatus(
"Id",1);
795 tmpTreeUV->SetBranchStatus(
"Par",1);
798 unsigned int detId=0;
799 tmpTreeUV->SetBranchAddress(
"Par",&par);
800 tmpTreeUV->SetBranchAddress(
"Id",&detId);
805 for(
int j = 0;
j < tmpTreeUV->GetEntries();
j++){
806 tmpTreeUV->GetEntry(
j);
808 bool passSubdetCut =
true;
809 if (subDet > 0){
if (
GetSubDet(detId) != subDet ) passSubdetCut =
false; }
810 if ( passSubdetCut ){
811 hsurvey[
j]->SetBinContent(iter,
double(par[currentPar]));
817 cout<<
"alignables accepted at iteration "<<iter<<
" = "<<modules_accepted<<endl;
825 cout<<
"Finished extractAlignableChiSquare"<<endl;
837 TCanvas *c_alichi2n=
new TCanvas(
"can_alichi2n",
"CAN_ALIGNABLECHI2N",900,900);
839 TDirectory *chi_d1=(TDirectory*)f->Get(
"AlignablesChi2n");
841 cout<<
"N iterations "<<maxIteration<<endl;
843 gDirectory->cd(
"AlignablesChi2n");
844 TDirectory *chi_d=(TDirectory*)gDirectory->Get(
"AlignablewiseChi2n");
847 gDirectory->cd(
"AlignablewiseChi2n");
850 int sampling_ratio=1;
851 int ndets_plotted=(int)ndets/sampling_ratio;
852 cout<<
"Sampling "<<ndets_plotted<<
" detectors over a total of "<<ndets<<endl;
853 double histomax=0.1, histomin=-0.1;
854 bool firstplotted=
false;
855 int firstplottedindex=0;
858 while((i<ndets_plotted) && (i*sampling_ratio<ndets) ){
859 sprintf(histoname,
"Chi2n_%d",i);
860 hchi2n[
i]=(TH1D*)gDirectory->Get(histoname);
865 for(
int bin=1;
bin<=hchi2n[
i]->GetNbinsX();
bin++){
866 if(hchi2n[i]->GetBinContent(
bin)>minChi2n){chi2ncut=
true;
break;}
875 if(chi2ncut&&plothisto){
876 double tmpmax=hchi2n[
i]->GetBinContent(hchi2n[i]->GetMaximumBin());
877 double tmpmin=hchi2n[
i]->GetBinContent(hchi2n[i]->GetMinimumBin());
880 if(tmpmax>histomax)histomax=tmpmax;
881 if(tmpmin<histomin)histomin=tmpmin;
883 hchi2n[
i]->SetMaximum(histomax);
884 hchi2n[
i]->SetMinimum(histomin);
885 hchi2n[
i]->SetStats(0);
889 hchi2n[
i]->SetXTitle(
"Iteration");
890 hchi2n[
i]->SetYTitle(
"#chi^{2} / # dof");
892 hchi2n[
i]->SetTitle(
"Reduced #chi^{2} for alignables");
893 hchi2n[
i]->Draw(
"PL");
897 else hchi2n[
i]->Draw(
"PLsame");
902 hchi2n[firstplottedindex]->SetMaximum(histomax*1.2);
903 hchi2n[firstplottedindex]->SetMinimum(histomin*0.8);
905 hchi2n[firstplottedindex]->SetMaximum(histomax);
906 hchi2n[firstplottedindex]->SetMinimum(histomin);
908 cout<<
"Plotted "<<totalplotted<<
" alignables over an initial sample of "<<ndets_plotted<<endl;
909 TText *txtchi2n_1=
new TText();
910 txtchi2n_1->SetTextFont(63);
911 txtchi2n_1->SetTextSize(22);
912 char strchi2n_1[128];
913 sprintf(strchi2n_1,
"Plotted alignables (Chi2n > %.3f): %d / %d",minChi2n,totalplotted,ndets_plotted);
914 txtchi2n_1->DrawText(1.2,0.0,strchi2n_1);
915 char finplotname[192];
916 sprintf(finplotname,
"%s.png",plotName);
917 c_alichi2n->SaveAs(finplotname);
922 cout<<
"Doing distrib"<<endl;
923 gDirectory->cd(
"../");
924 TCanvas *c_chi2ndist=
new TCanvas(
"can_chi2ndistr",
"CAN_CHI2N_DISTRIBUTION",900,900);
926 TH1D *hiter[maxIteration];
927 TLegend *
l=
new TLegend(0.7,0.7,0.9,0.9);
930 int colors[10]={1,2,8,4,6,7,94,52,41,45};
934 for(i=0;i<maxIteration;i++){
935 sprintf(histoname,
"Chi2n_iter%d",i+1);
936 hiter[
i]=(TH1D*)gDirectory->Get(histoname);
937 hiter[
i]->SetXTitle(
"#chi^{2} / dof");
938 hiter[
i]->SetYTitle(
"Alignables");
939 hiter[
i]->SetTitle(
"Normalised #chi^{2} of Alignables");
941 hiter[
i]->GetXaxis()->SetRangeUser(0.0,3.0);
942 hiter[
i]->SetLineColor(i);
944 char legend_entry[64];
945 float histmean=hiter[
i]->GetMean();
947 hiter[
i]->SetLineColor(colors[taken]);
949 sprintf(legend_entry,
"Norm #chi^{2}; Iter %d; %.4f",i,histmean);
950 l->AddEntry(hiter[i],legend_entry,
"L");
951 tmpmax=hiter[
i]->GetBinContent(hiter[i]->GetMaximumBin());
956 hiter[
i]->SetLineColor(colors[taken]);
958 sprintf(legend_entry,
"Norm #chi^{2}; Iter %d; %.4f",i+1,histmean);
959 l->AddEntry(hiter[i],legend_entry,
"L");
960 tmpmax=hiter[
i]->GetBinContent(hiter[i]->GetMaximumBin());
961 if(tmpmax>newmax)newmax=tmpmax;
965 cout<<
"NewMax after 1st loop -> "<<newmax<<endl;
967 for(i=0;i<maxIteration;i++){
968 hiter[
i]->SetMaximum(newmax*1.1);
969 if(i==1) hiter[
i]->Draw(
"");
970 else if((i+1)%5==0) hiter[
i]->Draw(
"same");
974 sprintf(finplotname,
"%s_distr.png",plotName);
975 cout<<finplotname<<endl;
976 c_chi2ndist->SaveAs(finplotname);
977 c_chi2ndist->SetLogy();
978 sprintf(finplotname,
"%s_distrlog.png",plotName);
979 cout<<finplotname<<endl;
980 c_chi2ndist->SaveAs(finplotname);
991 int fin_iter=0,
i=startingcounter;
992 bool obj_exist=kTRUE;
995 sprintf(objname,
"%s%d",tag,
i);
996 if(!f->FindObjectAny(objname))obj_exist=kFALSE;
1000 cout<<
"Max Iterations is "<<fin_iter<<endl;
1007 const int reserved_subdetectorstartbit=25;
1008 const int reserved_subdetectorfinalbit=27;
1010 unsigned int detID = id;
1012 int shift = 31-reserved_subdetectorfinalbit;
1013 detID = detID<<(
shift);
1014 shift = reserved_subdetectorstartbit +
shift;
1015 detID = detID>>(
shift);
1023 const int reserved_layerstartbit=14;
1024 const int reserved_layermask=0x7;
1026 return int((
id>>reserved_layerstartbit) & reserved_layermask);
1032 Double_t
xmin = 10000;
1033 Double_t
xmax = -10000;
1036 for(
int i = 1;
i <= h->GetNbinsX(); ++
i) {
1037 if((h->GetBinContent(
i) > 0)&&(h->GetBinCenter(
i)>
xmax) ) xmax = h->GetBinCenter(
i);
1039 for(
int i = h->GetNbinsX();
i >= 1; --
i) {
1040 if((h->GetBinContent(
i) > 0)&&(h->GetBinCenter(
i)<
xmin) ) xmin = h->GetBinCenter(
i);
1043 h->SetAxisRange((xmin-xmin*0.1), (xmax+xmax*0.1),
"X");
1051 cout<<
"Starting plotHitMap"<<flush;
1054 cout<<
"\tLoaded file"<<flush;
1056 TTree *talignable=(TTree*)falignable->Get(
"T2");
1057 cout<<
"\t Loaded tree"<<endl;
1059 float eta=-999.0,
phi=-55.0, xpos=-999.0,ypos=+999.0,zpos=-11111.0;
1060 int layer=-1,
type=-1, nhit=-11111;
1062 talignable->SetBranchAddress(
"Id",&
id);
1063 talignable->SetBranchAddress(
"Layer",&layer);
1064 talignable->SetBranchAddress(
"Type",&
type);
1065 talignable->SetBranchAddress(
"Nhit",&nhit);
1066 talignable->SetBranchAddress(
"Ypos",&ypos);
1067 talignable->SetBranchAddress(
"Eta",&eta);
1068 talignable->SetBranchAddress(
"Phi",&
phi);
1069 talignable->SetBranchAddress(
"Ypos",&ypos);
1070 talignable->SetBranchAddress(
"Xpos",&xpos);
1071 talignable->SetBranchAddress(
"Zpos",&zpos);
1076 if(subDet ==
TPBid){sprintf(typetag,
"TPB");maxLayers=3;}
1077 else if(subDet ==
TPEid){sprintf(typetag,
"TPE");maxLayers=2;}
1078 else if(subDet ==
TIBid){sprintf(typetag,
"TIB");maxLayers=4;}
1079 else if(subDet ==
TIDid){sprintf(typetag,
"TID");maxLayers=3;}
1080 else if(subDet ==
TOBid){sprintf(typetag,
"TOB");maxLayers=6;}
1081 else if(subDet ==
TECid){sprintf(typetag,
"TEC");maxLayers=9;}
1082 else {sprintf(typetag,
"UNKNOWN");}
1083 cout<<
"Starting to plot Hit Distributions for "<<typetag<<endl;
1085 bool printbinning=
true;
1088 sprintf(psname,
"%s/Hits_%s_Layers_Skimmed.eps",outpath,typetag);
1090 char binfilename[64];
1091 sprintf(binfilename,
"./BinningHitMaps_%s.txt",typetag);
1092 ofstream binfile(binfilename,
ios::out);
1095 binfile<<
"******** Binning for Subdet "<<typetag<<
" *********"<<endl<<endl;
1098 for(
int layerindex=1;layerindex<=maxLayers;layerindex++){
1100 cout<<
"\n\n*** Layer # "<<layerindex<<
" ***"<<endl;
1102 talignable->SetBranchStatus(
"*",0);
1103 talignable->SetBranchStatus(
"Id",1);
1104 talignable->SetBranchStatus(
"Type",1);
1105 talignable->SetBranchStatus(
"Layer",1);
1106 talignable->SetBranchStatus(
"Nhit",1);
1107 talignable->SetBranchStatus(
"Eta",1);
1108 talignable->SetBranchStatus(
"Phi",1);
1109 talignable->SetBranchStatus(
"Ypos",1);
1110 talignable->SetBranchStatus(
"Zpos",1);
1111 talignable->SetBranchStatus(
"Xpos",1);
1113 TCut selA,selECpos,selECneg;
1114 char selA_str[196],selECneg_str[196],selECpos_str[196];
1115 char varA_str[64],varB_str[64];
1116 char commonsense_str[128]=
"Xpos>-150.0&&Xpos<150.0&&Ypos>-150.0&&Ypos<150.0&&Zpos>-400.0&&Zpos<400.0";
1117 TCut commonsense=commonsense_str;
1119 sprintf(selECneg_str,
"(Type==%d && Layer==%d && Zpos<0.0 && Nhit>=%d && sqrt(pow(Xpos,2)+pow(Ypos,2) )<125.0 )",subDet,layerindex,minHits);
1120 sprintf(selECpos_str,
"(Type==%d && Layer==%d && Zpos>=0.0 && Nhit>=%d && sqrt(pow(Xpos,2)+pow(Ypos,2) )<125.0 )",subDet,layerindex,minHits);
1122 sprintf(selA_str,
"Type==%d && Layer==%d",subDet,layerindex);
1124 sprintf(varA_str,
"Eta>>hvarx");
1125 sprintf(varB_str,
"Phi>>hvary");
1127 selECneg=selECneg_str;
1128 selECpos=selECpos_str;
1130 cout<<
"Cuts defined as "<<selA<<endl;
1139 int nzentries= talignable->Draw(
"Zpos>>hZ(360,-270.0,270.0)",commonsense&&selA,
"goff");
1140 TH1F *hZ=(TH1F*)gDirectory->Get(
"hZ");
1145 for(bin=0;bin<120;bin++){
1148 const int nZpeaks=
FindPeaks(hZ,Zpeaks,99);
1149 const int nZbinlims=nZpeaks+1;
1150 float Zwidth=(Zpeaks[nZpeaks-1]-Zpeaks[0])/ (nZpeaks-1) ;
1151 float Zmin=Zpeaks[0]- Zwidth/2.0 ;
1152 float Zmax=Zpeaks[nZpeaks-1] + Zwidth/2.0;
1153 cout<<
"--> Zmin= "<<Zmin<<
" - Zmax= "<<Zmax<<
" Zwidth= "<<Zwidth<<
" ; found "<<nZpeaks<<
" Zpeaks"<<endl;
1154 cout<<
"Zpeaks[0] is "<<Zpeaks[0]<<endl;
1157 float Phipeaks[120];
1158 if((subDet==
TIBid||subDet==
TOBid)&&layerindex<=2) sprintf(selA_str,
"%s&&Zpos>%f&&Zpos<%f",selA_str,Zpeaks[0]-2.0,Zpeaks[0]+2.0);
1159 else sprintf(selA_str,
"%s&&Zpos>%f&&Zpos<%f",selA_str,Zpeaks[0]-2.0,Zpeaks[0]+2.0);
1160 int nphientries=talignable->Draw(
"Phi>>hPhi",selA_str,
"goff");
1161 cout<<
"N phi entries "<<nphientries<<
" from sel "<<selA_str<< endl;
1162 TH1F *hPhi=(TH1F*)gDirectory->Get(
"hPhi");
1164 if(subDet==
TPBid&&layerindex==1)nphientries=nphientries-1;
1165 const int nPhibins=nphientries;
1166 cout<<
"+ It would have found "<<nPhibins<<
" phi bins"<<endl;
1169 float phibin[nPhibins+1];
1170 float zbin[nZbinlims];
1171 float Phiwidth=6.28/nPhibins;
1173 if((subDet==
TIBid||subDet==
TOBid)&&layerindex<=2){
1176 cout<<
"Gonna loop over "<<nZpeaks<<
" peaks / "<<nZbinlims<<
" bin limits"<<endl;
1177 for(bin=0;bin<nZbinlims-1;bin++){
1182 zup=(Zpeaks[bin+1]-Zpeaks[
bin])/2.0;
1185 else if(bin==nZbinlims-2){
1186 cout<<
"Don't go overflow !"<<endl;
1187 zdown=(Zpeaks[
bin]-Zpeaks[bin-1])/2.0;
1188 if(layerindex==1) zup=(Zpeaks[bin-1]-Zpeaks[bin-2])/2.0;
1192 zup=(Zpeaks[bin+1]-Zpeaks[
bin])/2.0;
1193 zdown=(Zpeaks[
bin]-Zpeaks[bin-1])/2.0;
1195 zbin[
bin] = Zpeaks[
bin]-zdown;
1196 zbin[bin+1]= Zpeaks[
bin]+zup;
1202 for(
int bin=0;bin<=nPhibins;++
bin){
1203 if(bin==0)phibin[
bin]=-3.14+bin*(Phiwidth)+Phiwidth/4;
1204 else if(bin==nPhibins-1)phibin[
bin]=-3.14+bin*(Phiwidth)-Phiwidth/4;
1206 else phibin[
bin]=phibin[bin-1]+ Phiwidth;
1211 for(
int bin=0;bin<nZbinlims;++
bin){
1212 zbin[
bin]=Zmin+bin*(Zwidth);
1215 for(
int bin=0;bin<=nPhibins;++
bin){
1216 phibin[
bin]=-3.14+bin*(Phiwidth);
1221 float Phimin=Phipeaks[0]- ((Phipeaks[1]-Phipeaks[0])/2.0) ;
1222 float Phimax=Phipeaks[nPhibins-1] + ((Phipeaks[nPhibins-1]-Phipeaks[nPhibins-2])/2.0) ;
1224 cout<<
"N Z bin LIMITs = "<<nZbinlims<<
" N Phi bin LIMITS = "<<nPhibins<<endl;
1230 sprintf(histoname,
"%s_Layer%d",typetag,layerindex);
1231 TH2F *hetaphi=
new TH2F(histoname,histoname,nZpeaks,zbin,nPhibins,phibin);
1234 cout<<
"Starting to loop on entries"<<flush;
1236 int nlowentrycells=0;
1238 for(
int j=0;
j<talignable->GetEntries();
j++){
1239 if(
j%1000==0)
cout<<
"."<<flush;
1240 talignable->GetEntry(
j);
1241 if(
type==subDet&&layer==layerindex){
1244 hetaphi->Fill(zpos,
phi,nhit);
1248 hetaphi->Fill(zpos,
phi,-99);
1256 hetaphi->SetXTitle(
"Z [cm]");
1257 hetaphi->SetYTitle(
"#phi (rad)");
1259 int Nxbins=hetaphi->GetXaxis()->GetNbins();
1260 int Nybins=hetaphi->GetYaxis()->GetNbins();
1261 cout<<
"On x-axis there are "<<Nxbins<<
" bins "<<endl;
1262 cout<<
"On y-axis there are "<<Nybins<<
" bins "<<endl;
1265 bool smooth_etaphi=
false;
1267 for(
int i=1;
i<=Nxbins;
i++){
1268 for(
int j=1;
j<=Nybins;
j++){
1269 float bincont=hetaphi->GetBinContent(
i,
j);
1271 float binup1=hetaphi->GetBinContent(
i,
j+1);
1272 float bindown1=hetaphi->GetBinContent(
i,
j-1);
1273 float binlx1=hetaphi->GetBinContent(
i-1,
j);
1274 float binrx1=hetaphi->GetBinContent(
i+1,
j);
1275 if(
i==1)binlx1=binrx1;
1276 if(
i==Nxbins)binrx1=binlx1;
1277 if(
j==1)bindown1=binup1;
1278 if(
j==Nybins)binup1=bindown1;
1280 if(binup1>0.0)adiacentbins++;
1281 if(bindown1>0.0)adiacentbins++;
1282 if(binlx1>0.0)adiacentbins++;
1283 if(binrx1>0.0)adiacentbins++;
1284 if(adiacentbins>=2){
1285 float avg=(binup1+bindown1+binlx1+binrx1)/adiacentbins;
1286 hetaphi->SetBinContent(
i,
j,avg);
1296 bool plotAlignablePos=
false;
1297 if(plotAlignablePos){
1298 const int ngrpoints=nmods;
1299 float etagr[ngrpoints],phigr[ngrpoints];
1301 for(
int j=0;
j<talignable->GetEntries();
j++){
1302 if(
j%1000==0)
cout<<
"."<<flush;
1303 talignable->GetEntry(
j);
1304 if(
type==subDet&&layer==layerindex){
1311 gretaphi=
new TGraph(ngrpoints,etagr,phigr);
1312 gretaphi->SetMarkerStyle(20);
1313 gretaphi->SetMarkerColor(1);
1314 gretaphi->SetMarkerSize(0.75);
1322 float Phicellgr[512];
1324 for(
int zcells=1;zcells<=hetaphi->GetNbinsX();zcells++){
1325 for(
int phicells=1;phicells<=hetaphi->GetNbinsY();phicells++){
1326 if( hetaphi->GetBinContent( zcells,phicells)==-99){
1327 hetaphi->SetBinContent( zcells,phicells,0);
1328 Zcellgr[nemptycells]= float(hetaphi->GetXaxis()->GetBinCenter(zcells));
1329 Phicellgr[nemptycells]= float(hetaphi->GetYaxis()->GetBinCenter(phicells));
1335 TGraph *gr_empty=
new TGraph( nlowentrycells,Zcellgr,Phicellgr);
1336 sprintf(histoname,
"gr_emptycells_subdet%d_layer%d",subDet,layerindex);
1338 gr_empty->SetName(histoname);
1339 gr_empty->SetMarkerStyle(5);
1343 cout<<
" Done! Used "<<nmods<<
" alignables. Starting to plot !"<<endl;
1346 gStyle->SetPalette(1,0);
1347 TCanvas *c_barrels=
new TCanvas(
"canvas_hits_barrels",
"CANVAS_HITS_BARRELS",1600,1600);
1348 TCanvas *c_endcaps=
new TCanvas(
"canvas_hits_endcaps",
"CANVAS_HITS_ENDCAPS",3200,1600);
1349 TPad *pleft=
new TPad(
"left_panel",
"Left Panel",0.0,0.0,0.49,0.99);
1350 TPad *pcent=
new TPad(
"central_up_panel",
"Central Panel",0.01,0.00,0.99,0.99);
1351 TPad *pright=
new TPad(
"right_panel",
"Right Panel",0.51,0.0,0.99,0.99);
1354 if(subDet==1 ||subDet==3 ||subDet==5 ){
1358 gPad->SetRightMargin(0.15);
1362 hetaphi->SetStats(0);
1363 if(subDet==
TPBid||subDet==
TIBid||subDet==
TOBid)hetaphi->Draw(
"COLZtext");
1364 if(plotAlignablePos) gretaphi->Draw(
"P");
1365 gr_empty->Draw(
"P");
1368 binfile<<
"--> Layer #"<<layerindex<<endl;
1369 binfile<<
"Eta Binning: "<<flush;
1370 for(
int h=1;
h<=hetaphi->GetNbinsX();
h++){
1371 binfile<<hetaphi->GetXaxis()->GetBinLowEdge(
h)<<
"\t";
1372 if(
h==hetaphi->GetNbinsX()) binfile<<hetaphi->GetXaxis()->GetBinLowEdge(
h)+hetaphi->GetXaxis()->GetBinWidth(
h);
1375 binfile<<
"Phi Binning: "<<flush;
1376 for(
int h=1;
h<=hetaphi->GetNbinsY();
h++){
1377 binfile<<hetaphi->GetYaxis()->GetBinLowEdge(
h)<<
"\t";
1378 if(
h==hetaphi->GetNbinsX()) binfile<<hetaphi->GetYaxis()->GetBinLowEdge(
h)+hetaphi->GetYaxis()->GetBinWidth(
h);
1391 gPad->SetRightMargin(0.15);
1392 char selEC_str[192], varEC_str[128];
1394 if(subDet ==
TPBid){radlimit=45.0;}
1395 else if(subDet ==
TPEid){radlimit=45.0;}
1396 else if(subDet ==
TIBid){radlimit=70.0;}
1397 else if(subDet ==
TIDid){radlimit=70.0;}
1398 else if(subDet ==
TOBid){radlimit=130.0;}
1399 else if(subDet ==
TECid){radlimit=130.0;}
1400 else {radlimit=0.0;}
1402 sprintf(varEC_str,
"Ypos:Xpos>>hxy_negz(30,%f,%f)",-radlimit,radlimit);
1403 sprintf(selEC_str,
"Nhit*(%s&&%s)",selECneg_str,commonsense_str);
1404 cout<<selEC_str<<endl;
1405 int selentriesECneg=talignable->Draw(varEC_str,selEC_str,
"goff");
1406 if(selentriesECneg>0){
1407 TH2F *hxy_negz=(TH2F*)gDirectory->Get(
"hxy_negz");
1408 hxy_negz->GetXaxis()->SetRangeUser(-radlimit,radlimit);
1409 hxy_negz->GetYaxis()->SetRangeUser(-radlimit,radlimit);
1410 char histoname_negz[32];
1411 sprintf(histoname_negz,
"%s (-Z)",histoname);
1412 hxy_negz->SetStats(0);
1413 hxy_negz->SetTitle( histoname_negz);
1414 hxy_negz->SetXTitle(
"X (cm)");
1415 hxy_negz->SetYTitle(
"Y (cm)");
1416 hxy_negz->Draw(
"COLZ");
1419 cout<<
"WARNING !!!! No hits on this layer ! not plotting (-Z) !"<<endl;
1424 cout<<
"PAD 3"<<endl;
1426 gPad->SetRightMargin(0.15);
1427 sprintf(selEC_str,
"Nhit*(%s&&%s)",selECpos_str,commonsense_str);
1429 cout<<
"(2)"<<selEC_str<<endl;
1430 sprintf(varEC_str,
"Ypos:Xpos>>hxy_posz(30,%f,%f)",-radlimit,radlimit);
1431 int selentriesECpos=talignable->Draw(varEC_str,selEC_str,
"goff");
1432 if(selentriesECpos>0){
1433 TH2F *hxy_posz=(TH2F*)gDirectory->Get(
"hxy_posz");
1434 char histoname_posz[32];
1435 hxy_posz->GetXaxis()->SetRangeUser(-radlimit,radlimit);
1436 hxy_posz->GetYaxis()->SetRangeUser(-radlimit,radlimit);
1437 sprintf(histoname_posz,
"%s (+Z)",histoname);
1438 hxy_posz->SetStats(0);
1439 hxy_posz->SetTitle( histoname_posz);
1440 hxy_posz->SetXTitle(
"X (cm)");
1441 hxy_posz->SetYTitle(
"Y (cm)");
1442 hxy_posz->Draw(
"COLZ");
1445 cout<<
"WARNING !!!! No hits on this layer ! not plotting (+Z) !"<<endl;
1452 cout <<
"******* " << typetag << endl;
1453 char psnamefinal[600];
1455 if(layerindex==1) sprintf(psnamefinal,
"%s(",psname);
1456 else if(layerindex==maxLayers) sprintf(psnamefinal,
"%s)",psname);
1457 else sprintf(psnamefinal,
"%s",psname);
1459 cout<<
"Saving in "<<psnamefinal<<endl;
1460 if(subDet==1 ||subDet==3 ||subDet==5 )c_barrels->SaveAs(psnamefinal);
1461 else c_endcaps->SaveAs(psnamefinal);
1463 if(subDet==1 ||subDet==3 ||subDet==5 )
delete c_barrels;
1464 else delete c_endcaps;
1471 cout<<
"Finished "<<maxLayers<<
" of the "<<typetag<<endl;
1489 if(startbin<0)startbin=1;
1490 if(endbin<0)endbin=h1->GetNbinsX();
1492 int prevbin=startbin;
1496 float bincont=h1->GetBinContent(bin);
1497 float prevbincont=h1->GetBinContent(prevbin);
1500 if(bincont>=prevbincont){
1509 peaklist[Npeaks]=h1->GetBinCenter(prevbin);
1514 if(Npeaks>=maxNpeaks){
1534 if( fin.is_open() ) flag=
true;
1557 cout<<
"Output file already existing !"<<endl;
1566 bool rise1=
false,rise2=
false,rise3=
false;
1567 int totbins=h->GetNbinsX();
1572 for(i=1;i<=totbins-3;i++){
1573 double cont1 = h->GetBinContent(i);
1574 if( h->GetBinContent(i+1)>cont1)rise1=
true;
1576 if( h->GetBinContent(i+2)>h->GetBinContent(i+1))rise2=
true;
1578 if( h->GetBinContent(i+3)>h->GetBinContent(i+2)){
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const double Zmax[kNumberCalorimeter]
void plotAlignParams(string ShiftsOrParams, char *plotName="test.png")
TLegend * MakeLegend(double x1=0.1, double y1=0.1, double x2=0.1, double y2=0.1)
bool CheckFileExistence(char *filename)
int GetSubDet(unsigned int id)
void plotAlignableChiSquare(char *plotName="testchi2.png", float minChi2n=-1.0)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
int GetBarrelLayer(unsigned int id)
void CheckFiles(int &ierr)
void dumpAlignedModules(int nhits=0)
void extractSurveyResiduals(int currentPar, int subDet=0)
HIPplots(int IOV, char *path, char *outFile)
bool CheckHistoRising(TH1D *h)
void extractAlignShifts(int i, int minHits=0, int subDet=0)
char _inFile_surveys[256]
int GetNIterations(TDirectory *f, char *tag, int startingcounter=0)
char _inFile_truepos[256]
void extractAlignableChiSquare(int minHits=0, int subDet=0, int doubleSided=0)
const double Zmin[kNumberCalorimeter]
char _inFile_HIPalign[256]
void extractAlignParams(int i, int minHits=0, int subDet=0, int doubleSided=0)
void plotAlignParamsAtIter(int iter, string ShiftsOrParams, char *plotName="test.png")
static unsigned int const shift
void plotHitMap(char *outpath, int subDet, int minHits=0)
char _inFile_uservars[256]
#define COLOR_CODE(icolor)
int FindPeaks(TH1F *h1, float *peaklist, const int maxNpeaks, int startbin=-1, int endbin=-1)
void SetPeakThreshold(float newpeakthreshold)