--- quicklook/QLflightS4_ND/S4_QL.cpp 2006/09/25 08:42:56 1.5 +++ quicklook/QLflightS4_ND/S4_QL.cpp 2007/01/05 16:16:09 1.6 @@ -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,7 +75,7 @@ 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; @@ -260,15 +262,24 @@ ph = eh->GetPscuHeader(); firstime = ph->GetOrbitalTime(); - int iii =0; + headBr->GetEntry(nevents); + ph = eh->GetPscuHeader(); + lastime = ph->GetOrbitalTime(); + headBr->GetEntry(nevents-100); + ph = eh->GetPscuHeader(); + if(lastime-ph->GetOrbitalTime()> 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(); + TriggerBr->GetEntry(iii); + if(trige->s4calcount[0]>MaxR)MaxR=trige->s4calcount[0]; iii++; } - + MaxR=10+2*(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,8 +311,7 @@ S4Br->GetEntry(i); ph = eh->GetPscuHeader(); if (s4e->unpackError == 1 && (s4e->S4_DATA)==0) continue; - s4rate= trige->s4calcount[0]; - rate->Fill(ph->GetOrbitalTime(), s4rate); + rate->Fill(ph->GetOrbitalTime(),trige->s4calcount[0]); h1->Fill(s4e->S4_DATA); Allev->Fill(ph->GetOrbitalTime(),s4e->S4_DATA); Alltime->Fill(ph->GetOrbitalTime()); @@ -312,16 +323,19 @@ } } Int_t kk=0; + Double_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()); s4rate= s4rate+(trige->s4calcount[0]); + Aobt=Aobt+((ph->GetOrbitalTime())-obmin)*(trige->s4calcount[0]); } - rateline->Fill((obt/100),(s4rate/100)); + rateline->Fill((Aobt/s4rate)+obmin,(s4rate/100)); kk=kk+100; }