154 for(
int i=0; i<24576; i++){
155 std::getline(myfile,s);
156 std::getline(myfile2,s2);
162 hyb=(i-4096-feb*2560)/640;
163 ch=i-4096-feb*2560-hyb*640;
166 hyb=(i-feb*2048)/512;
167 ch=i-feb*2048-hyb*512;
169 for(
int I=0;I<5;I++){
170 std::string token=s2.substr(0,s2.find(
","));
171 s2=s2.substr(s2.find(
",")+1);
183 for(
int I=0;I<13;I++){
186 std::string token=s.substr(0,s.find(
" "));
188 std::cout<<i<<
" "<<feb<<
" "<<hyb<<
" "<<ch<<std::endl;
192 s=s.substr(s.find(
" ")+1);
194 std::string token=s.substr(0,s.find(
" "));
197 s=s.substr(s.find(
" ")+1);
201 s=s.substr(s.find(
" ")+1);
230 std::cout <<
"Setting up region:: " << regname << std::endl;
254 Float_t TimeRef=-0.0;
255 Float_t AmpRef=1000.0;
256 double weight = 1.;
int count1=0;
int count2=0;
262 bool doClMatch =
true;
272 int trigPhase = (int)((eventTime%24)/4);
274 for(
unsigned int i = 0; i <
svtHits_->size(); i++){
276 int getNum = thisHit->
getFitN();
278 bool Continue =
true;
279 for(
int i = 0; i<
Part_->size();i++){
280 if(
Part_->at(i)->getPDG()==22){
continue;}
281 if(
Part_->at(i)->getCluster().getEnergy()<0){
continue;}
282 if(not((
Part_->at(i)->getCluster().getTime()<=40)and(
Part_->at(i)->getCluster().getTime()>=36))){
continue;}
284 for(
int j = 0; j<
Part_->at(i)->getTrack().getSvtHits().GetEntries();j++){
287 for(
int k = 0;k<tHit->
getRawHits().GetEntries();k++){
289 if(rHit->
getT0(0)==thisHit->
getT0(0)){Continue=
false;}
301 for(
unsigned int J=0; J<getNum; J++){
306 Float_t TimeDiff=-42069.0;
307 Float_t AmpDiff=-42069.0;
312 TimeDiff=(thisHit->
getT0(J))-(thisHit->
getT0((J+1)%2));
313 AmpDiff=(thisHit->
getT0(J))-(thisHit->
getT0((J+1)%2));
322 if(!(
reg_selectors_[
regions_[i_reg]]->passCutLt(
"doing_ft",(((thisHit->
getT0(J))-TimeRef)*((thisHit->
getT0(J))-TimeRef)<((thisHit->
getT0((J+1)%getNum)-TimeRef)*(thisHit->
getT0((J+1)%getNum)-TimeRef)+.00001)),weight))){
continue;}
324 if(!(
reg_selectors_[
regions_[i_reg]]->passCutLt(
"doing_ct",(((thisHit->
getT0(J))-TimeRef)*((thisHit->
getT0(J))-TimeRef)>((thisHit->
getT0((J+1)%getNum)-TimeRef)*(thisHit->
getT0((J+1)%getNum)-TimeRef)+.00001)),weight))){
continue;}
327 if(!(
reg_selectors_[
regions_[i_reg]]->passCutLt(
"doing_ct",(((thisHit->
getT0(J))-TimeRef)*((thisHit->
getT0(J))-TimeRef)>((thisHit->
getT0((J+1)%getNum)-TimeRef)*(thisHit->
getT0((J+1)%getNum)-TimeRef)+.00001)),weight))){
continue;}
330 if(!(
reg_selectors_[
regions_[i_reg]]->passCutLt(
"doing_ca",(((thisHit->
getAmp(J))-AmpRef)*((thisHit->
getAmp(J))-AmpRef)<((thisHit->
getAmp((J+1)%getNum)-AmpRef)*(thisHit->
getAmp((J+1)%getNum)-AmpRef)+.00001)),weight))){
continue;}
358 for(
unsigned int K=0; K<6; K++){
359 if(maxx<adcs[K]){maxx=adcs[K];}
368 for(
int KK=0;KK<len;KK++){
378 if((
regions_[i_reg]==
"CTFit")and((thisHit->
getT0(J)<26.0)or(thisHit->
getT0(J)>30.0))){
continue;}
402 auto mod = std::to_string(thisHit->
getModule());
403 auto lay = std::to_string(thisHit->
getLayer());
407 char char_array[helper.length()+1];
408 std::strcpy(char_array,helper.c_str());
409 int feb = (int)char_array[1]-48;
410 int hyb = (int)char_array[3]-48;
413 if((feb>=2)and(word==
"OneFit")){
return;}
414 if((feb<2)and(word==
"CTFit")){
return;}
415 if(thisHit->
getChiSq(0)<.85){
return;}
422 BigCount+=feb*2048+hyb*512+(int)(thisHit->
getStrip());
425 BigCount+=(feb-2)*2560+hyb*640+(
int)(thisHit->
getStrip());
428 int * adcs2=thisHit->
getADCs();
438 fitfunc->FixParameter(0,TimeShift[0]);
439 fitfunc->FixParameter(3,thisHit->
getAmp(0));
441 fitfunc->FixParameter(1,
times1_[feb][hyb][(
int)thisHit->
getStrip()][1]);
442 fitfunc->FixParameter(2,
times1_[feb][hyb][(
int)thisHit->
getStrip()][2]);
446 fitfunc->FixParameter(1,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][1]);
447 fitfunc->FixParameter(2,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][2]);
452 fitfunc2->FixParameter(0,TimeShift[1]);
453 fitfunc2->FixParameter(3,thisHit->
getAmp(1));
455 fitfunc3->FixParameter(0,TimeShift[0]);
456 fitfunc3->FixParameter(3,thisHit->
getAmp(0));
457 fitfunc3->FixParameter(5,TimeShift[1]);
458 fitfunc3->FixParameter(8,thisHit->
getAmp(1));
461 fitfunc2->FixParameter(1,
times1_[feb][hyb][(
int)thisHit->
getStrip()][1]);
462 fitfunc2->FixParameter(2,
times1_[feb][hyb][(
int)thisHit->
getStrip()][2]);
465 fitfunc3->FixParameter(1,
times1_[feb][hyb][(
int)thisHit->
getStrip()][1]);
466 fitfunc3->FixParameter(2,
times1_[feb][hyb][(
int)thisHit->
getStrip()][2]);
469 fitfunc3->FixParameter(6,
times1_[feb][hyb][(
int)thisHit->
getStrip()][1]);
470 fitfunc3->FixParameter(7,
times1_[feb][hyb][(
int)thisHit->
getStrip()][2]);
473 fitfunc2->FixParameter(1,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][1]);
474 fitfunc2->FixParameter(2,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][2]);
477 fitfunc3->FixParameter(1,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][1]);
478 fitfunc3->FixParameter(2,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][2]);
481 fitfunc3->FixParameter(6,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][1]);
482 fitfunc3->FixParameter(7,
times2_[feb-2][hyb][(
int)thisHit->
getStrip()][2]);
491 for(
int K=0; K<Length;K++){
499 std::string helper1=
"Feb: "+std::to_string(feb)+
",Hyb: "+std::to_string(hyb)+
",ch: "+std::to_string((
int)thisHit->
getStrip())+
", chi_sqr value: "+std::to_string((
float)thisHit->
getChiSq(0));
500 const char *thing1 = helper1.data();
503 TCanvas *c1 =
new TCanvas(
"c");
504 c1->DrawFrame(0.0,3000.0,150.0,7000.0);
505 c1->SetTitle(thing1);
508 float times[12];
float points[12];
float errors[12];
float zeroes[12];
509 for(
int i=0;i<6;i++){
514 times[i]=float(i)*24.0;
519 times[i]=float(i)*24.0;
524 auto gr =
new TGraphErrors(6,times,points,zeroes,errors);
526 gr->SetTitle(thing1);
527 gr->GetYaxis()->SetTitle(
"ADC Counts");
528 gr->GetXaxis()->SetTitle(
"ns");
529 gr->GetXaxis()->SetLimits(-10.0,130.);
530 gr->GetHistogram()->SetMaximum(2000.);
531 gr->GetHistogram()->SetMinimum(-500.);
539 fitfunc->Draw(
"same");
541 fitfunc2->SetLineColor(kGreen);
542 fitfunc2->Draw(
"same");
543 fitfunc3->SetLineColor(kOrange);
544 fitfunc3->SetTitle(thing1);
545 fitfunc3->Draw(
"same");
555 auto legend =
new TLegend(0.1,0.7,.48,.9);
556 legend->AddEntry(
"gr",
"ADC counts");
557 legend->AddEntry(
"base",
"Offline Baselines");
558 legend->AddEntry(
"Pulse 0",
"First Pulse");
560 legend->AddEntry(
"Pulse 1",
"Second Pulse");
561 legend->AddEntry(
"Addition",
"Summed Fit");
563 legend->Draw(
"same");
564 std::string helper2=word+std::to_string(
readout[K]-1)+
".png";
565 const char *thing2 = helper2.data();