#include "AliLog.h"
#include "AliTRDCalibChamberStatus.h"
+#include "AliTRDdEdxUtils.h"
#include "AliTRDCalibTask.h"
//________________________________________________________________________
AliTRDCalibTask::AliTRDCalibTask(const char *name)
: AliAnalysisTaskSE(name), fESD(0),
- fESDfriend(0),
fkEsdTrack(0),
fFriendTrack(0),
fCalibObject(0),
fVector2d(kFALSE),
fVdriftLinear(kTRUE),
fExbAlt(kFALSE),
+ fDebugLevelTRDCalibraFillHisto(0),
fNbTimeBins(0),
+ fNumberBinCharge(50),
+ fSelectTrigger(kTRUE),
fSelectedTrigger(new TObjArray()),
fRejected(kTRUE),
fEsdTrackCuts(0),
fMinNbContributors(0),
fRangePrimaryVertexZ(9999999.0),
fMinNbTracks(9),
- fMaxNbTracks(500),
+ fMaxNbTracks(999999999),
+ fCutWithVdriftCalib(kFALSE),
+ fMinNbTRDtracklets(0),
+ fMinTRDMomentum(0),
fLow(0),
fHigh(30),
fFillZero(kFALSE),
fSubVersionExBUsed(-1),
fCalDetGain(0x0),
fMaxEvent(0),
- fCounter(0),
- fDebug(0)
+ fCounter(0)
{
//
// Default constructor
fNrphi[1] = 0;
fNrphi[2] = 0;
+
// Define input and output slots here
// Input slot #0 works with a TChain
DefineInput(0, TChain::Class());
if(fCH2dTest) delete fCH2dTest;
if(fPH2dTest) delete fPH2dTest;
if(fLinearVdriftTest) delete fLinearVdriftTest;
+ AliTRDdEdxUtils::DeleteCalibHist();
if(fCalDetGain) delete fCalDetGain;
if(fSelectedTrigger) {
// instance calibration
fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
if(fOnInstance) {
+ fTRDCalibraFillHisto->SetNumberBinCharge(fNumberBinCharge); // set number of bin of the charge distribution
+ fTRDCalibraFillHisto->SetCutWithVdriftCalib(fCutWithVdriftCalib); // cut vdrift
+ fTRDCalibraFillHisto->SetMinNbTRDtracklets(fMinNbTRDtracklets); // min number of TRD tracklets
+ fTRDCalibraFillHisto->SetMinTRDMomentum(fMinTRDMomentum); // min TRD momentum
fTRDCalibraFillHisto->SetHisto2d(fHisto2d); // choose to use histograms
fTRDCalibraFillHisto->SetVector2d(fVector2d); // choose to use vectors
fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
fTRDCalibraFillHisto->SetNumberClustersf(fHigh); // At least 11 clusters
// For testing only
- if(fDebug > 2) fTRDCalibraFillHisto->SetDebugLevel(1); //debug stuff
+ fTRDCalibraFillHisto->SetDebugLevel(fDebugLevelTRDCalibraFillHisto); //debug stuff
if(fHisto2d) {
fListHist->Add(fTRDCalibraFillHisto->GetCH2d());
fAbsoluteGain->Sumw2();
fListHist->Add(fAbsoluteGain);
+ AliTRDdEdxUtils::PrintControl();
+ AliTRDdEdxUtils::IniCalibHist(fListHist, kTRUE);
/////////////////////////////////////////
// First debug level
///////////////////////////////////////
//cout << "event = " << fCounter << endl;
//printf("Counter %d\n",fCounter);
-
+
///////////////////
// Check trigger
///////////////////
Bool_t pass = kTRUE;
- if (strstr(type,"p-p")) {
+ if (fSelectTrigger) {
//printf("Will check the triggers\n");
//printf("centrality %f, centralityb %f\n",centrality,centralityb);
}
- if (strstr(type,"Pb-Pb")) {
- //printf("Will check the number of good tracks\n");
+ //printf("Beam type %s\n",(const char*)type);
+ if (!strstr(type,"p-p")) {
+ //if (strstr(type,"A-A")) {
+ //printf("Will check the number of good tracks %f %f %f\n",nGoodParticles,fMinNbTracks,fMaxNbTracks);
if((nGoodParticles < fMinNbTracks) || (nGoodParticles > fMaxNbTracks)) {
PostData(1, fListHist);
return;
Int_t nbtrackTPC = 0;
-
+
if (nbTracks <= 0.0) {
if(fDebug > 1) {
PostData(1, fListHist);
return;
}
-
-
+
+
fESDfriend = dynamic_cast<AliESDfriend*> (fESD->FindListObject("AliESDfriend"));
if(!fESDfriend){
AliError("fESDfriend not available");
PostData(1, fListHist);
return;
}
-
+
//printf("has friends\n");
/////////////////////////////////////
//printf("Not a good track\n");
continue;
}
-
+
// First Absolute gain calibration
Int_t trdNTracklets = (Int_t) fkEsdTrack->GetTRDntracklets();
Int_t trdNTrackletsPID = (Int_t) fkEsdTrack->GetTRDntrackletsPID();
if(good && fOnInstance) {
//cout << "good" << endl;
- fTRDCalibraFillHisto->UpdateHistogramsV1(fTrdTrack);
+ fTRDCalibraFillHisto->UpdateHistogramsV1(fTrdTrack,fkEsdTrack);
//printf("Fill fTRDCalibraFillHisto\n");
}
-
-
-
+
+ const Double_t mag = AliTRDdEdxUtils::IsExBOn() ? fESD->GetMagneticField() : -1;
+ const Int_t charge = AliTRDdEdxUtils::IsExBOn() ? fkEsdTrack->Charge() : -1;
+ const Double_t toTPCscale = AliTRDdEdxUtils::GetCalibTPCscale(fkEsdTrack->GetTPCncls(), fkEsdTrack->GetTPCsignal());
+ if(toTPCscale>0){
+ AliTRDdEdxUtils::FillCalibHist(fTrdTrack, 0, mag, charge, toTPCscale);
+ }
+
//////////////////////////////////
// Debug
////////////////////////////////
Double_t phtb[AliTRDseedV1::kNtb];
memset(phtb, 0, AliTRDseedV1::kNtb*sizeof(Double_t));
Double_t sum = 0.0;
- Float_t normalisation = 6.67;
+ Float_t normalisation = 1.13;
Int_t detector = 0;
Int_t sector = 0;
for(Int_t itr = 0; itr < 6; ++itr){
if(!(fCl = tracklet->GetClusters(ic))) continue;
++nbclusters;
time = fCl->GetPadTime();
- ch = tracklet->GetdQdl(ic);
+ //ch = tracklet->GetdQdl(ic);
+ ch = tracklet->GetQperTB(ic);
qcl = TMath::Abs(fCl->GetQ());
detector = fCl->GetDetector();
// Add the charge if shared cluster
// Load Chamber Gain factors into the Tender supply
//
- printf("SetVersionSubversion\n");
+ //printf("SetVersionSubversion\n");
//find previous entry from the UserInfo
TTree *tree=((TChain*)GetInputData(0))->GetTree();
fFirstRunGainLocal = id->GetFirstRun();
fVersionGainLocalUsed = id->GetVersion();
fSubVersionGainLocalUsed = id->GetSubVersion();
- } else if(os->GetString().Contains("TRD/Calib/ChamberExB")){
+ } else if((os->GetString().Contains("TRD/Calib/ChamberExB")) && (!os->GetString().Contains("TRD/Calib/ChamberExBAlt"))){
// Get Old drift velocity calibration
AliCDBId *id=AliCDBId::MakeFromString(os->GetString());
fFirstRunExB = id->GetFirstRun();
fVersionExBUsed = id->GetVersion();
fSubVersionExBUsed = id->GetSubVersion();
+ //printf("Version %d and subversion %d\n",fVersionExBUsed,fSubVersionExBUsed);
}
}