//______________________________________________________________________
AliITSdEdxSamples::AliITSdEdxSamples():TObject(),
fNSamples(0),
+ fClusterMap(0),
fP(0.),
- fParticleSpecie(0)
+ fParticleSpecie(0),
+ fLayersForPid(0xFFFF)
{
// Default constructor
for(Int_t i=0; i<kMaxSamples; i++){
AliITSdEdxSamples::AliITSdEdxSamples(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t mom, Int_t specie) :
TObject(),
fNSamples(nSamples),
+ fClusterMap(0),
fP(mom),
- fParticleSpecie(specie)
+ fParticleSpecie(specie),
+ fLayersForPid(0xFFFF)
{
// Standard constructor
SetdESamples(nSamples,esamples);
SetdxSamples(nSamples,xsamples);
+ SetClusterMapFromdE();
}
//______________________________________________________________________
AliITSdEdxSamples::AliITSdEdxSamples(const AliITSdEdxSamples& source) :
TObject(),
fNSamples(source.fNSamples),
+ fClusterMap(source.fClusterMap),
fP(source.fP),
- fParticleSpecie(source.fParticleSpecie)
+ fParticleSpecie(source.fParticleSpecie),
+ fLayersForPid(source.fLayersForPid)
{
// Copy constructor
for(Int_t i=0; i<kMaxSamples; i++){
return;
}
//______________________________________________________________________
+void AliITSdEdxSamples::SetLayerSample(Int_t iLayer, Bool_t haspoint, Double_t dE, Double_t dx, Double_t p){
+ // set info from single layer
+ if(haspoint){
+ SetPointOnLayer(iLayer);
+ fdESamples[iLayer]=dE;
+ fdxSamples[iLayer]=dx;
+ fPAtSample[iLayer]=p;
+ }else{
+ if(HasPointOnLayer(iLayer)) fClusterMap-=(1<<iLayer);
+ fdESamples[iLayer]=0.;
+ fdxSamples[iLayer]=0.;
+ fPAtSample[iLayer]=0.;
+
+ }
+}
+//______________________________________________________________________
Double_t AliITSdEdxSamples::GetTruncatedMean(Double_t frac, Double_t mindedx) const {
// compute truncated mean
Double_t dedx[kMaxSamples];
for (Int_t il=0; il<fNSamples; il++) { // count good (>0) dE/dx values
Double_t dedxsamp=GetdEdxSample(il);
- if(dedxsamp>mindedx){
+ if(HasPointOnLayer(il) && UseLayerForPid(il) && dedxsamp>mindedx){
dedx[nc]= dedxsamp;
nc++;
}
}
if(nc<1) return 0.;
-
+
Int_t swap; // sort in ascending order
do {
swap=0;
Double_t dedx[kMaxSamples];
for (Int_t il=0; il<fNSamples; il++) { // count good (>0) dE/dx values
Double_t dedxsamp=GetdEdxSample(il);
- if(dedxsamp>mindedx){
+ if(HasPointOnLayer(il) && UseLayerForPid(il) && dedxsamp>mindedx){
dedx[nc]= dedxsamp;
nc++;
}
Double_t itsProb[nPart] = {1,1,1}; // p, K, pi
for(Int_t iS=0; iS<fNSamples; iS++){
+ if(!HasPointOnLayer(iS)) continue;
+ if(!UseLayerForPid(iS)) continue;
Int_t iLayer=iS+3; // to match with present ITS
if(iLayer>6) iLayer=6; // all extra points are treated as SSD
Float_t dedx = GetdEdxSample(iS);
return;
}
+//______________________________________________________________________
+void AliITSdEdxSamples::PrintAll() const{
+ // print all the infos
+ printf("Particle %d momentum %f GeV/c, number of points %d\n",
+ GetParticleSpecieMC(),
+ fP,
+ GetNumberOfEffectiveSamples());
+ for(Int_t iLay=0; iLay<fNSamples; iLay++){
+ printf(" Layer %d Point %d dE %f keV dx %f cm mom %f GeV/c\n",iLay,
+ HasPointOnLayer(iLay),
+ GetdESample(iLay),
+ GetdxSample(iLay),
+ GetMomentumAtSample(iLay));
+ }
+
+ printf("Layers used for PID:\n");
+ printf("Layer ");
+ for(Int_t iLay=0; iLay<fNSamples; iLay++){
+ printf("%d ",iLay);
+ }
+ printf("\n");
+
+ printf("Use ");
+ for(Int_t iLay=0; iLay<fNSamples; iLay++){
+ printf("%d ",UseLayerForPid(iLay));
+ }
+ printf("\n");
+ printf("Truncated mean = %f\n",GetTruncatedMean());
+}
+//______________________________________________________________________
+void AliITSdEdxSamples::PrintClusterMap() const{
+ // print the cluster map
+
+ printf("Layer ");
+ for(Int_t iLay=0; iLay<fNSamples; iLay++){
+ printf("%d ",iLay);
+ }
+ printf("\n");
+
+ printf("Point ");
+ for(Int_t iLay=0; iLay<fNSamples; iLay++){
+ printf("%d ",HasPointOnLayer(iLay));
+ }
+ printf("\n");
+}
void SetdESamples(Int_t nSamples, Double_t* samples);
void SetdxSamples(Int_t nSamples, Double_t* samples);
void SetSamplesAndMomenta(Int_t nSamples, Double_t* esamples, Double_t* xsamples, Double_t* mom);
+ void SetNSamples(Int_t nSamples){
+ fNSamples=nSamples;
+ }
+ void SetLayerSample(Int_t iLayer, Bool_t haspoint, Double_t dE=0., Double_t dx=0., Double_t p=0.);
+
void SetMomentum(Double_t mom){
fP=mom;
}
void SetParticleSpecieMC(Int_t specie){
fParticleSpecie=specie;
}
+ void SetClusterMap(UInt_t map){
+ fClusterMap=map;
+ }
+ void SetPointOnLayer(Int_t iLay){
+ fClusterMap|=(1<<iLay);
+ }
+ void SetLayersForPID(UInt_t laypid){
+ fLayersForPid=laypid;
+ }
+ void SetUseLayerForPid(Int_t iLay){
+ fLayersForPid|=(1<<iLay);
+ }
+ void SetNotUseLayerForPid(Int_t iLay){
+ if(fLayersForPid&(1<<iLay)) fLayersForPid-=(1<<iLay);
+ }
Int_t GetNumberOfSamples() const {
return fNSamples;
}
+ Int_t GetNumberOfEffectiveSamples() const{
+ Int_t nS=0;
+ for (Int_t il=0; il<fNSamples; il++) if(HasPointOnLayer(il)) nS++;
+ return nS;
+ }
+
Double_t GetdESample(Int_t i) const {
if(i<fNSamples) return fdESamples[i];
else return 0.;
Int_t GetParticleSpecieMC() const {
return fParticleSpecie;
}
+ UInt_t GetClusterMap() const{
+ return fClusterMap;
+ }
+ Bool_t HasPointOnLayer(Int_t iLay) const{
+ return fClusterMap&(1<<iLay);
+ }
+ UInt_t GetLayersForPid() const{
+ return fLayersForPid;
+ }
+ Bool_t UseLayerForPid(Int_t iLay) const{
+ return fLayersForPid&(1<<iLay);
+ }
+
+ void PrintAll() const;
+ void PrintClusterMap() const;
Double_t GetTruncatedMean(Double_t frac=0.5, Double_t mindedx=0.) const;
Double_t GetWeightedMean(Double_t mindedx=0.) const;
protected:
+
+ void SetClusterMapFromdE(){
+ fClusterMap=0;
+ for(Int_t i=0; i<fNSamples; i++)
+ if(fdESamples[i]>0.) SetPointOnLayer(i);
+ }
+
enum{kMaxSamples=10}; // max. n. of layers with dE/dx info
- Int_t fNSamples; // number of samples
- Double_t fdESamples[kMaxSamples]; // dE samples (keV)
- Double_t fdxSamples[kMaxSamples]; // dx samples (cm)
- Double_t fP; // track momentum
- Int_t fParticleSpecie; // MC generated particle
- Double_t fPAtSample[kMaxSamples]; // track momentum at specific samples
-
- ClassDef(AliITSdEdxSamples,2);
+ Int_t fNSamples; // number of samples
+ UInt_t fClusterMap; // map of clusters in layers
+ Double_t fdESamples[kMaxSamples]; // dE samples (keV)
+ Double_t fdxSamples[kMaxSamples]; // dx samples (cm)
+ Double_t fP; // track momentum
+ Int_t fParticleSpecie; // MC generated particle
+ Double_t fPAtSample[kMaxSamples]; // track momentum at specific samples
+ UInt_t fLayersForPid; // bit-map to enable/disable layers in PID
+
+ ClassDef(AliITSdEdxSamples,3);
};
#endif