#include "AliCDBManager.h"
#include "AliEMCALGeometry.h"
#include "AliEMCAL.h"
-#include "AliEMCALHistoUtilities.h"
#include "AliESDVZERO.h"
#include "AliCDBManager.h"
#include "AliRunLoader.h"
#include "AliRun.h"
#include "AliEMCALTriggerData.h"
#include "AliEMCALTriggerElectronics.h"
-#include "AliVZEROLoader.h"
+#include "AliEMCALTriggerDCSConfigDB.h"
+#include "AliEMCALTriggerDCSConfig.h"
ClassImp(AliEMCALReconstructor)
if(!fGeom) AliFatal(Form("Could not get geometry!"));
- fgTriggerProcessor = new AliEMCALTriggerElectronics();
+ AliEMCALTriggerDCSConfigDB* dcsConfigDB = AliEMCALTriggerDCSConfigDB::Instance();
+
+ const AliEMCALTriggerDCSConfig* dcsConfig = dcsConfigDB->GetTriggerDCSConfig();
+
+ if (!dcsConfig) AliFatal("No Trigger DCS Configuration from OCDB!");
+ fgTriggerProcessor = new AliEMCALTriggerElectronics( dcsConfig );
}
//____________________________________________________________________________
AliCodeTimer::Instance()->Print();
}
-//____________________________________________________________________________
-void AliEMCALReconstructor::Init()
-{
- // Trigger hists - Oct 24, 2007
- fList = AliEMCALHistoUtilities::GetTriggersListOfHists(kTRUE);
-}
+// //____________________________________________________________________________
+// void AliEMCALReconstructor::Init()
+// {
+// // Trigger hists - Oct 24, 2007
+// fList = AliEMCALHistoUtilities::GetTriggersListOfHists(kTRUE);
+// }
//____________________________________________________________________________
void AliEMCALReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const
ReadDigitsArrayFromTree(digitsTree);
fgClusterizer->InitParameters();
fgClusterizer->SetOutput(clustersTree);
-
+
AliEMCALTriggerData* trgData = new AliEMCALTriggerData();
Int_t bufferSize = 32000;
if (TBranch* triggerBranch = clustersTree->GetBranch("EMTRG"))
- triggerBranch->SetAddress(&trgData);
- else
- clustersTree->Branch("EMTRG","AliEMCALTriggerData",&trgData,bufferSize);
-
- AliVZEROLoader* vzeroLoader = dynamic_cast<AliVZEROLoader*>(AliRunLoader::Instance()->GetDetectorLoader("VZERO"));
-
- TTree* treeV0 = 0x0;
-
- if (vzeroLoader)
- {
- vzeroLoader->LoadDigits("READ");
- treeV0 = vzeroLoader->TreeD();
- }
+ triggerBranch->SetAddress(&trgData);
+ else
+ clustersTree->Branch("EMTRG","AliEMCALTriggerData",&trgData,bufferSize);
TClonesArray *trgDigits = new TClonesArray("AliEMCALRawDigit",1000);
TBranch *branchdig = digitsTree->GetBranch("EMTRG");
branchdig->SetAddress(&trgDigits);
branchdig->GetEntry(0);
-
- fgTriggerProcessor->Digits2Trigger(trgDigits, treeV0, trgData);
- trgDigits->Delete();
+ //Skip clusterization of LED events
+ if (GetRecParam()->GetEventSpecie()!=AliRecoParam::kCalib){
+
+ Int_t v0M[2] = {0,0};
+ fgTriggerProcessor->Digits2Trigger(trgDigits, v0M, trgData);
- if(fgDigitsArr && fgDigitsArr->GetEntries()) {
+
+ if(fgDigitsArr && fgDigitsArr->GetEntries()) {
- fgClusterizer->SetInput(digitsTree);
+ fgClusterizer->SetInput(digitsTree);
- if(Debug())
- fgClusterizer->Digits2Clusters("deb all") ;
- else
- fgClusterizer->Digits2Clusters("");
+ if(Debug())
+ fgClusterizer->Digits2Clusters("deb all") ;
+ else
+ fgClusterizer->Digits2Clusters("");
- fgClusterizer->Clear();
-
- }
+ fgClusterizer->Clear();
+ }//digits array exists and has somethind
+ }//not a LED event
+
clustersTree->Fill();
+ trgDigits->Delete();
+ delete trgDigits; trgDigits = 0x0;
+ delete trgData; trgData = 0x0;
- delete trgData;
}
//____________________________________________________________________________
Int_t bufsize = 32000;
digitsTree->Branch("EMCAL", &digitsArr, bufsize);
digitsTree->Branch("EMTRG", &digitsTrg, bufsize);
-
- //must be done here because, in constructor, option is not yet known
- fgRawUtils->SetOption(GetOption());
-
- fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor());
- fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter());
- fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau());
- fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold());
- fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples());
- fgRawUtils->SetRemoveBadChannels(GetRecParam()->GetRemoveBadChannels());
- fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm());
- fgRawUtils->SetFALTROUsage(GetRecParam()->UseFALTRO());
- fgRawUtils->Raw2Digits(rawReader,digitsArr,fPedestalData,digitsTrg);
-
+ //Skip calibration events do the rest
+ Bool_t doFit = kTRUE;
+ if ( !(GetRecParam()->FitLEDEvents()) && GetRecParam()->GetEventSpecie()==AliRecoParam::kCalib) doFit = kFALSE;
+ if (doFit){
+ //must be done here because, in constructor, option is not yet known
+ fgRawUtils->SetOption(GetOption());
+
+ fgRawUtils->SetRawFormatHighLowGainFactor(GetRecParam()->GetHighLowGainFactor());
+ fgRawUtils->SetRawFormatOrder(GetRecParam()->GetOrderParameter());
+ fgRawUtils->SetRawFormatTau(GetRecParam()->GetTau());
+ fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold());
+ fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples());
+ fgRawUtils->SetRemoveBadChannels(GetRecParam()->GetRemoveBadChannels());
+ fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm());
+ fgRawUtils->SetFALTROUsage(GetRecParam()->UseFALTRO());
+ fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin());
+ fgRawUtils->SetTimeMax(GetRecParam()->GetTimeMax());
+
+ fgRawUtils->Raw2Digits(rawReader,digitsArr,fPedestalData,digitsTrg);
+ }
+ else{
+ AliDebug(1," Calibration Event, skip!");
+ printf("**** AliEMCALReconstructor::ConvertDigits() Calibration Event, skip!!\n");
+ }
+
digitsTree->Fill();
digitsArr->Delete();
digitsTrg->Delete();
// printf(" ## AliEMCALReconstructor::FillESD() is started ### \n ");
//return;
- //######################################################
- //#########Calculate trigger and set trigger info###########
- //######################################################
- // Obsolete, to be changed with new trigger emulator when consensus is achieved about what is stored in ESDs.
- AliEMCALTrigger tr;
- // tr.SetPatchSize(1); // create 4x4 patches
- tr.SetSimulation(kFALSE); // Reconstruction mode
- tr.SetDigitsList(fgDigitsArr);
- // Get VZERO total multiplicity for jet trigger simulation
- // The simulation of jey trigger will be incorrect if no VZERO data
- // at ESD
- AliESDVZERO* vZero = esd->GetVZEROData();
- if(vZero) {
- tr.SetVZER0Multiplicity(vZero->GetMTotV0A() + vZero->GetMTotV0C());
- }
- //
- tr.Trigger();
-
- Float_t maxAmp2x2 = tr.Get2x2MaxAmplitude();
- Float_t maxAmpnxn = tr.GetnxnMaxAmplitude();
- Float_t ampOutOfPatch2x2 = tr.Get2x2AmpOutOfPatch() ;
- Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ;
-
- Int_t iSM2x2 = tr.Get2x2SuperModule();
- Int_t iSMnxn = tr.GetnxnSuperModule();
- Int_t iModulePhi2x2 = tr.Get2x2ModulePhi();
- Int_t iModulePhinxn = tr.GetnxnModulePhi();
- Int_t iModuleEta2x2 = tr.Get2x2ModuleEta();
- Int_t iModuleEtanxn = tr.GetnxnModuleEta();
-
- AliDebug(2, Form("Trigger 2x2 max amp %f, out amp %f, SM %d, iphi %d ieta %d", maxAmp2x2, ampOutOfPatch2x2, iSM2x2,iModulePhi2x2, iModuleEta2x2));
- AliDebug(2, Form("Trigger 4x4 max amp %f , out amp %f, SM %d, iphi %d, ieta %d", maxAmpnxn, ampOutOfPatchnxn, iSMnxn,iModulePhinxn, iModuleEtanxn));
-
- TVector3 pos2x2(-1,-1,-1);
- TVector3 posnxn(-1,-1,-1);
-
- Int_t iAbsId2x2 = fGeom->GetAbsCellIdFromCellIndexes( iSM2x2, iModulePhi2x2, iModuleEta2x2) ; // should be changed to Module
- Int_t iAbsIdnxn = fGeom->GetAbsCellIdFromCellIndexes( iSMnxn, iModulePhinxn, iModuleEtanxn) ;
- fGeom->GetGlobal(iAbsId2x2, pos2x2);
- fGeom->GetGlobal(iAbsIdnxn, posnxn);
- //printf(" iAbsId2x2 %i iAbsIdnxn %i \n", iAbsId2x2, iAbsIdnxn);
-
- TArrayF triggerPosition(6);
- triggerPosition[0] = pos2x2(0) ;
- triggerPosition[1] = pos2x2(1) ;
- triggerPosition[2] = pos2x2(2) ;
- triggerPosition[3] = posnxn(0) ;
- triggerPosition[4] = posnxn(1) ;
- triggerPosition[5] = posnxn(2) ;
- //printf(" triggerPosition ");
- //for(int i=0; i<6; i++) printf(" %i %f : ", i, triggerPosition[i]);
-
- TArrayF triggerAmplitudes(4);
- triggerAmplitudes[0] = maxAmp2x2 ;
- triggerAmplitudes[1] = ampOutOfPatch2x2 ;
- triggerAmplitudes[2] = maxAmpnxn ;
- triggerAmplitudes[3] = ampOutOfPatchnxn ;
- //printf("\n triggerAmplitudes ");
- //for(int i=0; i<4; i++) printf(" %i %f : ", i, triggerAmplitudes[i]);
- //printf("\n");
- //tr.Print("");
- //
- // Trigger jet staff
- //
- if(tr.GetNJetThreshold()>0) {
- // Jet phi/eta
- Int_t n0 = triggerPosition.GetSize();
- const TH2F *hpatch = tr.GetJetMatrixE();
- triggerPosition.Set(n0 + 2);
- for(Int_t i=0; i<2; i++) triggerPosition[n0+i] = hpatch->GetMean(i+1);
- // Add jet ampitudes
- n0 = triggerAmplitudes.GetSize();
- triggerAmplitudes.Set(n0 + tr.GetNJetThreshold());
- Double_t *ampJet = tr.GetL1JetThresholds();
- for(Int_t i=0; i<tr.GetNJetThreshold(); i++){
- triggerAmplitudes[n0 + i] = Float_t(ampJet[i]);
- }
- }
- esd->AddEMCALTriggerPosition(triggerPosition);
- esd->AddEMCALTriggerAmplitudes(triggerAmplitudes);
- // Fill trigger hists
- AliEMCALHistoUtilities::FillTriggersListOfHists(fList,&triggerPosition,&triggerAmplitudes);
-
//########################################
//##############Fill CaloCells###############
//########################################
Float_t energy = 0;
for (Int_t idig = 0 ; idig < nDigits ; idig++) {
const AliEMCALDigit * dig = (const AliEMCALDigit*)digits->At(idig);
- if(dig->GetAmp() > 0 ){
- energy = (static_cast<AliEMCALClusterizerv1*> (fgClusterizer))->Calibrate(dig->GetAmp(),dig->GetId());
+ if(dig->GetAmplitude() > 0 ){
+ energy = (static_cast<AliEMCALClusterizerv1*> (fgClusterizer))->Calibrate(dig->GetAmplitude(),dig->GetTime(),dig->GetId()); //TimeR or Time?
if(energy > 0){ //Digits tagged as bad (dead, hot, not alive) are set to 0 in calibrate, remove them
emcCells.SetCell(idignew,dig->GetId(),energy, dig->GetTime());
idignew++;
//------------------------------------------------------------
//-----------------CLUSTERS-----------------------------
//------------------------------------------------------------
+ clustersTree->SetBranchStatus("*",0); //disable all branches
+ clustersTree->SetBranchStatus("EMCALECARP",1); //Enable only the branch we need
+
TObjArray *clusters = new TObjArray(100);
TBranch *branch = clustersTree->GetBranch("EMCALECARP");
branch->SetAddress(&clusters);
- clustersTree->GetEvent(0);
+ branch->GetEntry(0);
+ //clustersTree->GetEvent(0);
Int_t nClusters = clusters->GetEntries(), nClustersNew=0;
AliDebug(1,Form("%d clusters",nClusters));
//Store EMCAL matrixes in ESD Header
//Check, if matrixes was already stored
- for(Int_t sm = 0 ; sm < 12; sm++){
+ for(Int_t sm = 0 ; sm < fGeom->GetNumberOfSuperModules(); sm++){
if(esd->GetEMCALMatrix(sm)!=0)
return ;
}
//Note, that owner of copied marixes will be header
char path[255] ;
TGeoHMatrix * m = 0x0;
- for(Int_t sm = 0; sm < 12; sm++){
+ for(Int_t sm = 0; sm < fGeom->GetNumberOfSuperModules(); sm++){
sprintf(path,"/ALIC_1/XEN1_1/SMOD_%d",sm+1) ; //In Geometry modules numbered 1,2,.,5
if(sm >= 10) sprintf(path,"/ALIC_1/XEN1_1/SM10_%d",sm-10+1) ;
if (gGeoManager->CheckPath(path)){
+ gGeoManager->cd(path);
m = gGeoManager->GetCurrentMatrix() ;
+// printf("================================================= \n");
+// printf("AliEMCALReconstructor::FixMisalMatrixes(), sm %d, \n",sm);
+// m->Print("");
esd->SetEMCALMatrix(new TGeoHMatrix(*m),sm) ;
+// printf("================================================= \n");
}
else{
esd->SetEMCALMatrix(NULL,sm) ;