X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSDigitizer.cxx;h=be7c008cd47f3218b9b1948e6fd0fd961d5c9bc0;hb=c6fba1d948c4837c6ff8588e6704f79dbc17e367;hp=257a297a43a62b4cfe7b45e00662b62505dc907c;hpb=fd04285ae10e33db0095ebbd8200b98444d18e63;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSDigitizer.cxx b/ITS/AliITSDigitizer.cxx index 257a297a43a..be7c008cd47 100644 --- a/ITS/AliITSDigitizer.cxx +++ b/ITS/AliITSDigitizer.cxx @@ -13,49 +13,42 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2002/03/25 10:48:55 nilsen -New ITS SDigit merging with region of interest cut. Update for changes in -AliDigitizer. Additional optimization should be done. - -Revision 1.2 2002/03/15 17:26:40 nilsen -New SDigit version of ITS Digitizer. - -Revision 1.1 2001/11/27 16:27:28 nilsen -Adding AliITSDigitizer class to do merging and digitization . Based on the -TTask method. AliITSDigitizer class added to the Makefile and ITSLinkDef.h -file. The following files required minor changes. AliITS, added functions -SetHitsAddressBranch, MakeBranchInTreeD and modified MakeBranchD. -AliITSsimulationSDD.cxx needed a Tree independent way of returning back to -the original Root Directory in function Compress1D. Now it uses gDirectory. - -Revision 1.2 2002/03/01 E. Lopez -Digitization changed to start from SDigits instead of Hits. -The SDigits are reading as TClonesArray of AliITSpListItem -*/ +/* $Id$ */ +/////////////////////////////////////////////////////////////////////////// +//Piotr.Skowronski@cern.ch : // +//Corrections applied in order to compile (only) // +// with new I/O and folder structure // +//To be implemented correctly by responsible // +// // +// Class used to steer // +// the digitization for ITS // +// // +/////////////////////////////////////////////////////////////////////////// #include -#include -#include +#include #include #include -#include - -#include -#include +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliLoader.h" +#include "AliLog.h" +#include "AliRunDigitizer.h" #include "AliITSDigitizer.h" -#include "AliITSpList.h" -#include "AliITSmodule.h" -#include "AliITSsimulation.h" -#include "AliITSDetType.h" #include "AliITSgeom.h" +#include "AliITSsimulation.h" ClassImp(AliITSDigitizer) //______________________________________________________________________ -AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){ +AliITSDigitizer::AliITSDigitizer() : AliDigitizer(), +fITS(0), +fModActive(0), +fInit(kFALSE), +fRoif(-1), +fRoiifile(0), +fFlagFirstEv(kTRUE){ // Default constructor. Assign fITS since it is never written out from // here. // Inputs: @@ -65,14 +58,15 @@ AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){ // Return: // A blank AliITSDigitizer class. - fITS = 0; - fActive = 0; - fRoif = -1; - fRoiifile = 0; - fInit = kFALSE; } //______________________________________________________________________ -AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){ +AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr), +fITS(0), +fModActive(0), +fInit(kFALSE), +fRoif(-1), +fRoiifile(0), +fFlagFirstEv(kTRUE){ // Standard constructor. Assign fITS since it is never written out from // here. // Inputs: @@ -82,12 +76,9 @@ AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){ // Return: // An AliItSDigitizer class. - fITS = 0; - fActive = 0; - fRoif = -1; - fRoiifile = 0; - fInit = kFALSE; } + + //______________________________________________________________________ AliITSDigitizer::~AliITSDigitizer(){ // Default destructor. @@ -97,9 +88,8 @@ AliITSDigitizer::~AliITSDigitizer(){ // none. // Return: // none. - fITS = 0; // don't delete fITS. Done else where. - if(fActive) delete[] fActive; + if(fModActive) delete[] fModActive; } //______________________________________________________________________ Bool_t AliITSDigitizer::Init(){ @@ -115,8 +105,6 @@ Bool_t AliITSDigitizer::Init(){ fInit = kTRUE; // Assume for now init will work. if(!gAlice) { fITS = 0; - fActive = 0; - fRoif = -1; fRoiifile = 0; fInit = kFALSE; Warning("Init","gAlice not found"); @@ -124,41 +112,21 @@ Bool_t AliITSDigitizer::Init(){ } // end if fITS = (AliITS *)(gAlice->GetDetector("ITS")); if(!fITS){ - fActive = 0; - fRoif = -1; fRoiifile = 0; fInit = kFALSE; Warning("Init","ITS not found"); return fInit; } else if(fITS->GetITSgeom()){ //cout << "fRoif,fRoiifile="<GetITSgeom()->GetIndexMax()]; + fModActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()]; } else{ - fActive = 0; - fRoif = -1; fRoiifile = 0; fInit = kFALSE; Warning("Init","ITS geometry not found"); return fInit; } // end if - // fActive needs to be set to a default all kTRUE value - for(Int_t i=0;iGetITSgeom()->GetIndexMax();i++) fActive[i] = kTRUE; -/* This will not work from Init. ts is aways returned as zero. - TTree *ts; - if(fRoif>=0 && fRoiifile>=0 && fRoiifileGetNinputs()){ - ts = GetManager()->GetInputTreeS(fRoiifile); - if(!ts){ - if(!gAlice) ts = gAlice->TreeS(); - if(!ts){ - cout <<"The TTree TreeS needed to set by region not found." - " No region of interest cut will be applied."<< endl; - return fInit; - } // end if - } // end if - cout << "calling SetByReionOfInterest ts="<< ts <GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE; return fInit; } //______________________________________________________________________ @@ -172,63 +140,108 @@ void AliITSDigitizer::Exec(Option_t* opt){ // none. char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - char *all; + const char *all; const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), strstr(opt,"SSD")}; if( !det[0] && !det[1] && !det[2] ) all = "All"; else all = 0; + Int_t nfiles = GetManager()->GetNinputs(); + Int_t event = GetManager()->GetOutputEventNr(); AliITSsimulation *sim = 0; - AliITSDetType *iDetType = 0; - static Bool_t setDef = kTRUE; - + if(fFlagFirstEv){ + fITS->SetDefaults(); + fITS->SetDefaultSimulation(); + fFlagFirstEv=kFALSE; + } if(!fInit){ - Error("Exec","Init not succesfull, aborting."); + Error("Exec","Init not successful, aborting."); return; } // end if - if( setDef ) fITS->SetDefaultSimulation(); - setDef = kFALSE; sprintf(name,"%s",fITS->GetName()); - Int_t nfiles = GetManager()->GetNinputs(); - Int_t event = GetManager()->GetOutputEventNr(); Int_t size = fITS->GetITSgeom()->GetIndexMax(); Int_t module,id,ifiles,mask; Bool_t lmod; Int_t *fl = new Int_t[nfiles]; fl[0] = fRoiifile; mask = 1; - for(id=0;idGetOutputFolderName()); + if ( outRL == 0x0) + { + Error("Exec","Can not get Output Run Loader"); + return; + } + outRL->GetEvent(event); + outgime = outRL->GetLoader(loadname); + if ( outgime == 0x0) + { + Error("Exec","Can not get Output ITS Loader"); + return; + } + + outgime->LoadDigits("update"); + if (outgime->TreeD() == 0x0) outgime->MakeTree("D"); + // Digitize - fITS->MakeBranchInTreeD(GetManager()->GetTreeD()); + fITS->MakeBranchInTreeD(outgime->TreeD()); + if(fRoif!=0) { + AliDebug(1,"Region of Interest digitization selected"); + } + else { + AliDebug(1,"No Region of Interest selected. Digitizing everything"); + } + if(fModActive==0) fRoif = 0; // fModActive array must be define for RIO cuts. + + for(ifiles=0; ifilesGetInputFolderName(fl[ifiles])); + ingime = inRL->GetLoader(loadname); + if (ingime->TreeS() == 0x0) ingime->LoadSDigits(); + } - for(module=0; moduleGetITSgeom()->GetModuleType(module); - if(!all && !det[id]) continue; - iDetType = fITS->DetType( id ); - sim = (AliITSsimulation*)iDetType->GetSimulationModel(); - if(!sim) { + for(module=0; moduleGetITSgeom()->GetModuleType(module); + if(!all && !det[id]) continue; + sim = (AliITSsimulation*)fITS->GetSimulationModel(id); + if(!sim) { Error( "Exec", "The simulation class was not instanciated!" ); exit(1); } // end if !sim - - // Fill the module with the sum of SDigits + // Fill the module with the sum of SDigits sim->InitSimulationModule(module, event); //cout << "Module=" << module; - for(ifiles=0; ifilesGetEvent( module ); lmod = sim->AddSDigitsToModule(sdig,mask); - if(ifiles==0){ - fActive[module] = lmod; - } // end if - //cout << " fActive["<Digits - sim->FinishSDigitiseModule(); + sim->FinishSDigitiseModule(); // fills all branches - wasted disk space - GetManager()->GetTreeD()->Fill(); - fITS->ResetDigits(); + outgime->TreeD()->Fill(); + fITS->ResetDigits(); } // end for module - //cout << "end modules loop"<GetTreeD()->AutoSave(); + + outgime->TreeD()->AutoSave(); + outgime->WriteDigits("OVERWRITE"); + outgime->UnloadDigits(); + for(ifiles=0; ifilesGetInputFolderName(fl[ifiles])); + ingime = inRL->GetLoader(loadname); + ingime->UnloadSDigits(); + } delete[] fl; sdig->Clear(); delete sdig; - for(Int_t i=0;iGetITSgeom()->GetIndexMax();i++) fActive[i] = kTRUE; + for(Int_t i=0;iGetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE; + + return; } //______________________________________________________________________ @@ -290,28 +310,29 @@ void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){ //cout << "Region of Interest ts="<GetITSgeom()->GetIndexMax(); for(m=0;mClear(); delete sdig; return;