#include <TH2D.h>
#include <TGraph.h>
#include <TParameter.h>
+#include <TTimeStamp.h>
// --- Standard library ---
#include "AliVZERORawStream.h"
#include "AliVZEROdigit.h"
#include "AliVZEROReconstructor.h"
+#include "AliVZEROTrending.h"
+#include "AliVZEROCalibData.h"
#include "event.h"
AliVZEROQADataMakerRec::AliVZEROQADataMakerRec() :
AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker"),
fCalibData(0x0),
- fEvent(0)
+ fEvent(0),
+ fNTotEvents(0),
+ fNSubEvents(0),
+ fTrendingUpdateEvent(0),
+ fNTrendingUpdates(0),
+ fTrendingUpdateTime(0),
+ fCycleStartTime(0),
+ fCycleStopTime(0),
+ fMonitorRate(0.)
{
// Constructor
AliDebug(AliQAv1::GetQADebugLevel(), "Construct VZERO QA Object");
-
+ for(Int_t i=0;i<8;i++){
+ fChargePerRing[i] = 0.;
+ fFlagPerRing[i] = 0.;
+ }
for(Int_t i=0; i<64; i++){
fEven[i] = 0;
- fOdd[i] = 0; }
+ fOdd[i] = 0;
+ fChargePerChannel[i] = 0.;
+ fFlagPerChannel[i] = 0.;
+ fMeanChargePerChannel[i] = 0.;
+ fMeanFlagPerChannel[i] = 0.;
+ }
for(Int_t i=0; i<128; i++){
fADCmean[i] = 0.0; }
AliVZEROQADataMakerRec::AliVZEROQADataMakerRec(const AliVZEROQADataMakerRec& qadm) :
AliQADataMakerRec(),
fCalibData(0x0),
- fEvent(0)
+ fEvent(0),
+ fNTotEvents(0),
+ fNSubEvents(0),
+ fTrendingUpdateEvent(0),
+ fNTrendingUpdates(0),
+ fTrendingUpdateTime(0),
+ fCycleStartTime(0),
+ fCycleStopTime(0),
+ fMonitorRate(0.)
{
// Copy constructor
// Does the QA checking
AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
+
+ if(task == AliQAv1::kRAWS){
+ TTimeStamp currentTime;
+ fCycleStopTime = currentTime.GetSec();
+ if(fCycleStopTime-fCycleStartTime>0.) fMonitorRate = fNTotEvents/(fCycleStopTime-fCycleStartTime);
+ //printf("%d event have been monitored -> Monitoring Rate = %f Hz\n",fNTotEvents,fMonitorRate);
+ Bool_t update = kFALSE;
+ if(!fTrendingUpdateEvent) {
+ update = kTRUE;
+ } else if ((TMath::Abs(fTrendingUpdateTime * fMonitorRate - fTrendingUpdateEvent) / fTrendingUpdateEvent) > 0.1){
+ update = kTRUE;
+ }
+ if(update) fTrendingUpdateEvent = (size_t)(fTrendingUpdateTime * fMonitorRate);
+ //printf("Update trending information every %d events\n",fTrendingUpdateEvent);
+
+ }
for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
if (! IsValidEventSpecie(specie, list))
void AliVZEROQADataMakerRec::InitRaws()
{
// Creates RAW histograms in Raws subdir
-
+
const Bool_t expert = kTRUE ;
const Bool_t saveCorr = kTRUE ;
const Bool_t image = kTRUE ;
TH2D * h2d;
TH1I * h1i;
TH1D * h1d;
+ AliVZEROTrending * trend;
int iHisto =0;
// Creation of Cell Multiplicity Histograms
h1i = new TH1I("H1I_Multiplicity_V0A", "Cell Multiplicity in V0A;# of Cells;Entries", 35, 0, 35) ;
- Add2RawsList(h1i,kMultiV0A, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1i,kMultiV0A, expert, image, saveCorr); iHisto++;
h1i = new TH1I("H1I_Multiplicity_V0C", "Cell Multiplicity in V0C;# of Cells;Entries", 35, 0, 35) ;
- Add2RawsList(h1i,kMultiV0C, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1i,kMultiV0C, expert, image, saveCorr); iHisto++;
// Creation of Total Charge Histograms
h1d = new TH1D("H1D_Charge_V0A", "Total Charge in V0A;Charge [ADC counts];Counts", 2048, 0, 32768) ;
- Add2RawsList(h1d,kChargeV0A, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kChargeV0A, expert, image, saveCorr); iHisto++;
h1d = new TH1D("H1D_Charge_V0C", "Total Charge in V0C;Charge [ADC counts];Counts", 2048, 0, 32768) ;
- Add2RawsList(h1d,kChargeV0C, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kChargeV0C, expert, image, saveCorr); iHisto++;
h1d = new TH1D("H1D_Charge_V0", "Total Charge in V0;Charge [ADC counts];Counts", 2048, 0, 65536) ;
- Add2RawsList(h1d,kChargeV0, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kChargeV0, expert, image, saveCorr); iHisto++;
// Creation of MIP Histograms
h1d = new TH1D("H1D_MIP_V0A", "Total MIP in V0A;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
- Add2RawsList(h1d,kRawMIPV0A, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kRawMIPV0A, expert, image, saveCorr); iHisto++;
h1d = new TH1D("H1D_MIP_V0C", "Total MIP in V0C;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
- Add2RawsList(h1d,kRawMIPV0C, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kRawMIPV0C, expert, image, saveCorr); iHisto++;
h1d = new TH1D("H1D_MIP_V0", "Total MIP in V0;Charge [MIP];Counts", 2*kNMIPBins,kMIPMin ,32*kMIPMax) ;
- Add2RawsList(h1d,kRawMIPV0, !expert, image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kRawMIPV0, expert, image, saveCorr); iHisto++;
h2d = new TH2D("H2D_MIP_Channel", "Nb of MIP per channel;Channel;# of Mips", kNChannelBins, kChannelMin, kChannelMax,kNMIPBins,kMIPMin ,kMIPMax) ;
Add2RawsList(h2d,kRawMIPChannel, expert, !image, !saveCorr); iHisto++;
sprintf(name,"H2I_ChargeEoI_Int%d",iInt);
sprintf(title,"Charge EoI (Int%d);Charge [ADC counts];Counts",iInt);
h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNChargeBins, kChargeMin, kChargeMax);
- Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), !expert, image, !saveCorr); iHisto++;
+ Add2RawsList(h2i,(iInt == 0 ? kChargeEoIInt0 : kChargeEoIInt1), expert, image, !saveCorr); iHisto++;
// Creation of temporary Charge EoI histograms used for the mean versus time histogram. This histogram will be reset at the end of each cycle
sprintf(name,"H2I_ChargeEoI_CycleInt%d",iInt);
sprintf(name,"H2I_HPTDCTime");
sprintf(title,"HPTDC Time;??;Width [ns]");
h2i = new TH2I(name, title,kNChannelBins, kChannelMin, kChannelMax, kNTdcTimeBins, kTdcTimeMin, kTdcTimeMax);
- Add2RawsList(h2i,kHPTDCTime, !expert, image, !saveCorr); iHisto++;
+ Add2RawsList(h2i,kHPTDCTime, expert, image, !saveCorr); iHisto++;
sprintf(name,"H2I_HPTDCTime_BB");
sprintf(title,"HPTDC Time w/ BB Flag condition;??;Width [ns]");
sprintf(name,"H1D_V0A_Time");
sprintf(title,"V0A Time;Time [ns];Counts");
h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
- Add2RawsList(h1d,kV0ATime, !expert, !image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kV0ATime, expert, !image, saveCorr); iHisto++;
sprintf(name,"H1D_V0C_Time");
sprintf(title,"V0C Time;Time [ns];Counts");
h1d = new TH1D(name, title,kNTdcTimeBins, kTdcTimeMin/10, kTdcTimeMax/10);
- Add2RawsList(h1d,kV0CTime, !expert, !image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kV0CTime, expert, !image, saveCorr); iHisto++;
sprintf(name,"H1D_Diff_Time");
sprintf(title,"Diff V0A-V0C Time;Time [ns];Counts");
h1d = new TH1D(name, title,2*kNTdcTimeBins, -kTdcTimeMax/10, kTdcTimeMax/10);
- Add2RawsList(h1d,kDiffTime, !expert, !image, saveCorr); iHisto++;
+ Add2RawsList(h1d,kDiffTime, expert, !image, saveCorr); iHisto++;
// Creation of Flag versus LHC Clock histograms
sprintf(name,"H2D_BBFlagVsClock");
h2d = new TH2D(name, title,kNChannelBins, kChannelMin, kChannelMax,21, -10.5, 10.5 );
Add2RawsList(h2d,kBGFlagVsClock, expert, !image, !saveCorr); iHisto++;
+ sprintf(name,"TREND_MeanChargePerRing");
+ sprintf(title,"Mean Charge per Event and per Ring versus time ");
+ trend = new AliVZEROTrending(name, title);
+ Add2RawsList(trend,kRawMeanChargePerRing, expert, !image, !saveCorr); iHisto++;
+
+ sprintf(name,"TREND_MeanFlagPerRing");
+ sprintf(title,"Mean Flag per Event and per Ring versus time ");
+ trend = new AliVZEROTrending(name, title);
+ Add2RawsList(trend,kRawMeanFlagPerRing, expert, !image, !saveCorr); iHisto++;
+
+ sprintf(name,"H1D_DQMFlag");
+ sprintf(title,"Current Flag per Event / Mean Flag per Event ");
+ h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
+ h1d->SetFillColor(29);
+ h1d->SetLineWidth(2);
+ h1d->GetXaxis()->SetLabelSize(0.06);
+ h1d->GetXaxis()->SetNdivisions(808,kFALSE);
+ h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
+ h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
+ h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
+ h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
+ h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
+ h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
+ h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
+ h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
+ h1d->GetXaxis()->CenterTitle();
+ h1d->GetXaxis()->SetTitleOffset(0.8);
+ h1d->GetXaxis()->SetNdivisions(808,kFALSE);
+ Add2RawsList(h1d,kRawDQMFlag, !expert, image, !saveCorr); iHisto++;
+
+ sprintf(name,"H1D_DQMCharge");
+ sprintf(title,"Current Charge per Event / Mean Charge per Event ");
+ h1d = new TH1D(name, title, kNChannelBins, kChannelMin, kChannelMax);
+ h1d->SetFillColor(29);
+ h1d->SetLineWidth(2);
+ h1d->GetXaxis()->SetLabelSize(0.06);
+ h1d->GetXaxis()->SetNdivisions(808,kFALSE);
+ h1d->GetXaxis()->SetBinLabel(4, "V0C");h1d->GetXaxis()->SetBinLabel(5, "R0");
+ h1d->GetXaxis()->SetBinLabel(12, "V0C");h1d->GetXaxis()->SetBinLabel(13, "R1");
+ h1d->GetXaxis()->SetBinLabel(20, "V0C");h1d->GetXaxis()->SetBinLabel(21, "R2");
+ h1d->GetXaxis()->SetBinLabel(28, "V0C");h1d->GetXaxis()->SetBinLabel(29, "R3");
+ h1d->GetXaxis()->SetBinLabel(36, "V0A");h1d->GetXaxis()->SetBinLabel(37, "R0");
+ h1d->GetXaxis()->SetBinLabel(44, "V0A");h1d->GetXaxis()->SetBinLabel(45, "R1");
+ h1d->GetXaxis()->SetBinLabel(52, "V0A");h1d->GetXaxis()->SetBinLabel(53, "R2");
+ h1d->GetXaxis()->SetBinLabel(60, "V0A");h1d->GetXaxis()->SetBinLabel(61, "R3");
+ h1d->GetXaxis()->CenterTitle();
+ h1d->GetXaxis()->SetTitleOffset(0.8);
+ h1d->GetXaxis()->SetNdivisions(808,kFALSE);
+ Add2RawsList(h1d,kRawDQMCharge, !expert, image, !saveCorr); iHisto++;
+
AliDebug(AliQAv1::GetQADebugLevel(), Form("%d Histograms has been added to the Raws List",iHisto));
}
rawReader->Reset() ;
AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
- rawStream->Next();
-
+ if(!(rawStream->Next())) return;
+
eventTypeType eventType = rawReader->GetType();
Int_t mulV0A = 0 ;
switch (eventType){
case PHYSICS_EVENT:
+
+ fNTotEvents++;
+
+ if(fNSubEvents++>=fTrendingUpdateEvent && fTrendingUpdateEvent>0) {
+ fNSubEvents=0;
+ AddTrendingEntry();
+ }
Int_t iFlag=0;
Int_t pedestal;
Int_t integrator;
Bool_t BBFlag;
Bool_t BGFlag;
- UInt_t time, width;
- Int_t MBCharge, charge;
+ Float_t time, width;
+ Int_t MBCharge;
+ Float_t charge;
Int_t offlineCh;
TH1D * hProj;
if(iFlag == 0){ //No Flag found
for(Int_t j=15; j<21; j++){
- pedestal=rawStream->GetPedestal(iChannel, j);
+ pedestal= (Int_t) rawStream->GetPedestal(iChannel, j);
integrator = rawStream->GetIntegratorFlag(iChannel, j);
GetRawsData((integrator == 0 ? kPedestalInt0 : kPedestalInt1))->Fill(offlineCh,pedestal);
// Look for the maximum in the LHC clock train
charge = 0;
Int_t iClock = 0;
- Int_t iCharge = 0;
+ Float_t iCharge = 0;
for(Int_t iEvent=0; iEvent<21; iEvent++){
iCharge = rawStream->GetPedestal(iChannel,iEvent);
if(iCharge>charge) {
// Calculation of the number of MIP
Double_t mipEoI = chargeEoI * fCalibData->GetMIPperADC(offlineCh);
-
+ int side = offlineCh/32;
+ int ring = (offlineCh - 32*side) / 8;
+ if(BBFlag) {
+ fFlagPerRing[side*4 + ring] += 1;
+ fFlagPerChannel[offlineCh] += 1;
+ }
+
if(charge<1023 && chargeEoI > 5.*sigma){
+ fChargePerRing[side*4 + ring] += chargeEoI;
+ fChargePerChannel[offlineCh] += chargeEoI;
((TH2I*)GetRawsData((integrator == 0 ? kChargeEoICycleInt0 : kChargeEoICycleInt1)))->Fill(offlineCh,chargeEoI);
((TH2D*)GetRawsData(kRawMIPChannel))->Fill(offlineCh,mipEoI);
if(offlineCh<32) {
if(h) h->Reset();
h = GetRawsData(kChargeEoICycleInt1);
if(h) h->Reset();
+
+ TTimeStamp currentTime;
+ fCycleStartTime = currentTime.GetSec();
+
+ fNTotEvents = 0;
+}
+
+//-------------------------------------------------------------------------------------------------
+void AliVZEROQADataMakerRec::AddTrendingEntry(){
+ //printf("AddTrendingEntry\n");
+ fNTrendingUpdates++;
+
+ // Normalize to the number of events
+ for(int i=0; i<8;i++){
+// fChargePerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
+// fFlagPerRing[i] *= TMath::Power(10.,i)/fTrendingUpdateEvent;
+ fChargePerRing[i] /= fTrendingUpdateEvent;
+ fFlagPerRing[i] /= fTrendingUpdateEvent;
+ }
+
+ GetRawsData(kRawDQMCharge)->Reset();
+ GetRawsData(kRawDQMFlag)->Reset();
+ for(int i=0; i<64;i++){
+ fChargePerChannel[i] /= fTrendingUpdateEvent;
+ fFlagPerChannel[i] /= fTrendingUpdateEvent;
+
+ if(fMeanChargePerChannel[i]) GetRawsData(kRawDQMCharge)->Fill(i,fChargePerChannel[i]/fMeanChargePerChannel[i]);
+ else GetRawsData(kRawDQMCharge)->Fill(i,0.);
+
+ if(fMeanFlagPerChannel[i]) GetRawsData(kRawDQMFlag)->Fill(i,fFlagPerChannel[i]/fMeanFlagPerChannel[i]);
+ else GetRawsData(kRawDQMFlag)->Fill(i,0.);
+
+ fMeanChargePerChannel[i] = (fMeanChargePerChannel[i] * (fNTrendingUpdates-1) + fChargePerChannel[i]) / fNTrendingUpdates;
+ fMeanFlagPerChannel[i] = (fMeanFlagPerChannel[i] * (fNTrendingUpdates-1) + fFlagPerChannel[i]) / fNTrendingUpdates;
+
+ }
+
+ TTimeStamp currentTime;
+ ((AliVZEROTrending*)GetRawsData(kRawMeanChargePerRing))->AddEntry(fChargePerRing, currentTime.GetSec());
+ ((AliVZEROTrending*)GetRawsData(kRawMeanFlagPerRing))->AddEntry(fFlagPerRing, currentTime.GetSec());
+ //moMeanFlagPerRing->AddEntry(fFlagPerRing, currentTime.GetSec());
+
+ // Put back counters to zero
+ for(int i=0; i<8;i++){
+ fChargePerRing[i] = 0.;
+ fFlagPerRing[i] = 0.;
+ }
+ for(int i=0; i<64;i++){
+ fChargePerChannel[i] = 0.;
+ fFlagPerChannel[i] = 0.;
+ }
+
}
+