1 /**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /** @file AliFMDBaseDA.cxx
17 @author Hans Hjersing Dalsgaard <canute@nbi.dk>
18 @date Wed Mar 26 11:30:45 2008
19 @brief Base class for detector algorithms.
22 //This is the implementation of the (virtual) base class for the FMD detector
23 //algorithms(DA). It implements the creation of the relevant containers and handles the
24 //loop over the raw data. The derived classes can control the parameters and action
25 //to be taken making this the base class for the Pedestal, Gain and Physics DA.
28 #include "AliFMDBaseDA.h"
31 #include "AliFMDRawReader.h"
33 //_____________________________________________________________________
34 ClassImp(AliFMDBaseDA)
36 //_____________________________________________________________________
37 AliFMDBaseDA::AliFMDBaseDA() : TNamed(),
38 fDiagnosticsFilename("diagnosticsHistograms.root"),
40 fSaveHistograms(kFALSE),
45 fDetectorArray.SetOwner();
48 //_____________________________________________________________________
49 AliFMDBaseDA::AliFMDBaseDA(const AliFMDBaseDA & baseDA) :
51 fDiagnosticsFilename(baseDA.fDiagnosticsFilename),
53 fSaveHistograms(baseDA.fSaveHistograms),
54 fDetectorArray(baseDA.fDetectorArray),
55 fRequiredEvents(baseDA.fRequiredEvents),
56 fCurrentEvent(baseDA.fCurrentEvent)
58 fDetectorArray.SetOwner();
62 //_____________________________________________________________________
63 AliFMDBaseDA::~AliFMDBaseDA() {
69 //_____________________________________________________________________
70 void AliFMDBaseDA::Run(AliRawReader* reader) {
81 diagFile = TFile::Open(fDiagnosticsFilename,"RECREATE");
82 for(UShort_t det=1;det<=3;det++) {
83 UShort_t FirstRing = (det == 1 ? 1 : 0);
85 for (UShort_t ir = FirstRing; ir < 2; ir++) {
86 Char_t ring = (ir == 0 ? 'O' : 'I');
87 UShort_t nsec = (ir == 0 ? 40 : 20);
88 UShort_t nstr = (ir == 0 ? 256 : 512);
90 gDirectory->cd(Form("%s:/",fDiagnosticsFilename));
91 gDirectory->mkdir(Form("FMD%d%c",det,ring),Form("FMD%d%c",det,ring));
92 for(UShort_t sec =0; sec < nsec; sec++) {
93 gDirectory->cd(Form("%s:/FMD%d%c",fDiagnosticsFilename,det,ring));
94 gDirectory->mkdir(Form("sector_%d",sec));
95 for(UShort_t strip = 0; strip < nstr; strip++) {
96 gDirectory->cd(Form("%s:/FMD%d%c/sector_%d",fDiagnosticsFilename,det,ring,sec));
97 gDirectory->mkdir(Form("strip_%d",strip));
107 AliFMDRawReader* fmdReader = new AliFMDRawReader(reader,0);
108 TClonesArray* digitArray = new TClonesArray("AliFMDDigit",0);
114 for(Int_t n =1;n <= GetRequiredEvents(); n++)
116 if(!reader->NextEvent())
119 SetCurrentEvent(*(reader->GetEventId()));
122 fmdReader->ReadAdcs(digitArray);
124 // std::cout<<"In event # "<< *(reader->GetEventId()) << "\r"<<std::flush;
126 for(Int_t i = 0; i<digitArray->GetEntries();i++) {
127 AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitArray->At(i));
134 AliInfo(Form("Looped over %d events",GetCurrentEvent()));
137 for(UShort_t det=1;det<=3;det++) {
138 UShort_t FirstRing = (det == 1 ? 1 : 0);
139 for (UShort_t ir = FirstRing; ir < 2; ir++) {
140 Char_t ring = (ir == 0 ? 'O' : 'I');
141 UShort_t nsec = (ir == 0 ? 40 : 20);
142 UShort_t nstr = (ir == 0 ? 256 : 512);
143 for(UShort_t sec =0; sec < nsec; sec++) {
144 for(UShort_t strip = 0; strip < nstr; strip++) {
145 Analyse(det,ring,sec,strip);
151 if(fOutputFile.is_open()) {
153 fOutputFile.write("# EOF\n",6);
158 if(fSaveHistograms ) {
159 AliInfo("Closing diagnostics file...please wait");
164 //_____________________________________________________________________
166 void AliFMDBaseDA::InitContainer(){
169 TObjArray* ringArray;
170 TObjArray* sectorArray;
172 for(UShort_t det=1;det<=3;det++) {
173 detArray = new TObjArray();
174 detArray->SetOwner();
175 fDetectorArray.AddAtAndExpand(detArray,det);
176 UShort_t FirstRing = (det == 1 ? 1 : 0);
177 for (UShort_t ir = FirstRing; ir < 2; ir++) {
178 Char_t ring = (ir == 0 ? 'O' : 'I');
179 UShort_t nsec = (ir == 0 ? 40 : 20);
180 UShort_t nstr = (ir == 0 ? 256 : 512);
181 ringArray = new TObjArray();
182 ringArray->SetOwner();
183 detArray->AddAtAndExpand(ringArray,ir);
184 for(UShort_t sec =0; sec < nsec; sec++) {
185 sectorArray = new TObjArray();
186 sectorArray->SetOwner();
187 ringArray->AddAtAndExpand(sectorArray,sec);
188 for(UShort_t strip = 0; strip < nstr; strip++) {
189 AddChannelContainer(sectorArray, det, ring, sec, strip);
195 //_____________________________________________________________________