78 fVertexType(kNoVertex),
93 for(Int_t det = 1; det<=3; det++) {
121 if (param->
Init(
true) != 0) {
122 AliError(
"Failed to initialize parameters, making zombie");
137 AliInfo(
"Making diagnostics histograms");
139 fDiagStep1 =
new TH2I(
"diagStep1",
"Read ADC vs. Noise surpressed ADC",
140 1024, -.5, 1023.5, 1024, -.5, 1023.5);
142 fDiagStep1->GetXaxis()->SetTitle(
"ADC (read)");
143 fDiagStep1->GetYaxis()->SetTitle(Form(
"ADC (noise surpressed %4.f)",
147 fDiagStep2 =
new TH2F(
"diagStep2",
"ADC vs Edep deduced",
148 1024, -.5, 1023.5, 100, 0, 2);
150 fDiagStep2->GetXaxis()->SetTitle(
"ADC (noise surpressed)");
151 fDiagStep2->GetYaxis()->SetTitle(
"#Delta E [GeV]");
154 fDiagStep3 =
new TH2F(
"diagStep3",
"Edep vs Edep path corrected",
155 100, 0., 2., 100, 0., 2.);
157 fDiagStep3->GetXaxis()->SetTitle(
"#Delta E [GeV]");
158 fDiagStep3->GetYaxis()->SetTitle(
"#Delta E/#Delta x #times #delta x [GeV]");
161 fDiagStep4 =
new TH2F(
"diagStep4",
"Edep vs Multiplicity deduced",
162 100, 0., 2., 100, -.1, 19.9);
164 fDiagStep4->GetXaxis()->SetTitle(
"#Delta E/#Delta x #times #delta x [GeV]");
165 fDiagStep4->GetYaxis()->SetTitle(
"Multiplicity");
166 fDiagAll =
new TH2F(
"diagAll",
"Read ADC vs Multiplicity deduced",
167 1024, -.5, 1023.5, 100, -.1, 19.9);
171 fDiagAll->GetXaxis()->SetTitle(
"ADC (read)");
172 fDiagAll->GetYaxis()->SetTitle(
"Multiplicity");
179 TTree* digitsTree)
const 183 AliWarning(
"I'm a zombie - cannot do anything");
186 AliFMDDebug(1, (
"Reading raw data into digits tree"));
191 static TClonesArray*
array = 0;
192 if (!array) array =
new TClonesArray(
"AliFMDDigit");
193 digitsTree->Branch(
"FMD", &array);
201 Int_t nWrite = digitsTree->Fill();
202 AliDebugF(1,
"Got a grand total of %d digits, wrote %d bytes to tree",
203 array->GetEntriesFast(), nWrite);
207 for (UShort_t i = 1; i <= 3; i++) {
232 vertex->GetName(), vertex->GetTitle(), vertex->
GetZ()));
243 AliWarning(
"Didn't get any vertex from ESD or generator");
267 if (!params || params->IsA() != AliFMDRecoParam::Class())
return 0;
307 for (UShort_t d = 1; d <= 3; d++) {
308 UShort_t nR = (d == 1 ? 1 : 2);
310 for (UShort_t q = 0; q < nR; q++) {
311 Char_t r = (q == 0 ?
'I' :
'O');
312 UShort_t nS = (q == 0 ? 20 : 40);
313 UShort_t nT = (q == 0 ? 512 : 256);
315 for (UShort_t s = 0; s < nS; s++) {
316 for (UShort_t t = 0; t < nT; t++) {
324 if (
fBad(d, r, s, t)) {
325 AliDebugF(5,
"Marking FMD%d%c[%2d,%3d] as bad", d, r, s, t);
328 if (param->
IsDead(d, r, s, t)) {
329 AliDebugF(5,
"Marking FMD%d%c[%2d,%3d] as dead", d, r, s, t);
334 AliDebugF(20,
"Setting null signal in FMD%d%c[%2d,%3d]",
339 AliDebugF(10,
"Setting FMD%d%c[%2d,%3d]=%f",d,r,s,t,
354 AliWarning(
"I'm a zombie - cannot do anything");
369 for (UShort_t d=1; d<=3; d++) {
370 UShort_t nQ = (d == 1 ? 1 : 2);
371 for (UShort_t q=0; q<nQ; q++) {
372 UShort_t nStr = (q == 0 ? 512 : 256);
373 Char_t r = (q == 0 ?
'I' :
'O');
375 for (UShort_t t = 0; t < nStr; t++) {
398 AliFMDDebug(1, (
"Reconstructing from FMD raw reader"));
401 UShort_t det, sec, str, fac;
402 Short_t adc, oldDet = -1;
407 while (rawReader.
NextSignal(det, rng, sec, str, adc, zs, fac)) {
429 AliFMDDebug(1, (
"Reconstructing from raw reader"));
431 AliWarning(
"I'm a zombie - cannot do anything");
449 AliWarning(
"I'm a zombie - cannot do anything");
454 UShort_t det, sec, str, sam, rat, fac;
455 Short_t adc, oldDet = -1;
460 while (rawReader.
NextSample(det, rng, sec, str, sam, rat, adc, zs, fac)) {
475 TTree* clusterTree)
const 488 if (!
fMult)
fMult =
new TClonesArray(
"AliFMDRecPoint");
490 AliFMDDebug(1, (
"Reconstructing from digits in a tree"));
493 static TClonesArray* digits =
new TClonesArray(
"AliFMDDigit");
494 TBranch* digitBranch = digitsTree->GetBranch(
"FMD");
496 Error(
"Exec",
"No digit branch for the FMD found");
499 digitBranch->SetAddress(&digits);
501 if (digits) digits->Clear();
509 AliDebug(5,
"Getting entry 0 from digit branch");
510 digitBranch->GetEntry(0);
512 AliDebugF(5,
"Processing %d digits", digits->GetEntriesFast());
517 Int_t written = clusterTree->Fill();
518 AliFMDDebug(10, (
"Filled %d bytes into cluster tree", written));
537 AliWarning(
"I'm a zombie - cannot do anything");
541 for (
size_t i = 1; i <= 3; i++) {
561 Int_t nDigits = digits->GetEntries();
566 for (Int_t i = 0; i < nDigits; i++) {
568 if (!digit)
continue;
584 Char_t rng = digit->
Ring();
585 UShort_t sec = digit->
Sector();
586 UShort_t str = digit->
Strip();
587 Short_t adc = digit->
Counts();
610 Bool_t dhr = dbg > 3 && dbg < 10;
611 if (dhr)
printf(
"FMD%d%c[%2d,%3d] adc=%4d ", det, rng, sec, str, adc);
614 AliFMDDebug(10, (
"FMD%d%c[%2d,%3d] is marked bad", det, rng, sec, str));
615 if (dhr) Printf(
"bad");
616 fBad(det,rng,sec,str) =
true;
622 if (param->
IsDead(det, rng, sec, str)) {
623 AliFMDDebug(10, (
"FMD%d%c[%2d,%3d] is dead", det, rng, sec, str));
624 if (dhr) Printf(
"dead");
625 fBad(det,rng,sec,str) =
true;
635 if(counts == USHRT_MAX) {
636 if (dhr) Printf(
"invalid");
639 if (dhr)
printf(
"counts=%4d ", counts);
642 Double_t edep =
Adc2Energy(det, rng, sec, str, eta, counts);
645 if (dhr) Printf(
"zero");
648 if (dhr)
printf(
"edep=%f ", edep);
659 if (dhr) Printf(
"not hit");
663 if (dhr) Printf(
"mult=%f ", mult);
665 "ADC: %d, Counts: %d, Energy: %f, Mult: %f",
666 det, rng, sec, str, adc, counts, edep, mult));
675 eta, phi, edep, mult);
708 if (param->
IsDead(det, rng, sec, str)) {
709 AliFMDDebug(10, (
"FMD%d%c[%2d,%3d] is dead", det, rng, sec, str));
715 if(counts == USHRT_MAX || counts == 0)
return;
718 Double_t edep =
Adc2Energy(det, rng, sec, str, counts);
722 Int_t n = sdigits->GetEntriesFast();
725 AliFMDSDigit(det, rng, sec, str, edep, counts, counts, counts, counts);
738 UShort_t zsNoiseFactor)
const 760 Float_t ped = (zsEnabled ? 0 :
763 if (ped < 0 || noise < 0) {
765 "for FMD%d%c[%02d,%03d]",
766 ped, noise, det, rng, sec, str));
769 AliDebugClass(10, Form(
"Subtracting pedestal for FMD%d%c[%2d,%3d]=%4d " 770 "(%s w/factor %d, noise factor %f, " 771 "pedestal %8.2f+/-%8.2f)",
772 det, rng, sec, str, adc,
773 (zsEnabled ?
"zs'ed" :
"straight"),
774 zsNoiseFactor, noiseFactor, ped, noise));
776 Int_t counts = adc + Int_t(zsEnabled ? zsNoiseFactor * noise : - ped);
777 counts = TMath::Max(Int_t(counts), 0);
793 Float_t nf = zsNoiseFactor;
794 if (counts <= noise * nf) counts = 0;
797 UShort_t ret = counts < 0 ? 0 : counts;
835 UShort_t count)
const 872 if (count <= 0)
return 0;
877 AliDebugF(10,
"Invalid gain (%f) for FMD%d%c[%02d,%03d]",
878 gain, det, rng, sec, str);
881 AliDebugF(10,
"Converting counts %d to energy (factor=%f, DAC2MIP=%f)",
884 Double_t edep = ((count * param->
GetEdepMip())
896 UShort_t count)
const 934 Double_t edep =
Adc2Energy(det, rng, sec, str, count);
938 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
939 Double_t corr = TMath::Abs(TMath::Cos(theta));
940 Double_t cedep = corr * edep;
941 AliDebugF(10,
"correcting for path %f * %f = %f (eta=%f, theta=%f)",
942 edep, corr, cedep, eta, theta);
982 Float_t mult = edep / edepMIP;
985 AliFMDDebug(15, (
"Translating energy %f to multiplicity via " 986 "divider %f->%f", edep, edepMIP, mult));
1012 Double_t x, y, z, r, theta, deta, dphi;
1027 Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
1028 Float_t m, Float_t e)
1031 printf(
" FMD%d%c[%2d,%3d] = %6.3f / %6.3f\n", d, r, s, t, m, e);
1047 AliFMDDebug(2, (
"Calling FillESD with two trees and one ESD"));
1049 AliWarning(
"I'm a zombie - cannot do anything");
1060 AliFMDDebug(2, (
"Revertexing the ESD data to vz=%f (was %f)",
1077 static bool first =
true;
1083 AliFMDDebug(3, (
"Writing diagnostics histograms to FMD.Diag.root/%03d",evno));
1084 TFile
f(
"FMD.Diag.root", (first ?
"RECREATE" :
"UPDATE"));
1087 TDirectory* d = f.mkdir(Form(
"%03d", evno),
1088 Form(
"Diagnostics histograms for event # %d", evno));
1115 AliWarning(
"I'm a zombie - cannot do anything");
1119 FillESD(dummy, clusterTree, esd);
virtual void GetVertex(AliESDEvent *esd) const
Float_t GetDACPerMIP() const
Int_t NextSample(UShort_t &det, Char_t &rng, UShort_t &sec, UShort_t &str, UShort_t &sam, UShort_t &rat, Short_t &adc, Bool_t &zs, UShort_t &fac)
Reconstructed FMD points. It contains the pseudo-inclusive multiplicity.
virtual UShort_t SubtractPedestal(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, UShort_t adc, Float_t noiseFactor, Bool_t zsEnabled, UShort_t zsNoiseFactor) const
void SetNoiseFactor(Float_t f)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Bool_t IsDead(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
virtual void Reconstruct(TTree *digitsTree, TTree *clusterTree) const
Geometry mananger for the FMD.
virtual void UseRecoParam(Bool_t set=kTRUE) const
const AliFMDRecoParam * GetParameters() const
UShort_t NoiseFactor(UShort_t ddl) const
Int_t GetIdentifier() const
virtual void InitTransformations(Bool_t force=kFALSE)
static const AliDetectorRecoParam * GetRecoParam(Int_t iDet)
This class is a singleton that handles various parameters of the FMD detectors. This class reads from...
Manager of FMD parameters.
Float_t GetPulseGain(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
virtual void PhysicalCoordinates(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, Float_t &eta, Float_t &phi) const
Class to read ALTRO formated raw data from an AliRawReader object.
UShort_t Detector2DDL(UShort_t det) const
AliFMDAltroMapping * GetAltroMap() const
virtual void SetAngleCorrect(Bool_t use=kTRUE)
Float_t GetEdepMip() const
virtual void FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const
Bool_t ForEach(ForOne &algo) const
Pseudo reconstructed charged particle multiplicity.
virtual void DigitizeSignal(TClonesArray *sdigits, UShort_t det, Char_t rng, UShort_t sec, UShort_t str, UShort_t sam, Short_t adc) const
#define AliWarning(message)
Bool_t IsZeroSuppressed(UShort_t ddl) const
Double32_t GetT0zVertex() const
virtual Float_t Energy2Multiplicity(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, Float_t edep) const
virtual void ConvertDigits(AliRawReader *reader, TTree *digitsTree) const
Map HW address to detector coordinates and back again.
virtual ~AliFMDReconstructor()
virtual void ProcessSignal(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, Short_t adc) const
#define AliDebugClass(logLevel, message)
const AliESDVertex * GetPrimaryVertexTPC() const
Int_t NextSignal(UShort_t &det, Char_t &rng, UShort_t &sec, UShort_t &str, Short_t &adc, Bool_t &zs, UShort_t &fac)
Float_t NoiseFactor() const
void SetMultiplicity(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Float_t mult)
This is a class that reconstructs AliFMDRecPoint objects from of Digits.
void SetEta(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Float_t eta)
Bool_t PreReconstruct() const
Singleton object of FMD geometry descriptions and parameters. This class is a singleton that handles ...
virtual Float_t Adc2Energy(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, UShort_t count) const
Float_t Multiplicity(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
static Bool_t SelectSample(UShort_t samp, UShort_t rate)
static Int_t GetDetIndex(const char *detector)
Float_t Eta(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
virtual void SetNoiseFactor(Float_t f=3)
#define AliWarningClass(message)
Class that encodes a map to/from ALTRO hardware address to FMD detector coordinates.
virtual Double_t GetZ() const
virtual const char * GetDetectorName() const
#define AliFMDDebug(N, A)
virtual Bool_t ReadAdcs(TClonesArray *array)
static AliFMDParameters * Instance()
void Detector2XYZ(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Double_t &x, Double_t &y, Double_t &z) const
Event Summary Data for the Forward Multiplicity Detector.This stores the psuedo-multiplicity and -rap...
const AliESDTZERO * GetESDTZERO() const
void Clear(Option_t *option="")
#define AliDebug(logLevel, message)
void SetFMDData(AliESDFMD *obj)
const AliESDVertex * GetVertex() const
static Bool_t XYZ2REtaPhiTheta(Double_t x, Double_t y, Double_t z, Double_t &r, Double_t &eta, Double_t &phi, Double_t &theta)
const AliESDVertex * GetPrimaryVertexSPD() const
Bool_t Revertex(AliESDFMD *fmdEsd, Double_t vz) const
class for summable digits
const AliESDVertex * GetPrimaryVertex() const
virtual void ProcessDigit(AliFMDDigit *digit) const
virtual void Reset(const Bool_t &v=Bool_t())
Bool_t AngleCorrect() const
UShort_t Detector() const
static Int_t GetDebugLevel(const char *module, const char *className)
Int_t GetEventNumberInFile() const
#define AliError(message)
static AliFMDGeometry * Instance()
Float_t GetPedestal(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
Float_t GetPedestalWidth(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
virtual void ProcessDigits(TClonesArray *digits, const AliFMDRawReader &rawRead) const
#define AliDebugF(logLevel, format,...)
virtual void Digitize(AliRawReader *reader, TClonesArray *sdigits) const
UShort_t Init(Bool_t forceReInit=kFALSE, UInt_t what=kAll)
void SetAngleCorrected(Bool_t done)
void MarkDeadChannels(AliESDFMD *esd) const