--- quicklook/QLflightS4_ND/S4_QL.cpp 2006/09/05 13:06:41 1.4 +++ quicklook/QLflightS4_ND/S4_QL.cpp 2007/03/12 14:32:46 1.7 @@ -48,6 +48,8 @@ #include "TGraph.h" #include "TH1F.h" #include "TF1.h" +#include "TH2F.h" +#include "TF2.h" #include "TGaxis.h" #include "TString.h" #include "TPaveText.h" @@ -73,14 +75,14 @@ TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); char *trc; - TString trcs; + TString trcs,ciao; TString str; TString trcsstot[31]; TString trcsstot2; TString trgconf[31]={"TOF1","TOF2","TOF3","TOF4","TOF5","TOF6","TOF7","S4","CALO","CALO-S4","TOF1-S4","TOF2-S4","TOF3-S4","TOF4-S4","TOF5-S4","TOF6-S4","TOF7-S4","TOF1-CALO","TOF2-CALO","TOF3-CALO","TOF4-CALO","TOF5-CALO","TOF6-CALO","TOF7-CALO","TOF1-CALO-S4","TOF2-CALO-S4","TOF3-CALO-S4","TOF4-CALO-S4","TOF5-CALO-S4","TOF6-CALO-S4","TOF7-CALO-S4",}; stringstream oss, oss1, oss2, oss3, s4soglia, buffer, conftrig, noentries; - ULong_t lastime, firstime; + ULong_t lastime, firstime,obmin,obmax,obt; Int_t vardumpentries = 0; Int_t channels = 4096; char S4_TRH[10]; @@ -88,9 +90,7 @@ Int_t trigconf = 0; Long64_t nevents; string title; - double obmin=0.; - double obmax=0.; - double obt; + double s4rate; //------to open headerfile, s4file, Trigfile and vardumpfile---------------------------/ TFile *file =new TFile(base.Data()) ; @@ -212,7 +212,7 @@ //cout<GetPscuHeader(); firstime = ph->GetOrbitalTime(); - int iii =0; + headBr->GetEntry(nevents); + ph = eh->GetPscuHeader(); + lastime = ph->GetOrbitalTime(); + headBr->GetEntry(nevents-100); + ph = eh->GetPscuHeader(); + obt=ph->GetOrbitalTime(); + if(lastime-obt> 100000)nevents=nevents-100; + int iii=0,MaxR=0; while(iii < nevents){ headBr->GetEntry(iii); ph = eh->GetPscuHeader(); - if((ph->GetOrbitalTime()) <= firstime) firstime=ph->GetOrbitalTime(); - if((ph->GetOrbitalTime()) >= lastime) lastime=ph->GetOrbitalTime(); + obt=ph->GetOrbitalTime(); + if(obt<=firstime) firstime=ph->GetOrbitalTime(); + if(obt>=lastime) lastime=ph->GetOrbitalTime(); + TriggerBr->GetEntry(iii); + if(trige->s4calcount[0]>MaxR)MaxR=trige->s4calcount[0]; iii++; } - + MaxR=2*(1.05*MaxR/2); + obmin=firstime; obmax=lastime; const ULong_t nint=(((lastime-firstime)/(DeltaT*60000))); @@ -287,8 +298,9 @@ const Int_t size2 = (Int_t)((nint2+1)); // one bin every 10 second const ULong_t nint3=(lastime-firstime)/1000; const Int_t size3 = (Int_t)((nint3+1)); // one bin every 1 second - TH1F *rate= new TH1F(title.c_str(), title.c_str(), size2, obmin, obmax); - TH1F *rateline= new TH1F(filename+". S4 rate from Trigger Packet: mean value over 100 events", filename+". S4 rate from Trigger Packet: mean value over 100 events", size3, obmin, obmax); + const Int_t Rbin = MaxR/2; + TH2I *rate= new TH2I(title.c_str(), title.c_str(), size2,obmin,obmax,Rbin,0,MaxR); + TH2I *rateline= new TH2I(filename+". S4 rate from Trigger Packet: mean value over 100 events", filename+". S4 rate from Trigger Packet: mean value over 100 events",size3,obmin,obmax,Rbin,0,MaxR); //------------------------------------------------------------------------------------------------------------------ //------- fill histograms ---------// @@ -299,29 +311,36 @@ S4Br->GetEntry(i); ph = eh->GetPscuHeader(); if (s4e->unpackError == 1 && (s4e->S4_DATA)==0) continue; - s4rate= trige->s4calcount[0]; - rate->Fill(ph->GetOrbitalTime(), s4rate); + obt=ph->GetOrbitalTime(); + rate->Fill(obt,trige->s4calcount[0]); h1->Fill(s4e->S4_DATA); - Allev->Fill(ph->GetOrbitalTime(),s4e->S4_DATA); - Alltime->Fill(ph->GetOrbitalTime()); + Allev->Fill(obt,s4e->S4_DATA); + Alltime->Fill(obt); if ((trige->patterntrig[0] == 0)&&(trige->patterntrig[1] != 0)&&(trige->patterntrig[2] == 0)&&(trige->patterntrig[3] == 0)&&(trige->patterntrig[4] == 0)&&(trige->patterntrig[5] == 0)){ h2->Fill(s4e->S4_DATA); - S4ev->Fill(ph->GetOrbitalTime(),s4e->S4_DATA); - S4time->Fill(ph->GetOrbitalTime()); + S4ev->Fill(obt,s4e->S4_DATA); + S4time->Fill(obt); p=p+1; } } Int_t kk=0; + ULong_t Aobt=0; while (kk < nevents){ obt=0; s4rate=0; + Aobt=0; for(Int_t jj=kk; jj< (kk+100); jj++){ TriggerBr->GetEntry(jj); headBr->GetEntry(jj); - obt = obt+(ph->GetOrbitalTime()); + obt=ph->GetOrbitalTime(); s4rate= s4rate+(trige->s4calcount[0]); + Aobt=Aobt-obmin+obt; + //*(trige->s4calcount[0])/1000; } - rateline->Fill((obt/100),(s4rate/100)); + Aobt=Aobt/100; + Aobt=Aobt+obmin; + rateline->Fill(Aobt,s4rate/100); + //rateline->Fill(ph->GetOrbitalTime(),(s4rate/100)); kk=kk+100; } @@ -524,7 +543,7 @@ rate->GetXaxis()->CenterTitle(); rate->GetYaxis()->SetTitle("S4 rate (Hz)"); rate->GetYaxis()->CenterTitle(); - if(rate->GetMaximum() > 1000) gPad->SetLogy(); + if(MaxR>500) gPad->SetLogy(); rate->Draw("9p"); canvas3->cd(2); @@ -537,7 +556,7 @@ rateline->GetYaxis()->SetTitle("S4 rate (Hz)"); rateline->GetYaxis()->CenterTitle(); rateline->SetMaximum(rate->GetMaximum()); - if(rateline->GetMaximum() > 1000) gPad->SetLogy(); + if(MaxR>500) gPad->SetLogy(); rateline->Draw("9p"); @@ -621,4 +640,3 @@ S4_QL(argv[1], outDir, format, DeltaT); } -