#include "AliCDBManager.h"
#include "AliCDBEntry.h"
-
ClassImp(AliEMCAL)
//____________________________________________________________________________
// Default ctor
fName = "EMCAL" ;
InitConstants();
+
// Should call AliEMCALGeometry::GetInstance(EMCAL->GetTitle(),"") for getting EMCAL geometry
}
}
//____________________________________________________________________________
void AliEMCAL::Digits2Raw() {
- static AliEMCALRawUtils rawUtil;
- //Get Mapping RCU files from the AliEMCALRecParam
- static AliCDBEntry* entry = AliCDBManager::Instance()->Get("EMCAL/Calib/Mapping");
- const TObjArray* maps = 0x0;
- if(entry)
- maps = (TObjArray*)entry->GetObject();
-
- if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
-
- AliAltroMapping * mapping[2] ; // For the moment only 2
- for(Int_t i = 0; i < 2; i++) {
- mapping[i] = (AliAltroMapping*)maps->At(i);
- }
- rawUtil.Digits2Raw(mapping);
+
+ static AliEMCALRawUtils rawUtils;
+ rawUtils.Digits2Raw();
+
}
//____________________________________________________________________________
void AliEMCAL::Hits2SDigits()
Int_t AliEMCALRawUtils::fgDDLPerSuperModule = 2; // 2 ddls per SuperModule
AliEMCALRawUtils::AliEMCALRawUtils()
- : fHighLowGainFactor(0.), fOption("")
+ : fHighLowGainFactor(0.), fGeom(0),
+ fOption("")
{
fHighLowGainFactor = 16. ; // adjusted for a low gain range of 82 GeV (10 bits)
+
+ //Get Mapping RCU files from the AliEMCALRecParam
+ const TObjArray* maps = AliEMCALRecParam::GetMappings();
+ if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
+
+ for(Int_t i = 0; i < 2; i++) {
+ fMapping[i] = (AliAltroMapping*)maps->At(i);
+ }
+
+
+ fGeom = AliEMCALGeometry::GetInstance();
+ if(!fGeom) {
+ fGeom = AliEMCALGeometry::GetInstance("","");
+ if(!fGeom) AliFatal(Form("Could not get geometry!!"));
+ }
+
}
+
+//____________________________________________________________________________
+AliEMCALRawUtils::AliEMCALRawUtils(const AliEMCALRawUtils& rawU)
+ : TObject(),
+ fHighLowGainFactor(rawU.fHighLowGainFactor),
+ fGeom(rawU.fGeom),
+ fOption(rawU.fOption)
+{
+ //copy ctor
+ fMapping[0] = rawU.fMapping[0];
+ fMapping[1] = rawU.fMapping[1];
+}
+
+//____________________________________________________________________________
+AliEMCALRawUtils& AliEMCALRawUtils::operator =(const AliEMCALRawUtils &rawU)
+{
+ //assignment operator
+
+ if(this != &rawU) {
+ fHighLowGainFactor = rawU.fHighLowGainFactor;
+ fGeom = rawU.fGeom;
+ fOption = rawU.fOption;
+ fMapping[0] = rawU.fMapping[0];
+ fMapping[1] = rawU.fMapping[1];
+ }
+
+ return *this;
+
+}
+
//____________________________________________________________________________
AliEMCALRawUtils::~AliEMCALRawUtils() {
+
}
+
//____________________________________________________________________________
-void AliEMCALRawUtils::Digits2Raw(AliAltroMapping **mapping)
+void AliEMCALRawUtils::Digits2Raw()
{
// convert digits of the current event to raw data
Warning("Digits2Raw", "no digits found !");
return;
}
-
- // get the geometry
- AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance();
- if (!geom) {
- AliError(Form("No geometry found !"));
- return;
- }
-
+
static const Int_t nDDL = 12*2; // 12 SM hardcoded for now. Buffers allocated dynamically, when needed, so just need an upper limit here
AliAltroBuffer* buffers[nDDL];
for (Int_t i=0; i < nDDL; i++)
Int_t iphi = 0;
Int_t ieta = 0;
Int_t nModule = 0;
- geom->GetCellIndex(digit->GetId(), nSM, nModule, nIphi, nIeta);
- geom->GetCellPhiEtaIndexInSModule(nSM, nModule, nIphi, nIeta,iphi, ieta) ;
+ fGeom->GetCellIndex(digit->GetId(), nSM, nModule, nIphi, nIeta);
+ fGeom->GetCellPhiEtaIndexInSModule(nSM, nModule, nIphi, nIeta,iphi, ieta) ;
//Check which is the RCU of the cell.
Int_t iRCU = -111;
if (buffers[iDDL] == 0) {
// open new file and write dummy header
TString fileName = AliDAQ::DdlFileName("EMCAL",iDDL);
- buffers[iDDL] = new AliAltroBuffer(fileName.Data(),mapping[iRCU]);
+ buffers[iDDL] = new AliAltroBuffer(fileName.Data(),fMapping[iRCU]);
buffers[iDDL]->WriteDataHeader(kTRUE, kFALSE); //Dummy;
}
delete buffers[i];
}
}
-//PH mapping[0]->Delete();
-//PH mapping[1]->Delete();
+
loader->UnloadDigits();
}
//____________________________________________________________________________
-void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr,
- AliAltroMapping **mapping)
+void AliEMCALRawUtils::Raw2Digits(AliRawReader* reader,TClonesArray *digitsArr)
{
- // convert raw data of the current event to digits
- AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
- if (!geom) {
- AliError(Form("No geometry found !"));
- return;
- }
+ // convert raw data of the current event to digits
digitsArr->Clear();
return;
}
- AliCaloRawStream in(reader,"EMCAL",mapping);
+ AliCaloRawStream in(reader,"EMCAL",fMapping);
// Select EMCAL DDL's;
reader->Select("EMCAL");
Int_t row = 0;
while (readOk) {
- id = geom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
+ id = fGeom->GetAbsCellIdFromCellIndexes(in.GetModule(), in.GetRow(), in.GetColumn()) ;
lowGain = in.IsLowGain();
Int_t maxTime = in.GetTime(); // timebins come in reverse order
if (maxTime < 0 || maxTime >= GetRawFormatTimeBins()) {
class TGraph;
class TF1;
class AliRawReader;
+class AliEMCALGeometry;
class AliEMCALRawUtils : public TObject {
public:
AliEMCALRawUtils();
virtual ~AliEMCALRawUtils();
- void Digits2Raw(AliAltroMapping **mapping = NULL);
- void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr, AliAltroMapping **mapping = NULL);
+ AliEMCALRawUtils(const AliEMCALRawUtils& rawUtils); //copy ctor
+ AliEMCALRawUtils& operator =(const AliEMCALRawUtils& rawUtils);
+
+ void Digits2Raw();
+ void Raw2Digits(AliRawReader *reader,TClonesArray *digitsArr);
+
void AddDigit(TClonesArray *digitsArr, Int_t id, Int_t lowGain, Int_t amp, Float_t time);
// Signal shape parameters
static Int_t fgThreshold; // threshold
static Int_t fgDDLPerSuperModule; // number of DDL per SuperModule
+ AliEMCALGeometry* fGeom; //geometry
+ AliAltroMapping* fMapping[2]; //only two for now
+
TString fOption; //! option passed from Reconstructor
};
#include "AliCDBEntry.h"
#include "AliCDBManager.h"
#include "AliEMCALRecParam.h"
-// to be removed - it is here just because of geom
-#include "AliRun.h"
-#include "AliRunLoader.h"
+#include "AliEMCALGeometry.h"
+
ClassImp(AliEMCALReconstructor)
AliEMCALRecParam* AliEMCALReconstructor::fgkRecParam = 0; // EMCAL rec. parameters
-
+AliEMCALRawUtils* AliEMCALReconstructor::fgRawUtils = 0; // EMCAL raw utilities class
//____________________________________________________________________________
AliEMCALReconstructor::AliEMCALReconstructor()
- : fDebug(kFALSE)
+ : fDebug(kFALSE),fGeom(0)
{
// ctor
+ InitRecParam();
+
+ fgRawUtils = new AliEMCALRawUtils;
+ fGeom = AliEMCALGeometry::GetInstance();
+ if(!fGeom) {
+ fGeom = AliEMCALGeometry::GetInstance("","");
+ if(!fGeom) AliFatal(Form("Could not get geometry!"));
+ }
}
//____________________________________________________________________________
AliEMCALReconstructor::AliEMCALReconstructor(const AliEMCALReconstructor & rec)
: AliReconstructor(rec),
- fDebug(rec.fDebug)
+ fDebug(rec.fDebug),
+ fGeom(rec.fGeom)
{
//copy ctor
}
AliEMCALReconstructor::~AliEMCALReconstructor()
{
// dtor
-
+ delete fGeom;
AliCodeTimer::Instance()->Print();
}
AliCodeTimerAuto("")
- InitRecParam();
AliEMCALClusterizerv1 clu;
clu.SetInput(digitsTree);
clu.SetOutput(clustersTree);
// EMCAL digits.
// Works on a single-event basis
-
- AliCodeTimerAuto("")
-
rawReader->Reset() ;
TClonesArray *digitsArr = new TClonesArray("AliEMCALDigit",100);
Int_t bufsize = 32000;
digitsTree->Branch("EMCAL", &digitsArr, bufsize);
- //Get Mapping RCU files from the AliEMCALRecParam
- const TObjArray* maps = AliEMCALRecParam::GetMappings();
- if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
-
- AliAltroMapping * mapping[2] ; // For the moment only 2
- for(Int_t i = 0; i < 2; i++) {
- mapping[i] = (AliAltroMapping*)maps->At(i);
- }
-
- static AliEMCALRawUtils rawUtils;
- rawUtils.SetOption(GetOption());
- rawUtils.Raw2Digits(rawReader,digitsArr,mapping);
+ //must be done here because, in constructor, option is not yet known
+ fgRawUtils->SetOption(GetOption());
+ fgRawUtils->Raw2Digits(rawReader,digitsArr);
digitsTree->Fill();
digitsArr->Delete();
//#########Calculate trigger and set trigger info###########
//######################################################
- AliCodeTimerStart(Form("JLK trigger info"));
AliEMCALTrigger tr ;
// tr.SetPatchSize(1);//create 4x4 patches
tr.Trigger();
Float_t ampOutOfPatch2x2 = tr.Get2x2AmpOutOfPatch() ;
Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ;
- AliEMCALGeometry * geom = 0;
- AliRunLoader *runLoader = AliRunLoader::GetRunLoader();
- if (runLoader->GetAliRun() && runLoader->GetAliRun()->GetDetector("EMCAL"))
- geom = dynamic_cast<AliEMCAL*>(runLoader->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
- if (geom == 0)
- geom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaulGeometryName());
-
Int_t iSM2x2 = tr.Get2x2SuperModule();
Int_t iSMnxn = tr.GetnxnSuperModule();
Int_t iCellPhi2x2 = tr.Get2x2CellPhi();
TVector3 pos2x2(-1,-1,-1);
TVector3 posnxn(-1,-1,-1);
- Int_t iAbsId2x2 = geom->GetAbsCellIdFromCellIndexes( iSM2x2, iCellPhi2x2, iCellEta2x2) ;
- Int_t iAbsIdnxn = geom->GetAbsCellIdFromCellIndexes( iSMnxn, iCellPhinxn, iCellEtanxn) ;
- geom->GetGlobal(iAbsId2x2, pos2x2);
- geom->GetGlobal(iAbsIdnxn, posnxn);
+ Int_t iAbsId2x2 = fGeom->GetAbsCellIdFromCellIndexes( iSM2x2, iCellPhi2x2, iCellEta2x2) ;
+ Int_t iAbsIdnxn = fGeom->GetAbsCellIdFromCellIndexes( iSMnxn, iCellPhinxn, iCellEtanxn) ;
+ fGeom->GetGlobal(iAbsId2x2, pos2x2);
+ fGeom->GetGlobal(iAbsIdnxn, posnxn);
TArrayF triggerPosition(6);
triggerPosition[0] = pos2x2(0) ;
esd->AddEMCALTriggerPosition(triggerPosition);
esd->AddEMCALTriggerAmplitudes(triggerAmplitudes);
- AliCodeTimerStop(Form("JLK trigger info"));
-
//########################################
//##############Fill CaloCells###############
//########################################
- AliCodeTimerStart(Form("JLK fill calocells"));
-
TClonesArray *digits = new TClonesArray("AliEMCALDigit",1000);
TBranch *branchdig = digitsTree->GetBranch("EMCAL");
if (!branchdig) {
emcCells.SetNumberOfCells(idignew);
emcCells.Sort();
- AliCodeTimerStop(Form("JLK fill calocells"));
-
//------------------------------------------------------------
//-----------------CLUSTERS-----------------------------
//------------------------------------------------------------
//######################################################
//Fill list of integers, each one is index of track to which the cluster belongs.
- AliCodeTimerStart(Form("JLK track matching"));
-
// step 1 - initialize array of matched track indexes
Int_t *matchedTrack = new Int_t[nClusters];
for (Int_t iclus = 0; iclus < nClusters; iclus++)
if(iemcalMatch >= 0) matchedTrack[iemcalMatch] = itrack;
}
- AliCodeTimerStop(Form("JLK track matching"));
-
//########################################
//##############Fill CaloClusters############
//########################################
- AliCodeTimerStart(Form("JLK fill caloclusters"));
-
esd->SetNumberOfEMCALClusters(nClusters);
for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)clusters->At(iClust);
pid->RunPID(esd);
delete pid;
- AliCodeTimerStop(Form("JLK fill caloclusters"));
-
}
class AliEMCALRecParam;
class AliESDEvent ;
class AliRawReader ;
+class AliEMCALRawUtils;
+class AliEMCALGeometry;
// --- Standard library ---
Bool_t fDebug; //! verbosity controller
static AliEMCALRecParam* fgkRecParam; // reconstruction parameters for EMCAL
+ static AliEMCALRawUtils* fgRawUtils; // raw utilities class -
+ // only need one per reco
+ AliEMCALGeometry *fGeom; // pointer to the EMCAL geometry
- ClassDef(AliEMCALReconstructor,2) // Reconstruction algorithm class (Base Class)
+ ClassDef(AliEMCALReconstructor,3) // Reconstruction algorithm class (Base Class)
};