Not able to read files within a directory while using TProof

Dear experts,
I am quite new to the feature of TProof (in fact started to try my hands at it today only). So when I run few files by explicit addition of them in chain, the code works.
TProof *plite = TProof::Open("");
TChain *fChain = new TChain(“HGCalTBAnalyzer/HGCTB”);
fChain->Add(“root://eoscms.cern.ch//eos/cms//store/group/upgrade/HGCAL/simulation/2017/JulyTBv1/mc/CRAB_PrivateMC/crab_Ele100GeV/170820_214312/0000/TBGenSim_235.root”);
fChain->Add(“root://eoscms.cern.ch//eos/cms//store/group/upgrade/HGCAL/simulation/2017/JulyTBv1/mc/CRAB_PrivateMC/crab_Ele100GeV/170820_214312/0000/TBGenSim_200.root”);
fChain->SetProof();
fChain->Process(“SelectorCheck.C+”);

However when I try to read all the files from a directory changing this code as pointed out below, it give me an error :
Error in TDSet::Process: not a correctly initialized TDSet

And unfortunately I am not able to understand where this is coming from. Can anyone please help?

Thanks a lot and Best regards
Sandhya

TProof *plite = TProof::Open("");
TChain *fChain = new TChain(“HGCalTBAnalyzer/HGCTB”);

TString location = “root://eoscms.cern.ch/”;
TString path = “/eos/cms//store/group/upgrade/HGCAL/simulation/2017/JulyTBv1/mc/CRAB_PrivateMC/crab_Ele100GeV/170820_214312/0000/”;

TSystemDirectory sourceDir(“hi”,path);
TList* fileList = sourceDir.GetListOfFiles();
TIter next(fileList);
TSystemFile* filename;
int fileNumber = 0;
int maxFiles = -1;
while ((filename = (TSystemFile*)next()) && fileNumber > maxFiles){
if(fileNumber > 1)
{
TString FullPathInputFile = (location+path+filename->GetName());
std::cout<<FullPathInputFile<<std::endl;
fChain->Add(FullPathInputFile); } }

fChain->SetProof();
fChain->Process(“SelectorCheck.C+”);

Dear sandhya,

With your code snippet, fileNumber is always 0 and therefore the chain empty.
Can you check that?

G Ganis

Ah, that’s a stupid mistake. Thanks a lot for this. It works fine now. :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.