1 #if !defined(__CINT__) || defined(__MAKECINT__)
16 #include "AliTRDgeometry.h"
17 #include "AliRunLoader.h"
18 #include "AliLoader.h"
19 #include "AliTRDdigitsManager.h"
20 #include "AliTRDarrayADC.h"
21 #include "AliTRDfeeParam.h"
22 #include "AliTRDdigitsParam.h"
30 void AliTRDanadigits()
32 gStyle->SetNdivisions(005,"X");
37 // Analyzes the digits
39 const Int_t kNdet = AliTRDgeometry::Ndet();
41 //open run loader and load gAlice, kinematics and header
42 AliRunLoader* rl = AliRunLoader::Open("galice.root");
45 gAlice = rl->GetAliRun();
48 // Import the Trees for the event nEvent in the file
53 AliLoader* loader = rl->GetLoader("TRDLoader");
55 cout << "<AliTRDanalyzeHits> No TRDLoader found" << endl;
60 Int_t detA = 240;//AliTRDgeometry::GetDetector(0,4,1); //layer,stac,sm
61 Int_t detB = 250;//AliTRDgeometry::GetDetector(5,4,1);
62 printf("detA %d \t detB %d \n",detA,detB);
63 TH2D *chA = new TH2D("chA", "chA", kNdet, 0, kNdet, 200, -50, 50);
64 TH2D *chB = new TH2D("chB", "chB", kNdet, 0, kNdet, 200, -50, 50);
66 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
68 for (Int_t ievent = iev1; ievent < iev2; ievent++) {
69 printf("Process event %d\n",ievent);
71 if (!loader->TreeD()){
72 printf("loader Loading Digits ... \n");
76 // Read the digits from the file
77 if (!(digitsManager->ReadDigits(loader->TreeD()))) {
78 cout << "<AliTRDanalyzeDigits> Cannot read the digits" << endl;
82 printf("digitsManager Read Digits Done\n");
85 // loop over selected chambers
86 for(Int_t det = detA; det < detB; det++) {
88 printf("try in %d :\t",det);
89 Int_t plan = AliTRDgeometry::GetLayer( det ); // Plane
90 Int_t cham = AliTRDgeometry::GetStack( det ); // Chamber
91 Int_t sect = AliTRDgeometry::GetSector( det ); // Sector (=iDDL)
92 Int_t nRow = AliTRDgeometry::GetRowMax( plan, cham, sect );
93 Int_t nCol = AliTRDgeometry::GetColMax( plan );
94 printf(" sm %d \t lay %d \t stac %d \n",sect,plan,cham);
97 AliTRDarrayADC *digits = (AliTRDarrayADC *) digitsManager->GetDigits(det); //mod
99 if (digits->HasData()) { //array
103 Int_t nbtimebin = digitsManager->GetDigitsParam()->GetNTimeBins(det);
105 AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance();
106 // Signal for regular pads
107 for (Int_t irow = 0; irow < nRow; irow++ ) {
108 for (Int_t icol = 0; icol < nCol; icol++ ) {
110 Int_t rob = feeParam->GetROBfromPad(irow,icol);
112 for(Int_t k = 0; k < nbtimebin; k++){
113 // printf(" row %d \t col %d \t timebin %d \t --> signal %d \n",irow,icol,k,signal);
114 Short_t signal = 999;
115 signal = (Short_t) digits->GetData(irow,icol,k);
117 if(signal==999) continue;
118 if(rob%2==0) { chB->Fill(det,signal); }
119 else {chA->Fill(det,signal); }
125 loader->UnloadDigits();
128 // Display the detector matrix
129 TCanvas *c = new TCanvas("c","",50,50,900,600);
132 chA->SetAxisRange(detA,detB-1,"X");
133 chA->SetTitle("HalfChamberSide A");
134 chA->SetXTitle("Detector number");
135 chA->SetYTitle("charge deposit [a.u]");
136 chB->SetAxisRange(detA,detB-1,"X");
137 chB->SetTitle("HalfChamberSide B");
138 chB->SetXTitle("Detector number");
139 chB->SetYTitle("charge deposit [a.u]");
147 //c->SaveAs("ChargeDeposit.pdf");