return *this;
}
-
//_____________________________________________________________________
AliTRDCalibPadStatus::~AliTRDCalibPadStatus() /*FOLD00*/
{
//
// destructor
//
+ fCalRocArrayMean.Delete();
+ fCalRocArrayRMS.Delete();
+ fCalRocArrayMeand.Delete();
+ fCalRocArrayRMSd.Delete();
+ fHistoArray.Delete();
if (fGeo) {
delete fGeo;
}
}
-
+//_____________________________________________________________________
+void AliTRDCalibPadStatus::Destroy()
+{
+ //
+ // Destroy
+ //
+ fCalRocArrayMean.Delete();
+ fCalRocArrayRMS.Delete();
+ fCalRocArrayMeand.Delete();
+ fCalRocArrayRMSd.Delete();
+ fHistoArray.Delete();
+}
//_____________________________________________________________________
Int_t AliTRDCalibPadStatus::UpdateHisto(const Int_t icdet, /*FOLD00*/
const Int_t icRow,
// 0 time bin problem or zero suppression
// 1 no input
// 2 input
- //
+ //
+
+ //
+ // Raw version number:
+ // [3,31] non zero suppressed
+ // 2,4 and [32,63] zero suppressed
+ //
Int_t withInput = 1;
rawStream->SetSharedPadReadout(kTRUE);
if(!nocheck) {
+
+ // Check the raw version and if all have the same number of timebins.
+
while (rawStream->Next()) {
+
Int_t rawversion = rawStream->GetRawVersion(); // current raw version
- //if(!rawStream->IsDataZeroSuppressed()) {
- if(rawversion > 2) {
+ //printf("Raw version is %d\n",rawversion);
+
+ // Could eventually change, have to check with time
+ if((rawversion < 3) || (rawversion > 31)) {
AliInfo(Form("this is not no-zero-suppressed data, the version is %d",rawversion));
return 0;
}
Int_t iRow = rawStream->GetRow(); // current row
Int_t iRowMax = rawStream->GetMaxRow(); // current rowmax
Int_t iCol = rawStream->GetCol(); // current col
-
-
Int_t iADC = 21-rawStream->GetADC(); // current ADC
+
+ // It goes in the opposite direction
Int_t col = 0;
if(iADC == 1) col = 1;
else {
if(col > 1) mcm -= 1;
if(col ==1) mcm += 1;
+ // printf to check
//Bool_t shared = rawStream->IsCurrentPadShared();
//printf("ADC %d, iCol %d, col %d, mcm %d, shared %d\n",iADC,iCol,col,mcm,(Int_t)shared);
+ // Take the signal
Int_t *signal = rawStream->GetSignals(); // current ADC signal
Int_t nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
return 0;
}
fNumberOfTimeBins = nbtimebin;
-
+ fDetector = idetector;
+
for(Int_t k = 0; k < fNumberOfTimeBins; k++){
if(signal[k]>0) UpdateHisto(idetector,iRow,iCol,signal[k],iRowMax,col,mcm);
}
}
}
else {
+
while (rawStream->Next()) {
+
Int_t idetector = rawStream->GetDet(); // current detector
Int_t iRow = rawStream->GetRow(); // current row
Int_t iRowMax = rawStream->GetMaxRow(); // current rowmax
Int_t iCol = rawStream->GetCol(); // current col
-
-
Int_t iADC = 21-rawStream->GetADC(); // current ADC
+
+ // It goes in the opposite direction
Int_t col = 0;
if(iADC == 1) col = 1;
else {
if(col > 1) mcm -= 1;
if(col ==1) mcm += 1;
+ // Take the signal
Int_t *signal = rawStream->GetSignals(); // current ADC signal
Int_t nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
return withInput;
}
-
//_____________________________________________________________________
Int_t AliTRDCalibPadStatus::ProcessEvent(AliRawReader *rawReader, Bool_t nocheck)
{
//_____________________________________________________________________
TH2F* AliTRDCalibPadStatus::GetHisto(Int_t det, TObjArray *arr, /*FOLD00*/
Int_t nbinsY, Float_t ymin, Float_t ymax,
- Char_t *type, Bool_t force)
+ const Char_t *type, Bool_t force)
{
//
// return pointer to histogram
// if we are forced and histogram doesn't yes exist create it
Char_t name[255], title[255];
- sprintf(name,"hCalib%s%.2d",type,det);
+ sprintf(name,"hCalib%s%.3d",type,det);
sprintf(title,"%s calibration histogram detector %.2d;ADC channel;Channel (pad)",type,det);
- Int_t nbchannels = fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det))*fGeo->GetColMax(GetPlane(det));
+ Int_t nbchannels = fGeo->GetRowMax(GetLayer(det),GetStack(det),GetSector(det))*fGeo->GetColMax(GetLayer(det));
// we will add 3*8*rowMax channels at the end for the double counted
- nbchannels += 3*8*(fGeo->GetRowMax(GetPlane(det),GetChamber(det),GetSector(det)));
+ nbchannels += 3*8*(fGeo->GetRowMax(GetLayer(det),GetStack(det),GetSector(det)));
// new histogram with calib information. One value for each pad!
// if we are forced and histogram doesn't yes exist create it
// new AliTRDCalROC. One value for each pad!
- AliTRDCalROC *croc = new AliTRDCalROC(GetPlane(det),GetChamber(det));
+ AliTRDCalROC *croc = new AliTRDCalROC(GetLayer(det),GetStack(det));
arr->AddAt(croc,det);
return croc;
}
{
//
// Create Pad Status out of Mean and RMS values
+ // The chamber without data are masked, this is the corrected in the preprocessor
//
AliTRDCalPadStatus* obj = new AliTRDCalPadStatus("padstatus", "padstatus");
{
AliTRDCalSingleChamberStatus *calROC = obj->GetCalROC(idet);
- //Take the stuff
- AliTRDCalROC *calRocMean = ((AliTRDCalROC *)GetCalRocMean(idet));
- AliTRDCalROC *calRocRMS = ((AliTRDCalROC *)GetCalRocRMS(idet));
-
- //Take the stuff second chance
- AliTRDCalROC *calRocMeand = ((AliTRDCalROC *)GetCalRocMeand(idet));
- AliTRDCalROC *calRocRMSd = ((AliTRDCalROC *)GetCalRocRMSd(idet));
- if ( !calRocMean ) {
+ if ( !GetCalRocMean(idet)) {
for(Int_t k = 0; k < calROC->GetNchannels(); k++){
- calROC->SetStatus(k,AliTRDCalPadStatus::kMasked);
+ calROC->SetStatus(k,AliTRDCalPadStatus::kNotConnected);
}
continue;
}
+
+ //Take the stuff
+ AliTRDCalROC *calRocMean = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocMean(idet)));
+ AliTRDCalROC *calRocRMS = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocRMS(idet)));
+
+ //Take the stuff second chance
+ AliTRDCalROC *calRocMeand = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocMeand(idet)));
+ AliTRDCalROC *calRocRMSd = new AliTRDCalROC(*( (AliTRDCalROC *) GetCalRocRMSd(idet)));
+
+ calRocRMS->Unfold();
+ calRocRMSd->Unfold();
+
+
//Range
- Int_t channels = calROC->GetNchannels();
+ Int_t row = calROC->GetNrows();
+ Int_t col = calROC->GetNcols();
Double_t rmsmean = calRocMean->GetRMS()*10.0;
Double_t meanmean = calRocMean->GetMean()*10.0;
- Double_t meansquares = calRocRMS->GetMean()*10.0;
+ Double_t meansquares = calRocRMS->GetMean();
- for(Int_t ich = 0; ich < channels; ich++){
+
+ for(Int_t irow = 0; irow < row; irow++){
- Float_t mean = calRocMean->GetValue(ich)*10.0;
- Float_t rms = calRocRMS->GetValue(ich)*10.0;
+ // for bridged pads
+ Float_t meanprevious = 0.0;
+ Float_t rmsprevious = 0.0;
+ Float_t mean = 0.0;
+ Float_t rms = 0.0;
- if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) {
- // look at second chance
- Float_t meand = calRocMeand->GetValue(ich)*10.0;
- Float_t rmsd = calRocRMSd->GetValue(ich)*10.0;
+ for(Int_t icol = 0; icol < col; icol++){
+
+ mean = calRocMean->GetValue(icol,irow)*10.0;
+ rms = calRocRMS->GetValue(icol,irow);
+
+ if(icol > 0) {
+ meanprevious = calRocMean->GetValue((icol -1),irow)*10.0;
+ rmsprevious = calRocRMS->GetValue((icol - 1),irow);
+ }
+
+ Bool_t pb = kFALSE;
+ // masked if two noisy
+ if((rms <= 0.0001) || (TMath::Abs(mean-meanmean)>(5*rmsmean)) || (TMath::Abs(rms)>(5.0*TMath::Abs(meansquares)))) {
+
+ pb = kTRUE;
+ // look at second chance
+ Float_t meand = calRocMeand->GetValue(icol,irow)*10.0;
+ Float_t rmsd = calRocRMSd->GetValue(icol,irow);
+
+ if((rmsd <= 0.0001) || (TMath::Abs(meand-meanmean)>(5*rmsmean)) || (TMath::Abs(rmsd)>(5.0*TMath::Abs(meansquares)))) {
+ if((rmsd <= 0.0001) && (rms <= 0.0001)) {
+ calROC->SetStatus(icol,irow,AliTRDCalPadStatus::kNotConnected);
+ }
+ else {
+ calROC->SetStatus(icol, irow, AliTRDCalPadStatus::kMasked);
+ }
+ }
+ else {
+ calROC->SetStatus(icol, irow, AliTRDCalPadStatus::kReadSecond);
+ }
+ }
- if((rmsd <= 0.0001) || (TMath::Abs(meand-meanmean)>(5*rmsmean)) || (TMath::Abs(rmsd)>(5.0*TMath::Abs(meansquares)))) {
- calROC->SetStatus(ich, AliTRDCalPadStatus::kMasked);
+
+ // bridge if previous pad found something
+ if(!pb) {
+ if((meanprevious == mean) && (rmsprevious == rms) && (mean > 0.0001)) {
+ //printf("mean previous %f, mean %f, rms %f, rmsprevious %f, col %d\n",meanprevious,mean,rms,rmsprevious,icol);
+ calROC->SetStatus(icol -1 ,irow, AliTRDCalPadStatus::kPadBridgedRight);
+ calROC->SetStatus(icol ,irow, AliTRDCalPadStatus::kPadBridgedLeft);
+ }
}
- else calROC->SetStatus(ich, AliTRDCalPadStatus::kReadSecond);
+
}
-
}
+
+ delete calRocMean;
+ delete calRocRMS;
+ delete calRocMeand;
+ delete calRocRMSd;
+
+
}
return obj;
}
//_____________________________________________________________________________
-Int_t AliTRDCalibPadStatus::GetPlane(Int_t d) const
+Int_t AliTRDCalibPadStatus::GetLayer(Int_t d) const
{
//
- // Reconstruct the plane number from the detector number
+ // Reconstruct the layer number from the detector number
//
return ((Int_t) (d % 6));
}
//_____________________________________________________________________________
-Int_t AliTRDCalibPadStatus::GetChamber(Int_t d) const
+Int_t AliTRDCalibPadStatus::GetStack(Int_t d) const
{
//
// Reconstruct the chamber number from the detector number