gAlice->SetDebug(2);
gAlice->Run(1);
- if (gAlice) delete gAlice;
- file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
- gAlice = (AliRun *) file->Get("gAlice");
+ //if (gAlice) delete gAlice;
+ //file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+ //gAlice = (AliRun *) file->Get("gAlice");
// Analyze the TRD hits
if (rc = AliTRDanalyzeHits()) return rc;
// Run the digitization
if (rc = AliTRDcreateDigits()) return rc;
- if (gAlice) delete gAlice;
- file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
- gAlice = (AliRun *) file->Get("gAlice");
+// if (gAlice) delete gAlice;
+// file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+// gAlice = (AliRun *) file->Get("gAlice");
- // Analyze the digits
- if (rc = AliTRDanalyzeDigits()) return rc;
+// // Analyze the digits
+// if (rc = AliTRDanalyzeDigits()) return rc;
- // Create the cluster
- if (rc = AliTRDcreateCluster()) return rc;
+// // Create the cluster
+// if (rc = AliTRDcreateCluster()) return rc;
- if (gAlice) delete gAlice;
- file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
- gAlice = (AliRun *) file->Get("gAlice");
+// if (gAlice) delete gAlice;
+// file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
+// gAlice = (AliRun *) file->Get("gAlice");
- // Analyze the cluster
- if (rc = AliTRDanalyzeCluster()) return rc;
+// // Analyze the cluster
+// if (rc = AliTRDanalyzeCluster()) return rc;
//file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root");
//file->Close();
Int_t rc = 0;
- if (!gAlice) {
- cout << "<AliTRDanalyzeHits> No AliRun object found" << endl;
+ AliRunLoader *rl = gAlice->GetRunLoader();
+ if (!rl) {
+ cout << "<AliTRDanalyzeHits> No RunLoader found" << endl;
rc = 1;
return rc;
}
- gAlice->GetEvent(0);
+
+ // Import the Trees for the event nEvent in the file
+ rl->GetEvent(0);
+
+ AliLoader* loader = rl->GetLoader("TRDLoader");
+ if (!loader) {
+ cout << "<AliTRDanalyzeHits> No TRDLoader found" << endl;
+ rc = 2;
+ return rc;
+ }
// Get the pointer to the TRD detector
AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD");
,50,0.0,1000.0);
// Get the pointer hit tree
- TTree *hitTree = gAlice->TreeH();
+ TTree *hitTree = loader->TreeH();
if (!hitTree) {
cout << "<AliTRDanalyzeHits> No hit tree found" << endl;
rc = 4;
hQtr->Fill(TMath::Abs(q));
}
- TParticle *part = gAlice->Particle(track);
+// printf("Getting TParticle for track %d\n",track);
+// TParticle *part = gAlice->Particle(track);
- if ((plane == 0) && (q > 0)) {
+// if ((plane == 0) && (q > 0)) {
- // 3 GeV electrons
- if ((part->GetPdgCode() == 11) &&
- (part->P() > 2.9)) {
- nPrimE++;
- nTotE += ((Int_t) q);
- }
+// // 3 GeV electrons
+// if ((part->GetPdgCode() == 11) &&
+// (part->P() > 2.9)) {
+// nPrimE++;
+// nTotE += ((Int_t) q);
+// }
- // MIP pions
- if ((part->GetPdgCode() == -211) &&
- (part->P() > 0.5)) {
- nPrimP++;
- nTotP += ((Int_t) q);
- }
+// // MIP pions
+// if ((part->GetPdgCode() == -211) &&
+// (part->P() > 0.5)) {
+// nPrimP++;
+// nTotP += ((Int_t) q);
+// }
- }
+// }
hit = (AliTRDhit *) trd->NextHit();
// Create the TRD digitzer
AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
,"TRD digitizer class");
+ digitizer->Open("TRD_test.root");
digitizer->InitDetector();
+ digitizer->InitOutput(0);
// Set the parameter
digitizer->SetDebug(1);
}
// Write the digits into the input file
- if (!(digitizer->MakeBranch())) {
- rc = 3;
- return rc;
- }
+ //if (!(digitizer->MakeBranch())) {
+ // rc = 3;
+ // return rc;
+ //}
// Write the digits into the input file
if (!(digitizer->WriteDigits())) {
Int_t countDigits = 0;
Int_t iSec = trd->GetSensSector();
Int_t iCha = trd->GetSensChamber();
- Int_t timeMax = geo->GetTimeTotal();
+ Int_t timeMax = parameter->GetTimeTotal();
TProfile *hAmpTimeEl = new TProfile("hAmpTimeEl","Amplitude of the digits (electrons)"
,timeMax,-0.5,((Double_t) timeMax)-0.5);
TH1F *hClusAll = new TH1F("hClusAll" ,"Amplitude of the cluster (all)"
,501,-0.5,500.5);
TH1F *hClusNoise = new TH1F("hClusNoise","Amplitude of the cluster (noise)"
- , 5,-0.5, 4.5);
+ , 11,-0.5, 10.5);
TH1F *hClusEl = new TH1F("hClusEl" ,"Amplitude of the cluster (electron)"
,501,-0.5,500.5);
TH1F *hClusPi = new TH1F("hClusPi" ,"Amplitude of the cluster (pion)"
Int_t plane = geo->GetPlane(detector);
Int_t chamber = geo->GetChamber(detector);
Float_t energy = cluster->GetQ();
- Int_t track0 = cluster->GetTrackIndex(0);
- Int_t track1 = cluster->GetTrackIndex(1);
- Int_t track2 = cluster->GetTrackIndex(2);
+ Int_t track0 = cluster->GetLabel(0);
+ Int_t track1 = cluster->GetLabel(1);
+ Int_t track2 = cluster->GetLabel(2);
TParticle *particle = 0;
if (track0 > -1) {
particle = gAlice->Particle(track0);
fun->SetLineColor(2);
fun->Draw("SAME");
- //cCluster->cd(2);
- //gPad->SetLogy();
+ cCluster->cd(2);
+ gPad->SetLogy();
Float_t meanNoise = hClusNoise->GetMean();
- //hClusNoise->Draw();
+ hClusNoise->Draw();
cCluster->cd(3);
gPad->SetLogy();