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;
ftVertexer(NULL),
fIsNewRunLoader(rec.fIsNewRunLoader),
fRunAliEVE(kFALSE),
- fChain(NULL)
+ fChain(NULL),
+ fNall(0),
+ fNspecie(0),
+ fSspecie(0),
+ fNhighPt(0),
+ fShighPt(0)
{
// copy constructor
fIsNewRunLoader = rec.fIsNewRunLoader;
fRunAliEVE = kFALSE;
fChain = NULL;
+ fNall = 0;
+ fNspecie = 0;
+ fSspecie = 0;
+ fNhighPt = 0;
+ fShighPt = 0;
return *this;
}
if (fStopOnError) {CleanUp(); return kFALSE;}
}
}
-
+
+ // AdC+FN
+ if (fReconstructor[3])
+ GetReconstructor(3)->FillEventTimeWithTOF(fesd,&pid);
+
// combined PID
pid.MakePID(fesd);
if (fRunV0Finder) {
// V0 finding
AliV0vertexer vtxer;
+ // get cuts for V0vertexer from AliGRPRecoParam
+ if (grpRecoParam) {
+ Int_t nCutsV0vertexer = grpRecoParam->GetVertexerV0NCuts();
+ Double_t *cutsV0vertexer = new Double_t[nCutsV0vertexer];
+ grpRecoParam->GetVertexerV0Cuts(cutsV0vertexer);
+ vtxer.SetCuts(cutsV0vertexer);
+ delete [] cutsV0vertexer; cutsV0vertexer = NULL;
+ }
vtxer.Tracks2V0vertices(fesd);
if (fRunCascadeFinder) {
// Cascade finding
AliCascadeVertexer cvtxer;
+ // get cuts for CascadeVertexer from AliGRPRecoParam
+ if (grpRecoParam) {
+ Int_t nCutsCascadeVertexer = grpRecoParam->GetVertexerCascadeNCuts();
+ Double_t *cutsCascadeVertexer = new Double_t[nCutsCascadeVertexer];
+ grpRecoParam->GetVertexerCascadeCuts(cutsCascadeVertexer);
+ cvtxer.SetCuts(cutsCascadeVertexer);
+ delete [] cutsCascadeVertexer; cutsCascadeVertexer = NULL;
+ }
cvtxer.V0sTracks2CascadeVertices(fesd);
}
}
ftree->Fill();
if (fWriteESDfriend) {
- // Sampling
- Double_t rnd = gRandom->Rndm();
- if (fFractionFriends < rnd) {
- fesdf->~AliESDfriend();
- new (fesdf) AliESDfriend(); // Reset...
- fesdf->SetSkipBit(kTRUE);
- }
-
- ftreeF->Fill();
+ WriteESDfriend();
}
// Auto-save the ESD tree in case of prompt reco @P2
if (fRawReader && fRawReader->UseAutoSaveESD()) {
ftree->AutoSave("SaveSelf");
if (fWriteESDfriend) ftreeF->AutoSave("SaveSelf");
- TFile *friendfile = (TFile *)(gROOT->GetListOfFiles()->FindObject("AliESDfriends.root"));
- if (friendfile) friendfile->Save();
}
// write HLT ESD
// The return flag shows whenever the
// AliEVE initialization was successful or not.
- TString macroPath;
- macroPath.Form(".:%s:%s/EVE/macros/",
- gROOT->GetMacroPath(),
- gSystem->ExpandPathName("$ALICE_ROOT"));
- gROOT->SetMacroPath(macroPath.Data());
+ TString macroStr(gSystem->Getenv("ALIEVE_ONLINE_MACRO"));
+
+ if (macroStr.IsNull())
+ macroStr.Form("%s/EVE/macros/alieve_online.C",gSystem->ExpandPathName("$ALICE_ROOT"));
+
+ AliInfo(Form("Loading AliEVE macro: %s",macroStr.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());};");
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; itrk<ntrk; ++itrk) {
+
+ AliESDtrack * trk = fesd->GetTrack(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 (rnd<fFractionFriends) {
+ isSelected = kTRUE;
+ fSspecie++;
+ }
+ }
+
+ Double_t remainingFraction = fFractionFriends;
+ remainingFraction -= ((Double_t)(fSspecie)/(Double_t)(fNall));
+
+ if (IsHighPt()) { // Selection of "high Pt" events
+ fNhighPt++;
+ Double_t curentHighPtFraction = ((Double_t)(fNhighPt+1))/((Double_t)(fNall+1));
+ // "Bayesian" estimate supposing that without events all the events are of the required type
+
+ if (!isSelected) {
+ Double_t rnd = gRandom->Rndm()*curentHighPtFraction;
+ if (rnd<remainingFraction) {
+ isSelected = kTRUE;
+ fShighPt++;
+ }
+ }
+ }
+ remainingFraction -= ((Double_t)(fShighPt)/(Double_t)(fNall));
+
+ // Random selection to fill the remaining fraction (if any)
+ if (!isSelected) {
+ Double_t rnd = gRandom->Rndm();
+ if (rnd<remainingFraction) {
+ isSelected = kTRUE;
+ }
+ }
+
+ if (!isSelected) {
+ fesdf->~AliESDfriend();
+ new (fesdf) AliESDfriend(); // Reset...
+ fesdf->SetSkipBit(kTRUE);
+ }
+
+ ftreeF->Fill();
+}