AliRoot Core  edcc906 (edcc906)
MakeSDigits.C
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
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  **************************************************************************/
15 
16 /* $Id */
17 
46 
47 /**********************************************************************
48  Created on : 11/01/2010
49  Purpose : To create SDigits from RawData
50  Author : Indranil Das, HEP Division, SINP
51  Email : indra.das@saha.ac.in | indra.ehep@gmail.com
52 **********************************************************************/
53 
54 
55 int MakeSDigits(const char* galiceFile="galice.root", const char* rawRootFile="./raw.root",
56  const char* ocdb = "local://$ALICE_ROOT/OCDB", int run=0, bool isMergeTrigger=true)
57 {
58  //TGrid connect for alien ocdb
59  TGrid::Connect("alien://");
60 
62  man->SetDefaultStorage(ocdb);
63  man->SetRun(run);
64 
66 
67  AliRawReader *rawReader = AliRawReader::Create(rawRootFile);
68 
69  AliRunLoader* runLoader = AliRunLoader::Open(galiceFile);
70  AliLoader* muonLoader = runLoader->GetDetectorLoader("MUON");
71 
72  for(Int_t iEvent=0;iEvent<runLoader->GetNumberOfEvents();iEvent++){
73 
74  cout<<"Running for Event : "<<iEvent<<endl;
75 
76  rawReader->NextEvent();
77  runLoader->GetEvent(iEvent);
78 
79  muonLoader->LoadSDigits("update");
80  muonLoader->CleanSDigits();
81  if (!muonLoader->TreeS()) muonLoader->MakeSDigitsContainer();
82 
83  TTree* treeS = muonLoader->TreeS();
84 
85  AliMUONVDigitStore* sDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S");
86  sDigitStore->Connect(*treeS,true);
87  AliMUONDigitMaker *digitMaker = new AliMUONDigitMaker(false);
88 
89  if(isMergeTrigger){
90  AliMUONVTriggerStore* triggerStore = new AliMUONTriggerStoreV1;
91  triggerStore->Connect(*treeS,true);
92  digitMaker->SetMakeTriggerDigits(true);
93  digitMaker->Raw2Digits(rawReader,sDigitStore,triggerStore);
94  }else{
95  digitMaker->Raw2Digits(rawReader,sDigitStore,0x0);
96  }
97 
98  TIter next(sDigitStore->CreateIterator());
99  AliMUONVDigit *mdigit;
100 
101  while ( (mdigit = reinterpret_cast<AliMUONVDigit *>(next())) ) {
102  if(mdigit->DetElemId()<1100){
103  mdigit->SetCharge(Float_t(mdigit->ADC()));
104  mdigit->SetADC(0);
105  }else{
106  mdigit->SetCharge(1.0);
107  }
108  //mdigit->Print();
109  }
110  treeS->Fill();
111 
112  muonLoader->WriteSDigits("OVERWRITE");
113 
114  muonLoader->UnloadSDigits();
115 
116  if(isMergeTrigger)
117  triggerStore->Delete();
118  sDigitStore->Delete();
119  digitMaker->Delete();
120 
121  }
122  delete runLoader;
123 
124  return 0;
125 }
int MakeSDigits(const char *galiceFile="galice.root", const char *rawRootFile="./raw.root", const char *ocdb="local://$ALICE_ROOT/OCDB", int run=0, bool isMergeTrigger=true)
Definition: MakeSDigits.C:55
Reading Raw data class for trigger and tracker chambers.
void SetMakeTriggerDigits(Bool_t flag=kFALSE)
Set flag whether or not we should generate digits for the trigger.
Interface for a digit container.
Implementation of AliMUONVTriggerStore.
static Bool_t LoadDDLStore(Bool_t warn=false)
Definition: AliMpCDB.cxx:149
AliLoader * GetDetectorLoader(const char *detname)
TTree * TreeS() const
Definition: AliLoader.h:85
virtual void SetCharge(Float_t q)=0
Set the charge of this digit.
virtual void CleanSDigits() const
Definition: AliLoader.h:184
Base class of a trigger information store.
virtual TIterator * CreateIterator() const =0
Create an iterator to loop over all our digits.
Int_t Raw2Digits(AliRawReader *rawReader, AliMUONVDigitStore *digitContainer=0, AliMUONVTriggerStore *triggerStore=0)
static AliRunLoader * Open(const char *filename="galice.root", const char *eventfoldername=AliConfig::GetDefaultEventFolderName(), Option_t *option="READ")
Int_t LoadSDigits(Option_t *opt="")
Definition: AliLoader.h:101
virtual void MakeSDigitsContainer() const
Definition: AliLoader.h:74
virtual Int_t WriteSDigits(Option_t *opt="") const
Definition: AliLoader.cxx:380
virtual AliMUONVDigitStore * Create() const =0
Create an (empty) object of the same concrete class as *this.
Int_t GetNumberOfEvents()
void SetRun(Int_t run)
void SetDefaultStorage(const char *dbString)
Int_t GetEvent(Int_t evno)
ABC of a MUON digit.
Definition: AliMUONVDigit.h:18
void UnloadSDigits() const
Definition: AliLoader.h:130
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)