TString AsString(const AliMpArea& area)
{
return Form("(X,Y)=(%7.3f,%7.3f) (DX,DY)=(%7.3f,%7.3f)",
- area.Position().X(),
- area.Position().Y(),
- area.Dimensions().Y(),
- area.Dimensions().Y());
+ area.GetPositionX(),
+ area.GetPositionY(),
+ area.GetDimensionX(), /// TBCL was Y !!!
+ area.GetDimensionY());
}
}
//_____________________________________________________________________________
AliMUONSimpleClusterServer::AliMUONSimpleClusterServer(AliMUONVClusterFinder* clusterFinder,
const AliMUONGeometryTransformer& transformer)
-: AliMUONVClusterServer(),
+: AliMUONVClusterServer(),
+ fDigitStore(0x0),
fClusterFinder(clusterFinder),
fkTransformer(transformer),
fPads(),
if ( ok )
{
- if ( fClusterFinder->NeedSegmentation() )
- {
- const AliMpVSegmentation* seg[2] =
+ const AliMpVSegmentation* seg[2] =
{ AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0),
AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath1)
};
+ if ( fClusterFinder->NeedSegmentation() )
+ {
fClusterFinder->Prepare(detElemId,pads,deArea,seg);
}
else
rawCluster->SetXYZ(xg, yg, zg);
rawCluster->SetErrXY(recoParam->GetDefaultNonBendingReso(chamberId),recoParam->GetDefaultBendingReso(chamberId));
- AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e)",
+ // Set MC label
+ if (fDigitStore && fDigitStore->HasMCInformation())
+ {
+ rawCluster->SetMCLabel(FindMCLabel(*cluster, detElemId, seg));
+ }
+
+ AliDebug(1,Form("Adding RawCluster detElemId %4d mult %2d charge %e (xl,yl,zl)=(%e,%e,%e) (xg,yg,zg)=(%e,%e,%e) label %d",
detElemId,rawCluster->GetNDigits(),rawCluster->GetCharge(),
cluster->Position().X(),cluster->Position().Y(),0.0,
- xg,yg,zg));
+ xg,yg,zg,rawCluster->GetMCLabel()));
}
}
}
}
AliDebug(1,Form("chamberId = %2d NofClusters after = %d",chamberId,fNCluster));
-
+
return nofAddedClusters;
}
Double_t zg = AliMUONConstants::DefaultChamberZ(AliMpDEManager::GetChamberId(detElemId));
fkTransformer.Global2Local(detElemId,
- globalArea.Position().X(),globalArea.Position().Y(),zg,
+ globalArea.GetPositionX(),globalArea.GetPositionY(),zg,
xl,yl,zl);
- localArea = AliMpArea(TVector2(xl,yl), globalArea.Dimensions());
+ localArea = AliMpArea(xl,yl, globalArea.GetDimensionX(), globalArea.GetDimensionY());
}
//_____________________________________________________________________________
//_____________________________________________________________________________
void
-AliMUONSimpleClusterServer::UseDigits(TIter& next)
+AliMUONSimpleClusterServer::UseDigits(TIter& next, AliMUONVDigitStore* digitStore)
{
/// Convert digitStore into two arrays of AliMUONPads
-
+
+ fDigitStore = digitStore;
+
fPads[0]->Clear();
fPads[1]->Clear();
Int_t detElemId = d->DetElemId();
const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->
GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode));
- AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy));
+ AliMpPad pad = seg->PadByIndices(ix,iy);
TClonesArray* padArray = PadArray(detElemId,cathode);
if (!padArray)
}
AliMUONPad mpad(detElemId,cathode,
- ix,iy,pad.Position().X(),pad.Position().Y(),
- pad.Dimensions().X(),pad.Dimensions().Y(),
+ ix,iy,pad.GetPositionX(),pad.GetPositionY(),
+ pad.GetDimensionX(),pad.GetDimensionY(),
d->Charge());
if ( d->IsSaturated() ) mpad.SetSaturated(kTRUE);
mpad.SetUniqueID(d->GetUniqueID());
}
}
+//_____________________________________________________________________________
+Int_t
+AliMUONSimpleClusterServer::FindMCLabel(const AliMUONCluster& cluster, Int_t detElemId, const AliMpVSegmentation* seg[2]) const
+{
+ /// Find the label of the most contributing MC track (-1 in case of failure)
+ /// The data member fDigitStore must be set
+
+ // --- get the digit (if any) located at the cluster position on both cathods ---
+ Int_t nTracks[2] = {0, 0};
+ AliMUONVDigit* digit[2] = {0x0, 0x0};
+ for (Int_t iCath = 0; iCath < 2; iCath++) {
+ AliMpPad pad
+ = seg[AliMp::GetCathodType(iCath)]->PadByPosition(cluster.Position().X(), cluster.Position().Y(),kFALSE);
+ if (pad.IsValid()) {
+ digit[iCath] = fDigitStore->FindObject(detElemId, pad.GetManuId(), pad.GetManuChannel(), iCath);
+ if (digit[iCath]) nTracks[iCath] = digit[iCath]->Ntracks();
+ }
+ }
+
+ if (nTracks[0] + nTracks[1] == 0) return -1;
+
+ // --- build the list of contributing tracks and of the associated charge ---
+ Int_t* trackId = new Int_t[nTracks[0] + nTracks[1]];
+ Float_t* trackCharge = new Float_t[nTracks[0] + nTracks[1]];
+ Int_t nTracksTot = 0;
+
+ // fill with contributing tracks on first cathod
+ for (Int_t iTrack1 = 0; iTrack1 < nTracks[0]; iTrack1++) {
+ trackId[iTrack1] = digit[0]->Track(iTrack1);
+ trackCharge[iTrack1] = digit[0]->TrackCharge(iTrack1);
+ }
+ nTracksTot = nTracks[0];
+
+ // complement with contributing tracks on second cathod
+ for (Int_t iTrack2 = 0; iTrack2 < nTracks[1]; iTrack2++) {
+ Int_t trackId2 = digit[1]->Track(iTrack2);
+ // check if track exist
+ Bool_t trackExist = kFALSE;
+ for (Int_t iTrack1 = 0; iTrack1 < nTracks[0]; iTrack1++) {
+ if (trackId2 == trackId[iTrack1]) {
+ // complement existing track
+ trackCharge[iTrack1] += digit[1]->TrackCharge(iTrack2);
+ trackExist = kTRUE;
+ break;
+ }
+ }
+ // add the new track
+ if (!trackExist) {
+ trackId[nTracksTot] = trackId2;
+ trackCharge[nTracksTot] = digit[1]->TrackCharge(iTrack2);
+ nTracksTot++;
+ }
+ }
+
+ // --- Find the most contributing track ---
+ Int_t mainTrackId = -1;
+ Float_t maxCharge = 0.;
+ for (Int_t iTrack = 0; iTrack < nTracksTot; iTrack++) {
+ if (trackCharge[iTrack] > maxCharge) {
+ mainTrackId = trackId[iTrack];
+ maxCharge = trackCharge[iTrack];
+ }
+ }
+
+ delete[] trackId;
+ delete[] trackCharge;
+
+ return mainTrackId;
+}
+
//_____________________________________________________________________________
void
AliMUONSimpleClusterServer::Print(Option_t*) const