6 #include "TPolyLine3D.h"
17 const char* filenamefull = gSystem->ExpandPathName(filename);
20 cout <<
"Opening " << filenamefull << endl;
21 if(gSystem->AccessPathName(filenamefull)){
23 cout <<
"file " << filenamefull <<
" does not exist" << endl;
27 if(update) file =
new TFile(filenamefull,
"update");
28 else file = TFile::Open(filenamefull);
31 cout <<
" Could not open file " << filenamefull << endl;
36 cout <<
"file " << filenamefull <<
" is a zombie" << endl;
43 TDirectory* output = file->GetDirectory(Form(
"run%d/%s",run,dir));
46 cout <<
"file " << filenamefull <<
" does not contain " << Form(
"run%d/%s",run,dir) << endl;
60 const char* dirname = gSystem->ExpandPathName(
"$HARPO_ANA_DIR");
61 const char* filename = Form(
"%s/run%d_hist%s.root",dirname,run,extra);
62 cout <<
"Opening " << filename << endl;
63 if(gSystem->AccessPathName(filename)){
64 cout <<
"file " << filename <<
" does not exist" << endl;
69 file =
new TFile(filename,
"update");
71 file = TFile::Open(filename);
73 cout <<
" Could not open file " << filename << endl;
77 cout <<
"file " << filename <<
" is a zombie" << endl;
80 TDirectory* output = file->GetDirectory(Form(
"run%d/%s",run,dir));
82 cout <<
"file " << filename <<
" does not contain " << Form(
"run%d/%s",run,dir) << endl;
94 const char* dirname = gSystem->ExpandPathName(
"$HARPO_ANA_DIR");
95 const char* filename = Form(
"%s/run%d_hist.root",dirname,run);
96 cout <<
"Opening " << filename << endl;
97 if(gSystem->AccessPathName(filename)){
98 cout <<
"file " << filename <<
" does not exist" << endl;
101 TFile* file = TFile::Open(filename);
103 cout <<
" Could not open file " << filename << endl;
106 if(file->IsZombie()){
107 cout <<
"file " << filename <<
" is a zombie" << endl;
115 cout <<
"No run header in file " << filename << endl;
121 std::cout <<
"Get Det Header " << ndet << std::endl;
123 if(rawhdr ==0 )
continue;
125 std::cout <<
"Header Class Name " << rawhdr->ClassName() << std::endl;
133 TChain* tree =
new TChain(
"HarpoTree");
135 str.open(
"listRuns.txt",std::ifstream::in);
137 const char* datadir = gSystem->ExpandPathName(
"$HARPO_RECO_DIR");
138 cout << datadir << endl;
142 str.getline(line,256);
143 Int_t a = 0, r = 0, p = -1;
145 sscanf(line,
"%d %f %d %d",&a,&e,&r,&p);
148 if(a != -1000 && a != angle)
continue;
149 if(p != pola)
continue;
151 if(energy>0 && TMath::Abs(e-energy)>0.1)
continue;
155 tree->Add(Form(
"%s/run%d.root",datadir,r));
181 if (info->
GetVal(
"date",val)) {
182 std::cout <<
"################### DATE val " << val << std::endl;
183 Int_t year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
184 sscanf(val,
"%d-%d-%d %d:%d:%d",&year,&month,&day,&hour,&minute,&second);
185 TDatime datime(year,month,day,hour,minute,second);
186 UInt_t outtime = datime.Convert();
194 str.open(
"timeRuns.txt",std::ifstream::in);
198 str.getline(line,256);
199 Int_t year = 0, month = 0, day = 0, hour = 0, minute = 0, r = 0;
200 sscanf(line,
"%d %d %d %d %d %d",&year,&month,&day,&hour,&minute,&r);
204 TDatime datime(year,month,day,hour,minute,0);
205 UInt_t outtime = datime.Convert();
206 cout << run <<
" : " << day <<
"/" << month <<
"/" << year <<
" => " << outtime << endl;
219 TGraph* g =
new TGraph();
221 str.open(filename,std::ifstream::in);
222 Double_t P = 0, T = 0;
227 str.getline(line,256);
228 Int_t year = 0, month = 0, day = 0, hour = 0, minute = 0;
230 Int_t test = sscanf(line,
"%d/%d/%d %d:%d:%*d %f",&day,&month,&year,&hour,&minute,&p);
231 if(test != 6)
continue;
232 if(night == 1 && hour>6 && hour<21)
continue;
234 TDatime datime(year,month,day,hour,minute,0);
237 UInt_t time = datime.Convert();
238 if( time < timestart )
continue;
239 if( time > timeend )
continue;
241 if(time - timeold > 600 && n>0){
245 g->SetPoint(g->GetN(),T,P);
262 TGraph* g =
new TGraph();
266 const char* filename =
"Temperature_Pressure.csv";
268 str.open(filename,std::ifstream::in);
275 str.getline(line,256);
276 Int_t year = 0, month = 0, day = 0, hour = 0, minute = 0;
278 Int_t test = sscanf(line,
"%d/%d/%d %d:%d:%*f;%f;%*s",&day,&month,&year,&hour,&minute,&p);
279 if(test != 6)
continue;
280 Int_t time = (((((year-2014)*12 + month-10)*31 + (day - 27))*24 + hour)*60 + minute);
284 if(time > timeold + 10){
286 g->SetPoint(g->GetN(),time*60,P);
301 TGraph* g =
new TGraph();
305 const char* filename =
"Temperature_Pressure.csv";
306 cout << filename << endl;
308 str.open(filename,std::ifstream::in);
315 str.getline(line,256);
316 Int_t year = 0, month = 0, day = 0, hour = 0, minute = 0;
318 Int_t test = sscanf(line,
"%*d/%*d/%*d %*d:%*d:%*f;%*f;%d/%d/%d %d:%d:%*f;%f;",&day,&month,&year,&hour,&minute,&t);
324 Int_t time = (((((year-2014)*12 + month-10)*31 + (day - 27))*24 + hour)*60 + minute);
328 if(time > timeold + 10){
330 g->SetPoint(g->GetN(),time*60,T);
347 Double_t xmin = h->GetXaxis()->GetXmin();
348 Double_t xmax = h->GetXaxis()->GetXmax();
349 Int_t nbinsX = h->GetXaxis()->GetNbins();
350 Int_t nbinsY = h->GetYaxis()->GetNbins();
352 TH1F* p =
new TH1F(Form(
"%s_trunc",h->GetName()),
"",nbinsX,xmin,xmax);
355 for(Int_t i = 1; i<nbinsX+1; i++){
356 TArrayD* arr =
new TArrayD(20000);
359 for(Int_t j = 0; j<nbinsY+2; j++){
360 Int_t N = h->GetBinContent(i,j);
361 Double_t y = h->GetYaxis()->GetBinCenter(j);
362 for(Int_t k = 0; k<N; k++){
370 Double_t min = -1, max = -1, norm = -1, trunc2;
371 Double_t trunc =
TruncSum(arr,tl,th,min,max,norm,trunc2);
373 if(norm==0)
continue;
376 trunc2 -= trunc*trunc/norm;
382 p->SetBinContent(i,trunc);
383 p->SetBinError(i,TMath::Sqrt(trunc2/norm));
390 Double_t
HarpoTools::TruncSum(TArrayD* vect, Double_t tl, Double_t th, Double_t &minTrunc, Double_t &maxTrunc, Double_t &norm, Double_t &truncSum2, Double_t thr)
399 Int_t size = vect->GetSize();
400 Double_t truncMean = 0;
401 Int_t* index =
new Int_t[size];
402 TMath::Sort(size,vect->GetArray(),index,kFALSE);
403 Int_t t = 0, tLow, tHigh;
406 while(vect->At(index[t])<thr&&t<size-1) t++;
407 tLow = TMath::FloorNint(t + (size - t)*tl);
408 tHigh = TMath::FloorNint(t + (size - t)*th);
410 for(Int_t tind = tLow; tind<tHigh; tind++){
411 truncMean += vect->At(index[tind]);
412 truncSum2 += vect->At(index[tind])*vect->At(index[tind]);
414 maxTrunc = vect->At(index[tHigh]);
415 minTrunc = vect->At(index[tLow]);
429 Double_t min = -1, max = -1, norm = -1, trunc2 = -1;
430 Double_t trunc =
TruncSum(vect,tl,th,min,max,norm,trunc2);
449 UInt_t time1, time2, time3, time4, timeCirc;
451 TDatime datime1(2015,6,8,10,40,00);
452 time1 = datime1.Convert();
453 TDatime datime2(2015,6,12,11,00,00);
454 time2 = datime2.Convert();
455 TDatime datime3(2015,7,8,13,00,00);
456 time3 = datime3.Convert();
457 TDatime datime4(2015,7,16,12,00,00);
458 time4 = datime4.Convert();
459 TDatime datimeCirc(2015,7,20,11,30,00);
460 timeCirc = datimeCirc.Convert();
461 TLine* line =
new TLine();
462 line->SetLineStyle(2);
463 line->SetLineColor(kGray+2);
464 TLine* lineCirc =
new TLine();
465 lineCirc->SetLineStyle(3);
466 lineCirc->SetLineColor(kGreen+1);
467 TArrow* arrowCirc =
new TArrow();
468 arrowCirc->SetLineColor(kGreen+1);
470 TLatex* latex =
new TLatex();
471 latex->SetTextFont(132);
472 latex->SetTextAlign(12);
473 latex->SetTextSize(0.1);
475 TCanvas* cTP =
new TCanvas(cname,cname,1600,800);
479 TGraph* gP =
getTP(
"Pressure.csv", timestart, timeend, 0);
480 gP->SetMarkerColor(kBlack);
481 gP->SetMarkerStyle(1);
483 cout << gP->GetN() << endl;
485 TGraph* gT =
getTP(
"Temperature.csv", timestart, timeend);
486 gT->SetMarkerColor(kGreen+1);
487 gT->SetMarkerStyle(1);
489 Int_t npoints = gT->GetN();
491 Int_t kT = 0, kP = 0;
492 TGraph* gRatio =
new TGraph();
493 Double_t corr1 = 1.02, corr2 = 1.065, corr3 = 1.09, corr4 = 1.09, corr5 = 1.11;
496 gT->GetPoint(kT,xT,yT);
498 gP->GetPoint(kP,xP,yP);
511 gRatio->SetPoint(gRatio->GetN(),xT,yP/(yT+273.15));
512 if(xT>time1 && xT<time2)
513 gRatio->SetPoint(gRatio->GetN(),xT,corr1*yP/(yT+273.15));
514 if(xT>time2 && xT<time3)
515 gRatio->SetPoint(gRatio->GetN(),xT,corr2*yP/(yT+273.15));
516 if(xT>time3 && xT<time4)
517 gRatio->SetPoint(gRatio->GetN(),xT,corr3*yP/(yT+273.15));
518 if(xT>time4 && xT<timeCirc)
519 gRatio->SetPoint(gRatio->GetN(),xT,corr4*yP/(yT+273.15));
521 gRatio->SetPoint(gRatio->GetN(),xT,corr5*yP/(yT+273.15));
529 Double_t Tmean = 21.8, Pmean = 2.11, Psig = 0.03;
530 Double_t Tsig = Psig*200;
531 for(Int_t i = 0; i<npoints; i++){
534 gT->SetPoint(i,x,(y-Tmean)*Psig/Tsig + Pmean);
536 if(i==0) cout << x << endl;
537 if(i==npoints - 1) cout << x << endl;
540 TH1F* hTime =
new TH1F(
"hTime",
";time;",200,timestart,timeend);
541 hTime->GetXaxis()->SetTimeDisplay(1);
547 hTime->GetXaxis()->SetTimeFormat(
"%m-%d");
548 hTime->GetXaxis()->SetNdivisions(121);
549 hTime->SetTitle(
";time;P [bar]");
550 hTime->SetMaximum(4000);
552 sprintf(name,
"%s_%i_%i",cTP->GetName(),0,2);
554 ((TPad*) gROOT->FindObject(name))->Draw();
555 ((TPad*) gROOT->FindObject(name))->cd();
557 hTime->GetYaxis()->SetLabelSize(0.08);
558 hTime->GetYaxis()->SetTitleSize(0.1);
559 hTime->GetYaxis()->SetTitleOffset(0.35);
562 hTime->SetMaximum(Pmean + Psig);
563 hTime->SetMinimum(Pmean - Psig);
564 sprintf(name,
"%s_%i_%i",cTP->GetName(),0,1);
566 ((TPad*) gROOT->FindObject(name))->Draw();
567 ((TPad*) gROOT->FindObject(name))->cd();
569 hTime->GetYaxis()->SetLabelSize(0.08);
570 hTime->GetYaxis()->SetTitleSize(0.1);
571 hTime->GetYaxis()->SetTitleOffset(0.35);
574 hTime->GetYaxis()->SetLabelSize(0.08);
575 hTime->GetYaxis()->SetTitleSize(0.1);
576 hTime->GetYaxis()->SetTitleOffset(0.3);
579 TGaxis *axis =
new TGaxis(timeend,Pmean - Psig,
580 timeend,Pmean + Psig,
581 Tmean - Tsig, Tmean + Tsig,510,
"+L");
582 axis->SetLineColor(kGreen+1);
583 axis->SetTextColor(kGreen+1);
584 axis->SetLabelColor(kGreen+1);
585 axis->SetTitle(
"T [C]");
586 axis->SetTitleSize(0.07);
587 axis->SetTitleOffset(0.3);
588 axis->SetTitleFont(132);
589 axis->SetLabelFont(132);
590 axis->SetLabelSize(0.06);
596 TGraph* gPnight =
getTP(
"Pressure.csv", timestart, timeend, 1);
597 TGraph* gTnight =
getTP(
"Temperature.csv", timestart, timeend, 1);
601 TGraph* gRatioNight =
new TGraph();
602 gRatioNight->SetMarkerColor(kRed);
603 gRatioNight->SetMarkerStyle(6);
604 Int_t npointsNight = gTnight->GetN();
605 while(kT<npointsNight){
607 gTnight->GetPoint(kT,xT,yT);
609 gPnight->GetPoint(kP,xP,yP);
620 if(xT>time1)
continue;
622 if(yP>0 && yP/(yT+273.15) < 0.008 && yP/(yT+273.15) > 0.007)
623 gRatioNight->SetPoint(gRatioNight->GetN(),xT,yP/(yT+273.15));
628 TH1F* hTime2 = (TH1F*)hTime->Clone(
"hTime2");
629 hTime2->SetTitle(
";time; P/T [bar/K]");
630 Double_t rMin = 0.00710, rMax = 0.00720;
631 hTime2->SetMaximum(rMax);
632 hTime2->SetMinimum(rMin);
633 sprintf(name,
"%s_%i_%i",cTP->GetName(),0,0);
635 ((TPad*) gROOT->FindObject(name))->Draw();
636 ((TPad*) gROOT->FindObject(name))->cd();
638 hTime2->GetYaxis()->SetLabelSize(0.08);
639 hTime2->GetYaxis()->SetTitleSize(0.1);
640 hTime2->GetYaxis()->SetTitleOffset(0.35);
646 gRatio->Draw(
"Psame");
647 gRatioNight->Draw(
"Psame");
654 Double_t ylatex1 = 0.00716;
655 latex->DrawLatex(0.5*(time1+time2)-200000,ylatex1,Form(
"x%.3g",corr1));
656 latex->DrawLatex(0.5*(time2+time3)-200000,ylatex1,Form(
"x%.3g",corr2));
657 latex->DrawLatex(0.5*(time3+time4)-200000,ylatex1,Form(
"x%.3g",corr3));
658 latex->DrawLatex(0.5*(time4+timeCirc)-200000,ylatex1,Form(
"x%.3g",corr4));
659 latex->DrawLatex(0.5*(timeCirc+timeend)-200000,ylatex1,Form(
"x%.3g",corr5));
661 TF1* f =
new TF1(
"f",
"expo",timestart, timeend);
663 f->SetParameters(7e-3,7e-4);
664 gRatioNight->Fit(f,
"0",
"",timestart,timeend);
665 f->SetLineColor(kRed);
675 Double_t ylatex = rMin + 0.8*(rMax-rMin);
676 Double_t xlatex = timestart+0.05*(timeend-timestart);
680 latex->DrawLatex(xlatex,ylatex,Form(
"Rate: %.3g%%/week = %.3g#muL/h = %.3g#mubar/h",f->GetParameter(1)*7*24*3600*100,f->GetParameter(1)*3600*100*1e6,f->GetParameter(1)*3600*2e6));
682 cout << f->GetParameter(1)*100 <<
"%/s" << endl;
683 cout << f->GetParameter(1)*3600 <<
"%/h" << endl;
684 cout << f->GetParameter(1)*7*24*3600*100 <<
"%/week" << endl;
697 std::cerr <<
"**** RUN NUMBER TOO HIGH (" << run <<
"). NOT UPDATING ****" << endl;
700 const char* dirname = gSystem->ExpandPathName(
"$HARPO_ANA_DIR");
701 Char_t infilename[512], outfilename[512];
702 sprintf(infilename,
"%s/RunData_bk.root",dirname);
703 sprintf(outfilename,
"%s/RunData.root",dirname);
705 sprintf(command,
"cp %s %s",outfilename, infilename);
707 if(gSystem->AccessPathName(Form(
"%s/RunData.root",dirname))){
708 TFile* fileout =
new TFile(outfilename,
"recreate");
709 TTree* tree =
new TTree(
"RunData",
"Run data from analysis");
711 tree->Branch(
"run",&r,
"run/D");
712 tree->Branch(name,&var,Form(
"%s/D",name));
730 TString namevar = TString(name);
731 cout <<
"Execute " << command << endl;
732 gSystem->Exec(command);
734 TFile* filein = TFile::Open(infilename);
736 TTree* treein = (TTree*)filein->Get(
"RunData");
739 TObjArray* listbr = treein->GetListOfBranches();
740 Int_t nbr = listbr->GetEntries();
743 for(Int_t i = 0; i<nbr; i++){
744 TBranch* br = (TBranch*)listbr->At(i);
745 TString namebr = TString(br->GetName());
746 if(namebr == namevar){
755 TFile* fileout =
new TFile(outfilename,
"recreate");
756 TTree* tree =
new TTree(
"RunData",
"Run data from analysis");
758 const Int_t nvar = nbr;
759 Double_t varlistin[nvar];
760 Double_t varlistout[nvar];
762 for(Int_t i = 0; i<nbr; i++){
763 TBranch* br = (TBranch*)listbr->At(i);
764 TString namebr = TString(br->GetName());
765 if(namebr == TString(
"run"))
767 tree->Branch(br->GetName(),&varlistout[i],Form(
"%s/D",br->GetName()));
768 treein->SetBranchAddress(br->GetName(),&varlistin[i]);
772 tree->Branch(name,&newvar,Form(
"%s/D",name));
775 Int_t nEntries = treein->GetEntries();
805 Bool_t newrun = kTRUE;
806 for(Int_t i = 0; i<nEntries; i++){
808 for(Int_t k = 0; k<nbr; k++){
809 varlistout[k] = varlistin[k];
813 if(varlistout[indexrun] == run){
814 cout <<
"Updating " << name <<
" in run " << run <<
" to " << val << endl;
815 if(index == -1) newvar = val;
816 else varlistout[index] = val;
824 cout <<
"Adding run " << run << endl;
825 for(Int_t k = 0; k<nbr; k++)
826 varlistout[k] = -1000;
827 if(index == -1) newvar = val;
828 else varlistout[index] = val;
829 varlistout[indexrun] = run;
847 const char* dirname = gSystem->ExpandPathName(
"$HARPO_ANA_DIR");
848 Char_t infilename[512], outfilename[512];
849 sprintf(infilename,
"%s/ConfData_bk.root",dirname);
850 sprintf(outfilename,
"%s/ConfData.root",dirname);
852 sprintf(command,
"cp %s %s",outfilename, infilename);
854 if(gSystem->AccessPathName(Form(
"%s/ConfData.root",dirname))){
855 TFile* fileout =
new TFile(outfilename,
"recreate");
856 TTree* tree =
new TTree(
"ConfData",
"Conf data from analysis");
857 Double_t E, Omega0, Sim, Pola, Flag, var;
858 tree->Branch(
"E",&E,
"E/D");
859 tree->Branch(
"omega0",&Omega0,
"omega0/D");
860 tree->Branch(
"sim",&Sim,
"sim/D");
861 tree->Branch(
"pola",&Pola,
"pola/D");
862 tree->Branch(
"flag",&Flag,
"flag/D");
863 tree->Branch(name,&var,Form(
"%s/D",name));
876 TString namevar = TString(name);
878 gSystem->Exec(command);
880 TFile* filein = TFile::Open(infilename);
882 TTree* treein = (TTree*)filein->Get(
"ConfData");
885 TObjArray* listbr = treein->GetListOfBranches();
886 Int_t nbr = listbr->GetEntries();
889 for(Int_t i = 0; i<nbr; i++){
890 TBranch* br = (TBranch*)listbr->At(i);
891 TString namebr = TString(br->GetName());
892 if(namebr == namevar){
901 TFile* fileout =
new TFile(outfilename,
"recreate");
902 TTree* tree =
new TTree(
"ConfData",
"Run data from analysis");
904 const Int_t nvar = nbr;
905 Double_t varlistin[nvar];
906 Double_t varlistout[nvar];
907 Int_t indexE = -1, indexOmega0 = -1, indexSim = -1, indexPola = -1, indexFlag = -1;
908 for(Int_t i = 0; i<nbr; i++){
909 TBranch* br = (TBranch*)listbr->At(i);
910 TString namebr = TString(br->GetName());
911 if(namebr == TString(
"E"))
913 if(namebr == TString(
"omega0"))
915 if(namebr == TString(
"sim"))
917 if(namebr == TString(
"pola"))
919 if(namebr == TString(
"flag"))
921 tree->Branch(br->GetName(),&varlistout[i],Form(
"%s/D",br->GetName()));
922 treein->SetBranchAddress(br->GetName(),&varlistin[i]);
926 tree->Branch(name,&newvar,Form(
"%s/D",name));
929 Int_t nEntries = treein->GetEntries();
934 Bool_t newconf = kTRUE;
935 for(Int_t i = 0; i<nEntries; i++){
939 for(Int_t k = 0; k<nbr; k++){
941 varlistout[k] = varlistin[k];
949 if(TMath::Abs(varlistout[indexE]-energy)<0.1 && TMath::Abs(varlistout[indexOmega0]-omega0)<1 && varlistout[indexSim] == sim && varlistout[indexPola] == pola && varlistout[indexFlag] == flag){
950 cout <<
"Updating " << name <<
" in E = " << varlistout[indexE] <<
"/" << energy <<
", angle = " << varlistout[indexOmega0] <<
"/" << omega0 <<
", p = " << varlistout[indexPola] <<
"/" << pola <<
", sim = " << varlistout[indexSim] <<
"/" << sim <<
", flag = " << varlistout[indexFlag] <<
"/" << flag <<
" ( " << i <<
") to " << val << endl;
951 if(index == -1) newvar = val;
952 else varlistout[index] = val;
960 cout <<
"Adding E = " << energy <<
", angle = " << omega0 <<
", p = " << pola <<
", sim = " << sim <<
", flag = " << flag <<
" with " << name <<
" = " << val << endl;
961 for(Int_t k = 0; k<nbr; k++)
962 varlistout[k] = -1000;
963 if(index == -1) newvar = val;
964 else varlistout[index] = val;
965 varlistout[indexE] = energy;
966 varlistout[indexOmega0] = omega0;
967 varlistout[indexSim] = sim;
968 varlistout[indexPola] = pola;
969 varlistout[indexFlag] = flag;
993 const char* dirname = gSystem->ExpandPathName(
"$HARPO_ANA_DIR");
994 Char_t infilename[512];
995 sprintf(infilename,
"%s/RunData.root",dirname);
996 if(gSystem->AccessPathName(infilename)){
997 cout <<
"Could not access " << infilename << endl;
1000 TString namevar = TString(name);
1001 TFile* filein = TFile::Open(infilename);
1002 if(!filein)
return -1000;
1003 TTree* treein = (TTree*)filein->Get(
"RunData");
1004 if(!treein)
return -1000;
1006 treein->SetBranchAddress(name,&var);
1008 treein->SetBranchAddress(
"run",&r);
1010 Int_t nEntries = treein->GetEntries();
1015 for(Int_t i = 0; i<nEntries; i++){
1016 treein->GetEvent(i);
1035 if(!found)
return TString(
"");
1039 if(info->
GetVal(name,val))
1051 if(!found)
return -1000;
1053 if (!info->
GetType(name,type))
1055 if(type.Contains(
"char"))
1057 if (!info->
GetVal(name,val))
1061 Double_t output = std::atof(val.Data());
1062 if(strcmp(name,
"Ephoton")==0){
1064 Double_t eDB[14] = {1.7 , 2.6 , 3.8 , 4.4 , 6.3 , 11. , 16. , 18 , 25. , 32. , 37. , 49. , 50., 72.};
1065 Int_t index[14] = {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 11 , 12 };
1066 Double_t eReal[13] = {1.74, 2.73, 3.93, 4.68, 6.76, 11.8, 16.9, 18.5, 26.6, 33.3, 38.1, 52.1, 74.3};
1067 for(Int_t i = 0; i<14; i++){
1068 if(TMath::Abs(output-eDB[i])<0.01){
1070 return eReal[index[i]];
1097 const Int_t Number = 2;
1098 Double_t min = 0.10, max = 0.92;
1099 Double_t Red[Number] = { max, min};
1100 Double_t Green[Number] = { max, min};
1101 Double_t Blue[Number] = { max, min};
1105 Double_t Length[Number] = { 0.00, 1.00 };
1107 TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
1111 cout <<
"SIMULATION ? " << isSim << endl;
1113 gStyle->SetOptStat(0);
1116 TH2F* fHistEvent[2];
1117 fHistEvent[0] =
new TH2F(
"fHistEventX",
";time [30ns bin]; X channel [1mm pitch]; charge [ADC ch]",512,0,512,288,0,288);
1118 fHistEvent[1] =
new TH2F(
"fHistEventY",
";time [30ns bin]; Y channel [1mm pitch]; charge [ADC ch]",512,0,512,288,0,288);
1120 TH2F* fHistEventEmpty[2];
1121 fHistEventEmpty[0] =
new TH2F(
"fHistEventEmptyX",
";time [30ns bin]; X channel [1mm pitch]; charge [ADC ch]",512,0,512,288,0,288);
1122 fHistEventEmpty[1] =
new TH2F(
"fHistEventEmptyY",
";time [30ns bin]; Y channel [1mm pitch]; charge [ADC ch]",512,0,512,288,0,288);
1124 TH1F* fHistSpectrum[2];
1125 fHistSpectrum[0] =
new TH1F(
"fHistSpectrumX",
";time [30ns bin]; X Q [ADC]",512,0,512);
1126 fHistSpectrum[1] =
new TH1F(
"fHistSpectrumY",
";time [30ns bin]; Y Q [ADC]",512,0,512);
1128 Info(
"DisplayMap",
"%p",evt);
1130 if(evt == 0)
return 0;
1132 for(Int_t ndet=0;ndet<2;ndet++) {
1135 if ( m == NULL )
continue;
1136 fHistEvent[ndet]->Reset();
1137 fHistSpectrum[ndet]->Reset();
1138 for(Int_t i=1;i<
NADC;i++){
1141 for(Int_t j=0;j<
NCHAN;j++){
1143 fHistEvent[ndet]->SetBinContent(i+1,j+1,q);
1147 fHistSpectrum[ndet]->SetBinContent(i+1,Qt);
1149 fHistEvent[ndet]->SetMinimum(1);
1150 fHistEvent[ndet]->SetMaximum(4096);
1156 TLatex* latex =
new TLatex();
1157 latex->SetTextFont(132);
1158 latex->SetTextAlign(12);
1159 latex->SetTextSize(0.08);
1167 cSave =
new TCanvas(
"cSave",
"c",1200,1100);
1170 cSaveSp =
new TCanvas(
"cSaveSp",
"spectrum",1200,1100);
1173 Double_t left = 0.15, right = 0.2, bottom = 0.09, top = 0.01;
1177 Double_t vcorr = ((1. - bottom - top)/2. + top)/((1. - bottom - top)/2. + bottom);
1179 TLine* lineT =
new TLine();
1180 lineT->SetLineStyle(10);
1181 lineT->SetLineWidth(2);
1182 lineT->SetLineColor(kGray+1);
1183 Double_t tmin = 90.,
tmax = 415.;
1186 sprintf(name,
"%s_%i_%i",cSave->GetName(),0,1);
1188 ((TPad*) gROOT->FindObject(name))->Draw();
1189 ((TPad*) gROOT->FindObject(name))->cd();
1191 cout <<
"******* " << endl;
1192 cout <<
"******* " << fHistEvent[0]->GetYaxis()->GetTitleOffset() << endl;
1193 fHistEvent[0]->GetXaxis()->SetLabelSize(0);
1194 fHistEvent[0]->GetYaxis()->SetTitleOffset(1);
1195 fHistEvent[0]->DrawCopy(
"colz");
1196 lineT->DrawLine(tmin,1,tmin,288);
1198 sprintf(name,
"%s_%i_%i",cSave->GetName(),0,0);
1200 ((TPad*) gROOT->FindObject(name))->Draw();
1201 ((TPad*) gROOT->FindObject(name))->cd();
1203 fHistEvent[1]->GetYaxis()->SetTitleOffset(1);
1204 fHistEvent[1]->GetYaxis()->SetLabelSize(fHistEvent[1]->GetYaxis()->GetLabelSize()*vcorr);
1205 fHistEvent[1]->GetYaxis()->SetTitleSize(fHistEvent[1]->GetYaxis()->GetTitleSize()*vcorr);
1206 fHistEvent[1]->GetYaxis()->SetTitleOffset(fHistEvent[1]->GetYaxis()->GetTitleOffset()/vcorr);
1207 fHistEvent[1]->GetZaxis()->SetLabelSize(fHistEvent[1]->GetZaxis()->GetLabelSize()*vcorr);
1208 fHistEvent[1]->GetZaxis()->SetTitleSize(fHistEvent[1]->GetZaxis()->GetTitleSize()*vcorr);
1209 fHistEvent[1]->GetZaxis()->SetTitleOffset(fHistEvent[1]->GetZaxis()->GetTitleOffset()/vcorr);
1210 fHistEvent[1]->DrawCopy(
"colz");
1211 lineT->DrawLine(tmin,1,tmin,288);
1216 fHistEventEmpty[1]->GetYaxis()->SetLabelSize(fHistEventEmpty[1]->GetYaxis()->GetLabelSize()*vcorr);
1217 fHistEventEmpty[1]->GetYaxis()->SetTitleSize(fHistEventEmpty[1]->GetYaxis()->GetTitleSize()*vcorr);
1218 fHistEventEmpty[1]->GetYaxis()->SetTitleOffset(fHistEventEmpty[1]->GetYaxis()->GetTitleOffset()/vcorr);
1221 Int_t run = rh->
GetRun();
1224 cSave->SaveAs(Form(
"%s/run%d_event%d_linZ.png",savedir,run,evtno));
1225 cSave->SaveAs(Form(
"%s/run%d_event%d_linZ.pdf",savedir,run,evtno));
1226 cSave->SaveAs(Form(
"%s/run%d_event%d_linZ.C",savedir,run,evtno));
1227 cSaveSp->SaveAs(Form(
"%s/run%d_event%d_Spectrum.pdf",savedir,run,evtno));
1228 cSaveSp->SaveAs(Form(
"%s/run%d_event%d_Spectrum.png",savedir,run,evtno));
void MakeNice1dHistoPad(TH1 *hist, TVirtualPad *c1, Double_t scaleX, Double_t scaleY, const char *opt, Bool_t copy)
Bool_t GetRunConfig(Long_t nrun, const TString *dbUrl=NULL)
Query Db for given run Only this function in class interact wich DataBase. Must be called in HarpoRaw...
Get Run Configuration info by run number. The class query MySQL databe use GetRunConfig Method Only t...
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
TClonesArray * CanvasPartition(TVirtualPad *C, const Int_t Nx, const Int_t Ny, Float_t lMargin, Float_t rMargin, Float_t bMargin, Float_t tMargin)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
void SetHistStyle(TH1 *hist)
Bool_t GetVal(const TString field, TString &val)
Return value of existing field in Tstring.
Bool_t GetType(const TString field, TString &type)
Return Type of field in Tstring.
HarpoEventHeader * GetHeader()
A class store HARPO row event data and header. Provide access metods to the row event data...
const ULong_t gkNDetectors
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
R__EXTERN HarpoDetSet * gHDetSet