X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliReconstruction.cxx;h=f51e4b9d102ffa1fade34aa691c1cd2e631d0cfe;hb=d8aa7e17cf922c4a46c7cb64d1d47b2e194f63c6;hp=dd068e2e369e98a9cdc9df2ec2978d3ca63ded52;hpb=3c99b88f60245aaae962ae615b9b655f774aa287;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index dd068e2e369..f51e4b9d102 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -130,6 +130,7 @@ #include #include #include +#include #include "AliAlignObj.h" #include "AliCDBEntry.h" @@ -189,11 +190,13 @@ #include "AliTriggerConfiguration.h" #include "AliV0vertexer.h" #include "AliVertexer.h" +#include "AliTrackleter.h" #include "AliVertexerTracks.h" #include "AliTriggerRunScalers.h" #include "AliCTPTimeParams.h" #include "AliESDHLTDecision.h" #include "AliTriggerInput.h" +#include "AliLHCData.h" ClassImp(AliReconstruction) //_____________________________________________________________________________ @@ -208,6 +211,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fRunMuonTracking(kFALSE), fRunV0Finder(kTRUE), fRunCascadeFinder(kTRUE), + fRunMultFinder(kTRUE), fStopOnError(kTRUE), fWriteAlignmentData(kFALSE), fWriteESDfriend(kFALSE), @@ -235,6 +239,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fFirstEvent(0), fLastEvent(-1), fNumberOfEventsPerFile((UInt_t)-1), + fFractionFriends(0.04), fOptions(), fLoadAlignFromCDB(kTRUE), fLoadAlignData("ALL"), @@ -243,6 +248,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fEventInfo(), fRunScalers(NULL), fCTPTimeParams(NULL), + fCTPTimeAlign(NULL), fRunLoader(NULL), fRawReader(NULL), @@ -285,7 +291,12 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : ftVertexer(NULL), fIsNewRunLoader(kFALSE), fRunAliEVE(kFALSE), - fChain(NULL) + fChain(NULL), + fNall(0), + fNspecie(0), + fSspecie(0), + fNhighPt(0), + fShighPt(0) { // create reconstruction object with default parameters gGeoManager = NULL; @@ -299,7 +310,8 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fQACycles[iDet] = 999999 ; fQAWriteExpert[iDet] = kFALSE ; } - + fBeamInt[0][0]=fBeamInt[0][1]=fBeamInt[1][0]=fBeamInt[1][1] = -1; + AliPID pid; } @@ -312,6 +324,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fRunMuonTracking(rec.fRunMuonTracking), fRunV0Finder(rec.fRunV0Finder), fRunCascadeFinder(rec.fRunCascadeFinder), + fRunMultFinder(rec.fRunMultFinder), fStopOnError(rec.fStopOnError), fWriteAlignmentData(rec.fWriteAlignmentData), fWriteESDfriend(rec.fWriteESDfriend), @@ -339,6 +352,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fFirstEvent(rec.fFirstEvent), fLastEvent(rec.fLastEvent), fNumberOfEventsPerFile(rec.fNumberOfEventsPerFile), + fFractionFriends(rec.fFractionFriends), fOptions(), fLoadAlignFromCDB(rec.fLoadAlignFromCDB), fLoadAlignData(rec.fLoadAlignData), @@ -347,6 +361,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fEventInfo(), fRunScalers(NULL), fCTPTimeParams(NULL), + fCTPTimeAlign(NULL), fRunLoader(NULL), fRawReader(NULL), @@ -389,7 +404,12 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : ftVertexer(NULL), fIsNewRunLoader(rec.fIsNewRunLoader), fRunAliEVE(kFALSE), - fChain(NULL) + fChain(NULL), + fNall(0), + fNspecie(0), + fSspecie(0), + fNhighPt(0), + fShighPt(0) { // copy constructor @@ -410,6 +430,9 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) { if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone()); } + + for (int i=2;i--;) for (int j=2;j--;) fBeamInt[i][j] = rec.fBeamInt[i][j]; + } //_____________________________________________________________________________ @@ -430,6 +453,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fRunMuonTracking = rec.fRunMuonTracking; fRunV0Finder = rec.fRunV0Finder; fRunCascadeFinder = rec.fRunCascadeFinder; + fRunMultFinder = rec.fRunMultFinder; fStopOnError = rec.fStopOnError; fWriteAlignmentData = rec.fWriteAlignmentData; fWriteESDfriend = rec.fWriteESDfriend; @@ -457,6 +481,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fFirstEvent = rec.fFirstEvent; fLastEvent = rec.fLastEvent; fNumberOfEventsPerFile = rec.fNumberOfEventsPerFile; + fFractionFriends = rec.fFractionFriends; for (Int_t i = 0; i < rec.fOptions.GetEntriesFast(); i++) { if (rec.fOptions[i]) fOptions.Add(rec.fOptions[i]->Clone()); @@ -476,6 +501,8 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) delete fCTPTimeParams; fCTPTimeParams = NULL; if (rec.fCTPTimeParams) fCTPTimeParams = new AliCTPTimeParams(*rec.fCTPTimeParams); + delete fCTPTimeAlign; fCTPTimeAlign = NULL; + if (rec.fCTPTimeAlign) fCTPTimeAlign = new AliCTPTimeParams(*rec.fCTPTimeAlign); fRunLoader = NULL; fRawReader = NULL; @@ -525,7 +552,7 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fInitQACalled = rec.fInitQACalled; fWriteQAExpertData = rec.fWriteQAExpertData; fRunPlaneEff = rec.fRunPlaneEff; - + for (int i=2;i--;) for (int j=2;j--;) fBeamInt[i][j] = rec.fBeamInt[i][j]; fesd = NULL; fhltesd = NULL; fesdf = NULL; @@ -538,6 +565,11 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fIsNewRunLoader = rec.fIsNewRunLoader; fRunAliEVE = kFALSE; fChain = NULL; + fNall = 0; + fNspecie = 0; + fSspecie = 0; + fNhighPt = 0; + fShighPt = 0; return *this; } @@ -555,6 +587,7 @@ AliReconstruction::~AliReconstruction() delete fGRPData; delete fRunScalers; delete fCTPTimeParams; + delete fCTPTimeAlign; fOptions.Delete(); if (fAlignObjArray) { fAlignObjArray->Delete(); @@ -1027,8 +1060,9 @@ Bool_t AliReconstruction::InitGRP() { !((detMask >> AliDAQ::DetectorID("ITSSDD")) & 0x1) && !((detMask >> AliDAQ::DetectorID("ITSSSD")) & 0x1) ) { // switch off the vertexer - AliInfo("SPD,SDD,SSD is not in the list of active detectors. Vertexer switched off."); + AliInfo("SPD,SDD,SSD is not in the list of active detectors. Vertexer and Trackleter are switched off."); fRunVertexFinder = kFALSE; + fRunMultFinder = kFALSE; } if (!((detMask >> AliDAQ::DetectorID("TRG")) & 0x1)) { // switch off the reading of CTP raw-data payload @@ -1152,6 +1186,8 @@ Bool_t AliReconstruction::LoadCDB() AliCDBManager::Instance()->Get("GRP/CTP/Config"); + AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase"); + TString detStr = fLoadCDB; for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (!IsSelected(fgkDetectorName[iDet], detStr)) continue; @@ -1193,17 +1229,44 @@ Bool_t AliReconstruction::LoadCTPTimeParamsCDB() // from OCDB. AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming"); + if (!entry) return kFALSE; - if (entry) { + AliInfo("Found an AliCTPTimeParams in GRP/CTP/CTPtiming, reading it"); + fCTPTimeParams = dynamic_cast (entry->GetObject()); + entry->SetOwner(0); - AliInfo("Found an AliCTPTimeParams in GRP/CTP/CTPtiming, reading it"); - fCTPTimeParams = dynamic_cast (entry->GetObject()); - entry->SetOwner(0); - return kTRUE; + AliCDBEntry* entry2 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign"); + if (!entry2) return kFALSE; + + AliInfo("Found an AliCTPTimeParams in GRP/CTP/TimeAlign, reading it"); + fCTPTimeAlign = dynamic_cast (entry2->GetObject()); + entry2->SetOwner(0); + + return kTRUE; +} + +//_____________________________________________________________________________ +Bool_t AliReconstruction::ReadIntensityInfoCDB() +{ + // Load LHC DIP data + AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/LHCData"); + + if (entry) { + AliInfo("Found an AliLHCData in GRP/GRP/LHCData, reading it"); + AliLHCData* dipData = dynamic_cast (entry->GetObject()); + for (int ib=2;ib--;) { + double intI,intNI; + if (dipData->GetMeanIntensity(ib,intI,intNI)>=0) { + fBeamInt[ib][0] = intI; + fBeamInt[ib][1] = intNI; + } + } + return kTRUE; } - - return kFALSE; + return kFALSE; } + + //_____________________________________________________________________________ Bool_t AliReconstruction::Run(const char* input) { @@ -1392,6 +1455,12 @@ void AliReconstruction::Begin(TTree *) } AliSysInfo::AddStamp("LoadCTPTimeParamsCDB"); + if (!ReadIntensityInfoCDB()) { + Abort("ReadIntensityInfoCDB", TSelector::kAbortProcess); + return; + } + AliSysInfo::AddStamp("ReadIntensityInfoCDB"); + // Read the reconstruction parameters from OCDB if (!InitRecoParams()) { AliWarning("Not all detectors have correct RecoParam objects initialized"); @@ -1560,7 +1629,7 @@ void AliReconstruction::SlaveBegin(TTree*) ProcInfo_t procInfo; gSystem->GetProcInfo(&procInfo); - AliInfo(Form("Current memory usage %d %d", procInfo.fMemResident, procInfo.fMemVirtual)); + AliInfo(Form("Current memory usage %ld %ld", procInfo.fMemResident, procInfo.fMemVirtual)); //QA //Initialize the QA and start of cycle @@ -1729,8 +1798,16 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) fesd->SetMagneticField(AliTracker::GetBz()); fhltesd->SetMagneticField(AliTracker::GetBz()); // - ((AliESDRun*)fesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV(); - ((AliESDRun*)fhltesd->GetESDRun())->SetBeamEnergyIsSqrtSHalfGeV(); + AliESDRun *esdRun,*esdRunH; + esdRun = (AliESDRun*)fesd->GetESDRun(); + esdRunH = (AliESDRun*)fhltesd->GetESDRun(); + esdRun->SetBeamEnergyIsSqrtSHalfGeV(); + esdRunH->SetBeamEnergyIsSqrtSHalfGeV(); + // + for (int ib=2;ib--;) for (int it=2;it--;) { + esdRun->SetMeanIntensity(ib,it, fBeamInt[ib][it]); + esdRunH->SetMeanIntensity(ib,it, fBeamInt[ib][it]); + } // AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField(); if (fld) { // set info needed for field initialization @@ -1965,9 +2042,19 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) cvtxer.V0sTracks2CascadeVertices(fesd); } } - + // write ESD if (fCleanESD) CleanESD(fesd); + // + // RS run updated trackleter: since we want to mark the clusters used by tracks and also mark the + // tracks interpreted as primary, this step should be done in the very end, when full + // ESD info is available (particulalry, V0s) + // vertex finder + if (fRunMultFinder) { + if (!RunMultFinder(fesd)) { + if (fStopOnError) {CleanUp(); return kFALSE;} + } + } if (fRunQA && IsInTasks(AliQAv1::kESDS)) { AliQAManager::QAManager()->SetEventSpecie(fRecoParam.GetEventSpecie()) ; @@ -1993,7 +2080,9 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) fesd->GetESDfriend(fesdf); ftree->Fill(); - if (fWriteESDfriend) ftreeF->Fill(); + if (fWriteESDfriend) { + WriteESDfriend(); + } // Auto-save the ESD tree in case of prompt reco @P2 if (fRawReader && fRawReader->UseAutoSaveESD()) { @@ -2023,7 +2112,7 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) aveDMres+=(dMres-aveDMres)/(iEvent-fFirstEvent+1); aveDMvir+=(dMvir-aveDMvir)/(iEvent-fFirstEvent+1); aveDCPU+=(dCPU-aveDCPU)/(iEvent-fFirstEvent+1); - AliInfo(Form("======================= End Event %d: Res %d(%3d <%3d>) Vir %d(%3d <%3d>) CPU %5.2f <%5.2f> ===================", + AliInfo(Form("======================= End Event %d: Res %ld(%3ld <%3ld>) Vir %ld(%3ld <%3ld>) CPU %5.2f <%5.2f> ===================", iEvent, procInfo.fMemResident/1024, dMres, aveDMres, procInfo.fMemVirtual/1024, dMvir, aveDMvir, dCPU, aveDCPU)); oldMres=procInfo.fMemResident; oldMvir=procInfo.fMemVirtual; @@ -2356,10 +2445,11 @@ Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) if(novertices>1){ for (Int_t kk=1; kkAddPileupVertexSPD(&vpileup[kk]); } + /* // if SPD multiplicity has been determined, it is stored in the ESD AliMultiplicity *mult = vertexer->GetMultiplicity(); if(mult)esd->SetMultiplicity(mult); - + */ for (Int_t iDet = 0; iDet < kNDetectors; iDet++) { if (fTracker[iDet]) fTracker[iDet]->SetVertex(vtxPos, vtxErr); } @@ -2370,6 +2460,40 @@ Bool_t AliReconstruction::RunVertexFinder(AliESDEvent*& esd) return kTRUE; } +//_____________________________________________________________________________ +Bool_t AliReconstruction::RunMultFinder(AliESDEvent*& esd) +{ + // run the trackleter for multiplicity study + + AliCodeTimerAuto("",0) + + AliTrackleter *trackleter = CreateMultFinder(); + if (!trackleter) return kFALSE; + + AliInfo(Form("running the ITS multiplicity finder: %s",trackleter->ClassName())); + + if (fLoader[0]) { + fLoader[0]->LoadRecPoints(); + TTree* cltree = fLoader[0]->TreeR(); + if (cltree) { + trackleter->Reconstruct(esd,cltree); + AliMultiplicity *mult = trackleter->GetMultiplicity(); + if(mult) esd->SetMultiplicity(mult); + } + else { + AliError("Can't get the ITS cluster tree"); + } + fLoader[0]->UnloadRecPoints(); + } + else { + AliError("Can't get the ITS loader"); + } + + delete trackleter; + + return kTRUE; +} + //_____________________________________________________________________________ Bool_t AliReconstruction::RunHLTTracking(AliESDEvent*& esd) { @@ -3001,7 +3125,8 @@ AliVertexer* AliReconstruction::CreateVertexer() AliVertexer* vertexer = NULL; AliReconstructor* itsReconstructor = GetReconstructor(0); - if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || fRunTracking.Contains("ITS"))) { + if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || + fRunTracking.Contains("ITS") || fFillESD.Contains("ITS") )) { vertexer = itsReconstructor->CreateVertexer(); } if (!vertexer) { @@ -3011,6 +3136,27 @@ AliVertexer* AliReconstruction::CreateVertexer() return vertexer; } +//_____________________________________________________________________________ +AliTrackleter* AliReconstruction::CreateMultFinder() +{ +// create the ITS trackleter for mult. estimation +// Please note that the caller is the owner of the +// trackleter + + AliTrackleter* trackleter = NULL; + AliReconstructor* itsReconstructor = GetReconstructor(0); + if (itsReconstructor && ((fRunLocalReconstruction.Contains("ITS")) || + fRunTracking.Contains("ITS") || fFillESD.Contains("ITS") )) { + trackleter = itsReconstructor->CreateMultFinder(); + } + else { + AliWarning("ITS is not in reconstruction, switching off RunMultFinder"); + fRunMultFinder = kFALSE; + } + + return trackleter; +} + //_____________________________________________________________________________ Bool_t AliReconstruction::CreateTrackers(const TString& detectors) { @@ -3032,7 +3178,6 @@ Bool_t AliReconstruction::CreateTrackers(const TString& detectors) continue; } - fTracker[iDet] = reconstructor->CreateTracker(); if (!fTracker[iDet] && (iDet < 7)) { AliWarning(Form("couldn't create a tracker for %s", detName.Data())); @@ -3302,9 +3447,15 @@ Bool_t AliReconstruction::InitAliEVE() // The return flag shows whenever the // AliEVE initialization was successful or not. - TString macroStr; - macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT")); - AliInfo(Form("Loading AliEVE macro: %s",macroStr.Data())); + TString macroPath; + macroPath.Form(".:%s:%s/EVE/macros/", + gROOT->GetMacroPath(), + gSystem->ExpandPathName("$ALICE_ROOT")); + gROOT->SetMacroPath(macroPath.Data()); + + TString macroStr("alieve_online.C"); + AliInfo(Form("Loading AliEVE macro: %s (%s)",macroStr.Data(), + gSystem->Which(gROOT->GetMacroPath(), macroStr.Data()))); if (gROOT->LoadMacro(macroStr.Data()) != 0) return kFALSE; gROOT->ProcessLine("if (!AliEveEventManager::GetMaster()){new AliEveEventManager();AliEveEventManager::GetMaster()->AddNewEventCommand(\"alieve_online_on_new_event()\");gEve->AddEvent(AliEveEventManager::GetMaster());};"); @@ -3322,7 +3473,7 @@ void AliReconstruction::RunAliEVE() // successful initialization of AliEVE. AliInfo("Running AliEVE..."); - gROOT->ProcessLine(Form("AliEveEventManager::GetMaster()->SetEvent((AliRunLoader*)0x%lx,(AliRawReader*)0x%lx,(AliESDEvent*)0x%lx,(AliESDfriend*)0x%lx);",fRunLoader,fRawReader,fesd,fesdf)); + gROOT->ProcessLine(Form("AliEveEventManager::GetMaster()->SetEvent((AliRunLoader*)%p,(AliRawReader*)%p,(AliESDEvent*)%p,(AliESDfriend*)%p);",fRunLoader,fRawReader,fesd,fesdf)); gSystem->Run(); } @@ -3734,3 +3885,115 @@ Bool_t AliReconstruction::ParseOutput() return kTRUE; } + +//______________________________________________________________________________ +Bool_t AliReconstruction::IsHighPt() const { + // Selection of events containing "high" pT tracks + // If at least one track is found within 1.5 and 100 GeV (pT) + // that was reconstructed by both ITS and TPC, the event is accepted + + // Track cuts + + const Double_t pTmin = 1.5; + const Double_t pTmax = 100; + ULong_t mask = 0; + mask |= (AliESDtrack::kITSrefit); + mask |= (AliESDtrack::kTPCrefit); + + Bool_t isOK = kFALSE; + + if (fesd && fesd->GetEventType()==AliRawEventHeaderBase::kPhysicsEvent) { + // Check if this ia a physics event (code 7) + Int_t ntrk = fesd->GetNumberOfTracks(); + for (Int_t itrk=0; itrkGetTrack(itrk); + if (trk + && trk->Pt() > pTmin + && trk->Pt() < pTmax + && (trk->GetStatus() & mask) == mask ) { + + isOK = kTRUE; + break; + } + } + } + return isOK; +} + +//______________________________________________________________________________ +Bool_t AliReconstruction::IsCosmicOrCalibSpecie() const { + // Select cosmic or calibration events + + Bool_t isOK = kFALSE; + + if (fesd && fesd->GetEventType()==AliRawEventHeaderBase::kPhysicsEvent) { + // Check if this ia a physics event (code 7) + + UInt_t specie = fesd->GetEventSpecie(); + if (specie==AliRecoParam::kCosmic || specie==AliRecoParam::kCalib) { + isOK = kTRUE; + } + } + return isOK; +} + +//______________________________________________________________________________ +void AliReconstruction::WriteESDfriend() { + // Fill the ESD friend in the tree. The required fraction of ESD friends is stored + // in fFractionFriends. We select events where we store the ESD friends according + // to the following algorithm: + // 1. Store all Cosmic or Calibration events within the required fraction + // 2. Sample "high Pt" events within the remaining fraction after step 1. + // 3. Sample randomly events if we still have remaining slot + + fNall++; + + Bool_t isSelected = kFALSE; + + if (IsCosmicOrCalibSpecie()) { // Selection of calib or cosmic events + fNspecie++; + Double_t curentSpecieFraction = ((Double_t)(fNspecie+1))/((Double_t)(fNall+1)); + // "Bayesian" estimate supposing that without events all the events are of the required type + + Double_t rnd = gRandom->Rndm()*curentSpecieFraction; + if (rndRndm()*curentHighPtFraction; + if (rndRndm(); + if (rnd~AliESDfriend(); + new (fesdf) AliESDfriend(); // Reset... + fesdf->SetSkipBit(kTRUE); + } + + ftreeF->Fill(); +}