X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMD.cxx;h=1bc97d3014a17d16d4deb3241a07246e4950ebe4;hb=4ef4cfbd7abc460a660c0956f7e817ab07b936f6;hp=8fe3744a487580248748f6894b35a3058e066e7c;hpb=a91c42d1687d97cd00f73ad60190f6ff764f4e82;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index 8fe3744a487..1bc97d3014a 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -84,14 +84,15 @@ // These files are not in the same directory, so there's no reason to // ask the preprocessor to search in the current directory for these // files by including them with `#include "..."' -#include // __CMATH__ +#include // ROOT_TBrowser #include // ROOT_TClonesArray +#include // ROOT_TGeoGlobalMagField +#include // ROOT_TGeoManager #include // ROOT_TRotMatrix #include // ROOT_TTree -#include // ROOT_TBrowser -#include // ROOT_TVirtualMC #include // ROOT_TVector2 -#include // ROOT_TGeoManager +#include // ROOT_TVirtualMC +#include // __CMATH__ #include // ALIRUNDIGITIZER_H #include // ALILOADER_H @@ -115,8 +116,11 @@ //#endif // #include "AliFMDGeometryBuilder.h" #include "AliFMDRawWriter.h" // ALIFMDRAWWRITER_H +#include "AliFMDRawReader.h" // ALIFMDRAWREADER_H #include "AliTrackReference.h" #include "AliFMDStripIndex.h" +#include "AliFMDParameters.h" +#include "AliFMDReconstructor.h" //____________________________________________________________________ ClassImp(AliFMD) @@ -261,8 +265,8 @@ void AliFMD::CreateMaterials() Double_t density = 0; Double_t radiationLength = 0; Double_t absorbtionLength = 999; - Int_t fieldType = gAlice->Field()->Integ(); // Field type - Double_t maxField = gAlice->Field()->Max(); // Field max. + Int_t fieldType = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ(); // Field type + Double_t maxField = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max(); // Field max. Double_t maxBending = 0; // Max Angle Double_t maxStepSize = 0.001; // Max step size Double_t maxEnergyLoss = 1; // Max Delta E @@ -652,13 +656,14 @@ AliFMD::AddHitByFields(Int_t track, hit = new (a[fNhits]) AliFMDHit(fIshunt, track, detector, ring, sector, strip, x, y, z, px, py, pz, edep, pdg, t, l, stop); + // gMC->AddTrackReference(track, 12); fNhits++; //Reference track AliMC *mcApplication = (AliMC*)gAlice->GetMCApp(); - AliTrackReference* trackRef = AddTrackReference(mcApplication->GetCurrentTrackNumber(), 12); // should be AliTrackReference::kFMD + AliTrackReference* trackRef = AddTrackReference(mcApplication->GetCurrentTrackNumber(), AliTrackReference::kFMD); UInt_t stripId = AliFMDStripIndex::Pack(detector,ring,sector,strip); trackRef->SetUserId(stripId); @@ -695,14 +700,16 @@ AliFMD::AddDigit(Int_t* digits, Int_t*) //____________________________________________________________________ void -AliFMD::AddDigitByFields(UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - UShort_t count1, - Short_t count2, - Short_t count3, - Short_t count4) +AliFMD::AddDigitByFields(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + UShort_t count1, + Short_t count2, + Short_t count3, + Short_t count4, + UShort_t nrefs, + Int_t* refs) { // add a real digit - as coming from data // @@ -717,12 +724,14 @@ AliFMD::AddDigitByFields(UShort_t detector, // count3 ADC count (a 10-bit word), or -1 if not used TClonesArray& a = *(DigitsArray()); - new (a[fNdigits++]) - AliFMDDigit(detector, ring, sector, strip, count1, count2, count3, count4); - AliFMDDebug(15, ("Adding digit # %5d/%5d for FMD%d%c[%2d,%3d]=(%d,%d,%d,%d)", + AliFMDDebug(15, ("Adding digit # %5d/%5d for FMD%d%c[%2d,%3d]" + "=(%d,%d,%d,%d) with %d tracks", fNdigits-1, a.GetEntriesFast(), detector, ring, sector, strip, - count1, count2, count3, count4)); + count1, count2, count3, count4, nrefs)); + new (a[fNdigits++]) + AliFMDDigit(detector, ring, sector, strip, + count1, count2, count3, count4, nrefs, refs); } @@ -754,22 +763,22 @@ AliFMD::AddSDigit(Int_t* digits) Short_t(digits[8]), // ADC Count4 UShort_t(digits[9]), // N particles UShort_t(digits[10])); // N primaries - } //____________________________________________________________________ void -AliFMD::AddSDigitByFields(UShort_t detector, - Char_t ring, - UShort_t sector, - UShort_t strip, - Float_t edep, - UShort_t count1, - Short_t count2, - Short_t count3, - Short_t count4, - UShort_t ntot, - UShort_t nprim) +AliFMD::AddSDigitByFields(UShort_t detector, + Char_t ring, + UShort_t sector, + UShort_t strip, + Float_t edep, + UShort_t count1, + Short_t count2, + Short_t count3, + Short_t count4, + UShort_t ntot, + UShort_t nprim, + Int_t* refs) { // add a summable digit // @@ -787,9 +796,14 @@ AliFMD::AddSDigitByFields(UShort_t detector, TClonesArray& a = *(SDigitsArray()); // AliFMDDebug(0, ("Adding sdigit # %d", fNsdigits)); + AliFMDDebug(15, ("Adding sdigit # %5d/%5d for FMD%d%c[%2d,%3d]" + "=(%d,%d,%d,%d) with %d tracks %d primaries %d (%p)", + fNsdigits-1, a.GetEntriesFast(), + detector, ring, sector, strip, + count1, count2, count3, count4, ntot, nprim, refs)); new (a[fNsdigits++]) AliFMDSDigit(detector, ring, sector, strip, edep, - count1, count2, count3, count4, ntot, nprim); + count1, count2, count3, count4, ntot, nprim, refs); } //____________________________________________________________________ @@ -906,6 +920,45 @@ AliFMD::Digits2Raw() writer.Exec(); } +//==================================================================== +// +// Raw data reading +// +//__________________________________________________________________ +Bool_t +AliFMD::Raw2SDigits(AliRawReader* reader) +{ + // Turn digits into raw data. + // + // This uses the class AliFMDRawWriter to do the job. Please refer + // to that class for more information. + AliFMDParameters::Instance()->Init(); + MakeTree("S"); + MakeBranch("S"); + + TClonesArray* sdigits = SDigits(); + AliFMDReconstructor rec; + + // The two boolean arguments + // Make sdigits instead of digits + // Subtract the pedestal off the signal + rec.Digitize(reader, sdigits); + // + // Bool_t ret = fmdReader.ReadAdcs(sdigits, kTRUE, kTRUE); + // sdigits->ls(); + UShort_t ns = sdigits->GetEntriesFast(); + for (UShort_t i = 0; i < ns; i++) + sdigits->At(i)->Print("pl"); + + AliFMDDebug(1, ("Got a total of %d SDigits", ns)); + + fLoader->TreeS()->Fill(); + ResetSDigits(); + fLoader->WriteSDigits("OVERWRITE"); + + return kTRUE; +} + //==================================================================== //