//----------------------------------------------------------------
AliPHOSDA2::AliPHOSDA2(int module) : TNamed(),
- fHistoFile(0),fMod(module)
+ fHistoFile(0),fFiredCells(0),fMod(module)
{
// Create AliPHOSDA2 ("Bad channels finder") object.
fMaps[0]=0;
fMaps[1]=0;
+ fFiredCells = new TH1I("fFiredCells","Number of fired cells per event",100,0,1000);
+
}
//-------------------------------------------------------------------
AliPHOSDA2::AliPHOSDA2(const AliPHOSDA2& da) : TNamed(da),
- fHistoFile(0),fMod(da.fMod)
+ fHistoFile(0),fFiredCells(0),fMod(da.fMod)
{
// Copy constructor.
fMaps[1] = 0;
fHistoFile = new TFile(da.GetName(),"recreate");
+ fFiredCells = new TH1I(*da.fFiredCells);
}
fMaps[1] = da.fMaps[1];
}
+ if(fFiredCells) {
+ delete fFiredCells;
+ fFiredCells = da.fFiredCells;
+ }
+
}
return *this;
}
+//-------------------------------------------------------------------
+void AliPHOSDA2::FillFiredCellsHistogram(Int_t nCells)
+{
+ fFiredCells->Fill(nCells);
+}
+
//-------------------------------------------------------------------
void AliPHOSDA2::UpdateHistoFile()
{
fMaps[0]->Write(fMaps[0]->GetName(),TObject::kWriteDelete);
fMaps[1]->Write(fMaps[1]->GetName(),TObject::kWriteDelete);
+ fFiredCells->Write();
+
}
~AliPHOSDA2();
void FillQualityHistograms(Float_t quality[64][56][2]);
+ void FillFiredCellsHistogram(Int_t nCells);
Int_t GetModule() { return fMod; }
void UpdateHistoFile();
const TH1F* GetQualityHistogram(Int_t X, Int_t Z, Int_t gain) const
{ return fHQuality[X][Z][gain]; }
+
+ const TH1I* GetFiredCellsHistogram() { return fFiredCells; }
private:
TFile* fHistoFile; // root file to store histograms in
TH1F* fHQuality[64][56][2]; // "quality" for high and low gains
+ TH1I* fFiredCells; // Number of fired cells pre event.
Int_t fMod; // PHOS module number (0..4)
TH2F* fMaps[2]; // 2D quality map for low and high gains.
TIter iter(list);
TObjString *source;
+ Bool_t firedOK = kFALSE;
while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
return kFALSE;
}
+ TH1I* fFiredCells = (TH1I*)f.Get("fFiredCells");
+
+ if(!fFiredCells) {
+ Log(Form("fFiredCells histogram not found in %s, skip this source.",fileName.Data()));
+ firedOK=kFALSE;
+ }
+ else {
+ const Double_t nFiredCells = fFiredCells->GetMean();
+ if(nFiredCells>100 && nFiredCells<600) {
+ firedOK = kTRUE;
+ Log(Form("Number of fired cells per event is %d.",nFiredCells));
+ }
+ else {
+ Log(Form("Number of fired cells per event is %d, possibly not a LED run!",nFiredCells));
+ firedOK = kFALSE;
+ }
+
+ }
+
const Int_t nMod=5; // 1:5 modules
const Int_t nCol=56; //1:56 columns in each module
const Int_t nRow=64; //1:64 rows in each module
for(Int_t col=0; col<nCol; col++) {
for(Int_t row=0; row<nRow; row++) {
- //High Gain to Low Gain ratio
- Float_t ratio = HG2LG(mod,row,col,&f);
- calibData.SetHighLowRatioEmc(mod+1,col+1,row+1,ratio);
- if(ratio != 16.)
- AliInfo(Form("mod %d iX %d iZ %d ratio %.3f\n",mod,row,col,ratio));
-
+ //High Gain to Low Gain ratio
+ if(firedOK) {
+ Float_t ratio = HG2LG(mod,row,col,&f);
+ calibData.SetHighLowRatioEmc(mod+1,col+1,row+1,ratio);
+ if(ratio != 16.)
+ AliInfo(Form("mod %d iX %d iZ %d ratio %.3f\n",mod,row,col,ratio));
+ }
+
if(clb) {
Double_t coeff = clb->GetADCchannelEmc(mod+1,col+1,row+1);
calibData.SetADCchannelEmc(mod+1,col+1,row+1,coeff);
Log(Form("File %s is not opened, something goes wrong!",fileName.Data()));
return kFALSE;
}
+
+ TH1I* fFiredCells = (TH1I*)f.Get("fFiredCells");
+
+ if(!fFiredCells) {
+ Log(Form("fFiredCells histogram not found in %s, skip this source.",fileName.Data()));
+ continue;
+ }
+
+ const Double_t nFiredCells = fFiredCells->GetMean();
+
+ if(nFiredCells<100. || nFiredCells>600. ) {
+ Log(Form("Number of fired cells per event is %d, possibly not a LED run!",nFiredCells));
+ continue; // not a LED run!
+ }
- Log(Form("Begin check for bad channels."));
+ Log(Form("Number of fired cells per event %d. Begin check for bad channels.",nFiredCells));
for(Int_t mod=0; mod<5; mod++) {
for(Int_t iX=0; iX<64; iX++) {
AliRawReader *rawReader = NULL;
- AliPHOSDA2 da2(2); // DA2 ("Checking for bad channels") for module2
+ AliPHOSDA2* da2 = new AliPHOSDA2(2); // DA2 ("Checking for bad channels") for module2
Float_t q[64][56][2];
Int_t gain = -1;
Int_t X = -1;
Int_t Z = -1;
+ Int_t nFired = -1;
/* main loop (infinite) */
for(;;) {
}
}
+ nFired = 0;
+
rawReader = new AliRawReaderDate((void*)event);
AliPHOSRawDecoderv1 dc(rawReader,mapping);
dc.SubtractPedestals(kTRUE);
gain = 1;
q[X][Z][gain] = dc.GetSampleQuality();
+
+ if(gain && dc.GetEnergy()>40)
+ nFired++;
}
- da2.FillQualityHistograms(q);
+ da2->FillQualityHistograms(q);
+ da2->FillFiredCellsHistogram(nFired);
//da1.UpdateHistoFile();
delete rawReader;
}
for(Int_t i = 0; i < 4; i++) delete mapping[i];
+
+ /* Be sure that all histograms are saved */
+ delete da2;
/* Store output files to the File Exchange Server */
- char localfile[128];
-
- for(Int_t iMod=0; iMod<5; iMod++) {
- sprintf(localfile,"PHOS_Module%d_BCM.root",iMod);
- daqDA_FES_storeFile(localfile,"BAD_CHANNELS");
- }
+ daqDA_FES_storeFile("PHOS_Module2_BCM.root","BAD_CHANNELS");
return status;
}
Int_t gain = -1;
Int_t X = -1;
Int_t Z = -1;
+ Int_t nFired = -1;
+
+ TH1I fFiredCells("fFiredCells","Number of fired cells per event",100,0,1000);
/* main loop (infinite) */
for(;;) {
}
}
+ nFired = 0;
+
rawReader = new AliRawReaderDate((void*)event);
// AliPHOSRawDecoderv1 dc(rawReader,mapping);
AliPHOSRawDecoder dc(rawReader,mapping);
e[X][Z][gain] = dc.GetEnergy();
t[X][Z][gain] = dc.GetTime();
+ if(gain && dc.GetEnergy()>40)
+ nFired++;
+
}
da1.FillHistograms(e,t);
-
+ fFiredCells.Fill(nFired);
+
delete rawReader;
nevents_physics++;
}
}
}
+ fFiredCells.Write();
f->Close();
/* Store output files to the File Exchange Server */
-
- for(Int_t iMod=0; iMod<5; iMod++) {
- sprintf(localfile,"PHOS_Module%d_LED.root",iMod);
- daqDA_FES_storeFile(localfile,"LED");
- }
+ daqDA_FES_storeFile("PHOS_Module2_LED.root","LED");
printf("%d physics events of %d total processed.\n",nevents_physics,nevents_total);
printf("%d histograms has >10 entries in maximum, max. is %d entries ",nGood,nMax);