X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONTriggerDecision.cxx;h=8a487c182fdc9bee118dcf29978a3e4444fd00c7;hb=bdb9f2a3383e55d7dc09c09b9ad683f270a2bc23;hp=fb29af618e42f9717f68ff639122ae85ab5c0430;hpb=e516b01dc9b050949d85a6e082e9213ee783c82c;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONTriggerDecision.cxx b/MUON/AliMUONTriggerDecision.cxx index fb29af618e4..8a487c182fd 100644 --- a/MUON/AliMUONTriggerDecision.cxx +++ b/MUON/AliMUONTriggerDecision.cxx @@ -29,6 +29,7 @@ #include "AliRunLoader.h" #include "AliLoader.h" #include "AliRawReader.h" // for raw data +#include "AliLog.h" //---------------------------------------------------------------------- @@ -90,15 +91,11 @@ AliMUONTriggerDecision::AliMUONTriggerDecision(AliLoader* loader, Int_t iprint, fLoader = loader; // initialize container - if (data == 0) - Error("TriggerDecision","No MUONdata for trigger\n"); - else + if (data == 0){ + AliError("No MUONdata for trigger"); + }else{ fMUONData = data; - - // Loading AliRun master - AliRunLoader* runloader = fLoader->GetRunLoader(); - if (runloader->GetAliRun() == 0x0) runloader->LoadgAlice(); - gAlice = runloader->GetAliRun(); + } // getting MUON fMUON = (AliMUON*) gAlice->GetDetector("MUON"); @@ -114,6 +111,7 @@ AliMUONTriggerDecision::AliMUONTriggerDecision(AliLoader* loader, Int_t iprint, fDigits = new TObjArray(AliMUONConstants::NCh()); //NTriggerCh for (Int_t i=0; iAddAt(new TClonesArray("AliMUONDigit",10000),i); + fDigitIndices = new TArrayI[AliMUONConstants::NCh()]; } //---------------------------------------------------------------------- @@ -125,6 +123,7 @@ AliMUONTriggerDecision::AliMUONTriggerDecision() fMUON(0) { // Default constructor + fDigitIndices = NULL; } //---------------------------------------------------------------------- @@ -133,14 +132,17 @@ AliMUONTriggerDecision::AliMUONTriggerDecision(const AliMUONTriggerDecision& rhs { // Protected copy constructor - Fatal("AliMUONTriggerDecision", "Not implemented."); + AliFatal("Not implemented."); } //---------------------------------------------------------------------- void AliMUONTriggerDecision::ClearDigits() { - for ( int i=0;iAt(i))->Clear(); + fDigitIndices[i].Set(0); + }; } //---------------------------------------------------------------------- @@ -154,13 +156,21 @@ TClonesArray* AliMUONTriggerDecision::Digits(Int_t DetectionPlane) } //_____________________________________________________________________________ -void AliMUONTriggerDecision::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) +void AliMUONTriggerDecision::AddDigit( + Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits, + Int_t digitindex + ) { // // Add a MUON digit to the list of Digits of the detection plane id + // Also adds the digit index to the corresponding fDigitIndices arrays. // TClonesArray &ldigits = *Digits(id); new(ldigits[ldigits.GetEntriesFast()]) AliMUONDigit(tracks,charges,digits); + + TArrayI& indices = fDigitIndices[id]; + indices.Set(indices.GetSize() + 1); + indices[indices.GetSize() - 1] = digitindex; } //---------------------------------------------------------------------- @@ -179,6 +189,8 @@ AliMUONTriggerDecision::~AliMUONTriggerDecision() delete fDigits; } + if (fDigitIndices) + delete [] fDigitIndices; } //---------------------------------------------------------------------- @@ -189,7 +201,7 @@ AliMUONTriggerDecision::operator=(const AliMUONTriggerDecision& rhs) if (this == &rhs) return *this; - Fatal("operator=", "Not implemented."); + AliFatal("Not implemented."); return *this; } @@ -291,13 +303,10 @@ void AliMUONTriggerDecision::SetBit(){ AliMUONTriggerCircuit* triggerCircuit; for (Int_t chamber = 11; chamber < 15; chamber++){ - // for (Int_t cathode=1; cathode<3; cathode++){ - // fMUONData->GetCathode(cathode-1); TClonesArray *muonDigits = Digits(chamber-1); Int_t ndigits = muonDigits->GetEntriesFast(); - if (fDebug>=3) - printf("\nFound %d digits in %p %d \n", ndigits, (void*)muonDigits,chamber-1); + AliDebug(3,Form("Found %d digits in %p %d", ndigits, (void*)muonDigits,chamber-1)); AliMUONDigit *mdig; @@ -307,8 +316,7 @@ void AliMUONTriggerDecision::SetBit(){ Int_t ix=mdig->PadX(); Int_t iy=mdig->PadY(); cathode = mdig->Cathode() + 1; - if (fDebug>=3) - printf("cathode %d ix %d iy %d \n",cathode,ix,iy); + AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); // get the sum of the coded charge // see coding convention in AliMUONChamberTrigger::DisIntegration @@ -316,6 +324,7 @@ void AliMUONTriggerDecision::SetBit(){ for (Int_t icharge=0; icharge<10; icharge++) { sumCharge=sumCharge+mdig->TrackCharge(icharge); } + // apply condition on soft background Int_t testCharge=sumCharge-(Int_t(sumCharge/10))*10; if(sumCharge<=10||testCharge>0) { @@ -327,6 +336,11 @@ void AliMUONTriggerDecision::SetBit(){ Int_t istrip; Int_t nStrip; + // If I want to fetch the digits as in MUONCheck.C then I need to + // know the correct digit index. These were stored in fDigitIndices + // by the digitizer so we just need to fetch the correct value. + Int_t digitindex = fDigitIndices[chamber-1][digit]; + if (cathode==1) { switch (chamber) { @@ -334,8 +348,11 @@ void AliMUONTriggerDecision::SetBit(){ for (icirc=0; icirc<234; icirc++) { triggerCircuit = (AliMUONTriggerCircuit*) fTriggerCircuit->At(icirc); for (istrip=0; istrip<16; istrip++) { - if (triggerCircuit->GetXcode(0,istrip)==code) + if (triggerCircuit->GetXcode(0,istrip)==code) + { fXbit11[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -344,7 +361,10 @@ void AliMUONTriggerDecision::SetBit(){ triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); for (istrip=0; istrip<16; istrip++) { if (triggerCircuit->GetXcode(1,istrip)==code) + { fXbit12[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -353,7 +373,10 @@ void AliMUONTriggerDecision::SetBit(){ triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); for (istrip=0; istrip<32; istrip++) { if (triggerCircuit->GetXcode(2,istrip)==code) + { fXbit21[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -362,7 +385,10 @@ void AliMUONTriggerDecision::SetBit(){ triggerCircuit = (AliMUONTriggerCircuit*)fTriggerCircuit->At(icirc); for (istrip=0; istrip<32; istrip++) { if (triggerCircuit->GetXcode(3,istrip)==code) + { fXbit22[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -377,7 +403,10 @@ void AliMUONTriggerDecision::SetBit(){ nStrip=triggerCircuit->GetNstripY(); for (istrip=0; istripGetYcode(0,istrip)==code) + { fYbit11[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -387,7 +416,10 @@ void AliMUONTriggerDecision::SetBit(){ nStrip=triggerCircuit->GetNstripY(); for (istrip=0; istripGetYcode(1,istrip)==code) + { fYbit12[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -397,7 +429,10 @@ void AliMUONTriggerDecision::SetBit(){ nStrip=triggerCircuit->GetNstripY(); for (istrip=0; istripGetYcode(2,istrip)==code) + { fYbit21[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -407,7 +442,10 @@ void AliMUONTriggerDecision::SetBit(){ nStrip=triggerCircuit->GetNstripY(); for (istrip=0; istripGetYcode(3,istrip)==code) + { fYbit22[icirc][istrip]=1; + DigitFiredCircuit(icirc, cathode-1, chamber-1, digitindex); + }; } } break; @@ -416,7 +454,7 @@ void AliMUONTriggerDecision::SetBit(){ } // remove soft background } // end loop on digit fMUONData->ResetDigits(); - // } // end loop on cathode +// } // end loop on cathode } // end loop on chamber } @@ -742,8 +780,8 @@ void AliMUONTriggerDecision::TrigX(Int_t ch1q[16], Int_t ch2q[16], // compare Left & Right deviations Int_t tmpLeftDev=0, tmpRightDev=0; for (j=0; j<5; j++){ - tmpLeftDev = tmpLeftDev + Int_t(leftDev[j]*TMath::Power(2,j)); - tmpRightDev = tmpRightDev + Int_t(rightDev[j]*TMath::Power(2,j)); + tmpLeftDev = tmpLeftDev + Int_t(leftDev[j]<ResetTrigger(); Trigger(); @@ -1415,9 +1454,9 @@ void AliMUONTriggerDecision::Digits2Trigger(){ localtr[2] = GetDev(icirc); localtr[3] = GetStripY11(icirc); for (Int_t i = 0; i < 2; i++) { // convert the Lut output in 1 digit - localtr[4] += Int_t(loLpt[i]*TMath::Power(2,i)); - localtr[5] += Int_t(loHpt[i]*TMath::Power(2,i)); - localtr[6] += Int_t(loApt[i]*TMath::Power(2,i)); + localtr[4] += Int_t(loLpt[i]<AddLocalTrigger(*pLocTrig); // add a local trigger in the list } } } //_______________________________________________________________________ -void AliMUONTriggerDecision::Trigger2Trigger() +void AliMUONTriggerDecision::ClearDigitNumbers() { -// copy trigger from TreeD to TreeR +// Clears the fDigitNumbers arrays so that they are all empty. - fMUONData->SetTreeAddress("GLT"); - fMUONData->GetTriggerD(); + for (Int_t i = 0; i < AliMUONConstants::NTriggerCircuit(); i++) + fDigitNumbers[i].Set(0); } //_______________________________________________________________________ -void AliMUONTriggerDecision::Trigger2Trigger(AliRawReader* /*rawReader*/) +void AliMUONTriggerDecision::DigitFiredCircuit( + Int_t circuit, Int_t cathode, + Int_t chamber, Int_t digit + ) { -// call the Trigger Algorithm from raw data and fill TreeR - - Fatal("Trigger2Trigger","Trigger not implemented for raw data input"); - +// Registers that the specified digit fired the specified circuit. +// This digit gets added to an array which will be copied to +// AliMUONLocalTrigger when such an object is created for each circuit. + + Int_t digitnumber = AliMUONLocalTrigger::EncodeDigitNumber(chamber, cathode, digit); + Int_t last = fDigitNumbers[circuit].GetSize(); + fDigitNumbers[circuit].Set(last + 1); + fDigitNumbers[circuit][last] = digitnumber; } +