fAxes(kMaxCuts),
fMixType(kOSonly),
fMixIncomplete(kTRUE),
- fMoveToSameVertex(kFALSE)
+ fMoveToSameVertex(kFALSE),
+ fSkipFirstEvt(kFALSE),
+ fPID(0x0)
{
//
// Default Constructor
fAxes(kMaxCuts),
fMixType(kOSonly),
fMixIncomplete(kTRUE),
- fMoveToSameVertex(kFALSE)
+ fMoveToSameVertex(kFALSE),
+ fSkipFirstEvt(kFALSE),
+ fPID(0x0)
{
//
// Named Constructor
// Default Destructor
//
fAxes.Delete();
+ delete fPID;
}
//________________________________________________________________
//check if there are tracks available
if (diele->GetTrackArray(0)->GetEntriesFast()==0 && diele->GetTrackArray(1)->GetEntriesFast()==0) return;
-
- //find mixing bin
- Double_t values[AliDielectronVarManager::kNMaxValues]={0.};
- AliDielectronVarManager::Fill(ev,values);
TString dim;
- Int_t bin=FindBin(values,&dim);
+ Int_t bin=FindBin(AliDielectronVarManager::GetData(),&dim);
//add mixing bin to event data
- values[AliDielectronVarManager::kMixingBin] = bin;
+ AliDielectronVarManager::SetValue(AliDielectronVarManager::kMixingBin,bin);
if (bin<0){
AliDebug(5,Form("Bin outside range: %s",dim.Data()));
AliDebug(10,Form("new event at %d: %d",bin,pool.GetEntriesFast()));
AliDielectronEvent *event=new(pool[pool.GetEntriesFast()]) AliDielectronEvent();
+ if(ev->IsA() == AliAODEvent::Class()) event->SetAOD();
+ else event->SetESD();
+ event->SetProcessID(fPID);
event->SetTracks(*diele->GetTrackArray(0), *diele->GetTrackArray(1), *diele->GetPairArray(1));
- event->SetEventData(values);
-
+ event->SetEventData(AliDielectronVarManager::GetData());
+
// check if pool depth is reached.
if (pool.GetEntriesFast()<fDepth) return;
//
// perform the mixing
//
-
+
//buffer track arrays and copy them back afterwards
TObjArray arrTrDummy[4];
for (Int_t i=0; i<4; ++i) arrTrDummy[i]=diele->fTracks[i];
for (Int_t i=AliDielectronVarManager::kPairMax; i<AliDielectronVarManager::kNMaxValues; ++i)
values[i]=AliDielectronVarManager::GetValue((AliDielectronVarManager::ValueTypes)i);
- for (Int_t i1=0; i1<pool.GetEntriesFast(); ++i1){
+
+ // use event data from the first event
+ // all events are in the same mixing bin anyhow...
+ // optionally use only the event data from the first event and no tracks of it,
+ // by this you should get ride of event plane - leg correlations in the mixing
+ // but you loose the 1st event in the mixing statistics
+ AliDielectronEvent *ev0=static_cast<AliDielectronEvent*>(pool.At(0));
+ AliDielectronVarManager::SetEventData(ev0->GetEventData());
+ Int_t firstEvt=(fSkipFirstEvt ? 1 : 0);
+
+ for (Int_t i1=firstEvt; i1<pool.GetEntriesFast(); ++i1){
AliDielectronEvent *ev1=static_cast<AliDielectronEvent*>(pool.At(i1));
//use event data from the first event
//both events are in the same mixing bin anyhow...
- AliDielectronVarManager::SetEventData(ev1->GetEventData());
+ if( !fSkipFirstEvt ) AliDielectronVarManager::SetEventData(ev1->GetEventData());
TObject *o=0x0;
TIter ev1P(ev1->GetTrackArrayP());
//setup track arrays
AliDielectronEvent *ev2=static_cast<AliDielectronEvent*>(pool.At(i2));
-
ev1P.Reset();
ev1N.Reset();
TIter ev2P(ev2->GetTrackArrayP());
ev2P.Reset();
ev2N.Reset();
}
-
+
//mixing of ev1- ev2+ (pair type4). This is common for all mixing types
- while ( (o=ev1N()) ) diele->fTracks[1].Add(o);
+ while ( (o=ev1N()) ) diele->fTracks[1].Add(o);
while ( (o=ev2P()) ) diele->fTracks[2].Add(o);
diele->FillPairArrays(1,2);
while ( (o=ev2N()) ) diele->fTracks[2].Add(o);
diele->FillPairArrays(1,2);
}
+
}
}
//Check if there was any processed data and it is requested to mix incomplete bins
if (!diele || !diele->PairArray(0) || !fMixIncomplete ) return;
-
+ AliDielectronVarManager::SetEvent(0x0);
for (Int_t ipool=0; ipool<fArrPools.GetSize(); ++ipool){
TClonesArray *poolp=static_cast<TClonesArray*>(fArrPools.At(ipool));
if (!poolp || !poolp->GetEntriesFast() || !poolp->At(0)) continue;
values+=Form("%.2f, ",(*bins)[irow]);
}
}
+
+ if (!fPID){
+ fPID=TProcessID::AddProcessID();
+ }
AliDebug(10,values.Data());
}
Int_t pos=TMath::BinarySearch(nRows,bins->GetMatrixArray(),val);
bin+=sizeAdd*pos;
- if (dim) (*dim)+=Form("%s: %f; ",AliDielectronVarManager::GetValueName(fEventCuts[i]),val);
- sizeAdd*=nRows;
+ if (dim) (*dim)+=Form("%s: %f (%d); ",AliDielectronVarManager::GetValueName(fEventCuts[i]),val,pos);
+ sizeAdd*=(nRows-1);
}
return bin;
//translation
Double_t vt[3] = {vMix[0]-vFirst[0],vMix[1]-vFirst[1],vMix[2]-vFirst[2]};
//rotate to the track frame
- track->Global2LocalPosition(vt,track->GetAlpha());
+// track->Global2LocalPosition(vt,track->GetAlpha());
//add to track position
- x = x -vt[0];
- param[0] = param[0]-vt[1];
+// x = x -vt[0];
+// param[0] = param[0]-vt[1];
+// param[1] = param[1]-vt[2];
param[1] = param[1]-vt[2];
//set updated track information