+//____________________________________________________________________
+Int_t
+AliFMDReconstructor::GetIdentifier() const
+{
+ // Get the detector identifier.
+ // Note the actual value is cached so that we do not
+ // need to do many expensive string comparisons.
+ static Int_t idx = AliReconstruction::GetDetIndex(GetDetectorName());
+ return idx;
+}
+
+//____________________________________________________________________
+const AliFMDRecoParam*
+AliFMDReconstructor::GetParameters() const
+{
+ // Get the reconstruction parameters.
+ //
+ // Return:
+ // Pointer to reconstruction parameters or null if not found or wrong type
+ Int_t iDet = GetIdentifier(); // Was 12 - but changed on Cvetans request
+ const AliDetectorRecoParam* params = AliReconstructor::GetRecoParam(iDet);
+ if (!params || params->IsA() != AliFMDRecoParam::Class()) return 0;
+ return static_cast<const AliFMDRecoParam*>(params);
+}
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::UseRecoParam(Bool_t set) const
+{
+ //
+ // Set-up reconstructor to use values from reconstruction
+ // parameters, if present, for this event. If the argument @a set
+ // is @c false, then restore preset values.
+ //
+ // Parameters:
+ // set
+ //
+ static Float_t savedNoiseFactor = fNoiseFactor;
+ static Bool_t savedAngleCorrect = fAngleCorrect;
+ if (set) {
+ const AliFMDRecoParam* params = GetParameters();
+ if (params) {
+ fNoiseFactor = params->NoiseFactor();
+ fAngleCorrect = params->AngleCorrect();
+ }
+ return;
+ }
+ fNoiseFactor = savedNoiseFactor;
+ fAngleCorrect = savedAngleCorrect;
+}
+
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::MarkDeadChannels(AliESDFMD* esd) const
+{
+ // Loop over all entries of the ESD and mark
+ // those that are dead as such
+ // - otherwise put in the zero signal.
+ AliFMDParameters* param = AliFMDParameters::Instance();
+
+ for (UShort_t d = 1; d <= 3; d++) {
+ UShort_t nR = (d == 1 ? 1 : 2);
+
+ for (UShort_t q = 0; q < nR; q++) {
+ Char_t r = (q == 0 ? 'I' : 'O');
+ UShort_t nS = (q == 0 ? 20 : 40);
+ UShort_t nT = (q == 0 ? 512 : 256);
+
+ for (UShort_t s = 0; s < nS; s++) {
+ for (UShort_t t = 0; t < nT; t++) {
+ if (fBad(d, r, s, t)) {
+ AliDebug(5, Form("Marking FMD%d%c[%2d,%3d] as bad", d, r, s, t));
+ esd->SetMultiplicity(d, r, s, t, AliESDFMD::kInvalidMult);
+ }
+ if (param->IsDead(d, r, s, t)) {
+ AliDebug(5, Form("Marking FMD%d%c[%2d,%3d] as dead", d, r, s, t));
+ esd->SetMultiplicity(d, r, s, t, AliESDFMD::kInvalidMult);
+ // esd->SetEta(d, r, s, t, AliESDFMD::kInvalidEta);
+ }
+ else if (esd->Multiplicity(d, r, s, t) == AliESDFMD::kInvalidMult) {
+ AliDebug(10, Form("Setting null signal in FMD%d%c[%2d,%3d]",
+ d, r, s, t));
+ esd->SetMultiplicity(d, r, s, t, 0);
+ }
+ }
+ }
+ }
+ }
+}
+
+//____________________________________________________________________
+void
+AliFMDReconstructor::Reconstruct(AliRawReader* reader, TTree*) const
+{
+ // Reconstruct directly from raw data (no intermediate output on
+ // digit tree or rec point tree).
+ //
+ // Parameters:
+ // reader Raw event reader
+ // ctree Not used - 'cluster tree' to store rec-points in.
+ AliFMDDebug(1, ("Reconstructing from raw reader"));
+ AliFMDRawReader rawReader(reader, 0);
+ fBad.Reset(false);
+ UShort_t det, sec, str, fac;
+ Short_t adc, oldDet = -1;
+ Bool_t zs;
+ Char_t rng;
+
+ UseRecoParam(kTRUE);
+ while (rawReader.NextSignal(det, rng, sec, str, adc, zs, fac)) {
+ if (det != oldDet) {
+ fZS[det-1] = zs;
+ fZSFactor[det-1] = fac;
+ oldDet = det;
+ }
+ ProcessSignal(det, rng, sec, str, adc);
+ }
+ UseRecoParam(kFALSE);
+
+}