From: ivana Date: Fri, 15 Jan 2010 13:04:26 +0000 (+0000) Subject: New macro for generation SDigits from raw data for merging X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=377cd3df66c47690f0c01439c51896961c7126c6;p=u%2Fmrichter%2FAliRoot.git New macro for generation SDigits from raw data for merging (Indra) --- diff --git a/MUON/MakeSDigits.C b/MUON/MakeSDigits.C new file mode 100644 index 00000000000..17e1882090a --- /dev/null +++ b/MUON/MakeSDigits.C @@ -0,0 +1,111 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id */ + +/// \ingroup macros +/// \file MakeSDigits.C +/// \brief Macro for generation SDigits from raw data for merging +/// \author Indranil Das, HEP Division, SINP (indra.das@saha.ac.in, indra.ehep@gmail.com) +/// +/// Usage : To run this code one should have $ALICE_ROOT/MUON/rootlogon.C +/// in the current working directory. Then run it from command line as, +///
aliroot MakeSDigits.C\(\""reconstructed galicefile"\",\""rawdatafile"\",\""OCDB path"\",run-numer\)
+///
+///        where inputs are : 1. galice file of local reconstruction directory
+///                           2. rootified rawdata file of local reconstruction directory.
+///                           In case the raw data are ddl files, specify the path which has "raw0", "raw1".... events
+///                           3. OCDB path
+///                           4. run number
+///        and the output is : "MUON.SDigits.root" file with the same tree and event structure as produced in simulation directory
+/// 
+/// Note: +/// galice.root and raw.root cannot be a directory read from alien +/// beacuse "muonLoader->WriteSDigits("OVERWRITE")" tries to write in reconstruction directory, +/// which will fail. For files in alien, make a local copy of the galice and raw.root file, and run the code +/// in that directory. +/// +/// Merging Hints : +/// Follow the merging procedure as specified in the \ref README_sim page, with +///
MuonSim.MergeWith("recodir_that_has_MUON.SDigits.root_from_rawdata/galice.root",nofBackground)
+/// 
+/// in the $ALICE_ROOT/MUON/runSimulation.C + +/********************************************************************** + Created on : 11/01/2010 + Purpose : To create SDigits from RawData + Author : Indranil Das, HEP Division, SINP + Email : indra.das@saha.ac.in | indra.ehep@gmail.com +**********************************************************************/ + + +int MakeSDigits(const char* galiceFile="galice.root", const char* rawRootFile="./raw.root", + const char* ocdb = "local://$ALICE_ROOT/OCDB", int run=0) +{ + //TGrid connect for alien ocdb + TGrid::Connect("alien://"); + + AliCDBManager *man = AliCDBManager::Instance(); + man->SetDefaultStorage(ocdb); + man->SetRun(run); + + AliMpCDB::LoadDDLStore(true); + + AliRawReader *rawReader = AliRawReader::Create(rawRootFile); + + AliRunLoader* runLoader = AliRunLoader::Open(galiceFile); + AliLoader* muonLoader = runLoader->GetDetectorLoader("MUON"); + + for(Int_t iEvent=0;iEventGetNumberOfEvents();iEvent++){ + + cout<<"Running for Event : "<NextEvent(); + runLoader->GetEvent(iEvent); + + muonLoader->LoadSDigits("update"); + muonLoader->CleanSDigits(); + if (!muonLoader->TreeS()) muonLoader->MakeSDigitsContainer(); + + TTree* treeS = muonLoader->TreeS(); + + AliMUONVDigitStore* sDigitStore = AliMUONVDigitStore::Create("AliMUONDigitStoreV2S"); + sDigitStore->Connect(*treeS,true); + + AliMUONDigitMaker *digitMaker = new AliMUONDigitMaker(false); + digitMaker->Raw2Digits(rawReader,sDigitStore,0x0); + + TIter next(sDigitStore->CreateIterator()); + AliMUONVDigit *mdigit; + + while ( (mdigit = reinterpret_cast(next())) ) { + mdigit->SetCharge(Float_t(mdigit->ADC())); + mdigit->SetADC(0); + //mdigit->Print(); + } + treeS->Fill(); + + muonLoader->WriteSDigits("OVERWRITE"); + + muonLoader->UnloadSDigits(); + + sDigitStore->Delete(); + digitMaker->Delete(); + + } + delete runLoader; + + return 0; +}