extern AliRun* gAlice;
-AliTOFGeometry* AliTOFTrigger::fgTofGeo = NULL; // TOF geometry needed to get the minimial arrival time for each channel
-
+AliTOFTriggerMask* AliTOFTrigger:: fTOFTrigMap=NULL;
+AliTOFTriggerMask* AliTOFTrigger:: fTOFTrigMask=NULL;
//-------------------------------------------------------------------------
ClassImp(AliTOFTrigger)
fNCrateOn(0),
fNMaxipadOn(0),
fNMaxipadOnAll(0),
- fTOFTrigMask(0),
fStartTimeHit(0.0),
fTimeWidthTrigger(25.0)
SetName("TOF");
CreateInputs();
+ if(!fTOFTrigMap) fTOFTrigMap = new AliTOFTriggerMask();
+
}
//----------------------------------------------------------------------
fNCrateOn(0),
fNMaxipadOn(0),
fNMaxipadOnAll(0),
- fTOFTrigMask(0),
fStartTimeHit(startTimeWindow),
fTimeWidthTrigger(widthTimeWindow)
{
SetName("TOF");
CreateInputs();
+
+ if(!fTOFTrigMap) fTOFTrigMap = new AliTOFTriggerMask();
}
fSel4(tr.fSel4),
fNCrateOn(tr.fNCrateOn),
fNMaxipadOn(tr.fNMaxipadOn),
- fNMaxipadOnAll(tr.fNMaxipadOnAll),
- fTOFTrigMask(0)
+ fNMaxipadOnAll(tr.fNMaxipadOnAll)
{
//copy ctor
for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
fPowerMask[i] = fPowerMask[i-1]*2;
}
- if(tr.fTOFTrigMask){
- fTOFTrigMask = new AliTOFTriggerMask();
- fTOFTrigMask->SetTriggerMaskArray(tr.fTOFTrigMask->GetTriggerMaskArray());
- }
-
SetName(tr.GetName());
//fInputs=&(tr.GetInputs());
CreateInputs();
// Do not create inputs again!!
if( fInputs.GetEntriesFast() > 0 ) return;
- LoadActiveMask();
+ //LoadActiveMask();
fInputs.AddLast(new AliTriggerInput("TOF_Cosmic_MultiMuon_L0","TOF",0));
fInputs.AddLast(new AliTriggerInput("0OIN","TOF",0)); // was "TOF_pp_MB_L0"
fInputs.AddLast(new AliTriggerInput("0OM2","TOF",0)); // was "TOF_PbPb_MB2_L0"
fInputs.AddLast(new AliTriggerInput("0OM3","TOF",0)); // was "TOF_PbPb_MB3_L0"
fInputs.AddLast(new AliTriggerInput("0OUP","TOF",0)); // was "TOF_UltraPer_Coll_L0"
+ fInputs.AddLast(new AliTriggerInput("0OMU","TOF",0)); // new trigger (150 < DeltaPhi < 180) and 2 <= N_pad <= 6
fInputs.AddLast(new AliTriggerInput("0OHM","TOF",0)); // was "TOF_High_Mult_L0"
fInputs.AddLast(new AliTriggerInput("TOF_Jet_L1","TOF",0));
//----------------------------------------------------------------------
void AliTOFTrigger::Trigger() {
+ fTOFTrigMap->ResetMask();
+ if(!fTOFTrigMask) LoadActiveMask();
+
//triggering method
fSel1=0;
fSel2=0;
for (Int_t i=0;i<kNCTTM;i++){
for (Int_t j=0;j<kNCTTMchannels;j++){
- if (fCTTMmatrixFront[i][j]) nchonFront++;
+ if (fCTTMmatrixFront[i][j]){
+ nchonFront++;
+ fTOFTrigMap->SetON(i,j);
+ }
}
}
for (Int_t i=kNCTTM;i<(kNCTTM*2);i++){
for (Int_t j=0;j<kNCTTMchannels;j++){
- if (fCTTMmatrixBack[i-kNCTTM][j]) nchonBack++;
+ if (fCTTMmatrixBack[i-kNCTTM][j]){
+ nchonBack++;
+ fTOFTrigMap->SetON(i,j);
+ }
}
}
//printf("trigger On with AntiDeSlot \n");
}
- }
-
+ if(nchonTot >= 2 && nchonTot <= 6){
+ if(DeSlots >= 15 && DeSlots <= 18){
+ SetInput("0OMU");
+ }
+ else if(AntiDeSlots >= 15 && AntiDeSlots <= 18){
+ SetInput("0OMU");
+ }
+ }
+ }
}
}
}
//creating LTMMatrix
//initialization
CreateLTMMatrixFromDigits();
+ CreateCTTMMatrix();
}
//-------------------------------------------------------------------------
// 3 -> padz
// 4 -> padx
- if(! fgTofGeo) fgTofGeo = new AliTOFGeometry();
-
-
for (Int_t i=0;i<ndigits;i++){
AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i);
detind[0] = digit->GetSector();
Int_t indexLTM[2] = {-1,-1};
GetLTMIndex(detind,indexLTM);
- Float_t timedigit = digit->GetTdc()*AliTOFGeometry::TdcBinWidth()*1E-3; // time digit in ns
+ //Float_t timedigit = digit->GetTdc()*AliTOFGeometry::TdcBinWidth()*1E-3; // decalibrated time digit in ns
+ Float_t timedigit = digit->GetTdcND()*AliTOFGeometry::TdcBinWidth()*1E-3; // time digit in ns
Float_t pos[3];
- fgTofGeo->GetPosPar(detind, pos);
+ AliTOFGeometry::GetPosPar(detind, pos);
Float_t length = 0.;
for (Int_t ic = 0; ic < 3; ic++) length += pos[ic] * pos[ic];
length = TMath::Sqrt(length);
tofLoader->UnloadDigits();
// rl->UnloadgAlice();
- CreateCTTMMatrix();
}
//
// Create LTM matrix by TOF raw data
//
+ fTOFTrigMap->ResetMask();
//initialization
for (Int_t i=0;i<kNLTM;i++){
}
}
+//-----------------------------------------------------------------------------
+void AliTOFTrigger::PrepareTOFMapFromRaw(AliRawReader *fRawReader,Int_t deltaBC) {
+ //
+ // Create LTM matrix by TOF raw data
+ //
+ if(!fTOFTrigMap) fTOFTrigMap = new AliTOFTriggerMask();
+ fTOFTrigMap->ResetMask();
+ LoadActiveMask();
+
+ if(fRawReader){
+ AliTOFRawStream * tofRawStream = new AliTOFRawStream();
+
+ tofRawStream->SetRawReader(fRawReader);
+
+ TClonesArray staticRawData("AliTOFrawData",10000);
+ staticRawData.Clear();
+ TClonesArray * clonesRawData = &staticRawData;
+
+ Int_t indexDDL = 0;
+ Int_t iRawData = 0;
+ AliTOFrawData *tofRawDatum = 0;
+ for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
+
+ fRawReader->Reset();
+ tofRawStream->LoadRawDataBuffersV2(indexDDL);
+
+ clonesRawData = tofRawStream->GetRawData();
+ for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
+
+ tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
+
+ //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+ if (tofRawDatum->GetTOF()==-1) continue;
+
+ Int_t nTRM = tofRawDatum->GetTRM();
+ Int_t iChain = tofRawDatum->GetTRMchain();
+ Int_t iTDC = tofRawDatum->GetTDC();
+ Int_t iCH=tofRawDatum->GetTDCchannel();
+
+ if(nTRM==3 && iTDC>=12 && iTDC<=14 && indexDDL%2==1){ // DDL number to LTM number mapping
+ Int_t iLTMindex=-1;
+ Int_t iChannelIndex=-1;
+ switch(indexDDL%AliTOFGeometry::NDDL()){
+ case 1:
+ iLTMindex=1;
+ break;
+ case 3:
+ iLTMindex=36;
+ break;
+ default:
+ break;
+ }
+ iLTMindex+=2*(Int_t)(indexDDL/AliTOFGeometry::NDDL());
+ if(iChain==0 && indexDDL<36)
+ iLTMindex--;
+ if(iChain==0 && indexDDL>=36)
+ iLTMindex++;
+ iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
+ Int_t index[2]={iLTMindex,iChannelIndex};
+
+
+ if(fTOFTrigMask->IsON(index[0],index[1]) && TMath::Abs(tofRawDatum->GetTOF()-deltaBC) < 400) fTOFTrigMap->SetON(index[0],index[1]);
+ }
+
+ tofRawDatum = 0;
+ } // while loop
+
+ clonesRawData->Clear();
+
+ } // DDL Loop
+
+
+ delete tofRawStream;
+ tofRawStream = NULL;
+
+ }
+
+}
+//-----------------------------------------------------------------------------
+void AliTOFTrigger::PrepareTOFMapFromDigit(TTree *treeD) {
+ if(!fTOFTrigMap) fTOFTrigMap = new AliTOFTriggerMask();
+ LoadActiveMask();
+
+ fTOFTrigMap->ResetMask();
+ if (treeD == 0x0) {
+ return;
+ }
+ TBranch *branch = treeD->GetBranch("TOF");
+ if (!branch) {
+ return;
+ }
+ TClonesArray *tofDigits =new TClonesArray("AliTOFdigit", 1000);
+ branch->SetAddress(&tofDigits);
+ treeD->GetEvent(0);
+ Int_t ndigits = tofDigits->GetEntriesFast();
+ Int_t detind[5]; //detector indexes: 0 -> sector
+ // 1 -> plate(modulo)
+ // 2 -> strip
+ // 3 -> padz
+ // 4 -> padx
+
+ for (Int_t i=0;i<ndigits;i++){
+ AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i);
+ detind[0] = digit->GetSector();
+ detind[1] = digit->GetPlate();
+ detind[2] = digit->GetStrip();
+ detind[3] = digit->GetPadz();
+ detind[4] = digit->GetPadx();
+
+ Int_t indexLTM[2] = {-1,-1};
+ GetLTMIndex(detind,indexLTM);
+
+ if(fTOFTrigMask->IsON(indexLTM[0],indexLTM[1])) fTOFTrigMap->SetON(indexLTM[0],indexLTM[1]);
+ }
+
+}
//-----------------------------------------------------------------------------
void AliTOFTrigger::GetLTMIndex(const Int_t * const detind, Int_t *indexLTM) {
//
indexLTM[1] = detind[2]+19*2;
}
else{
- AliError("Smth Wrong!!!");
+ // AliError("Smth Wrong!!!");
}
}
else {
indexLTM[1] = detind[2]+26;
}
else{
- AliError("Smth Wrong!!!");
+ // AliError("Smth Wrong!!!");
}
}
//
// Create CTTM bit map
//
+
+ LoadActiveMask();
+
Int_t fromTriggertoDCS[72] = {0,1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,52,53,56,57,60,61,64,65,68,69,3,
2,7,6,11,10,15,14,19,18,23,22,27,26,31,30,35,34,39,38,43,42,47,46,51,50,55,54,59,58,63,62,67,66,71,70};