#include "AliRawReaderRoot.h"
#include "AliRawReaderDate.h"
#include "AliTPCRawStream.h"
-#include "AliTPCRawStreamFast.h"
#include "AliTPCCalROC.h"
#include "AliTPCROC.h"
#include "AliMathBase.h"
#include "TTreeStream.h"
+#include "AliTPCRawStreamFast.h"
//date
#include "event.h"
fOldRCUformat(kTRUE),
fTimeAnalysis(kFALSE),
fROC(AliTPCROC::Instance()),
+ fMapping(NULL),
fCalRocArrayPedestal(72),
fCalRocArrayRMS(72),
fHistoPedestalArray(72),
fOldRCUformat(ped.fOldRCUformat),
fTimeAnalysis(ped.fTimeAnalysis),
fROC(AliTPCROC::Instance()),
+ fMapping(NULL),
fCalRocArrayPedestal(72),
fCalRocArrayRMS(72),
fHistoPedestalArray(72),
delete [] fTimeSignal;
fTimeSignal = 0;
}
+
+ // do not delete fMapping, because we do not own it.
+
}
Int_t iChannel = fROC->GetRowIndexes(icsector)[icRow]+icPad; // global pad position in sector
- // fast filling methode.
+ // fast filling method
// Attention: the entry counter of the histogram is not increased
// this means that e.g. the colz draw option gives an empty plot
Int_t bin = (iChannel+1)*(fAdcMax-fAdcMin+2)+((Int_t)csignal-fAdcMin+1);
return 0;
}
+
+
//_____________________________________________________________________
Bool_t AliTPCCalibPedestal::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast)
{
//
// Event processing loop - AliRawReader
//
- printf("ProcessEventFast - raw reader\n");
-
- AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader);
+ AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping);
Bool_t res=ProcessEventFast(rawStreamFast);
delete rawStreamFast;
return res;
}
+
//_____________________________________________________________________
Bool_t AliTPCCalibPedestal::ProcessEvent(AliTPCRawStream *rawStream)
{
Bool_t withInput = kFALSE;
while (rawStream->Next()) {
+
Int_t iSector = rawStream->GetSector(); // current ROC
Int_t iRow = rawStream->GetRow(); // current row
Int_t iPad = rawStream->GetPad(); // current pad
Update(iSector,iRow,iPad,iTimeBin,signal);
withInput = kTRUE;
}
+
return withInput;
}
+
+
//_____________________________________________________________________
Bool_t AliTPCCalibPedestal::ProcessEvent(AliRawReader *rawReader)
{
// Event processing loop - AliRawReader
//
- AliTPCRawStream rawStream(rawReader);
+ // if fMapping is NULL the rawstream will crate its own mapping
+ AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping);
rawReader->Select("TPC");
return ProcessEvent(&rawStream);
}
//_____________________________________________________________________
TH2F* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
- Int_t nbinsY, Float_t ymin, Float_t ymax,
- Char_t *type, Bool_t force)
+ Int_t nbinsY, Float_t ymin, Float_t ymax,
+ Char_t *type, Bool_t force)
{
//
// return pointer to Q histogram
class AliTPCRawStream;
class AliTPCRawStreamFast;
class AliRawReader;
+class AliTPCAltroMapping;
struct eventHeaderStruct;
AliTPCCalibPedestal& operator = (const AliTPCCalibPedestal &source);
Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
- Bool_t ProcessEventFast(AliRawReader *rawReader);
+ Bool_t ProcessEventFast(AliRawReader *rawReader);
Bool_t ProcessEvent(AliTPCRawStream *rawStream);
Bool_t ProcessEvent(AliRawReader *rawReader);
const Int_t iTimeBin, const Float_t signal);
void Analyse();
//
+ AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
+ void SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
+ //
AliTPCCalROC* GetCalRocPedestal (Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE); // get calibration object - sector
const TObjArray* GetCalPadPedestal (){return &fCalRocArrayPedestal;} // get calibration object
Bool_t fTimeAnalysis; //! Should we use the time dependent analysis? ONLY ON LDC!
AliTPCROC *fROC; //! ROC information
+ AliTPCAltroMapping **fMapping; //! Altro Mapping object
TObjArray fCalRocArrayPedestal; // Array of AliTPCCalROC class for Time0 calibration
TObjArray fCalRocArrayRMS; // Array of AliTPCCalROC class for signal width calibration
AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force);
public:
- ClassDef(AliTPCCalibPedestal, 2) // Implementation of the TPC pedestal and noise calibration
+ ClassDef(AliTPCCalibPedestal, 4) // Implementation of the TPC pedestal and noise calibration
};
fPrevRow(-1),
fPad(-1),
fPrevPad(-1),
- fIsMapOwner(kTRUE)
+ fIsMapOwner(kFALSE)
{
// create an object to read TPC raw digits
path2 += ".data";
fMapping[i] = new AliTPCAltroMapping(path2.Data());
}
+ fIsMapOwner = kTRUE;
}
else {
for(Int_t i = 0; i < 6; i++)
#include "AliRawReaderDate.h"
#include "AliTPCmapper.h"
#include "AliTPCRawStream.h"
-#include "AliTPCAltroMapping.h"
#include "AliTPCROC.h"
#include "AliTPCCalROC.h"
#include "AliTPCCalPad.h"
status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root");
if (status) {
printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status);
- printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- //return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ printf("Continue anyway ... maybe it works?\n"); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ //return -1; // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
/* open the mapping file and retrieve mapping object */
- TFile *fileMapping = new TFile(MAPPING_FILE, "read");
AliTPCmapper *mapping = 0; // The TPC mapping
+ TFile *fileMapping = new TFile(MAPPING_FILE, "read");
mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
if (mapping == 0) {
printf("Failed to get mapping object from %s. Exiting ...\n", MAPPING_FILE);
} else {
printf("Got mapping object from %s\n", MAPPING_FILE);
}
- AliTPCAltroMapping **altromapp = mapping->GetAltroMapping();
- AliTPCCalibPedestal calibPedestal; // pedestal and noise calibration
- calibPedestal.SetTimeAnalysis(timeAnalysis); // pedestal(t) calibration
- calibPedestal.SetAltroMapping(altromapp); // Use altro mapping we got from daqDetDb
+ AliTPCCalibPedestal calibPedestal; // pedestal and noise calibration
+ calibPedestal.SetTimeAnalysis(timeAnalysis); // pedestal(t) calibration
+ calibPedestal.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
/* loop over RAW data files */
int nevents=0;
continue;
/* retry if got no event */
- if (event==NULL) {
+ if (event==NULL)
continue;
- }
nevents++;
// Pedestal calibration
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
- calibPedestal.ProcessEvent(rawReader);
+ //calibPedestal.ProcessEvent(rawReader);
+ calibPedestal.ProcessEventFast(rawReader); // fast data reader
delete rawReader;
/* free resources */
Float_t rms = 0.;
Float_t ctr = 0.;
for ( int channel = 0; channel < 16; channel++ ) {
- Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
- Int_t row = mapping->GetPadRow(patch, hwadd);
- Int_t pad = mapping->GetPad(patch, hwadd);
- Float_t ped = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
+ Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
+ Int_t row = mapping->GetPadRow(patch, hwadd); // row in a ROC
+ Int_t globalrow = mapping->GetGlobalPadRow(patch, hwadd); // row in full sector
+ Int_t pad = mapping->GetPad(patch, hwadd);
+ Float_t ped = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
// fixed pedestal
if ( ped > 1.e-10 ) {
pedfile << ctr_channel << "\t" << side << "\t" << sector << "\t" << patch << "\t"
ctr_channel++;
}
// pedestal(t)
- if ( timePed && fabs(timePed[row][pad].GetSum()) > 1e-10 ) {
+ if ( timePed && fabs(timePed[globalrow][pad].GetSum()) > 1e-10 ) {
pedmemfile << ctr_pattern << "\t" << side << "\t" << sector << "\t" << patch
<< "\t" << hwadd;
for ( Int_t timebin = 0; timebin < 1024; timebin++ )
- pedmemfile << "\t" << timePed[row][pad].At(timebin);
+ pedmemfile << "\t" << timePed[globalrow][pad].At(timebin);
pedmemfile << std::endl;
ctr_pattern++;
}