#include "AliTOFTrigger.h"
#include "AliTOFTriggerMask.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
+
extern AliRun* gAlice;
//-------------------------------------------------------------------------
fTOFTrigMask(0)
{
//main ctor
+ for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
+
for (Int_t i=0;i<kNLTM;i++){
- fLTMarray[i] = kFALSE; //*******************************************************************************************************
+
for (Int_t j=0;j<kNLTMchannels;j++){
fLTMmatrix[i][j]=kFALSE;
}
fTOFTrigMask(0)
{
//ctor with thresholds for triggers
+ for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
for (Int_t i=0;i<kNLTM;i++){
- fLTMarray[i] = kFALSE; //*******************************************************************************************************
for (Int_t j=0;j<kNLTMchannels;j++){
fLTMmatrix[i][j]=kFALSE;
}
CreateInputs();
}
+
+#if 0 /*** COPY CONSTRUCTOR SUPPRESSED **/
//____________________________________________________________________________
AliTOFTrigger::AliTOFTrigger(const AliTOFTrigger & tr):
fTOFTrigMask(0)
{
//copy ctor
+ for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i] = kFALSE;
for (Int_t i=0;i<kNLTM;i++){
- fLTMarray[i] = tr.fLTMarray[i];
for (Int_t j=0;j<kNLTMchannels;j++){
fLTMmatrix[i][j]=tr.fLTMmatrix[i][j];
}
CreateInputs();
}
+#endif /*** COPY CONTRUCTOR SUPPRESSED ***/
//----------------------------------------------------------------------
//
//initialization
+ for (Int_t i=0;i<kNCTTM;i++) fLTMarray[i]= kFALSE;
for (Int_t i=0;i<kNLTM;i++){
- fLTMarray[i]= kFALSE;
for (Int_t j=0;j<kNLTMchannels;j++){
fLTMmatrix[i][j]=kFALSE;
}
}
+ for (Int_t i=0;i<kNCTTM;i++){
+ for (Int_t j=0;j<kNCTTMchannels;j++){
+ fCTTMmatrixFront[i][j]=kFALSE;
+ fCTTMmatrixBack[i][j]=kFALSE;
+ }
+ }
+
+
AliRunLoader *rl;
rl = AliRunLoader::Instance();
tofLoader->LoadDigits("read");
TTree *treeD = tofLoader->TreeD();
- if (treeD == 0x0)
- {
- AliFatal("AliTOFTrigger: Can not get TreeD");
- }
+ if (treeD == 0x0) {
+ AliFatal("AliTOFTrigger: Can not get TreeD");
+ return;
+ }
TBranch *branch = treeD->GetBranch("TOF");
if (!branch) {
GetLTMIndex(detind,indexLTM);
fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE;
- fLTMarray[indexLTM[0]%36] = kTRUE; //dimensione MAX array 36 = kNCTTM
+// fLTMarray[indexLTM[0]%36] = kTRUE; //dimensione MAX array 36 = kNCTTM
}
- fNCrateOn = 0;
- for(Int_t j=0; j < kNCTTM; j++) {if(fLTMarray[j]) fNCrateOn++;}
tofLoader->UnloadDigits();
fLTMmatrix[i][j]=kFALSE;
}
}
+ for (Int_t i=0;i<kNCTTM;i++){
+ for (Int_t j=0;j<kNCTTMchannels;j++){
+ fCTTMmatrixFront[i][j]=kFALSE;
+ fCTTMmatrixBack[i][j]=kFALSE;
+ }
+ }
if(fRawReader){
AliTOFRawStream * tofRawStream = new AliTOFRawStream();
for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
fRawReader->Reset();
- tofRawStream->LoadRawData(indexDDL);
+ tofRawStream->LoadRawDataBuffersV2(indexDDL);
clonesRawData = tofRawStream->GetRawData();
if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
//if (fVerbose==2) ftxt.close();
if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
+ delete tofRawStream;
+ tofRawStream = NULL;
}
*/
//-------------------------------------------------------------------------
+void AliTOFTrigger::GetMapMatrix(Bool_t map[][24]) const
+{
+ //
+ // Returns CTTM map
+ //
+
+ for(Int_t i = 0; i<kNLTM;i++)
+ for(Int_t j = 0; j<kNCTTMchannels;j++)
+ map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i-36][j];
+
+}
+//-------------------------------------------------------------------------
+
void AliTOFTrigger::GetMap(Bool_t **map) const
{
//
for(Int_t i = 0; i<kNLTM;i++)
for(Int_t j = 0; j<kNCTTMchannels;j++)
- map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i][j];
+ map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i-36][j];
}
+
//-------------------------------------------------------------------------
void AliTOFTrigger::GetTRDmap(Bool_t **map) const
{
//
// Retriev the bit map sent to the TRD detector
//
+
+ for(int i = 0; i<kNLTM;i++)
+ for(int j = 0; j<kNLTMtoTRDchannels;j++){
+ map[i][j]=kFALSE;
+ }
- for(int i = 0; i<kNLTM;i++)
- for(int j = 0; j<kNLTMtoTRDchannels;j++)
- map[i][j]=kFALSE;
-
- for(int i = 0; i<kNLTM/2;i++)
+ for(int i = 0; i<kNLTM/2;i++)
for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
- UInt_t uTRDbit=j/3;
- if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE;
+ UInt_t uTRDbit=j/3;
+ if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE;
}
for(int i = kNLTM/2; i<kNLTM;i++)
+ for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
+ UInt_t uTRDbit=j/3;
+ if(fCTTMmatrixBack[i-kNLTM/2][j]) map[i][uTRDbit]=kTRUE;
+ }
+
+}
+//-------------------------------------------------------------------------
+void AliTOFTrigger::GetTRDmapMatrix(Bool_t map[][8]) const
+{
+ //
+ // Retriev the bit map sent to the TRD detector
+ //
+
+ for(int i = 0; i<kNLTM;i++)
+ for(int j = 0; j<kNLTMtoTRDchannels;j++){
+ map[i][j]=kFALSE;
+ }
+
+ for(int i = 0; i<kNLTM/2;i++)
for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
- UInt_t uTRDbit=j/3;
- if(fCTTMmatrixBack[i][j]) map[i][uTRDbit]=kTRUE;
+ UInt_t uTRDbit=j/3;
+ if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE;
}
+ for(int i = kNLTM/2; i<kNLTM;i++)
+ for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
+ UInt_t uTRDbit=j/3;
+ if(fCTTMmatrixBack[i-kNLTM/2][j]) map[i][uTRDbit]=kTRUE;
+ }
+
}
//-------------------------------------------------------------------------
if(index[0]<36)
fCTTMmatrixFront[index[0]][index[1]]=kTRUE;
else
- fCTTMmatrixBack[index[0]][index[1]]=kTRUE;
+ fCTTMmatrixBack[index[0]-36][index[1]]=kTRUE;
}
// labelled by number nDDL, nTRM, iChain, iTDC, iCH
//
- if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1){ // DDL number to LTM number mapping
+ if(nTRM==3 && iTDC>=12 && iTDC<=14 && nDDL%2==1){ // DDL number to LTM number mapping
+// getchar();
Int_t iLTMindex=-1;
Int_t iChannelIndex=-1;
switch(nDDL%AliTOFGeometry::NDDL()){
iLTMindex++;
iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
Int_t index[2]={iLTMindex,iChannelIndex};
- if (index[0]<36)
+ if (index[0]<36){
fCTTMmatrixFront[index[0]][index[1]]=kTRUE;
- else
- fCTTMmatrixBack[index[0]][index[1]]=kTRUE;
- }
- else
- AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
+ fLTMmatrix[index[0]][index[1]*2]=kTRUE;
+ }
+ else{
+ fCTTMmatrixBack[index[0]-36][index[1]]=kTRUE;
+ fLTMmatrix[index[0]][index[1]*2]=kTRUE;
+ }
+ }
}
//-------------------------------------------------------------------------
if(index[0]<36)
fCTTMmatrixFront[index[0]][index[1]]=kFALSE;
else
- fCTTMmatrixBack[index[0]][index[1]]=kFALSE;
+ fCTTMmatrixBack[index[0]-36][index[1]]=kFALSE;
}
iLTMindex++;
iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
Int_t index[2]={iLTMindex,iChannelIndex};
- if (index[0]<36)
+ if (index[0]<36){
fCTTMmatrixFront[index[0]][index[1]]=kFALSE;
- else
- fCTTMmatrixBack[index[0]][index[1]]=kFALSE;
+ }
+ else{
+ fCTTMmatrixBack[index[0]-36][index[1]]=kFALSE;
+ }
}
else
AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
Int_t index[2];
GetCTTMIndex(detind,index);
- return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]][index[1]];
+ return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]-36][index[1]];
}
iLTMindex++;
iChannelindex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
Int_t index[2]={iLTMindex,iChannelindex};
- return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]][index[1]];
+ return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]-36][index[1]];
}
//
// Create CTTM bit map
//
+ 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};
+
+
fNMaxipadOnAll=0;
fNMaxipadOn=0;
for(Int_t i = 0; i<kNLTM;i++){
UInt_t currentMask = fPowerMask[kNCTTMchannels]-1;
- if(fTOFTrigMask) currentMask=fTOFTrigMask->GetTriggerMask(i);
+ if(fTOFTrigMask) currentMask=fTOFTrigMask->GetTriggerMask(fromTriggertoDCS[i]);
if(i<kNCTTM){
for(Int_t j = 0; j<kNCTTMchannels;j++){
fCTTMmatrixFront[i][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1];
if(fCTTMmatrixFront[i][j]) fNMaxipadOnAll++;
if(!(currentMask & fPowerMask[j])) fCTTMmatrixFront[i][j]=0;
- if(fCTTMmatrixFront[i][j]) fNMaxipadOn++;
+ if(fCTTMmatrixFront[i][j]){
+ fNMaxipadOn++;
+ fLTMarray[i] = kTRUE;
+ }
}
}
else{
fCTTMmatrixBack[i-kNCTTM][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1];;
if(fCTTMmatrixBack[i-kNCTTM][j]) fNMaxipadOnAll++;
if(!(currentMask & fPowerMask[j])) fCTTMmatrixBack[i-kNCTTM][j]=0;
- if(fCTTMmatrixBack[i-kNCTTM][j]) fNMaxipadOn++;
+ if(fCTTMmatrixBack[i-kNCTTM][j]){
+ fNMaxipadOn++;
+ fLTMarray[i-kNCTTM] = kTRUE;
+ }
}
}
}
+
+ fNCrateOn = 0;
+ for(Int_t j=0; j < kNCTTM; j++) {if(fLTMarray[j]) fNCrateOn++;}
+
}
//-----------------------------------------------------------------------------
//
// Load OCDB current mask
//
- UInt_t maskArray[kNLTM];
- if(fTOFTrigMask == NULL) fTOFTrigMask = new AliTOFTriggerMask();
- for (Int_t k = 0; k < kNLTM ; k++) maskArray[k] = fPowerMask[kNCTTMchannels]-1;
- for (Int_t k = 0; k < kNLTM ; k+=2) maskArray[k] = 0;
+
+ AliCDBManager *cdb = AliCDBManager::Instance();
+ if(cdb->GetRun() < 0 || !(cdb->GetDefaultStorage())){
+ if(!(cdb->GetDefaultStorage())){
+ cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ printf("AliTOFTrigger (WARNING): probably CDB first instance - Default Sorage set to \"local://$ALICE_ROOT/OCDB\"\n");
+ }
+ if(cdb->GetRun() < 0){
+ cdb->SetRun(0);
+ printf("AliTOFTrigger (WARNING): probably CDB first instance - number of run set to 0\n");
+ }
+ }
+
+ AliCDBEntry *cdbe = cdb->Get("TRIGGER/TOF/TriggerMask");
+ if(!cdbe) return;
+ fTOFTrigMask= (AliTOFTriggerMask *)cdbe->GetObject();
+
+// UInt_t maskArray[kNLTM];
+// if(fTOFTrigMask == NULL) fTOFTrigMask = new AliTOFTriggerMask();
+// for (Int_t k = 0; k < kNLTM ; k++) maskArray[k] = fPowerMask[kNCTTMchannels]-1;
+// //for (Int_t k = 0; k < kNLTM ; k+=2) maskArray[k] = 0;
- fTOFTrigMask->SetTriggerMaskArray(maskArray);
+// fTOFTrigMask->SetTriggerMaskArray(maskArray);
}
{
// dtor
- if (fTOFTrigMask) delete fTOFTrigMask;
-
}
//-----------------------------------------------------------------------------
return *this;
}
+