#include <TDirectory.h>
#include <TTreeStream.h>
#include <TVectorD.h>
+#include <TLinearFitter.h>
#include "AliLog.h"
#include "AliTRDCalibraVdriftLinearFit.h"
#include "AliTRDcalibDB.h"
#include "AliTRDCommonParam.h"
-#include "AliTRDmcmTracklet.h"
-#include "AliTRDmcm.h"
-#include "AliTRDtrigParam.h"
#include "AliTRDpadPlane.h"
#include "AliTRDcluster.h"
#include "AliTRDtrack.h"
:TObject()
,fGeo(0)
,fIsHLT(kFALSE)
- ,fMcmCorrectAngle(kFALSE)
,fCH2dOn(kFALSE)
,fPH2dOn(kFALSE)
,fPRF2dOn(kFALSE)
,fNumberTrack(0)
,fTimeMax(0)
,fSf(10.0)
- ,fNumberBinCharge(100)
- ,fNumberBinPRF(40)
- ,fNgroupprf(0)
+ ,fNumberBinCharge(50)
+ ,fNumberBinPRF(10)
+ ,fNgroupprf(3)
,fAmpTotal(0x0)
,fPHPlace(0x0)
,fPHValue(0x0)
:TObject(c)
,fGeo(0)
,fIsHLT(c.fIsHLT)
- ,fMcmCorrectAngle(c.fMcmCorrectAngle)
,fCH2dOn(c.fCH2dOn)
,fPH2dOn(c.fPH2dOn)
,fPRF2dOn(c.fPRF2dOn)
TLinearFitter *f = (TLinearFitter*)fLinearFitterArray.At(idet);
if(f) { delete f;}
}
+ if(fLinearVdriftFit) delete fLinearVdriftFit;
if (fGeo) {
delete fGeo;
}
// calibration with AliTRDtrackV1: Init, Update
//////////////////////////////////////////////////////////////////////////////////
//____________Functions for initialising the AliTRDCalibraFillHisto in the code_________
-Bool_t AliTRDCalibraFillHisto::Init2Dhistos()
+Bool_t AliTRDCalibraFillHisto::Init2Dhistos(Int_t nboftimebin)
{
//
// Init the histograms and stuff to be filled
}
// Some parameters
- fTimeMax = cal->GetNumberOfTimeBins();
+ if(nboftimebin > 0) fTimeMax = nboftimebin;
+ else fTimeMax = cal->GetNumberOfTimeBinsDCS();
+ if(fTimeMax <= 0) fTimeMax = 30;
fSf = parCom->GetSamplingFrequency();
if(!fNormalizeNbOfCluster) fRelativeScale = 20.0;
else fRelativeScale = 1.18;
fCalibraVector->SetDetCha0(k,fCalibraMode->GetDetChamb0(k));
fCalibraVector->SetDetCha2(k,fCalibraMode->GetDetChamb2(k));
}
- TString namech("Nz");
- namech += fCalibraMode->GetNz(0);
- namech += "Nrphi";
- namech += fCalibraMode->GetNrphi(0);
- fCalibraVector->SetNameCH((const char* ) namech);
- TString nameph("Nz");
- nameph += fCalibraMode->GetNz(1);
- nameph += "Nrphi";
- nameph += fCalibraMode->GetNrphi(1);
- fCalibraVector->SetNamePH((const char* ) nameph);
- TString nameprf("Nz");
- nameprf += fCalibraMode->GetNz(2);
- nameprf += "Nrphi";
- nameprf += fCalibraMode->GetNrphi(2);
- nameprf += "Ngp";
- nameprf += fNgroupprf;
- fCalibraVector->SetNamePRF((const char* ) nameprf);
+ fCalibraVector->SetNzNrphi(0,fCalibraMode->GetNz(0),fCalibraMode->GetNrphi(0));
+ fCalibraVector->SetNzNrphi(1,fCalibraMode->GetNz(1),fCalibraMode->GetNrphi(1));
+ fCalibraVector->SetNzNrphi(2,fCalibraMode->GetNz(2),fCalibraMode->GetNrphi(2));
+ fCalibraVector->SetNbGroupPRF(fNgroupprf);
}
// Create the 2D histos corresponding to the pad groupCalibration mode
}
}
if (fLinearFitterOn) {
- //fLinearFitterArray.Expand(540);
- fLinearFitterArray.SetName("ArrayLinearFitters");
- fEntriesLinearFitter = new Int_t[540];
- for(Int_t k = 0; k < 540; k++){
- fEntriesLinearFitter[k] = 0;
+ if(fLinearFitterDebugOn) {
+ fLinearFitterArray.SetName("ArrayLinearFitters");
+ fEntriesLinearFitter = new Int_t[540];
+ for(Int_t k = 0; k < 540; k++){
+ fEntriesLinearFitter[k] = 0;
+ }
}
fLinearVdriftFit = new AliTRDCalibraVdriftLinearFit();
}
}
//____________Offline tracking in the AliTRDtracker____________________________
-Bool_t AliTRDCalibraFillHisto::UpdateHistograms(AliTRDtrack *t)
+Bool_t AliTRDCalibraFillHisto::UpdateHistograms(const AliTRDtrack *t)
{
//
// Use AliTRDtrack for the calibration
}
//____________Offline tracking in the AliTRDtracker____________________________
-Bool_t AliTRDCalibraFillHisto::UpdateHistogramsV1(AliTRDtrackV1 *t)
+Bool_t AliTRDCalibraFillHisto::UpdateHistogramsV1(const AliTRDtrackV1 *t)
{
//
// Use AliTRDtrackV1 for the calibration
// loop over the clusters
////////////////////////////
Int_t nbclusters = 0;
- for(int jc=0; jc<AliTRDseed::knTimebins; jc++){
+ for(int jc=0; jc<AliTRDseedV1::kNtb; jc++){
if(!(cl = tracklet->GetClusters(jc))) continue;
nbclusters++;
// Fill the stuffs if a good tracklet
////////////////////////////////////////
if (fGoodTracklet) {
-
+
// drift velocity unables to cut bad tracklets
Bool_t pass = FindP1TrackPHtrackletV1(tracklet, nbclusters);
+ //printf("pass %d and nbclusters %d\n",pass,nbclusters);
+
// Gain calibration
if (fCH2dOn) {
FillTheInfoOfTheTrackCH(nbclusters);
// Routine inside the update with AliTRDtrack
///////////////////////////////////////////////////////////////////////////////////
//____________Offine tracking in the AliTRDtracker_____________________________
-Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtracklet(AliTRDtrack *t, Int_t index0, Int_t index1)
+Bool_t AliTRDCalibraFillHisto::FindP1TrackPHtracklet(const AliTRDtrack *t, Int_t index0, Int_t index1)
{
//
// Drift velocity calibration:
Double_t tgl = t->GetTglPlane(GetLayer(detector)); // dz/dl and not dz/dx!
Double_t tnp = 0.0; // tan angle in the plan xy track
if( TMath::Abs(snp) < 1.){
- tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+ tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
}
Float_t dzdx = tgl*TMath::Sqrt(1+tnp*tnp); // dz/dx now from dz/dl
// tilting pad and cross row
//Add to the linear fitter of the detector
if( TMath::Abs(snp) < 1.){
Double_t x = tnp-dzdx*tnt;
- (GetLinearFitter(detector,kTRUE))->AddPoint(&x,dydt);
if(fLinearFitterDebugOn) {
- fLinearVdriftFit->Update(detector,x,pars[1]);
+ (GetLinearFitter(detector,kTRUE))->AddPoint(&x,dydt);
+ fEntriesLinearFitter[detector]++;
}
- fEntriesLinearFitter[detector]++;
+ fLinearVdriftFit->Update(detector,x,pars[1]);
}
}
Double_t snp = tracklet->GetSnp(); // sin dy/dx at the end of the chamber
Double_t tnp = 0.0; // dy/dx at the end of the chamber
if( TMath::Abs(snp) < 1.){
- tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+ tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
}
Double_t tgl = tracklet->GetTgl(); // dz/dl
Double_t dzdx = tgl*TMath::Sqrt(1+tnp*tnp); // dz/dx calculated from dz/dl
////////////////////////////
Int_t nbli = 0;
AliTRDcluster *cl = 0x0;
- for(int ic=0; ic<AliTRDseed::knTimebins; ic++){
+ for(int ic=0; ic<AliTRDseedV1::kNtb; ic++){
if(!(cl = tracklet->GetClusters(ic))) continue;
if((fLimitChargeIntegration) && (!cl->IsInChamber())) continue;
fLinearFitterTracklet->AddPoint(&timeis,ycluster,1);
nbli++;
+ //////////////////////////////
+ // Check no shared clusters
+ //////////////////////////////
+ for(int icc=AliTRDseedV1::kNtb; icc<AliTRDseedV1::kNclusters; icc++){
+ if((cl = tracklet->GetClusters(icc))) crossrow = 1;
+ }
}
////////////////////////////////////
//Add to the linear fitter of the detector
if( TMath::Abs(snp) < 1.){
Double_t x = tnp-dzdx*tnt;
- (GetLinearFitter(fDetectorPreviousTrack,kTRUE))->AddPoint(&x,dydt);
if(fLinearFitterDebugOn) {
- fLinearVdriftFit->Update(fDetectorPreviousTrack,x,pars[1]);
+ (GetLinearFitter(fDetectorPreviousTrack,kTRUE))->AddPoint(&x,dydt);
+ fEntriesLinearFitter[fDetectorPreviousTrack]++;
}
- fEntriesLinearFitter[fDetectorPreviousTrack]++;
+ fLinearVdriftFit->Update(fDetectorPreviousTrack,x,pars[1]);
}
}
return kTRUE;
}
//____________Offine tracking in the AliTRDtracker_____________________________
-Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(AliTRDtrack *t, Int_t index0, Int_t index1)
+Bool_t AliTRDCalibraFillHisto::HandlePRFtracklet(const AliTRDtrack *t, Int_t index0, Int_t index1)
{
//
// PRF width calibration
Float_t dzdx = 0.0; // dzdx
Float_t tnp = 0.0;
if(TMath::Abs(snp) < 1.0){
- tnp = snp / (TMath::Sqrt(1-snp*snp));
+ tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
dzdx = tgl*TMath::Sqrt(1+tnp*tnp);
}
// linear fitter
for(Int_t k = 0; k < npoints; k++){
//Take the cluster
AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
+ if(!cl) continue;
Short_t *signals = cl->GetSignals();
- Double_t time = cl->GetLocalTimeBin();
+ Double_t time = cl->GetPadTime();
//Calculate x if possible
Float_t xcenter = 0.0;
Bool_t echec1 = kTRUE;
for(Int_t k = 0; k < npoints; k++){
//Take the cluster
AliTRDcluster *cl = (AliTRDcluster *) t->GetCluster(k+index0);
- Short_t *signals = cl->GetSignals(); // signal
- Double_t time = cl->GetLocalTimeBin(); // time bin
+ Short_t *signals = cl->GetSignals(); // signal
+ Double_t time = cl->GetPadTime(); // time bin
Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
Float_t padPos = cl->GetPadCol(); // middle pad
Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
Double_t snp = tracklet->GetSnp(); // sin dy/dx at the end of the chamber
Double_t tnp = 0.0; // dy/dx at the end of the chamber
if( TMath::Abs(snp) < 1.){
- tnp = snp / (TMath::Sqrt(1-(snp*snp)));
+ tnp = snp / TMath::Sqrt((1.-snp)*(1.+snp));
}
Double_t tgl = tracklet->GetTgl(); // dz/dl
Double_t dzdx = tgl*TMath::Sqrt(1+tnp*tnp); // dz/dx calculated from dz/dl
//////////////////////
Int_t nb3pc = 0; // number of three pads clusters used for fit
- Double_t *padPositions; // to see the difference between the fit and the 3 pad clusters position
- padPositions = new Double_t[AliTRDseed::knTimebins];
- for(Int_t k = 0; k < AliTRDseed::knTimebins; k++){
- padPositions[k] = 0.0;
- }
+ // to see the difference between the fit and the 3 pad clusters position
+ Double_t padPositions[AliTRDseedV1::kNtb];
+ memset(padPositions, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
fLinearFitterTracklet->ClearPoints();
//printf("loop clusters \n");
// loop over the clusters
////////////////////////////
AliTRDcluster *cl = 0x0;
- for(int ic=0; ic<AliTRDseed::knTimebins; ic++){
+ for(int ic=0; ic<AliTRDseedV1::kNtb; ic++){
+ // reject shared clusters on pad row
+ if((ic+AliTRDseedV1::kNtb) < AliTRDseedV1::kNclusters) {
+ if((cl = tracklet->GetClusters(ic+AliTRDseedV1::kNtb))) continue;
+ }
if(!(cl = tracklet->GetClusters(ic))) continue;
-
- Double_t time = cl->GetLocalTimeBin();
+ Double_t time = cl->GetPadTime();
if((time<=7) || (time>=21)) continue;
Short_t *signals = cl->GetSignals();
Float_t xcenter = 0.0;
// fit with a straight line
/////////////////////////////
if(nb3pc < 3){
- delete [] padPositions;
fLinearFitterTracklet->ClearPoints();
- delete [] padPositions;
return kFALSE;
}
fLinearFitterTracklet->Eval();
////////////////////////////////////////////////
// Fill the PRF: Second loop over clusters
//////////////////////////////////////////////
- for(int ic=0; ic<AliTRDseed::knTimebins; ic++){
+ for(int ic=0; ic<AliTRDseedV1::kNtb; ic++){
+ // reject shared clusters on pad row
+ if(((ic+AliTRDseedV1::kNtb) < AliTRDseedV1::kNclusters) && (cl = tracklet->GetClusters(ic+AliTRDseedV1::kNtb))) continue;
+ //
if(!(cl = tracklet->GetClusters(ic))) continue;
Short_t *signals = cl->GetSignals(); // signal
- Double_t time = cl->GetLocalTimeBin(); // time bin
+ Double_t time = cl->GetPadTime(); // time bin
Float_t padPosTracklet = line[0]+line[1]*time; // reconstruct position from fit
Float_t padPos = cl->GetPadCol(); // middle pad
Double_t dpad = padPosTracklet - padPos; // reconstruct position relative to middle pad from fit
} // second loop over clusters
- delete [] padPositions;
return kTRUE;
-
}
///////////////////////////////////////////////////////////////////////////////////////
// Pad row col stuff: see if masked or not
///////////////////////////////////////////////////////////////////////////////////////
//_____________________________________________________________________________
-void AliTRDCalibraFillHisto::CheckGoodTrackletV1(AliTRDcluster *cl)
+void AliTRDCalibraFillHisto::CheckGoodTrackletV1(const AliTRDcluster *cl)
{
//
// See if we are not near a masked pad
}
//_____________________________________________________________________________
-void AliTRDCalibraFillHisto::CheckGoodTrackletV0(Int_t detector, Int_t row, Int_t col)
+void AliTRDCalibraFillHisto::CheckGoodTrackletV0(const Int_t detector,const Int_t row,const Int_t col)
{
//
// See if we are not near a masked pad
// Per tracklet: store or reset the info, fill the histos with the info
//////////////////////////////////////////////////////////////////////////////////////////
//_____________________________________________________________________________
-void AliTRDCalibraFillHisto::StoreInfoCHPHtrack(AliTRDcluster *cl, Double_t dqdl, Int_t *group, Int_t row, Int_t col)
+void AliTRDCalibraFillHisto::StoreInfoCHPHtrack(const AliTRDcluster *cl,const Double_t dqdl,const Int_t *group,const Int_t row,const Int_t col)
{
//
// Store the infos in fAmpTotal, fPHPlace and fPHValue
// time bin of the cluster not corrected
Int_t time = cl->GetPadTime();
-
+ Float_t charge = TMath::Abs(cl->GetQ());
+
+ //printf("Store::time %d, amplitude %f\n",time,dqdl);
+
//Correct for the gain coefficient used in the database for reconstruction
Float_t correctthegain = 1.0;
if(fIsHLT) correctthegain = fCalDetGain->GetValue(fDetectorPreviousTrack);
// Fill the fAmpTotal with the charge
if (fCH2dOn) {
- if((!fLimitChargeIntegration) || (cl->IsInChamber())) fAmpTotal[(Int_t) group[0]] += correction;
+ if((!fLimitChargeIntegration) || (cl->IsInChamber())) {
+ //printf("Store::group %d, amplitude %f\n",group[0],correction);
+ fAmpTotal[(Int_t) group[0]] += correction;
+ }
}
// Fill the fPHPlace and value
if (fPH2dOn) {
fPHPlace[time] = group[1];
- fPHValue[time] = correction;
+ fPHValue[time] = charge;
}
}
Int_t fd = -1; // Premiere zone non nulle
Float_t totalcharge = 0.0; // Total charge for the supermodule histo
+ //printf("CH2d nbclusters %d, fNumberClusters %d, fNumberClustersf %d\n",nbclusters,fNumberClusters,fNumberClustersf);
+
if(nbclusters < fNumberClusters) return;
if(nbclusters > fNumberClustersf) return;
// Normalize with the number of clusters
Double_t normalizeCst = fRelativeScale;
if(fNormalizeNbOfCluster) normalizeCst = normalizeCst*nbclusters;
+
+ //printf("Number of groups in one detector %d\n",fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0));
// See if the track goes through different zones
for (Int_t k = 0; k < fCalibraMode->GetNfragZ(0)*fCalibraMode->GetNfragRphi(0); k++) {
+ //printf("fAmpTotal %f for %d\n",fAmpTotal[k],k);
if (fAmpTotal[k] > 0.0) {
totalcharge += fAmpTotal[k];
nb++;
}
}
+ //printf("CH2d: nb %d, fd %d, calibration group %d, amplitude %f, detector %d\n",nb,fd,fCalibraMode->GetXbins(0),fAmpTotal[fd]/normalizeCst,fDetectorPreviousTrack);
switch (nb)
{
// 0 timebin problem
// 1 no input
// 2 input
- //
// Same algorithm as TestBeam but different reader
//
+
+ rawStream->SetSharedPadReadout(kFALSE);
Int_t withInput = 1;
return withInput;
-}
-//_____________________________________________________________________
-Int_t AliTRDCalibraFillHisto::ProcessEventDAQV1(AliTRDrawStreamBase *rawStream, Bool_t nocheck)
-{
- //
- // Event Processing loop - AliTRDrawStreamBase
- // Use old AliTRDmcmtracklet code
- // 0 timebin problem
- // 1 no input
- // 2 input
- //
- // Algorithm with mcm tracklet
- //
-
- Int_t withInput = 1;
-
- AliTRDmcm mcm = AliTRDmcm(0);
- AliTRDtrigParam *param = AliTRDtrigParam::Instance();
- rawStream->SetSharedPadReadout(kTRUE);
-
- fDetectorPreviousTrack = -1;
- fMCMPrevious = -1;
- fROBPrevious = -1;
- Int_t row = -1;
- Int_t nbtimebin = 0;
- Int_t baseline = 10;
-
-
- if(!nocheck){
-
- fTimeMax = 0;
-
- while (rawStream->Next()) {
-
- Int_t idetector = rawStream->GetDet(); // current detector
- Int_t imcm = rawStream->GetMCM(); // current MCM
- Int_t irob = rawStream->GetROB(); // current ROB
- row = rawStream->GetRow();
-
-
- if(((fDetectorPreviousTrack != idetector) || (fMCMPrevious != imcm) || (fROBPrevious != irob)) && (fDetectorPreviousTrack != -1)){
-
- // Fill
- withInput = TMath::Max(FillDAQ(&mcm),withInput);
-
-
- // reset
- mcm.Reset();
- mcm.SetRobId(irob);
- mcm.SetChaId(idetector);
- mcm.SetRow(row);
- mcm.SetColRange(0,21);
-
- }
- if(fDetectorPreviousTrack == -1){
-
- mcm.SetRobId(irob);
- mcm.SetChaId(idetector);
- mcm.SetRow(row);
- mcm.SetColRange(0,21);
-
- }
-
- fDetectorPreviousTrack = idetector;
- fMCMPrevious = imcm;
- fROBPrevious = irob;
-
- nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
- if(nbtimebin == 0) return 0;
- if((fTimeMax != 0) && (nbtimebin != fTimeMax)) return 0;
- fTimeMax = nbtimebin;
- fNumberClustersf = fTimeMax;
- fNumberClusters = (Int_t)(0.6*fTimeMax);
- param->SetTimeRange(0,fTimeMax);
-
- //baseline = rawStream->GetCommonAdditive(); // common additive baseline
-
- Int_t *signal = rawStream->GetSignals(); // current ADC signal
- Int_t adc = rawStream->GetADC();
-
-
- //printf("detector %d, signal[0] %d, signal[1] %d, signal[2] %d, baseline %d\n",idetector,signal[0],signal[1],signal[2], baseline);
-
- for(Int_t itime = 0; itime < nbtimebin; itime++){
- mcm.SetADC(adc,itime,(signal[itime]-baseline));
- }
- }
-
- // fill the last one
- if(fDetectorPreviousTrack != -1){
-
- // Fill
- withInput = TMath::Max(FillDAQ(&mcm),withInput);
-
-
- // reset
- mcm.Reset();
- mcm.SetRobId(fROBPrevious);
- mcm.SetChaId(fDetectorPreviousTrack);
- mcm.SetRow(row);
- mcm.SetColRange(0,21);
-
- }
-
- }
- else{
-
- while (rawStream->Next()) {
-
- Int_t idetector = rawStream->GetDet(); // current detector
- Int_t imcm = rawStream->GetMCM(); // current MCM
- Int_t irob = rawStream->GetROB(); // current ROB
- row = rawStream->GetRow();
-
- if(((fDetectorPreviousTrack != idetector) || (fMCMPrevious != imcm) || (fROBPrevious != irob)) && (fDetectorPreviousTrack != -1)){
-
- // Fill
- withInput = TMath::Max(FillDAQ(&mcm),withInput);
-
-
- // reset
- mcm.Reset();
- mcm.SetRobId(irob);
- mcm.SetChaId(idetector);
- mcm.SetRow(row);
- mcm.SetColRange(0,21);
-
- }
-
- fDetectorPreviousTrack = idetector;
- fMCMPrevious = imcm;
- fROBPrevious = irob;
-
- //baseline = rawStream->GetCommonAdditive(); // common baseline
-
- fTimeMax = rawStream->GetNumberOfTimeBins(); // number of time bins read from data
- fNumberClustersf = fTimeMax;
- fNumberClusters = (Int_t)(0.6*fTimeMax);
- param->SetTimeRange(0,fTimeMax);
- Int_t *signal = rawStream->GetSignals(); // current ADC signal
- Int_t adc = rawStream->GetADC();
-
-
- //printf("detector %d, signal[0] %d, signal[1] %d, signal[2] %d, baseline %d\n",idetector,signal[0],signal[1],signal[2], baseline);
-
- for(Int_t itime = 0; itime < fTimeMax; itime++){
- mcm.SetADC(adc,itime,(signal[itime]-baseline));
- }
- }
-
- // fill the last one
- if(fDetectorPreviousTrack != -1){
-
- // Fill
- withInput = TMath::Max(FillDAQ(&mcm),withInput);
-
- // reset
- mcm.Reset();
- mcm.SetRobId(fROBPrevious);
- mcm.SetChaId(fDetectorPreviousTrack);
- mcm.SetRow(row);
- mcm.SetColRange(0,21);
-
- }
- }
-
- return withInput;
-
}
//_____________________________________________________________________
Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck)
//_________________________________________________________________________
Int_t AliTRDCalibraFillHisto::ProcessEventDAQ(
#ifdef ALI_DATE
- eventHeaderStruct *event,
+ const eventHeaderStruct *event,
Bool_t nocheck
#else
- eventHeaderStruct* /*event*/,
+ const eventHeaderStruct* /*event*/,
Bool_t /*nocheck*/
#endif
return 0;
#endif
-}
-//_____________________________________________________________________
-Int_t AliTRDCalibraFillHisto::ProcessEventDAQV1(AliRawReader *rawReader, Bool_t nocheck)
-{
- //
- // Event processing loop - AliRawReader
- // use the old mcm traklet code
- //
-
- AliTRDrawStreamBase rawStream(rawReader);
-
- rawReader->Select("TRD");
-
- return ProcessEventDAQV1(&rawStream, nocheck);
-}
-//_________________________________________________________________________
-Int_t AliTRDCalibraFillHisto::ProcessEventDAQV1(
-#ifdef ALI_DATE
- eventHeaderStruct *event,
- Bool_t nocheck
-#else
- eventHeaderStruct* /*event*/,
- Bool_t /*nocheck*/
-
-#endif
- )
-{
- //
- // process date event
- // use the old mcm tracklet code
- //
-#ifdef ALI_DATE
- AliRawReader *rawReader = new AliRawReaderDate((void*)event);
- Int_t result=ProcessEventDAQV1(rawReader, nocheck);
- delete rawReader;
- return result;
-#else
- Fatal("AliTRDCalibraFillHisto", "this class was compiled without DATE");
- return 0;
-#endif
-
}
//////////////////////////////////////////////////////////////////////////////
// Routine inside the DAQ process
/////////////////////////////////////////////////////////////////////////////
//_______________________________________________________________________
-Int_t AliTRDCalibraFillHisto::FillDAQ(AliTRDmcm *mcm){
-
- //
- // Return 2 if some tracklets are found and used, 1 if nothing
- //
-
- Int_t nbev = 0;
-
- if(mcm->Run()){
-
- for (Int_t iSeed = 0; iSeed < 4; iSeed++) {
-
- if (mcm->GetSeedCol()[iSeed] < 0) {
- continue;
- }
-
- nbev += TestTracklet(mcm->GetChaId(),mcm->GetRow(),iSeed,mcm);
- }
-
- }
-
- if(nbev > 0) nbev = 2;
- else nbev = 1;
-
- return nbev;
-
-}
-//__________________________________________________________________________
-Int_t AliTRDCalibraFillHisto::TestTracklet( Int_t idet, Int_t row, Int_t iSeed, AliTRDmcm *mcm){
-
- //
- // Build the tracklet and return if the tracklet if finally used or not (1/0)
- //
-
- Int_t nbev = 0;
-
- AliTRDmcmTracklet mcmtracklet = AliTRDmcmTracklet();
- //mcmtracklet.Reset();
- mcmtracklet.SetDetector(idet);
- mcmtracklet.SetRow(row);
- mcmtracklet.SetN(0);
-
- Int_t iCol, iCol1, iCol2, track[3];
- iCol = mcm->GetSeedCol()[iSeed]; // 0....20 (MCM)
- mcm->GetColRange(iCol1,iCol2); // range in the pad plane
-
- Float_t amp[3];
- for (Int_t iTime = 0; iTime < fTimeMax; iTime++) {
-
- amp[0] = mcm->GetADC(iCol-1,iTime);
- amp[1] = mcm->GetADC(iCol ,iTime);
- amp[2] = mcm->GetADC(iCol+1,iTime);
-
- if(mcm->IsCluster(iCol,iTime)) {
-
- mcmtracklet.AddCluster(iCol+iCol1,iTime,amp,track);
-
- }
- else if ((iCol+1+1) < 21) {
-
- amp[0] = mcm->GetADC(iCol-1+1,iTime);
- amp[1] = mcm->GetADC(iCol +1,iTime);
- amp[2] = mcm->GetADC(iCol+1+1,iTime);
-
- if(mcm->IsCluster(iCol+1,iTime)) {
-
- mcmtracklet.AddCluster(iCol+1+iCol1,iTime,amp,track);
-
- }
-
- }
-
- }
-
-
- nbev = UpdateHistogramcm(&mcmtracklet);
-
- return nbev;
-
-}
-//____________Online trackling in AliTRDtrigger________________________________
-Int_t AliTRDCalibraFillHisto::UpdateHistogramcm(AliTRDmcmTracklet *trk)
-{
- //
- // Return if the tracklet is finally used or not (1/0) for calibration
- //
-
- Int_t used = 1;
-
- //fGoodTracklet = kTRUE;
-
- // Localisation of the Xbins involved
- Int_t idect = trk->GetDetector();
- Int_t idectrue = trk->GetDetector();
- //idect = 0;
-
- Int_t nbclusters = trk->GetNclusters();
-
- // Eventuelle correction due to track angle in z direction
- Float_t correction = 1.0;
- if (fMcmCorrectAngle) {
- Float_t z = trk->GetRowz();
- Float_t r = trk->GetTime0();
- correction = r / TMath::Sqrt((r*r+z*z));
- }
-
- //row
- Int_t row = trk->GetRow();
-
-
- // Boucle sur les clusters
- // Condition on number of cluster: don't come from the middle of the detector
-
- Double_t amph[36];
- for(Int_t k =0; k < 36; k++) amph[k]=0.0;
- Double_t ampTotal = 0.0;
-
- for (Int_t icl = 0; icl < trk->GetNclusters(); icl++) {
-
- Float_t amp[3] = { 0.0, 0.0, 0.0 };
- Int_t time = trk->GetClusterTime(icl);
- Int_t col = trk->GetClusterCol(icl);
-
- //CheckGoodTrackletV0(idect,row,col);
-
- amp[0] = trk->GetClusterADC(icl)[0] * correction;
- amp[1] = trk->GetClusterADC(icl)[1] * correction;
- amp[2] = trk->GetClusterADC(icl)[2] * correction;
-
- ampTotal += (Float_t) (amp[0]+amp[1]+amp[2]);
- amph[time]=amp[0]+amp[1]+amp[2];
-
- if(fDebugLevel > 0){
- if ( !fDebugStreamer ) {
- //debug stream
- TDirectory *backup = gDirectory;
- fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
- if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
- }
-
- Double_t amp0 = amp[0];
- Double_t amp1 = amp[1];
- Double_t amp2 = amp[2];
-
- (* fDebugStreamer) << "UpdateHistogramcm0"<<
- "nbclusters="<<nbclusters<<
- "amp0="<<amp0<<
- "amp1="<<amp1<<
- "amp2="<<amp2<<
- "time="<<time<<
- "col="<<col<<
- "row="<<row<<
- "detector="<<idectrue<<
- "\n";
- }
-
- } // Boucle clusters
-
- if((amph[0] > 100.0) || (!fGoodTracklet) || (trk->GetNclusters() < fNumberClusters) || (trk->GetNclusters() > fNumberClustersf)) used = 0;
-
- if (used == 1) {
- for(Int_t k = 0; k < fTimeMax; k++) UpdateDAQ(idect,0,0,k,amph[k],fTimeMax);
- //((TH2I *)GetCH2d()->Fill(ampTotal/30.0,idect));
- } // Condition cut
-
-
- if(fDebugLevel > 0){
- if ( !fDebugStreamer ) {
- //debug stream
- TDirectory *backup = gDirectory;
- fDebugStreamer = new TTreeSRedirector("TRDdebugCalibraFill.root");
- if ( backup ) backup->cd(); //we don't want to be cd'd to the debug streamer
- }
-
- Double_t amph0 = amph[0];
- Double_t amphlast = amph[fTimeMax-1];
- Double_t rms = TMath::RMS(fTimeMax,amph);
- Int_t goodtracklet = (Int_t) fGoodTracklet;
-
- (* fDebugStreamer) << "UpdateHistogramcm1"<<
- "nbclusters="<<nbclusters<<
- "ampTotal="<<ampTotal<<
- "row="<<row<<
- "detector="<<idectrue<<
- "amph0="<<amph0<<
- "amphlast="<<amphlast<<
- "goodtracklet="<<goodtracklet<<
- "rms="<<rms<<
- "\n";
- }
-
- return used;
-
-}
-//_______________________________________________________________________
Int_t AliTRDCalibraFillHisto::FillDAQ(Double_t phvalue[16][144][36]){
//
}
}
if(fLinearFitterOn){
- AnalyseLinearFitter();
+ if(fLinearFitterDebugOn) AnalyseLinearFitter();
f.WriteTObject(fLinearVdriftFit);
}