//*-- Author: Marco van Leeuwen (LBL)
#include "AliEMCALRawUtils.h"
-
+
#include "TF1.h"
#include "TGraph.h"
#include "TSystem.h"
-
+
#include "AliLog.h"
#include "AliRun.h"
#include "AliRunLoader.h"
#include "AliRawReader.h"
#include "AliCaloRawStream.h"
#include "AliDAQ.h"
-
+
#include "AliEMCALRecParam.h"
#include "AliEMCALLoader.h"
#include "AliEMCALGeometry.h"
#include "AliEMCALDigitizer.h"
#include "AliEMCALDigit.h"
#include "AliEMCAL.h"
-
+
ClassImp(AliEMCALRawUtils)
-
+
// Signal shape parameters
-Double_t AliEMCALRawUtils::fgTimeBinWidth = 100E-9 ; // each sample is 100 ns
+ Double_t AliEMCALRawUtils::fgTimeBinWidth = 100E-9 ; // each sample is 100 ns
Double_t AliEMCALRawUtils::fgTimeTrigger = 1.5E-6 ; // 15 time bins ~ 1.5 musec
// some digitization constants
const TObjArray* maps = AliEMCALRecParam::GetMappings();
if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
- for(Int_t i = 0; i < 2; i++) {
+ for(Int_t i = 0; i < 4; i++) {
fMapping[i] = (AliAltroMapping*)maps->At(i);
}
//To make sure we match with the geometry in a simulation file,
//let's try to get it first. If not, take the default geometry
AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ if(!rl) AliError("Cannot find RunLoader!");
if (rl->GetAliRun() && rl->GetAliRun()->GetDetector("EMCAL")) {
fGeom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
} else {
const TObjArray* maps = AliEMCALRecParam::GetMappings();
if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
- for(Int_t i = 0; i < 2; i++) {
+ for(Int_t i = 0; i < 4; i++) {
fMapping[i] = (AliAltroMapping*)maps->At(i);
}
//copy ctor
fMapping[0] = rawU.fMapping[0];
fMapping[1] = rawU.fMapping[1];
+ fMapping[2] = rawU.fMapping[2];
+ fMapping[3] = rawU.fMapping[3];
}
//____________________________________________________________________________
fOption = rawU.fOption;
fMapping[0] = rawU.fMapping[0];
fMapping[1] = rawU.fMapping[1];
+ fMapping[2] = rawU.fMapping[2];
+ fMapping[3] = rawU.fMapping[3];
}
return *this;
fGeom->GetCellIndex(digit->GetId(), nSM, nModule, nIphi, nIeta);
fGeom->GetCellPhiEtaIndexInSModule(nSM, nModule, nIphi, nIeta,iphi, ieta) ;
- //Check which is the RCU of the cell.
+ //Check which is the RCU, 0 or 1, of the cell.
Int_t iRCU = -111;
//RCU0
if (0<=iphi&&iphi<8) iRCU=0; // first cable row
else if(8<=iphi&&iphi<16 && 24<=ieta&&ieta<48) iRCU=1; // second half;
//second cable row
else if(16<=iphi&&iphi<24) iRCU=1; // third cable row
+
+ if (nSM%2==1) iRCU = 1 - iRCU; // swap for odd=C side, to allow us to cable both sides the same
+
if (iRCU<0)
Fatal("Digits2Raw()","Non-existent RCU number: %d", iRCU);
if (buffers[iDDL] == 0) {
// open new file and write dummy header
TString fileName = AliDAQ::DdlFileName("EMCAL",iDDL);
- buffers[iDDL] = new AliAltroBuffer(fileName.Data(),fMapping[iRCU]);
+ //Select mapping file RCU0A, RCU0C, RCU1A, RCU1C
+ Int_t iRCUside=iRCU+(nSM%2)*2;
+ //iRCU=0 and even (0) SM -> RCU0A.data 0
+ //iRCU=1 and even (0) SM -> RCU1A.data 1
+ //iRCU=0 and odd (1) SM -> RCU0C.data 2
+ //iRCU=1 and odd (1) SM -> RCU1C.data 3
+ //cout<<" nSM "<<nSM<<"; iRCU "<<iRCU<<"; iRCUside "<<iRCUside<<endl;
+ buffers[iDDL] = new AliAltroBuffer(fileName.Data(),fMapping[iRCUside]);
buffers[iDDL]->WriteDataHeader(kTRUE, kFALSE); //Dummy;
}
Int_t row = 0;
while (readOk) {
+
id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
lowGain = in.IsLowGain();
Int_t maxTime = in.GetTime(); // timebins come in reverse order
FitRaw(gSig, signalF, amp, time) ;
- if (amp > 0 && amp < 10000) { //check both high and low end of
- //result, 10000 is somewhat arbitrary
+ if (amp > 0 && amp < 2000) { //check both high and low end of
+ //result, 2000 is somewhat arbitrary
AliDebug(2,Form("id %d lowGain %d amp %g", id, lowGain, amp));
- //cout << "col " << col-40 << " row " << row-8 << " lowGain " << lowGain << " amp " << amp << endl;
AddDigit(digitsArr, id, lowGain, (Int_t)amp, time);
}
Int_t n_ped_after_sig = 0;
Int_t plateau_width = 0;
Int_t plateau_start = 9999;
+ Float_t Cut = 0.3;
for (Int_t i=fNPedSamples; i < gSig->GetN(); i++) {
Double_t ttime, signal;
max_fit = tmin_after_sig;
break;
}
+ if ( signal < Cut*max){ //stop fit at 30% amplitude(avoid the pulse shape falling edge)
+ max_fit = i;
+ break;
+ }
if ( signal < ped + fNoiseThreshold)
n_ped_after_sig++;
if (n_ped_after_sig >= 5) { // include 5 pedestal bins after peak
}
if(plateau_width > 0) {
- for(int j = 0; j < plateau_width-2; j++) {
+ for(int j = 0; j < plateau_width; j++) {
//Note, have to remove the same point N times because after each
//remove, the positions of all subsequent points have shifted down
- //We leave the first and last as anchor points
- gSig->RemovePoint(plateau_start+1);
+ gSig->RemovePoint(plateau_start);
}
}