99 #include <TDirectory.h>
103 #include <TProfile.h>
104 #include <TObjArray.h>
106 #include "AliRawReader.h"
107 #include "AliRawReaderRoot.h"
108 #include "AliRawReaderDate.h"
112 #include "AliMathBase.h"
113 #include "TTreeStream.h"
135 fRequireNeighbouringPad(kTRUE),
149 fHistQVsTimeSideA(0),
150 fHistQVsTimeSideC(0),
151 fHistQMaxVsTimeSideA(0),
152 fHistQMaxVsTimeSideC(0),
153 fHistOccupancyVsEvent(0),
154 fHistNclustersVsEvent(0),
169 fHistOccVsSector(0x0),
170 fHistOcc2dVsSector(0x0),
172 fHistQmaxVsSector(0x0),
182 for (Int_t i=0; i<72; ++i) {fActiveChambers.SetBitNumber(i,kTRUE);}
188 fFirstTimeBin(ped.GetFirstTimeBin()),
189 fLastTimeBin(ped.GetLastTimeBin()),
190 fAdcMin(ped.GetAdcMin()),
191 fAdcMax(ped.GetAdcMax()),
192 fMinQMax(ped.GetMinQMax()),
193 fRequireNeighbouringPad(ped.GetRequireNeighbouringPad()),
207 fHistQVsTimeSideA(0),
208 fHistQVsTimeSideC(0),
209 fHistQMaxVsTimeSideA(0),
210 fHistQMaxVsTimeSideC(0),
211 fHistOccupancyVsEvent(0),
212 fHistNclustersVsEvent(0),
213 fEventCounter(ped.GetEventCounter()),
214 fIsAnalysed(ped.GetIsAnalysed()),
215 fMaxEvents(ped.GetMaxEvents()),
216 fEventsPerBin(ped.GetEventsPerBin()),
217 fSignalCounter(ped.GetSignalCounter()),
218 fClusterCounter(ped.GetClusterCounter()),
219 fActiveChambers(ped.fActiveChambers),
226 fIsDQM(ped.GetIsDQM()),
227 fHistOccVsSector(0x0),
228 fHistOcc2dVsSector(0x0),
230 fHistQmaxVsSector(0x0),
286 TH1F(
"TPCRAW",
"TPCRAW",100,0,100),
292 fRequireNeighbouringPad(kTRUE),
306 fHistQVsTimeSideA(0),
307 fHistQVsTimeSideC(0),
308 fHistQMaxVsTimeSideA(0),
309 fHistQMaxVsTimeSideC(0),
310 fHistOccupancyVsEvent(0),
311 fHistNclustersVsEvent(0),
326 fHistOccVsSector(0x0),
327 fHistOcc2dVsSector(0x0),
329 fHistQmaxVsSector(0x0),
337 if (config->GetValue(
"FirstTimeBin"))
fFirstTimeBin = ((TObjString*)config->GetValue(
"FirstTimeBin"))->GetString().Atoi();
338 if (config->GetValue(
"LastTimeBin"))
fLastTimeBin = ((TObjString*)config->GetValue(
"LastTimeBin"))->GetString().Atoi();
339 if (config->GetValue(
"AdcMin"))
fAdcMin = ((TObjString*)config->GetValue(
"AdcMin"))->GetString().Atoi();
340 if (config->GetValue(
"AdcMax"))
fAdcMax = ((TObjString*)config->GetValue(
"AdcMax"))->GetString().Atoi();
341 if (config->GetValue(
"MinQMax"))
fMinQMax = ((TObjString*)config->GetValue(
"MinQMax"))->GetString().Atof();
342 if (config->GetValue(
"MaxEvents"))
fMaxEvents = ((TObjString*)config->GetValue(
"MaxEvents"))->GetString().Atoi();
343 if (config->GetValue(
"EventsPerBin"))
fEventsPerBin = ((TObjString*)config->GetValue(
"EventsPerBin"))->GetString().Atoi();
344 if (config->GetValue(
"RequireNeighbouringPad"))
fRequireNeighbouringPad = ((TObjString*)config->GetValue(
"RequireNeighbouringPad"))->GetString().Atoi();
353 if (&source ==
this)
return *
this;
396 for (Int_t iRow = 0; iRow <
fRowsMax; iRow++) {
468 for(Int_t bin = 1; bin <= nBins; bin+=2) {
470 Int_t newBin = TMath::Nint(Float_t(bin+1)/2.0);
481 Int_t lastHalf = nBins/2 +1;
482 for(Int_t bin = lastHalf; bin <= nBins; bin++) {
495 Float_t averageOccupancy =
501 Float_t averageNclusters =
512 Bool_t withInput = kFALSE;
514 Int_t lastSector = -1;
518 while ( rawStreamV3->
NextDDL() ){
522 Int_t iSector = rawStreamV3->
GetSector();
523 Int_t iRow = rawStreamV3->
GetRow();
524 Int_t iPad = rawStreamV3->
GetPad();
526 Int_t iBranch = rawStreamV3->GetBranch();
527 if (iRow<0 || iPad<0)
continue;
529 if(iSector != lastSector) {
535 lastSector = iSector;
539 while ( rawStreamV3->NextBunch() ){
541 Int_t startTbin = (Int_t)rawStreamV3->GetStartTimeBin();
542 Int_t bunchlength = (Int_t)rawStreamV3->GetBunchLength();
543 const UShort_t *sig = rawStreamV3->GetSignals();
545 for (Int_t iTimeBin = 0; iTimeBin<bunchlength; iTimeBin++){
546 Float_t signal=(Float_t)sig[iTimeBin];
547 nSignals +=
Update(iSector,iRow,iPad,startTbin--,signal, iPatch, iBranch);
554 if (lastSector>=0&&nSignals>0)
583 AliRawReaderDate rawReader((
void*)event);
603 TDirectory *backup = gDirectory;
604 TFile
f(filename,option.Data());
606 if ( !sDir.IsNull() ){
607 f.mkdir(sDir.Data());
613 if ( backup ) backup->cd();
621 const Int_t iTimeBin,
647 fOccVec->GetArray()[iSector] += 1.0;
649 if(iPatch>=0 && iBranch>=0 && iPatch<=5 && iBranch <= 1)
650 fOccVecFine->GetArray()[(iSector%36)*12+iPatch*2+iBranch] += 1.0;
666 if(signal < noise*3.0)
692 Int_t nLocalMaxima = 0;
697 for (Int_t iRow = 0; iRow <
fRowsMax; iRow++) {
703 for (Int_t iSig = 0; iSig < nSigBins; iSig++) {
705 Int_t bin = sigBins[iSig];
706 Float_t *b = &allBins[bin];
722 if (b[-1]+b[1]<=0)
continue;
730 if (b[-maxTimeBin] >= qMax)
continue;
731 if (b[-1 ] >= qMax)
continue;
732 if (b[+maxTimeBin] > qMax)
continue;
733 if (b[+1 ] > qMax)
continue;
734 if (b[-maxTimeBin-1] >= qMax)
continue;
735 if (b[+maxTimeBin-1] >= qMax)
continue;
736 if (b[+maxTimeBin+1] > qMax)
continue;
737 if (b[-maxTimeBin+1] >= qMax)
continue;
744 Int_t iPad, iTimeBin;
785 Int_t minP = 0, maxP = 0, minT = 0, maxT = 0;
787 for(Int_t i = -1; i<=1; i++) {
788 for(Int_t j = -1; j<=1; j++) {
793 Float_t charge1 =
GetQ(b, i, j, maxTimeBin, minT, maxT, minP, maxP);
798 qTot +=
GetQ(b, 2*i, 2*j, maxTimeBin, minT, maxT, minP, maxP);
801 qTot +=
GetQ(b, i, 2*j, maxTimeBin, minT, maxT, minP, maxP);
802 qTot +=
GetQ(b, 2*i, j, maxTimeBin, minT, maxT, minP, maxP);
803 qTot +=
GetQ(b, 2*i, 2*j, maxTimeBin, minT, maxT, minP, maxP);
822 if((iSector%36)<18) {
841 AliInfo(
"Analyse called");
845 AliInfo(
"DQM flas is set -> No 2d information to analyze");
851 AliInfo(
"No new data since Analyse was called last time");
857 AliInfo(
"EventCounter == 0, Cannot analyse");
862 AliInfo(Form(
"EventCounter: %d , TimeBins: %d",
fEventCounter, nTimeBins));
864 Float_t normalization = 1.0 / Float_t(
fEventCounter * nTimeBins);
924 for (Int_t iRow = 0; iRow <
fRowsMax; iRow++) {
927 fAllBins[iRow] =
new Float_t[maxBin];
928 memset(
fAllBins[iRow],0,
sizeof(Float_t)*maxBin);
941 for (Int_t iRow = 0; iRow <
fRowsMax; iRow++) {
952 for(Int_t i = 0; i < nSignals; i++)
953 allBins[sigBins[i]]=0;
957 memset(
fAllBins[iRow],0,
sizeof(Float_t)*maxBin);
976 R__ASSERT(iPad>=0 && iPad<=
fPadsMax);
982 Int_t iTimeBin,
const Float_t signal)
990 R__ASSERT(iRow>=0 && iRow<
fRowsMax);
991 R__ASSERT(iPad>=0 && iPad<=
fPadsMax);
1001 fAllNSigBins[iRow]++;
1006 const Int_t pad,
const Int_t maxTimeBins,
1007 Int_t& timeMin, Int_t& timeMax,
1008 Int_t& padMin, Int_t& padMax)
const
1014 Float_t charge = adcArray[time + pad*maxTimeBins];
1016 timeMin = TMath::Min(time, timeMin); timeMax = TMath::Max(time, timeMax);
1017 padMin = TMath::Min(pad, padMin); padMax = TMath::Max(pad, padMax);
1023 void AliTPCdataQA::Streamer(TBuffer &xRuub)
1029 UInt_t xRuus, xRuuc;
1030 if (xRuub.IsReading()) {
1031 Version_t xRuuv = xRuub.ReadVersion(&xRuus, &xRuuc);
1034 AliTPCdataQA::Class()->ReadBuffer(xRuub,
this, xRuuv, xRuus,
1038 TH1F::Streamer(xRuub);
1052 xRuub.CheckByteCount(xRuus, xRuuc, AliTPCdataQA::IsA());
1054 AliTPCdataQA::Class()->WriteBuffer(xRuub,
this);
1064 AliInfo(
"Method only meaningful for DQM");
1066 for(Int_t i = 0; i < 72; i++) {
1072 const Int_t nBranches = 36*12;
1073 for(Int_t i = 0; i < nBranches; i++) {
1077 const Int_t fullSector = Int_t(i/12);
1079 Int_t branch = i - fullSector*12;
1080 const Int_t patch = Int_t(branch/2);
1092 AliInfo(
"Method only meaningful for DQM");
1104 for(Int_t i = 0; i < 72; i++)
1107 for(Int_t i = 0; i < 36*12; i++)
1123 if (!fNLocalMaxima){
1136 fHistQVsTimeSideA =
new TProfile(
"hQVsTimeSideA",
"Q vs time (side A); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
1138 fHistQVsTimeSideC =
new TProfile(
"hQVsTimeSideC",
"Q vs time (side C); Time [Timebin]; Q [ADC ch]", 100, 0, 1000);
1140 fHistQMaxVsTimeSideA =
new TProfile(
"hQMaxVsTimeSideA",
"Q_{MAX} vs time (side A); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
1142 fHistQMaxVsTimeSideC =
new TProfile(
"hQMaxVsTimeSideC",
"Q_{MAX} vs time (side C); Time [Timebin]; Q_{MAX} [ADC ch]", 100, 0, 1000);
1148 fHistOccVsSector =
new TProfile(
"hOccVsSector",
"Occupancy vs sector; Sector; Occupancy", 72, 0, 72);
1151 fHistOcc2dVsSector =
new TProfile2D(
"hOcc2dVsSector",
"Occupancy vs sector and patch; Sector; Patch", 72, 0, 36, 6, 0, 6);
1154 fHistQVsSector =
new TProfile(
"hQVsSector",
"Q vs sector; Sector; Q [ADC ch]", 72, 0, 72);
1157 fHistQmaxVsSector =
new TProfile(
"hQmaxVsSector",
"Qmax vs sector; Sector; Qmax [ADC ch]", 72, 0, 72);
1161 for(Int_t i = 0; i < 72; i++)
1165 const Double_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
1166 for(Int_t i = 0; i < 72; i++)
1174 const Int_t nBranches = 36*12;
1176 for(Int_t i = 0; i < nBranches; i++)
1180 Int_t nPads0[6] = {1152, 1536, 1152, 1280, 1280, 1280};
1181 Int_t nPads1[6] = {1152, 1664, 1152, 1280, 1280, 1280};
1184 for(Int_t i = 0; i < nBranches; i++) {
1186 const Int_t fullSector = Int_t(i/12);
1187 Int_t branch = i - fullSector*12;
1188 R__ASSERT(branch>=0 && branch<12);
1190 const Int_t patch = Int_t(branch/2);
1193 R__ASSERT(branch>=0 && branch<2);
1206 if(fIsAnalysed == kTRUE && !
fIsDQM) {
1208 const Int_t nTimeBins = fLastTimeBin - fFirstTimeBin +1;
1209 const Float_t denormalization = Float_t(fEventCounter * nTimeBins);
1210 fNoThreshold->Multiply(denormalization);
1212 fMeanCharge->Multiply(fNLocalMaxima);
1213 fMaxCharge->Multiply(fNLocalMaxima);
1214 fNTimeBins->Multiply(fNLocalMaxima);
1215 fNPads->Multiply(fNLocalMaxima);
1216 fTimePosition->Multiply(fNLocalMaxima);
1217 fIsAnalysed = kFALSE;
1229 fNoThreshold->Reset();
1230 fNLocalMaxima->Reset();
1231 fMeanCharge->Reset();
1232 fMaxCharge->Reset();
1233 fNTimeBins->Reset();
1235 fTimePosition->Reset();
1245 fIsAnalysed = kFALSE;
1260 for (Int_t i=0; i<72; ++i){
Int_t fPadsMax
! Maximum number of time bins
UInt_t GetNPads(UInt_t sector, UInt_t row) const
AliTPCCalROC * GetCalROC(Int_t sector) const
Int_t fClusterCounter
Cluster counter.
TProfile * fHistQmaxVsSector
! QMax vs sector (for DQM only)
void FillOccupancyProfile()
AliTPCCalPad * GetMaxCharge() const
TArrayD * fOccVecFine
! "2D" occupancy help counter for DQM
Int_t ** fAllSigBins
! array of pointers to the indexes over threshold
TProfile * fHistQMaxVsTimeSideA
QMax vs time (side A)
virtual Bool_t NextChannel()
Int_t fEventCounter
event Counter
TProfile * fHistQVsSector
! Q vs sector (for DQM only)
void SetExpandDigit(const Int_t iRow, Int_t iPad, Int_t iTimeBin, const Float_t signal)
Int_t fAdcMin
min adc channel of pedestal value
TH1F * GetHistOccupancyVsEventConst() const
Int_t GetPatchIndex() const
UInt_t GetNRows(UInt_t sector) const
Int_t fFirstTimeBin
First Time bin needed for analysis.
TFile f("CalibObjects.root")
Float_t GetValue(UInt_t row, UInt_t pad) const
UInt_t GetNSector() const
void Divide(const AliTPCCalPad *pad)
Float_t ** fAllBins
! array for digit using random access
AliTPCCalPad * fNoThreshold
number of digits
TBits fActiveChambers
configured ROCs
AliTPCCalPad * GetNTimeBins() const
AliTPCCalPad * fTimePosition
Time position of local maximum.
void DumpToFile(const Char_t *filename, const Char_t *dir="", Bool_t append=kFALSE)
AliTPCCalPad * fOverThreshold20
! local maxima with qMax over threshold
AliTPCCalPad * fOverThreshold30
! local maxima with qMax over threshold
AliTPCCalPad * GetTimePosition() const
Int_t Update(const Int_t iSector, const Int_t iRow, const Int_t iPad, const Int_t iTimeBin, Float_t signal, const Int_t iPatch=-1, const Int_t iBranch=-1)
Int_t fSignalCounter
Signal counter.
TProfile * GetHistQMaxVsTimeSideA() const
AliTPCCalPad * GetOverThreshold30() const
Int_t fAdcMax
max adc channel of pedestal value
TArrayD * fOccMaxVec
! Occupancy help normlization for DQM
Int_t fTimeBinsMax
! Maximum number of time bins
void FindLocalMaxima(const Int_t iSector)
This class provides access to TPC digits in raw data.
AliTPCCalPad * fNLocalMaxima
local maximas found
TProfile * GetHistQVsTimeSideA() const
TArrayD * fOccMaxVecFine
! "2D" occupancy help normlization for DQM
TH1F * GetHistNclustersVsEventConst() const
TArrayD * fOccVec
! Occupancy help counter for DQM
Int_t fEventsPerBin
Events per bin for event histograms.
TObjArray * ConfigArrRocs(TObjArray *arr, const Text_t *name)
TProfile * fHistQVsTimeSideC
Q vs time (side C)
Int_t fLastTimeBin
Last Time bin needed for analysis.
AliTPCCalPad * fNPads
pads with of cluster
Bool_t fRequireNeighbouringPad
If clusterer should require a neighbouring pad to accept it.
Geometry class for a single ROC.
void SetValue(UInt_t row, UInt_t pad, Float_t vd)
TProfile * fHistQVsTimeSideA
Q vs time (side A)
TPC calibration base class for one ROC.
AliTPCCalPad * GetNPads() const
AliTPCAltroMapping ** fMapping
! Altro Mapping object
TProfile2D * fHistOcc2dVsSector
! Occ vs sector 2D (for DQM only)
AliTPCCalPad * fNoise
! option to set noise cal object
TProfile * fHistOccVsSector
! Occ vs sector (for DQM only)
Int_t fMaxEvents
Max events for event histograms.
AliTPCCalPad * GetMeanCharge() const
AliTPCCalPad * fMeanCharge
mean charge
Bool_t fIsAnalysed
Set to true after Analyse has been called.
TProfile * fHistQMaxVsTimeSideC
QMax vs time (side C)
AliTPCCalPad * fMaxCharge
max charge
TH1F * GetHistOccupancyVsEvent()
void DumpToFile(const char *fileName)
AliTPCCalPad * fNTimeBins
timebins width of cluster
Float_t GetQ(const Float_t *adcArray, const Int_t time, const Int_t pad, const Int_t maxTimeBins, Int_t &timeMin, Int_t &timeMax, Int_t &padMin, Int_t &padMax) const
Preprocessor class for HLT and DAQ.
TProfile * GetHistQMaxVsTimeSideC() const
TH1F * fHistNclustersVsEvent
Nclusters vs event number (~time)
AliTPCCalPad * GetNLocalMaxima() const
void UpdateEventHistograms()
TH1F * GetHistNclustersVsEvent()
AliTPCCalPad * fOverThreshold10
! local maxima with qMax over threshold
void GetPadAndTimeBin(Int_t bin, Int_t &iPad, Int_t &iTimeBin)
Bool_t ProcessEvent(AliTPCRawStreamV3 *const rawStreamV3)
static AliTPCROC * Instance()
void AddComponent(TObject *obj)
AliTPCCalPad * GetNoThreshold() const
AliTPCCalPad * GetOverThreshold20() const
Bool_t fIsDQM
! Is DQM -> Simple output (no 2D!)
TH1F * fHistOccupancyVsEvent
Occupancy vs event number (~time)
void MakeTree(const char *fname="QApad.root") const
AliTPCCalPad * GetOverThreshold10() const
void Multiply(Float_t c1)
Int_t fRowsMax
! Maximum number of time bins
Float_t fMinQMax
Minimun charge for Maximum ADC in cluster.
TProfile * GetHistQVsTimeSideC() const
AliTPCdataQA & operator=(const AliTPCdataQA &source)
AliTPCCalPad * fPedestal
! option to set pedestal cal object